From f7c73f1987a7069489d66316383b31b3248810b3 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 6 Feb 2020 23:29:26 +0100 Subject: mobile/summary: implement firstDiveDate and lastDiveDate Instead of transporting the global first and last dive date in the dive summary, calculate it in an external function. Since we already have time and date functions in qthelper.cpp implement those functions there. Provide a stub in QMLInterface so that QML can access these standalone functions. Signed-off-by: Berthold Stoeger --- mobile-widgets/qml/DiveSummary.qml | 8 ++++++-- mobile-widgets/qmlinterface.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qml/DiveSummary.qml b/mobile-widgets/qml/DiveSummary.qml index ad6d30372..e827d4f42 100644 --- a/mobile-widgets/qml/DiveSummary.qml +++ b/mobile-widgets/qml/DiveSummary.qml @@ -8,6 +8,10 @@ import org.subsurfacedivelog.mobile 1.0 import org.kde.kirigami 2.4 as Kirigami Kirigami.ScrollablePage { + id: summary + property string firstDive: "" + property string lastDive: "" + background: Rectangle { color: subsurfaceTheme.backgroundColor } title: qsTr("Dive summary") @@ -54,10 +58,10 @@ Kirigami.ScrollablePage { font.bold: true } TemplateLabel { - text: Backend.diveSummaryText[0] + text: summary.firstDive } TemplateLabel { - text: Backend.diveSummaryText[1] + text: summary.lastDive } TemplateLabel { diff --git a/mobile-widgets/qmlinterface.h b/mobile-widgets/qmlinterface.h index 9b05b927d..c8383387d 100644 --- a/mobile-widgets/qmlinterface.h +++ b/mobile-widgets/qmlinterface.h @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #ifndef QMLINTERFACE_H #define QMLINTERFACE_H +#include "core/qthelper.h" #include "core/settings/qPrefCloudStorage.h" #include "core/settings/qPrefUnit.h" #include "core/settings/qPrefDivePlanner.h" @@ -265,6 +266,8 @@ public slots: void set_display_transitions(bool value) { DivePlannerPointsModel::instance()->setDisplayTransitions(value); } void set_verbatim_plan(bool value) { DivePlannerPointsModel::instance()->setVerbatim(value); } void set_display_variations(bool value) { DivePlannerPointsModel::instance()->setDisplayVariations(value); } + QString firstDiveDate() { return get_first_dive_date_string(); } + QString lastDiveDate() { return get_last_dive_date_string(); } signals: void cloud_verification_statusChanged(CLOUD_STATUS); -- cgit v1.2.3-70-g09d2