diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-06-24 13:13:04 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-06-24 13:13:04 -0700 |
commit | d93280f1dc30939c94259afccba6e112b7090892 (patch) | |
tree | 5c3a42887932f4e8a054c99c06f526f2f18bcfb9 /core/subsurface-qt/DiveObjectHelper.cpp | |
parent | 29741f0ed2328ce3c010a9d51cff39790b9b27ca (diff) | |
download | subsurface-d93280f1dc30939c94259afccba6e112b7090892.tar.gz |
QML UI: DiveList: add date box to trip header
This way you can tell when a trip happened.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/subsurface-qt/DiveObjectHelper.cpp')
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index a93053ac8..8e5890b4c 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -335,10 +335,12 @@ QString DiveObjectHelper::tripMeta() const if (dt) { QString numDives = tr("(%n dive(s))", "", dt->nrdives); QString title(dt->location); + QDateTime firstTime = QDateTime::fromMSecsSinceEpoch(1000*dt->when, 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 - QDateTime firstTime = QDateTime::fromMSecsSinceEpoch(1000*dt->when, Qt::UTC); - QString firstMonth = firstTime.toString("MMM"); QString firstYear = firstTime.toString("yyyy"); QDateTime lastTime = QDateTime::fromMSecsSinceEpoch(1000*dt->dives->when, Qt::UTC); QString lastMonth = lastTime.toString("MMM"); @@ -350,7 +352,7 @@ QString DiveObjectHelper::tripMeta() const else title = firstMonth + " " + firstYear + " - " + lastMonth + " " + lastYear; } - ret = QString::number((quint64)m_dive->divetrip, 16) + QLatin1Literal("::") + QStringLiteral("%1 %2").arg(title, numDives); + ret = QString::number((quint64)m_dive->divetrip, 16) + QLatin1Literal("++") + tripDate + QLatin1Literal("::") + QStringLiteral("%1 %2").arg(title, numDives); } return ret; } |