summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-12-14 22:42:07 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-17 13:03:56 -0800
commitbf8261c0014253634eaddf7c0a9cf79d3a8b4123 (patch)
treee74ca215dbf25cf311e958875863da8037e0eee3 /qt-models
parentdc37ba7758a34fb9d5dd840d41902621030fec32 (diff)
downloadsubsurface-bf8261c0014253634eaddf7c0a9cf79d3a8b4123.tar.gz
core: create string-format.cpp source file
The mobile version of the list used string formatting functions defined in DiveObjectHelper and declared in mobilelistmodels.h. Very confusing. Move them to a separate source file where - in the long run - all the string-formatting functions, which are scattered all over the place, can be collected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divetripmodel.cpp9
-rw-r--r--qt-models/mobilelistmodel.h10
2 files changed, 5 insertions, 14 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index 6b700a92e..52ad937f5 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -3,6 +3,7 @@
#include "core/divefilter.h"
#ifdef SUBSURFACE_MOBILE
#include "qt-models/mobilelistmodel.h"
+#include "core/string-format.h"
#endif
#include "core/gettextfromc.h"
#include "core/metrics.h"
@@ -225,11 +226,11 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
case MobileListModel::DiveSiteRole: return QVariant::fromValue(d->dive_site);
case MobileListModel::CylinderRole: return formatGetCylinder(d).join(", ");
case MobileListModel::GetCylinderRole: return formatGetCylinder(d);
- case MobileListModel::CylinderListRole: return getFullCylinderList();
+ case MobileListModel::CylinderListRole: return formatFullCylinderList();
case MobileListModel::SingleWeightRole: return d->weightsystems.nr <= 1;
- case MobileListModel::StartPressureRole: return getStartPressure(d);
- case MobileListModel::EndPressureRole: return getEndPressure(d);
- case MobileListModel::FirstGasRole: return getFirstGas(d);
+ case MobileListModel::StartPressureRole: return formatStartPressure(d);
+ case MobileListModel::EndPressureRole: return formatEndPressure(d);
+ case MobileListModel::FirstGasRole: return formatFirstGas(d);
case MobileListModel::SelectedRole: return d->selected;
case MobileListModel::DiveInTripRole: return d->divetrip != NULL;
case MobileListModel::IsInvalidRole: return d->invalid;
diff --git a/qt-models/mobilelistmodel.h b/qt-models/mobilelistmodel.h
index e18481efc..5c03a02a7 100644
--- a/qt-models/mobilelistmodel.h
+++ b/qt-models/mobilelistmodel.h
@@ -186,14 +186,4 @@ private:
MobileSwipeModel sm;
};
-// Helper functions - these are actually defined in DiveObjectHelper.cpp. Why declare them here?
-QString formatSac(const dive *d);
-QString formatNotes(const dive *d);
-QString format_gps_decimal(const dive *d);
-QStringList formatGetCylinder(const dive *d);
-QStringList getStartPressure(const dive *d);
-QStringList getEndPressure(const dive *d);
-QStringList getFirstGas(const dive *d);
-QStringList getFullCylinderList();
-
#endif