summaryrefslogtreecommitdiffstats
path: root/qt-ui/globe.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2015-07-30 21:51:38 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-31 10:28:17 -0700
commit7efa924067942e6ad32894454e90bf7c5c99a5ae (patch)
treee2b55d2ed2811fa54fd3ddee7315f7e8e15b4d4f /qt-ui/globe.cpp
parent9130ff8a97ea73e92dccd68f8107f441cb0a3f7e (diff)
downloadsubsurface-7efa924067942e6ad32894454e90bf7c5c99a5ae.tar.gz
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>
Diffstat (limited to 'qt-ui/globe.cpp')
-rw-r--r--qt-ui/globe.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index 066fdc217..4f40e22ec 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -24,6 +24,12 @@
#include <marble/MarbleDebug.h>
#endif
+GlobeGPS *GlobeGPS::instance()
+{
+ static GlobeGPS *self = new GlobeGPS();
+ return self;
+}
+
GlobeGPS::GlobeGPS(QWidget *parent) : MarbleWidget(parent),
loadedDives(0),
messageWidget(new KMessageWidget(this)),
@@ -378,9 +384,9 @@ void GlobeGPS::centerOnIndex(const QModelIndex& idx)
{
struct dive_site *ds = get_dive_site_by_uuid(idx.model()->index(idx.row(), 0).data().toInt());
if (!ds || !dive_site_has_gps_location(ds))
- MainWindow::instance()->globe()->centerOnDiveSite(&displayed_dive_site);
+ centerOnDiveSite(&displayed_dive_site);
else
- MainWindow::instance()->globe()->centerOnDiveSite(ds);
+ centerOnDiveSite(ds);
}
#else