diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-15 23:37:02 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | ae52e2a272b5274abbf6d9e73747ad058e43a734 (patch) | |
tree | 278591e33115d4a44ab3d25955f06302b1f08fd7 /desktop-widgets/tab-widgets/maintab.cpp | |
parent | 4334d334134784722f6e1a86da0ce0f132293531 (diff) | |
download | subsurface-ae52e2a272b5274abbf6d9e73747ad058e43a734.tar.gz |
maintab: use GlobeGPS / MapWidget abstraction
Based on NO_MARBLE, call the same methods in the two different classes.
Later the dummy Marble GlobeGPS (for NO_MARBLE) should be removed.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'desktop-widgets/tab-widgets/maintab.cpp')
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 14b5f2b7f..95481df21 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -8,6 +8,7 @@ #include "desktop-widgets/tab-widgets/maintab.h" #include "desktop-widgets/mainwindow.h" #include "desktop-widgets/globe.h" +#include "desktop-widgets/mapwidget.h" #include "core/helpers.h" #include "core/statistics.h" #include "desktop-widgets/modeldelegates.h" @@ -74,6 +75,9 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), #ifndef NO_MARBLE connect(ui.location, &DiveLocationLineEdit::entered, GlobeGPS::instance(), &GlobeGPS::centerOnIndex); connect(ui.location, &DiveLocationLineEdit::currentChanged, GlobeGPS::instance(), &GlobeGPS::centerOnIndex); +#else + connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex); + connect(ui.location, &DiveLocationLineEdit::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex); #endif QAction *action = new QAction(tr("Apply changes"), this); @@ -907,7 +911,11 @@ void MainTab::acceptChanges() qDebug() << "delete now unused dive site" << ((ds && ds->name) ? ds->name : "without name"); } delete_dive_site(oldUuid); +#ifndef NO_MARBLE GlobeGPS::instance()->reload(); +#else + MapWidget::instance()->reload(); +#endif } // the code above can change the correct uuid for the displayed dive site - and the // code below triggers an update of the display without re-initializing displayed_dive @@ -1041,6 +1049,8 @@ void MainTab::rejectChanges() // let's get the correct location back in view #ifndef NO_MARBLE GlobeGPS::instance()->centerOnDiveSite(get_dive_site_by_uuid(displayed_dive.dive_site_uuid)); +#else + MapWidget::instance()->centerOnDiveSite(get_dive_site_by_uuid(displayed_dive.dive_site_uuid)); #endif // show the profile and dive info MainWindow::instance()->graphics()->replot(); |