summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mapwidget.cpp21
-rw-r--r--desktop-widgets/mapwidget.h2
2 files changed, 19 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;
diff --git a/desktop-widgets/mapwidget.h b/desktop-widgets/mapwidget.h
index 5a79cd68d..49d94608a 100644
--- a/desktop-widgets/mapwidget.h
+++ b/desktop-widgets/mapwidget.h
@@ -33,8 +33,10 @@ public slots:
void repopulateLabels();
void prepareForGetDiveCoordinates();
void selectedDivesChanged(QList<int>);
+ void coordinatesChangedLocal();
private:
+ void setEditMode(bool editMode);
static MapWidget *m_instance;
QQuickItem *m_rootItem;
MapWidgetHelper *m_mapHelper;