summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/mainwindow.cpp4
-rw-r--r--qt-mobile/qmlmanager.cpp25
-rw-r--r--subsurface-core/git-access.c6
-rw-r--r--subsurface-core/git-access.h2
4 files changed, 25 insertions, 12 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index df0190e10..ca78b82af 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -66,8 +66,10 @@
QProgressDialog *progressDialog = NULL;
bool progressDialogCanceled = false;
-extern "C" int updateProgress(int percent)
+extern "C" int updateProgress(int percent, const char *text)
{
+ if (verbose)
+ qDebug() << "git storage:" << percent << "% with note" << text;
if (progressDialog)
progressDialog->setValue(percent);
return progressDialogCanceled;
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;
diff --git a/subsurface-core/git-access.c b/subsurface-core/git-access.c
index 4213d18f0..36413a55c 100644
--- a/subsurface-core/git-access.c
+++ b/subsurface-core/git-access.c
@@ -22,9 +22,9 @@
bool is_subsurface_cloud = false;
-int (*update_progress_cb)(int) = NULL;
+int (*update_progress_cb)(int, const char *) = NULL;
-void set_git_update_cb(int(*cb)(int))
+void set_git_update_cb(int(*cb)(int, const char *))
{
update_progress_cb = cb;
}
@@ -34,7 +34,7 @@ static int update_progress(int percent)
static int last_percent = -10;
int ret = 0;
if (update_progress_cb)
- ret = (*update_progress_cb)(percent);
+ ret = (*update_progress_cb)(percent, "");
if (verbose && percent - 10 >= last_percent) {
last_percent = percent;
fprintf(stderr, "git progress %d%%\n", percent);
diff --git a/subsurface-core/git-access.h b/subsurface-core/git-access.h
index 7e57351fb..272ec116e 100644
--- a/subsurface-core/git-access.h
+++ b/subsurface-core/git-access.h
@@ -23,7 +23,7 @@ extern int do_git_save(git_repository *repo, const char *branch, const char *rem
extern const char *saved_git_id;
extern void clear_git_id(void);
extern void set_git_id(const struct git_oid *);
-void set_git_update_cb(int(*cb)(int));
+void set_git_update_cb(int (*)(int, const char *));
char *get_local_dir(const char *remote, const char *branch);
#ifdef __cplusplus
}