Initial comit

This commit is contained in:
Niels
2025-05-31 09:58:34 +02:00
commit e44717c1f3
40 changed files with 2221 additions and 0 deletions
+77
View File
@@ -0,0 +1,77 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
//allowedOrientations: Orientation.Landscape | Orientation.Portrait
SilicaFlickable {
anchors.fill: parent
contentHeight: column.height
Column {
id: column
PageHeader {
title: qsTr("About Anchor v.")+Qt.application.version
}
width: parent.width
spacing: Theme.paddingLarge
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Author")
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeLarge
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: "Niels Simonsen (nesnomis)"
font.pixelSize: Theme.fontSizeMedium
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Info")
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeLarge
}
Text {
x: Theme.paddingLarge
width: parent.width - 2*Theme.paddingLarge
wrapMode: Text.Wrap
text: qsTr("Anchor is a small app using compass/magnetometer and GPS to mark your current position (make an anchor) so you can find your direction back. This could be where you parked your car, or other useful places?!")
font.pixelSize: Theme.fontSizeMedium
color: Theme.primaryColor
horizontalAlignment: Text.AlignHCenter
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Copyrights (2018)")
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeLarge
}
Label {
text: qsTr("Anchor is public domain. If nothing else is stated, it is licened under GPL.")
x: Theme.paddingLarge
width: parent.width - 2*Theme.paddingLarge
wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeMedium
color: Theme.primaryColor
horizontalAlignment: Text.AlignHCenter
}
Image {
anchors.horizontalCenter: parent.horizontalCenter
opacity: 0.7
fillMode: Image.PreserveAspectFit
source: "../images/harbour-anchor.png"//anchorIcon !== "0" ? anchorIcon : "image://theme/icon-m-whereami" //anchorIcon !== "0" ? anchorIcon + "?" + Theme.highlightColor : "image://theme/icon-m-whereami?" + Theme.highlightColor
}
}
}
}
+211
View File
@@ -0,0 +1,211 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
//import "../components"
Dialog {
id: page
canAccept: sName.text !== "" && lName.text !=="" && la.text !== "" && lo.text !=="" ? true : false
property bool edit: false
property bool newAnchor: false
allowedOrientations: Orientation.Portrait
SilicaFlickable {
anchors.fill: parent
contentX: 0
contentHeight: col1.height
//contentWidth: text.width; contentHeight: text.height
Column {
id: col1
anchors.left: parent.left
anchors.right: parent.right
spacing: Theme.paddingMedium
DialogHeader {}
Label {
id: aLabel
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: edit ? qsTr("Edit anchor") : qsTr("Create anchor")
}
Separator {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
color: Theme.highlightColor
}
Row {
width:parent.width
TextField {
id: sName
width: parent.width - iBtn.width
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: {focus = false;lName.focus = true}
placeholderText: edit && !newAnchor ? "" : qsTr("Anchor name")
text: edit ? anchorName : ""
label: qsTr("Anchor name")
}
Image {
id:iBtn
source: edit ? anchorIcon : "image://theme/icon-m-car"
}
}
TextField {
id: lName
width: parent.width
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: {edit || newAnchor? la.focus = true : focus = false}
placeholderText: edit && !newAnchor ? "" : qsTr("Anchor description")
text: edit ? anchorDescription : ""
label: qsTr("Anchor description")
}
Label {
id: iLabel
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: qsTr("Choose icon")
}
Separator {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
color: Theme.highlightColor
}
Grid {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
columns: 4
spacing: 2
IconButton {
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-car"
onClicked: iBtn.source = icon.source
}
IconButton {
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-airplane-mode"
onClicked: iBtn.source = icon.source
}
IconButton {
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-whereami"
onClicked: iBtn.source = icon.source
}
IconButton {
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-person"
onClicked: iBtn.source = icon.source
}
IconButton {
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-train"
onClicked: iBtn.source = icon.source
}
IconButton {
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-region"
onClicked: iBtn.source = icon.source
}
IconButton {
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-favorite"
onClicked: iBtn.source = icon.source
}
IconButton {
id: lim
width: parent.width / 4
height: width / 1.5
icon.source: "image://theme/icon-m-home"
onClicked: iBtn.source = icon.source
}
}
Label {
id: cLabel
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: qsTr("Latitude & Longitude")
}
Separator {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
color: Theme.highlightColor
}
Item {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
height: Theme.itemSizeMedium
TextField {
id: lo
enabled: edit || newAnchor
anchors.left: parent.horizontalCenter
anchors.leftMargin: Theme.paddingLarge
width: parent.width * 0.5 - Theme.paddingLarge
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: {focus = false}
inputMethodHints: Qt.ImhFormattedNumbersOnly //| Qt.ImhNoPredictiveText
placeholderText: newAnchor ? "Longitude" : ""
text: edit ? anchorLongitude : newAnchor ? "" : aGps.currentLongitude
onTextChanged: text = text.replace(",",".")
}
TextField {
id: la
enabled: edit || newAnchor
anchors.right: parent.horizontalCenter
anchors.rightMargin: Theme.paddingLarge
anchors.top: lo.top
width: parent.width * 0.5 - Theme.paddingLarge
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: {focus = false;lo.focus = true}
inputMethodHints: Qt.ImhFormattedNumbersOnly //| Qt.ImhNoPredictiveText
placeholderText: newAnchor ? "Latitude" : ""
horizontalAlignment: Qt.AlignRight
text: edit ? anchorLatitude : newAnchor ? "" : aGps.currentLatitude
onTextChanged: text = text.replace(",",".")
}
}
}
}
onAccepted: {
console.log("*** ACCEPTED")
if (sName.text !== "" && la.text !== "" && lo.text !=="") {
if (edit && !newAnchor) settings.delAnchor(anchorName)
anchorIcon = iBtn.source
anchorName = sName.text
anchorDescription = lName.text
anchorLatitude = la.text
anchorLongitude = lo.text
settings.setSettings(anchorLatitude,anchorLongitude,anchorIcon,anchorName,anchorDescription)
settings.getAnchors(dbAnchors)
settings.setAnchor(anchorName, anchorDescription, anchorIcon, anchorLatitude, anchorLongitude)
settings.getAnchors(dbAnchors)
}
}
}
+307
View File
@@ -0,0 +1,307 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "../components"
import QtSensors 5.0
Page {
id: page
property int dots: 1
property real calibration: aCompass.calibration ? aCompass.calibration : aMagnetometer.calibration
allowedOrientations: Orientation.Portrait
SilicaFlickable {
anchors.fill: parent
contentHeight: Screen.height
PullDownMenu {
// pageStack.push(Qt.resolvedUrl("AddAnchorPage.qml"),{edit: true,newAnchor: false});
MenuItem {
enabled: false//aGps.active
visible: false
text: qsTr("Refresh to current position")
onClicked: {
anchorLatitude = aGps.currentLatitude
anchorLongitude = aGps.currentLongitude
settings.setSettings(anchorLatitude,anchorLongitude,anchorIcon,anchorName,anchorDescription)
settings.setAnchor(anchorName, anchorDescription, anchorIcon, anchorLatitude, anchorLongitude)
}
}
MenuItem {
enabled: aGps.active
visible: aGps.active && anchorLatitude !=="" ? true : false
text: qsTr("Edit current position")
onClicked: pageStack.push(Qt.resolvedUrl("AddAnchorPage.qml"),{edit: true,newAnchor: false});
}
MenuItem {
enabled: aGps.active
visible: aGps.active
text: qsTr("Add current position")
onClicked: pageStack.push(Qt.resolvedUrl("AddAnchorPage.qml"),{edit: false,newAnchor: false});//posTimer.running = true//pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
MenuItem {
enabled: true
text: qsTr("Add custom position")
onClicked: pageStack.push(Qt.resolvedUrl("AddAnchorPage.qml"),{edit: false,newAnchor: true});//posTimer.running = true//pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
}
MenuItem {
enabled: true
text: qsTr("Select anchor")
onClicked: {pageStack.push(Qt.resolvedUrl("ChooseAnchorsPage.qml"))}
}
}
PushUpMenu {
MenuItem {
enabled: true
text: aGps.enabled ? qsTr("Disable GPS in app") : qsTr("Enable GPS in app")
onClicked: aGps.enabled ? aGps.enabled = false : aGps.enabled = true
}
MenuItem {
enabled: true
text: qsTr("Settings")
onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
}
MenuItem {
enabled: true
text: qsTr("About Anchor")
onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
}
}
Item {
id: header2
visible: !header.visible
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: Theme.paddingLarge
anchors.top: parent.top
anchors.bottom: compassCapsule.top
anchors.bottomMargin: Theme.paddingLarge
Row {
spacing: Theme.paddingLarge
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Image {
//id:iBtn
height: apHeader2.height+apInfo2.height
width: height
fillMode: Image.PreserveAspectFit
source: "../images/harbour-anchor.png"//anchorIcon !== "0" ? anchorIcon : "image://theme/icon-m-whereami" //anchorIcon !== "0" ? anchorIcon + "?" + Theme.highlightColor : "image://theme/icon-m-whereami?" + Theme.highlightColor
}
Column {
Label {
id: apHeader2
style: Text.Outline; styleColor: Theme.secondaryHighlightColor;
font.pixelSize: Theme.fontSizeHuge
text: qsTr("Anchor") //anchorName !== "0" ? anchorName : qsTr("No anchor") //"Anchor: Quick"
}
Label {
id: apInfo2
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeMedium
text: qsTr("A compass & anchor app") //anchorDescription !== "0" ? anchorDescription : "" // "[Default anchor]"
}
}
}
}
Item {
id: header
visible: aGps.enabled
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: Theme.paddingLarge
anchors.top: parent.top
anchors.bottom: compassCapsule.top
anchors.bottomMargin: Theme.paddingLarge
Row {
spacing: Theme.paddingMedium
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Image {
id:iBtn
height: apHeader.height+apInfo.height
width: height
fillMode: Image.PreserveAspectFit
source: anchorIcon ? anchorIcon : "image://theme/icon-m-whereami" //anchorIcon !== "0" ? anchorIcon + "?" + Theme.highlightColor : "image://theme/icon-m-whereami?" + Theme.highlightColor
}
Column {
Label {
id: apHeader
style: Text.Outline; styleColor: Theme.secondaryHighlightColor;
font.pixelSize: Theme.fontSizeExtraLarge
text: anchorName ? anchorName : qsTr("No anchor") //"Anchor: Quick"
}
Label {
id: apInfo
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeMedium
text: anchorDescription ? anchorDescription : qsTr("Add an anchor") // "[Default anchor]"
}
}
}
}
CompassCapsule {
id: compassCapsule
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: parent.width * 0.8
height: width
anchorArrow: aGps.active && aGps.distance > anchorRadius ? 0.8 : 0.0
azimuth: aCompass.enabled ? aCompass.azimuth : aMagnetometer.azimuth
anchor: aGps.direction
}
Dot {
id: dotN
visible: !showCompasNumbers
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: compassCapsule.top
width: compassCapsule.width / 12
color: Theme.highlightColor
opacity: aGps.active && aGps.distance > anchorRadius ? 0.7 : 0.1
}
Item {
id: footer
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: Theme.paddingLarge
anchors.top: compassCapsule.bottom
anchors.bottom: info.top
anchors.bottomMargin: Theme.paddingLarge
Column {
spacing: Theme.paddingMedium
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Label {
id: gpsconnect
anchors.horizontalCenter: parent.horizontalCenter
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeHuge//aGps.active ? Theme.fontSizeHuge : Theme.fontSizeExtraLarge
text: aGps.active ? aGps.distance > anchorRadius ? qsTr("Distance: ")+aGps.distance + " m" : qsTr("HERE") : aGps.enabled ? qsTr("WAITING FOR GPS") : azimuth
Timer {
property bool up
id: glowingTimer
running: !aGps.active && aGps.enabled
repeat: true
interval: 100
onRunningChanged: if (!running) gpsconnect.opacity = 1
onTriggered: {
if (gpsconnect.opacity == 1){
up = false
} else if (gpsconnect.opacity < 0.5) {
up = true
}
if (up)
gpsconnect.opacity += 0.1
else
gpsconnect.opacity -= 0.1
}
}
}
Label {
id: gpsheight
visible: aGps.enabled
anchors.horizontalCenter: parent.horizontalCenter
color: Theme.secondaryColor
font.pixelSize: aGps.active ? Theme.fontSizeExtraLarge : Theme.fontSizeMedium
text: aGps.active ? qsTr("Altitude: ")+aGps.currentAltitude + " m" : qsTr("Make sure your phone GPS is enabled!")
}
}
}
Rectangle {
id: calibRect
color: "transparent"
border.color: Theme.highlightColor
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingMedium
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Theme.paddingMedium
anchors.rightMargin: Theme.paddingMedium
height: calibrationBar.height
visible: calibration < 1 ? true : false//aCompass.enabled ? aCompass.calibration < 1 && aCompass.calibration > 0 ? true : aMagnetometer.calibration < 1 && aMagnetometer.calibration > 0 ? true : false : false
ProgressBar {
id: calibrationBar
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
minimumValue: 0.0
maximumValue: 1.0
width: parent.width
value: aCompass.enabled ? aCompass.calibration : aMagnetometer.calibration
label: qsTr("Rotate phone to calibrate compass")
}
}
Label {
id: info
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: Theme.paddingLarge
anchors.bottom: parent.bottom
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeSmall
text: "Anchor v."+Qt.application.version+" "+qsTr("is an app by")+" nesnomis"
visible: !calibRect.visible
}
Rectangle {
id: rect
visible: false
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: page.width * 0.75
height: width
color: Theme.highlightDimmerColor
border.color: Theme.highlightColor
border.width: 1
radius: width
Column {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Text {
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeHuge
text: aGps.positionBearing + " ("+aGps.direction+")"
}
Text {
visible: aCompass.running
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeHuge
text: aCompass.enabled ? aCompass.azimuth : aMagnetometer.azimuth//compass.compassBearing + " ("+compass.compasNumber+")"
}
}
}
}
Component.onCompleted: {
settings.getQanchor()
var types = QmlSensors.sensorTypes();
console.log(types.join(", "));
}
}
+127
View File
@@ -0,0 +1,127 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
SilicaListView {
id: listView
anchors.fill: parent
clip: true
header: PageHeader {
id: pHeader
title: qsTr("Anchors")
}
model: dbModel
delegate: ListItem {
id: delegate
height: menuOpen ? contextMenu.height + img.height + (Theme.paddingMedium * 2): img.height + (Theme.paddingMedium * 2)
contentHeight: img.height
width: parent.width - Theme.paddingMedium * 2
anchors.horizontalCenter: parent.horizontalCenter
menu: contextMenu
showMenuOnPressAndHold: true
ListView.onRemove: animateRemoval(delegate)
function remove() {
remorseAction(qsTr("Deleting"), function() { settings.delAnchor(name);listView.model.remove(index) })
}
ContextMenu {
id: contextMenu
MenuItem {
id:mlisten
text: qsTr("Select anchor")
//enabled: false
onClicked: {
aGps.enabled = true
anchorIcon = icon
anchorName = name
anchorDescription = description
anchorLatitude = latitude
anchorLongitude = longitude
settings.setSettings(latitude,longitude,icon,name,description)
pageStack.navigateBack() }
}
MenuItem {
id:medit
text: qsTr("Edit anchor")
enabled: true
onClicked: {
// aGps.enabled = true
// anchorIcon = icon
// anchorName = name
// anchorDescription = description
//anchorLatitude = latitude
//anchorLongitude = longitude
anchorIcon = icon
anchorName = name
anchorDescription = description
anchorLatitude = latitude
anchorLongitude = longitude
settings.setSettings(latitude,longitude,icon,name,description)
pageStack.push(Qt.resolvedUrl("AddAnchorPage.qml"),{edit: true,newAnchor: false});
//settings.setSettings(anchorLatitude,anchorLatitude,anchorIcon,anchorName,anchorDescription)
//pageStack.navigateBack()
}
// onClicked: window.pageStack.push(Qt.resolvedUrl("AddOwnRadio.qml"),
// {infotext: qsTr("Edit radio station"),titlfield: title,streamurlfield: source,homepagefield: site,sectionfield: section,oldsource: source})
}
MenuItem {
id:mdelete
text: qsTr("Delete anchor")
onClicked: remove()//listView.currentItem.remove(rpindex,rpsource) //listView.remorseAction();
}
}
Row {
spacing: Theme.paddingLarge
width: parent.width
Image {
id: img
height: aName.height + aDesc.height
width: height
fillMode: Image.PreserveAspectFit
source: icon
}
Column {
Text {
id: aName
text: name
color: highlighted ? Theme.highlightColor : Theme.primaryColor
wrapMode: Text.ElideRight
font.pixelSize: Theme.fontSizeLarge
}
Text {
id: aDesc
text: description
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
wrapMode: Text.ElideRight
font.pixelSize: Theme.fontSizeMedium
}
}
}
onClicked: {
aGps.enabled = true
anchorIcon = icon
anchorName = name
anchorDescription = description
anchorLatitude = latitude
anchorLongitude = longitude
settings.setSettings(latitude,longitude,icon,name,description)
pageStack.navigateBack()
}
}
}
}
+43
View File
@@ -0,0 +1,43 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable {
anchors.fill: parent
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
PullDownMenu {
MenuItem {
text: qsTr("Show Page 2")
onClicked: pageStack.animatorPush(Qt.resolvedUrl("SecondPage.qml"))
}
}
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
Column {
id: column
width: page.width
spacing: Theme.paddingLarge
PageHeader {
title: qsTr("UI Template")
}
Label {
x: Theme.horizontalPageMargin
text: qsTr("Hello Sailors")
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeExtraLarge
}
}
}
}
+30
View File
@@ -0,0 +1,30 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
SilicaListView {
id: listView
model: 20
anchors.fill: parent
header: PageHeader {
title: qsTr("Nested Page")
}
delegate: BackgroundItem {
id: delegate
Label {
x: Theme.horizontalPageMargin
text: qsTr("Item") + " " + index
anchors.verticalCenter: parent.verticalCenter
color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
}
onClicked: console.log("Clicked " + index)
}
VerticalScrollDecorator {}
}
}
+124
View File
@@ -0,0 +1,124 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Dialog {
id: settingsDialog
property bool aComp
property bool aMag
property int aR: anchorRadius
Column {
//id: col1
anchors.left: parent.left
anchors.right: parent.right
spacing: Theme.paddingMedium
DialogHeader {}
Label {
id: sLabel
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: qsTr("Compass")
}
Separator {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
color: Theme.highlightColor
}
TextSwitch {
id: activateACompass
width: parent.width
checked: aCompass.enabled
enabled: false //aCompass.running
text: qsTr("Compass")
description: qsTr("Enables the compass")
onCheckedChanged: {
activateAMagnet.checked = !checked
aComp = checked
aMag = !checked
}
}
TextSwitch {
id: activateAMagnet
width: parent.width
checked: aMagnetometer.enabled
enabled: false //aMagnetometer.running
text: qsTr("Magnetometer")
description: qsTr("Activates the magnetometer")
onCheckedChanged: {
activateACompass.checked = !checked
aComp = !checked
aMag = checked
}
}
TextSwitch {
id: activateNumbers
width: parent.width
checked: showCompasNumbers
enabled: true //aMagnetometer.running
text: qsTr("Degrees")
description: qsTr("Show degrees in compass")
onCheckedChanged: {
}
}
Label {
id: rLabel
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: qsTr("Here radius")+" "+rSlider.value + " "+qsTr("meters")
}
Slider {
id: rSlider
width: parent.width
minimumValue: 1
maximumValue: 30
stepSize: 1.0
value: aR
onValueChanged: aR = value
}
Label {
// id: sLabel
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: qsTr("Anchor settings")
}
Separator {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
color: Theme.highlightColor
}
TextSwitch {
id: keepSon
width: parent.width
checked: keepScreenOn
enabled: true //aMagnetometer.running
text: qsTr("Prevent screensaver")
description: qsTr("Prevent screensaver when Anchor is active")
}
}
onAccepted: {
activateNumbers.checked ? showCompasNumbers = 1 : showCompasNumbers = 0
var scron
keepSon.checked ? scron = 1 : scron = 0
keepScreenOn = keepSon.checked
settings.setSettingSetting(aComp,aMag,aR,showCompasNumbers,scron)
anchorRadius = aR
}
}