summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-03 18:13:22 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-04 14:17:45 -0700
commiteea1ff6a83a318d7749110baa81c249a6faea8ef (patch)
tree05867047169d211f85815b3ecb577d74c08c99b6 /qt-mobile/qmlmanager.cpp
parent8b710f4d6cde00bf598031fafa9e3f1d8c2708a5 (diff)
downloadsubsurface-eea1ff6a83a318d7749110baa81c249a6faea8ef.tar.gz
Change the git progress update callback signature
This way we can include additional text. This will be used in later patches. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r--qt-mobile/qmlmanager.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index 96ab5421c..5589bffd5 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -7,6 +7,8 @@
#include <QDesktopServices>
#include <QTextDocument>
#include <QRegularExpression>
+#include <QApplication>
+#include <QElapsedTimer>
#include "qt-models/divelistmodel.h"
#include <gpslistmodel.h>
@@ -30,15 +32,24 @@ static void appendTextToLogStandalone(const char *text)
self->appendTextToLog(QString(text));
}
-extern "C" int gitProgressCB(int percent)
+extern "C" int gitProgressCB(int percent, const char *text)
{
- static int lastPercent = -10;
+ static QElapsedTimer timer;
+ static qint64 lastTime = 0;
- if (percent - lastPercent >= 10) {
- lastPercent += 10;
- QMLManager *self = QMLManager::instance();
- if (self)
- self->loadDiveProgress(percent);
+ if (!timer.isValid() || percent == 0) {
+ timer.restart();
+ lastTime = 0;
+ }
+ QMLManager *self = QMLManager::instance();
+ if (self) {
+ qint64 elapsed = timer.elapsed();
+ self->loadDiveProgress(percent);
+ self->appendTextToLog(QString::number(elapsed / 1000.0, 'f', 1) + " / " + QString::number((elapsed - lastTime) / 1000.0, 'f', 3) +
+ QString(" : git progress %1 (%2)").arg(percent).arg(text));
+ qApp->processEvents();
+ qApp->flush();
+ lastTime = elapsed;
}
// return 0 so that we don't end the download
return 0;