plannerShared: add variables from plannerModel

the variables are set through set functions in DivePlannerPointsModel,
but read via getters from qPrefDivePlanner.

Variables:
bottomsac
decosac
problemsolvingtime
sacfactor

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
jan Iversen 2019-12-23 15:40:21 +01:00 committed by Dirk Hohndel
parent 53958a50c6
commit d8780fdd89
2 changed files with 64 additions and 0 deletions

View file

@ -170,3 +170,43 @@ void plannerShared::set_min_switch_duration(int value)
// NO conversion, this is done in the planner model.
DivePlannerPointsModel::instance()->setMinSwitchDuration(value);
}
double plannerShared::bottomsac()
{
return qPrefDivePlanner::bottomsac() / 1000.0;
}
void plannerShared::set_bottomsac(double value)
{
// NO conversion, this is done in the planner model.
DivePlannerPointsModel::instance()->setBottomSac(value);
}
double plannerShared::decosac()
{
return qPrefDivePlanner::decosac() / 1000.0;
}
void plannerShared::set_decosac(double value)
{
// NO conversion, this is done in the planner model.
DivePlannerPointsModel::instance()->setDecoSac(value);
}
int plannerShared::problemsolvingtime()
{
return qPrefDivePlanner::problemsolvingtime();
}
void plannerShared::set_problemsolvingtime(int value)
{
// NO conversion, this is done in the planner model.
DivePlannerPointsModel::instance()->setProblemSolvingTime(value);
}
double plannerShared::sacfactor()
{
return qPrefDivePlanner::sacfactor() / 100.0;
}
void plannerShared::set_sacfactor(double value)
{
// NO conversion, this is done in the planner model.
DivePlannerPointsModel::instance()->setSacFactor(value);
}

View file

@ -38,6 +38,12 @@ class plannerShared: public QObject {
Q_PROPERTY(bool doo2breaks READ doo2breaks WRITE set_doo2breaks NOTIFY doo2breaksChanged);
Q_PROPERTY(int min_switch_duration READ min_switch_duration WRITE set_min_switch_duration NOTIFY min_switch_durationChanged);
// Gas data
Q_PROPERTY(double bottomsac READ bottomsac WRITE set_bottomsac NOTIFY bottomsacChanged);
Q_PROPERTY(double decosac READ decosac WRITE set_decosac NOTIFY decosacChanged);
Q_PROPERTY(int problemsolvingtime READ problemsolvingtime WRITE set_problemsolvingtime NOTIFY problemsolvingtimeChanged);
Q_PROPERTY(double sacfactor READ sacfactor WRITE set_sacfactor NOTIFY sacfactorChanged);
public:
static plannerShared *instance();
@ -62,6 +68,12 @@ public:
static bool doo2breaks();
static int min_switch_duration();
// Gas data
static double bottomsac();
static double decosac();
static int problemsolvingtime();
static double sacfactor();
public slots:
// Ascend/Descend data, converted to meter/feet depending on user selection
static void set_ascratelast6m(int value);
@ -84,6 +96,12 @@ public slots:
static void set_doo2breaks(bool value);
static void set_min_switch_duration(int value);
// Gas data
static void set_bottomsac(double value);
static void set_decosac(double value);
static void set_problemsolvingtime(int value);
static void set_sacfactor(double value);
signals:
// Ascend/Descend data, converted to meter/feet depending on user selection
void ascratelast6mChanged(int value);
@ -106,6 +124,12 @@ signals:
void doo2breaksChanged(bool value);
void min_switch_durationChanged(int value);
// Gas data
void bottomsacChanged(double value);
void decosacChanged(double value);
void problemsolvingtimeChanged(int value);
void sacfactorChanged(double value);
private:
plannerShared() {}
};