Skip to content

Commit 31cdd92

Browse files
committed
Version 0.1.3: Disable navigate button when not on a place, switch to grid unit scale.
1 parent 6554dcb commit 31cdd92

2 files changed

Lines changed: 35 additions & 10 deletions

File tree

app/Main.qml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import Ubuntu.Content 1.3
2+
import Ubuntu.Components 1.3
13
import QtQuick 2.9
24
import QtQuick.Controls 2.9
35
import QtWebEngine 1.9
46

5-
ApplicationWindow {
7+
MainView {
68
visible: true
79
id: app
8-
title: "Google Maps Navigator"
10+
applicationName: "mapsexporter.pparent"
911

1012
Component.onCompleted: {
1113
// Vérifie s'il y a au moins un argument
@@ -28,7 +30,7 @@ ApplicationWindow {
2830
anchors.horizontalCenter: parent.horizontalCenter
2931
anchors.bottom: navigateButton.top
3032
width: parent.width
31-
height: parent.height - 50
33+
height: parent.height - units.gu(11)
3234
url: "https://www.google.com/maps"
3335

3436
profile: WebEngineProfile {
@@ -42,14 +44,36 @@ ApplicationWindow {
4244
onFeaturePermissionRequested: function(securityOrigin, feature) {
4345
grantFeaturePermission(securityOrigin, feature, false);
4446
}
47+
onUrlChanged: {
48+
if ( url.toString().indexOf("/place/") !== -1)
49+
{
50+
navigate.enabled=true
51+
}
52+
else
53+
{
54+
var urlStr = url.toString();
55+
var latMatch = urlStr.match(/!3d([-0-9.]+)/);
56+
var lonMatch = urlStr.match(/!4d([-0-9.]+)/);
57+
if (latMatch && lonMatch) {
58+
navigate.enabled=true
59+
}
60+
else
61+
{
62+
navigate.enabled=false
63+
}
64+
}
65+
}
66+
4567
}
4668

4769
Button {
4870
text: "Navigate with Ubuntu Touch!"
4971
anchors.left: parent.left
5072
anchors.right: parent.right
5173
anchors.bottom: parent.bottom
52-
height:100
74+
enabled:false
75+
id:navigate
76+
height:units.gu(11)
5377
anchors.horizontalCenter: parent.horizontalCenter
5478
onClicked: {
5579
var t = mapView.title
@@ -68,20 +92,21 @@ ApplicationWindow {
6892
contentItem: Row {
6993
anchors.centerIn: parent
7094
anchors.verticalCenter: parent.verticalCenter
71-
spacing: 8
95+
spacing: units.gu(1)
7296

7397
Text {
7498
text: "Navigate with Ubuntu Touch! "
7599
color: "black"
76100
font.pixelSize: 16
77101
font.bold: true
102+
font.family: "Roboto"
78103
anchors.verticalCenter: parent.verticalCenter
79104
}
80105

81106
Image {
82107
source: "img/Ubports-robot.png"
83-
width: 50
84-
height: 50
108+
width: units.gu(6)
109+
height: units.gu(6)
85110
fillMode: Image.PreserveAspectFit
86111
anchors.verticalCenter: parent.verticalCenter
87112
}
@@ -156,8 +181,8 @@ Rectangle {
156181
BusyIndicator {
157182
id: loadingIndicator
158183
running: true
159-
width: 60
160-
height: 60
184+
width: units.gu(6)
185+
height: units.gu(6)
161186
anchors.horizontalCenter: parent.horizontalCenter
162187
}
163188

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"content-hub": "mapsexporter.contenthub"
1313
}
1414
},
15-
"version": "0.1.2",
15+
"version": "0.1.3",
1616
"maintainer": "Pierre Parent <pro@pierre-parent.fr>",
1717
"framework" : "ubuntu-sdk-20.04"
1818
}

0 commit comments

Comments
 (0)