summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlinterface.h
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2020-01-19 18:44:16 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-20 15:46:08 -0800
commit699665ce9e4c1bdb9a4e1027fc3d1533c1929054 (patch)
tree2c7db7c6105cccddd055abfae96409654cf2a256 /mobile-widgets/qmlinterface.h
parentd924afdf52b578c3afccfc7e702acdbb7800d38c (diff)
downloadsubsurface-699665ce9e4c1bdb9a4e1027fc3d1533c1929054.tar.gz
mobile-widgets: add asc/desc rates to pure interface
Make ascent/descent rates available to QML through the Backend interface. Remark signals from qPrefDivePlanner is used because the diveplanner model sets qPrefDivePlanner but does not issue its own signals. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlinterface.h')
-rw-r--r--mobile-widgets/qmlinterface.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/mobile-widgets/qmlinterface.h b/mobile-widgets/qmlinterface.h
index fca87260e..7d96785bf 100644
--- a/mobile-widgets/qmlinterface.h
+++ b/mobile-widgets/qmlinterface.h
@@ -3,6 +3,8 @@
#define QMLINTERFACE_H
#include "core/settings/qPrefCloudStorage.h"
#include "core/settings/qPrefUnit.h"
+#include "core/settings/qPrefDivePlanner.h"
+#include "qt-models/diveplannermodel.h"
#include <QObject>
#include <QQmlContext>
@@ -35,6 +37,12 @@ class QMLInterface : public QObject {
Q_PROPERTY(VOLUME volume READ volume WRITE set_volume NOTIFY volumeChanged)
Q_PROPERTY(WEIGHT weight READ weight WRITE set_weight NOTIFY weightChanged)
+ Q_PROPERTY(int ascratelast6m READ ascratelast6m WRITE set_ascratelast6m NOTIFY ascratelast6mChanged);
+ Q_PROPERTY(int ascratestops READ ascratestops WRITE set_ascratestops NOTIFY ascratestopsChanged);
+ Q_PROPERTY(int ascrate50 READ ascrate50 WRITE set_ascrate50 NOTIFY ascrate50Changed);
+ Q_PROPERTY(int ascrate75 READ ascrate75 WRITE set_ascrate75 NOTIFY ascrate75Changed);
+ Q_PROPERTY(int descrate READ descrate WRITE set_descrate NOTIFY descrateChanged);
+
public:
static QMLInterface *instance();
@@ -120,6 +128,12 @@ public:
VOLUME volume() { return (VOLUME)prefs.units.volume; }
WEIGHT weight() { return (WEIGHT)prefs.units.weight; }
+ int ascratelast6m() { return DivePlannerPointsModel::instance()->ascratelast6mDisplay(); }
+ int ascratestops() { return DivePlannerPointsModel::instance()->ascratestopsDisplay(); }
+ int ascrate50() { return DivePlannerPointsModel::instance()->ascrate50Display(); }
+ int ascrate75() { return DivePlannerPointsModel::instance()->ascrate75Display(); }
+ int descrate() { return DivePlannerPointsModel::instance()->descrateDisplay(); }
+
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); }
@@ -131,6 +145,12 @@ public slots:
void set_volume(VOLUME value) { qPrefUnits::set_volume((units::VOLUME)value); }
void set_weight(WEIGHT value) { qPrefUnits::set_weight((units::WEIGHT)value); }
+ void set_ascratelast6m(int value) { DivePlannerPointsModel::instance()->setAscratelast6mDisplay(value); }
+ void set_ascratestops(int value) { DivePlannerPointsModel::instance()->setAscratestopsDisplay(value); }
+ void set_ascrate50(int value) { DivePlannerPointsModel::instance()->setAscrate50Display(value); }
+ void set_ascrate75(int value) { DivePlannerPointsModel::instance()->setAscrate75Display(value); }
+ void set_descrate(int value) { DivePlannerPointsModel::instance()->setDescrateDisplay(value); }
+
signals:
void cloud_verification_statusChanged(CLOUD_STATUS);
void duration_unitsChanged(DURATION);
@@ -142,6 +162,12 @@ signals:
void volumeChanged(VOLUME);
void weightChanged(WEIGHT);
+ void ascratelast6mChanged(int);
+ void ascratestopsChanged(int);
+ void ascrate50Changed(int);
+ void ascrate75Changed(int);
+ void descrateChanged(int);
+
private:
QMLInterface() {}
};