From 0c10eb90185c6cf95ef17006d30f6bb00694c23b Mon Sep 17 00:00:00 2001 From: Jyrki Gadinger Date: Fri, 30 Aug 2024 12:12:28 +0200 Subject: [PATCH] gui: shorten the estimated time left in tooltip Signed-off-by: Jyrki Gadinger --- src/gui/folderman.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 915f1ff7562cb..06cbf0e168d1f 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1729,21 +1729,28 @@ QString FolderMan::trayTooltipStatusString(SyncResult::Status syncStatus, bool h break; case SyncResult::SyncRunning: if (progress && progress->status() == ProgressInfo::Propagation) { + const auto estimatedEta = progress->totalProgress().estimatedEta; if (progress->totalSize() == 0) { qint64 currentFile = progress->currentFile(); qint64 totalFileCount = qMax(progress->totalFiles(), currentFile); if (progress->trustEta()) { - folderMessage = tr("Syncing %1 of %2 (%3 left)") - .arg(currentFile) - .arg(totalFileCount) - .arg(Utility::durationToDescriptiveString2(progress->totalProgress().estimatedEta)); + if (estimatedEta == 0) { + folderMessage = tr("Syncing %1 of %2 (A few seconds left)").arg(currentFile).arg(totalFileCount); + } else { + folderMessage = + tr("Syncing %1 of %2 (%3 left)").arg(currentFile).arg(totalFileCount).arg(Utility::durationToDescriptiveString1(estimatedEta)); + } } else { folderMessage = tr("Syncing %1 of %2").arg(currentFile).arg(totalFileCount); } } else { QString totalSizeStr = Utility::octetsToString(progress->totalSize()); if (progress->trustEta()) { - folderMessage = tr("Syncing %1 (%2 left)").arg(totalSizeStr, Utility::durationToDescriptiveString2(progress->totalProgress().estimatedEta)); + if (estimatedEta == 0) { + folderMessage = tr("Syncing %1 (A few seconds left)").arg(totalSizeStr, Utility::durationToDescriptiveString1(estimatedEta)); + } else { + folderMessage = tr("Syncing %1 (%2 left)").arg(totalSizeStr, Utility::durationToDescriptiveString1(estimatedEta)); + } } else { folderMessage = tr("Syncing %1").arg(totalSizeStr); }