From 7efa924067942e6ad32894454e90bf7c5c99a5ae Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 30 Jul 2015 21:51:38 -0300 Subject: 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 --- qt-ui/mainwindow.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'qt-ui/mainwindow.cpp') 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(applicationState["Default"].bottomLeft); } -GlobeGPS *MainWindow::globe() -{ - return qobject_cast(applicationState["Default"].bottomRight); -} - MainTab *MainWindow::information() { return qobject_cast(applicationState["Default"].topLeft); -- cgit v1.2.3-70-g09d2