AccountSettings: Update progress only twice per second. #3014

This commit is contained in:
Christian Kamm 2015-03-27 14:40:33 +01:00
parent d1e46056ae
commit 0f33e266ce
2 changed files with 12 additions and 0 deletions

View file

@ -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();

View file

@ -98,6 +98,7 @@ private:
QStringList _generalErrors;
bool _wasDisabledBefore;
AccountState *_accountState;
QElapsedTimer _lastProgressUpdate;
private slots:
void slotFolderSyncStateChange();
void slotAccountStateChanged(AccountState*);