From ae52e2a272b5274abbf6d9e73747ad058e43a734 Mon Sep 17 00:00:00 2001
From: "Lubomir I. Ivanov" <neolit123@gmail.com>
Date: Sat, 15 Jul 2017 23:37:02 +0300
Subject: 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>
---
 desktop-widgets/tab-widgets/maintab.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'desktop-widgets/tab-widgets')

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();
-- 
cgit v1.2.3-70-g09d2