Skip to content

Commit

Permalink
fixup! gui: add some extra syncing details to the tray tooltips
Browse files Browse the repository at this point in the history
Signed-off-by: Jyrki Gadinger <[email protected]>
  • Loading branch information
nilsding committed Aug 30, 2024
1 parent c9fbcec commit 1f3a6e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ void FolderMan::trayOverallStatus(const QList<Folder *> &folders,
}
}

QString FolderMan::trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo &progress)
QString FolderMan::trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo *progress)
{
QString folderMessage;
switch (syncStatus) {
Expand All @@ -1728,22 +1728,22 @@ QString FolderMan::trayTooltipStatusString(SyncResult::Status syncStatus, bool h
folderMessage = tr("Preparing for sync.");
break;
case SyncResult::SyncRunning:
if (progress.status() == ProgressInfo::Propagation) {
if (progress.totalSize() == 0) {
qint64 currentFile = progress.currentFile();
qint64 totalFileCount = qMax(progress.totalFiles(), currentFile);
if (progress.trustEta()) {
if (progress && progress->status() == ProgressInfo::Propagation) {
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));
.arg(Utility::durationToDescriptiveString2(progress->totalProgress().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));
QString totalSizeStr = Utility::octetsToString(progress->totalSize());
if (progress->trustEta()) {
folderMessage = tr("Syncing %1 (%2 left)").arg(totalSizeStr, Utility::durationToDescriptiveString2(progress->totalProgress().estimatedEta));
} else {
folderMessage = tr("Syncing %1").arg(totalSizeStr);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/folderman.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class FolderMan : public QObject
bool startFromScratch(const QString &);

/// Produce text for use in the tray tooltip
static QString trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo &progress);
static QString trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo *progress);

/// Compute status summarizing multiple folders
static void
Expand Down
6 changes: 3 additions & 3 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ void ownCloudGui::slotComputeOverallSyncStatus()

SyncResult::Status overallStatus = SyncResult::Undefined;
bool hasUnresolvedConflicts = false;
const ProgressInfo *overallProgressInfo;
const ProgressInfo *overallProgressInfo = nullptr;
FolderMan::trayOverallStatus(map.values(), &overallStatus, &hasUnresolvedConflicts, &overallProgressInfo);

#ifdef BUILD_FILE_PROVIDER_MODULE
Expand Down Expand Up @@ -422,15 +422,15 @@ void ownCloudGui::slotComputeOverallSyncStatus()
#endif
#ifdef Q_OS_WIN
// Windows has a 128-char tray tooltip length limit.
trayMessage = folderMan->trayTooltipStatusString(overallStatus, hasUnresolvedConflicts, false, *overallProgressInfo);
trayMessage = folderMan->trayTooltipStatusString(overallStatus, hasUnresolvedConflicts, false, overallProgressInfo);
#else
QStringList allStatusStrings;
const auto folders = map.values();
for (const auto folder : folders) {
QString folderMessage = FolderMan::trayTooltipStatusString(folder->syncResult().status(),
folder->syncResult().hasUnresolvedConflicts(),
folder->syncPaused(),
folder->syncEngine().progressInfo());
&folder->syncEngine().progressInfo());
allStatusStrings += tr("%1: %2").arg(folder->shortGuiLocalPath(), folderMessage);
}
#ifdef BUILD_FILE_PROVIDER_MODULE
Expand Down

0 comments on commit 1f3a6e9

Please sign in to comment.