mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Save more planner settings into prefs
This adds to the prefs struct the variables last_stop, verbatim_plan, display_runtime, display_duration, and display_transitions from the planner so their values are saved from one session to the next. The widgets for some of those settings had default values in plannerSettings.ui; remove them since the new code in subsurfacestartup.c takes care of initializing them. Signed-off-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3ff73d0a66
commit
5bf23381e0
4 changed files with 30 additions and 6 deletions
5
pref.h
5
pref.h
|
@ -73,6 +73,11 @@ struct preferences {
|
||||||
char *proxy_pass;
|
char *proxy_pass;
|
||||||
bool doo2breaks;
|
bool doo2breaks;
|
||||||
bool drop_stone_mode;
|
bool drop_stone_mode;
|
||||||
|
bool last_stop;
|
||||||
|
bool verbatim_plan;
|
||||||
|
bool display_runtime;
|
||||||
|
bool display_duration;
|
||||||
|
bool display_transitions;
|
||||||
int bottomsac;
|
int bottomsac;
|
||||||
int decosac;
|
int decosac;
|
||||||
int o2consumption; // ml per min
|
int o2consumption; // ml per min
|
||||||
|
|
|
@ -388,6 +388,11 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
QSettings s;
|
QSettings s;
|
||||||
QStringList rebreater_modes;
|
QStringList rebreater_modes;
|
||||||
s.beginGroup("Planner");
|
s.beginGroup("Planner");
|
||||||
|
prefs.last_stop = s.value("last_stop", prefs.last_stop).toBool();
|
||||||
|
prefs.verbatim_plan = s.value("verbatim_plan", prefs.verbatim_plan).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_transitions = s.value("display_transitions", prefs.display_transitions).toBool();
|
||||||
prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
|
prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
|
||||||
prefs.ascrate50 = s.value("ascrate50", prefs.ascrate50).toInt();
|
prefs.ascrate50 = s.value("ascrate50", prefs.ascrate50).toInt();
|
||||||
prefs.ascratestops = s.value("ascratestops", prefs.ascratestops).toInt();
|
prefs.ascratestops = s.value("ascratestops", prefs.ascratestops).toInt();
|
||||||
|
@ -404,6 +409,11 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
updateUnitsUI();
|
updateUnitsUI();
|
||||||
|
ui.lastStop->setChecked(prefs.last_stop);
|
||||||
|
ui.verbatim_plan->setChecked(prefs.verbatim_plan);
|
||||||
|
ui.display_duration->setChecked(prefs.display_duration);
|
||||||
|
ui.display_runtime->setChecked(prefs.display_runtime);
|
||||||
|
ui.display_transitions->setChecked(prefs.display_transitions);
|
||||||
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
|
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
|
||||||
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
||||||
ui.backgasBreaks->setChecked(prefs.doo2breaks);
|
ui.backgasBreaks->setChecked(prefs.doo2breaks);
|
||||||
|
@ -459,6 +469,11 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
|
||||||
{
|
{
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup("Planner");
|
s.beginGroup("Planner");
|
||||||
|
s.setValue("last_stop", prefs.last_stop);
|
||||||
|
s.setValue("verbatim_plan", prefs.verbatim_plan);
|
||||||
|
s.setValue("display_duration", prefs.display_duration);
|
||||||
|
s.setValue("display_runtime", prefs.display_runtime);
|
||||||
|
s.setValue("display_transitions", prefs.display_transitions);
|
||||||
s.setValue("ascrate75", prefs.ascrate75);
|
s.setValue("ascrate75", prefs.ascrate75);
|
||||||
s.setValue("ascrate50", prefs.ascrate50);
|
s.setValue("ascrate50", prefs.ascrate50);
|
||||||
s.setValue("ascratestops", prefs.ascratestops);
|
s.setValue("ascratestops", prefs.ascratestops);
|
||||||
|
@ -814,30 +829,35 @@ int DivePlannerPointsModel::getSurfacePressure()
|
||||||
void DivePlannerPointsModel::setLastStop6m(bool value)
|
void DivePlannerPointsModel::setLastStop6m(bool value)
|
||||||
{
|
{
|
||||||
set_last_stop(value);
|
set_last_stop(value);
|
||||||
|
prefs.last_stop = value;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setVerbatim(bool value)
|
void DivePlannerPointsModel::setVerbatim(bool value)
|
||||||
{
|
{
|
||||||
set_verbatim(value);
|
set_verbatim(value);
|
||||||
|
prefs.verbatim_plan = value;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setDisplayRuntime(bool value)
|
void DivePlannerPointsModel::setDisplayRuntime(bool value)
|
||||||
{
|
{
|
||||||
set_display_runtime(value);
|
set_display_runtime(value);
|
||||||
|
prefs.display_runtime = value;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setDisplayDuration(bool value)
|
void DivePlannerPointsModel::setDisplayDuration(bool value)
|
||||||
{
|
{
|
||||||
set_display_duration(value);
|
set_display_duration(value);
|
||||||
|
prefs.display_duration = value;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setDisplayTransitions(bool value)
|
void DivePlannerPointsModel::setDisplayTransitions(bool value)
|
||||||
{
|
{
|
||||||
set_display_transitions(value);
|
set_display_transitions(value);
|
||||||
|
prefs.display_transitions = value;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -501,9 +501,6 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display runtime</string>
|
<string>Display runtime</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
@ -517,9 +514,6 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Display segment duration</string>
|
<string>Display segment duration</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
|
|
|
@ -45,6 +45,11 @@ struct preferences default_prefs = {
|
||||||
.decopo2 = 1600,
|
.decopo2 = 1600,
|
||||||
.doo2breaks = false,
|
.doo2breaks = false,
|
||||||
.drop_stone_mode = false,
|
.drop_stone_mode = false,
|
||||||
|
.last_stop = false,
|
||||||
|
.verbatim_plan = false,
|
||||||
|
.display_runtime = true,
|
||||||
|
.display_duration = true,
|
||||||
|
.display_transitions = true,
|
||||||
.bottomsac = 20000,
|
.bottomsac = 20000,
|
||||||
.decosac = 17000,
|
.decosac = 17000,
|
||||||
.o2consumption = 720,
|
.o2consumption = 720,
|
||||||
|
|
Loading…
Add table
Reference in a new issue