diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-04-15 06:01:14 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-15 13:22:16 -0700 |
commit | 71d74f9e3c7cb49ab93aef035dbf7735b5ae3454 (patch) | |
tree | 668579dde6e2bec4e566ebc35892d1310c2fd40f /core | |
parent | c111c4bb022229e66fb15cf8a7967bf79180a441 (diff) | |
download | subsurface-71d74f9e3c7cb49ab93aef035dbf7735b5ae3454.tar.gz |
QML UI: rewrite the commitChanges function
I couldn't figure out how to break this down into small, useful commits.
Part of the problem is that I kept going while working on this and as you
can see from looking at the commit, diff tries so hard to find small code
fragments that moved around, that the diff overall becomes quite
unreadable and it seemed impossible to recreate the sequence of steps
after the fact.
It all started with adding the parsing for the GPS coordinates. But while
testing that code I found several issues with the rest of the function.
Most importantly it seemed ridiculous that we carefully tried to match the
texts that the DiveObjectHelper would create for the various fields,
instead of just using the DiveObjectHelper to do just that. And once I had
converted that I once again realized just how long and hard to understand
that function was getting and decided to break out some of the more
complex parts into their own helper functions.
But of course all this didn't happen in this logical, structured, ordered
way. Instead I did all of these things at the same time, testing,
rearranging, etc.
So in the end I went with one BIG commit that does all of this in one fell
swoop.
This adds four helper functions to deal with start time/date, duration,
location and gps coordinates, and depth of the dive.
To avoid mistakes when dealing with the GPS coordinates, there's another
helper to encapsulate the creation of the dive site and we switched to a
current GPS location.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/gpslocation.cpp | 2 | ||||
-rw-r--r-- | core/gpslocation.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp index 8595cc45d..b56cb7b8c 100644 --- a/core/gpslocation.cpp +++ b/core/gpslocation.cpp @@ -111,7 +111,7 @@ QString GpsLocation::currentPosition() // ok, we need to get the current position and somehow in the callback update the location in the QML UI // punting right now waitingForPosition = true; - return QString("waiting for the next gps location"); + return GPS_CURRENT_POS; } void GpsLocation::newPosition(QGeoPositionInfo pos) diff --git a/core/gpslocation.h b/core/gpslocation.h index 82b51a291..e1b485832 100644 --- a/core/gpslocation.h +++ b/core/gpslocation.h @@ -10,6 +10,8 @@ #include <QNetworkReply> #include <QMap> +#define GPS_CURRENT_POS QObject::tr("Waiting to aquire GPS location") + struct gpsTracker { degrees_t latitude; degrees_t longitude; |