diff options
author | jan Iversen <jan@casacondor.com> | 2020-01-20 20:10:35 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-01-24 20:20:42 -0800 |
commit | b0e46c208dd4fb13d5c3e6010c56cbc50742b4ec (patch) | |
tree | c60317a91592a80949816e84fc5660d39a61c807 /mobile-widgets | |
parent | e22943fa21027917cd8d2de98cd13ae7d12d751a (diff) | |
download | subsurface-b0e46c208dd4fb13d5c3e6010c56cbc50742b4ec.tar.gz |
mobile: move dive planner notes access to pure interface
Make notes rates available to QML through the Backend interface.
Remove the corresponding variables from plannerShared.
Getters are from prefs. while setters are linked to diveplan model.
Remark: signals from qPrefDivePlanner is used, because the diveplanner model
sets qPrefDivePlanner but do not issue special signals.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/DivePlannerSetup.qml | 20 | ||||
-rw-r--r-- | mobile-widgets/qmlinterface.cpp | 11 | ||||
-rw-r--r-- | mobile-widgets/qmlinterface.h | 25 |
3 files changed, 45 insertions, 11 deletions
diff --git a/mobile-widgets/qml/DivePlannerSetup.qml b/mobile-widgets/qml/DivePlannerSetup.qml index ec1e14ca4..870444275 100644 --- a/mobile-widgets/qml/DivePlannerSetup.qml +++ b/mobile-widgets/qml/DivePlannerSetup.qml @@ -331,37 +331,37 @@ Kirigami.ScrollablePage { TemplateCheckBox { text: qsTr("Display runtime") - checked: Planner.display_runtime + checked: Backend.display_runtime onClicked: { - Planner.display_runtime = checked + Backend.display_runtime = checked } } TemplateCheckBox { text: qsTr("Display segment duration") - checked: Planner.display_duration + checked: Backend.display_duration onClicked: { - Planner.display_duration = checked + Backend.display_duration = checked } } TemplateCheckBox { text: qsTr("Display transitions in deco") - checked: Planner.display_transitions + checked: Backend.display_transitions onClicked: { - Planner.display_transitions = checked + Backend.display_transitions = checked } } TemplateCheckBox { text: qsTr("Verbatim dive plan") - checked: Planner.verbatim_plan + checked: Backend.verbatim_plan onClicked: { - Planner.verbatim_plan = checked + Backend.verbatim_plan = checked } } TemplateCheckBox { text: qsTr("Display plan variations") - checked: Planner.display_variations + checked: Backend.display_variations onClicked: { - Planner.display_variations = checked + Backend.display_variations = checked } } } diff --git a/mobile-widgets/qmlinterface.cpp b/mobile-widgets/qmlinterface.cpp index e422a5856..277db13ef 100644 --- a/mobile-widgets/qmlinterface.cpp +++ b/mobile-widgets/qmlinterface.cpp @@ -47,4 +47,15 @@ void QMLInterface::setup(QQmlContext *ct) instance(), &QMLInterface::ascrate75Changed); connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::descrateChanged, instance(), &QMLInterface::descrateChanged); + + connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::display_runtimeChanged, + instance(), &QMLInterface::display_runtimeChanged); + connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::display_durationChanged, + instance(), &QMLInterface::display_durationChanged); + connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::display_transitionsChanged, + instance(), &QMLInterface::display_transitionsChanged); + connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::verbatim_planChanged, + instance(), &QMLInterface::verbatim_planChanged); + connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::display_variationsChanged, + instance(), &QMLInterface::display_variationsChanged); } diff --git a/mobile-widgets/qmlinterface.h b/mobile-widgets/qmlinterface.h index 7d96785bf..670512b6f 100644 --- a/mobile-widgets/qmlinterface.h +++ b/mobile-widgets/qmlinterface.h @@ -43,6 +43,12 @@ class QMLInterface : public QObject { Q_PROPERTY(int ascrate75 READ ascrate75 WRITE set_ascrate75 NOTIFY ascrate75Changed); Q_PROPERTY(int descrate READ descrate WRITE set_descrate NOTIFY descrateChanged); + Q_PROPERTY(bool display_runtime READ display_runtime WRITE set_display_runtime NOTIFY display_runtimeChanged); + Q_PROPERTY(bool display_duration READ display_duration WRITE set_display_duration NOTIFY display_durationChanged); + Q_PROPERTY(bool display_transitions READ display_transitions WRITE set_display_transitions NOTIFY display_transitionsChanged); + Q_PROPERTY(bool verbatim_plan READ verbatim_plan WRITE set_verbatim_plan NOTIFY verbatim_planChanged); + Q_PROPERTY(bool display_variations READ display_variations WRITE set_display_variations NOTIFY display_variationsChanged); + public: static QMLInterface *instance(); @@ -134,6 +140,12 @@ public: int ascrate75() { return DivePlannerPointsModel::instance()->ascrate75Display(); } int descrate() { return DivePlannerPointsModel::instance()->descrateDisplay(); } + bool display_runtime() { return prefs.display_runtime; } + bool display_duration() { return prefs.display_duration; } + bool display_transitions() { return prefs.display_transitions; } + bool verbatim_plan() { return prefs.verbatim_plan; } + bool display_variations() { return prefs.display_variations; } + public slots: void set_cloud_verification_status(CLOUD_STATUS value) { qPrefCloudStorage::set_cloud_verification_status(value); } void set_duration_units(DURATION value) { qPrefUnits::set_duration_units((units::DURATION)value); } @@ -151,6 +163,12 @@ public slots: void set_ascrate75(int value) { DivePlannerPointsModel::instance()->setAscrate75Display(value); } void set_descrate(int value) { DivePlannerPointsModel::instance()->setDescrateDisplay(value); } + void set_display_runtime(bool value) { DivePlannerPointsModel::instance()->setDisplayRuntime(value); } + void set_display_duration(bool value) { DivePlannerPointsModel::instance()->setDisplayDuration(value); } + 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); } + signals: void cloud_verification_statusChanged(CLOUD_STATUS); void duration_unitsChanged(DURATION); @@ -168,8 +186,13 @@ signals: void ascrate75Changed(int); void descrateChanged(int); + void display_runtimeChanged(bool value); + void display_durationChanged(bool value); + void display_transitionsChanged(bool value); + void verbatim_planChanged(bool value); + void display_variationsChanged(bool value); + private: QMLInterface() {} }; #endif // QMLINTERFACE_H - |