2015-11-29 16:43:56 +00:00
|
|
|
import QtQuick 2.4
|
2015-05-27 10:34:55 +00:00
|
|
|
import QtQuick.Controls 1.2
|
2015-07-26 11:52:46 +00:00
|
|
|
import QtQuick.Controls.Styles 1.2
|
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
|
2015-07-10 08:05:13 +00:00
|
|
|
import QtQuick.Layouts 1.1
|
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
|
2015-11-29 16:43:56 +00:00
|
|
|
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
2015-10-08 23:57:10 +00:00
|
|
|
|
2015-11-29 16:43:56 +00:00
|
|
|
MobileComponents.ApplicationWindow {
|
2015-12-03 22:27:27 +00:00
|
|
|
id: rootItem
|
2016-01-01 17:34:32 +00:00
|
|
|
title: qsTr("Subsurface-mobile")
|
2015-07-12 17:42:23 +00:00
|
|
|
property bool fullscreen: true
|
2015-11-29 16:43:56 +00:00
|
|
|
|
|
|
|
FontMetrics {
|
|
|
|
id: fontMetrics
|
|
|
|
}
|
|
|
|
|
2015-07-12 17:42:23 +00:00
|
|
|
visible: true
|
2015-06-04 08:27:38 +00:00
|
|
|
|
2015-12-03 23:26:45 +00:00
|
|
|
globalDrawer: MobileComponents.GlobalDrawer {
|
2015-11-29 16:43:56 +00:00
|
|
|
title: "Subsurface"
|
|
|
|
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
2015-11-07 02:08:05 +00:00
|
|
|
|
2015-11-29 16:43:56 +00:00
|
|
|
bannerImageSource: "dive.jpg"
|
|
|
|
actions: [
|
2015-12-03 23:26:45 +00:00
|
|
|
Action {
|
2015-12-08 01:33:11 +00:00
|
|
|
text: "Cloud credentials"
|
2015-12-03 23:26:45 +00:00
|
|
|
onTriggered: {
|
|
|
|
stackView.push(cloudCredWindow)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Action {
|
2015-12-08 01:33:11 +00:00
|
|
|
text: "Preferences"
|
2015-12-03 23:26:45 +00:00
|
|
|
onTriggered: {
|
2015-12-08 01:33:11 +00:00
|
|
|
stackView.push(prefsWindow)
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
|
|
|
},
|
2015-11-29 16:43:56 +00:00
|
|
|
|
2015-12-08 01:33:11 +00:00
|
|
|
MobileComponents.ActionGroup {
|
|
|
|
text: "Manage dives"
|
|
|
|
Action {
|
|
|
|
text: "Download from computer"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(downloadDivesWindow)
|
|
|
|
}
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
2015-12-08 01:33:11 +00:00
|
|
|
Action {
|
|
|
|
text: "Add dive manually"
|
|
|
|
onTriggered: {
|
2015-12-27 01:06:52 +00:00
|
|
|
detailsWindow.state = "edit"
|
2015-12-27 05:37:18 +00:00
|
|
|
detailsWindow.dive_id = manager.addDive();
|
|
|
|
detailsWindow.number = manager.getNumber(detailsWindow.dive_id)
|
|
|
|
detailsWindow.date = manager.getDate(detailsWindow.dive_id)
|
2016-01-06 07:06:46 +00:00
|
|
|
detailsWindow.airtemp = ""
|
|
|
|
detailsWindow.watertemp = ""
|
|
|
|
detailsWindow.buddy = ""
|
|
|
|
detailsWindow.depth = ""
|
|
|
|
detailsWindow.divemaster = ""
|
|
|
|
detailsWindow.notes = ""
|
|
|
|
detailsWindow.location = ""
|
|
|
|
detailsWindow.duration = ""
|
|
|
|
detailsWindow.suit = ""
|
|
|
|
detailsWindow.weight = ""
|
2015-12-08 01:33:11 +00:00
|
|
|
stackView.push(detailsWindow)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: "Refresh"
|
|
|
|
onTriggered: {
|
|
|
|
manager.loadDives();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: "Upload to cloud"
|
|
|
|
onTriggered: {
|
|
|
|
manager.saveChanges();
|
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
}
|
2015-12-03 23:26:45 +00:00
|
|
|
},
|
2015-11-29 16:43:56 +00:00
|
|
|
|
2015-12-03 23:26:45 +00:00
|
|
|
MobileComponents.ActionGroup {
|
|
|
|
text: "GPS"
|
|
|
|
Action {
|
2015-12-08 01:33:11 +00:00
|
|
|
text: "GPS-tag dives"
|
2015-12-03 23:26:45 +00:00
|
|
|
onTriggered: {
|
2015-12-08 01:33:11 +00:00
|
|
|
manager.applyGpsData();
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
2015-12-08 01:33:11 +00:00
|
|
|
text: "Upload GPS data"
|
2015-12-03 23:26:45 +00:00
|
|
|
onTriggered: {
|
2015-12-08 01:33:11 +00:00
|
|
|
manager.sendGpsData();
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-08 05:37:36 +00:00
|
|
|
Action {
|
|
|
|
text: "Download GPS data"
|
|
|
|
onTriggered: {
|
|
|
|
manager.downloadGpsData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-08 05:40:15 +00:00
|
|
|
Action {
|
|
|
|
text: "Show GPS fixes"
|
|
|
|
onTriggered: {
|
|
|
|
manager.populateGpsData();
|
|
|
|
stackView.push(gpsWindow)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-03 23:26:45 +00:00
|
|
|
Action {
|
2015-12-08 01:33:11 +00:00
|
|
|
text: "Clear GPS cache"
|
2015-12-03 23:26:45 +00:00
|
|
|
onTriggered: {
|
2015-12-08 01:33:11 +00:00
|
|
|
manager.clearGpsData();
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-11-29 16:43:56 +00:00
|
|
|
|
2015-12-08 01:33:11 +00:00
|
|
|
MobileComponents.ActionGroup {
|
|
|
|
text: "Developer"
|
|
|
|
Action {
|
|
|
|
text: "App log"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(logWindow)
|
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
}
|
|
|
|
|
2015-12-08 01:33:11 +00:00
|
|
|
Action {
|
|
|
|
text: "Theme information"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(themetest)
|
|
|
|
}
|
2015-12-03 23:26:45 +00:00
|
|
|
}
|
2015-12-20 02:41:10 +00:00
|
|
|
Action {
|
|
|
|
checkable: true
|
|
|
|
checked: manager.verboseEnabled
|
|
|
|
text: checked ? "Disable verbose (for adb logcat)" : "Enable verbose (for adb logcat)"
|
|
|
|
onToggled: {
|
|
|
|
manager.verboseEnabled = checked;
|
|
|
|
}
|
|
|
|
}
|
2015-11-29 16:43:56 +00:00
|
|
|
}
|
2015-12-08 01:33:11 +00:00
|
|
|
|
2015-12-03 23:26:45 +00:00
|
|
|
] // end actions
|
2015-10-08 23:57:10 +00:00
|
|
|
|
2015-11-30 00:48:10 +00:00
|
|
|
MouseArea {
|
|
|
|
height: childrenRect.height
|
|
|
|
width: MobileComponents.Units.gridUnit * 10
|
|
|
|
CheckBox {
|
|
|
|
//text: "Run location service"
|
|
|
|
id: locationCheckbox
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
top: parent.top
|
|
|
|
}
|
|
|
|
checked: manager.locationServiceEnabled
|
|
|
|
onCheckedChanged: {
|
|
|
|
manager.locationServiceEnabled = checked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MobileComponents.Label {
|
|
|
|
x: MobileComponents.Units.gridUnit * 1.5
|
|
|
|
anchors {
|
|
|
|
left: locationCheckbox.right
|
|
|
|
//leftMargin: units.smallSpacing
|
|
|
|
verticalCenter: locationCheckbox.verticalCenter
|
|
|
|
}
|
|
|
|
text: "Run location service"
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
print("Click.")
|
|
|
|
locationCheckbox.checked = !locationCheckbox.checked
|
2015-11-30 00:32:55 +00:00
|
|
|
}
|
|
|
|
}
|
2015-10-08 23:57:10 +00:00
|
|
|
}
|
2015-11-29 18:09:59 +00:00
|
|
|
|
2015-12-04 02:32:52 +00:00
|
|
|
contextDrawer: MobileComponents.ContextDrawer {
|
|
|
|
id: contextDrawer
|
|
|
|
actions: rootItem.pageStack.currentPage ? rootItem.pageStack.currentPage.contextualActions : null
|
|
|
|
title: "Actions"
|
|
|
|
}
|
|
|
|
|
2015-11-29 18:09:59 +00:00
|
|
|
QtObject {
|
|
|
|
id: subsurfaceTheme
|
|
|
|
property int titlePointSize: Math.round(fontMetrics.font.pointSize * 1.5)
|
2015-11-29 22:39:14 +00:00
|
|
|
property int smallPointSize: Math.round(fontMetrics.font.pointSize * 0.8)
|
2015-11-29 18:09:59 +00:00
|
|
|
property color accentColor: "#2d5b9a"
|
|
|
|
property color accentTextColor: "#ececec"
|
|
|
|
}
|
2015-10-08 23:57:10 +00:00
|
|
|
|
2015-11-29 20:13:57 +00:00
|
|
|
toolBar: TopBar {
|
|
|
|
width: parent.width
|
|
|
|
height: Layout.minimumHeight
|
|
|
|
}
|
2015-07-17 15:28:01 +00:00
|
|
|
|
2015-11-29 20:13:57 +00:00
|
|
|
property Item stackView: pageStack
|
2015-11-29 21:51:49 +00:00
|
|
|
initialPage: DiveList {
|
|
|
|
anchors.fill: detailsPage
|
|
|
|
id: diveDetails
|
2015-07-12 17:56:48 +00:00
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
Preferences {
|
|
|
|
id: prefsWindow
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2015-12-03 22:06:52 +00:00
|
|
|
CloudCredentials {
|
|
|
|
id: cloudCredWindow
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2015-07-21 12:00:29 +00:00
|
|
|
DiveDetails {
|
|
|
|
id: detailsWindow
|
|
|
|
visible: false
|
|
|
|
}
|
2015-07-23 11:46:02 +00:00
|
|
|
|
|
|
|
DownloadFromDiveComputer {
|
|
|
|
id: downloadDivesWindow
|
|
|
|
visible: false
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
2015-11-06 21:53:26 +00:00
|
|
|
ThemeTest {
|
|
|
|
id: themetest
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2015-10-08 23:57:10 +00:00
|
|
|
Component.onCompleted: {
|
2015-12-05 03:34:59 +00:00
|
|
|
manager.finishSetup();
|
2015-10-08 23:57:10 +00:00
|
|
|
}
|
2015-05-27 10:34:55 +00:00
|
|
|
}
|