From fd31e7792e73a89b7dfdd8125466b0b4a819c55f Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 26 Jun 2015 20:54:48 -0300 Subject: Dive site rewrite: change the default sizes of the dialog Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 16 ++++++++-------- qt-ui/maintab.cpp | 2 ++ qt-ui/simpledivesiteedit.ui | 12 ++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index f50834660..50b3ccb1e 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -241,8 +241,8 @@ SimpleDiveSiteEditDialog::~SimpleDiveSiteEditDialog() void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev) { - const int heigth = 190; - const int width = 280; + const int heigth = 275; + const int width = 450; // Position. QDialog::showEvent(ev); @@ -256,8 +256,8 @@ void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev) //Da ui->diveSiteName->setText(displayed_dive_site.name); - ui->diveSiteNotes->setText(displayed_dive_site.notes); - ui->diveSiteDescription->setText(displayed_dive_site.description); + ui->diveSiteNotes->setPlainText(displayed_dive_site.notes); + ui->diveSiteDescription->setPlainText(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)); @@ -294,18 +294,18 @@ void SimpleDiveSiteEditDialog::on_diveSiteCoordinates_editingFinished() void SimpleDiveSiteEditDialog::on_diveSiteDescription_editingFinished() { - if (ui->diveSiteDescription->text() == displayed_dive_site.description) + if (ui->diveSiteDescription->toPlainText() == displayed_dive_site.description) return; free(displayed_dive_site.description); - displayed_dive_site.description = copy_string(qPrintable(ui->diveSiteDescription->text())); + displayed_dive_site.description = copy_string(qPrintable(ui->diveSiteDescription->toPlainText())); changed_dive_site = true; } void SimpleDiveSiteEditDialog::on_diveSiteNotes_editingFinished() { - if (ui->diveSiteNotes->text() == displayed_dive_site.notes) + if (ui->diveSiteNotes->toPlainText() == displayed_dive_site.notes) return; free(displayed_dive_site.notes); - displayed_dive_site.notes = copy_string(qPrintable(ui->diveSiteNotes->text())); + displayed_dive_site.notes = copy_string(qPrintable(ui->diveSiteNotes->toPlainText())); changed_dive_site = true; } diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 8bb2892ad..b960ebb03 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -240,6 +240,8 @@ void MainTab::setCurrentLocationIndex() void MainTab::showDiveSiteSimpleEdit() { + if (ui.location->text().isEmpty()) + return; SimpleDiveSiteEditDialog dlg(this); dlg.exec(); if (dlg.changed_dive_site) { diff --git a/qt-ui/simpledivesiteedit.ui b/qt-ui/simpledivesiteedit.ui index 120e3293f..a7903d00e 100644 --- a/qt-ui/simpledivesiteedit.ui +++ b/qt-ui/simpledivesiteedit.ui @@ -6,8 +6,8 @@ 0 0 - 280 - 190 + 449 + 274 @@ -41,9 +41,6 @@ - - - @@ -51,8 +48,11 @@ + + + - + -- cgit v1.2.3-70-g09d2