diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp index 2bdafd650..c278617e9 100644 --- a/src/mirall/accountsettings.cpp +++ b/src/mirall/accountsettings.cpp @@ -643,12 +643,18 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf if (Progress::isSizeDependent(curItem._instruction)) { QString s1 = Utility::octetsToString( curItemProgress ); QString s2 = Utility::octetsToString( curItem._size ); - //: 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::timeToDescriptiveString(progress.getFileEstimate(curItem).getEtaEstimate(), 3, " ", true), - Utility::octetsToString(progress.getFileEstimate(curItem).getEstimatedBandwidth()) ); - } else { + quint64 estimatedBw = progress.getFileEstimate(curItem).getEstimatedBandwidth(); + if (estimatedBw) { + //: 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::timeToDescriptiveString(progress.getFileEstimate(curItem).getEtaEstimate(), 3, " ", true), + Utility::octetsToString(estimatedBw) ); + } else { + //: Example text: "uploading foobar.png (2MB of 2MB)" + fileProgressString = tr("%1 %2 (%3 of %4)") .arg(kindString, itemFileName, s1, s2); + } + } else if (!kindString.isEmpty()) { //: Example text: "uploading foobar.png" fileProgressString = tr("%1 %2").arg(kindString, itemFileName); } @@ -657,12 +663,18 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf // overall progress quint64 completedSize = progress.completedSize(); quint64 currentFile = progress._completedFileCount + progress._currentItems.count(); - QString s1 = Utility::octetsToString( completedSize ); - QString s2 = Utility::octetsToString( progress._totalSize ); - QString overallSyncString = tr("%1 of %2, file %3 of %4\nTotal time left %5") - .arg(s1, s2) - .arg(currentFile).arg(progress._totalFileCount) - .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate(), 3, " ", true) ); + QString overallSyncString; + if (progress._totalSize > 0) { + QString s1 = Utility::octetsToString( completedSize ); + QString s2 = Utility::octetsToString( progress._totalSize ); + overallSyncString = tr("%1 of %2, file %3 of %4\nTotal time left %5") + .arg(s1, s2) + .arg(currentFile).arg(progress._totalFileCount) + .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate(), 3, " ", true) ); + } else if (progress._totalFileCount > 0) { + // Don't attemt to estimate the time left if there is no kb to transfer. + overallSyncString = tr("file %1 of %2") .arg(currentFile).arg(progress._totalFileCount); + } item->setData( overallSyncString, FolderStatusDelegate::SyncProgressOverallString ); diff --git a/src/mirall/progressdispatcher.cpp b/src/mirall/progressdispatcher.cpp index ccf402593..b0f8a0be8 100644 --- a/src/mirall/progressdispatcher.cpp +++ b/src/mirall/progressdispatcher.cpp @@ -75,9 +75,9 @@ QString Progress::asActionString( const SyncFileItem &item ) return QCoreApplication::translate( "progress", "error"); case CSYNC_INSTRUCTION_NONE: case CSYNC_INSTRUCTION_EVAL: - return QCoreApplication::translate( "progress", "unknown"); + break; } - return QCoreApplication::translate( "progress", "unknown"); + return QString(); } bool Progress::isWarningKind( SyncFileItem::Status kind)