summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp37
-rw-r--r--core/subsurface-qt/DiveObjectHelper.h4
2 files changed, 5 insertions, 36 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index e522e3e39..e8e11e7d9 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -324,40 +324,9 @@ QList<CylinderObjectHelper*> DiveObjectHelper::cylinderObjects() const
return m_cyls;
}
-// combine the pointer address with the trip title so that
-// we detect multiple, destinct trips with the same title
-// the trip title is designed to be
-// location (# dives)
-// or, if there is no location name
-// date range (# dives)
-// where the date range is given as "month year" or "month-month year" or "month year - month year"
-QString DiveObjectHelper::tripMeta() const
-{
- QString ret = EMPTY_DIVE_STRING;
- struct dive_trip *dt = m_dive->divetrip;
- if (dt) {
- QString numDives = tr("(%n dive(s))", "", dt->showndives);
- QString title(dt->location);
- QDateTime firstTime = QDateTime::fromMSecsSinceEpoch(1000*trip_date(dt), Qt::UTC);
- QString firstMonth = firstTime.toString("MMM");
- QString tripDate = QStringLiteral("%1@%2").arg(firstMonth,firstTime.toString("yy"));
-
- if (title.isEmpty()) {
- // so use the date range
- QString firstYear = firstTime.toString("yyyy");
- QDateTime lastTime = QDateTime::fromMSecsSinceEpoch(1000*dt->dives.dives[0]->when, Qt::UTC);
- QString lastMonth = lastTime.toString("MMM");
- QString lastYear = lastTime.toString("yyyy");
- if (lastMonth == firstMonth && lastYear == firstYear)
- title = firstMonth + " " + firstYear;
- else if (lastMonth != firstMonth && lastYear == firstYear)
- title = firstMonth + "-" + lastMonth + " " + firstYear;
- else
- title = firstMonth + " " + firstYear + " - " + lastMonth + " " + lastYear;
- }
- ret = QString::number((quint64)m_dive->divetrip, 16) + QLatin1Literal("++") + tripDate + QLatin1Literal("::") + QStringLiteral("%1 %2").arg(title, numDives);
- }
- return ret;
+QString DiveObjectHelper::tripId() const
+{
+ return m_dive->divetrip ? QString::number((quint64)m_dive->divetrip, 16) : QString();
}
int DiveObjectHelper::tripNrDives() const
diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h
index f5f4e35f0..cb51ef82d 100644
--- a/core/subsurface-qt/DiveObjectHelper.h
+++ b/core/subsurface-qt/DiveObjectHelper.h
@@ -39,7 +39,7 @@ class DiveObjectHelper : public QObject {
Q_PROPERTY(QStringList cylinderList READ cylinderList CONSTANT)
Q_PROPERTY(QStringList cylinders READ cylinders CONSTANT)
Q_PROPERTY(QList<CylinderObjectHelper*> cylinderObjects READ cylinderObjects CONSTANT)
- Q_PROPERTY(QString tripMeta READ tripMeta CONSTANT)
+ Q_PROPERTY(QString tripId READ tripId CONSTANT)
Q_PROPERTY(int tripNrDives READ tripNrDives CONSTANT)
Q_PROPERTY(int maxcns READ maxcns CONSTANT)
Q_PROPERTY(int otu READ otu CONSTANT)
@@ -85,7 +85,7 @@ public:
QStringList cylinders() const;
QString cylinder(int idx) const;
QList<CylinderObjectHelper*> cylinderObjects() const;
- QString tripMeta() const;
+ QString tripId() const;
int tripNrDives() const;
int maxcns() const;
int otu() const;