diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 22 | ||||
-rw-r--r-- | desktop-widgets/locationinformation.h | 2 | ||||
-rw-r--r-- | desktop-widgets/mapwidget.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/mapwidget.h | 2 |
4 files changed, 9 insertions, 21 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 5fc1eb4d0..64c0574b9 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -49,14 +49,8 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo ui.diveSiteListView->setModelColumn(LocationInformationModel::NAME); ui.diveSiteListView->installEventFilter(this); // Map Management Code. - connect(this, &LocationInformationWidget::requestCoordinates, - MapWidget::instance(), &MapWidget::prepareForGetDiveCoordinates); - connect(this, &LocationInformationWidget::endRequestCoordinates, - MapWidget::instance(), &MapWidget::endGetDiveCoordinates); connect(MapWidget::instance(), &MapWidget::coordinatesChanged, this, &LocationInformationWidget::updateGpsCoordinates); - connect(this, &LocationInformationWidget::endEditDiveSite, - MapWidget::instance(), &MapWidget::repopulateLabels); } bool LocationInformationWidget::eventFilter(QObject *object, QEvent *ev) @@ -213,19 +207,11 @@ void LocationInformationWidget::acceptChanges() copy_dive_site(currentDs, &displayed_dive_site); mark_divelist_changed(true); resetState(); - emit endRequestCoordinates(); - emit endEditDiveSite(); - emit stopFilterDiveSite(); - updateLocationOnMap(); } void LocationInformationWidget::rejectChanges() { resetState(); - emit endRequestCoordinates(); - emit stopFilterDiveSite(); - emit endEditDiveSite(); - updateLocationOnMap(); } void LocationInformationWidget::showEvent(QShowEvent *ev) @@ -240,8 +226,7 @@ void LocationInformationWidget::showEvent(QShowEvent *ev) } else { clearLabels(); } - emit requestCoordinates(); - + MapWidget::instance()->prepareForGetDiveCoordinates(displayed_dive_site.uuid); QGroupBox::showEvent(ev); } @@ -264,6 +249,11 @@ void LocationInformationWidget::resetState() MainWindow::instance()->dive_list()->setEnabled(true); MainWindow::instance()->setEnabledToolbar(true); ui.diveSiteMessage->setText(tr("Dive site management")); + MapWidget::instance()->endGetDiveCoordinates(); + MapWidget::instance()->repopulateLabels(); + emit stopFilterDiveSite(); + emit endEditDiveSite(); + updateLocationOnMap(); } void LocationInformationWidget::enableEdition() diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h index 0e425e217..225414b2f 100644 --- a/desktop-widgets/locationinformation.h +++ b/desktop-widgets/locationinformation.h @@ -41,8 +41,6 @@ signals: void endEditDiveSite(); void startFilterDiveSite(uint32_t uuid); void stopFilterDiveSite(); - void requestCoordinates(); - void endRequestCoordinates(); void nameChanged(const QString &oldName, const QString &newName); private: diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp index ca519b774..471e924a6 100644 --- a/desktop-widgets/mapwidget.cpp +++ b/desktop-widgets/mapwidget.cpp @@ -93,10 +93,10 @@ void MapWidget::endGetDiveCoordinates() m_mapHelper->exitEditMode(); } -void MapWidget::prepareForGetDiveCoordinates() +void MapWidget::prepareForGetDiveCoordinates(uint32_t uuid) { CHECK_IS_READY_RETURN_VOID(); - m_mapHelper->enterEditMode(); + m_mapHelper->enterEditMode(uuid); } void MapWidget::selectedDivesChanged(QList<int> list) diff --git a/desktop-widgets/mapwidget.h b/desktop-widgets/mapwidget.h index 7ce8e7df8..eb7d994aa 100644 --- a/desktop-widgets/mapwidget.h +++ b/desktop-widgets/mapwidget.h @@ -33,7 +33,7 @@ public slots: void centerOnIndex(const QModelIndex& idx); void endGetDiveCoordinates(); void repopulateLabels(); - void prepareForGetDiveCoordinates(); + void prepareForGetDiveCoordinates(uint32_t uuid); void selectedDivesChanged(QList<int>); void coordinatesChangedLocal(degrees_t latitude, degrees_t longitude); void doneLoading(QQuickWidget::Status status); |