diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-06-26 14:26:54 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-26 18:50:22 -0700 |
commit | 09f2d3b35de0fc687290eece9f94e9106cc3a7aa (patch) | |
tree | 101d00877add6d36c4d12c25dacb781c40555ba0 | |
parent | 6afd9161e8ef2bce328fdb4663d24d8d4651c12f (diff) | |
download | subsurface-09f2d3b35de0fc687290eece9f94e9106cc3a7aa.tar.gz |
Dive site rewrite: fill and change the current dive site
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/locationinformation.cpp | 39 | ||||
-rw-r--r-- | qt-ui/locationinformation.h | 5 |
2 files changed, 43 insertions, 1 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 78569c09c..929fbec36 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -244,12 +244,49 @@ void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev) const int heigth = 190; const int width = 280; + // Position. QDialog::showEvent(ev); QRect currGeometry = geometry(); - currGeometry.setX(QCursor::pos().x() + 10); + currGeometry.setX(QCursor::pos().x() + 15); currGeometry.setY(QCursor::pos().y() - heigth / 2); currGeometry.setWidth(width); currGeometry.setHeight(heigth); setGeometry(currGeometry); ev->accept(); + + //Da + ui->diveSiteName->setText(displayed_dive_site.name); + ui->diveSiteNotes->setText(displayed_dive_site.notes); + ui->diveSiteDescription->setText(displayed_dive_site.description); + + const char *gps_text = printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg); + ui->diveSiteCoordinates->setText(QString(gps_text)); + free( (void*) gps_text); +} + +void SimpleDiveSiteEditDialog::on_diveSiteName_editingFinished() +{ + free(displayed_dive_site.name); + displayed_dive_site.name = copy_string(qPrintable(ui->diveSiteName->text())); +} + +void SimpleDiveSiteEditDialog::on_diveSiteCoordinates_editingFinished() +{ + double lat, lon; + + parseGpsText(ui->diveSiteCoordinates->text(), &lat, &lon); + displayed_dive_site.latitude.udeg = lat * 1000000; + displayed_dive_site.longitude.udeg = lon * 1000000; +} + +void SimpleDiveSiteEditDialog::on_diveSiteDescription_editingFinished() +{ + free(displayed_dive_site.description); + displayed_dive_site.description = copy_string(qPrintable(ui->diveSiteDescription->text())); +} + +void SimpleDiveSiteEditDialog::on_diveSiteNotes_editingFinished() +{ + free(displayed_dive_site.notes); + displayed_dive_site.notes = copy_string(qPrintable(ui->diveSiteNotes->text())); } diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h index dcf51c748..2fa6f6615 100644 --- a/qt-ui/locationinformation.h +++ b/qt-ui/locationinformation.h @@ -51,6 +51,11 @@ Q_OBJECT public: SimpleDiveSiteEditDialog(QWidget *parent); virtual ~SimpleDiveSiteEditDialog(); +public slots: + void on_diveSiteName_editingFinished(); + void on_diveSiteCoordinates_editingFinished(); + void on_diveSiteDescription_editingFinished(); + void on_diveSiteNotes_editingFinished(); protected: void showEvent(QShowEvent *ev); private: |