From f4ee8934243d6c924d810b5b2ec5a6c1f3b492f8 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 29 Sep 2020 22:45:21 +0200 Subject: cleanup: replace get_trip_date_string() by get_trip_string() The get_trip_date_string() formatted, as the name implies, the date of a trip. It was passed a number of parameters and had only one caller, which would also add the location if it existed. Therefore, move all that logic into the helper function and name it get_trip_string(). Signed-off-by: Berthold Stoeger --- qt-models/divetripmodel.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'qt-models/divetripmodel.cpp') diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 789fb3b55..539cf98ff 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -119,14 +119,10 @@ QVariant DiveTripModelBase::tripData(const dive_trip *trip, int column, int role switch (column) { case DiveTripModelBase::NR: QString shownText; - bool oneDayTrip = trip_is_single_day(trip); int countShown = trip_shown_dives(trip); if (countShown < trip->dives.nr) shownText = tr("(%1 shown)").arg(countShown); - if (!empty_string(trip->location)) - return QString(trip->location) + ", " + get_trip_date_string(trip_date(trip), trip->dives.nr, oneDayTrip) + " "+ shownText; - else - return get_trip_date_string(trip_date(trip), trip->dives.nr, oneDayTrip) + shownText; + return get_trip_string(trip) + " " + shownText; } } -- cgit v1.2.3-70-g09d2