summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-03-31 14:52:37 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-02 09:45:50 -0700
commit8571dcf9673e35710201cdffc0cb7ff1ff2b2426 (patch)
tree4ba251b920e3c349aa9f9e20c9fc52e943160db7 /qt-ui
parent297ddf666df490699128b038948177ba4e5444b6 (diff)
downloadsubsurface-8571dcf9673e35710201cdffc0cb7ff1ff2b2426.tar.gz
Introduce recreational planner mode
This adopts the planner to the needs of the recreational diver. Rather than immediately starting to ascent doing deco stops this mode, this mode stays at the last manually entered depth for the maximal time before mandantory stops appear (NDL). It does not change gas but keeps using the last used cylinder. TODO: * Grey out unused UI elements of the planner in this mode * Start ascent before gas runs out (or into reserve) * Do a 3min @ 5m safety stop. Fixes #840 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp10
-rw-r--r--qt-ui/diveplanner.h1
-rw-r--r--qt-ui/plannerSettings.ui89
-rw-r--r--qt-ui/profile/diveprofileitem.cpp2
4 files changed, 60 insertions, 42 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 8262f3dfc..00a4113ca 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -393,6 +393,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
prefs.display_duration = s.value("display_duration", prefs.display_duration).toBool();
prefs.display_runtime = s.value("display_runtime", prefs.display_runtime).toBool();
prefs.display_transitions = s.value("display_transitions", prefs.display_transitions).toBool();
+ prefs.recreational_mode = s.value("recreational_mode", prefs.recreational_mode).toBool();
prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
prefs.ascrate50 = s.value("ascrate50", prefs.ascrate50).toInt();
prefs.ascratestops = s.value("ascratestops", prefs.ascratestops).toInt();
@@ -414,6 +415,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.display_duration->setChecked(prefs.display_duration);
ui.display_runtime->setChecked(prefs.display_runtime);
ui.display_transitions->setChecked(prefs.display_transitions);
+ ui.recreational_mode->setChecked(prefs.recreational_mode);
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
ui.backgasBreaks->setChecked(prefs.doo2breaks);
@@ -427,6 +429,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
+ connect(ui.recreational_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setRecreationalMode(bool)));
connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int)));
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
connect(ui.ascRate50, SIGNAL(valueChanged(int)), this, SLOT(setAscRate50(int)));
@@ -474,6 +477,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
s.setValue("display_duration", prefs.display_duration);
s.setValue("display_runtime", prefs.display_runtime);
s.setValue("display_transitions", prefs.display_transitions);
+ s.setValue("recreational_mode", prefs.recreational_mode);
s.setValue("ascrate75", prefs.ascrate75);
s.setValue("ascrate50", prefs.ascrate50);
s.setValue("ascratestops", prefs.ascratestops);
@@ -861,6 +865,12 @@ void DivePlannerPointsModel::setDisplayTransitions(bool value)
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
}
+void DivePlannerPointsModel::setRecreationalMode(bool value)
+{
+ prefs.recreational_mode = value;
+ emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
+}
+
void DivePlannerPointsModel::setDropStoneMode(bool value)
{
prefs.drop_stone_mode = value;
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 196e17546..eed481c04 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -82,6 +82,7 @@ slots:
void setDisplayRuntime(bool value);
void setDisplayDuration(bool value);
void setDisplayTransitions(bool value);
+ void setRecreationalMode(bool value);
void savePlan();
void saveDuplicatePlan();
void remove(const QModelIndex &index);
diff --git a/qt-ui/plannerSettings.ui b/qt-ui/plannerSettings.ui
index 0951e324f..09f019e06 100644
--- a/qt-ui/plannerSettings.ui
+++ b/qt-ui/plannerSettings.ui
@@ -262,62 +262,52 @@
<property name="spacing">
<number>2</number>
</property>
- <item row="0" column="2">
- <widget class="QSpinBox" name="gflow">
- <property name="suffix">
- <string>%</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>150</number>
- </property>
- </widget>
- </item>
- <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">
+ <item row="2" column="1">
<widget class="QLabel" name="label_16">
<property name="text">
<string>GF high</string>
</property>
</widget>
</item>
- <item row="4" column="1" colspan="2">
+ <item row="5" 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>
+ <item row="2" column="2">
+ <widget class="QSpinBox" name="gfhigh">
+ <property name="suffix">
+ <string>%</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <property name="minimum">
+ <number>1</number>
</property>
- </spacer>
+ <property name="maximum">
+ <number>150</number>
+ </property>
+ </widget>
</item>
- <item row="3" column="1" colspan="2">
+ <item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="lastStop">
<property name="text">
<string>Last stop at 6m</string>
</property>
</widget>
</item>
+ <item row="6" column="1">
+ <widget class="QComboBox" name="rebreathermode">
+ <property name="currentText">
+ <string/>
+ </property>
+ <property name="maxVisibleItems">
+ <number>6</number>
+ </property>
+ </widget>
+ </item>
<item row="1" column="2">
- <widget class="QSpinBox" name="gfhigh">
+ <widget class="QSpinBox" name="gflow">
<property name="suffix">
<string>%</string>
</property>
@@ -329,20 +319,37 @@
</property>
</widget>
</item>
- <item row="2" column="1" colspan="2">
+ <item row="3" 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="5" column="1">
- <widget class="QComboBox" name="rebreathermode">
- <property name="currentText">
- <string/>
+ <item row="7" column="1">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="maxVisibleItems">
- <number>6</number>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>GF low</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="recreational_mode">
+ <property name="text">
+ <string>Recreational mode</string>
</property>
</widget>
</item>
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 4ad0ba3ca..7d29d28b4 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -169,7 +169,7 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI
for (int i = 0; i < dataModel->rowCount(); i++, entry++) {
int max = maxCeiling(i);
// Don't scream if we violate the ceiling by a few cm
- if (entry->depth < max - 100) {
+ if (entry->depth < max - 100 && entry->sec > 0) {
profileColor = QColor(Qt::red);
if (!eventAdded) {
add_event(&displayed_dive.dc, entry->sec, SAMPLE_EVENT_CEILING, -1, max / 1000, "planned waypoint above ceiling");