From 2bc76beb65bacd8640170d85e40bdc844a368570 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 7 May 2014 13:58:07 -0700 Subject: [PATCH] Globe: we always center on the current dive Simplify the API (we'll take advantage of this in the next commit). We always center the globe on the current dive, so no point in passing that dive in. Signed-off-by: Dirk Hohndel --- qt-ui/globe.cpp | 3 ++- qt-ui/globe.h | 2 +- qt-ui/maintab.cpp | 2 +- qt-ui/mainwindow.cpp | 2 +- qt-ui/subsurfacewebservices.cpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index 275d7ee85..f5b60ac23 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -207,8 +207,9 @@ void GlobeGPS::reload() repopulateLabels(); } -void GlobeGPS::centerOn(dive *dive) +void GlobeGPS::centerOnCurrentDive() { + struct dive *dive = current_dive; // dive has changed, if we had the 'editingDive', hide it. if (messageWidget->isVisible() && (!dive || dive_has_gps_location(dive) || amount_selected != 1 )) diff --git a/qt-ui/globe.h b/qt-ui/globe.h index 91ea46c02..7331a033f 100644 --- a/qt-ui/globe.h +++ b/qt-ui/globe.h @@ -19,7 +19,7 @@ public: GlobeGPS(QWidget *parent); void reload(); void repopulateLabels(); - void centerOn(struct dive *dive); + void centerOnCurrentDive(); bool eventFilter(QObject *, QEvent *); protected: diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index e02fa1988..65eb86290 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -891,7 +891,7 @@ void MainTab::rejectChanges() MainWindow::instance()->dive_list()->setFocus(); // the user could have edited the location and then canceled the edit // let's get the correct location back in view - MainWindow::instance()->globe()->centerOn(current_dive); + MainWindow::instance()->globe()->centerOnCurrentDive(); } #undef EDIT_TEXT2 diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 861b6868c..b03fbe14c 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -147,7 +147,7 @@ void MainWindow::current_dive_changed(int divenr) { if (divenr >= 0) { select_dive(divenr); - ui.globe->centerOn(get_dive(selected_dive)); + ui.globe->centerOnCurrentDive(); } /* It looks like it's a bit too cumberstone to send *one* dive using a QList, diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 0f062265b..5170b3a40 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -343,7 +343,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button) if (merge_locations_into_dives()) { mark_divelist_changed(true); MainWindow::instance()->globe()->repopulateLabels(); - MainWindow::instance()->globe()->centerOn(current_dive); + MainWindow::instance()->globe()->centerOnCurrentDive(); MainWindow::instance()->information()->updateDiveInfo(selected_dive); }