mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
e22943fa21
commit
b0e46c208d
6 changed files with 49 additions and 88 deletions
|
@ -214,51 +214,6 @@ void plannerShared::set_bestmixend(int value)
|
|||
CylindersModel::instance()->updateBestMixes();
|
||||
}
|
||||
|
||||
bool plannerShared::display_runtime()
|
||||
{
|
||||
return qPrefDivePlanner::display_runtime();
|
||||
}
|
||||
void plannerShared::set_display_runtime(bool value)
|
||||
{
|
||||
DivePlannerPointsModel::instance()->setDisplayRuntime(value);
|
||||
}
|
||||
|
||||
bool plannerShared::display_duration()
|
||||
{
|
||||
return qPrefDivePlanner::display_duration();
|
||||
}
|
||||
void plannerShared::set_display_duration(bool value)
|
||||
{
|
||||
DivePlannerPointsModel::instance()->setDisplayDuration(value);
|
||||
}
|
||||
|
||||
bool plannerShared::display_transitions()
|
||||
{
|
||||
return qPrefDivePlanner::display_transitions();
|
||||
}
|
||||
void plannerShared::set_display_transitions(bool value)
|
||||
{
|
||||
DivePlannerPointsModel::instance()->setDisplayTransitions(value);
|
||||
}
|
||||
|
||||
bool plannerShared::verbatim_plan()
|
||||
{
|
||||
return qPrefDivePlanner::verbatim_plan();
|
||||
}
|
||||
void plannerShared::set_verbatim_plan(bool value)
|
||||
{
|
||||
DivePlannerPointsModel::instance()->setVerbatim(value);
|
||||
}
|
||||
|
||||
bool plannerShared::display_variations()
|
||||
{
|
||||
return qPrefDivePlanner::display_variations();
|
||||
}
|
||||
void plannerShared::set_display_variations(bool value)
|
||||
{
|
||||
DivePlannerPointsModel::instance()->setDisplayVariations(value);
|
||||
}
|
||||
|
||||
// Handle when user changes length measurement type
|
||||
void plannerShared::unit_lengthChangedSlot(int value)
|
||||
{
|
||||
|
|
|
@ -39,13 +39,6 @@ class plannerShared: public QObject {
|
|||
Q_PROPERTY(double decopo2 READ decopo2 WRITE set_decopo2 NOTIFY decopo2Changed);
|
||||
Q_PROPERTY(int bestmixend READ bestmixend WRITE set_bestmixend NOTIFY bestmixendChanged);
|
||||
|
||||
// Notes data
|
||||
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 plannerShared *instance();
|
||||
|
||||
|
@ -73,13 +66,6 @@ public:
|
|||
static double decopo2();
|
||||
static int bestmixend();
|
||||
|
||||
// Notes data
|
||||
static bool display_runtime();
|
||||
static bool display_duration();
|
||||
static bool display_transitions();
|
||||
static bool verbatim_plan();
|
||||
static bool display_variations();
|
||||
|
||||
public slots:
|
||||
|
||||
// Planning data
|
||||
|
@ -106,13 +92,6 @@ public slots:
|
|||
static void set_decopo2(double value);
|
||||
static void set_bestmixend(int value);
|
||||
|
||||
// Notes data
|
||||
static void set_display_runtime(bool value);
|
||||
static void set_display_duration(bool value);
|
||||
static void set_display_transitions(bool value);
|
||||
static void set_verbatim_plan(bool value);
|
||||
static void set_display_variations(bool value);
|
||||
|
||||
signals:
|
||||
// Planning data
|
||||
void planner_deco_modeChanged(deco_mode value);
|
||||
|
@ -138,13 +117,6 @@ signals:
|
|||
void decopo2Changed(double value);
|
||||
void bestmixendChanged(int value);
|
||||
|
||||
// Notes data
|
||||
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 slots:
|
||||
static void unit_lengthChangedSlot(int value);
|
||||
|
||||
|
|
|
@ -461,10 +461,10 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
|
||||
connect(ui.lastStop, &QAbstractButton::toggled, plannerShared::instance(), &plannerShared::set_last_stop);
|
||||
connect(ui.lastStop, &QAbstractButton::toggled, this, &PlannerSettingsWidget::disableBackgasBreaks);
|
||||
connect(ui.verbatim_plan, &QAbstractButton::toggled, plannerShared::instance(), &plannerShared::set_verbatim_plan);
|
||||
connect(ui.display_duration, &QAbstractButton::toggled, plannerShared::instance(), &plannerShared::set_display_duration);
|
||||
connect(ui.display_runtime, &QAbstractButton::toggled, plannerShared::instance(), &plannerShared::set_display_runtime);
|
||||
connect(ui.display_transitions, &QAbstractButton::toggled, plannerShared::instance(), &plannerShared::set_display_transitions);
|
||||
connect(ui.verbatim_plan, &QAbstractButton::toggled, plannerModel, &DivePlannerPointsModel::setVerbatim);
|
||||
connect(ui.display_duration, &QAbstractButton::toggled, plannerModel, &DivePlannerPointsModel::setDisplayDuration);
|
||||
connect(ui.display_runtime, &QAbstractButton::toggled, plannerModel, &DivePlannerPointsModel::setDisplayRuntime);
|
||||
connect(ui.display_transitions, &QAbstractButton::toggled, plannerModel, &DivePlannerPointsModel::setDisplayTransitions);
|
||||
connect(ui.safetystop, &QAbstractButton::toggled, plannerShared::instance(), &plannerShared::set_safetystop);
|
||||
connect(ui.reserve_gas, QOverload<int>::of(&QSpinBox::valueChanged), plannerShared::instance(), &plannerShared::set_reserve_gas);
|
||||
connect(ui.ascRate75, QOverload<int>::of(&QSpinBox::valueChanged), plannerModel, &DivePlannerPointsModel::setAscrate75Display);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue