diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-27 23:59:30 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | 4a004f37eac32c2c84b5453d9d6b12a5bf06e8c2 (patch) | |
tree | 7c6b20f48aede94b11f0dddb1c063b10699c9f74 /desktop-widgets/mapwidget.cpp | |
parent | 4d698310ff830462b7d5fad7d449bedc45aa50cb (diff) | |
download | subsurface-4a004f37eac32c2c84b5453d9d6b12a5bf06e8c2.tar.gz |
mapwidget: add a method to set update editMode in MapWidgetHelper
The local slot coordinatesChangedLocal() tracks the MapWidgetHelper
coordinatesChanged() signal and emit a coordinatesChanged() signal
to any listeners (e.g. MainWindow).
Also add a small change in centerOnDiveSite(), to not be called if
we are skipping the reload (skipReload is updated by
selectedDivesChanged()).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'desktop-widgets/mapwidget.cpp')
-rw-r--r-- | desktop-widgets/mapwidget.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp index 4ac394b4e..0b7624371 100644 --- a/desktop-widgets/mapwidget.cpp +++ b/desktop-widgets/mapwidget.cpp @@ -29,11 +29,14 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent) m_mapHelper = rootObject()->findChild<MapWidgetHelper *>();
connect(m_mapHelper, SIGNAL(selectedDivesChanged(QList<int>)),
this, SLOT(selectedDivesChanged(QList<int>)));
+ connect(m_mapHelper, SIGNAL(coordinatesChanged()),
+ this, SLOT(coordinatesChangedLocal()));
}
void MapWidget::centerOnDiveSite(struct dive_site *ds)
{
- m_mapHelper->centerOnDiveSite(ds);
+ if (!skipReload)
+ m_mapHelper->centerOnDiveSite(ds);
}
void MapWidget::centerOnIndex(const QModelIndex& idx)
@@ -52,23 +55,28 @@ void MapWidget::repopulateLabels() void MapWidget::reload()
{
+ setEditMode(false);
if (!skipReload)
m_mapHelper->reloadMapLocations();
}
+void MapWidget::setEditMode(bool editMode)
+{
+ m_mapHelper->setEditMode(editMode);
+}
+
void MapWidget::endGetDiveCoordinates()
{
- // TODO;
+ setEditMode(false);
}
void MapWidget::prepareForGetDiveCoordinates()
{
- // TODO;
+ setEditMode(true);
}
void MapWidget::selectedDivesChanged(QList<int> list)
{
- qDebug() << "onSelectedDivesChanged:" << list.size();
skipReload = true;
MainWindow::instance()->dive_list()->unselectDives();
if (!list.empty())
@@ -76,6 +84,11 @@ void MapWidget::selectedDivesChanged(QList<int> list) skipReload = false;
}
+void MapWidget::coordinatesChangedLocal()
+{
+ emit coordinatesChanged();
+}
+
MapWidget::~MapWidget()
{
m_instance = NULL;
|