diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-03-10 11:09:25 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-10 11:09:25 -0700 |
commit | ca64f8a7827722212679e8af355b1000c48338c6 (patch) | |
tree | 9e6d0de3b7075586e415b61d101f6f2dbb2f8342 /qt-ui | |
parent | 043ae4af2782fa652aab57158611656c00139473 (diff) | |
download | subsurface-ca64f8a7827722212679e8af355b1000c48338c6.tar.gz |
Clean up the UI when finished editing
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 24 | ||||
-rw-r--r-- | qt-ui/simplewidgets.h | 1 |
2 files changed, 19 insertions, 6 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 4276e6151..cbc570e97 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -698,12 +698,20 @@ void LocationInformationWidget::setLocationId(uint32_t uuid) displayed_dive_site = *currentDs; if (displayed_dive_site.name) ui.diveSiteName->setText(displayed_dive_site.name); + else + ui.diveSiteName->clear(); if (displayed_dive_site.description) ui.diveSiteDescription->setText(displayed_dive_site.description); + else + ui.diveSiteDescription->clear(); if (displayed_dive_site.notes) ui.diveSiteNotes->setPlainText(displayed_dive_site.notes); + else + ui.diveSiteNotes->clear(); if (displayed_dive_site.latitude.udeg || displayed_dive_site.longitude.udeg) ui.diveSiteCoordinates->setText(printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg)); + else + ui.diveSiteCoordinates->clear(); } void LocationInformationWidget::updateGpsCoordinates() @@ -740,9 +748,7 @@ void LocationInformationWidget::acceptChanges() setLocationId(currentDs->uuid); } mark_divelist_changed(true); - resetPallete(); - ui.diveSiteNotes->hide(); - MainWindow::instance()->setEnabledToolbar(true); + resetState(); emit informationManagementEnded(); } @@ -756,9 +762,7 @@ void LocationInformationWidget::rejectChanges() } else { setLocationId(currentDs->uuid); } - resetPallete(); - ui.diveSiteNotes->hide(); - MainWindow::instance()->setEnabledToolbar(true); + resetState(); emit informationManagementEnded(); } @@ -778,6 +782,14 @@ void LocationInformationWidget::markChangedWidget(QWidget *w) modified = true; } +void LocationInformationWidget::resetState() +{ + modified = false; + resetPallete(); + ui.diveSiteMessage->hide(); + MainWindow::instance()->setEnabledToolbar(true); +} + void LocationInformationWidget::enableEdition() { MainWindow::instance()->dive_list()->setEnabled(false); diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index d86fefd70..613fb6480 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -232,6 +232,7 @@ public slots: void updateGpsCoordinates(void); void markChangedWidget(QWidget *w); void enableEdition(); + void resetState(); void resetPallete(); void on_diveSiteCoordinates_textChanged(const QString& text); |