aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.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/mainwindow.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/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index e7d53e550..4f8241586 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -73,7 +73,7 @@ MainWindow::MainWindow() : QMainWindow(),
ProfileWidget2 *profileWidget = new ProfileWidget2();
#ifndef NO_MARBLE
- GlobeGPS *globeGps = new GlobeGPS();
+ GlobeGPS *globeGps = GlobeGPS::instance();
#else
QWidget *globeGps = NULL;
#endif
@@ -174,7 +174,7 @@ MainWindow::MainWindow() : QMainWindow(),
diveListView->reload(DiveTripModel::TREE);
diveListView->reloadHeaderActions();
diveListView->setFocus();
- globe()->reload();
+ GlobeGPS::instance()->reload();
diveListView->expand(dive_list()->model()->index(0, 0));
diveListView->scrollTo(dive_list()->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
divePlannerWidget()->settingsChanged();
@@ -258,7 +258,7 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
information()->reload();
TankInfoModel::instance()->update();
- globe()->reload();
+ GlobeGPS::instance()->reload();
if (doRecreateDiveList)
recreateDiveList();
@@ -286,7 +286,7 @@ void MainWindow::current_dive_changed(int divenr)
}
graphics()->plotDive();
information()->updateDiveInfo();
- globe()->reload();
+ GlobeGPS::instance()->reload();
}
void MainWindow::on_actionNew_triggered()
@@ -429,7 +429,7 @@ void MainWindow::cleanUpEmpty()
information()->updateDiveInfo(true);
graphics()->setEmptyState();
dive_list()->reload(DiveTripModel::TREE);
- globe()->reload();
+ GlobeGPS::instance()->reload();
if (!existing_filename)
setTitle(MWTF_DEFAULT);
disableShortcuts();
@@ -741,7 +741,7 @@ void MainWindow::on_actionEditDive_triggered()
disableShortcuts();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
graphics()->setAddState();
- globe()->endGetDiveCoordinates();
+ GlobeGPS::instance()->endGetDiveCoordinates();
setApplicationState("EditDive");
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
@@ -1179,11 +1179,6 @@ DiveListView *MainWindow::dive_list()
return qobject_cast<DiveListView*>(applicationState["Default"].bottomLeft);
}
-GlobeGPS *MainWindow::globe()
-{
- return qobject_cast<GlobeGPS*>(applicationState["Default"].bottomRight);
-}
-
MainTab *MainWindow::information()
{
return qobject_cast<MainTab*>(applicationState["Default"].topLeft);