Rebreather type selector UI

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-12-26 15:09:18 +01:00 committed by Dirk Hohndel
parent ac2c15e8cf
commit d01c6c824b
4 changed files with 65 additions and 38 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -90,6 +90,7 @@ slots:
void deleteTemporaryPlan();
void loadFromDive(dive *d);
void emitDataChanged();
void setRebreatherMode(QString mode);
signals:
void planCreated();

View file

@ -30,8 +30,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1084</width>
<height>424</height>
<width>1078</width>
<height>418</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -262,14 +262,7 @@
<property name="spacing">
<number>2</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>GF low</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QSpinBox" name="gflow">
<property name="suffix">
<string>%</string>
@ -282,14 +275,48 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="1">
<widget class="QLabel" name="label_15">
<property name="text">
<string>GF low</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_16">
<property name="text">
<string>GF high</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="backgasBreaks">
<property name="text">
<string>Plan backgas breaks</string>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="lastStop">
<property name="text">
<string>Last stop at 6m</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="gfhigh">
<property name="suffix">
<string>%</string>
@ -302,40 +329,23 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="drop_stone_mode">
<property name="text">
<string>Drop to first depth</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="lastStop">
<property name="text">
<string>Last stop at 6m</string>
<item row="5" column="1">
<widget class="QComboBox" name="rebreathermode">
<property name="currentText">
<string/>
</property>
<property name="maxVisibleItems">
<number>6</number>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="backgasBreaks">
<property name="text">
<string>Plan backgas breaks</string>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>