2017-04-27 18:30:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-05-12 15:55:19 +00:00
|
|
|
import QtQuick 2.6
|
2017-10-12 12:25:22 +00:00
|
|
|
import QtQuick.Controls 2.2 as Controls
|
2015-07-23 11:46:02 +00:00
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Dialogs 1.2
|
2017-05-12 15:55:19 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
2015-07-23 11:46:02 +00:00
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
2018-09-27 20:09:26 +00:00
|
|
|
import org.kde.kirigami 2.4 as Kirigami
|
2015-07-23 11:46:02 +00:00
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Page {
|
2015-07-23 11:46:02 +00:00
|
|
|
id: diveComputerDownloadWindow
|
2018-09-26 12:57:12 +00:00
|
|
|
leftPadding: Kirigami.Units.gridUnit / 2
|
|
|
|
rightPadding: Kirigami.Units.gridUnit / 2
|
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
2016-05-03 19:24:00 +00:00
|
|
|
title: qsTr("Dive Computer")
|
2018-02-16 10:17:20 +00:00
|
|
|
background: Rectangle { color: subsurfaceTheme.backgroundColor }
|
2015-07-23 11:46:02 +00:00
|
|
|
|
2017-06-16 08:22:44 +00:00
|
|
|
property alias dcImportModel: importModel
|
2017-07-09 23:07:03 +00:00
|
|
|
property bool divesDownloaded: false
|
2017-10-12 07:43:40 +00:00
|
|
|
property bool btEnabled: manager.btEnabled
|
|
|
|
property string btMessage: manager.btEnabled ? "" : qsTr("Bluetooth is not enabled")
|
2018-08-08 13:02:49 +00:00
|
|
|
property alias vendor: comboVendor.currentIndex
|
|
|
|
property alias product: comboProduct.currentIndex
|
|
|
|
property alias connection: comboConnection.currentIndex
|
2017-05-29 18:36:00 +00:00
|
|
|
|
2017-05-26 14:40:50 +00:00
|
|
|
DCDownloadThread {
|
2017-05-28 09:23:03 +00:00
|
|
|
id: downloadThread
|
2017-05-26 15:53:25 +00:00
|
|
|
|
|
|
|
onFinished : {
|
|
|
|
importModel.repopulate()
|
2017-07-09 23:07:03 +00:00
|
|
|
progressBar.visible = false
|
|
|
|
if (dcImportModel.rowCount() > 0) {
|
|
|
|
console.log(dcImportModel.rowCount() + " dive downloaded")
|
|
|
|
divesDownloaded = true
|
|
|
|
} else {
|
|
|
|
console.log("no new dives downloaded")
|
|
|
|
divesDownloaded = false
|
|
|
|
}
|
2017-05-28 09:44:24 +00:00
|
|
|
manager.appendTextToLog("DCDownloadThread finished")
|
2017-05-26 15:53:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DCImportModel {
|
|
|
|
id: importModel
|
2017-05-26 14:40:50 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 19:48:43 +00:00
|
|
|
ColumnLayout {
|
2015-07-23 11:46:02 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
height: parent.height
|
2016-02-02 19:48:43 +00:00
|
|
|
width: parent.width
|
2017-05-12 15:55:19 +00:00
|
|
|
GridLayout {
|
2017-10-19 13:41:05 +00:00
|
|
|
id: buttonGrid
|
2018-06-25 08:41:29 +00:00
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing * 4
|
2017-05-12 15:55:19 +00:00
|
|
|
columns: 2
|
2018-09-26 12:57:12 +00:00
|
|
|
rowSpacing: 0
|
2018-09-25 17:58:12 +00:00
|
|
|
Controls.Label {
|
|
|
|
text: qsTr(" Vendor name: ")
|
|
|
|
font.pointSize: subsurfaceTheme.regularPointSize
|
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.ComboBox {
|
2017-05-12 16:29:45 +00:00
|
|
|
id: comboVendor
|
2017-05-12 16:17:23 +00:00
|
|
|
Layout.fillWidth: true
|
2018-09-25 17:58:12 +00:00
|
|
|
Layout.preferredHeight: fontMetrics.height * 2.5
|
2017-05-12 16:17:23 +00:00
|
|
|
model: vendorList
|
2018-06-04 16:37:43 +00:00
|
|
|
currentIndex: -1
|
2017-10-12 12:25:22 +00:00
|
|
|
delegate: Controls.ItemDelegate {
|
2017-07-17 19:07:19 +00:00
|
|
|
width: comboVendor.width
|
2018-09-25 17:58:12 +00:00
|
|
|
height: fontMetrics.height * 2.0
|
2017-07-17 19:07:19 +00:00
|
|
|
contentItem: Text {
|
|
|
|
text: modelData
|
|
|
|
font.pointSize: subsurfaceTheme.regularPointSize
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
highlighted: comboVendor.highlightedIndex === index
|
|
|
|
}
|
|
|
|
contentItem: Text {
|
|
|
|
text: comboVendor.displayText
|
|
|
|
font.pointSize: subsurfaceTheme.regularPointSize
|
|
|
|
leftPadding: Kirigami.Units.gridUnit * 0.5
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
2017-06-05 16:18:17 +00:00
|
|
|
onCurrentTextChanged: {
|
2018-06-20 03:07:08 +00:00
|
|
|
manager.DC_vendor = currentText
|
2018-06-10 16:33:28 +00:00
|
|
|
comboProduct.model = manager.getProductListFromVendor(currentText)
|
|
|
|
if (currentIndex == manager.getDetectedVendorIndex())
|
|
|
|
comboProduct.currentIndex = manager.getDetectedProductIndex(currentText)
|
2018-08-08 22:42:26 +00:00
|
|
|
if (currentText === "Atomic Aquatics") {
|
|
|
|
comboConnection.model = [ qsTr("USB device") ]
|
|
|
|
comboConnection.currentIndex = 0
|
|
|
|
} else {
|
|
|
|
comboConnection.model = connectionListModel
|
|
|
|
}
|
2017-06-05 16:18:17 +00:00
|
|
|
}
|
2017-05-12 16:17:23 +00:00
|
|
|
}
|
2018-09-25 17:58:12 +00:00
|
|
|
Controls.Label {
|
|
|
|
text: qsTr(" Dive Computer:")
|
|
|
|
font.pointSize: subsurfaceTheme.regularPointSize
|
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.ComboBox {
|
2017-05-12 16:29:45 +00:00
|
|
|
id: comboProduct
|
|
|
|
Layout.fillWidth: true
|
2018-09-25 17:58:12 +00:00
|
|
|
Layout.preferredHeight: fontMetrics.height * 2.5
|
2017-06-05 16:18:17 +00:00
|
|
|
model: null
|
2018-06-04 16:37:43 +00:00
|
|
|
currentIndex: -1
|
2017-10-12 12:25:22 +00:00
|
|
|
delegate: Controls.ItemDelegate {
|
2017-07-17 19:07:19 +00:00
|
|
|
width: comboProduct.width
|
2018-09-25 17:58:12 +00:00
|
|
|
height: fontMetrics.height * 2.0
|
2017-07-17 19:07:19 +00:00
|
|
|
contentItem: Text {
|
|
|
|
text: modelData
|
|
|
|
font.pointSize: subsurfaceTheme.regularPointSize
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
highlighted: comboProduct.highlightedIndex === index
|
|
|
|
}
|
|
|
|
contentItem: Text {
|
|
|
|
text: comboProduct.displayText
|
|
|
|
font.pointSize: subsurfaceTheme.regularPointSize
|
|
|
|
leftPadding: Kirigami.Units.gridUnit * 0.5
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
2017-07-17 04:50:28 +00:00
|
|
|
onCurrentTextChanged: {
|
2018-06-20 03:07:08 +00:00
|
|
|
manager.DC_product = currentText
|
2018-06-10 16:33:28 +00:00
|
|
|
var newIdx = manager.getMatchingAddress(comboVendor.currentText, currentText)
|
2017-07-17 13:06:22 +00:00
|
|
|
if (newIdx != -1)
|
|
|
|
comboConnection.currentIndex = newIdx
|
2017-07-17 04:50:28 +00:00
|
|
|
}
|
|
|
|
|
Mobile: wrap up fixes for BT download on Android
Major functional change in this commit is the addition of found static BT devices
to the internal administration (on Android), in a way that is equivalent to
mobile-on-desktop. So, in both cases, the list of devices in the app are
as in the list of devices on the host OS (Linux or Android). To minimize code
duplication, the btDeviceDiscovered slot is split in two parts, the part to
act as slot for the Qt BT discovery agent (Linux, so mobile-on-desktop), and
the part only needed for Android.
Remaining to be fixed: the correct handling of the QML UI selection of
vendor/product. The first default dive computer is correctly detected,
all paired devices from the virtual vendow can be selected, but clicking
through vendors results in non logical selections. It is obvious why
this is, but a fix is not straigforward at this point.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12 08:38:24 +00:00
|
|
|
onModelChanged: {
|
2018-06-10 16:33:28 +00:00
|
|
|
currentIndex = manager.getDetectedProductIndex(comboVendor.currentText)
|
Mobile: wrap up fixes for BT download on Android
Major functional change in this commit is the addition of found static BT devices
to the internal administration (on Android), in a way that is equivalent to
mobile-on-desktop. So, in both cases, the list of devices in the app are
as in the list of devices on the host OS (Linux or Android). To minimize code
duplication, the btDeviceDiscovered slot is split in two parts, the part to
act as slot for the Qt BT discovery agent (Linux, so mobile-on-desktop), and
the part only needed for Android.
Remaining to be fixed: the correct handling of the QML UI selection of
vendor/product. The first default dive computer is correctly detected,
all paired devices from the virtual vendow can be selected, but clicking
through vendors results in non logical selections. It is obvious why
this is, but a fix is not straigforward at this point.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12 08:38:24 +00:00
|
|
|
}
|
2017-05-29 22:11:11 +00:00
|
|
|
}
|
2018-09-25 17:58:12 +00:00
|
|
|
Controls.Label {
|
|
|
|
text: qsTr(" Connection:")
|
|
|
|
font.pointSize: subsurfaceTheme.regularPointSize
|
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.ComboBox {
|
2017-07-17 04:50:28 +00:00
|
|
|
id: comboConnection
|
|
|
|
Layout.fillWidth: true
|
2018-09-25 17:58:12 +00:00
|
|
|
Layout.preferredHeight: fontMetrics.height * 2.5
|
2017-07-17 04:50:28 +00:00
|
|
|
model: connectionListModel
|
|
|
|
currentIndex: -1
|
2017-10-12 12:25:22 +00:00
|
|
|
delegate: Controls.ItemDelegate {
|
2017-07-17 19:07:19 +00:00
|
|
|
width: comboConnection.width
|
2018-09-25 17:58:12 +00:00
|
|
|
height: fontMetrics.height * 2.0
|
2017-07-17 19:07:19 +00:00
|
|
|
contentItem: Text {
|
|
|
|
text: modelData
|
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
highlighted: comboConnection.highlightedIndex === index
|
|
|
|
}
|
|
|
|
contentItem: Text {
|
|
|
|
text: comboConnection.displayText
|
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
|
|
|
leftPadding: Kirigami.Units.gridUnit * 0.5
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
2017-07-17 13:36:44 +00:00
|
|
|
onCurrentTextChanged: {
|
|
|
|
// pattern that matches BT addresses
|
|
|
|
var btAddr = /[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]/ ;
|
2017-12-02 06:55:47 +00:00
|
|
|
|
|
|
|
// On iOS we store UUID instead of device address.
|
|
|
|
if (Qt.platform.os === 'ios')
|
|
|
|
btAddr = /\{?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\}/;
|
|
|
|
|
2017-07-17 13:36:44 +00:00
|
|
|
if (btAddr.test(currentText))
|
2018-06-16 02:19:49 +00:00
|
|
|
manager.DC_bluetoothMode = true
|
2017-07-17 13:36:44 +00:00
|
|
|
else
|
2018-06-16 02:19:49 +00:00
|
|
|
manager.DC_bluetoothMode = false
|
2018-08-08 23:07:58 +00:00
|
|
|
manager.DC_devName = currentText
|
2018-09-30 15:43:59 +00:00
|
|
|
dc1.enabled = dc2.enabled = dc3.enabled = dc4.enabled = true
|
|
|
|
for (var i = 1; i < 5; i++) {
|
|
|
|
if (comboProduct.currentIndex === -1 && currentText === "FTDI"){
|
2018-10-09 17:08:03 +00:00
|
|
|
if ( eval("PrefDiveComputer.vendor" + i) === comboVendor.currentText && eval("PrefDiveComputer.device" + i).toUpperCase() === currentText)
|
2018-09-30 15:43:59 +00:00
|
|
|
rememberedDCsGrid.setDC(eval("PrefDiveComputer.vendor" + i), eval("PrefDiveComputer.product" + i), ("PrefDiveComputer.device" + i))
|
|
|
|
}else if (comboProduct.currentIndex !== -1 && currentText === "FTDI") {
|
2018-10-09 17:08:03 +00:00
|
|
|
if ( eval("PrefDiveComputer.vendor" + i) === comboVendor.currentText && eval("PrefDiveComputer.product" + i) === comboProduct.currentText && eval("PrefDiveComputer.device" + i).toUpperCase() === currentText) {
|
2018-09-30 15:43:59 +00:00
|
|
|
eval("dc"+ i + ".enabled = false")
|
2018-10-09 17:08:03 +00:00
|
|
|
break
|
2018-09-30 15:43:59 +00:00
|
|
|
}
|
2018-10-09 17:08:03 +00:00
|
|
|
}else if ( eval("PrefDiveComputer.vendor" + i) === comboVendor.currentText && eval("PrefDiveComputer.product" + i) === comboProduct.currentText && eval("PrefDiveComputer.product" + i) +" " + eval("PrefDiveComputer.device" + i) === currentText) {
|
|
|
|
eval("dc"+ i + ".enabled = false")
|
|
|
|
break
|
|
|
|
}else if ( eval("PrefDiveComputer.vendor" + i) === comboVendor.currentText && eval("PrefDiveComputer.product" + i) === comboProduct.currentText && eval("PrefDiveComputer.device" + i) === currentText) {
|
2018-09-30 15:43:59 +00:00
|
|
|
eval("dc"+ i + ".enabled = false")
|
2018-10-09 17:08:03 +00:00
|
|
|
break
|
2018-09-30 15:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
2018-10-09 17:19:00 +00:00
|
|
|
download.text = qsTr("Download")
|
2018-10-09 17:08:03 +00:00
|
|
|
|
2017-07-08 16:59:48 +00:00
|
|
|
}
|
2017-05-12 16:29:45 +00:00
|
|
|
}
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
2017-05-12 15:55:19 +00:00
|
|
|
|
2018-09-22 16:17:12 +00:00
|
|
|
Controls.Label {
|
|
|
|
text: qsTr(" Previously used dive computers: ")
|
|
|
|
visible: PrefDiveComputer.vendor1 !== ""
|
|
|
|
}
|
|
|
|
Flow {
|
2018-09-21 22:42:34 +00:00
|
|
|
id: rememberedDCsGrid
|
|
|
|
visible: PrefDiveComputer.vendor1 !== ""
|
|
|
|
Layout.alignment: Qt.AlignTop
|
2018-09-22 16:17:12 +00:00
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing * 2
|
|
|
|
spacing: Kirigami.Units.smallSpacing;
|
2018-09-23 09:21:19 +00:00
|
|
|
Layout.fillWidth: true
|
2018-09-21 22:42:34 +00:00
|
|
|
function setDC(vendor, product, device) {
|
|
|
|
comboVendor.currentIndex = comboVendor.find(vendor);
|
|
|
|
comboProduct.currentIndex = comboProduct.find(product);
|
2018-09-23 05:53:43 +00:00
|
|
|
comboConnection.currentIndex = manager.getConnectionIndex(device);
|
2018-09-21 22:42:34 +00:00
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: dc1
|
|
|
|
visible: PrefDiveComputer.vendor1 !== ""
|
|
|
|
text: PrefDiveComputer.vendor1 + " - " + PrefDiveComputer.product1
|
|
|
|
onClicked: {
|
|
|
|
// update comboboxes
|
|
|
|
rememberedDCsGrid.setDC(PrefDiveComputer.vendor1, PrefDiveComputer.product1, PrefDiveComputer.device1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: dc2
|
|
|
|
visible: PrefDiveComputer.vendor2 !== ""
|
|
|
|
text: PrefDiveComputer.vendor2 + " - " + PrefDiveComputer.product2
|
|
|
|
onClicked: {
|
|
|
|
// update comboboxes
|
|
|
|
rememberedDCsGrid.setDC(PrefDiveComputer.vendor2, PrefDiveComputer.product2, PrefDiveComputer.device2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: dc3
|
|
|
|
visible: PrefDiveComputer.vendor3 !== ""
|
|
|
|
text: PrefDiveComputer.vendor3 + " - " + PrefDiveComputer.product3
|
|
|
|
onClicked: {
|
|
|
|
// update comboboxes
|
|
|
|
rememberedDCsGrid.setDC(PrefDiveComputer.vendor3, PrefDiveComputer.product3, PrefDiveComputer.device3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: dc4
|
|
|
|
visible: PrefDiveComputer.vendor4 !== ""
|
|
|
|
text: PrefDiveComputer.vendor4 + " - " + PrefDiveComputer.product4
|
|
|
|
onClicked: {
|
|
|
|
// update comboboxes
|
|
|
|
rememberedDCsGrid.setDC(PrefDiveComputer.vendor4, PrefDiveComputer.product4, PrefDiveComputer.device4)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.ProgressBar {
|
2017-07-09 23:07:03 +00:00
|
|
|
id: progressBar
|
2018-06-25 08:41:29 +00:00
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing * 4
|
2016-02-02 19:48:43 +00:00
|
|
|
Layout.fillWidth: true
|
2017-06-25 22:52:07 +00:00
|
|
|
indeterminate: true
|
2017-05-12 15:55:19 +00:00
|
|
|
visible: false
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
2017-05-12 15:55:19 +00:00
|
|
|
|
2016-02-02 19:48:43 +00:00
|
|
|
RowLayout {
|
2017-10-19 13:41:05 +00:00
|
|
|
id: buttonBar
|
2018-06-25 08:41:29 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing * 2
|
2017-07-24 00:45:55 +00:00
|
|
|
spacing: Kirigami.Units.smallSpacing
|
2017-07-25 15:19:53 +00:00
|
|
|
SsrfButton {
|
2017-07-08 13:16:42 +00:00
|
|
|
id: download
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Download")
|
2016-02-02 19:48:43 +00:00
|
|
|
onClicked: {
|
2017-06-13 07:54:21 +00:00
|
|
|
text = qsTr("Retry")
|
2017-07-17 14:43:31 +00:00
|
|
|
// strip any BT Name from the address
|
2018-06-16 02:19:49 +00:00
|
|
|
var devName = manager.DC_devName
|
2018-08-08 23:09:06 +00:00
|
|
|
if (devName != qsTr("USB device"))
|
|
|
|
manager.DC_devName = devName.replace(/^(.*) /, "")
|
2018-06-20 03:07:08 +00:00
|
|
|
manager.appendTextToLog("DCDownloadThread started for " + manager.DC_vendor + " " + manager.DC_product + " on "+ manager.DC_devName)
|
2017-07-09 23:07:03 +00:00
|
|
|
progressBar.visible = true
|
2017-05-28 09:23:03 +00:00
|
|
|
downloadThread.start()
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-25 15:19:53 +00:00
|
|
|
SsrfButton {
|
2016-02-02 19:48:43 +00:00
|
|
|
id:quitbutton
|
2017-07-19 07:16:47 +00:00
|
|
|
text: progressBar.visible ? qsTr("Cancel") : qsTr("Quit")
|
2016-02-02 19:48:43 +00:00
|
|
|
onClicked: {
|
2017-07-19 07:16:47 +00:00
|
|
|
manager.cancelDownloadDC()
|
2017-12-13 13:39:10 +00:00
|
|
|
if (!progressBar.visible) {
|
2017-07-19 07:16:47 +00:00
|
|
|
stackView.pop();
|
2017-12-13 13:39:10 +00:00
|
|
|
download.text = qsTr("Download")
|
2017-12-13 14:30:51 +00:00
|
|
|
divesDownloaded = false
|
|
|
|
manager.progressMessage = ""
|
2017-12-13 13:39:10 +00:00
|
|
|
}
|
2017-05-28 09:44:24 +00:00
|
|
|
manager.appendTextToLog("exit DCDownload screen")
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-12-05 19:58:54 +00:00
|
|
|
SsrfButton {
|
|
|
|
id:rescanbutton
|
|
|
|
text: qsTr("Rescan")
|
|
|
|
onClicked: {
|
|
|
|
manager.btRescan()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
2018-06-27 23:27:59 +00:00
|
|
|
Layout.fillWidth: true
|
2017-07-24 00:45:55 +00:00
|
|
|
text: divesDownloaded ? qsTr(" Downloaded dives") :
|
2017-07-24 00:51:48 +00:00
|
|
|
(manager.progressMessage != "" ? qsTr("Info:") + " " + manager.progressMessage : btMessage)
|
2017-07-24 00:45:55 +00:00
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
|
|
|
}
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
2017-05-26 15:53:25 +00:00
|
|
|
|
2017-05-29 17:55:36 +00:00
|
|
|
ListView {
|
2017-10-19 13:41:05 +00:00
|
|
|
id: dlList
|
2018-06-25 08:41:29 +00:00
|
|
|
Layout.topMargin: Kirigami.Units.smallSpacing * 4
|
2018-09-26 12:57:12 +00:00
|
|
|
Layout.bottomMargin: bottomButtons.height / 2
|
2017-05-29 17:55:36 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
model : importModel
|
|
|
|
delegate : DownloadedDiveDelegate {
|
2017-05-29 18:36:00 +00:00
|
|
|
id: delegate
|
2017-06-25 23:12:07 +00:00
|
|
|
datetime: model.datetime ? model.datetime : ""
|
|
|
|
duration: model.duration ? model.duration : ""
|
|
|
|
depth: model.depth ? model.depth : ""
|
|
|
|
selected: model.selected ? model.selected : false
|
2017-05-29 18:36:00 +00:00
|
|
|
|
|
|
|
onClicked : {
|
|
|
|
console.log("Selecting index" + index);
|
|
|
|
importModel.selectRow(index)
|
|
|
|
}
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
2017-05-12 15:55:19 +00:00
|
|
|
}
|
2017-05-29 17:55:36 +00:00
|
|
|
|
2016-02-02 19:48:43 +00:00
|
|
|
RowLayout {
|
2017-10-27 12:29:23 +00:00
|
|
|
id: bottomButtons
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
2017-06-25 23:12:45 +00:00
|
|
|
text: "" // Spacer on the left for hamburger menu
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2017-07-25 15:19:53 +00:00
|
|
|
SsrfButton {
|
2017-05-28 10:22:46 +00:00
|
|
|
id: acceptButton
|
2017-07-09 23:07:03 +00:00
|
|
|
enabled: divesDownloaded
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Accept")
|
2018-09-26 12:57:12 +00:00
|
|
|
bottomPadding: Kirigami.Units.gridUnit / 2
|
2016-02-02 19:48:43 +00:00
|
|
|
onClicked: {
|
2017-05-28 18:48:30 +00:00
|
|
|
manager.appendTextToLog("Save downloaded dives that were selected")
|
|
|
|
importModel.recordDives()
|
|
|
|
manager.saveChangesLocal()
|
|
|
|
diveModel.clear()
|
|
|
|
diveModel.addAllDives()
|
2016-02-02 19:48:43 +00:00
|
|
|
stackView.pop();
|
2017-12-13 13:39:10 +00:00
|
|
|
download.text = qsTr("Download")
|
2017-12-13 14:30:51 +00:00
|
|
|
divesDownloaded = false
|
2015-07-23 11:46:02 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
2016-02-02 19:48:43 +00:00
|
|
|
text: "" // Spacer between 2 button groups
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2017-07-25 15:19:53 +00:00
|
|
|
SsrfButton {
|
2017-07-08 13:16:42 +00:00
|
|
|
id: select
|
2017-07-09 23:07:03 +00:00
|
|
|
enabled: divesDownloaded
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Select All")
|
2018-09-26 12:57:12 +00:00
|
|
|
bottomPadding: Kirigami.Units.gridUnit / 2
|
2017-05-29 18:36:00 +00:00
|
|
|
onClicked : {
|
|
|
|
importModel.selectAll()
|
|
|
|
}
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
2017-07-25 15:19:53 +00:00
|
|
|
SsrfButton {
|
2017-07-08 13:16:42 +00:00
|
|
|
id: unselect
|
2017-07-09 23:07:03 +00:00
|
|
|
enabled: divesDownloaded
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Unselect All")
|
2018-09-26 12:57:12 +00:00
|
|
|
bottomPadding: Kirigami.Units.gridUnit / 2
|
2017-05-29 18:36:00 +00:00
|
|
|
onClicked : {
|
|
|
|
importModel.selectNone()
|
|
|
|
}
|
2016-02-02 19:48:43 +00:00
|
|
|
}
|
|
|
|
}
|
2018-06-04 16:37:43 +00:00
|
|
|
|
|
|
|
onVisibleChanged: {
|
2018-09-23 09:44:05 +00:00
|
|
|
comboVendor.currentIndex = comboProduct.currentIndex = comboConnection.currentIndex = -1
|
2018-09-30 15:43:59 +00:00
|
|
|
dc1.enabled = dc2.enabled = dc3.enabled = dc4.enabled = true
|
|
|
|
if (visible) {
|
|
|
|
comboVendor.currentIndex = manager.getDetectedVendorIndex()
|
|
|
|
comboProduct.currentIndex = manager.getDetectedProductIndex(comboVendor.currentText)
|
|
|
|
comboConnection.currentIndex = manager.getMatchingAddress(comboVendor.currentText, comboProduct.currentText)
|
|
|
|
|
2018-06-04 16:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
2015-07-23 11:46:02 +00:00
|
|
|
}
|
|
|
|
}
|