From: Claudio Cambra Date: Wed, 19 Oct 2022 17:23:37 +0000 (+0200) Subject: Clean up methods in sync engine X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~188^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=421f5e723a5891791731e48cf9932460a97e0938;p=nextcloud-desktop.git Clean up methods in sync engine Signed-off-by: Claudio Cambra --- diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index c39d63989..d52fc1f17 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -970,11 +970,6 @@ bool SyncEngine::wasFileTouched(const QString &fn) const return false; } -AccountPtr SyncEngine::account() const -{ - return _account; -} - void SyncEngine::setLocalDiscoveryOptions(LocalDiscoveryStyle style, std::set paths) { _localDiscoveryStyle = style; diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index 3ee0b10f2..1e49aa5eb 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -65,31 +65,20 @@ public: ~SyncEngine() override; - Q_INVOKABLE void startSync(); - void setNetworkLimits(int upload, int download); - - /* Abort the sync. Called from the main thread */ - void abort(); - [[nodiscard]] bool isSyncRunning() const { return _syncRunning; } [[nodiscard]] SyncOptions syncOptions() const { return _syncOptions; } - void setSyncOptions(const SyncOptions &options) { _syncOptions = options; } [[nodiscard]] bool ignoreHiddenFiles() const { return _ignore_hidden_files; } - void setIgnoreHiddenFiles(bool ignore) { _ignore_hidden_files = ignore; } - - void addAcceptedInvalidFileName(const QString& filePath); - ExcludedFiles &excludedFiles() { return *_excludedFiles; } - Utility::StopWatch &stopWatch() { return _stopWatch; } - SyncFileStatusTracker &syncFileStatusTracker() { return *_syncFileStatusTracker; } + [[nodiscard]] ExcludedFiles &excludedFiles() const { return *_excludedFiles; } + [[nodiscard]] SyncFileStatusTracker &syncFileStatusTracker() const { return *_syncFileStatusTracker; } /* Returns whether another sync is needed to complete the sync */ - AnotherSyncNeeded isAnotherSyncNeeded() { return _anotherSyncNeeded; } + [[nodiscard]] AnotherSyncNeeded isAnotherSyncNeeded() const { return _anotherSyncNeeded; } [[nodiscard]] bool wasFileTouched(const QString &fn) const; - [[nodiscard]] AccountPtr account() const; + [[nodiscard]] AccountPtr account() const { return _account; }; [[nodiscard]] SyncJournalDb *journal() const { return _journal; } [[nodiscard]] QString localPath() const { return _localPath; } @@ -105,19 +94,6 @@ public: */ static std::chrono::milliseconds minimumFileAgeForUpload; - /** - * Control whether local discovery should read from filesystem or db. - * - * If style is DatabaseAndFilesystem, paths a set of file paths relative to - * the synced folder. All the parent directories of these paths will not - * be read from the db and scanned on the filesystem. - * - * Note, the style and paths are only retained for the next sync and - * revert afterwards. Use _lastLocalDiscoveryStyle to discover the last - * sync's style. - */ - void setLocalDiscoveryOptions(LocalDiscoveryStyle style, std::set paths = {}); - /** * Returns whether the given folder-relative path should be locally discovered * given the local discovery options. @@ -142,7 +118,32 @@ public: static void switchToVirtualFiles(const QString &localPath, SyncJournalDb &journal, Vfs &vfs); - auto getPropagator() { return _propagator; } // for the test + [[nodiscard]] QSharedPointer getPropagator() const { return _propagator; } // for the test + +public slots: + void startSync(); + + /* Abort the sync. Called from the main thread */ + void abort(); + + void setNetworkLimits(int upload, int download); + void setSyncOptions(const SyncOptions &options) { _syncOptions = options; } + void setIgnoreHiddenFiles(bool ignore) { _ignore_hidden_files = ignore; } + + /** + * Control whether local discovery should read from filesystem or db. + * + * If style is DatabaseAndFilesystem, paths a set of file paths relative to + * the synced folder. All the parent directories of these paths will not + * be read from the db and scanned on the filesystem. + * + * Note, the style and paths are only retained for the next sync and + * revert afterwards. Use _lastLocalDiscoveryStyle to discover the last + * sync's style. + */ + void setLocalDiscoveryOptions(LocalDiscoveryStyle style, std::set paths = {}); + + void addAcceptedInvalidFileName(const QString& filePath); signals: // During update, before reconcile