mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: create qPrefDivePlanner from SettingsObjectWrapper
Update set/get functions to follow common name scheme: - get function have same name as in struct diveComputer - set function have set_<name> - signal function have <name>_changed one class one .h/.cpp is the C++ idiom. Having load/sync of each variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper handles it) secures the same storage name is used. Having the set/get/load/sync functions grouped together makes it easier to get an overview. REMARK: this commit only defines the class, it is not active in production Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
27b005b76d
commit
357510b9cd
6 changed files with 257 additions and 0 deletions
97
core/settings/qPrefDivePlanner.cpp
Normal file
97
core/settings/qPrefDivePlanner.cpp
Normal file
|
@ -0,0 +1,97 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "core/subsurface-string.h"
|
||||
#include "qPrefPrivate.h"
|
||||
#include "qPref.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
static const QString group = QStringLiteral("Planner");
|
||||
|
||||
qPrefDivePlanner::qPrefDivePlanner(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
qPrefDivePlanner *qPrefDivePlanner::instance()
|
||||
{
|
||||
static qPrefDivePlanner *self = new qPrefDivePlanner;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qPrefDivePlanner::loadSync(bool doSync)
|
||||
{
|
||||
disk_ascratelast6m(doSync);
|
||||
disk_ascratestops(doSync);
|
||||
disk_ascrate50(doSync);
|
||||
disk_ascrate75(doSync);
|
||||
disk_bestmixend(doSync);
|
||||
disk_bottompo2(doSync);
|
||||
disk_bottomsac(doSync);
|
||||
disk_decopo2(doSync);
|
||||
disk_decosac(doSync);
|
||||
disk_descrate(doSync);
|
||||
disk_display_duration(doSync);
|
||||
disk_display_runtime(doSync);
|
||||
disk_display_transitions(doSync);
|
||||
disk_display_variations(doSync);
|
||||
disk_doo2breaks(doSync);
|
||||
disk_drop_stone_mode(doSync);
|
||||
disk_last_stop(doSync);
|
||||
disk_min_switch_duration(doSync);
|
||||
disk_planner_deco_mode(doSync);
|
||||
disk_problemsolvingtime(doSync);
|
||||
disk_reserve_gas(doSync);
|
||||
disk_sacfactor(doSync);
|
||||
disk_safetystop(doSync);
|
||||
disk_switch_at_req_stop(doSync);
|
||||
disk_verbatim_plan(doSync);
|
||||
}
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/ascratelast6m", ascratelast6m);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/ascratestops", ascratestops);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/ascrate50", ascrate50);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/ascrate75", ascrate75);
|
||||
|
||||
HANDLE_PREFERENCE_STRUCT(DivePlanner, depth_t, "/bestmixend", bestmixend, mm);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/bottompo2", bottompo2);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/bottomsac", bottomsac);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/decopo2", decopo2);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/decosac", decosac);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/descrate", descrate);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/display_duration", display_duration);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/display_runtime", display_runtime);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/display_transitions", display_transitions);
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/display_variations", display_variations);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/doo2breaks", doo2breaks);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/drop_stone_mode", drop_stone_mode);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/last_stop", last_stop);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/min_switch_duration", min_switch_duration);
|
||||
|
||||
HANDLE_PREFERENCE_ENUM(DivePlanner, deco_mode, "/deco_mode", planner_deco_mode);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/problemsolvingtime", problemsolvingtime);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/reserve_gas", reserve_gas);
|
||||
|
||||
HANDLE_PREFERENCE_INT(DivePlanner, "/sacfactor", sacfactor);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/safetystop", safetystop);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/switch_at_req_stop", switch_at_req_stop);
|
||||
|
||||
HANDLE_PREFERENCE_BOOL(DivePlanner, "/verbatim_plan", verbatim_plan);
|
Loading…
Add table
Add a link
Reference in a new issue