this *should* fix linus issues with geocoordinates. I hope.
From 5fd0d9e0394b589616e51a9a98a271abf3934b1f Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 30 Sep 2015 19:06:05 -0300 Subject: [PATCH 1/4] Remove unused code
Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index e7b6a33..8857e3b 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -430,10 +430,6 @@ void MainTab::refreshDiveInfo() void MainTab::updateDiveInfo(bool clear) { - // I don't like this code here - but globe() wasn't initialized on the constructor. - { - } - ui.location->refreshDiveSiteCache(); EditMode rememberEM = editMode; // don't execute this while adding / planning a dive -- 2.6.0
From 91d08c792e8da2baa9c403c995e04962d6dd0b34 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 30 Sep 2015 19:29:03 -0300 Subject: [PATCH 2/4] Make 'Choose DiveSite' work as 'Rename' But it will also create a new dive site, not rename it. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 8857e3b..a70f390 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -885,13 +885,17 @@ void MainTab::updateDiveSite(int divenr) } newDs = get_dive_site_by_uuid(pickedUuid); - copy_dive_site(newDs, &displayed_dive_site); + + // Copy everything from the displayed_dive_site, so we have the latitude, longitude, notes, etc. + // The user *might* be using wrongly the 'choose dive site' just to edit the name of it, sigh. + if(origDs) { + copy_dive_site(origDs, newDs); + free(newDs->name); + newDs->name = copy_string(qPrintable(ui.location->text().constData())); + newDs->uuid = pickedUuid; + } if (origDs && pickedUuid != origDs->uuid && same_string(origDs->notes, "SubsurfaceWebservice")) { - // this is a special case - let's keep the GPS data and - // remove the original dive site if this was the only user - newDs->latitude.udeg = origDs->latitude.udeg; - newDs->longitude.udeg = origDs->longitude.udeg; if (!is_dive_site_used(origDs->uuid, false)) { if (verbose) qDebug() << "delete the autogenerated dive site" << origDs->name; -- 2.6.0
From deed68919fa3ea0a9f33b15a8cf6148a73189f14 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 30 Sep 2015 19:33:33 -0300 Subject: [PATCH 3/4] Better way to handle the tooltip for dive sites Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/locationinformation.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index ea73575..736f7d4 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -310,11 +310,9 @@ QVariant DiveLocationModel::data(const QModelIndex &index, int role) const case Qt::DisplayRole: return new_ds_value[index.row()]; case Qt::ToolTipRole: - if (same_string(displayed_dive_site.notes,"SubsurfaceWebservice")) - return "Update dive site name"; - else - return "Create a new dive site"; - return "Create a new dive site"; + return displayed_dive_site.uuid ? + tr("Create a new dive site, copying relevant information from the current dive.") : + tr("Create a new dive site with this name"); case Qt::DecorationRole: return plusIcon; } -- 2.6.0
From b16ebe61981722fd48a6216f5bb0fa03d79d6896 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 30 Sep 2015 19:58:38 -0300 Subject: [PATCH 4/4] Fix multi-dive edit regarding Dive Sites Now it correctly sets the same dive site instead of creating a new one for each dive. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 20 +++++++++++--------- qt-ui/maintab.h | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index a70f390..a192385 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -856,28 +856,27 @@ void MainTab::updateDisplayedDiveSite() // when this is called we already have updated the current_dive and know that it exists // there is no point in calling this function if there is no current dive -void MainTab::updateDiveSite(int divenr) +uint32_t MainTab::updateDiveSite(uint32_t pickedUuid, int divenr) { qDebug() << "accepting the change and updating the actual dive site data"; struct dive *cd = get_dive(divenr); if (!cd) - return; + return 0; if (ui.location->text().isEmpty()) { qDebug() << "No location data set, not updating the dive site."; - return; + return 0; } - uint32_t pickedUuid = ui.location->currDiveSiteUuid(); if (pickedUuid == 0) - return; + return 0; const uint32_t origUuid = cd->dive_site_uuid; struct dive_site *origDs = get_dive_site_by_uuid(origUuid); struct dive_site *newDs = NULL; if (pickedUuid == origUuid) { - return; + return origUuid; } if (pickedUuid == RECENTLY_ADDED_DIVESITE) { @@ -905,6 +904,7 @@ void MainTab::updateDiveSite(int divenr) cd->dive_site_uuid = pickedUuid; qDebug() << "Setting the dive site id on the dive:" << pickedUuid; + return pickedUuid; } void MainTab::acceptChanges() @@ -930,7 +930,7 @@ void MainTab::acceptChanges() record_dive(added_dive); addedId = added_dive->id; // make sure that the dive site is handled as well - updateDiveSite(get_idx_by_uniq_id(added_dive->id)); + updateDiveSite(ui.location->currDiveSiteUuid(), get_idx_by_uniq_id(added_dive->id)); // unselect everything as far as the UI is concerned and select the new // dive - we'll have to undo/redo this later after we resort the dive_table @@ -1055,9 +1055,11 @@ void MainTab::acceptChanges() // update the dive site for the selected dives that had the same dive site as the current dive uint32_t oldUuid = cd->dive_site_uuid; + uint32_t newUuid = 0; MODIFY_SELECTED_DIVES( - if (mydive->dive_site_uuid == current_dive->dive_site_uuid) - updateDiveSite(get_idx_by_uniq_id(mydive->id)); + if (mydive->dive_site_uuid == current_dive->dive_site_uuid) { + newUuid = updateDiveSite(newUuid == 0 ? ui.location->currDiveSiteUuid() : newUuid, get_idx_by_uniq_id(mydive->id)); + } ); if (!is_dive_site_used(oldUuid, false)) { if (verbose) { diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 502ea69..1fffc21 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -123,7 +123,7 @@ private: dive_trip_t displayedTrip; bool acceptingEdit; void updateDisplayedDiveSite(); - void updateDiveSite(int divenr); + uint32_t updateDiveSite(uint32_t pickedUuid, int divenr); }; #endif // MAINTAB_H -- 2.6.0
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
