summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-02 18:13:50 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-02 23:38:36 -0700
commiteb9d6d0f94adaf390ae94428afca74c78bc53c53 (patch)
tree6394c39454e544b381692ae5c2a4eb976a1b5b57 /qthelper.cpp
parentdb4a003ef52baeee8f7d56e56f8314cf61ec4b64 (diff)
downloadsubsurface-eb9d6d0f94adaf390ae94428afca74c78bc53c53.tar.gz
Rewrite dive edit logic
The existing code took an odd approach. It tried to change all selected dives whenever the user edited a field, and kept all this backup data in case the user rejected the edits. This code takes the opposite approach. Only edit a copy of the selected dive and then when the user accepts it, edit all the dives and when the user rejects the edit simply redraw the screen (as all the "real" data is still unchanged). This not only saves quite a bit of code, it should be much easier to get correct. Admitedly this code will need quite a bit more testing to make sure it works as intended, but as far as I can tell it already gets more scenarios right than the previous implementation. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index bcf78b5d1..d8626f9d7 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -161,10 +161,13 @@ bool parseGpsText(const QString &gps_text, double *latitude, double *longitude)
return false;
}
-bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed)
+bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out)
{
double latitude, longitude;
int latudeg, longudeg;
+ bool ignore;
+ bool *parsed = parsed_out ?: &ignore;
+
/* if we have a master and the dive's gps address is different from it,
* don't change the dive */