mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add planner minimum gas switch duration option
Add the option for a minimum gas switch duration to the planner UI. This is not actually used yet. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ab90375c19
commit
4dfdea1e1d
6 changed files with 41 additions and 2 deletions
1
pref.h
1
pref.h
|
@ -84,6 +84,7 @@ struct preferences {
|
||||||
bool recreational_mode;
|
bool recreational_mode;
|
||||||
bool safetystop;
|
bool safetystop;
|
||||||
int reserve_gas;
|
int reserve_gas;
|
||||||
|
int min_switch_duration; // seconds
|
||||||
int bottomsac;
|
int bottomsac;
|
||||||
int decosac;
|
int decosac;
|
||||||
int o2consumption; // ml per min
|
int o2consumption; // ml per min
|
||||||
|
|
|
@ -490,6 +490,12 @@ void DivePlannerPointsModel::setDropStoneMode(bool value)
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivePlannerPointsModel::setMinSwitchDuration(int duration)
|
||||||
|
{
|
||||||
|
prefs.min_switch_duration = duration * 60;
|
||||||
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setStartDate(const QDate &date)
|
void DivePlannerPointsModel::setStartDate(const QDate &date)
|
||||||
{
|
{
|
||||||
startTime.setDate(date);
|
startTime.setDate(date);
|
||||||
|
|
|
@ -90,6 +90,7 @@ slots:
|
||||||
void emitDataChanged();
|
void emitDataChanged();
|
||||||
void setRebreatherMode(int mode);
|
void setRebreatherMode(int mode);
|
||||||
void setReserveGas(int reserve);
|
void setReserveGas(int reserve);
|
||||||
|
void setMinSwitchDuration(int duration);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void planCreated();
|
void planCreated();
|
||||||
|
|
|
@ -254,6 +254,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
prefs.bottompo2 = s.value("bottompo2", prefs.bottompo2).toInt();
|
prefs.bottompo2 = s.value("bottompo2", prefs.bottompo2).toInt();
|
||||||
prefs.decopo2 = s.value("decopo2", prefs.decopo2).toInt();
|
prefs.decopo2 = s.value("decopo2", prefs.decopo2).toInt();
|
||||||
prefs.doo2breaks = s.value("doo2breaks", prefs.doo2breaks).toBool();
|
prefs.doo2breaks = s.value("doo2breaks", prefs.doo2breaks).toBool();
|
||||||
|
prefs.min_switch_duration = s.value("min_switch_duration", prefs.min_switch_duration).toInt();
|
||||||
prefs.drop_stone_mode = s.value("drop_stone_mode", prefs.drop_stone_mode).toBool();
|
prefs.drop_stone_mode = s.value("drop_stone_mode", prefs.drop_stone_mode).toBool();
|
||||||
prefs.bottomsac = s.value("bottomsac", prefs.bottomsac).toInt();
|
prefs.bottomsac = s.value("bottomsac", prefs.bottomsac).toInt();
|
||||||
prefs.decosac = s.value("decosac", prefs.decosac).toInt();
|
prefs.decosac = s.value("decosac", prefs.decosac).toInt();
|
||||||
|
@ -274,6 +275,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
||||||
ui.backgasBreaks->setChecked(prefs.doo2breaks);
|
ui.backgasBreaks->setChecked(prefs.doo2breaks);
|
||||||
ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
|
ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
|
||||||
|
ui.min_switch_duration->setValue(prefs.min_switch_duration / 60);
|
||||||
// should be the same order as in dive_comp_type!
|
// should be the same order as in dive_comp_type!
|
||||||
rebreater_modes << tr("Open circuit") << tr("CCR") << tr("pSCR");
|
rebreater_modes << tr("Open circuit") << tr("CCR") << tr("pSCR");
|
||||||
ui.rebreathermode->insertItems(0, rebreater_modes);
|
ui.rebreathermode->insertItems(0, rebreater_modes);
|
||||||
|
@ -306,6 +308,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh()));
|
connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh()));
|
||||||
connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow()));
|
connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow()));
|
||||||
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
|
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
|
||||||
|
connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int)));
|
||||||
connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int)));
|
connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int)));
|
||||||
connect(plannerModel, SIGNAL(recreationChanged(bool)), this, SLOT(disableDecoElements(bool)));
|
connect(plannerModel, SIGNAL(recreationChanged(bool)), this, SLOT(disableDecoElements(bool)));
|
||||||
|
|
||||||
|
@ -347,6 +350,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
|
||||||
s.setValue("decopo2", prefs.decopo2);
|
s.setValue("decopo2", prefs.decopo2);
|
||||||
s.setValue("doo2breaks", prefs.doo2breaks);
|
s.setValue("doo2breaks", prefs.doo2breaks);
|
||||||
s.setValue("drop_stone_mode", prefs.drop_stone_mode);
|
s.setValue("drop_stone_mode", prefs.drop_stone_mode);
|
||||||
|
s.setValue("min_switch_duration", prefs.min_switch_duration);
|
||||||
s.setValue("bottomsac", prefs.bottomsac);
|
s.setValue("bottomsac", prefs.bottomsac);
|
||||||
s.setValue("decosac", prefs.decosac);
|
s.setValue("decosac", prefs.decosac);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
|
@ -308,7 +308,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="QComboBox" name="rebreathermode">
|
<widget class="QComboBox" name="rebreathermode">
|
||||||
<property name="currentText">
|
<property name="currentText">
|
||||||
<string/>
|
<string/>
|
||||||
|
@ -338,7 +338,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1">
|
<item row="12" column="1">
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -401,6 +401,32 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="10" column="1">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Min. switch duration</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="2">
|
||||||
|
<widget class="QSpinBox" name="min_switch_duration">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>min</string>
|
||||||
|
</property>
|
||||||
|
<property name="prefix">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -47,6 +47,7 @@ struct preferences default_prefs = {
|
||||||
.decopo2 = 1600,
|
.decopo2 = 1600,
|
||||||
.doo2breaks = false,
|
.doo2breaks = false,
|
||||||
.drop_stone_mode = false,
|
.drop_stone_mode = false,
|
||||||
|
.min_switch_duration = 60,
|
||||||
.last_stop = false,
|
.last_stop = false,
|
||||||
.verbatim_plan = false,
|
.verbatim_plan = false,
|
||||||
.display_runtime = true,
|
.display_runtime = true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue