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/simplewidgets.cpp | |
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/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 24 |
1 files changed, 18 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); |