From 12d5a1e9aadc26ddd4aceadb96234bc4f378b39e Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Tue, 21 Nov 2017 14:23:04 -0800 Subject: navigation: qml: remove start address and use current GPS location Change RouteAddress form to use start location from current GPS coordinate instead of entering a start address. Bug-AGL: SPEC-1068 Change-Id: Id1a42ba409d24e527e613b67b9ac4583aff92ed4 Signed-off-by: Matt Ranostay --- app/forms/RouteAddress.qml | 17 ++++------------ app/forms/RouteAddressForm.ui.qml | 41 --------------------------------------- app/map/MapComponent.qml | 2 +- 3 files changed, 5 insertions(+), 55 deletions(-) diff --git a/app/forms/RouteAddress.qml b/app/forms/RouteAddress.qml index 248396d..e41277e 100644 --- a/app/forms/RouteAddress.qml +++ b/app/forms/RouteAddress.qml @@ -44,31 +44,25 @@ import QtPositioning 5.5 RouteAddressForm { property alias plugin : tempGeocodeModel.plugin; - property variant fromAddress; property variant toAddress; + property variant fromCoordinate; signal showMessage(string topic, string message) signal showRoute(variant startCoordinate,variant endCoordinate) signal closeForm() goButton.onClicked: { tempGeocodeModel.reset() - fromAddress.country = fromCountry.text - fromAddress.street = fromStreet.text - fromAddress.city = fromCity.text toAddress.country = toCountry.text toAddress.street = toStreet.text toAddress.city = toCity.text - tempGeocodeModel.startCoordinate = QtPositioning.coordinate() + tempGeocodeModel.startCoordinate = fromCoordinate tempGeocodeModel.endCoordinate = QtPositioning.coordinate() - tempGeocodeModel.query = fromAddress + tempGeocodeModel.query = fromCoordinate tempGeocodeModel.update(); goButton.enabled = false; } clearButton.onClicked: { - fromStreet.text = "" - fromCity.text = "" - fromCountry.text = "" toStreet.text = "" toCity.text = "" toCountry.text = "" @@ -79,9 +73,6 @@ RouteAddressForm { } Component.onCompleted: { - fromStreet.text = fromAddress.street - fromCity.text = fromAddress.city - fromCountry.text = fromAddress.country toStreet.text = toAddress.street toCity.text = toAddress.city toCountry.text = toAddress.country @@ -102,7 +93,7 @@ RouteAddressForm { } onStatusChanged: { - if ((status == GeocodeModel.Ready) && (count == 1)) { + if ((status == GeocodeModel.Ready) && count >= 1) { success++ if (success == 1) { startCoordinate.latitude = get(0).coordinate.latitude diff --git a/app/forms/RouteAddressForm.ui.qml b/app/forms/RouteAddressForm.ui.qml index 3f98dc0..5e43e7f 100644 --- a/app/forms/RouteAddressForm.ui.qml +++ b/app/forms/RouteAddressForm.ui.qml @@ -44,12 +44,9 @@ import QtQuick.Controls 1.4 import QtQuick.Layouts 1.2 Item { - property alias fromStreet: fromStreet - property alias fromCountry: fromCountry property alias toStreet: toStreet property alias toCity: toCity property alias toCountry: toCountry - property alias fromCity: fromCity property alias goButton: goButton property alias clearButton: clearButton property alias cancelButton: cancelButton @@ -91,44 +88,6 @@ Item { columns: 2 anchors.fill: parent - Label { - id: label1 - text: qsTr("From") - font.bold: true - anchors.horizontalCenter: parent.horizontalCenter - Layout.columnSpan : 2 - } - - Label { - id: label2 - text: qsTr("Street") - } - - TextField { - id: fromStreet - Layout.fillWidth: true - } - - Label { - id: label3 - text: qsTr("City") - } - - TextField { - id: fromCity - Layout.fillWidth: true - } - - Label { - id: label7 - text: qsTr("Country") - } - - TextField { - id: fromCountry - Layout.fillWidth: true - } - Label { id: label6 text: qsTr("To") diff --git a/app/map/MapComponent.qml b/app/map/MapComponent.qml index ce669ff..f8e8e37 100644 --- a/app/map/MapComponent.qml +++ b/app/map/MapComponent.qml @@ -377,7 +377,7 @@ Map { stackView.push(Qt.resolvedUrl("../forms/RouteAddress.qml"), { "plugin": map.plugin, "toAddress": toAddress, - "fromAddress": fromAddress}) + "fromCoordinate": map.location}) stackView.currentItem.showRoute.connect(map.calculateCoordinateRoute) stackView.currentItem.showMessage.connect(stackView.showMessage) stackView.currentItem.closeForm.connect(stackView.closeForm) -- cgit 1.2.3-korg