aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/locationinformation.h
diff options
context:
space:
mode:
authorGravatar Willem Ferguson <willemferguson@zoology.up.ac.za>2020-01-19 12:06:50 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-24 09:51:02 -0800
commit1ecd5065a0f821bb9406b5f651ebf6db5d6c2040 (patch)
tree005526bde95db900712a9de2e37d1f9886305c0b /desktop-widgets/locationinformation.h
parent1f51251f1b80304d65c36b46cfa84ba892a62683 (diff)
downloadsubsurface-1ecd5065a0f821bb9406b5f651ebf6db5d6c2040.tar.gz
Desktop: Import dive coordinates directly from GPS
This allows Subsurface to obtain the coordinates of a dive directly from a GPS track. It parses a GPX file (GPX V1.0 or V1.1) from a GPS to locate the trackpoint immediatedly after the start of a dive. There is an additional "Use GPS file" button in the Edit Dive Site panel that is selected from the Notes tab. Image: This allows one to select a GPX file, bringing up the Import GPS dialog. There is extensive provision for cross-checking that the dive track synchronises with the dive start and end. If the Save button in the dialog is pressed the dive coordinates are copied into the Dive Coordinates text box in the Edit Dive Site panel. The map moves to indicate the location of the dive site. The bulk of the work is done in importgps.cpp. The code is pretty intergrated: I tried to break it up in smaller commits but that was not feasible. The code includes responses to the comments by @neolit123 and @bstoeger. The C-based file input was replaced with Qt-based code using QChar, QString and QFile. [Dirk Hohndel: fixed several small issues in the .ui file, removed various headers includes that weren't needed and fixed printing of minutes as zero padded] Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/locationinformation.h')
-rw-r--r--desktop-widgets/locationinformation.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h
index 0e53a4439..a936269e6 100644
--- a/desktop-widgets/locationinformation.h
+++ b/desktop-widgets/locationinformation.h
@@ -7,6 +7,7 @@
#include "ui_locationinformation.h"
#include "modeldelegates.h"
#include "qt-models/divelocationmodel.h"
+#include "desktop-widgets/importgps.h"
#include <stdint.h>
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
@@ -17,6 +18,7 @@ public:
LocationInformationWidget(QWidget *parent = 0);
bool eventFilter(QObject*, QEvent*) override;
void initFields(dive_site *ds);
+ Ui::LocationInformation ui;
protected:
void enableLocationButtons(bool enable);
@@ -31,6 +33,7 @@ public slots:
void on_diveSiteDistance_textChanged(const QString &s);
void reverseGeocode();
void mergeSelectedDiveSites();
+ void on_GPSbutton_clicked();
private slots:
void updateLabels();
void diveSiteChanged(struct dive_site *ds, int field);
@@ -39,7 +42,6 @@ private slots:
private:
void keyPressEvent(QKeyEvent *e) override;
void clearLabels();
- Ui::LocationInformation ui;
GPSLocationInformationModel filter_model;
dive_site *diveSite;
int64_t closeDistance; // Distance of "close" dive sites in mm