From 45b1d0d73db6e2116c6de7113feed381dcc5875f Mon Sep 17 00:00:00 2001 From: Giorgio Marzano Date: Tue, 6 Oct 2015 21:08:27 +0200 Subject: Display day number in trips longer than 1 day Signed-off-by: Giorgio Marzano Signed-off-by: Dirk Hohndel --- qt-models/divetripmodel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'qt-models') diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 819bb5463..78a7a7420 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -43,6 +43,7 @@ static QVariant dive_table_alignment(int column) QVariant TripItem::data(int column, int role) const { QVariant ret; + bool oneDayTrip=true; if (role == DiveTripModel::TRIP_ROLE) return QVariant::fromValue(trip); @@ -59,14 +60,15 @@ QVariant TripItem::data(int column, int role) const while (d) { if (!d->hidden_by_filter) countShown++; + oneDayTrip &= is_same_day (trip->when, d->when); d = d->next; } if (countShown < trip->nrdives) shownText = tr("(%1 shown)").arg(countShown); if (trip->location && *trip->location) - ret = QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->nrdives) + " " + shownText; + ret = QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + " "+ shownText; else - ret = get_trip_date_string(trip->when, trip->nrdives) + shownText; + ret = get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + shownText; break; } } -- cgit v1.2.3-70-g09d2