diff options
author | jan Iversen <jani@apache.org> | 2018-08-12 21:58:25 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-14 09:09:06 -0700 |
commit | 691025fa2440d76e1b208a3ecd280a4aec646890 (patch) | |
tree | 6fb9cdbf743c6e6abb95c0f138530ca0e3d0cd09 | |
parent | 4a7864444ba5c90e4113e704a593d0fc4e6207b8 (diff) | |
download | subsurface-691025fa2440d76e1b208a3ecd280a4aec646890.tar.gz |
core: activate qPrefGeneral
remove General from SettingsObjectWrapper and reference qPrefGeneral
update files using SettingsObjectWrapper/General to use qPrefGeneral
this activated qPrefGeneral and removed the similar class from
SettingsObjectWrapper.
Signed-off-by: Jan Iversen <jani@apache.org>
-rw-r--r-- | core/settings/qPref.cpp | 1 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 257 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.h | 61 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.cpp | 20 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_graph.cpp | 10 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 12 | ||||
-rw-r--r-- | subsurface-helper.cpp | 1 | ||||
-rw-r--r-- | tests/testpreferences.cpp | 52 |
8 files changed, 53 insertions, 361 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp index 0649cddc8..36ec4d6c3 100644 --- a/core/settings/qPref.cpp +++ b/core/settings/qPref.cpp @@ -20,6 +20,7 @@ void qPref::loadSync(bool doSync) qPrefDiveComputer::instance()->loadSync(doSync); qPrefDivePlanner::instance()->loadSync(doSync); // qPrefFaceook does not use disk. + qPrefGeneral::instance()->loadSync(doSync); qPrefGeocoding::instance()->loadSync(doSync); qPrefLanguage::instance()->loadSync(doSync); qPrefLocationService::instance()->loadSync(doSync); diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index d1a8ba27e..1f29e692a 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -9,208 +9,6 @@ #include "core/prefs-macros.h" -GeneralSettingsObjectWrapper::GeneralSettingsObjectWrapper(QObject *parent) : - QObject(parent) -{ -} - -QString GeneralSettingsObjectWrapper::defaultFilename() const -{ - return prefs.default_filename; -} - -QString GeneralSettingsObjectWrapper::defaultCylinder() const -{ - return prefs.default_cylinder; -} - -short GeneralSettingsObjectWrapper::defaultFileBehavior() const -{ - return prefs.default_file_behavior; -} - -bool GeneralSettingsObjectWrapper::useDefaultFile() const -{ - return prefs.use_default_file; -} - -int GeneralSettingsObjectWrapper::defaultSetPoint() const -{ - return prefs.defaultsetpoint; -} - -int GeneralSettingsObjectWrapper::o2Consumption() const -{ - return prefs.o2consumption; -} - -int GeneralSettingsObjectWrapper::pscrRatio() const -{ - return prefs.pscr_ratio; -} - -bool GeneralSettingsObjectWrapper::autoRecalculateThumbnails() const -{ - return prefs.auto_recalculate_thumbnails; -} - -bool GeneralSettingsObjectWrapper::extractVideoThumbnails() const -{ - return prefs.extract_video_thumbnails; -} - -int GeneralSettingsObjectWrapper::extractVideoThumbnailsPosition() const -{ - return prefs.extract_video_thumbnails_position; -} - -QString GeneralSettingsObjectWrapper::ffmpegExecutable() const -{ - return prefs.ffmpeg_executable; -} - -void GeneralSettingsObjectWrapper::setDefaultFilename(const QString& value) -{ - if (value == prefs.default_filename) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("default_filename", value); - free((void *)prefs.default_filename); - prefs.default_filename = copy_qstring(value); - emit defaultFilenameChanged(value); -} - -void GeneralSettingsObjectWrapper::setDefaultCylinder(const QString& value) -{ - if (value == prefs.default_cylinder) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("default_cylinder", value); - free((void *)prefs.default_cylinder); - prefs.default_cylinder = copy_qstring(value); - emit defaultCylinderChanged(value); -} - -void GeneralSettingsObjectWrapper::setDefaultFileBehavior(short value) -{ - if (value == prefs.default_file_behavior && prefs.default_file_behavior != UNDEFINED_DEFAULT_FILE) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("default_file_behavior", value); - - prefs.default_file_behavior = value; - if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE) { - // undefined, so check if there's a filename set and - // use that, otherwise go with no default file - if (QString(prefs.default_filename).isEmpty()) - prefs.default_file_behavior = NO_DEFAULT_FILE; - else - prefs.default_file_behavior = LOCAL_DEFAULT_FILE; - } - emit defaultFileBehaviorChanged(value); -} - -void GeneralSettingsObjectWrapper::setUseDefaultFile(bool value) -{ - if (value == prefs.use_default_file) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("use_default_file", value); - prefs.use_default_file = value; - emit useDefaultFileChanged(value); -} - -void GeneralSettingsObjectWrapper::setDefaultSetPoint(int value) -{ - if (value == prefs.defaultsetpoint) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("defaultsetpoint", value); - prefs.defaultsetpoint = value; - emit defaultSetPointChanged(value); -} - -void GeneralSettingsObjectWrapper::setO2Consumption(int value) -{ - if (value == prefs.o2consumption) - return; - QSettings s; - s.beginGroup(group); - s.setValue("o2consumption", value); - prefs.o2consumption = value; - emit o2ConsumptionChanged(value); -} - -void GeneralSettingsObjectWrapper::setPscrRatio(int value) -{ - if (value == prefs.pscr_ratio) - return; - QSettings s; - s.beginGroup(group); - s.setValue("pscr_ratio", value); - prefs.pscr_ratio = value; - emit pscrRatioChanged(value); -} - -void GeneralSettingsObjectWrapper::setAutoRecalculateThumbnails(bool value) -{ - if (value == prefs.auto_recalculate_thumbnails) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("auto_recalculate_thumbnails", value); - prefs.auto_recalculate_thumbnails = value; - emit autoRecalculateThumbnailsChanged(value); -} - -void GeneralSettingsObjectWrapper::setExtractVideoThumbnails(bool value) -{ - if (value == prefs.extract_video_thumbnails) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("extract_video_thumbnails", value); - prefs.extract_video_thumbnails = value; - emit extractVideoThumbnailsChanged(value); -} - -void GeneralSettingsObjectWrapper::setExtractVideoThumbnailsPosition(int value) -{ - if (value == prefs.extract_video_thumbnails_position) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("extract_video_thumbnails_position", value); - prefs.extract_video_thumbnails_position = value; - emit extractVideoThumbnailsPositionChanged(value); -} - -void GeneralSettingsObjectWrapper::setFfmpegExecutable(const QString &value) -{ - if (value == prefs.ffmpeg_executable) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("ffmpeg_executable", value); - free((void *)prefs.ffmpeg_executable); - prefs.ffmpeg_executable = copy_qstring(value); - emit ffmpegExecutableChanged(value); -} - SettingsObjectWrapper::SettingsObjectWrapper(QObject* parent): QObject(parent), techDetails(new qPrefTechnicalDetails(this)), @@ -221,7 +19,7 @@ QObject(parent), cloud_storage(new qPrefCloudStorage(this)), planner_settings(new qPrefDivePlanner(this)), unit_settings(new qPrefUnits(this)), - general_settings(new GeneralSettingsObjectWrapper(this)), + general_settings(new qPrefGeneral(this)), display_settings(new qPrefDisplay(this)), language_settings(new qPrefLanguage(this)), animation_settings(new qPrefAnimations(this)), @@ -240,58 +38,7 @@ void SettingsObjectWrapper::load() qPrefUnits::instance()->load(); qPrefPartialPressureGas::instance()->load(); - - s.beginGroup("TecDetails"); - GET_BOOL("mod", mod); - GET_DOUBLE("modpO2", modpO2); - GET_BOOL("ead", ead); - GET_BOOL("redceiling", redceiling); - GET_BOOL("dcceiling", dcceiling); - GET_BOOL("calcceiling", calcceiling); - GET_BOOL("calcceiling3m", calcceiling3m); - GET_BOOL("calcndltts", calcndltts); - GET_BOOL("calcalltissues", calcalltissues); - GET_BOOL("hrgraph", hrgraph); - GET_BOOL("tankbar", tankbar); - GET_BOOL("RulerBar", rulergraph); - GET_BOOL("percentagegraph", percentagegraph); - GET_INT("gflow", gflow); - GET_INT("gfhigh", gfhigh); - GET_INT("vpmb_conservatism", vpmb_conservatism); - GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth); - GET_BOOL("show_ccr_setpoint",show_ccr_setpoint); - GET_BOOL("show_ccr_sensors",show_ccr_sensors); - GET_BOOL("show_scr_ocpo2",show_scr_ocpo2); - GET_BOOL("zoomed_plot", zoomed_plot); - set_gf(prefs.gflow, prefs.gfhigh); - set_vpmb_conservatism(prefs.vpmb_conservatism); - GET_BOOL("show_sac", show_sac); - GET_BOOL("display_unused_tanks", display_unused_tanks); - GET_BOOL("show_average_depth", show_average_depth); - GET_BOOL("show_icd", show_icd); - GET_BOOL("show_pictures_in_profile", show_pictures_in_profile); - prefs.display_deco_mode = (deco_mode) s.value("display_deco_mode").toInt(); - s.endGroup(); - - s.beginGroup("GeneralSettings"); - GET_TXT("default_filename", default_filename); - GET_INT("default_file_behavior", default_file_behavior); - if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE) { - // undefined, so check if there's a filename set and - // use that, otherwise go with no default file - if (QString(prefs.default_filename).isEmpty()) - prefs.default_file_behavior = NO_DEFAULT_FILE; - else - prefs.default_file_behavior = LOCAL_DEFAULT_FILE; - } - GET_TXT("default_cylinder", default_cylinder); - GET_BOOL("use_default_file", use_default_file); - GET_INT("defaultsetpoint", defaultsetpoint); - GET_INT("o2consumption", o2consumption); - GET_INT("pscr_ratio", pscr_ratio); - GET_BOOL("auto_recalculate_thumbnails", auto_recalculate_thumbnails); - s.endGroup(); - + qPrefGeneral::instance()->load(); qPrefAnimations::instance()->load(); qPrefCloudStorage::instance()->load(); qPrefDisplay::instance()->load(); diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index 22429f9db..00f2b3626 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -13,63 +13,6 @@ * and QWidget frontends. This class will be huge, since * I need tons of properties, one for each option. */ -class GeneralSettingsObjectWrapper : public QObject { - Q_OBJECT - Q_PROPERTY(QString default_filename READ defaultFilename WRITE setDefaultFilename NOTIFY defaultFilenameChanged) - Q_PROPERTY(QString default_cylinder READ defaultCylinder WRITE setDefaultCylinder NOTIFY defaultCylinderChanged) - Q_PROPERTY(short default_file_behavior READ defaultFileBehavior WRITE setDefaultFileBehavior NOTIFY defaultFileBehaviorChanged) - Q_PROPERTY(bool use_default_file READ useDefaultFile WRITE setUseDefaultFile NOTIFY useDefaultFileChanged) - Q_PROPERTY(int defaultsetpoint READ defaultSetPoint WRITE setDefaultSetPoint NOTIFY defaultSetPointChanged) - Q_PROPERTY(int o2consumption READ o2Consumption WRITE setO2Consumption NOTIFY o2ConsumptionChanged) - Q_PROPERTY(int pscr_ratio READ pscrRatio WRITE setPscrRatio NOTIFY pscrRatioChanged) - Q_PROPERTY(bool auto_recalculate_thumbnails READ autoRecalculateThumbnails WRITE setAutoRecalculateThumbnails NOTIFY autoRecalculateThumbnailsChanged) - Q_PROPERTY(bool extract_video_thumbnails READ extractVideoThumbnails WRITE setExtractVideoThumbnails NOTIFY extractVideoThumbnailsChanged) - Q_PROPERTY(int extract_video_thumbnails_position READ extractVideoThumbnailsPosition WRITE setExtractVideoThumbnailsPosition NOTIFY extractVideoThumbnailsPositionChanged) - Q_PROPERTY(QString ffmpeg_executable READ ffmpegExecutable WRITE setFfmpegExecutable NOTIFY ffmpegExecutableChanged) - -public: - GeneralSettingsObjectWrapper(QObject *parent); - QString defaultFilename() const; - QString defaultCylinder() const; - short defaultFileBehavior() const; - bool useDefaultFile() const; - int defaultSetPoint() const; - int o2Consumption() const; - int pscrRatio() const; - bool autoRecalculateThumbnails() const; - bool extractVideoThumbnails() const; - int extractVideoThumbnailsPosition() const; - QString ffmpegExecutable() const; - -public slots: - void setDefaultFilename (const QString& value); - void setDefaultCylinder (const QString& value); - void setDefaultFileBehavior (short value); - void setUseDefaultFile (bool value); - void setDefaultSetPoint (int value); - void setO2Consumption (int value); - void setPscrRatio (int value); - void setAutoRecalculateThumbnails (bool value); - void setExtractVideoThumbnails (bool value); - void setExtractVideoThumbnailsPosition (int value); - void setFfmpegExecutable (const QString &value); - -signals: - void defaultFilenameChanged(const QString& value); - void defaultCylinderChanged(const QString& value); - void defaultFileBehaviorChanged(short value); - void useDefaultFileChanged(bool value); - void defaultSetPointChanged(int value); - void o2ConsumptionChanged(int value); - void pscrRatioChanged(int value); - void autoRecalculateThumbnailsChanged(int value); - void extractVideoThumbnailsChanged(bool value); - void extractVideoThumbnailsPositionChanged(int value); - void ffmpegExecutableChanged(const QString &value); -private: - const QString group = QStringLiteral("GeneralSettings"); -}; - class SettingsObjectWrapper : public QObject { Q_OBJECT @@ -81,7 +24,7 @@ class SettingsObjectWrapper : public QObject { Q_PROPERTY(qPrefCloudStorage* cloud_storage MEMBER cloud_storage CONSTANT) Q_PROPERTY(qPrefDivePlanner* planner MEMBER planner_settings CONSTANT) Q_PROPERTY(qPrefUnits* units MEMBER unit_settings CONSTANT) - Q_PROPERTY(GeneralSettingsObjectWrapper* general MEMBER general_settings CONSTANT) + Q_PROPERTY(qPrefGeneral* general MEMBER general_settings CONSTANT) Q_PROPERTY(qPrefDisplay* display MEMBER display_settings CONSTANT) Q_PROPERTY(qPrefLanguage* language MEMBER language_settings CONSTANT) Q_PROPERTY(qPrefAnimations* animation MEMBER animation_settings CONSTANT) @@ -100,7 +43,7 @@ public: qPrefCloudStorage *cloud_storage; qPrefDivePlanner *planner_settings; qPrefUnits *unit_settings; - GeneralSettingsObjectWrapper *general_settings; + qPrefGeneral *general_settings; qPrefDisplay *display_settings; qPrefLanguage *language_settings; qPrefAnimations *animation_settings; diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp index 4d8aef610..748817e02 100644 --- a/desktop-widgets/preferences/preferences_defaults.cpp +++ b/desktop-widgets/preferences/preferences_defaults.cpp @@ -101,19 +101,19 @@ void PreferencesDefaults::refreshSettings() void PreferencesDefaults::syncSettings() { - auto general = SettingsObjectWrapper::instance()->general_settings; - general->setDefaultFilename(ui->defaultfilename->text()); - general->setDefaultCylinder(ui->default_cylinder->currentText()); - general->setUseDefaultFile(ui->btnUseDefaultFile->isChecked()); + auto general = qPrefGeneral::instance(); + general->set_default_filename(ui->defaultfilename->text()); + general->set_default_cylinder(ui->default_cylinder->currentText()); + general->set_use_default_file(ui->btnUseDefaultFile->isChecked()); if (ui->noDefaultFile->isChecked()) - general->setDefaultFileBehavior(NO_DEFAULT_FILE); + general->set_default_file_behavior(NO_DEFAULT_FILE); else if (ui->localDefaultFile->isChecked()) - general->setDefaultFileBehavior(LOCAL_DEFAULT_FILE); + general->set_default_file_behavior(LOCAL_DEFAULT_FILE); else if (ui->cloudDefaultFile->isChecked()) - general->setDefaultFileBehavior(CLOUD_DEFAULT_FILE); - general->setExtractVideoThumbnails(ui->extractVideoThumbnails->isChecked()); - general->setExtractVideoThumbnailsPosition(ui->videoThumbnailPosition->value()); - general->setFfmpegExecutable(ui->ffmpegExecutable->text()); + general->set_default_file_behavior(CLOUD_DEFAULT_FILE); + general->set_extract_video_thumbnails(ui->extractVideoThumbnails->isChecked()); + general->set_extract_video_thumbnails_position(ui->videoThumbnailPosition->value()); + general->set_ffmpeg_executable(ui->ffmpegExecutable->text()); auto display = qPrefDisplay::instance(); display->set_divelist_font(ui->font->currentFont().toString()); diff --git a/desktop-widgets/preferences/preferences_graph.cpp b/desktop-widgets/preferences/preferences_graph.cpp index a25f818c7..cbb2b2c39 100644 --- a/desktop-widgets/preferences/preferences_graph.cpp +++ b/desktop-widgets/preferences/preferences_graph.cpp @@ -52,11 +52,11 @@ void PreferencesGraph::refreshSettings() void PreferencesGraph::syncSettings() { - auto general = SettingsObjectWrapper::instance()->general_settings; - general->setDefaultSetPoint(lrint(ui->defaultSetpoint->value() * 1000.0)); - general->setO2Consumption(lrint(ui->psro2rate->value() *1000.0)); - general->setPscrRatio(lrint(1000.0 / ui->pscrfactor->value())); - general->setAutoRecalculateThumbnails(ui->auto_recalculate_thumbnails->isChecked()); + auto general = qPrefGeneral::instance(); + general->set_defaultsetpoint(lrint(ui->defaultSetpoint->value() * 1000.0)); + general->set_o2consumption(lrint(ui->psro2rate->value() *1000.0)); + general->set_pscr_ratio(lrint(1000.0 / ui->pscrfactor->value())); + general->set_auto_recalculate_thumbnails(ui->auto_recalculate_thumbnails->isChecked()); auto pp_gas = qPrefPartialPressureGas::instance(); pp_gas->set_phe_threshold(ui->pheThreshold->value()); diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 0c06f37ad..c9d9dfefb 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1210,9 +1210,9 @@ void QMLManager::openNoCloudRepo() if (git == dummy_git_repository) { git_create_local_repo(filename); set_filename(filename); - auto s = SettingsObjectWrapper::instance()->general_settings; - s->setDefaultFilename(filename); - s->setDefaultFileBehavior(LOCAL_DEFAULT_FILE); + auto s = qPrefGeneral::instance(); + s->set_default_filename(filename); + s->set_default_file_behavior(LOCAL_DEFAULT_FILE); } openLocalThenRemote(filename); @@ -1226,9 +1226,9 @@ void QMLManager::saveChangesLocal() char *filename = NOCLOUD_LOCALSTORAGE; git_create_local_repo(filename); set_filename(filename); - auto s = SettingsObjectWrapper::instance()->general_settings; - s->setDefaultFilename(filename); - s->setDefaultFileBehavior(LOCAL_DEFAULT_FILE); + auto s = qPrefGeneral::instance(); + s->set_default_filename(filename); + s->set_default_file_behavior(LOCAL_DEFAULT_FILE); } } else if (!m_loadFromCloud) { // this seems silly, but you need a common ancestor in the repository in diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp index ea7a6f0c4..67cfcceb4 100644 --- a/subsurface-helper.cpp +++ b/subsurface-helper.cpp @@ -162,6 +162,7 @@ void register_qml_types() REGISTER_TYPE(qPrefDiveComputer, "SsrfDiveComputerPrefs"); REGISTER_TYPE(qPrefDivePlanner, "SsrfDivePlannerPrefs"); REGISTER_TYPE(qPrefFacebook, "SsrfFacebookPrefs"); + REGISTER_TYPE(qPrefGeneral, "SsrfGeneralPrefs"); REGISTER_TYPE(qPrefGeocoding, "SsrfGeocodingPrefs"); REGISTER_TYPE(qPrefLanguage, "SsrfLanguagePrefs"); REGISTER_TYPE(qPrefLocationService, "SsrfLocationServicePrefs"); diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 41e2950d8..8f0c12f24 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -28,37 +28,37 @@ void TestPreferences::testPreferences() general->setDefaultFilename("filename"); general->setDefaultCylinder("cylinder_2"); //TODOl: Change this to a enum. // This is 'undefined', it will need to figure out later between no_file or use_deault file. - general->setDefaultFileBehavior(0); - general->setDefaultSetPoint(0); - general->setO2Consumption(0); - general->setPscrRatio(0); - general->setUseDefaultFile(true); + general->set_default_file_behavior(LOCAL_DEFAULT_FILE); + general->set_defaultsetpoint(0); + general->set_o2consumption(0); + general->set_pscr_ratio(0); + general->set_use_default_file(true); - TEST(general->defaultFilename(), QStringLiteral("filename")); - TEST(general->defaultCylinder(), QStringLiteral("cylinder_2")); - TEST(general->defaultFileBehavior(), (short)LOCAL_DEFAULT_FILE); // since we have a default file, here it returns - TEST(general->defaultSetPoint(), 0); - TEST(general->o2Consumption(), 0); - TEST(general->pscrRatio(), 0); - TEST(general->useDefaultFile(), true); + TEST(general->default_filename(), QStringLiteral("filename")); + TEST(general->default_cylinder(), QStringLiteral("cylinder_2")); + TEST(general->default_file_behavior(), LOCAL_DEFAULT_FILE); // since we have a default file, here it returns + TEST(general->defaultsetpoint(), 0); + TEST(general->o2consumption(), 0); + TEST(general->pscr_ratio(), 0); + TEST(general->use_default_file(), true); - general->setDefaultFilename("no_file_name"); - general->setDefaultCylinder("cylinder_1"); + general->set_default_filename("no_file_name"); + general->set_default_cylinder("cylinder_1"); //TODOl: Change this to a enum. - general->setDefaultFileBehavior(CLOUD_DEFAULT_FILE); + general->set_default_file_behavior(CLOUD_DEFAULT_FILE); - general->setDefaultSetPoint(1); - general->setO2Consumption(1); - general->setPscrRatio(1); - general->setUseDefaultFile(false); + general->set_defaultsetpoint(1); + general->set_o2consumption(1); + general->set_pscr_ratio(1); + general->set_use_default_file(false); - TEST(general->defaultFilename(), QStringLiteral("no_file_name")); - TEST(general->defaultCylinder(), QStringLiteral("cylinder_1")); - TEST(general->defaultFileBehavior(), (short)CLOUD_DEFAULT_FILE); - TEST(general->defaultSetPoint(), 1); - TEST(general->o2Consumption(), 1); - TEST(general->pscrRatio(), 1); - TEST(general->useDefaultFile(), false); + TEST(general->default_filename(), QStringLiteral("no_file_name")); + TEST(general->default_cylinder(), QStringLiteral("cylinder_1")); + TEST(general->default_file_behavior(), CLOUD_DEFAULT_FILE); + TEST(general->defaultsetpoint(), 1); + TEST(general->o2consumption(), 1); + TEST(general->pscr_ratio(), 1); + TEST(general->use_default_file(), false); } QTEST_MAIN(TestPreferences) |