summaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-02 07:09:40 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-02 12:46:59 -0500
commit69c10808af442140829975ee1cf893160e3be10d (patch)
tree920867c4eb230888c5b6193571690719da227f97 /qt-mobile
parentf677d482e9db6f4d566eac40909bb7c8f01fafd7 (diff)
downloadsubsurface-69c10808af442140829975ee1cf893160e3be10d.tar.gz
QML UI: don't go through manager object to show map
We can open URLs in the browser directly from QML. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qml/DiveDetailsView.qml2
-rw-r--r--qt-mobile/qml/GpsList.qml5
-rw-r--r--qt-mobile/qml/main.qml8
-rw-r--r--qt-mobile/qmlmanager.cpp10
-rw-r--r--qt-mobile/qmlmanager.h1
5 files changed, 11 insertions, 15 deletions
diff --git a/qt-mobile/qml/DiveDetailsView.qml b/qt-mobile/qml/DiveDetailsView.qml
index c423ef016..ef1dc5605 100644
--- a/qt-mobile/qml/DiveDetailsView.qml
+++ b/qt-mobile/qml/DiveDetailsView.qml
@@ -54,7 +54,7 @@ Item {
anchors.fill: parent
onClicked: {
if (dive.gps !== "")
- manager.showMap(dive.gps)
+ showMap(dive.gps)
}
}
}
diff --git a/qt-mobile/qml/GpsList.qml b/qt-mobile/qml/GpsList.qml
index 54dc02121..6903acd80 100644
--- a/qt-mobile/qml/GpsList.qml
+++ b/qt-mobile/qml/GpsList.qml
@@ -36,7 +36,7 @@ Kirigami.ScrollablePage {
property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1
Kirigami.BasicListItem {
- supportsMouseEvents: true
+ supportsMouseEvents: true
width: parent.width - Kirigami.Units.gridUnit
height: childrenRect.height - Kirigami.Units.smallSpacing
GridLayout {
@@ -99,8 +99,7 @@ Kirigami.ScrollablePage {
Kirigami.Action {
iconName: "gps"
onTriggered: {
- print("show map")
- manager.showMap(latitude + " " + longitude)
+ showMap(latitude + " " + longitude)
}
}
diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml
index 9365052a8..b578ffe51 100644
--- a/qt-mobile/qml/main.qml
+++ b/qt-mobile/qml/main.qml
@@ -46,6 +46,14 @@ Kirigami.ApplicationWindow {
diveList.scrollToTop()
}
+ function showMap(location) {
+ var urlPrefix = "https://www.google.com/maps/place/"
+ var locationPair = location + "/@" + location
+ var urlSuffix = ",5000m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0"
+ Qt.openUrlExternally(urlPrefix + locationPair + urlSuffix)
+
+ }
+
function startAddDive() {
detailsWindow.state = "add"
detailsWindow.dive_id = manager.addDive();
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index a3506ce4d..96ab5421c 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -959,16 +959,6 @@ void QMLManager::setCredentialStatus(const credentialStatus_t value)
}
}
-void QMLManager::showMap(const QString& location)
-{
- if (!location.isEmpty()) {
- QString link = QString("https://www.google.com/maps/place/%1/@%2,5000m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0")
- .arg(location)
- .arg(location);
- QDesktopServices::openUrl(link);
- }
-}
-
// where in the QML dive list is that dive?
int QMLManager::getIndex(const QString &diveId)
{
diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h
index de04156f5..2d7e913ef 100644
--- a/qt-mobile/qmlmanager.h
+++ b/qt-mobile/qmlmanager.h
@@ -103,7 +103,6 @@ public slots:
void clearGpsData();
void finishSetup();
void openLocalThenRemote(QString url);
- void showMap(const QString& location);
int getIndex(const QString& diveId);
QString getNumber(const QString& diveId);
QString getDate(const QString& diveId);