1 |
import Qt 4.7
|
2 |
import "pagenavigation.js" as Navit
|
3 |
|
4 |
Rectangle {
|
5 |
id: page
|
6 |
|
7 |
width: gui.width; height: gui.height
|
8 |
color: "Black"
|
9 |
opacity: 0
|
10 |
|
11 |
function pageOpen() {
|
12 |
page.opacity = 1;
|
13 |
if (navit.getPosition().length>0) {
|
14 |
btnPoi.opacity=0.8;
|
15 |
}
|
16 |
if (navit.getDestination().length>0 && navit.getPosition().length>0) {
|
17 |
btnRouteView.opacity=0.8;
|
18 |
btnRouteBook.opacity=0.8;
|
19 |
btnRouteHeight.opacity=0.8;
|
20 |
}
|
21 |
route.getDestinations();
|
22 |
}
|
23 |
|
24 |
Component.onCompleted: pageOpen();
|
25 |
|
26 |
Behavior on opacity {
|
27 |
NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
|
28 |
}
|
29 |
|
30 |
Text {
|
31 |
id: statusTxt;
|
32 |
text: route.getAttr("route_status"); color: "White"; font.pointSize: gui.height/20;
|
33 |
anchors.top:parent.top;anchors.left:parent.left;anchors.topMargin: gui.height/20;anchors.leftMargin: gui.height/20;
|
34 |
}
|
35 |
Text {
|
36 |
id: timeLabel;
|
37 |
text: "Time to drive route: "; color: "White"; font.pointSize: gui.height/20;
|
38 |
anchors.top:statusTxt.top;anchors.left:statusTxt.right;anchors.leftMargin: gui.height/20;
|
39 |
}
|
40 |
Text {
|
41 |
id: timeTxt;
|
42 |
text: route.getAttr("destination_time"); color: "White"; font.pointSize: gui.height/20;
|
43 |
anchors.top:timeLabel.top;anchors.left:timeLabel.right;anchors.leftMargin: gui.height/20;
|
44 |
}
|
45 |
Text {
|
46 |
id: lengthLabel;
|
47 |
text: "Route length: "; color: "White"; font.pointSize: gui.height/20;
|
48 |
anchors.top:timeTxt.top;anchors.left:timeTxt.right;anchors.leftMargin: gui.height/20;
|
49 |
}
|
50 |
Text {
|
51 |
id: lengthTxt;
|
52 |
text: route.getAttr("destination_length"); color: "White"; font.pointSize: gui.height/20;
|
53 |
anchors.top:lengthLabel.top;anchors.left:lengthLabel.right;anchors.leftMargin: gui.height/20;
|
54 |
}
|
55 |
|
56 |
Grid {
|
57 |
columns: 3;rows: 1
|
58 |
anchors.horizontalCenter: parent.horizontalCenter;
|
59 |
anchors.bottom: parent.verticalCenter; anchors.bottomMargin: gui.height/16;
|
60 |
spacing: gui.width/12
|
61 |
ButtonIcon {
|
62 |
id: btnRouteView; text: "View route"; icon: "gui_town.svg"; onClicked: { navit.command("zoom_to_route()"), gui.backToMap(); }
|
63 |
opacity: 0;
|
64 |
}
|
65 |
ButtonIcon {
|
66 |
id: btnRouteBook; text: "Roadbook"; icon: "gui_log.svg"; onClicked: console.log("Implement me!");
|
67 |
opacity: 0;
|
68 |
}
|
69 |
ButtonIcon {
|
70 |
id: btnRouteHeight; text: "Height profile"; icon: "peak.svg"; onClicked: console.log("Implement me!");
|
71 |
opacity: 0;
|
72 |
}
|
73 |
}
|
74 |
|
75 |
Grid {
|
76 |
columns: 3;rows: 1
|
77 |
anchors.horizontalCenter: parent.horizontalCenter;
|
78 |
anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;
|
79 |
spacing: gui.width/12
|
80 |
ButtonIcon {
|
81 |
id: btnView; text: "View position\non map"; icon: "gui_maps.svg"; onClicked: { navit.getPosition();navit.setCenter();gui.backToMap(); }
|
82 |
}
|
83 |
ButtonIcon {
|
84 |
id: btnPoi; text: "POIs near\nPosition"; icon: "attraction.svg"; onClicked: Navit.load("PagePoi.qml");
|
85 |
opacity: 0;
|
86 |
}
|
87 |
ButtonIcon {
|
88 |
id: btnStop; text: "Stop"; icon: "gui_stop.svg"; onClicked: { navit.stopNavigation(); Navit.back(); }
|
89 |
opacity: 0;
|
90 |
}
|
91 |
}
|
92 |
|
93 |
Cellar {anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
|
94 |
}
|