Skip to content

Commit

Permalink
AccountSettings: Update progress only twice per second. owncloud#3014
Browse files Browse the repository at this point in the history
  • Loading branch information
ckamm committed Mar 27, 2015
1 parent ba0c325 commit ffd6c62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/gui/accountsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ protected slots:
QStringList _generalErrors;
bool _wasDisabledBefore;
AccountState *_accountState;
QElapsedTimer _lastProgressUpdate;
private slots:
void slotFolderSyncStateChange();
void slotAccountStateChanged(AccountState*);
Expand Down

0 comments on commit ffd6c62

Please sign in to comment.