From d24de5b72b69d6a114654706f6f7821b73bf4400 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 10 Jun 2015 07:09:23 -0700 Subject: [PATCH] Don't show all the auto generated dive sites on the globe When downloading GPS data from the Subsurface webservice we repopulated the globe before purging all the unused GPS fixes from the list of dive sites which caused massive clutter (until the next time the user changed the displayed dive or did anything else that caused the globe to redraw itself). Signed-off-by: Dirk Hohndel --- qt-ui/subsurfacewebservices.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 6050782b2..825d4f03d 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -334,6 +334,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button) int i; struct dive *d; struct dive_site *ds; + bool changed = false; clear_table(&gps_location_table); QByteArray url = tr("Webservice").toLocal8Bit(); parse_xml_buffer(url.data(), downloadedData.data(), downloadedData.length(), &gps_location_table, NULL); @@ -346,12 +347,8 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button) } /* now merge the data in the gps_location table into the dive_table */ if (merge_locations_into_dives()) { + changed = true; mark_divelist_changed(true); -#ifndef NO_MARBLE - - MainWindow::instance()->globe()->repopulateLabels(); - MainWindow::instance()->globe()->centerOnDiveSite(current_dive->dive_site_uuid); -#endif MainWindow::instance()->information()->updateDiveInfo(); } @@ -387,6 +384,15 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button) i--; // otherwise we skip one site } } +#ifndef NO_MARBLE + // finally now that all the extra GPS fixes that weren't used have been deleted + // we can update the globe + if (changed) { + MainWindow::instance()->globe()->repopulateLabels(); + MainWindow::instance()->globe()->centerOnDiveSite(current_dive->dive_site_uuid); + } +#endif + } break; case QDialogButtonBox::RejectRole: if (reply != NULL && reply->isOpen()) {