diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2015-05-29 21:13:16 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-05-29 20:58:38 -0700 |
commit | 88549d18743823878d68de76d707630dd74e1bff (patch) | |
tree | 03d596d12c47acb0a7f8ccc5fff2bededef8c554 /qt-ui | |
parent | abb677349021a6ff214734307b8b0f09083b277a (diff) | |
download | subsurface-88549d18743823878d68de76d707630dd74e1bff.tar.gz |
Change the Location from a LineEdit to a ComboBox
And hook up every method that was changed.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 12 | ||||
-rw-r--r-- | 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 @@ <number>2</number> </property> <item> - <widget class="QLineEdit" name="location"> - <property name="readOnly"> - <bool>false</bool> + <widget class="QComboBox" name="location"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> </widget> </item> @@ -1255,7 +1258,6 @@ <tabstop>timeEdit</tabstop> <tabstop>airtemp</tabstop> <tabstop>watertemp</tabstop> - <tabstop>location</tabstop> <tabstop>divemaster</tabstop> <tabstop>buddy</tabstop> <tabstop>rating</tabstop> |