From 88549d18743823878d68de76d707630dd74e1bff Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 29 May 2015 21:13:16 -0300 Subject: Change the Location from a LineEdit to a ComboBox And hook up every method that was changed. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 12 ++++++------ qt-ui/maintab.ui | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 5dc0f434b..e6cf8bc13 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -414,7 +414,7 @@ bool MainTab::isEditing() void MainTab::showLocation() { - ui.location->setText(get_dive_location(&displayed_dive)); + ui.location->setCurrentText(get_dive_location(&displayed_dive)); } void MainTab::updateDiveInfo(bool clear) @@ -461,7 +461,7 @@ void MainTab::updateDiveInfo(bool clear) if (!clear) { struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid); if (ds) - ui.location->setText(ds->name); + ui.location->setCurrentText(ds->name); else ui.location->clear(); // Subsurface always uses "local time" as in "whatever was the local time at the location" @@ -494,7 +494,7 @@ void MainTab::updateDiveInfo(bool clear) ui.watertemp->setVisible(false); // rename the remaining fields and fill data from selected trip ui.LocationLabel->setText(tr("Trip location")); - ui.location->setText(currentTrip->location); + ui.location->setCurrentText(currentTrip->location); ui.NotesLabel->setText(tr("Trip notes")); ui.notes->setText(currentTrip->notes); clearEquipment(); @@ -1248,7 +1248,7 @@ void MainTab::on_location_textChanged(const QString &text) return; if (currentTrip) { free(displayedTrip.location); - displayedTrip.location = strdup(ui.location->text().toUtf8().data()); + displayedTrip.location = strdup(qPrintable(ui.location->currentText())); } markChangedWidget(ui.location); } @@ -1257,7 +1257,7 @@ void MainTab::on_location_textChanged(const QString &text) void MainTab::on_location_editingFinished() { // find the dive site or create it - const char *name = copy_string(qPrintable(ui.location->text())); + const char *name = copy_string(qPrintable(ui.location->currentText())); uint32_t uuid = get_dive_site_uuid_by_name(name, NULL); if (!uuid) uuid = create_dive_site(name); @@ -1433,7 +1433,7 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what) if (what.visibility) ui.visibility->setCurrentStars(displayed_dive.visibility); if (what.divesite) - ui.location->setText(get_dive_location(&displayed_dive)); + ui.location->setCurrentText(get_dive_location(&displayed_dive)); if (what.tags) { char buf[1024]; taglist_get_tagstring(displayed_dive.tag_list, buf, 1024); diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index f5d942a79..07c4d9fe0 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -186,9 +186,12 @@ 2 - - - false + + + + 0 + 0 + @@ -1255,7 +1258,6 @@ timeEdit airtemp watertemp - location divemaster buddy rating -- cgit v1.2.3-70-g09d2