mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
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>
This commit is contained in:
parent
f67b3a9852
commit
8e0895e429
1 changed files with 17 additions and 8 deletions
|
@ -17,6 +17,7 @@ Kirigami.Page {
|
||||||
|
|
||||||
property bool selectAll : false
|
property bool selectAll : false
|
||||||
property alias dcImportModel: importModel
|
property alias dcImportModel: importModel
|
||||||
|
property bool divesDownloaded: false
|
||||||
|
|
||||||
DCDownloadThread {
|
DCDownloadThread {
|
||||||
id: downloadThread
|
id: downloadThread
|
||||||
|
@ -37,8 +38,14 @@ Kirigami.Page {
|
||||||
|
|
||||||
onFinished : {
|
onFinished : {
|
||||||
importModel.repopulate()
|
importModel.repopulate()
|
||||||
acceptButton.enabled = true
|
progressBar.visible = false
|
||||||
dcDownloadProgress.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")
|
manager.appendTextToLog("DCDownloadThread finished")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +112,7 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressBar {
|
ProgressBar {
|
||||||
id: dcDownloadProgress
|
id: progressBar
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
indeterminate: true
|
indeterminate: true
|
||||||
visible: false
|
visible: false
|
||||||
|
@ -140,7 +147,7 @@ Kirigami.Page {
|
||||||
downloadThread.deviceData.product = product;
|
downloadThread.deviceData.product = product;
|
||||||
}
|
}
|
||||||
manager.appendTextToLog("DCDownloadThread started for " + downloadThread.deviceData.devName)
|
manager.appendTextToLog("DCDownloadThread started for " + downloadThread.deviceData.devName)
|
||||||
dcDownloadProgress.visible = true
|
progressBar.visible = true
|
||||||
downloadThread.start()
|
downloadThread.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,8 +203,9 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: acceptButton
|
id: acceptButton
|
||||||
|
enabled: divesDownloaded
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: subsurfaceTheme.darkerPrimaryColor
|
color: enabled ? subsurfaceTheme.darkerPrimaryColor : "gray"
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
radius: Kirigami.Units.smallSpacing * 2
|
radius: Kirigami.Units.smallSpacing * 2
|
||||||
}
|
}
|
||||||
|
@ -206,7 +214,6 @@ Kirigami.Page {
|
||||||
text: acceptButton.text
|
text: acceptButton.text
|
||||||
color: subsurfaceTheme.darkerPrimaryTextColor
|
color: subsurfaceTheme.darkerPrimaryTextColor
|
||||||
}
|
}
|
||||||
enabled: false
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
manager.appendTextToLog("Save downloaded dives that were selected")
|
manager.appendTextToLog("Save downloaded dives that were selected")
|
||||||
importModel.recordDives()
|
importModel.recordDives()
|
||||||
|
@ -222,8 +229,9 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: select
|
id: select
|
||||||
|
enabled: divesDownloaded
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: subsurfaceTheme.darkerPrimaryColor
|
color: enabled ? subsurfaceTheme.darkerPrimaryColor : "gray"
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
radius: Kirigami.Units.smallSpacing * 2
|
radius: Kirigami.Units.smallSpacing * 2
|
||||||
}
|
}
|
||||||
|
@ -239,8 +247,9 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: unselect
|
id: unselect
|
||||||
|
enabled: divesDownloaded
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: subsurfaceTheme.darkerPrimaryColor
|
color: enabled ? subsurfaceTheme.darkerPrimaryColor : "gray"
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
radius: Kirigami.Units.smallSpacing * 2
|
radius: Kirigami.Units.smallSpacing * 2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue