summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joakim Bygdell <j.bygdell@gmail.com>2017-07-23 09:38:40 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-23 23:47:22 +0900
commitd51fe03bd9195380aeec031a6e45eda5f44404f0 (patch)
tree28297346ed0feb262a3a55ee5a93a4ba04c6c26c
parent3b3f6b67f570c44609dba3690ee958b05e10933a (diff)
downloadsubsurface-d51fe03bd9195380aeec031a6e45eda5f44404f0.tar.gz
QML UI: move location services to GPS menu
Move the location services switch to the GPS menu, indicate both with icon and text if the service is active or not. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
-rw-r--r--mobile-widgets/qml/Settings.qml35
-rw-r--r--mobile-widgets/qml/main.qml9
-rw-r--r--mobile-widgets/qmlmanager.cpp1
3 files changed, 10 insertions, 35 deletions
diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml
index 8669c3bb1..f3418e01f 100644
--- a/mobile-widgets/qml/Settings.qml
+++ b/mobile-widgets/qml/Settings.qml
@@ -308,41 +308,6 @@ Kirigami.ScrollablePage {
}
}
- Kirigami.Label {
- text: qsTr("Run location service")
- Layout.alignment: Qt.AlignRight
- Layout.preferredWidth: gridWidth * 0.75
- }
- Switch {
- id: locationButton
- Layout.preferredWidth: gridWidth * 0.25
- visible: manager.locationServiceAvailable
- checked: manager.locationServiceEnabled
- onClicked: {
- manager.locationServiceEnabled = checked
- }
- indicator: Rectangle {
- implicitWidth: Kirigami.Units.largeSpacing * 3
- implicitHeight: Kirigami.Units.largeSpacing
- x: locationButton.leftPadding
- y: parent.height / 2 - height / 2
- radius: Kirigami.Units.largeSpacing * 0.5
- color: locationButton.checked ?
- subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
- border.color: subsurfaceTheme.darkerPrimaryColor
-
- Rectangle {
- x: locationButton.checked ? parent.width - width : 0
- y: parent.height / 2 - height / 2
- width: Kirigami.Units.largeSpacing * 1.5
- height: Kirigami.Units.largeSpacing * 1.5
- radius: height / 2
- color: locationButton.down || locationButton.checked ?
- subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
- border.color: subsurfaceTheme.darkerPrimaryColor
- }
- }
- }
}
Rectangle {
color: subsurfaceTheme.darkerPrimaryColor
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 98825e98a..0a45ab09e 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -24,6 +24,7 @@ Kirigami.ApplicationWindow {
property QtObject notification: null
property bool showingDiveList: false
property alias syncToCloud: manager.syncToCloud
+ property alias locationServiceEnabled: manager.locationServiceEnabled
property alias showPin: manager.showPin
onNotificationTextChanged: {
if (notificationText != "") {
@@ -229,6 +230,14 @@ if you have network connectivity and want to sync your data to cloud storage."),
manager.clearGpsData();
}
}
+
+ Kirigami.Action {
+ iconName: locationServiceEnabled ? "icons/ic_location_off.svg" : "icons/ic_place.svg"
+ text: locationServiceEnabled ? qsTr("Disable location service") : qsTr("Run location service")
+ onTriggered: {
+ locationServiceEnabled = !locationServiceEnabled
+ }
+ }
},
Kirigami.Action {
iconName: "icons/ic_info_outline.svg"
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 3612fb73c..eec2c00ac 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1213,6 +1213,7 @@ void QMLManager::setLocationServiceEnabled(bool locationServiceEnabled)
{
m_locationServiceEnabled = locationServiceEnabled;
locationProvider->serviceEnable(m_locationServiceEnabled);
+ emit locationServiceEnabledChanged();
}
bool QMLManager::locationServiceAvailable() const