mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
d924afdf52
commit
699665ce9e
2 changed files with 37 additions and 0 deletions
|
@ -36,4 +36,15 @@ void QMLInterface::setup(QQmlContext *ct)
|
|||
[=] (int value) { emit instance()->volumeChanged(VOLUME(value)); });
|
||||
connect(qPrefUnits::instance(), &qPrefUnits::weightChanged,
|
||||
[=] (int value) { emit instance()->weightChanged(WEIGHT(value)); });
|
||||
|
||||
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::ascratelast6mChanged,
|
||||
instance(), &QMLInterface::ascratelast6mChanged);
|
||||
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::ascratestopsChanged,
|
||||
instance(), &QMLInterface::ascratestopsChanged);
|
||||
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::ascrate50Changed,
|
||||
instance(), &QMLInterface::ascrate50Changed);
|
||||
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::ascrate75Changed,
|
||||
instance(), &QMLInterface::ascrate75Changed);
|
||||
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::descrateChanged,
|
||||
instance(), &QMLInterface::descrateChanged);
|
||||
}
|
||||
|
|
|
@ -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() {}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue