From f58bc91d8bb81feb02d059a8f69025f8f6f5a6b0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 1 Apr 2020 06:55:12 -0700 Subject: core: add additional notification callback Especially on slower devices with a large dive list the startup time has become really long. This callback allows us to give the user an idea of what the app is doing during that time. Signed-off-by: Dirk Hohndel --- core/qthelper.cpp | 9 +++++++++ core/qthelper.h | 1 + 2 files changed, 10 insertions(+) (limited to 'core') diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 7e3b58b11..7b879e7d6 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1642,6 +1642,15 @@ char *copy_qstring(const QString &s) return strdup(qPrintable(s)); } +// function to call to allow the UI to show updates for longer running activities +void (*uiNotificationCallback)(QString msg) = nullptr; + +void uiNotification(const QString &msg) +{ + if (uiNotificationCallback != nullptr) + uiNotificationCallback(msg); +} + // function to call to get changes for a git commit QString (*changesCallback)() = nullptr; diff --git a/core/qthelper.h b/core/qthelper.h index 6e23e6768..bb8876383 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -85,6 +85,7 @@ QString getUserAgent(); QString printGPSCoords(const location_t *loc); extern QString (*changesCallback)(); +void uiNotification(const QString &msg); #if defined __APPLE__ #define TITLE_OR_TEXT(_t, _m) "", _t + "\n" + _m -- cgit v1.2.3-70-g09d2