mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-14 17:51:41 +03:00
AccountSettings: Update progress only twice per second. #3014
This commit is contained in:
parent
d1e46056ae
commit
0f33e266ce
2 changed files with 12 additions and 0 deletions
|
@ -119,6 +119,8 @@ AccountSettings::AccountSettings(QWidget *parent) :
|
||||||
connect(folderMan, SIGNAL(folderListLoaded(Folder::Map)),
|
connect(folderMan, SIGNAL(folderListLoaded(Folder::Map)),
|
||||||
this, SLOT(setFolderList(Folder::Map)));
|
this, SLOT(setFolderList(Folder::Map)));
|
||||||
setFolderList(FolderMan::instance()->map());
|
setFolderList(FolderMan::instance()->map());
|
||||||
|
|
||||||
|
_lastProgressUpdate.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountSettings::slotAccountStateChanged(AccountState *newAccountState)
|
void AccountSettings::slotAccountStateChanged(AccountState *newAccountState)
|
||||||
|
@ -607,6 +609,15 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
|
||||||
return;
|
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()
|
if(!progress._lastCompletedItem.isEmpty()
|
||||||
&& Progress::isWarningKind(progress._lastCompletedItem._status)) {
|
&& Progress::isWarningKind(progress._lastCompletedItem._status)) {
|
||||||
int warnCount = item->data(FolderStatusDelegate::WarningCount).toInt();
|
int warnCount = item->data(FolderStatusDelegate::WarningCount).toInt();
|
||||||
|
|
|
@ -98,6 +98,7 @@ private:
|
||||||
QStringList _generalErrors;
|
QStringList _generalErrors;
|
||||||
bool _wasDisabledBefore;
|
bool _wasDisabledBefore;
|
||||||
AccountState *_accountState;
|
AccountState *_accountState;
|
||||||
|
QElapsedTimer _lastProgressUpdate;
|
||||||
private slots:
|
private slots:
|
||||||
void slotFolderSyncStateChange();
|
void slotFolderSyncStateChange();
|
||||||
void slotAccountStateChanged(AccountState*);
|
void slotAccountStateChanged(AccountState*);
|
||||||
|
|
Loading…
Reference in a new issue