[Pkg-owncloud-commits] [owncloud-client] 34/498: AccountSettings: Update progress only twice per second. #3014

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 0f33e266cede90f56824cd92a19a8fd8b3c2801a
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Fri Mar 27 14:40:33 2015 +0100

    AccountSettings: Update progress only twice per second. #3014
---
 src/gui/accountsettings.cpp | 11 +++++++++++
 src/gui/accountsettings.h   |  1 +
 2 files changed, 12 insertions(+)

diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index f46cf80..a685804 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -119,6 +119,8 @@ AccountSettings::AccountSettings(QWidget *parent) :
     connect(folderMan, SIGNAL(folderListLoaded(Folder::Map)),
             this, SLOT(setFolderList(Folder::Map)));
     setFolderList(FolderMan::instance()->map());
+
+    _lastProgressUpdate.start();
 }
 
 void AccountSettings::slotAccountStateChanged(AccountState *newAccountState)
@@ -607,6 +609,15 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
         return;
     }
 
+    // Don't update progess too often.
+    const int msBetweenProgressUpdates = 500;
+    if (_lastProgressUpdate.elapsed() < msBetweenProgressUpdates) {
+        qDebug() << "skip progress";
+        return;
+    }
+    _lastProgressUpdate.restart();
+
+
     if(!progress._lastCompletedItem.isEmpty()
             && Progress::isWarningKind(progress._lastCompletedItem._status)) {
         int warnCount = item->data(FolderStatusDelegate::WarningCount).toInt();
diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h
index 94110a9..46b6fd9 100644
--- a/src/gui/accountsettings.h
+++ b/src/gui/accountsettings.h
@@ -98,6 +98,7 @@ private:
     QStringList _generalErrors;
     bool _wasDisabledBefore;
     AccountState *_accountState;
+    QElapsedTimer _lastProgressUpdate;
 private slots:
     void slotFolderSyncStateChange();
     void slotAccountStateChanged(AccountState*);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list