mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:43:23 +00:00
VPM-B: add deco choice to the ui.
Removed recreational mode from ui and pref and replaced it with new deco_mode enum. Added radio button ui selection. Set default deco_mode to Buehlmann algorithm. Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
This commit is contained in:
parent
2435d79c0e
commit
500fbe4994
8 changed files with 53 additions and 15 deletions
|
@ -955,7 +955,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
||||||
/* Keep time during the ascend */
|
/* Keep time during the ascend */
|
||||||
bottom_time = clock = previous_point_time = displayed_dive.dc.sample[displayed_dive.dc.samples - 1].time.seconds;
|
bottom_time = clock = previous_point_time = displayed_dive.dc.sample[displayed_dive.dc.samples - 1].time.seconds;
|
||||||
gi = gaschangenr - 1;
|
gi = gaschangenr - 1;
|
||||||
if(prefs.recreational_mode) {
|
|
||||||
|
if(prefs.deco_mode == RECREATIONAL) {
|
||||||
bool safety_stop = prefs.safetystop && max_depth >= 10000;
|
bool safety_stop = prefs.safetystop && max_depth >= 10000;
|
||||||
track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time, safety_stop);
|
track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time, safety_stop);
|
||||||
// How long can we stay at the current depth and still directly ascent to the surface?
|
// How long can we stay at the current depth and still directly ascent to the surface?
|
||||||
|
|
8
pref.h
8
pref.h
|
@ -32,6 +32,12 @@ typedef struct {
|
||||||
enum taxonomy_category category[3];
|
enum taxonomy_category category[3];
|
||||||
} geocoding_prefs_t;
|
} geocoding_prefs_t;
|
||||||
|
|
||||||
|
enum deco_mode {
|
||||||
|
BUEHLMANN,
|
||||||
|
RECREATIONAL,
|
||||||
|
VPMB
|
||||||
|
};
|
||||||
|
|
||||||
struct preferences {
|
struct preferences {
|
||||||
const char *divelist_font;
|
const char *divelist_font;
|
||||||
const char *default_filename;
|
const char *default_filename;
|
||||||
|
@ -89,7 +95,6 @@ struct preferences {
|
||||||
bool display_runtime;
|
bool display_runtime;
|
||||||
bool display_duration;
|
bool display_duration;
|
||||||
bool display_transitions;
|
bool display_transitions;
|
||||||
bool recreational_mode;
|
|
||||||
bool safetystop;
|
bool safetystop;
|
||||||
bool switch_at_req_stop;
|
bool switch_at_req_stop;
|
||||||
int reserve_gas;
|
int reserve_gas;
|
||||||
|
@ -110,6 +115,7 @@ struct preferences {
|
||||||
short cloud_verification_status;
|
short cloud_verification_status;
|
||||||
bool cloud_background_sync;
|
bool cloud_background_sync;
|
||||||
geocoding_prefs_t geocoding;
|
geocoding_prefs_t geocoding;
|
||||||
|
enum deco_mode deco_mode;
|
||||||
};
|
};
|
||||||
enum unit_system_values {
|
enum unit_system_values {
|
||||||
METRIC,
|
METRIC,
|
||||||
|
|
|
@ -449,10 +449,10 @@ void DivePlannerPointsModel::setDisplayTransitions(bool value)
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setRecreationalMode(bool value)
|
void DivePlannerPointsModel::setDecoMode(int mode)
|
||||||
{
|
{
|
||||||
prefs.recreational_mode = value;
|
prefs.deco_mode = deco_mode(mode);
|
||||||
emit recreationChanged(value);
|
emit recreationChanged(mode == int(RECREATIONAL));
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ slots:
|
||||||
void setDisplayRuntime(bool value);
|
void setDisplayRuntime(bool value);
|
||||||
void setDisplayDuration(bool value);
|
void setDisplayDuration(bool value);
|
||||||
void setDisplayTransitions(bool value);
|
void setDisplayTransitions(bool value);
|
||||||
void setRecreationalMode(bool value);
|
void setDecoMode(int mode);
|
||||||
void setSafetyStop(bool value);
|
void setSafetyStop(bool value);
|
||||||
void savePlan();
|
void savePlan();
|
||||||
void saveDuplicatePlan();
|
void saveDuplicatePlan();
|
||||||
|
|
|
@ -243,7 +243,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
prefs.display_duration = s.value("display_duration", prefs.display_duration).toBool();
|
prefs.display_duration = s.value("display_duration", prefs.display_duration).toBool();
|
||||||
prefs.display_runtime = s.value("display_runtime", prefs.display_runtime).toBool();
|
prefs.display_runtime = s.value("display_runtime", prefs.display_runtime).toBool();
|
||||||
prefs.display_transitions = s.value("display_transitions", prefs.display_transitions).toBool();
|
prefs.display_transitions = s.value("display_transitions", prefs.display_transitions).toBool();
|
||||||
prefs.recreational_mode = s.value("recreational_mode", prefs.recreational_mode).toBool();
|
prefs.deco_mode = deco_mode(s.value("deco_mode", prefs.deco_mode).toInt());
|
||||||
prefs.safetystop = s.value("safetystop", prefs.safetystop).toBool();
|
prefs.safetystop = s.value("safetystop", prefs.safetystop).toBool();
|
||||||
prefs.reserve_gas = s.value("reserve_gas", prefs.reserve_gas).toInt();
|
prefs.reserve_gas = s.value("reserve_gas", prefs.reserve_gas).toInt();
|
||||||
prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
|
prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
|
||||||
|
@ -269,7 +269,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
ui.display_duration->setChecked(prefs.display_duration);
|
ui.display_duration->setChecked(prefs.display_duration);
|
||||||
ui.display_runtime->setChecked(prefs.display_runtime);
|
ui.display_runtime->setChecked(prefs.display_runtime);
|
||||||
ui.display_transitions->setChecked(prefs.display_transitions);
|
ui.display_transitions->setChecked(prefs.display_transitions);
|
||||||
ui.recreational_mode->setChecked(prefs.recreational_mode);
|
|
||||||
ui.safetystop->setChecked(prefs.safetystop);
|
ui.safetystop->setChecked(prefs.safetystop);
|
||||||
ui.reserve_gas->setValue(prefs.reserve_gas / 1000);
|
ui.reserve_gas->setValue(prefs.reserve_gas / 1000);
|
||||||
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
|
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
|
||||||
|
@ -278,17 +277,30 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
|
ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
|
||||||
ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop);
|
ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop);
|
||||||
ui.min_switch_duration->setValue(prefs.min_switch_duration / 60);
|
ui.min_switch_duration->setValue(prefs.min_switch_duration / 60);
|
||||||
|
ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL);
|
||||||
|
ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN);
|
||||||
|
ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB);
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
||||||
|
modeMapper = new QSignalMapper(this);
|
||||||
|
connect(modeMapper, SIGNAL(mapped(int)) , plannerModel, SLOT(setDecoMode(int)));
|
||||||
|
modeMapper->setMapping(ui.recreational_deco, int(RECREATIONAL));
|
||||||
|
modeMapper->setMapping(ui.buehlmann_deco, int(BUEHLMANN));
|
||||||
|
modeMapper->setMapping(ui.vpmb_deco, int(VPMB));
|
||||||
|
|
||||||
|
connect(ui.recreational_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
|
||||||
|
connect(ui.buehlmann_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
|
||||||
|
connect(ui.vpmb_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
|
||||||
|
|
||||||
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
|
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
|
||||||
connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
|
connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
|
||||||
connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
|
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_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
|
||||||
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
|
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
|
||||||
connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool)));
|
connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool)));
|
||||||
connect(ui.recreational_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setRecreationalMode(bool)));
|
|
||||||
connect(ui.reserve_gas, SIGNAL(valueChanged(int)), plannerModel, SLOT(setReserveGas(int)));
|
connect(ui.reserve_gas, SIGNAL(valueChanged(int)), plannerModel, SLOT(setReserveGas(int)));
|
||||||
connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int)));
|
connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int)));
|
||||||
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
|
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
|
||||||
|
@ -341,7 +353,6 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
|
||||||
s.setValue("display_duration", prefs.display_duration);
|
s.setValue("display_duration", prefs.display_duration);
|
||||||
s.setValue("display_runtime", prefs.display_runtime);
|
s.setValue("display_runtime", prefs.display_runtime);
|
||||||
s.setValue("display_transitions", prefs.display_transitions);
|
s.setValue("display_transitions", prefs.display_transitions);
|
||||||
s.setValue("recreational_mode", prefs.recreational_mode);
|
|
||||||
s.setValue("safetystop", prefs.safetystop);
|
s.setValue("safetystop", prefs.safetystop);
|
||||||
s.setValue("reserve_gas", prefs.reserve_gas);
|
s.setValue("reserve_gas", prefs.reserve_gas);
|
||||||
s.setValue("ascrate75", prefs.ascrate75);
|
s.setValue("ascrate75", prefs.ascrate75);
|
||||||
|
@ -357,6 +368,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
|
||||||
s.setValue("min_switch_duration", prefs.min_switch_duration);
|
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.setValue("deco_mode", int(prefs.deco_mode));
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ slots:
|
||||||
private:
|
private:
|
||||||
Ui::plannerSettingsWidget ui;
|
Ui::plannerSettingsWidget ui;
|
||||||
void updateUnitsUI();
|
void updateUnitsUI();
|
||||||
|
QSignalMapper *modeMapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "ui_plannerDetails.h"
|
#include "ui_plannerDetails.h"
|
||||||
|
|
|
@ -359,13 +359,30 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QCheckBox" name="recreational_mode">
|
<widget class="QRadioButton" name="recreational_deco">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Recreational mode</string>
|
<string>Recreational mode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
|
<widget class="QRadioButton" name="buehlmann_deco">
|
||||||
|
<property name="text">
|
||||||
|
<string>Buehlmann deco</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QRadioButton" name="vpmb_deco">
|
||||||
|
<property name="text">
|
||||||
|
<string>VPM-B deco</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
<widget class="QCheckBox" name="safetystop">
|
<widget class="QCheckBox" name="safetystop">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Safety stop</string>
|
<string>Safety stop</string>
|
||||||
|
@ -375,14 +392,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Reserve gas</string>
|
<string>Reserve gas</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="4" column="2">
|
||||||
<widget class="QSpinBox" name="reserve_gas">
|
<widget class="QSpinBox" name="reserve_gas">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string>bar</string>
|
<string>bar</string>
|
||||||
|
|
|
@ -54,7 +54,6 @@ struct preferences default_prefs = {
|
||||||
.display_runtime = true,
|
.display_runtime = true,
|
||||||
.display_duration = true,
|
.display_duration = true,
|
||||||
.display_transitions = true,
|
.display_transitions = true,
|
||||||
.recreational_mode = false,
|
|
||||||
.safetystop = true,
|
.safetystop = true,
|
||||||
.bottomsac = 20000,
|
.bottomsac = 20000,
|
||||||
.decosac = 17000,
|
.decosac = 17000,
|
||||||
|
@ -75,7 +74,8 @@ struct preferences default_prefs = {
|
||||||
.parse_dive_without_gps = false,
|
.parse_dive_without_gps = false,
|
||||||
.tag_existing_dives = false,
|
.tag_existing_dives = false,
|
||||||
.category = { 0 }
|
.category = { 0 }
|
||||||
}
|
},
|
||||||
|
.deco_mode = BUEHLMANN
|
||||||
};
|
};
|
||||||
|
|
||||||
int run_survey;
|
int run_survey;
|
||||||
|
|
Loading…
Add table
Reference in a new issue