Transform GlobeGPS in a static instance() class

This is needed to start easing the transition from the completely
wrong and bogus MainWindow::instance()->globe() calls. this is still
wrong, but with it I removed one level of indirection.
I did that now because I wanted to not taint the location management
when I use it to deal with the globe.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-07-30 21:51:38 -03:00 committed by Dirk Hohndel
parent 9130ff8a97
commit 7efa924067
6 changed files with 20 additions and 21 deletions

View file

@ -463,7 +463,7 @@ void MainTab::updateDiveInfo(bool clear)
// I don't like this code here - but globe() wasn't initialized on the constructor.
{
QListView *completerListview = qobject_cast<QListView*>(ui.location->completer()->popup());
connect(completerListview, SIGNAL(entered(QModelIndex)), MainWindow::instance()->globe(), SLOT(centerOnIndex(QModelIndex)), Qt::UniqueConnection);
connect(completerListview, SIGNAL(entered(QModelIndex)), GlobeGPS::instance(), SLOT(centerOnIndex(QModelIndex)), Qt::UniqueConnection);
}
EditMode rememberEM = editMode;
@ -1208,8 +1208,7 @@ void MainTab::rejectChanges()
// the user could have edited the location and then canceled the edit
// let's get the correct location back in view
#ifndef NO_MARBLE
MainWindow::instance()->globe()->centerOnDiveSite(get_dive_site_by_uuid(displayed_dive.dive_site_uuid));
MainWindow::instance()->globe()->reload();
GlobeGPS::instance()->centerOnDiveSite(get_dive_site_by_uuid(displayed_dive.dive_site_uuid));
#endif
// show the profile and dive info
MainWindow::instance()->graphics()->replot();