mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: convert divesite strings to std::string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3394ce7931
commit
160f06db8d
38 changed files with 181 additions and 222 deletions
|
@ -68,7 +68,7 @@ void DivesiteImportDialog::on_ok_clicked()
|
|||
for (int i = 0; i < importedSites.nr; i++)
|
||||
if (divesiteImportedModel->data(divesiteImportedModel->index(i, 0), Qt::CheckStateRole) == Qt::Checked) {
|
||||
struct dive_site *newSite = new dive_site;
|
||||
copy_dive_site(importedSites.dive_sites[i], newSite);
|
||||
*newSite = *importedSites.dive_sites[i];
|
||||
add_dive_site_to_table(newSite, &selectedSites);
|
||||
}
|
||||
|
||||
|
|
|
@ -129,8 +129,8 @@ void LocationInformationWidget::updateLabels()
|
|||
clearLabels();
|
||||
return;
|
||||
}
|
||||
if (diveSite->name)
|
||||
ui.diveSiteName->setText(diveSite->name);
|
||||
if (!diveSite->name.empty())
|
||||
ui.diveSiteName->setText(QString::fromStdString(diveSite->name));
|
||||
else
|
||||
ui.diveSiteName->clear();
|
||||
std::string country = taxonomy_get_country(diveSite->taxonomy);
|
||||
|
@ -138,12 +138,12 @@ void LocationInformationWidget::updateLabels()
|
|||
ui.diveSiteCountry->setText(QString::fromStdString(country));
|
||||
else
|
||||
ui.diveSiteCountry->clear();
|
||||
if (diveSite->description)
|
||||
ui.diveSiteDescription->setText(diveSite->description);
|
||||
if (!diveSite->description.empty())
|
||||
ui.diveSiteDescription->setText(QString::fromStdString(diveSite->description));
|
||||
else
|
||||
ui.diveSiteDescription->clear();
|
||||
if (diveSite->notes)
|
||||
ui.diveSiteNotes->setPlainText(diveSite->notes);
|
||||
if (!diveSite->notes.empty())
|
||||
ui.diveSiteNotes->setPlainText(QString::fromStdString(diveSite->notes));
|
||||
else
|
||||
ui.diveSiteNotes->clear();
|
||||
if (has_location(&diveSite->location))
|
||||
|
@ -172,13 +172,13 @@ void LocationInformationWidget::diveSiteChanged(struct dive_site *ds, int field)
|
|||
return; // A different dive site was changed -> do nothing.
|
||||
switch (field) {
|
||||
case LocationInformationModel::NAME:
|
||||
ui.diveSiteName->setText(diveSite->name);
|
||||
ui.diveSiteName->setText(QString::fromStdString(diveSite->name));
|
||||
return;
|
||||
case LocationInformationModel::DESCRIPTION:
|
||||
ui.diveSiteDescription->setText(diveSite->description);
|
||||
ui.diveSiteDescription->setText(QString::fromStdString(diveSite->description));
|
||||
return;
|
||||
case LocationInformationModel::NOTES:
|
||||
ui.diveSiteNotes->setText(diveSite->notes);
|
||||
ui.diveSiteNotes->setText(QString::fromStdString(diveSite->notes));
|
||||
return;
|
||||
case LocationInformationModel::TAXONOMY:
|
||||
ui.diveSiteCountry->setText(QString::fromStdString(taxonomy_get_country(diveSite->taxonomy)));
|
||||
|
@ -563,7 +563,7 @@ static struct dive_site *get_dive_site_name_start_which_str(const QString &str)
|
|||
struct dive_site *ds;
|
||||
int i;
|
||||
for_each_dive_site (i, ds, divelog.sites) {
|
||||
QString dsName(ds->name);
|
||||
QString dsName = QString::fromStdString(ds->name);
|
||||
if (dsName.toLower().startsWith(str.toLower()))
|
||||
return ds;
|
||||
}
|
||||
|
@ -585,10 +585,10 @@ void DiveLocationLineEdit::setTemporaryDiveSiteName(const QString &name)
|
|||
// the user entered text.
|
||||
QString i1_name;
|
||||
if (struct dive_site *ds = get_dive_site_name_start_which_str(name)) {
|
||||
const QString orig_name = QString(ds->name).toLower();
|
||||
const QString orig_name = QString::fromStdString(ds->name).toLower();
|
||||
const QString new_name = name.toLower();
|
||||
if (new_name != orig_name)
|
||||
i1_name = QString(ds->name);
|
||||
i1_name = QString::fromStdString(ds->name);
|
||||
}
|
||||
|
||||
model->setData(i1, i1_name);
|
||||
|
@ -674,7 +674,7 @@ void DiveLocationLineEdit::setCurrentDiveSite(struct dive *d)
|
|||
if (!currDs)
|
||||
clear();
|
||||
else
|
||||
setText(currDs->name);
|
||||
setText(QString::fromStdString(currDs->name));
|
||||
proxy->setCurrentLocation(currentLocation);
|
||||
delegate.setCurrentLocation(currentLocation);
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
|
|||
QString cliptext;
|
||||
text.setString(&cliptext);
|
||||
if (what->divesite && current_dive->dive_site)
|
||||
text << tr("Dive site: ") << current_dive->dive_site->name << "\n";
|
||||
text << tr("Dive site: ") << QString::fromStdString(current_dive->dive_site->name) << "\n";
|
||||
if (what->diveguide)
|
||||
text << tr("Dive guide: ") << current_dive->diveguide << "\n";
|
||||
if (what->buddy)
|
||||
|
|
|
@ -526,7 +526,7 @@ QVariant TemplateLayout::getValue(QString list, QString property, const State &s
|
|||
} else if (property == "timestamp") {
|
||||
return QVariant::fromValue(d->when);
|
||||
} else if (property == "location") {
|
||||
return get_dive_location(d);
|
||||
return QString::fromStdString(get_dive_location(d));
|
||||
} else if (property == "gps") {
|
||||
return formatDiveGPS(d);
|
||||
} else if (property == "gps_decimal") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue