diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-04-04 13:37:56 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-04 14:19:24 -0700 |
commit | e50a3470c1810d5c80ff8f96e03a50dbc9fba254 (patch) | |
tree | a6ffaf8b237750a418674a8bcb3fd9cf7da18924 | |
parent | 9283332b95d3e41f43f3300667ac7523f58ab14b (diff) | |
download | subsurface-e50a3470c1810d5c80ff8f96e03a50dbc9fba254.tar.gz |
QML UI: rate limit git progress output
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 6a38078a8..048e787cf 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -36,14 +36,19 @@ extern "C" int gitProgressCB(int percent, const char *text) { static QElapsedTimer timer; static qint64 lastTime = 0; + static int lastPercent = -100; if (!timer.isValid() || percent == 0) { timer.restart(); lastTime = 0; + lastPercent = -100; } QMLManager *self = QMLManager::instance(); if (self) { qint64 elapsed = timer.elapsed(); + // don't show the same status twice in 200ms + if (percent == lastPercent && elapsed - lastTime < 200) + return 0; self->loadDiveProgress(percent); QString logText = QString::number(elapsed / 1000.0, 'f', 1) + " / " + QString::number((elapsed - lastTime) / 1000.0, 'f', 3) + QString(" : git progress %1 (%2)").arg(percent).arg(text); |