mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Settings update: Fix settings in PreferencesGraph class
Use the SettingsObjectWrapper. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
93c19b18a7
commit
906d62ac7a
1 changed files with 19 additions and 21 deletions
|
@ -1,7 +1,7 @@
|
||||||
#include "preferences_graph.h"
|
#include "preferences_graph.h"
|
||||||
#include "ui_preferences_graph.h"
|
#include "ui_preferences_graph.h"
|
||||||
#include "core/prefs-macros.h"
|
#include "core/prefs-macros.h"
|
||||||
|
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
@ -41,28 +41,26 @@ void PreferencesGraph::refreshSettings()
|
||||||
|
|
||||||
void PreferencesGraph::syncSettings()
|
void PreferencesGraph::syncSettings()
|
||||||
{
|
{
|
||||||
QSettings s;
|
auto general = SettingsObjectWrapper::instance()->general_settings;
|
||||||
|
general->setDefaultSetPoint(rint(ui->defaultSetpoint->value() * 1000.0));
|
||||||
|
general->setO2Consumption(rint(ui->psro2rate->value() *1000.0));
|
||||||
|
general->setPscrRatio(rint(1000.0 / ui->pscrfactor->value()));
|
||||||
|
|
||||||
s.beginGroup("GeneralSettings");
|
auto pp_gas = SettingsObjectWrapper::instance()->pp_gas;
|
||||||
s.setValue("defaultsetpoint", rint(ui->defaultSetpoint->value() * 1000.0));
|
pp_gas->setPheThreshold(ui->pheThreshold->value());
|
||||||
s.setValue("o2consumption", rint(ui->psro2rate->value() *1000.0));
|
pp_gas->setPo2Threshold(ui->po2Threshold->value());
|
||||||
s.setValue("pscr_ratio", rint(1000.0 / ui->pscrfactor->value()));
|
pp_gas->setPn2Threshold(ui->pn2Threshold->value());
|
||||||
s.endGroup();
|
|
||||||
|
|
||||||
s.beginGroup("TecDetails");
|
auto tech = SettingsObjectWrapper::instance()->techDetails;
|
||||||
SAVE_OR_REMOVE("phethreshold", default_prefs.pp_graphs.phe_threshold, ui->pheThreshold->value());
|
tech->setModp02(ui->maxpo2->value());
|
||||||
SAVE_OR_REMOVE("po2threshold", default_prefs.pp_graphs.po2_threshold, ui->po2Threshold->value());
|
tech->setRedceiling(ui->red_ceiling->isChecked());
|
||||||
SAVE_OR_REMOVE("pn2threshold", default_prefs.pp_graphs.pn2_threshold, ui->pn2Threshold->value());
|
tech->setGflow(ui->gflow->value());
|
||||||
SAVE_OR_REMOVE("modpO2", default_prefs.modpO2, ui->maxpo2->value());
|
tech->setGfhigh(ui->gfhigh->value());
|
||||||
SAVE_OR_REMOVE("redceiling", default_prefs.redceiling, ui->red_ceiling->isChecked());
|
tech->setGfLowAtMaxDepth(ui->gf_low_at_maxdepth->isChecked());
|
||||||
SAVE_OR_REMOVE("gflow", default_prefs.gflow, ui->gflow->value());
|
tech->setShowCCRSetpoint(ui->show_ccr_setpoint->isChecked());
|
||||||
SAVE_OR_REMOVE("gfhigh", default_prefs.gfhigh, ui->gfhigh->value());
|
tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked());
|
||||||
SAVE_OR_REMOVE("gf_low_at_maxdepth", default_prefs.gf_low_at_maxdepth, ui->gf_low_at_maxdepth->isChecked());
|
tech->setDisplayUnusedTanks(ui->display_unused_tanks->isChecked());
|
||||||
SAVE_OR_REMOVE("show_ccr_setpoint", default_prefs.show_ccr_setpoint, ui->show_ccr_setpoint->isChecked());
|
tech->setShowAverageDepth(ui->show_average_depth->isChecked());
|
||||||
SAVE_OR_REMOVE("show_ccr_sensors", default_prefs.show_ccr_sensors, ui->show_ccr_sensors->isChecked());
|
|
||||||
SAVE_OR_REMOVE("display_unused_tanks", default_prefs.display_unused_tanks, ui->display_unused_tanks->isChecked());
|
|
||||||
SAVE_OR_REMOVE("show_average_depth", default_prefs.show_average_depth, ui->show_average_depth->isChecked());
|
|
||||||
s.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""
|
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue