From d01c6c824b1e6114a58ac84f387cd437a2c2ac02 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 26 Dec 2014 15:09:18 +0100 Subject: Rebreather type selector UI Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- planner.c | 2 +- qt-ui/diveplanner.cpp | 16 ++++++++++ qt-ui/diveplanner.h | 1 + qt-ui/plannerSettings.ui | 82 +++++++++++++++++++++++++++--------------------- 4 files changed, 64 insertions(+), 37 deletions(-) diff --git a/planner.c b/planner.c index 27781f6f3..322bd25e6 100644 --- a/planner.c +++ b/planner.c @@ -251,7 +251,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas) int oldpo2 = 0; int lasttime = 0; int lastdepth = 0; - enum dive_comp_type type = OC; + enum dive_comp_type type = displayed_dive.dc.dctype; if (!diveplan || !diveplan->dp) return; diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index fabc11ed7..57349007c 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -394,6 +394,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.setupUi(this); QSettings s; + QStringList rebreater_modes; s.beginGroup("Planner"); prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt(); prefs.ascrate50 = s.value("ascrate50", prefs.ascrate50).toInt(); @@ -415,6 +416,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.decopo2->setValue(prefs.decopo2 / 1000.0); ui.backgasBreaks->setChecked(prefs.doo2breaks); ui.drop_stone_mode->setChecked(prefs.drop_stone_mode); + rebreater_modes << "Open circuit" << "pSCR" << "CCR"; + ui.rebreathermode->insertItems(0, rebreater_modes); connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool))); connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool))); @@ -441,6 +444,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh())); connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow())); connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool))); + connect(ui.rebreathermode, SIGNAL(currentIndexChanged(QString)), plannerModel, SLOT(setRebreatherMode(QString))); settingsChanged(); ui.gflow->setValue(prefs.gflow); ui.gfhigh->setValue(prefs.gfhigh); @@ -779,6 +783,18 @@ void DivePlannerPointsModel::setGFLow(const int ghflow) triggerGFLow(); } +void DivePlannerPointsModel::setRebreatherMode(QString mode) +{ + qDebug() << mode << "selected, was" << displayed_dive.dc.dctype; + if (mode == "OC") + displayed_dive.dc.dctype = OC; + else if (mode == "pSCR") + displayed_dive.dc.dctype = PSCR; + else if (mode == "CCR") + displayed_dive.dc.dctype = CCR; + plannerModel->emitDataChanged(); +} + void DivePlannerPointsModel::triggerGFLow() { if (diveplan.gflow != tempGFLow) { diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index bca0deb78..6ff4d0f50 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -90,6 +90,7 @@ slots: void deleteTemporaryPlan(); void loadFromDive(dive *d); void emitDataChanged(); + void setRebreatherMode(QString mode); signals: void planCreated(); diff --git a/qt-ui/plannerSettings.ui b/qt-ui/plannerSettings.ui index f99be9803..af03fd1fb 100644 --- a/qt-ui/plannerSettings.ui +++ b/qt-ui/plannerSettings.ui @@ -30,8 +30,8 @@ 0 0 - 1084 - 424 + 1078 + 418 @@ -262,14 +262,7 @@ 2 - - - - GF low - - - - + % @@ -282,14 +275,48 @@ - + + + + GF low + + + + GF high - + + + + Plan backgas breaks + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Last stop at 6m + + + + % @@ -302,40 +329,23 @@ - + Drop to first depth - - - - Last stop at 6m + + + + - - - - - - Plan backgas breaks + + 6 - - - - Qt::Vertical - - - - 20 - 40 - - - - -- cgit v1.2.3-70-g09d2