From: Claudio Cambra Date: Thu, 17 Aug 2023 10:14:41 +0000 (+0800) Subject: Modernise FolderWatcher::changeDetected X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~9^2~19^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=128648a7354286f89a9818eb2ab4e1921ebb3512;p=nextcloud-desktop.git Modernise FolderWatcher::changeDetected Signed-off-by: Claudio Cambra --- diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp index 44b56d391..868d85370 100644 --- a/src/gui/folderwatcher.cpp +++ b/src/gui/folderwatcher.cpp @@ -160,7 +160,7 @@ void FolderWatcher::changeDetected(const QStringList &paths) // - why do we skip the file altogether instead of e.g. reducing the upload frequency? // Check if the same path was reported within the last second. - QSet pathsSet = paths.toSet(); + const auto pathsSet = paths.toSet(); if (pathsSet == _lastPaths && _timer.elapsed() < 1000) { // the same path was reported within the last second. Skip. return; @@ -172,8 +172,7 @@ void FolderWatcher::changeDetected(const QStringList &paths) QSet unlockedFiles; QSet lockedFiles; - for (int i = 0; i < paths.size(); ++i) { - QString path = paths[i]; + for (const auto &path : paths) { if (!_testNotificationPath.isEmpty() && Utility::fileNamesEqual(path, _testNotificationPath)) { _testNotificationPath.clear(); @@ -194,7 +193,7 @@ void FolderWatcher::changeDetected(const QStringList &paths) qCDebug(lcFolderWatcher) << "Locked files:" << lockedFiles.values(); - // ------- handle ignores: + // ------- handle ignores: if (pathIsIgnored(path)) { continue; } @@ -215,7 +214,7 @@ void FolderWatcher::changeDetected(const QStringList &paths) } qCInfo(lcFolderWatcher) << "Detected changes in paths:" << changedPaths; - foreach (const QString &path, changedPaths) { + for (const auto &path : changedPaths) { emit pathChanged(path); } }