From cf634a3ed47e756d70f0228044ebd0be794886f9 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sat, 22 Oct 2022 14:35:59 +0100 Subject: Add a settings page --- src/MainMapView.qml | 15 +++++++------ src/SettingsPage.qml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.qml | 11 +++++----- src/resources.qrc | 1 + 4 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 src/SettingsPage.qml (limited to 'src') diff --git a/src/MainMapView.qml b/src/MainMapView.qml index 9a00a45..82815f9 100644 --- a/src/MainMapView.qml +++ b/src/MainMapView.qml @@ -4,6 +4,11 @@ import QtPositioning 5.15 import QtLocation 5.15 Item { + Label { + text: "Map Data from OpenStreetMap" + anchors.centerIn: parent + z: 0 + } Map { id: mapView plugin: mapProvider @@ -20,7 +25,7 @@ Item { width: height iconColor: "blue" z: 2 - onClicked: mapView.zoomLevel = mapView.zoomLevel + 0.1 + onClicked: mapView.zoomLevel = mapView.zoomLevel + 0.3 } IconButton { iconName: "ios-remove-circle-outline" @@ -30,7 +35,7 @@ Item { width: height iconColor: "blue" z: 2 - onClicked: mapView.zoomLevel = mapView.zoomLevel - 0.1 + onClicked: mapView.zoomLevel = mapView.zoomLevel - 0.3 } IconButton { iconName: "ios-locate-outline" @@ -49,10 +54,6 @@ Item { width: height iconColor: "blue" z: 2 - // Icon { - // anchors.fill: parent - // name: "ios-circle-outline" - // // color: parent.iconColor - // } + onClicked: pageStack.push(settingsPage,{}) } } diff --git a/src/SettingsPage.qml b/src/SettingsPage.qml new file mode 100644 index 0000000..189ebe4 --- /dev/null +++ b/src/SettingsPage.qml @@ -0,0 +1,60 @@ +import QtQuick 2.0 +import org.asteroid.controls 1.0 +import QtPositioning 5.15 +import QtLocation 5.15 + +Item { + id: root + PageHeader { + text: "Map settings" + } + Flickable { + anchors.fill: parent + contentHeight: contentColumn.implicitHeight + anchors.leftMargin: root.width*0.15 + anchors.rightMargin: root.width*0.15 + Column { + id: contentColumn + anchors.fill: parent + Item { + height: root.height*0.1 + width: parent.width + } + LabeledSwitch { + width: parent.width + height: width*0.2 + text: "show zoom controls" + } + LabeledSwitch { + width: parent.width + height: width*0.2 + text: "center on GPS" + } + Row { + width: parent.width + height: width*0.2 + // Icon { + // name: "ios-information-circle-outline" + // height: parent.height + // width: height + // } + Column { + height: parent.height + width: parent.width - parent.height + Label { + text: "Map Data © OpenStreetMap contributors" + height: parent.height*0.5 + width: parent.width + font.pixelSize: root.width*0.05 + } + Label { + text: "under the ODbL" + height: parent.height*0.5 + width: parent.width + font.pixelSize: root.width*0.05 + } + } + } + } + } +} diff --git a/src/main.qml b/src/main.qml index 5442abc..693e9d4 100644 --- a/src/main.qml +++ b/src/main.qml @@ -9,17 +9,12 @@ Application { centerColor: "#9800A6" outerColor: "#0C0009" - Label { - text: "Map Data from OpenStreetMap" - anchors.centerIn: parent - z: 0 - } Plugin { id: mapProvider name: "osm" } LayerStack { - id: pagestack + id: pageStack anchors.fill: parent firstPage: mainmapview } @@ -28,4 +23,8 @@ Application { id: mainmapview MainMapView {} } + Component { + id: settingsPage + SettingsPage {} + } } diff --git a/src/resources.qrc b/src/resources.qrc index bd1509f..66c9640 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -2,5 +2,6 @@ main.qml MainMapView.qml + SettingsPage.qml -- cgit v1.2.3-70-g09d2