diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-12-15 15:33:39 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-12-17 13:03:56 -0800 |
commit | ae182c386b0b1b58ab25fc1fbc18c3618062e57f (patch) | |
tree | 87c5d94a0f795b969233750b83fb22320ff53389 /qt-models/divetripmodel.cpp | |
parent | d9942269a9b61bc35bd939b23858a7cb4a2515c3 (diff) | |
download | subsurface-ae182c386b0b1b58ab25fc1fbc18c3618062e57f.tar.gz |
printing: remove DiveObjectHelper from printing code
At this point (post grantlee), DiveObjectHelper is just pointless
glue code. Let's remove it from the printing code and call the
formatting functions directly. If necessary, move these functions
to core/string-format.cpp.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r-- | qt-models/divetripmodel.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 52ad937f5..6d9bd8de4 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -206,21 +206,21 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role) case MobileListModel::NumberRole: return d->number; case MobileListModel::LocationRole: return get_dive_location(d); case MobileListModel::DepthRole: return get_depth_string(d->dc.maxdepth.mm, true, true); - case MobileListModel::DurationRole: return get_dive_duration_string(d->duration.seconds, gettextFromC::tr("h"), gettextFromC::tr("min")); + case MobileListModel::DurationRole: return formatDiveDuration(d); case MobileListModel::DepthDurationRole: return QStringLiteral("%1 / %2").arg(get_depth_string(d->dc.maxdepth.mm, true, true), - get_dive_duration_string(d->duration.seconds, gettextFromC::tr("h"), gettextFromC::tr("min"))); + formatDiveDuration(d)); case MobileListModel::RatingRole: return d->rating; case MobileListModel::VizRole: return d->visibility; case MobileListModel::SuitRole: return d->suit; case MobileListModel::AirTempRole: return get_temperature_string(d->airtemp, true); case MobileListModel::WaterTempRole: return get_temperature_string(d->watertemp, true); case MobileListModel::SacRole: return formatSac(d); - case MobileListModel::SumWeightRole: return get_weight_string(weight_t { total_weight(d) }, true); - case MobileListModel::DiveMasterRole: return d->divemaster ? d->divemaster : QString(); - case MobileListModel::BuddyRole: return d->buddy ? d->buddy : QString(); + case MobileListModel::SumWeightRole: return formatSumWeight(d); + case MobileListModel::DiveMasterRole: return d->divemaster; + case MobileListModel::BuddyRole: return d->buddy; case MobileListModel::TagsRole: return get_taglist_string(d->tag_list); case MobileListModel::NotesRole: return formatNotes(d); - case MobileListModel::GpsRole: return d->dive_site ? printGPSCoords(&d->dive_site->location) : QString(); + case MobileListModel::GpsRole: return formatDiveGPS(d); case MobileListModel::GpsDecimalRole: return format_gps_decimal(d); case MobileListModel::NoDiveRole: return d->duration.seconds == 0 && d->dc.duration.seconds == 0; case MobileListModel::DiveSiteRole: return QVariant::fromValue(d->dive_site); |