Change the coordinates via globe.

Now when the user selects the dive site edit, the globe
will enter in edit mode too.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-07-30 22:10:01 -03:00 committed by Dirk Hohndel
parent 2faff7ceae
commit f8b64da136
2 changed files with 16 additions and 7 deletions

View file

@ -26,6 +26,14 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
connect(this, SIGNAL(startFilterDiveSite(uint32_t)), MultiFilterSortModel::instance(), SLOT(startFilterDiveSite(uint32_t))); connect(this, SIGNAL(startFilterDiveSite(uint32_t)), MultiFilterSortModel::instance(), SLOT(startFilterDiveSite(uint32_t)));
connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite())); 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() void LocationInformationWidget::updateLabels()
@ -85,18 +93,15 @@ void LocationInformationWidget::acceptChanges()
mark_divelist_changed(true); mark_divelist_changed(true);
resetState(); resetState();
emit endRequestCoordinates();
emit endEditDiveSite(); emit endEditDiveSite();
emit coordinatesChanged(); emit coordinatesChanged();
} }
void LocationInformationWidget::on_btnPickCoordinates_clicked()
{
qDebug() << "Sim, Deve haver o perdao";
}
void LocationInformationWidget::rejectChanges() void LocationInformationWidget::rejectChanges()
{ {
resetState(); resetState();
emit endRequestCoordinates();
emit stopFilterDiveSite(); emit stopFilterDiveSite();
emit endEditDiveSite(); emit endEditDiveSite();
emit coordinatesChanged(); emit coordinatesChanged();
@ -104,9 +109,12 @@ void LocationInformationWidget::rejectChanges()
void LocationInformationWidget::showEvent(QShowEvent *ev) void LocationInformationWidget::showEvent(QShowEvent *ev)
{ {
if (displayed_dive_site.uuid) if (displayed_dive_site.uuid) {
updateLabels(); updateLabels();
emit startFilterDiveSite(displayed_dive_site.uuid); emit startFilterDiveSite(displayed_dive_site.uuid);
}
emit requestCoordinates();
QGroupBox::showEvent(ev); QGroupBox::showEvent(ev);
} }

View file

@ -24,7 +24,6 @@ public slots:
void on_diveSiteDescription_textChanged(const QString& text); void on_diveSiteDescription_textChanged(const QString& text);
void on_diveSiteName_textChanged(const QString& text); void on_diveSiteName_textChanged(const QString& text);
void on_diveSiteNotes_textChanged(); void on_diveSiteNotes_textChanged();
void on_btnPickCoordinates_clicked();
private slots: private slots:
void updateLabels(); void updateLabels();
signals: signals:
@ -33,6 +32,8 @@ signals:
void coordinatesChanged(); void coordinatesChanged();
void startFilterDiveSite(uint32_t uuid); void startFilterDiveSite(uint32_t uuid);
void stopFilterDiveSite(); void stopFilterDiveSite();
void requestCoordinates();
void endRequestCoordinates();
private: private:
Ui::LocationInformation ui; Ui::LocationInformation ui;
bool modified; bool modified;