blob: c2e8787e9338d912344726edf315c9adba512560 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
import QtQuick 2.0
import org.asteroid.controls 1.0 as Asteroid
import QtPositioning 5.15
import QtLocation 5.15
import Nemo.Configuration 1.0
Item {
id: root
// FlatMesh {
// centerColor: "#003ee9"
// outerColor: "#00bc1b"
// anchors.fill: parent
// }
Asteroid.PageHeader {
text: "Add waypoint"
}
ConfigurationValue {
id: waypointList
key: "/map/waypointList"
defaultValue: ""
}
property string selectedIcon: "ios-locate-outline"
property variant coord
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
Asteroid.TextField {
id: textBox
width: parent.width
height: parent.width*0.2
//for the default text, we probably want a date/time
previewText: "Waypoint name"
text: Date.toLocaleString(Locale.ShortFormat)
}
ListView {
id: iconSelectorView
width: parent.width
height: width*0.2
orientation: ListView.Horizontal
model: iconModel
delegate: Asteroid.IconButton {
iconName: name
onClicked: root.selectedIcon = model.name
height: iconSelectorView.height
width: height
iconColor: root.selectedIcon == model.name ? colours.primary : colours.primaryUnselected
}
ListModel {
id: iconModel
ListElement {
name: "ios-locate-outline"
}
ListElement {
name: "ios-checkmark"
}
ListElement {
name: "ios-help"
}
ListElement {
name: "ios-information"
}
ListElement {
name: "ios-body-outline"
}
ListElement {
name: "ios-bicycle"
}
ListElement {
name: "ios-car-outline"
}
ListElement {
name: "ios-boat-outline"
}
}
}
Asteroid.IconButton {
width: parent.width*0.2
height: width
iconName: "ios-checkmark-circle-outline"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: appendWayPoint()
}
}
}
function appendWayPoint() { //the colours.primary is currently a placeholder. it would be nice to let users select colours, but I CBA to write a colour picker right now.
var newWayPointString = selectedIcon + ";" + coord.latitude + "," + coord.longitude + ";" + colours.primary + ";" + textBox.text + ";" + Date.now() + ">"
console.log(newWayPointString)
waypointList.value = waypointList.value + newWayPointString
setPointControls.visible = false
mapControls.visible = true
pageStack.pop(pageStack.currentLayer)
}
}
|