mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 08:53:24 +00:00
QML-UI: add hacky, useless way to show the GPS location of a dive
This is of course stupid and NOT what we want to do, but one could argue it's better than nothing (well, not sure, whatever). If we have a GPS location associated with a dive and you tap on the location name when showing the dive details, it opens a static image of a satellite map with a marker for the dive site. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7ffe7a8c8a
commit
bf239e7c42
5 changed files with 35 additions and 0 deletions
|
@ -13,6 +13,7 @@ MobileComponents.Page {
|
||||||
flickable: flick
|
flickable: flick
|
||||||
|
|
||||||
property string location
|
property string location
|
||||||
|
property string gps
|
||||||
property string depth
|
property string depth
|
||||||
property string dive_id
|
property string dive_id
|
||||||
property string diveNumber
|
property string diveNumber
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
|
/*
|
||||||
|
import QtWebView 1.0
|
||||||
|
*/
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.2
|
||||||
import QtQuick.Controls.Styles 1.2
|
import QtQuick.Controls.Styles 1.2
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
|
@ -29,7 +32,26 @@ GridLayout {
|
||||||
text: location
|
text: location
|
||||||
Layout.columnSpan: 4
|
Layout.columnSpan: 4
|
||||||
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
|
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
if (gps !== "")
|
||||||
|
manager.showMap(gps)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Rectangle {
|
||||||
|
id: mapView
|
||||||
|
width: parent.width
|
||||||
|
height: parents.width * 0.7
|
||||||
|
WebView {
|
||||||
|
id: webView
|
||||||
|
anchors.fill: parent
|
||||||
|
url: "http://www.google.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
MobileComponents.Label {
|
MobileComponents.Label {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
id: dateLabel
|
id: dateLabel
|
||||||
|
|
|
@ -28,6 +28,7 @@ MobileComponents.Page {
|
||||||
diveListView.currentIndex = model.index
|
diveListView.currentIndex = model.index
|
||||||
detailsWindow.width = parent.width
|
detailsWindow.width = parent.width
|
||||||
detailsWindow.location = location
|
detailsWindow.location = location
|
||||||
|
detailsWindow.gps = gps
|
||||||
detailsWindow.dive_id = id
|
detailsWindow.dive_id = id
|
||||||
detailsWindow.diveNumber = diveNumber
|
detailsWindow.diveNumber = diveNumber
|
||||||
detailsWindow.duration = duration
|
detailsWindow.duration = duration
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QAuthenticator>
|
#include <QAuthenticator>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
#include "qt-models/divelistmodel.h"
|
#include "qt-models/divelistmodel.h"
|
||||||
#include "divelist.h"
|
#include "divelist.h"
|
||||||
|
@ -467,3 +468,12 @@ void QMLManager::setStartPageText(QString text)
|
||||||
m_startPageText = text;
|
m_startPageText = text;
|
||||||
emit startPageTextChanged();
|
emit startPageTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMLManager::showMap(QString location)
|
||||||
|
{
|
||||||
|
if (!location.isEmpty()) {
|
||||||
|
QString link = QString("https://maps.googleapis.com/maps/api/staticmap?center=%1&zoom=15&size=600x400&maptype=satellite&markers=color:red|%2")
|
||||||
|
.arg(location).arg(location);
|
||||||
|
QDesktopServices::openUrl(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ public slots:
|
||||||
void sendGpsData();
|
void sendGpsData();
|
||||||
void clearGpsData();
|
void clearGpsData();
|
||||||
void finishSetup();
|
void finishSetup();
|
||||||
|
void showMap(QString location);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_cloudUserName;
|
QString m_cloudUserName;
|
||||||
|
|
Loading…
Add table
Reference in a new issue