summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-12-26 15:09:18 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-10 17:27:24 -0800
commitd01c6c824b1e6114a58ac84f387cd437a2c2ac02 (patch)
treee705e57e41c7be6a585d8df126d40c59746378ed
parentac2c15e8cf882fa51220ca51f856c5e252979ff8 (diff)
downloadsubsurface-d01c6c824b1e6114a58ac84f387cd437a2c2ac02.tar.gz
Rebreather type selector UI
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--planner.c2
-rw-r--r--qt-ui/diveplanner.cpp16
-rw-r--r--qt-ui/diveplanner.h1
-rw-r--r--qt-ui/plannerSettings.ui82
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 @@
<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>
- </widget>
- </item>
- <item row="4" column="0" colspan="2">
- <widget class="QCheckBox" name="backgasBreaks">
- <property name="text">
- <string>Plan backgas breaks</string>
+ <property name="maxVisibleItems">
+ <number>6</number>
</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>