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

@ -1369,17 +1369,17 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
void QMLManager::updateTripDetails(QString tripIdString, QString tripLocation, QString tripNotes)
{
int tripId = tripIdString.toInt();
dive_trip_t *trip = get_trip_by_uniq_id(tripId);
dive_trip *trip = get_trip_by_uniq_id(tripId);
if (!trip) {
report_info("updateTripData: cannot find trip for tripId %s", qPrintable(tripIdString));
return;
}
bool changed = false;
if (tripLocation != trip->location) {
if (tripLocation != trip->location.c_str()) {
changed = true;
Command::editTripLocation(trip, tripLocation);
}
if (tripNotes != trip->notes) {
if (tripNotes != trip->notes.c_str()) {
changed = true;
Command::editTripNotes(trip, tripNotes);
}
@ -1412,7 +1412,7 @@ void QMLManager::addTripForDive(int id)
return;
}
if (d->divetrip) {
appendTextToLog(QString("Asked to create trip for dive %1 with id %2 but it's already part of a trip with location %3.").arg(d->number).arg(id).arg(d->divetrip->location));
appendTextToLog(QString("Asked to create trip for dive %1 with id %2 but it's already part of a trip with location %3.").arg(d->number).arg(id).arg(d->divetrip->location.c_str()));
return;
}
QVector <dive *> dives;