Skip to content

Commit

Permalink
gui: make SyncEngine::ProgressInfo return a pointer, change position …
Browse files Browse the repository at this point in the history
…of `const` in method implementations

Signed-off-by: Jyrki Gadinger <[email protected]>
  • Loading branch information
nilsding committed Sep 2, 2024
1 parent 0c10eb9 commit a19b493
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ void FolderMan::slotLeaveShare(const QString &localFile, const QByteArray &folde
void FolderMan::trayOverallStatus(const QList<Folder *> &folders,
SyncResult::Status *status,
bool *unresolvedConflicts,
const ProgressInfo **overallProgressInfo)
ProgressInfo **const overallProgressInfo)
{
*status = SyncResult::Undefined;
*unresolvedConflicts = false;
Expand Down Expand Up @@ -1647,7 +1647,7 @@ void FolderMan::trayOverallStatus(const QList<Folder *> &folders,
}
}
*unresolvedConflicts = syncResult.hasUnresolvedConflicts();
*overallProgressInfo = &folder->syncEngine().progressInfo();
*overallProgressInfo = folder->syncEngine().progressInfo();
}
} else {
auto errorsSeen = false;
Expand Down 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, ProgressInfo *const progress)
{
QString folderMessage;
switch (syncStatus) {
Expand Down
5 changes: 2 additions & 3 deletions src/gui/folderman.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ 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, ProgressInfo *progress);

/// Compute status summarizing multiple folders
static void
trayOverallStatus(const QList<Folder *> &folders, SyncResult::Status *status, bool *unresolvedConflicts, const ProgressInfo **overallProgressInfo);
static void trayOverallStatus(const QList<Folder *> &folders, SyncResult::Status *status, bool *unresolvedConflicts, ProgressInfo **overallProgressInfo);

// Escaping of the alias which is used in QSettings AND the file
// system, thus need to be escaped.
Expand Down
4 changes: 2 additions & 2 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 = nullptr;
ProgressInfo *overallProgressInfo = nullptr;
FolderMan::trayOverallStatus(map.values(), &overallStatus, &hasUnresolvedConflicts, &overallProgressInfo);

#ifdef BUILD_FILE_PROVIDER_MODULE
Expand Down Expand Up @@ -430,7 +430,7 @@ void ownCloudGui::slotComputeOverallSyncStatus()
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
4 changes: 2 additions & 2 deletions src/libsync/syncengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class OWNCLOUDSYNC_EXPORT SyncEngine : public QObject
[[nodiscard]] SyncOptions syncOptions() const { return _syncOptions; }
[[nodiscard]] bool ignoreHiddenFiles() const { return _ignore_hidden_files; }

[[nodiscard]] const ProgressInfo &progressInfo() const
[[nodiscard]] ProgressInfo *progressInfo() const
{
return *_progressInfo;
return _progressInfo.get();
}

[[nodiscard]] ExcludedFiles &excludedFiles() const { return *_excludedFiles; }
Expand Down

0 comments on commit a19b493

Please sign in to comment.