QML UI: show progress messages on the download page

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-07-09 16:07:48 -07:00
parent 8e0895e429
commit 9111ce01e7
2 changed files with 13 additions and 3 deletions

View file

@ -169,9 +169,10 @@ Kirigami.Page {
} }
} }
} }
Kirigami.Label { Kirigami.Label {
text: qsTr(" Downloaded dives") text: divesDownloaded ? qsTr(" Downloaded dives") :
(manager.progressMessage != "" ? qsTr("Info:") + " " + manager.progressMessage : qsTr(" No dives"))
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
} }
ListView { ListView {

View file

@ -33,6 +33,15 @@ QMLManager *QMLManager::m_instance = NULL;
#define NOCLOUD_LOCALSTORAGE format_string("%s/cloudstorage/localrepo[master]", system_default_directory()) #define NOCLOUD_LOCALSTORAGE format_string("%s/cloudstorage/localrepo[master]", system_default_directory())
static void progressCallback(const char *text)
{
QMLManager *self = QMLManager::instance();
if (self) {
self->appendTextToLog(QString(text));
self->setProgressMessage(QString(text));
}
}
static void appendTextToLogStandalone(const char *text) static void appendTextToLogStandalone(const char *text)
{ {
QMLManager *self = QMLManager::instance(); QMLManager *self = QMLManager::instance();
@ -93,7 +102,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
setShowPin(false); setShowPin(false);
// create location manager service // create location manager service
locationProvider = new GpsLocation(&appendTextToLogStandalone, this); locationProvider = new GpsLocation(&appendTextToLogStandalone, this);
progress_callback = &appendTextToLogStandalone; progress_callback = &progressCallback;
connect(locationProvider, SIGNAL(haveSourceChanged()), this, SLOT(hasLocationSourceChanged())); connect(locationProvider, SIGNAL(haveSourceChanged()), this, SLOT(hasLocationSourceChanged()));
setLocationServiceAvailable(locationProvider->hasLocationsSource()); setLocationServiceAvailable(locationProvider->hasLocationsSource());
set_git_update_cb(&gitProgressCB); set_git_update_cb(&gitProgressCB);