From ffd6c6213dd8fe1b2aeab54b3f0788a5a48cbe70 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 27 Mar 2015 14:40:33 +0100 Subject: [PATCH] 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 f46cf80b131..a6858043ae7 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 94110a9bc62..46b6fd9ba10 100644 --- a/src/gui/accountsettings.h +++ b/src/gui/accountsettings.h @@ -98,6 +98,7 @@ protected slots: QStringList _generalErrors; bool _wasDisabledBefore; AccountState *_accountState; + QElapsedTimer _lastProgressUpdate; private slots: void slotFolderSyncStateChange(); void slotAccountStateChanged(AccountState*);