mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Do not set text on the Location LineEdit
Since the location is only true with a valid uuid, set the uuid on it, it will search for a valid name and set there. this fixes a few inconsistencies handling the locations. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
94d05d1cb6
commit
64453893a0
3 changed files with 21 additions and 6 deletions
|
@ -538,6 +538,18 @@ void DiveLocationLineEdit::fixPopupPosition()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiveLocationLineEdit::setCurrentDiveSiteUuid(uint32_t uuid)
|
||||||
|
{
|
||||||
|
currUuid = uuid;
|
||||||
|
if(uuid == 0) {
|
||||||
|
currType = NO_DIVE_SITE;
|
||||||
|
}
|
||||||
|
struct dive_site *ds = get_dive_site_by_uuid(uuid);
|
||||||
|
if(!ds)
|
||||||
|
clear();
|
||||||
|
setText(ds->name);
|
||||||
|
}
|
||||||
|
|
||||||
void DiveLocationLineEdit::showPopup()
|
void DiveLocationLineEdit::showPopup()
|
||||||
{
|
{
|
||||||
fixPopupPosition();
|
fixPopupPosition();
|
||||||
|
|
|
@ -90,6 +90,7 @@ public:
|
||||||
DiveSiteType currDiveSiteType() const;
|
DiveSiteType currDiveSiteType() const;
|
||||||
uint32_t currDiveSiteUuid() const;
|
uint32_t currDiveSiteUuid() const;
|
||||||
void fixPopupPosition();
|
void fixPopupPosition();
|
||||||
|
void setCurrentDiveSiteUuid(uint32_t uuid);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void diveSiteSelected(uint32_t uuid);
|
void diveSiteSelected(uint32_t uuid);
|
||||||
|
@ -102,6 +103,7 @@ protected:
|
||||||
void showPopup();
|
void showPopup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
using QLineEdit::setText;
|
||||||
DiveLocationFilterProxyModel *proxy;
|
DiveLocationFilterProxyModel *proxy;
|
||||||
DiveLocationModel *model;
|
DiveLocationModel *model;
|
||||||
DiveLocationListView *view;
|
DiveLocationListView *view;
|
||||||
|
|
|
@ -220,7 +220,7 @@ void MainTab::setCurrentLocationIndex()
|
||||||
if (current_dive) {
|
if (current_dive) {
|
||||||
struct dive_site *ds = get_dive_site_by_uuid(current_dive->dive_site_uuid);
|
struct dive_site *ds = get_dive_site_by_uuid(current_dive->dive_site_uuid);
|
||||||
if (ds)
|
if (ds)
|
||||||
ui.location->setText(ds->name);
|
ui.location->setCurrentDiveSiteUuid(ds->uuid);
|
||||||
else
|
else
|
||||||
ui.location->clear();
|
ui.location->clear();
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ bool MainTab::isEditing()
|
||||||
void MainTab::showLocation()
|
void MainTab::showLocation()
|
||||||
{
|
{
|
||||||
if (get_dive_site_by_uuid(displayed_dive.dive_site_uuid))
|
if (get_dive_site_by_uuid(displayed_dive.dive_site_uuid))
|
||||||
ui.location->setText(get_dive_location(&displayed_dive));
|
ui.location->setCurrentDiveSiteUuid(displayed_dive.dive_site_uuid);
|
||||||
else
|
else
|
||||||
ui.location->clear();
|
ui.location->clear();
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
}
|
}
|
||||||
locationTag += ")</small></small>";
|
locationTag += ")</small></small>";
|
||||||
}
|
}
|
||||||
ui.location->setText(ds->name);
|
ui.location->setCurrentDiveSiteUuid(ds->uuid);
|
||||||
ui.locationTags->setText(locationTag);
|
ui.locationTags->setText(locationTag);
|
||||||
} else {
|
} else {
|
||||||
ui.location->clear();
|
ui.location->clear();
|
||||||
|
@ -548,7 +548,8 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
// rename the remaining fields and fill data from selected trip
|
// rename the remaining fields and fill data from selected trip
|
||||||
ui.LocationLabel->setText(tr("Trip location"));
|
ui.LocationLabel->setText(tr("Trip location"));
|
||||||
ui.locationTags->clear();
|
ui.locationTags->clear();
|
||||||
ui.location->setText(currentTrip->location);
|
//TODO: Fix this.
|
||||||
|
//ui.location->setText(currentTrip->location);
|
||||||
ui.NotesLabel->setText(tr("Trip notes"));
|
ui.NotesLabel->setText(tr("Trip notes"));
|
||||||
ui.notes->setText(currentTrip->notes);
|
ui.notes->setText(currentTrip->notes);
|
||||||
clearEquipment();
|
clearEquipment();
|
||||||
|
@ -807,7 +808,7 @@ void MainTab::refreshDisplayedDiveSite()
|
||||||
{
|
{
|
||||||
if (displayed_dive_site.uuid) {
|
if (displayed_dive_site.uuid) {
|
||||||
copy_dive_site(get_dive_site_by_uuid(displayed_dive_site.uuid), &displayed_dive_site);
|
copy_dive_site(get_dive_site_by_uuid(displayed_dive_site.uuid), &displayed_dive_site);
|
||||||
ui.location->setText(displayed_dive_site.name);
|
ui.location->setCurrentDiveSiteUuid(displayed_dive_site.uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,7 +1617,7 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
|
||||||
if (what.visibility)
|
if (what.visibility)
|
||||||
ui.visibility->setCurrentStars(displayed_dive.visibility);
|
ui.visibility->setCurrentStars(displayed_dive.visibility);
|
||||||
if (what.divesite)
|
if (what.divesite)
|
||||||
ui.location->setText(get_dive_location(&displayed_dive));
|
ui.location->setCurrentDiveSiteUuid(displayed_dive.dive_site_uuid);
|
||||||
if (what.tags) {
|
if (what.tags) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
|
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
|
||||||
|
|
Loading…
Add table
Reference in a new issue