diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-06-26 14:40:12 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-26 18:50:22 -0700 |
commit | 2fec1a88de2a075fd9586f5fb5c57b5bab2a74a6 (patch) | |
tree | c4d8690c1734b0b97be4522b27d4546b51b6f12a | |
parent | 09f2d3b35de0fc687290eece9f94e9106cc3a7aa (diff) | |
download | subsurface-2fec1a88de2a075fd9586f5fb5c57b5bab2a74a6.tar.gz |
Dive site rewrite: copy the current dive to the displayed dive
This way we can actually edit something.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | divesite.c | 13 | ||||
-rw-r--r-- | divesite.h | 1 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/divesite.c b/divesite.c index e096c7172..0abd664c0 100644 --- a/divesite.c +++ b/divesite.c @@ -156,3 +156,16 @@ bool dive_site_is_empty(struct dive_site *ds) ds->latitude.udeg == 0 && ds->longitude.udeg == 0; } + +void copy_dive_site(struct dive_site *orig, struct dive_site *copy) +{ + free(copy->name); + free(copy->notes); + free(copy->description); + + copy->latitude = orig->latitude; + copy->longitude = orig->longitude; + copy->name = copy_string(orig->name); + copy->notes = copy_string(orig->notes); + copy->description = copy_string(orig->description); +} diff --git a/divesite.h b/divesite.h index 79adf664a..13a8d7f38 100644 --- a/divesite.h +++ b/divesite.h @@ -55,6 +55,7 @@ uint32_t get_dive_site_uuid_by_name(const char *name, struct dive_site **dsp); uint32_t get_dive_site_uuid_by_gps(degrees_t latitude, degrees_t longitude, struct dive_site **dsp); uint32_t get_dive_site_uuid_by_gps_proximity(degrees_t latitude, degrees_t longitude, int distance, struct dive_site **dsp); bool dive_site_is_empty(struct dive_site *ds); +void copy_dive_site(struct dive_site *orig, struct dive_site *copy); #ifdef __cplusplus } diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index a29123521..9c8cac2bf 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -703,6 +703,7 @@ void MainTab::updateDiveInfo(bool clear) ui.locationTags->hide(); else ui.locationTags->show(); + copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site); } else { /* clear the fields */ |