core: turn dive-trip location and notes into std::string

Simpler memory management.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-31 17:15:47 +02:00 committed by bstoeger
parent 2fd226964c
commit 3ee41328f9
29 changed files with 157 additions and 179 deletions

View file

@ -81,7 +81,7 @@ QString DiveTripModelBase::tripTitle(const dive_trip *trip)
QString numDives = tr("(%n dive(s))", "", trip->dives.nr);
int shown = trip_shown_dives(trip);
QString shownDives = shown != trip->dives.nr ? QStringLiteral(" ") + tr("(%L1 shown)").arg(shown) : QString();
QString title(trip->location);
QString title = QString::fromStdString(trip->location);
if (title.isEmpty()) {
// so use the date range
@ -110,8 +110,8 @@ QVariant DiveTripModelBase::tripData(const dive_trip *trip, int column, int role
case MobileListModel::TripNrDivesRole: return trip->dives.nr;
case MobileListModel::TripShortDateRole: return tripShortDate(trip);
case MobileListModel::TripTitleRole: return tripTitle(trip);
case MobileListModel::TripLocationRole: return QString(trip->location);
case MobileListModel::TripNotesRole: return QString(trip->notes);
case MobileListModel::TripLocationRole: return QString::fromStdString(trip->location);
case MobileListModel::TripNotesRole: return QString::fromStdString(trip->notes);
}
#endif
// Set the font for all trips alike
@ -714,7 +714,7 @@ void DiveTripModelTree::populate()
update_cylinder_related_info(d);
if (d->hidden_by_filter)
continue;
dive_trip_t *trip = d->divetrip;
dive_trip *trip = d->divetrip;
// If this dive doesn't have a trip, add as top-level item.
if (!trip) {