diveplanner: add last gas variables to QMLInterface

Add bottompo2, decopo2 and bestmixend to QMLInterface

Bestmixend in gas options changing with
meter/feet

Signed-off-by: jan Iversen <jan@casacondor.com>
This commit is contained in:
jan Iversen 2020-01-21 17:43:18 +01:00 committed by Dirk Hohndel
parent 86fd49f2d7
commit 1e3879d87d
3 changed files with 58 additions and 10 deletions

View file

@ -20,6 +20,7 @@ Kirigami.ScrollablePage {
spinAscratestops.value = Backend.ascratestops spinAscratestops.value = Backend.ascratestops
spinAscratelast6m.value = Backend.ascratelast6m spinAscratelast6m.value = Backend.ascratelast6m
spinDescrate.value = Backend.descrate spinDescrate.value = Backend.descrate
spinBestmixend.value = Backend.bestmixend
} }
onVolumeChanged: { onVolumeChanged: {
spinBottomsac.value = Backend.bottomsac spinBottomsac.value = Backend.bottomsac
@ -292,14 +293,14 @@ Kirigami.ScrollablePage {
} }
TemplateSpinBox { TemplateSpinBox {
from: 0 from: 0
to: 200 to: 250
stepSize: 1 stepSize: 1
value: Planner.bottompo2 value: Backend.bottompo2
textFromValue: function (value, locale) { textFromValue: function (value, locale) {
return (value / 100).toFixed(2) + "bar" return (value / 100).toFixed(2) + "bar"
} }
onValueModified: { onValueModified: {
Planner.bottompo2 = value Backend.bottompo2 = value
} }
} }
TemplateLabel { TemplateLabel {
@ -307,36 +308,37 @@ Kirigami.ScrollablePage {
} }
TemplateSpinBox { TemplateSpinBox {
from: 0 from: 0
to: 200 to: 250
stepSize: 1 stepSize: 1
value: Planner.decopo2 value: Backend.decopo2
textFromValue: function (value, locale) { textFromValue: function (value, locale) {
return (value / 100).toFixed(2) + "bar" return (value / 100).toFixed(2) + "bar"
} }
onValueModified: { onValueModified: {
Planner.decopo2 = value Backend.decopo2 = value
} }
} }
TemplateLabel { TemplateLabel {
text: qsTr("Best mix END") text: qsTr("Best mix END")
} }
TemplateSpinBox { TemplateSpinBox {
id: spinBestmixend
from: 1 from: 1
to: 99 to: 99
stepSize: 1 stepSize: 1
value: Planner.bestmixend value: Backend.bestmixend
textFromValue: function (value, locale) { textFromValue: function (value, locale) {
return value + speedUnit return value + speedUnit
} }
onValueModified: { onValueModified: {
Planner.bestmixend = value Backend.bestmixend = value
} }
} }
TemplateCheckBox { TemplateCheckBox {
text: qsTr("O2 narcotic") text: qsTr("O2 narcotic")
checked: Planner.o2narcotic checked: Backend.o2narcotic
onClicked: { onClicked: {
Planner.o2narcotic = checked Backend.o2narcotic = checked
} }
} }
} }

View file

@ -71,6 +71,16 @@ void QMLInterface::setup(QQmlContext *ct)
instance(), &QMLInterface::decosacChanged); instance(), &QMLInterface::decosacChanged);
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::sacfactorChanged, connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::sacfactorChanged,
instance(), &QMLInterface::sacfactorChanged); instance(), &QMLInterface::sacfactorChanged);
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::problemsolvingtimeChanged,
instance(), &QMLInterface::problemsolvingtimeChanged);
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::o2narcoticChanged,
instance(), &QMLInterface::o2narcoticChanged);
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::bottompo2Changed,
instance(), &QMLInterface::bottompo2Changed);
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::decopo2Changed,
instance(), &QMLInterface::decopo2Changed);
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::bestmixendChanged,
instance(), &QMLInterface::bestmixendChanged);
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::display_runtimeChanged, connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::display_runtimeChanged,
instance(), &QMLInterface::display_runtimeChanged); instance(), &QMLInterface::display_runtimeChanged);

View file

@ -53,6 +53,15 @@ class QMLInterface : public QObject {
Q_PROPERTY(bool last_stop6m READ last_stop6m WRITE set_last_stop6m NOTIFY last_stop6mChanged); Q_PROPERTY(bool last_stop6m READ last_stop6m WRITE set_last_stop6m NOTIFY last_stop6mChanged);
Q_PROPERTY(bool switch_at_req_stop READ switch_at_req_stop WRITE set_switch_at_req_stop NOTIFY switch_at_req_stopChanged); Q_PROPERTY(bool switch_at_req_stop READ switch_at_req_stop WRITE set_switch_at_req_stop NOTIFY switch_at_req_stopChanged);
Q_PROPERTY(int bottomsac READ bottomsac WRITE set_bottomsac NOTIFY bottomsacChanged);
Q_PROPERTY(int decosac READ decosac WRITE set_decosac NOTIFY decosacChanged);
Q_PROPERTY(int problemsolvingtime READ problemsolvingtime WRITE set_problemsolvingtime NOTIFY problemsolvingtimeChanged);
Q_PROPERTY(int sacfactor READ sacfactor WRITE set_sacfactor NOTIFY sacfactorChanged);
Q_PROPERTY(bool o2narcotic READ o2narcotic WRITE set_o2narcotic NOTIFY o2narcoticChanged);
Q_PROPERTY(int bottompo2 READ bottompo2 WRITE set_bottompo2 NOTIFY bottompo2Changed);
Q_PROPERTY(int decopo2 READ decopo2 WRITE set_decopo2 NOTIFY decopo2Changed);
Q_PROPERTY(int bestmixend READ bestmixend WRITE set_bestmixend NOTIFY bestmixendChanged);
Q_PROPERTY(bool display_runtime READ display_runtime WRITE set_display_runtime NOTIFY display_runtimeChanged); 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_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 display_transitions READ display_transitions WRITE set_display_transitions NOTIFY display_transitionsChanged);
@ -158,6 +167,15 @@ public:
bool last_stop6m() { return prefs.last_stop; } bool last_stop6m() { return prefs.last_stop; }
bool switch_at_req_stop() { return prefs.switch_at_req_stop; } bool switch_at_req_stop() { return prefs.switch_at_req_stop; }
int bottomsac() { return (int)plannerShared::bottomsac(); }
int decosac() { return (int)plannerShared::decosac(); }
int problemsolvingtime() { return prefs.problemsolvingtime; }
int sacfactor() { return (int)plannerShared::sacfactor(); }
bool o2narcotic() { return (int)plannerShared::o2narcotic(); }
int bottompo2() { return (int)plannerShared::bottompo2(); }
int decopo2() { return (int)plannerShared::decopo2(); }
int bestmixend() { return plannerShared::bestmixend(); }
bool display_runtime() { return prefs.display_runtime; } bool display_runtime() { return prefs.display_runtime; }
bool display_duration() { return prefs.display_duration; } bool display_duration() { return prefs.display_duration; }
bool display_transitions() { return prefs.display_transitions; } bool display_transitions() { return prefs.display_transitions; }
@ -189,6 +207,15 @@ public slots:
void set_last_stop6m(bool value) { DivePlannerPointsModel::instance()->setLastStop6m(value); } void set_last_stop6m(bool value) { DivePlannerPointsModel::instance()->setLastStop6m(value); }
void set_switch_at_req_stop(bool value) { DivePlannerPointsModel::instance()->setSwitchAtReqStop(value); } void set_switch_at_req_stop(bool value) { DivePlannerPointsModel::instance()->setSwitchAtReqStop(value); }
void set_bottomsac(int value) { plannerShared::set_bottomsac((double)value); }
void set_decosac(int value) { plannerShared::set_decosac((double)value); }
void set_problemsolvingtime(int value) { DivePlannerPointsModel::instance()->setProblemSolvingTime(value); }
void set_sacfactor(int value) { plannerShared::set_sacfactor((double)value); }
void set_o2narcotic(bool value) { plannerShared::set_o2narcotic(value); }
void set_bottompo2(int value) { plannerShared::set_bottompo2((double)value); }
void set_decopo2(int value) { plannerShared::set_decopo2((double)value); }
void set_bestmixend(int value) { plannerShared::set_bestmixend(value); }
void set_display_runtime(bool value) { DivePlannerPointsModel::instance()->setDisplayRuntime(value); } void set_display_runtime(bool value) { DivePlannerPointsModel::instance()->setDisplayRuntime(value); }
void set_display_duration(bool value) { DivePlannerPointsModel::instance()->setDisplayDuration(value); } void set_display_duration(bool value) { DivePlannerPointsModel::instance()->setDisplayDuration(value); }
void set_display_transitions(bool value) { DivePlannerPointsModel::instance()->setDisplayTransitions(value); } void set_display_transitions(bool value) { DivePlannerPointsModel::instance()->setDisplayTransitions(value); }
@ -220,6 +247,15 @@ signals:
void last_stop6mChanged(bool value); void last_stop6mChanged(bool value);
void switch_at_req_stopChanged(bool value); void switch_at_req_stopChanged(bool value);
void bottomsacChanged(int value);
void decosacChanged(int value);
void sacfactorChanged(int value);
void problemsolvingtimeChanged(int value);
void o2narcoticChanged(bool value);
void bottompo2Changed(int value);
void decopo2Changed(int value);
void bestmixendChanged(int value);
void display_runtimeChanged(bool value); void display_runtimeChanged(bool value);
void display_durationChanged(bool value); void display_durationChanged(bool value);
void display_transitionsChanged(bool value); void display_transitionsChanged(bool value);