Changeset View
Changeset View
Standalone View
Standalone View
plasmoid/contents/ui/PlacesDelegate.qml
1 | import QtQuick 2.9 | 1 | import QtQuick 2.9 | ||
---|---|---|---|---|---|
2 | import QtQml.Models 2.2 | 2 | import QtQml.Models 2.2 | ||
3 | import QtQuick.Controls 2.2 | 3 | import QtQuick.Controls 2.2 | ||
4 | import QtQuick.Layouts 1.3 | 4 | import QtQuick.Layouts 1.3 | ||
5 | import org.kde.plasma.core 2.0 as PlasmaCore | 5 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
6 | import org.kde.plasma.plasmoid 2.0 | 6 | import org.kde.plasma.plasmoid 2.0 | ||
7 | import org.kde.plasma.components 2.0 as PlasmaComponents | 7 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
8 | 8 | | |||
9 | Rectangle { | 9 | Rectangle { | ||
10 | id: nearbyDelegateItm | 10 | id: nearbyDelegateItm | ||
11 | height: units.gridUnit * 5 | 11 | height: units.gridUnit * 5 | ||
12 | color: theme.backgroundColor | 12 | color: theme.backgroundColor | ||
13 | anchors.left: parent.left | 13 | anchors.left: parent.left | ||
14 | anchors.right: parent.right | 14 | anchors.right: parent.right | ||
15 | width: placesmodelview.view.width | 15 | width: placesmodelview.view.width | ||
16 | 16 | | |||
17 | function getRouteInformation(llat, llong, dlat, dlong, oappid, oappcode){ | ||||
18 | var routedoc = new XMLHttpRequest() | ||||
19 | var url = "https://route.cit.api.here.com/routing/7.2/calculateroute.json?waypoint0=" + llat + "," + llong + "&waypoint1=" + dlat + "," + dlong + "&mode=fastest;car;&app_id=" + oappid + "&app_code=" + oappcode + "&depature=now" | ||||
20 | routedoc.open("GET", url, true); | ||||
21 | routedoc.send() | ||||
22 | | ||||
23 | routedoc.onreadystatechange = function() { | ||||
24 | if (routedoc.readyState === XMLHttpRequest.DONE && routedoc.responseText !== "undefined") { | ||||
25 | var reqroute = routedoc.responseText | ||||
26 | if (reqroute !== "undefined") { | ||||
27 | var filterRouteDict = JSON.parse(reqroute) | ||||
28 | for (var i = 0; i<filterRouteDict.response.route[0].leg[0].maneuver.length; i++){ | ||||
29 | var getRouteDict = filterRouteDict.response.route[0].leg[0].maneuver[i].instruction | ||||
30 | console.log(JSON.stringify(getRouteDict)) | ||||
31 | routeLmodel.append({navInstruction: getRouteDict}); | ||||
32 | } | ||||
33 | } | ||||
34 | } | ||||
35 | } | ||||
36 | } | ||||
37 | | ||||
17 | ColumnLayout { | 38 | ColumnLayout { | ||
18 | id: contentdlgtitem | 39 | id: contentdlgtitem | ||
19 | anchors.fill: parent | 40 | anchors.fill: parent | ||
20 | 41 | | |||
21 | RowLayout { | 42 | RowLayout { | ||
22 | id: skillTopRowLayout | 43 | id: skillTopRowLayout | ||
23 | spacing: 5 | 44 | spacing: 5 | ||
24 | anchors.fill: parent | 45 | anchors.fill: parent | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 91 | Image { | |||
75 | width: 36 | 96 | width: 36 | ||
76 | height: 36 | 97 | height: 36 | ||
77 | 98 | | |||
78 | MouseArea { | 99 | MouseArea { | ||
79 | anchors.fill: parent | 100 | anchors.fill: parent | ||
80 | 101 | | |||
81 | onClicked: { | 102 | onClicked: { | ||
82 | var navpos = placeposition.replace(/[[\]]/g,'').split(","); | 103 | var navpos = placeposition.replace(/[[\]]/g,'').split(","); | ||
83 | Qt.openUrlExternally("https://www.google.co.in/maps/place/" + placetitle + "/@" + navpos[0] + "," + navpos[1] + ",17z"); | 104 | getRouteInformation(placelocallat, placelocallong, navpos[0], navpos[1], placeappid, placeappcode) | ||
105 | var formatedurl = "https://image.maps.cit.api.here.com/mia/1.6/mapview?c=" + placelocallat + "," + placelocallong + "&z=16&poi=" + navpos[0] + "," + navpos[1] + "&poithm=0&app_id=" + placeappid + "&app_code=" + placeappcode + "&h=" + cbheight / 2 + "&w=" + cbwidth + "&ppi=500ppi=120&t=7&f=2&i=true" | ||||
106 | navMapDrawer.open() | ||||
107 | navMapDrawer.getURL = formatedurl | ||||
84 | } | 108 | } | ||
85 | } | 109 | } | ||
86 | } | 110 | } | ||
87 | } | 111 | } | ||
88 | 112 | | |||
89 | PlasmaComponents.Label { | 113 | PlasmaComponents.Label { | ||
90 | id: tagsplccs | 114 | id: tagsplccs | ||
91 | anchors.top: plcinner.bottom | 115 | anchors.top: plcinner.bottom | ||
Show All 11 Lines |