Skip to content

Commit

Permalink
Progress: Show real speed and all filenames #3403 #3095
Browse files Browse the repository at this point in the history
  • Loading branch information
guruz committed Aug 6, 2015
1 parent 2cf2935 commit 1feb749
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/gui/folderstatusmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,31 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
SyncFileItem curItem = progress._lastCompletedItem;
qint64 curItemProgress = -1; // -1 means finished
quint64 biggerItemSize = -1;
quint64 estimatedUpBw = 0;
quint64 estimatedDownBw = 0;
QString allFilenames;
foreach(const ProgressInfo::ProgressItem &citm, progress._currentItems) {
if (curItemProgress == -1 || (ProgressInfo::isSizeDependent(citm._item)
&& biggerItemSize < citm._item._size)) {
curItemProgress = citm._progress.completed();
curItem = citm._item;
biggerItemSize = citm._item._size;
}
if (citm._item._direction != SyncFileItem::Up){
estimatedDownBw += progress.fileProgress(citm._item).estimatedBandwidth;
//qDebug() << "DOWN" << citm._item._file << progress.fileProgress(citm._item).estimatedBandwidth;
} else {
estimatedUpBw += progress.fileProgress(citm._item).estimatedBandwidth;
//qDebug() << "UP" << citm._item._file << progress.fileProgress(citm._item).estimatedBandwidth;
}
if (allFilenames.length() > 0) {
allFilenames.append(", ");
}
allFilenames.append('\'');
allFilenames.append(QFileInfo(citm._item._file).fileName());
allFilenames.append('\'');
}
//qDebug() << "Syncing bandwidth" << estimatedDownBw << estimatedUpBw;
if (curItemProgress == -1) {
curItemProgress = curItem._size;
}
Expand All @@ -680,13 +697,24 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
if (ProgressInfo::isSizeDependent(curItem)) {
QString s1 = Utility::octetsToString( curItemProgress );
QString s2 = Utility::octetsToString( curItem._size );
quint64 estimatedBw = progress.fileProgress(curItem).estimatedBandwidth;
if (estimatedBw) {
//quint64 estimatedBw = progress.fileProgress(curItem).estimatedBandwidth;
if (estimatedUpBw || estimatedDownBw) {
/*
//: Example text: "uploading foobar.png (1MB of 2MB) time left 2 minutes at a rate of 24Kb/s"
fileProgressString = tr("%1 %2 (%3 of %4) %5 left at a rate of %6/s")
.arg(kindString, itemFileName, s1, s2,
Utility::durationToDescriptiveString(progress.fileProgress(curItem).estimatedEta),
Utility::octetsToString(estimatedBw) );
*/
fileProgressString = tr("Syncing %1").arg(allFilenames);
if (estimatedDownBw > 0) {
fileProgressString.append(", ");
fileProgressString.append(tr("\u2193" " %1/s").arg(Utility::octetsToString(estimatedDownBw)));
}
if (estimatedUpBw > 0) {
fileProgressString.append(", ");
fileProgressString.append(tr("\u2191" " %1/s").arg(Utility::octetsToString(estimatedUpBw)));
}
} else {
//: Example text: "uploading foobar.png (2MB of 2MB)"
fileProgressString = tr("%1 %2 (%3 of %4)") .arg(kindString, itemFileName, s1, s2);
Expand Down

0 comments on commit 1feb749

Please sign in to comment.