2017-04-27 18:30:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-10-29 12:44:22 +00:00
|
|
|
import QtQuick 2.6
|
2017-03-31 14:15:14 +00:00
|
|
|
import QtQuick.Controls 2.0
|
2017-07-15 16:11:13 +00:00
|
|
|
import QtQuick.Controls.Material 2.1
|
2015-05-27 10:34:55 +00:00
|
|
|
import QtQuick.Window 2.2
|
2015-06-04 08:27:38 +00:00
|
|
|
import QtQuick.Dialogs 1.2
|
2017-10-30 10:26:47 +00:00
|
|
|
import QtQuick.Layouts 1.2
|
2015-07-30 06:17:09 +00:00
|
|
|
import QtQuick.Window 2.2
|
2015-06-04 10:36:36 +00:00
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
2018-09-27 20:09:26 +00:00
|
|
|
import org.kde.kirigami 2.4 as Kirigami
|
2018-06-16 21:05:20 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
2015-10-08 23:57:10 +00:00
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.ApplicationWindow {
|
2015-12-03 22:27:27 +00:00
|
|
|
id: rootItem
|
2016-01-01 17:34:32 +00:00
|
|
|
title: qsTr("Subsurface-mobile")
|
2017-06-28 13:50:11 +00:00
|
|
|
reachableModeEnabled: false // while it's a good idea, it seems to confuse more than help
|
Mobile QML UI: wideScreen property change
See also 15cdcdbc6. There, we introduced the wideScreen (set to true)
to evade a (cosmetic) bug in (most likely) Kirigami. The top dive
was partially obscured on the start of the app. And by setting the
wideScreen to true, the application header became of a fixed height.
Numerous changes further in Kirigami, we can now set this property to
false. This results in a correctly displayed divelist at the start of
the app, and *also* an application header that correcly hides itself
when scrolling up, and displays itself again when scrolling down. So,
a behavior that is common to, for example, mobile brouwsers.
This all said. I still believe this is a workround for strange behavior.
In fact, we should not need to set this wideScreen property at all,
and Kirigami should behave correct in all cases (true, false, unset
at our end). It behaves correctly when set to true or false, but
still displays a partially hidden top item in the dive list when
unset.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-21 08:04:58 +00:00
|
|
|
wideScreen: false // workaround for probably Kirigami bug. See commits.
|
2018-09-22 22:57:02 +00:00
|
|
|
|
|
|
|
// the documentation claims that the ApplicationWindow should pick up the font set on
|
|
|
|
// the C++ side. But as a matter of fact, it doesn't, unless you add this line:
|
|
|
|
font: Qt.application.font
|
|
|
|
|
2016-04-22 16:12:15 +00:00
|
|
|
header: Kirigami.ApplicationHeader {
|
|
|
|
minimumHeight: 0
|
2017-06-21 16:19:24 +00:00
|
|
|
preferredHeight: Math.round(Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1.5))
|
2016-04-22 16:12:15 +00:00
|
|
|
maximumHeight: Kirigami.Units.gridUnit * 2
|
2018-02-17 08:21:25 +00:00
|
|
|
background: Rectangle { color: subsurfaceTheme.primaryColor }
|
2016-04-22 16:12:15 +00:00
|
|
|
}
|
2018-06-13 16:06:11 +00:00
|
|
|
property alias oldStatus: prefs.oldStatus
|
2017-06-18 06:22:37 +00:00
|
|
|
property alias notificationText: manager.notificationText
|
2017-07-23 07:38:40 +00:00
|
|
|
property alias locationServiceEnabled: manager.locationServiceEnabled
|
2018-08-06 13:24:51 +00:00
|
|
|
property alias pluggedInDeviceName: manager.pluggedInDeviceName
|
2018-06-13 16:06:11 +00:00
|
|
|
property alias showPin: prefs.showPin
|
2018-08-20 18:02:54 +00:00
|
|
|
property alias defaultCylinderIndex: settingsWindow.defaultCylinderIndex
|
2018-02-04 15:46:03 +00:00
|
|
|
property bool filterToggle: false
|
|
|
|
property string filterPattern: ""
|
|
|
|
|
2017-06-18 06:22:37 +00:00
|
|
|
onNotificationTextChanged: {
|
|
|
|
if (notificationText != "") {
|
|
|
|
// there's a risk that we have a >5 second gap in update events;
|
|
|
|
// still, keep the timeout at 5s to avoid odd unchanging notifications
|
|
|
|
showPassiveNotification(notificationText, 5000)
|
2016-03-03 01:14:47 +00:00
|
|
|
} else {
|
2017-06-18 06:22:37 +00:00
|
|
|
// hiding the notification right away may be a mistake as it hides the last warning / error
|
2016-03-03 18:35:33 +00:00
|
|
|
hidePassiveNotification();
|
2016-03-03 01:14:47 +00:00
|
|
|
}
|
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
FontMetrics {
|
|
|
|
id: fontMetrics
|
2017-06-20 17:56:49 +00:00
|
|
|
Component.onCompleted: {
|
mobile, QML: introduce basePointSize in subsurfaceTheme
By manipulation the used font pointSize property, we can dynamically
scale fonts and derived UI objects. At the same time, we have
some logic to determine the default font, its size, etc, for example
depending on screen properties. The scaling of the UI (and its font)
does not need to interfere with those defaults.
However, when we want to reset the pointSize, we alter the default, so
a backup of the default is needed. Ok, not al full backup, as the only
thing we like to manipulate is the pointSize, to which we want to be
able to return.
All this leads to this commit. A basePointSize property is added, that
is initialized from the default. Due to the binding logic of the QML
engine, it is not a classic initialization, but a binding between the
2 properties. We need to break that binding explicitly, so that
the original PointSize is always preserved.
In addition, a display of the new font property is added to the
developers theme test.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 10:48:48 +00:00
|
|
|
console.log("Using the following font: " + fontMetrics.font.family
|
|
|
|
+ " at " + subsurfaceTheme.basePointSize + "pt" +
|
|
|
|
" with mobile_scale: " + PrefDisplay.mobile_scale)
|
2016-09-20 13:42:34 +00:00
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
}
|
2016-01-19 20:42:58 +00:00
|
|
|
visible: false
|
2016-12-27 17:36:02 +00:00
|
|
|
|
2018-10-20 15:54:47 +00:00
|
|
|
BusyIndicator {
|
|
|
|
id: busy
|
|
|
|
running: false
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: Kirigami.Units.gridUnit
|
|
|
|
}
|
|
|
|
|
|
|
|
function showBusy() {
|
|
|
|
busy.running = true
|
2018-10-20 16:04:00 +00:00
|
|
|
diveList.diveListModel = null
|
2018-10-20 15:54:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function hideBusy() {
|
|
|
|
busy.running = false
|
2018-10-20 16:04:00 +00:00
|
|
|
diveList.diveListModel = diveModel
|
2018-10-20 15:54:47 +00:00
|
|
|
}
|
2015-06-04 08:27:38 +00:00
|
|
|
|
2016-02-11 05:47:09 +00:00
|
|
|
function returnTopPage() {
|
2018-10-12 12:57:43 +00:00
|
|
|
for (var i=pageStack.depth; i>1; i--) {
|
|
|
|
pageStack.pop()
|
2016-02-11 05:47:09 +00:00
|
|
|
}
|
|
|
|
detailsWindow.endEditMode()
|
|
|
|
}
|
|
|
|
|
2016-03-31 01:39:25 +00:00
|
|
|
function scrollToTop() {
|
|
|
|
diveList.scrollToTop()
|
|
|
|
}
|
|
|
|
|
2018-03-08 20:22:35 +00:00
|
|
|
function showMap() {
|
|
|
|
globalDrawer.close()
|
|
|
|
returnTopPage()
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(mapPage)
|
2016-04-02 12:09:40 +00:00
|
|
|
}
|
|
|
|
|
2016-04-02 03:29:39 +00:00
|
|
|
function startAddDive() {
|
|
|
|
detailsWindow.state = "add"
|
|
|
|
detailsWindow.dive_id = manager.addDive();
|
|
|
|
detailsWindow.number = manager.getNumber(detailsWindow.dive_id)
|
|
|
|
detailsWindow.date = manager.getDate(detailsWindow.dive_id)
|
|
|
|
detailsWindow.airtemp = ""
|
|
|
|
detailsWindow.watertemp = ""
|
2018-01-28 09:26:45 +00:00
|
|
|
detailsWindow.buddyModel = manager.buddyList
|
2016-05-20 16:48:36 +00:00
|
|
|
detailsWindow.buddyIndex = -1
|
2017-04-15 00:09:09 +00:00
|
|
|
detailsWindow.buddyText = ""
|
2016-04-02 03:29:39 +00:00
|
|
|
detailsWindow.depth = ""
|
2018-01-28 10:28:01 +00:00
|
|
|
detailsWindow.divemasterModel = manager.divemasterList
|
2016-05-20 16:48:36 +00:00
|
|
|
detailsWindow.divemasterIndex = -1
|
2017-04-15 00:09:09 +00:00
|
|
|
detailsWindow.divemasterText = ""
|
2016-04-02 03:29:39 +00:00
|
|
|
detailsWindow.notes = ""
|
|
|
|
detailsWindow.location = ""
|
2016-04-15 12:17:39 +00:00
|
|
|
detailsWindow.gps = ""
|
2016-04-02 03:29:39 +00:00
|
|
|
detailsWindow.duration = ""
|
2018-01-28 08:52:51 +00:00
|
|
|
detailsWindow.suitModel = manager.suitList
|
2016-05-20 16:48:36 +00:00
|
|
|
detailsWindow.suitIndex = -1
|
2017-04-15 00:09:09 +00:00
|
|
|
detailsWindow.suitText = ""
|
2018-07-28 13:43:05 +00:00
|
|
|
detailsWindow.cylinderModel0 = manager.cylinderInit
|
|
|
|
detailsWindow.cylinderModel1 = manager.cylinderInit
|
|
|
|
detailsWindow.cylinderModel2 = manager.cylinderInit
|
|
|
|
detailsWindow.cylinderModel3 = manager.cylinderInit
|
|
|
|
detailsWindow.cylinderModel4 = manager.cylinderInit
|
2018-09-04 09:18:43 +00:00
|
|
|
detailsWindow.cylinderIndex0 = PrefGeneral.default_cylinder == "" ? -1 : detailsWindow.cylinderModel0.indexOf(PrefGeneral.default_cylinder)
|
2018-07-28 13:43:05 +00:00
|
|
|
detailsWindow.usedCyl = ["",]
|
2016-04-02 03:29:39 +00:00
|
|
|
detailsWindow.weight = ""
|
2018-07-28 13:43:05 +00:00
|
|
|
detailsWindow.usedGas = []
|
|
|
|
detailsWindow.startpressure = []
|
|
|
|
detailsWindow.endpressure = []
|
2016-04-15 12:17:39 +00:00
|
|
|
detailsWindow.gpsCheckbox = false
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(detailsWindow)
|
2016-04-02 03:29:39 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
globalDrawer: Kirigami.GlobalDrawer {
|
2018-06-16 21:05:20 +00:00
|
|
|
topContent: Image {
|
|
|
|
source: "qrc:/qml/icons/dive.jpg"
|
|
|
|
Layout.fillWidth: true
|
|
|
|
sourceSize.width: parent.width
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
LinearGradient {
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
top: parent.top
|
|
|
|
}
|
|
|
|
height: textblock.height * 2
|
|
|
|
start: Qt.point(0, 0)
|
|
|
|
end: Qt.point(0, height)
|
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop {
|
|
|
|
position: 0.0
|
|
|
|
color: Qt.rgba(0, 0, 0, 0.8)
|
|
|
|
}
|
|
|
|
GradientStop {
|
|
|
|
position: 1.0
|
|
|
|
color: "transparent"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ColumnLayout {
|
|
|
|
id: textblock
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
top: parent.top
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
width: Math.min(implicitWidth, parent.width)
|
|
|
|
Layout.margins: Kirigami.Units.smallSpacing
|
|
|
|
Image {
|
|
|
|
source: "qrc:/qml/subsurface-mobile-icon.png"
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
sourceSize.width: Kirigami.Units.iconSizes.large
|
|
|
|
width: Kirigami.Units.iconSizes.large
|
|
|
|
Layout.margins: Kirigami.Units.smallSpacing
|
|
|
|
}
|
|
|
|
Kirigami.Heading {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
visible: text.length > 0
|
|
|
|
level: 1
|
|
|
|
color: "white"
|
|
|
|
text: "Subsurface"
|
|
|
|
wrapMode: Text.NoWrap
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.weight: Font.Normal
|
|
|
|
Layout.margins: Kirigami.Units.smallSpacing
|
|
|
|
}
|
|
|
|
}
|
2018-06-16 10:53:04 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.margins: Kirigami.Units.smallSpacing
|
|
|
|
Kirigami.Heading {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
visible: text.length > 0
|
2018-06-20 02:50:14 +00:00
|
|
|
level: 3
|
2018-06-16 10:53:04 +00:00
|
|
|
color: "white"
|
|
|
|
text: prefs.cloudUserName
|
|
|
|
wrapMode: Text.NoWrap
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.weight: Font.Normal
|
|
|
|
}
|
|
|
|
}
|
2018-06-16 21:05:20 +00:00
|
|
|
}
|
|
|
|
}
|
2015-11-07 02:08:05 +00:00
|
|
|
|
2017-12-06 10:41:46 +00:00
|
|
|
resetMenuOnTriggered: false
|
2016-06-12 19:09:49 +00:00
|
|
|
|
2017-04-13 17:57:22 +00:00
|
|
|
actions: [
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_home.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Dive list")
|
2015-12-03 23:26:45 +00:00
|
|
|
onTriggered: {
|
2018-06-13 16:06:11 +00:00
|
|
|
manager.appendTextToLog("requested dive list with credential status " + prefs.credentialStatus)
|
2018-09-04 09:18:43 +00:00
|
|
|
if (prefs.credentialStatus == CloudStatus.CS_UNKNOWN) {
|
2016-03-13 18:41:09 +00:00
|
|
|
// the user has asked to change credentials - if the credentials before that
|
|
|
|
// were valid, go back to dive list
|
2018-09-04 09:18:43 +00:00
|
|
|
if (oldStatus == CloudStatus.CS_VERIFIED) {
|
2018-06-13 16:06:11 +00:00
|
|
|
prefs.credentialStatus = oldStatus
|
2016-03-13 18:41:09 +00:00
|
|
|
}
|
|
|
|
}
|
2016-02-11 05:47:09 +00:00
|
|
|
returnTopPage()
|
2016-03-03 23:12:09 +00:00
|
|
|
globalDrawer.close()
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
|
|
|
},
|
2018-03-08 20:23:58 +00:00
|
|
|
Kirigami.Action {
|
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/map-globe.svg"
|
2018-03-08 20:23:58 +00:00
|
|
|
}
|
|
|
|
text: mapPage.title
|
|
|
|
onTriggered: {
|
|
|
|
showMap()
|
|
|
|
}
|
|
|
|
},
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_sync.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2017-07-23 06:22:44 +00:00
|
|
|
text: qsTr("Dive management")
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_add.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Add dive manually")
|
2018-09-04 09:18:43 +00:00
|
|
|
enabled: prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
|
|
|
|
prefs.credentialStatus === CloudStatus.CS_NOCLOUD
|
2015-12-08 01:33:11 +00:00
|
|
|
onTriggered: {
|
2017-12-06 10:41:46 +00:00
|
|
|
globalDrawer.close()
|
2016-04-02 16:04:44 +00:00
|
|
|
returnTopPage() // otherwise odd things happen with the page stack
|
2016-04-02 03:29:39 +00:00
|
|
|
startAddDive()
|
2015-12-08 01:33:11 +00:00
|
|
|
}
|
|
|
|
}
|
2017-05-11 10:47:54 +00:00
|
|
|
Kirigami.Action {
|
2017-10-05 00:06:18 +00:00
|
|
|
// this of course assumes a white background - theming means this needs to change again
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/downloadDC-black.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2017-05-11 10:47:54 +00:00
|
|
|
text: qsTr("Download from DC")
|
|
|
|
enabled: true
|
|
|
|
onTriggered: {
|
2017-12-06 10:41:46 +00:00
|
|
|
globalDrawer.close()
|
2017-06-16 08:22:44 +00:00
|
|
|
downloadFromDc.dcImportModel.clearTable()
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(downloadFromDc)
|
2017-05-11 10:47:54 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-19 14:39:43 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_add_location.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2017-12-05 08:06:57 +00:00
|
|
|
text: qsTr("Apply GPS fixes")
|
2017-07-19 14:39:43 +00:00
|
|
|
onTriggered: {
|
|
|
|
manager.applyGpsData();
|
|
|
|
}
|
|
|
|
}
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/cloud_sync.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Manual sync with cloud")
|
2018-09-04 09:18:43 +00:00
|
|
|
enabled: prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
|
|
|
|
prefs.credentialStatus === CloudStatus.CS_NOCLOUD
|
2015-12-08 01:33:11 +00:00
|
|
|
onTriggered: {
|
2018-09-04 09:18:43 +00:00
|
|
|
if (prefs.credentialStatus === CloudStatus.CS_NOCLOUD) {
|
2016-04-22 12:21:26 +00:00
|
|
|
returnTopPage()
|
2018-06-13 16:06:11 +00:00
|
|
|
oldStatus = prefs.credentialStatus
|
2016-04-22 12:21:26 +00:00
|
|
|
manager.startPageText = "Enter valid cloud storage credentials"
|
2018-09-04 09:18:43 +00:00
|
|
|
prefs.credentialStatus = CloudStatus.CS_UNKNOWN
|
2016-04-22 12:21:26 +00:00
|
|
|
globalDrawer.close()
|
|
|
|
} else {
|
|
|
|
globalDrawer.close()
|
|
|
|
detailsWindow.endEditMode()
|
|
|
|
manager.saveChangesCloud(true);
|
|
|
|
globalDrawer.close()
|
|
|
|
}
|
2015-12-08 01:33:11 +00:00
|
|
|
}
|
|
|
|
}
|
2016-04-02 01:40:12 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-10-08 16:47:01 +00:00
|
|
|
name: PrefCloudStorage.cloud_auto_sync ? ":/icons/ic_cloud_off.svg" : ":/icons/ic_cloud_done.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2018-10-08 16:47:01 +00:00
|
|
|
text: PrefCloudStorage.cloud_auto_sync ? qsTr("Disable auto cloud sync") : qsTr("Enable auto cloud sync")
|
2018-10-09 07:49:21 +00:00
|
|
|
visible: prefs.credentialStatus !== CloudStatus.CS_NOCLOUD
|
2015-12-08 01:33:11 +00:00
|
|
|
onTriggered: {
|
2018-10-08 16:47:01 +00:00
|
|
|
PrefCloudStorage.cloud_auto_sync = !PrefCloudStorage.cloud_auto_sync
|
2018-10-09 08:23:24 +00:00
|
|
|
manager.setGitLocalOnly(PrefCloudStorage.cloud_auto_sync)
|
2018-10-08 16:47:01 +00:00
|
|
|
if (!PrefCloudStorage.cloud_auto_sync) {
|
2017-06-24 20:09:38 +00:00
|
|
|
showPassiveNotification(qsTr("Turning off automatic sync to cloud causes all data to only be \
|
|
|
|
stored locally. This can be very useful in situations with limited or no network access. Please choose 'Manual sync with cloud' \
|
|
|
|
if you have network connectivity and want to sync your data to cloud storage."), 10000)
|
2016-04-04 01:33:40 +00:00
|
|
|
}
|
2015-12-08 01:33:11 +00:00
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
}
|
2017-04-13 17:57:22 +00:00
|
|
|
},
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_place.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("GPS")
|
2017-12-03 07:18:07 +00:00
|
|
|
visible: true
|
2015-12-03 23:26:45 +00:00
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name:":/icons/ic_gps_fixed.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Show GPS fixes")
|
2016-01-08 05:40:15 +00:00
|
|
|
onTriggered: {
|
2017-12-06 10:41:46 +00:00
|
|
|
globalDrawer.close()
|
2016-04-02 16:04:44 +00:00
|
|
|
returnTopPage()
|
2016-01-08 05:40:15 +00:00
|
|
|
manager.populateGpsData();
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(gpsWindow)
|
2016-01-08 05:40:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_clear.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Clear GPS cache")
|
2015-12-03 23:26:45 +00:00
|
|
|
onTriggered: {
|
2017-12-26 10:36:43 +00:00
|
|
|
globalDrawer.close();
|
2015-12-08 01:33:11 +00:00
|
|
|
manager.clearGpsData();
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-23 07:38:40 +00:00
|
|
|
|
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: locationServiceEnabled ? ":/icons/ic_location_off.svg" : ":/icons/ic_place.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2017-07-23 07:38:40 +00:00
|
|
|
text: locationServiceEnabled ? qsTr("Disable location service") : qsTr("Run location service")
|
|
|
|
onTriggered: {
|
2017-12-26 10:36:43 +00:00
|
|
|
globalDrawer.close();
|
2017-07-23 07:38:40 +00:00
|
|
|
locationServiceEnabled = !locationServiceEnabled
|
|
|
|
}
|
|
|
|
}
|
2017-04-13 17:57:22 +00:00
|
|
|
},
|
2017-07-19 14:39:43 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_info_outline.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2017-07-19 14:39:43 +00:00
|
|
|
text: qsTr("About")
|
|
|
|
onTriggered: {
|
2017-12-06 10:41:46 +00:00
|
|
|
globalDrawer.close()
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(aboutWindow)
|
2017-07-19 14:39:43 +00:00
|
|
|
detailsWindow.endEditMode()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_settings.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2017-07-19 14:39:43 +00:00
|
|
|
text: qsTr("Settings")
|
2017-10-05 00:06:18 +00:00
|
|
|
onTriggered: {
|
2017-12-06 10:41:46 +00:00
|
|
|
globalDrawer.close()
|
2018-08-20 18:02:54 +00:00
|
|
|
settingsWindow.defaultCylinderModel = manager.cylinderInit
|
2018-09-04 09:18:43 +00:00
|
|
|
PrefGeneral.default_cylinder === "" ? defaultCylinderIndex = "-1" : defaultCylinderIndex = settingsWindow.defaultCylinderModel.indexOf(PrefGeneral.default_cylinder)
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(settingsWindow)
|
2017-10-05 00:06:18 +00:00
|
|
|
detailsWindow.endEditMode()
|
2017-07-19 14:39:43 +00:00
|
|
|
}
|
|
|
|
},
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_adb.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Developer")
|
2018-09-12 06:55:55 +00:00
|
|
|
visible: PrefDisplay.show_developer
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("App log")
|
2015-12-08 01:33:11 +00:00
|
|
|
onTriggered: {
|
2017-12-06 10:41:46 +00:00
|
|
|
globalDrawer.close()
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(logWindow)
|
2015-12-08 01:33:11 +00:00
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Action {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Theme information")
|
2015-12-08 01:33:11 +00:00
|
|
|
onTriggered: {
|
2017-12-06 10:41:46 +00:00
|
|
|
globalDrawer.close()
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.push(themetest)
|
2015-12-08 01:33:11 +00:00
|
|
|
}
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
2016-02-10 20:53:59 +00:00
|
|
|
},
|
2016-04-01 02:57:12 +00:00
|
|
|
Kirigami.Action {
|
2018-01-02 16:02:19 +00:00
|
|
|
icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
name: ":/icons/ic_help_outline.svg"
|
2018-01-02 16:02:19 +00:00
|
|
|
}
|
2017-07-19 14:39:43 +00:00
|
|
|
text: qsTr("Help")
|
2016-03-13 18:13:04 +00:00
|
|
|
onTriggered: {
|
2017-10-06 14:33:41 +00:00
|
|
|
Qt.openUrlExternally("https://subsurface-divelog.org/documentation/subsurface-mobile-v2-user-manual/")
|
2016-03-13 18:13:04 +00:00
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
}
|
2017-04-13 17:57:22 +00:00
|
|
|
] // end actions
|
2017-07-24 17:17:04 +00:00
|
|
|
Kirigami.Icon {
|
2018-04-17 00:28:53 +00:00
|
|
|
source: ":/icons/" + (subsurfaceTheme.currentTheme != "" ? subsurfaceTheme.currentTheme : "Blue") + "_gps.svg"
|
2017-07-24 17:17:04 +00:00
|
|
|
enabled: false
|
|
|
|
visible: locationServiceEnabled
|
|
|
|
}
|
2015-10-08 23:57:10 +00:00
|
|
|
|
|
|
|
}
|
2015-11-29 18:09:59 +00:00
|
|
|
|
2017-06-21 20:44:24 +00:00
|
|
|
function blueTheme() {
|
2017-07-15 14:33:50 +00:00
|
|
|
Material.theme = Material.Light
|
2017-07-25 17:46:59 +00:00
|
|
|
Material.accent = subsurfaceTheme.bluePrimaryColor
|
2017-06-23 19:29:22 +00:00
|
|
|
subsurfaceTheme.currentTheme = "Blue"
|
|
|
|
subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.blueDarkerPrimaryColor
|
|
|
|
subsurfaceTheme.darkerPrimaryTextColor= subsurfaceTheme.blueDarkerPrimaryTextColor
|
|
|
|
subsurfaceTheme.primaryColor = subsurfaceTheme.bluePrimaryColor
|
|
|
|
subsurfaceTheme.primaryTextColor = subsurfaceTheme.bluePrimaryTextColor
|
|
|
|
subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.blueLightPrimaryColor
|
|
|
|
subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.blueLightPrimaryTextColor
|
|
|
|
subsurfaceTheme.backgroundColor = subsurfaceTheme.blueBackgroundColor
|
2017-06-24 01:07:48 +00:00
|
|
|
subsurfaceTheme.textColor = subsurfaceTheme.blueTextColor
|
2017-06-24 18:18:18 +00:00
|
|
|
subsurfaceTheme.secondaryTextColor = subsurfaceTheme.blueSecondaryTextColor
|
2017-07-28 13:59:49 +00:00
|
|
|
manager.setStatusbarColor(subsurfaceTheme.darkerPrimaryColor)
|
2017-07-15 14:31:51 +00:00
|
|
|
subsurfaceTheme.drawerColor = subsurfaceTheme.lightDrawerColor
|
2017-06-21 20:44:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function pinkTheme() {
|
2017-07-15 14:33:50 +00:00
|
|
|
Material.theme = Material.Light
|
2017-07-25 17:46:59 +00:00
|
|
|
Material.accent = subsurfaceTheme.pinkPrimaryColor
|
2017-06-23 19:29:22 +00:00
|
|
|
subsurfaceTheme.currentTheme = "Pink"
|
|
|
|
subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.pinkDarkerPrimaryColor
|
|
|
|
subsurfaceTheme.darkerPrimaryTextColor = subsurfaceTheme.pinkDarkerPrimaryTextColor
|
|
|
|
subsurfaceTheme.primaryColor = subsurfaceTheme.pinkPrimaryColor
|
|
|
|
subsurfaceTheme.primaryTextColor = subsurfaceTheme.pinkPrimaryTextColor
|
|
|
|
subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.pinkLightPrimaryColor
|
|
|
|
subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.pinkLightPrimaryTextColor
|
|
|
|
subsurfaceTheme.backgroundColor = subsurfaceTheme.pinkBackgroundColor
|
2017-06-24 01:07:48 +00:00
|
|
|
subsurfaceTheme.textColor = subsurfaceTheme.pinkTextColor
|
2017-06-24 18:18:18 +00:00
|
|
|
subsurfaceTheme.secondaryTextColor = subsurfaceTheme.pinkSecondaryTextColor
|
2017-07-28 13:59:49 +00:00
|
|
|
manager.setStatusbarColor(subsurfaceTheme.darkerPrimaryColor)
|
2017-07-15 14:31:51 +00:00
|
|
|
subsurfaceTheme.drawerColor = subsurfaceTheme.lightDrawerColor
|
2017-06-21 22:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function darkTheme() {
|
2017-07-15 14:33:50 +00:00
|
|
|
Material.theme = Material.Dark
|
2017-07-25 17:46:59 +00:00
|
|
|
Material.accent = subsurfaceTheme.darkerPrimaryColor
|
2017-06-23 19:29:22 +00:00
|
|
|
subsurfaceTheme.currentTheme = "Dark"
|
|
|
|
subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.darkDarkerPrimaryColor
|
|
|
|
subsurfaceTheme.darkerPrimaryTextColor= subsurfaceTheme.darkDarkerPrimaryTextColor
|
|
|
|
subsurfaceTheme.primaryColor = subsurfaceTheme.darkPrimaryColor
|
|
|
|
subsurfaceTheme.primaryTextColor = subsurfaceTheme.darkPrimaryTextColor
|
|
|
|
subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.darkLightPrimaryColor
|
|
|
|
subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.darkLightPrimaryTextColor
|
|
|
|
subsurfaceTheme.backgroundColor = subsurfaceTheme.darkBackgroundColor
|
2017-06-24 01:07:48 +00:00
|
|
|
subsurfaceTheme.textColor = subsurfaceTheme.darkTextColor
|
2017-06-24 18:18:18 +00:00
|
|
|
subsurfaceTheme.secondaryTextColor = subsurfaceTheme.darkSecondaryTextColor
|
2017-07-28 13:59:49 +00:00
|
|
|
manager.setStatusbarColor(subsurfaceTheme.darkerPrimaryColor)
|
2017-07-15 14:31:51 +00:00
|
|
|
subsurfaceTheme.drawerColor = subsurfaceTheme.darkDrawerColor
|
2017-06-21 20:44:24 +00:00
|
|
|
}
|
|
|
|
|
2015-11-29 18:09:59 +00:00
|
|
|
QtObject {
|
|
|
|
id: subsurfaceTheme
|
mobile, QML: introduce basePointSize in subsurfaceTheme
By manipulation the used font pointSize property, we can dynamically
scale fonts and derived UI objects. At the same time, we have
some logic to determine the default font, its size, etc, for example
depending on screen properties. The scaling of the UI (and its font)
does not need to interfere with those defaults.
However, when we want to reset the pointSize, we alter the default, so
a backup of the default is needed. Ok, not al full backup, as the only
thing we like to manipulate is the pointSize, to which we want to be
able to return.
All this leads to this commit. A basePointSize property is added, that
is initialized from the default. Due to the binding logic of the QML
engine, it is not a classic initialization, but a binding between the
2 properties. We need to break that binding explicitly, so that
the original PointSize is always preserved.
In addition, a display of the new font property is added to the
developers theme test.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 10:48:48 +00:00
|
|
|
|
|
|
|
// basePointSize is determinded at start of the app and shall
|
|
|
|
// never be changed. This is very tricky. In order to break the
|
|
|
|
// binding between basePointSize and fontMetrics.font.pointSize we
|
|
|
|
// multipy it by 1.0 in the onComplete hander of this object.
|
|
|
|
property double basePointSize: fontMetrics.font.pointSize;
|
|
|
|
|
|
|
|
property double regularPointSize: fontMetrics.font.pointSize
|
|
|
|
property double titlePointSize: regularPointSize * 1.5
|
2018-09-27 09:54:28 +00:00
|
|
|
property double headingPointSize: regularPointSize * 1.2
|
mobile, QML: introduce basePointSize in subsurfaceTheme
By manipulation the used font pointSize property, we can dynamically
scale fonts and derived UI objects. At the same time, we have
some logic to determine the default font, its size, etc, for example
depending on screen properties. The scaling of the UI (and its font)
does not need to interfere with those defaults.
However, when we want to reset the pointSize, we alter the default, so
a backup of the default is needed. Ok, not al full backup, as the only
thing we like to manipulate is the pointSize, to which we want to be
able to return.
All this leads to this commit. A basePointSize property is added, that
is initialized from the default. Due to the binding logic of the QML
engine, it is not a classic initialization, but a binding between the
2 properties. We need to break that binding explicitly, so that
the original PointSize is always preserved.
In addition, a display of the new font property is added to the
developers theme test.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 10:48:48 +00:00
|
|
|
property double smallPointSize: regularPointSize * 0.8
|
2017-06-21 14:39:07 +00:00
|
|
|
|
2017-06-23 19:29:22 +00:00
|
|
|
// colors currently in use
|
|
|
|
property string currentTheme
|
|
|
|
property color darkerPrimaryColor
|
|
|
|
property color darkerPrimaryTextColor
|
|
|
|
property color primaryColor
|
|
|
|
property color primaryTextColor
|
|
|
|
property color lightPrimaryColor
|
|
|
|
property color lightPrimaryTextColor
|
|
|
|
property color backgroundColor
|
2017-06-24 01:07:48 +00:00
|
|
|
property color textColor
|
2017-06-24 18:18:18 +00:00
|
|
|
property color secondaryTextColor
|
2017-07-15 14:31:51 +00:00
|
|
|
property color drawerColor
|
2017-06-23 19:29:22 +00:00
|
|
|
|
|
|
|
// colors for the blue theme
|
|
|
|
property color blueDarkerPrimaryColor: "#303F9f"
|
|
|
|
property color blueDarkerPrimaryTextColor: "#ECECEC"
|
|
|
|
property color bluePrimaryColor: "#3F51B5"
|
2017-06-24 18:18:18 +00:00
|
|
|
property color bluePrimaryTextColor: "#FFFFFF"
|
2017-06-23 19:29:22 +00:00
|
|
|
property color blueLightPrimaryColor: "#C5CAE9"
|
|
|
|
property color blueLightPrimaryTextColor: "#212121"
|
|
|
|
property color blueBackgroundColor: "#eff0f1"
|
2017-06-24 01:07:48 +00:00
|
|
|
property color blueTextColor: blueLightPrimaryTextColor
|
2017-06-24 18:18:18 +00:00
|
|
|
property color blueSecondaryTextColor: "#757575"
|
2017-06-23 19:29:22 +00:00
|
|
|
|
|
|
|
// colors for the pink theme
|
2017-07-14 13:44:40 +00:00
|
|
|
property color pinkDarkerPrimaryColor: "#C2185B"
|
2017-06-23 19:29:22 +00:00
|
|
|
property color pinkDarkerPrimaryTextColor: "#ECECEC"
|
|
|
|
property color pinkPrimaryColor: "#FF69B4"
|
|
|
|
property color pinkPrimaryTextColor: "#212121"
|
|
|
|
property color pinkLightPrimaryColor: "#FFDDF4"
|
|
|
|
property color pinkLightPrimaryTextColor: "#212121"
|
|
|
|
property color pinkBackgroundColor: "#eff0f1"
|
2017-06-24 01:07:48 +00:00
|
|
|
property color pinkTextColor: pinkLightPrimaryTextColor
|
2017-06-24 18:18:18 +00:00
|
|
|
property color pinkSecondaryTextColor: "#757575"
|
2017-06-23 19:29:22 +00:00
|
|
|
|
|
|
|
// colors for the dark theme
|
|
|
|
property color darkDarkerPrimaryColor: "#303F9f"
|
|
|
|
property color darkDarkerPrimaryTextColor: "#ECECEC"
|
|
|
|
property color darkPrimaryColor: "#3F51B5"
|
2017-06-21 14:39:07 +00:00
|
|
|
property color darkPrimaryTextColor: "#ECECEC"
|
2017-06-23 19:29:22 +00:00
|
|
|
property color darkLightPrimaryColor: "#C5CAE9"
|
|
|
|
property color darkLightPrimaryTextColor: "#212121"
|
2017-07-14 13:37:02 +00:00
|
|
|
property color darkBackgroundColor: "#303030"
|
2017-06-24 01:07:48 +00:00
|
|
|
property color darkTextColor: darkPrimaryTextColor
|
2017-06-24 18:18:18 +00:00
|
|
|
property color darkSecondaryTextColor: "#757575"
|
2017-06-21 22:47:29 +00:00
|
|
|
|
2017-06-24 18:18:18 +00:00
|
|
|
property color contrastAccentColor: "#FF5722" // used for delete button
|
2017-07-15 14:31:51 +00:00
|
|
|
property color lightDrawerColor: "#FFFFFF"
|
|
|
|
property color darkDrawerColor: "#424242"
|
2017-06-21 14:39:07 +00:00
|
|
|
|
2016-09-17 19:56:47 +00:00
|
|
|
property int columnWidth: Math.round(rootItem.width/(Kirigami.Units.gridUnit*28)) > 0 ? Math.round(rootItem.width / Math.round(rootItem.width/(Kirigami.Units.gridUnit*28))) : rootItem.width
|
2017-06-21 05:51:25 +00:00
|
|
|
Component.onCompleted: {
|
mobile, QML: introduce basePointSize in subsurfaceTheme
By manipulation the used font pointSize property, we can dynamically
scale fonts and derived UI objects. At the same time, we have
some logic to determine the default font, its size, etc, for example
depending on screen properties. The scaling of the UI (and its font)
does not need to interfere with those defaults.
However, when we want to reset the pointSize, we alter the default, so
a backup of the default is needed. Ok, not al full backup, as the only
thing we like to manipulate is the pointSize, to which we want to be
able to return.
All this leads to this commit. A basePointSize property is added, that
is initialized from the default. Due to the binding logic of the QML
engine, it is not a classic initialization, but a binding between the
2 properties. We need to break that binding explicitly, so that
the original PointSize is always preserved.
In addition, a display of the new font property is added to the
developers theme test.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 10:48:48 +00:00
|
|
|
// break binding explicitly. Now we have a basePointSize that we can
|
|
|
|
// use to easily scale against
|
|
|
|
basePointSize = basePointSize * 1.0;
|
|
|
|
|
|
|
|
// set the initial UI scaling as in the the preferences
|
|
|
|
fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale;
|
|
|
|
|
2017-06-23 19:29:22 +00:00
|
|
|
// this needs to pick the theme from persistent preference settings
|
2018-09-12 11:50:24 +00:00
|
|
|
var theme = PrefDisplay.theme
|
2017-06-24 02:35:48 +00:00
|
|
|
if (theme == "Blue")
|
|
|
|
blueTheme()
|
|
|
|
else if (theme == "Pink")
|
|
|
|
pinkTheme()
|
|
|
|
else
|
|
|
|
darkTheme()
|
2017-06-21 05:51:25 +00:00
|
|
|
}
|
2015-11-29 18:09:59 +00:00
|
|
|
}
|
2016-03-08 20:26:54 +00:00
|
|
|
pageStack.initialPage: DiveList {
|
2016-01-29 02:27:54 +00:00
|
|
|
id: diveList
|
2016-01-19 20:42:58 +00:00
|
|
|
opacity: 0
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 200
|
|
|
|
easing.type: Easing.OutQuad
|
|
|
|
}
|
|
|
|
}
|
2017-12-18 13:37:02 +00:00
|
|
|
}
|
2016-01-19 20:42:58 +00:00
|
|
|
|
2017-12-18 13:37:02 +00:00
|
|
|
pageStack.onCurrentItemChanged: {
|
|
|
|
// This is called whenever the user navigates using the breadcrumbs in the header
|
|
|
|
|
2018-03-08 20:28:42 +00:00
|
|
|
// disable the left swipe to go back when on the map page
|
2018-08-09 02:49:48 +00:00
|
|
|
if (pageStack.currentItem === null) {
|
|
|
|
console.log("there's no current page")
|
|
|
|
} else {
|
2018-10-12 12:57:43 +00:00
|
|
|
pageStack.interactive = pageStack.currentItem.objectName !== mapPage.objectName
|
2018-03-08 20:28:42 +00:00
|
|
|
|
2018-08-09 02:49:48 +00:00
|
|
|
// is there a better way to reload the map markers instead of doing that
|
|
|
|
// every time the map page is shown - e.g. link to the dive list model somehow?
|
|
|
|
if (pageStack.currentItem.objectName === mapPage.objectName)
|
|
|
|
mapPage.reloadMap()
|
2018-03-08 20:28:42 +00:00
|
|
|
|
2018-08-09 02:49:48 +00:00
|
|
|
// In case we land on any page, not being the DiveDetails (which can be
|
|
|
|
// in multiple states, such as add, edit or view), just end the edit/add mode
|
|
|
|
if (pageStack.currentItem.objectName !== "DiveDetails" &&
|
|
|
|
(detailsWindow.state === 'edit' || detailsWindow.state === 'add')) {
|
2017-12-18 13:37:02 +00:00
|
|
|
detailsWindow.endEditMode()
|
2018-08-09 02:49:48 +00:00
|
|
|
}
|
2017-12-18 13:37:02 +00:00
|
|
|
}
|
2015-07-12 17:56:48 +00:00
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
|
2018-06-12 08:29:40 +00:00
|
|
|
QMLPrefs {
|
|
|
|
id: prefs
|
|
|
|
}
|
|
|
|
|
2015-07-12 17:56:48 +00:00
|
|
|
QMLManager {
|
|
|
|
id: manager
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
2015-07-12 17:56:48 +00:00
|
|
|
|
2017-07-20 17:39:55 +00:00
|
|
|
Settings {
|
|
|
|
id: settingsWindow
|
2015-07-12 17:56:48 +00:00
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2016-02-10 20:53:59 +00:00
|
|
|
About {
|
|
|
|
id: aboutWindow
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2015-07-21 12:00:29 +00:00
|
|
|
DiveDetails {
|
|
|
|
id: detailsWindow
|
|
|
|
visible: false
|
2016-04-27 12:44:18 +00:00
|
|
|
anchors.fill: parent
|
2015-07-21 12:00:29 +00:00
|
|
|
}
|
2015-07-23 11:46:02 +00:00
|
|
|
|
2015-08-19 07:18:26 +00:00
|
|
|
Log {
|
|
|
|
id: logWindow
|
|
|
|
visible: false
|
|
|
|
}
|
2015-10-08 23:57:10 +00:00
|
|
|
|
2016-01-08 05:40:15 +00:00
|
|
|
GpsList {
|
|
|
|
id: gpsWindow
|
2016-03-08 20:26:54 +00:00
|
|
|
visible: false
|
2016-01-08 05:40:15 +00:00
|
|
|
}
|
|
|
|
|
2017-05-11 10:47:54 +00:00
|
|
|
DownloadFromDiveComputer {
|
|
|
|
id: downloadFromDc
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2018-03-08 20:04:28 +00:00
|
|
|
MapPage {
|
|
|
|
id: mapPage
|
|
|
|
visible: false
|
|
|
|
anchors.fill: parent
|
|
|
|
}
|
|
|
|
|
2015-11-06 21:53:26 +00:00
|
|
|
ThemeTest {
|
|
|
|
id: themetest
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2018-08-06 13:24:51 +00:00
|
|
|
onPluggedInDeviceNameChanged: {
|
2018-08-07 01:38:52 +00:00
|
|
|
if (detailsWindow.state === 'edit' || detailsWindow.state === 'add') {
|
|
|
|
/* we're in the middle of editing / adding a dive */
|
|
|
|
console.log("Download page requested by Android Intent, but adding/editing dive; no action taken")
|
|
|
|
} else {
|
|
|
|
console.log("Show download page for device " + pluggedInDeviceName)
|
2018-08-08 13:08:15 +00:00
|
|
|
/* if we recognized the device, we'll pass in a triple of ComboBox indeces as "vendor;product;connection" */
|
|
|
|
var vendorProductConnection = pluggedInDeviceName.split(';')
|
|
|
|
if (vendorProductConnection.length === 3)
|
|
|
|
diveList.showDownloadPage(vendorProductConnection[0], vendorProductConnection[1], vendorProductConnection[2])
|
|
|
|
else
|
|
|
|
diveList.showDownloadPage()
|
|
|
|
console.log("done showing download page")
|
2018-08-07 01:38:52 +00:00
|
|
|
}
|
2018-08-06 13:24:51 +00:00
|
|
|
}
|
|
|
|
|
2015-10-08 23:57:10 +00:00
|
|
|
Component.onCompleted: {
|
2016-01-19 20:42:58 +00:00
|
|
|
rootItem.visible = true
|
2016-01-29 02:27:54 +00:00
|
|
|
diveList.opacity = 1
|
2016-01-19 20:42:58 +00:00
|
|
|
rootItem.opacity = 1
|
2016-09-17 19:56:47 +00:00
|
|
|
pageStack.defaultColumnWidth = Kirigami.Units.gridUnit * 28
|
2018-08-09 14:12:32 +00:00
|
|
|
manager.appInitialized()
|
2016-01-19 20:42:58 +00:00
|
|
|
}
|
2016-12-27 17:36:02 +00:00
|
|
|
/* TODO: Verify where opacity went to.
|
2016-01-19 20:42:58 +00:00
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 200
|
|
|
|
easing.type: Easing.OutQuad
|
|
|
|
}
|
2015-10-08 23:57:10 +00:00
|
|
|
}
|
2016-12-27 17:36:02 +00:00
|
|
|
*/
|
2015-05-27 10:34:55 +00:00
|
|
|
}
|