aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-07 13:58:07 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-07 15:17:47 -0700
commit2bc76beb65bacd8640170d85e40bdc844a368570 (patch)
treeb86d3115dbedb2ea59676d6e0bd40c658e16151a /qt-ui
parenta209dfbfd53f8ba4310a89ffde4cc02a6edb2d16 (diff)
downloadsubsurface-2bc76beb65bacd8640170d85e40bdc844a368570.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/globe.cpp3
-rw-r--r--qt-ui/globe.h2
-rw-r--r--qt-ui/maintab.cpp2
-rw-r--r--qt-ui/mainwindow.cpp2
-rw-r--r--qt-ui/subsurfacewebservices.cpp2
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);
}