summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-09 16:07:03 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-09 16:07:03 -0700
commit8e0895e429d6df04dd160b425fd52ae28ef7df46 (patch)
tree9b5d078fddaa5c5ade38e72c67e548facf3b3280 /mobile-widgets
parentf67b3a985274438153ff973ebe56128e353ff81f (diff)
downloadsubsurface-8e0895e429d6df04dd160b425fd52ae28ef7df46.tar.gz
QML UI: Download from DC: disable misleading UI elements
These buttons only work when we successfully downloaded a dive. Also, don't show a list of dives when there are no dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DownloadFromDiveComputer.qml25
1 files changed, 17 insertions, 8 deletions
diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml
index d9dc46eb4..3b9ed7dfb 100644
--- a/mobile-widgets/qml/DownloadFromDiveComputer.qml
+++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml
@@ -17,6 +17,7 @@ Kirigami.Page {
property bool selectAll : false
property alias dcImportModel: importModel
+ property bool divesDownloaded: false
DCDownloadThread {
id: downloadThread
@@ -37,8 +38,14 @@ Kirigami.Page {
onFinished : {
importModel.repopulate()
- acceptButton.enabled = true
- dcDownloadProgress.visible = false
+ progressBar.visible = false
+ if (dcImportModel.rowCount() > 0) {
+ console.log(dcImportModel.rowCount() + " dive downloaded")
+ divesDownloaded = true
+ } else {
+ console.log("no new dives downloaded")
+ divesDownloaded = false
+ }
manager.appendTextToLog("DCDownloadThread finished")
}
}
@@ -105,7 +112,7 @@ Kirigami.Page {
}
ProgressBar {
- id: dcDownloadProgress
+ id: progressBar
Layout.fillWidth: true
indeterminate: true
visible: false
@@ -140,7 +147,7 @@ Kirigami.Page {
downloadThread.deviceData.product = product;
}
manager.appendTextToLog("DCDownloadThread started for " + downloadThread.deviceData.devName)
- dcDownloadProgress.visible = true
+ progressBar.visible = true
downloadThread.start()
}
}
@@ -196,8 +203,9 @@ Kirigami.Page {
}
Button {
id: acceptButton
+ enabled: divesDownloaded
background: Rectangle {
- color: subsurfaceTheme.darkerPrimaryColor
+ color: enabled ? subsurfaceTheme.darkerPrimaryColor : "gray"
antialiasing: true
radius: Kirigami.Units.smallSpacing * 2
}
@@ -206,7 +214,6 @@ Kirigami.Page {
text: acceptButton.text
color: subsurfaceTheme.darkerPrimaryTextColor
}
- enabled: false
onClicked: {
manager.appendTextToLog("Save downloaded dives that were selected")
importModel.recordDives()
@@ -222,8 +229,9 @@ Kirigami.Page {
}
Button {
id: select
+ enabled: divesDownloaded
background: Rectangle {
- color: subsurfaceTheme.darkerPrimaryColor
+ color: enabled ? subsurfaceTheme.darkerPrimaryColor : "gray"
antialiasing: true
radius: Kirigami.Units.smallSpacing * 2
}
@@ -239,8 +247,9 @@ Kirigami.Page {
}
Button {
id: unselect
+ enabled: divesDownloaded
background: Rectangle {
- color: subsurfaceTheme.darkerPrimaryColor
+ color: enabled ? subsurfaceTheme.darkerPrimaryColor : "gray"
antialiasing: true
radius: Kirigami.Units.smallSpacing * 2
}