summaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-03-09 15:51:32 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-10 07:47:21 -0700
commit986b6c509aab851371865bb6f46941557bbe9409 (patch)
tree9cc8dae8224fba950e526bad39c5eb95cee61a23 /qt-ui/simplewidgets.cpp
parent30c5a027caad423fdfba47912bc97ecdc091f3f1 (diff)
downloadsubsurface-986b6c509aab851371865bb6f46941557bbe9409.tar.gz
Change color / mark widget as changed correctly on LocationEdit
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index edee3ec49..e1ad6b861 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -696,10 +696,14 @@ void LocationInformationWidget::setLocationId(uint32_t uuid)
ui.diveSiteCoordinates->clear();
}
displayed_dive_site = *currentDs;
- ui.diveSiteName->setText(displayed_dive_site.name);
- ui.diveSiteDescription->setText(displayed_dive_site.description);
- ui.diveSiteNotes->setPlainText(displayed_dive_site.notes);
- ui.diveSiteCoordinates->setText(printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg));
+ if (displayed_dive_site.name)
+ ui.diveSiteName->setText(displayed_dive_site.name);
+ if (displayed_dive_site.description)
+ ui.diveSiteDescription->setText(displayed_dive_site.description);
+ if (displayed_dive_site.notes)
+ ui.diveSiteNotes->setPlainText(displayed_dive_site.notes);
+ 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));
}
void LocationInformationWidget::updateGpsCoordinates()
@@ -769,5 +773,30 @@ void LocationInformationWidget::markChangedWidget(QWidget *w)
void LocationInformationWidget::enableEdition()
{
+ MainWindow::instance()->dive_list()->setEnabled(false);
+ MainWindow::instance()->setEnabledToolbar(false);
+ ui.diveSiteMessage->show();
+}
+
+void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString& text)
+{
+ markChangedWidget(ui.diveSiteCoordinates);
+}
+
+void LocationInformationWidget::on_diveSiteDescription_textChanged(const QString& text)
+{
+ if (!same_string(qPrintable(text), currentDs->description))
+ markChangedWidget(ui.diveSiteDescription);
+}
+
+void LocationInformationWidget::on_diveSiteName_textChanged(const QString& text)
+{
+ if (!same_string(qPrintable(text), currentDs->name))
+ markChangedWidget(ui.diveSiteName);
+}
+void LocationInformationWidget::on_diveSiteNotes_textChanged()
+{
+ if (!same_string(qPrintable(ui.diveSiteNotes->toPlainText()), currentDs->notes))
+ markChangedWidget(ui.diveSiteNotes);
}