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>
This commit is contained in:
Dirk Hohndel 2014-05-07 13:58:07 -07:00
parent a209dfbfd5
commit 2bc76beb65
5 changed files with 6 additions and 5 deletions

View file

@ -207,8 +207,9 @@ void GlobeGPS::reload()
repopulateLabels(); repopulateLabels();
} }
void GlobeGPS::centerOn(dive *dive) void GlobeGPS::centerOnCurrentDive()
{ {
struct dive *dive = current_dive;
// dive has changed, if we had the 'editingDive', hide it. // dive has changed, if we had the 'editingDive', hide it.
if (messageWidget->isVisible() if (messageWidget->isVisible()
&& (!dive || dive_has_gps_location(dive) || amount_selected != 1 )) && (!dive || dive_has_gps_location(dive) || amount_selected != 1 ))

View file

@ -19,7 +19,7 @@ public:
GlobeGPS(QWidget *parent); GlobeGPS(QWidget *parent);
void reload(); void reload();
void repopulateLabels(); void repopulateLabels();
void centerOn(struct dive *dive); void centerOnCurrentDive();
bool eventFilter(QObject *, QEvent *); bool eventFilter(QObject *, QEvent *);
protected: protected:

View file

@ -891,7 +891,7 @@ void MainTab::rejectChanges()
MainWindow::instance()->dive_list()->setFocus(); MainWindow::instance()->dive_list()->setFocus();
// the user could have edited the location and then canceled the edit // the user could have edited the location and then canceled the edit
// let's get the correct location back in view // let's get the correct location back in view
MainWindow::instance()->globe()->centerOn(current_dive); MainWindow::instance()->globe()->centerOnCurrentDive();
} }
#undef EDIT_TEXT2 #undef EDIT_TEXT2

View file

@ -147,7 +147,7 @@ void MainWindow::current_dive_changed(int divenr)
{ {
if (divenr >= 0) { if (divenr >= 0) {
select_dive(divenr); 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, /* It looks like it's a bit too cumberstone to send *one* dive using a QList,

View file

@ -343,7 +343,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button)
if (merge_locations_into_dives()) { if (merge_locations_into_dives()) {
mark_divelist_changed(true); mark_divelist_changed(true);
MainWindow::instance()->globe()->repopulateLabels(); MainWindow::instance()->globe()->repopulateLabels();
MainWindow::instance()->globe()->centerOn(current_dive); MainWindow::instance()->globe()->centerOnCurrentDive();
MainWindow::instance()->information()->updateDiveInfo(selected_dive); MainWindow::instance()->information()->updateDiveInfo(selected_dive);
} }