diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index aec20f936..721e831a6 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -26,6 +26,14 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo connect(this, SIGNAL(startFilterDiveSite(uint32_t)), MultiFilterSortModel::instance(), SLOT(startFilterDiveSite(uint32_t))); connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite())); + + // Globe Management Code. + connect(this, &LocationInformationWidget::requestCoordinates, + GlobeGPS::instance(), &GlobeGPS::prepareForGetDiveCoordinates); + connect(this, &LocationInformationWidget::endRequestCoordinates, + GlobeGPS::instance(), &GlobeGPS::endGetDiveCoordinates); + connect(GlobeGPS::instance(), &GlobeGPS::coordinatesChanged, + this, &LocationInformationWidget::updateGpsCoordinates); } void LocationInformationWidget::updateLabels() @@ -85,18 +93,15 @@ void LocationInformationWidget::acceptChanges() mark_divelist_changed(true); resetState(); + emit endRequestCoordinates(); emit endEditDiveSite(); emit coordinatesChanged(); } -void LocationInformationWidget::on_btnPickCoordinates_clicked() -{ - qDebug() << "Sim, Deve haver o perdao"; -} - void LocationInformationWidget::rejectChanges() { resetState(); + emit endRequestCoordinates(); emit stopFilterDiveSite(); emit endEditDiveSite(); emit coordinatesChanged(); @@ -104,9 +109,12 @@ void LocationInformationWidget::rejectChanges() void LocationInformationWidget::showEvent(QShowEvent *ev) { - if (displayed_dive_site.uuid) + if (displayed_dive_site.uuid) { updateLabels(); emit startFilterDiveSite(displayed_dive_site.uuid); + } + emit requestCoordinates(); + QGroupBox::showEvent(ev); } diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h index ef28ddafd..09814e9c0 100644 --- a/qt-ui/locationinformation.h +++ b/qt-ui/locationinformation.h @@ -24,7 +24,6 @@ public slots: void on_diveSiteDescription_textChanged(const QString& text); void on_diveSiteName_textChanged(const QString& text); void on_diveSiteNotes_textChanged(); - void on_btnPickCoordinates_clicked(); private slots: void updateLabels(); signals: @@ -33,6 +32,8 @@ signals: void coordinatesChanged(); void startFilterDiveSite(uint32_t uuid); void stopFilterDiveSite(); + void requestCoordinates(); + void endRequestCoordinates(); private: Ui::LocationInformation ui; bool modified;