mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't add separate country field, use taxonomy
The more I looked at the code that added the country to the dive site, the more it seemed redundant given what we have with the taxonomy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
de10fd4021
commit
21d78121ad
8 changed files with 21 additions and 24 deletions
|
@ -93,8 +93,9 @@ void LocationInformationWidget::updateLabels()
|
|||
ui.diveSiteName->setText(displayed_dive_site.name);
|
||||
else
|
||||
ui.diveSiteName->clear();
|
||||
if (displayed_dive_site.country)
|
||||
ui.diveSiteCountry->setText(displayed_dive_site.country);
|
||||
const char *country = taxonomy_get_country(&displayed_dive_site.taxonomy);
|
||||
if (country)
|
||||
ui.diveSiteCountry->setText(country);
|
||||
else
|
||||
ui.diveSiteCountry->clear();
|
||||
if (displayed_dive_site.description)
|
||||
|
@ -151,11 +152,15 @@ void LocationInformationWidget::acceptChanges()
|
|||
free(currentDs->description);
|
||||
currentDs->description = copy_string(uiString);
|
||||
}
|
||||
uiString = ui.diveSiteCountry->text().toUtf8().data();
|
||||
if (!same_string(uiString, currentDs->country)) {
|
||||
free(currentDs->country);
|
||||
currentDs->country = copy_string(uiString);
|
||||
}
|
||||
uiString = copy_string(ui.diveSiteCountry->text().toUtf8().data());
|
||||
// if the user entered a different contriy, first update the taxonomy
|
||||
// for the displayed dive site; this below will get copied into the currentDs
|
||||
if (!same_string(uiString, taxonomy_get_country(&displayed_dive_site.taxonomy)) &&
|
||||
!same_string(uiString, ""))
|
||||
taxonomy_set_country(&displayed_dive_site.taxonomy, copy_string(uiString), taxonomy_origin::GEOMANUAL);
|
||||
// now update the currentDs (which we then later copy back ontop of displayed_dive_site
|
||||
copy_dive_site_taxonomy(&displayed_dive_site, currentDs);
|
||||
|
||||
uiString = ui.diveSiteNotes->document()->toPlainText().toUtf8().data();
|
||||
if (!same_string(uiString, currentDs->notes)) {
|
||||
free(currentDs->notes);
|
||||
|
@ -254,7 +259,7 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString
|
|||
|
||||
void LocationInformationWidget::on_diveSiteCountry_textChanged(const QString& text)
|
||||
{
|
||||
if (!same_string(qPrintable(text), displayed_dive_site.country))
|
||||
if (!same_string(qPrintable(text), taxonomy_get_country(&displayed_dive_site.taxonomy)))
|
||||
markChangedWidget(ui.diveSiteCountry);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue