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-07-12 17:42:23 +00:00
|
|
|
title: qsTr("Subsurface mobile")
|
|
|
|
property bool fullscreen: true
|
2015-07-13 00:39:13 +00:00
|
|
|
property alias messageText: message.text
|
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-11-29 16:43:56 +00:00
|
|
|
globalDrawer: MobileComponents.GlobalDrawer{
|
|
|
|
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: [
|
|
|
|
Action {
|
|
|
|
text: "Preferences"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(prefsWindow)
|
|
|
|
}
|
|
|
|
},
|
2015-11-07 02:08:05 +00:00
|
|
|
|
2015-11-29 16:43:56 +00:00
|
|
|
Action {
|
|
|
|
text: "Load Dives"
|
|
|
|
onTriggered: {
|
|
|
|
manager.loadDives();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: "Download Dives"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(downloadDivesWindow)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: "Add Dive"
|
|
|
|
onTriggered: {
|
|
|
|
manager.addDive();
|
|
|
|
stackView.push(detailsWindow)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: "Save Changes"
|
|
|
|
onTriggered: {
|
|
|
|
manager.saveChanges();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
MobileComponents.ActionGroup {
|
|
|
|
text: "GPS"
|
|
|
|
Action {
|
|
|
|
text: "Run location service"
|
|
|
|
checkable: true
|
|
|
|
checked: manager.locationServiceEnabled
|
|
|
|
onToggled: {
|
|
|
|
manager.locationServiceEnabled = checked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: "Apply GPS data to dives"
|
|
|
|
onTriggered: {
|
|
|
|
manager.applyGpsData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: "Send GPS data to server"
|
|
|
|
onTriggered: {
|
|
|
|
manager.sendGpsData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: "Clear stored GPS data"
|
|
|
|
onTriggered: {
|
|
|
|
manager.clearGpsData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: "View Log"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(logWindow)
|
|
|
|
}
|
|
|
|
},
|
2015-10-08 23:57:10 +00:00
|
|
|
|
2015-11-29 16:43:56 +00:00
|
|
|
Action {
|
|
|
|
text: "Theme Information"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(themetest)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2015-10-08 23:57:10 +00:00
|
|
|
}
|
2015-11-29 18:09:59 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: subsurfaceTheme
|
|
|
|
property int titlePointSize: Math.round(fontMetrics.font.pointSize * 1.5)
|
|
|
|
property int smallPointSize: Math.round(fontMetrics.font.pointSize * 0.7)
|
|
|
|
property color accentColor: "#2d5b9a"
|
|
|
|
property color accentTextColor: "#ececec"
|
|
|
|
}
|
2015-10-08 23:57:10 +00:00
|
|
|
|
2015-07-26 10:48:33 +00:00
|
|
|
Menu {
|
|
|
|
id: prefsMenu
|
|
|
|
title: "Menu"
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: "Preferences"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(prefsWindow)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: "Load Dives"
|
|
|
|
onTriggered: {
|
|
|
|
manager.loadDives();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: "Download Dives"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(downloadDivesWindow)
|
|
|
|
}
|
|
|
|
}
|
2015-08-10 05:35:47 +00:00
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: "Add Dive"
|
|
|
|
onTriggered: {
|
|
|
|
manager.addDive();
|
|
|
|
stackView.push(detailsWindow)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-26 10:48:33 +00:00
|
|
|
MenuItem {
|
|
|
|
text: "Save Changes"
|
|
|
|
onTriggered: {
|
|
|
|
manager.saveChanges();
|
|
|
|
}
|
|
|
|
}
|
2015-08-19 07:18:26 +00:00
|
|
|
|
2015-11-11 20:34:56 +00:00
|
|
|
MenuItem {
|
|
|
|
text: "Run location service"
|
|
|
|
checkable: true
|
|
|
|
checked: manager.locationServiceEnabled
|
|
|
|
onToggled: {
|
2015-11-11 23:19:09 +00:00
|
|
|
manager.locationServiceEnabled = checked;
|
2015-11-11 20:34:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-13 04:23:00 +00:00
|
|
|
MenuItem {
|
|
|
|
text: "Apply GPS data to dives"
|
|
|
|
onTriggered: {
|
|
|
|
manager.applyGpsData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-14 01:21:43 +00:00
|
|
|
MenuItem {
|
|
|
|
text: "Send GPS data to server"
|
|
|
|
onTriggered: {
|
|
|
|
manager.sendGpsData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-14 01:20:45 +00:00
|
|
|
MenuItem {
|
|
|
|
text: "Clear stored GPS data"
|
|
|
|
onTriggered: {
|
|
|
|
manager.clearGpsData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-19 07:18:26 +00:00
|
|
|
MenuItem {
|
|
|
|
text: "View Log"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(logWindow)
|
|
|
|
}
|
|
|
|
}
|
2015-11-06 21:53:26 +00:00
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: "Theme Information"
|
|
|
|
onTriggered: {
|
|
|
|
stackView.push(themetest)
|
|
|
|
}
|
|
|
|
}
|
2015-07-26 10:48:33 +00:00
|
|
|
}
|
|
|
|
|
2015-11-07 02:08:05 +00:00
|
|
|
ColumnLayout {
|
2015-07-10 08:05:13 +00:00
|
|
|
anchors.fill: parent
|
2015-07-17 15:28:01 +00:00
|
|
|
|
2015-11-07 02:08:05 +00:00
|
|
|
TopBar {
|
2015-06-10 18:39:43 +00:00
|
|
|
|
2015-11-07 02:08:05 +00:00
|
|
|
}
|
2015-06-10 18:39:43 +00:00
|
|
|
|
2015-11-07 02:08:05 +00:00
|
|
|
StackView {
|
|
|
|
id: stackView
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
Layout.fillHeight: true
|
|
|
|
focus: true
|
|
|
|
Keys.onReleased: if (event.key == Qt.Key_Back && stackView.depth > 1) {
|
|
|
|
stackView.pop()
|
|
|
|
event.accepted = true;
|
2015-07-12 17:56:48 +00:00
|
|
|
}
|
2015-11-07 02:08:05 +00:00
|
|
|
initialItem: Item {
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: awLayout
|
|
|
|
anchors.fill: parent
|
2015-11-29 16:43:56 +00:00
|
|
|
spacing: MobileComponents.Units.gridUnit / 2
|
2015-11-07 02:08:05 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: detailsPage
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
DiveList {
|
|
|
|
anchors.fill: detailsPage
|
|
|
|
id: diveDetails
|
2015-11-29 16:43:56 +00:00
|
|
|
color: MobileComponents.Theme.backgroundColor
|
2015-11-07 02:08:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: messageArea
|
|
|
|
height: childrenRect.height
|
|
|
|
Layout.fillWidth: true
|
2015-11-29 16:43:56 +00:00
|
|
|
color: MobileComponents.Theme.backgroundColor
|
2015-06-10 18:39:43 +00:00
|
|
|
|
2015-11-07 02:08:05 +00:00
|
|
|
Text {
|
|
|
|
id: message
|
2015-11-29 16:43:56 +00:00
|
|
|
color: MobileComponents.Theme.textColor
|
2015-11-11 23:18:57 +00:00
|
|
|
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
|
2015-11-29 16:43:56 +00:00
|
|
|
styleColor: MobileComponents.Theme.textColor
|
2015-11-29 18:21:27 +00:00
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
2015-11-07 02:08:05 +00:00
|
|
|
}
|
2015-07-13 00:39:13 +00:00
|
|
|
}
|
2015-11-07 02:08:05 +00:00
|
|
|
}
|
2015-07-10 08:05:13 +00:00
|
|
|
}
|
2015-06-09 19:20:44 +00:00
|
|
|
}
|
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-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
|
|
|
|
2015-11-06 21:53:26 +00:00
|
|
|
ThemeTest {
|
|
|
|
id: themetest
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2015-10-08 23:57:10 +00:00
|
|
|
Component.onCompleted: {
|
2015-11-29 16:43:56 +00:00
|
|
|
print("MobileComponents.Units.gridUnit is: " + MobileComponents.Units.gridUnit);
|
2015-10-08 23:57:10 +00:00
|
|
|
}
|
2015-05-27 10:34:55 +00:00
|
|
|
}
|