Index: sources/gui/qml/pages/MainStack.qml =================================================================== diff -u -r5687815256ae070a9a207107088e3f72dd464da0 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/gui/qml/pages/MainStack.qml (.../MainStack.qml) (revision 5687815256ae070a9a207107088e3f72dd464da0) +++ sources/gui/qml/pages/MainStack.qml (.../MainStack.qml) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -108,10 +108,7 @@ MainHome { id: _mainHome onStartTreatment : { page( _treatmentStack )} - onCreateTreatment : { vPreTreatmentAdjustmentInitTreatment.doInitiate() - if ( vSettings.noCANBus ) - vHDOperationMode.validateParametersChanged(true) - } + onCreateTreatment : { vPreTreatmentAdjustmentInitTreatment.doInitiate( )} onVisibleChanged: { if (visible) { _mainMenu.hidden = false // initially our landing screen is _initialModeScreen which should not have the Main menu. @@ -122,31 +119,14 @@ } } - Connections { target: vSettings - function onNoCANBusChanged ( vValue ) { - //// DEBUG: - // console.debug("vSettings.noCANBus" , vSettings .noCANBus , - // "vHDOperationMode.init" , vHDOperationMode .init , - // "vHDOperationMode.fault" , vHDOperationMode .fault , - // "vHDOperationMode.opMode" , vHDOperationMode .opMode ) - if ( vSettings.noCANBus ) { - page( _startupScreen , - vHDOperationMode.fault || // in fault mode - vHDOperationMode.init || // in initial post mode - vHDOperationMode.opMode === 0 // has not even been initialized , which most probably is the case. - ) - } - } - } - Connections { target: vHDOperationMode function onIsTreatmentChanged ( vValue ) { if( vValue ) _mainMenu.isTreatment() } function onIsManagerChanged ( vValue ) { if( vValue ) _mainMenu.isManager () } function onIsSettingsChanged ( vValue ) { if( vValue ) _mainMenu.isSettings () } function onFaultChanged ( vValue ) { page( _startupScreen , vValue )} function onServiceChanged ( vValue ) { page( _startupScreen , vValue )} - function onInitChanged ( vValue ) { page( _postModeScreen , vValue && ! vSettings.noCANBus ) + function onInitChanged ( vValue ) { page( _postModeScreen , vValue ) if( vValue ) vHDPOSTData.reset() // better to reset on vinit = true because the rest makes the screen animation to run } Index: sources/gui/qml/pages/settings/SettingsServicePassword.qml =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/gui/qml/pages/settings/SettingsServicePassword.qml (.../SettingsServicePassword.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/gui/qml/pages/settings/SettingsServicePassword.qml (.../SettingsServicePassword.qml) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -62,9 +62,6 @@ // in case of debugging that the HD is in service mode already check and call the gotoServiceMode if ( vHDOperationMode.service ) gotoServiceMode(true) - - // if NoCANBus is set don't wait for HD and go to service mode. - if ( vSettings.noCANBus ) gotoServiceMode(true) } function checkPassword() { Index: sources/model/settings/MSettings.cpp =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/model/settings/MSettings.cpp (.../MSettings.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/model/settings/MSettings.cpp (.../MSettings.cpp) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -142,6 +142,9 @@ } } +QString MSettings::systemLocale () { return value(Storage::Settings_Category_SettingsSystem, "Localization", "Locale" ).toString(); } +QString MSettings::systemLanguage () { return value(Storage::Settings_Category_SettingsSystem, "Localization", "Language" ).toString(); } + /********** The common helper functions **********/ /*! Index: sources/model/settings/MSettings.h =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/model/settings/MSettings.h (.../MSettings.h) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/model/settings/MSettings.h (.../MSettings.h) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -82,9 +82,12 @@ QVariantList values (const QString &vCategory, const QString &vGroup ); QVariant value (const QString &vCategory, const QString &vGroup , const QString &vKey); - void add (const QString &vCategory, const QString &vGroup, const QString &vKey, const QVariant &vValue, bool vEnableDuplicateKeys); + void add (const QString &vCategory, const QString &vGroup , const QString &vKey, const QVariant &vValue, bool vEnableDuplicateKeys); -// the utility static functions + QString systemLocale (); + QString systemLanguage (); + +// the utility functions private : QString _datetimeFormat = "MM/dd/yyyy HH:mm:ss"; private : QString _dateFormat = "MM/dd/yyyy"; private : QString _timeFormat = "HH:mm:ss"; Index: sources/storage/Settings.cpp =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/storage/Settings.cpp (.../Settings.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/storage/Settings.cpp (.../Settings.cpp) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -29,7 +29,7 @@ #include "Settings.h" -bool Settings::isValid(const QString &vSettingFile) +bool Settings::exists(const QString &vSettingFile) { int err = Settings::Settings_Error::eError_None; if (! QFileInfo::exists(vSettingFile)) { @@ -43,10 +43,12 @@ /*! * \brief Settings::fileName * \details returns the conf file by the settings information provided. + * \param vCategory - the settings file category + * \param vLocale - the settings file locale * \return QString configuration/settings file name */ -QString Settings::fileName(const QString &vCategory) { - return QString("%1%2.%3").arg(Storage::Settings_Path()).arg(vCategory).arg(_settingsExt); +QString Settings::fileName(const QString &vCategory, const QString &vLocale) { + return QString("%1%2%4.%3").arg(Storage::Settings_Path()).arg(vCategory).arg(_settingsExt).arg(vLocale.trimmed().isEmpty() ? "" : _settingsLocalSeparator + vLocale); } /*! @@ -56,151 +58,155 @@ */ int Settings::read() { - int err = Settings::Settings_Error::eError_None; - QStringList fileFilter = QStringList() << QString("*.%1").arg(_settingsExt); - QFileInfoList settingFiles = FileHandler::find (Storage::Settings_Path(), fileFilter); - QStringList settingFolders = FileHandler::subFolders(Storage::Settings_Path()); + int err = Settings::Settings_Error::eError_None; + QFileInfo mSettingFile; + QString mCategory; + for ( quint8 i = 0; i <= _categoryCount; i++ ) { + mCategory = category(static_cast(i)); + switch (i) { // NOTE: don't use default case + case eSettingsSystem : + case eMessagesUnhandled : + mSettingFile.setFile(fileName(mCategory, "")); + // FALLTHROUGH + break; + case eInstructions : + case eConfigurationsDataList : + case eAlarms : + case eEvents : + case eGenericConfirm : + mSettingFile.setFile(fileName(mCategory, _Settings.systemLocale())); + // FALLTHROUGH + break; + } - if ( ! settingFolders.count() ) { - err = Settings::Settings_Error::eError_No_SettingsFolder; - LOG_APPED_PO(errorMessage(err).arg(Storage::Settings_Path())); - return err; - } - - for ( QString &settingFolder : settingFolders ) { - QString folder = settingFolder.prepend(Storage::Settings_Path()); - settingFiles += FileHandler::find(folder, fileFilter); - } - - // DEBUG: - // settingFiles = - // { - // QFileInfo("/home/denali/Projects/application/resources/settings/Confirm/Confirm.conf"), - // QFileInfo("/home/denali/Projects/application/resources/settings/Alarms/Alarms.conf") - // }; - - if ( ! settingFiles.count() ) { - err = Settings::Settings_Error::eError_No_SettingsFile; - LOG_APPED_PO(errorMessage(err).arg(Storage::Settings_Path())); - return err; - } - - QList details; - for (const auto &settingFile: settingFiles) { - if (! isValid(settingFile.absoluteFilePath())) continue; - - QFile file(settingFile.absoluteFilePath()); + if (! exists(mSettingFile.absoluteFilePath())) continue; // error handling is done in exists(), so just continue. + QFile file(mSettingFile.absoluteFilePath()); if (! file.open(QIODevice::ReadOnly | QIODevice::Text)) { err = Settings::Settings_Error::eError_Read; LOG_APPED_PO(errorMessage(err).arg(Storage::Settings_Path())); return err; } Detail detail; - detail.content = file.readAll().trimmed(); + detail.content = file.readAll().trimmed(); if (detail.content.isEmpty()) { //TODO Do not error out for now, the list of the config files which can be empty or not needs to be defined. // err = Settings::Settings_Error::eError_Empty; - LOG_APPED_PO(errorMessage(Settings::Settings_Error::eError_Empty).arg(settingFile.fileName())); + LOG_APPED_PO(errorMessage(Settings::Settings_Error::eError_Empty).arg(mSettingFile.fileName())); continue; } - detail.location = settingFile.absolutePath() + "/"; - detail.category = QString(detail.location + settingFile.baseName()).remove(Storage::Settings_Path()); - details += detail; + detail.location = mSettingFile.absolutePath() + "/"; + detail.category = mCategory; + + if ( parse(detail) ) { + LOG_DEBUG( (QString("Configuration file '%1' successfully loaded").arg(mSettingFile.fileName())) ); + } + else { + LOG_DEBUG( (QString("Configuration file '%1' failed to load").arg(mSettingFile.fileName())) ); + } } + return err; +} - for (const auto &detail : details) { - bool enableDuplicateKey = false; - QString attribute = QString("%1%2").arg(_config_attribute_tag); - QString group = ""; - QStringList lines = detail.content.split('\n'); - for (QString line : lines) { - // ----- trim the line - line = line.trimmed(); +/*! + * \brief Settings::parse + * \details The function to parse the content of the conf file and fill in the Settings model. + * \param vDetail - the conf file detail has been read. + * \return bool - true on success. + */ +bool Settings::parse(const Detail &vDetail) { + bool enableDuplicateKey = false; + QString attribute = QString("%1%2").arg(_config_attribute_tag); + QString group = ""; + QStringList lines = vDetail.content.split('\n'); + for (QString line : lines) { + // ----- trim the line + line = line.trimmed(); - // ----- ignore empty lines - if ( line.isEmpty() ) continue; + // ----- ignore empty lines + if ( line.isEmpty() ) continue; - // ----- find comments - int commentPosition = line.indexOf('#'); + // ----- find comments + int commentPosition = line.indexOf('#'); - // ----- ignore comment line or find attributes - if ( commentPosition == 0 ) { + // ----- ignore comment line or find attributes + if ( commentPosition == 0 ) { - // ----- find the configuration file attribute - int attributeTagPosition = line.indexOf(_config_attribute_tag); - if ( attributeTagPosition == 0 ) { + // ----- find the configuration file attribute + int attributeTagPosition = line.indexOf(_config_attribute_tag); + if ( attributeTagPosition == 0 ) { - // ----- find the attribute : duplicate_key_... - if ( line == attribute.arg( _duplicate_key_on ) ) { enableDuplicateKey = true ;} - else if ( line == attribute.arg(_duplicate_key_off ) ) { enableDuplicateKey = false ;} + // ----- find the attribute : duplicate_key_... + if ( line == attribute.arg( _duplicate_key_on ) ) { enableDuplicateKey = true ;} + else if ( line == attribute.arg(_duplicate_key_off ) ) { enableDuplicateKey = false ;} - else { - LOG_APPED_PO(( "Unknown '" + line + "' attribute in %1").arg(detail.category)); - } + else { + LOG_APPED_PO(( "Unknown '" + line + "' attribute in %1").arg(vDetail.category)); + return false; } - - // next line - continue; } - // ----- remove inline comment - if ( commentPosition > 0 ) line.truncate(commentPosition); - line = line.trimmed(); + // next line + continue; + } - // ----- find group - if (line.startsWith("[") && line.endsWith("]")) { - line.replace("[","").replace("]", ""); - group = line; + // ----- remove inline comment + if ( commentPosition > 0 ) line.truncate(commentPosition); + line = line.trimmed(); + + // ----- find group + if (line.startsWith("[") && line.endsWith("]")) { + line.replace("[","").replace("]", ""); + group = line; + } + else { + if ( group.isEmpty() ) { + continue; } else { - if ( group.isEmpty() ) { - continue; - } - else { - if ( ! line.isEmpty() ) { - QString key = ""; - QString value = ""; - if ( line.contains('=') ) { - QStringList keyValue = line.split('='); - key = keyValue[0].trimmed().replace("\\n","\n"); - value = keyValue[1].trimmed().replace("\\n","\n"); - } - else { - key = line; - } - _Settings.add(detail.category, group, key, QVariant(value), enableDuplicateKey); - // DEBUG: qDebug() << group << key << value << location << category; + if ( ! line.isEmpty() ) { + QString key = ""; + QString value = ""; + if ( line.contains('=') ) { + QStringList keyValue = line.split('='); + key = keyValue[0].trimmed().replace("\\n","\n"); + value = keyValue[1].trimmed().replace("\\n","\n"); } + else { + key = line; + } + _Settings.add(vDetail.category, group, key, QVariant(value), enableDuplicateKey); + // DEBUG: qDebug() << group << key << value << location << category; } } - // DEBUG: qDebug() << group << line; } + // DEBUG: qDebug() << group << line; } - return err; + return true; } /*! * \brief Settings::save * \details Writes the setting in the configuration files * \return */ -int Settings::save(const QString &vCategory, const QString &vGroup, const QString &vKey, const QString &vValue) +int Settings::saveSystem(const QString &vGroup, const QString &vKey, const QString &vValue) { // qDebug() << vCategory // << vGroup // << vKey // << vValue; - QString mFileName = fileName(vCategory); + QString mCategory = Storage::Settings_Category_SettingsSystem; + QString mFileName = fileName(mCategory, ""); QString mContent; int err = Settings_Error::eError_None; // -------------------------------------------------------------------------------------------------------------- //Note: the configuration files which can be saved, are like settings and should not have duplicate values. // as an example the Alarm volume can't have two separate duplicate entry in the settings. // -------------------------------------------------------------------------------------------------------------- - _Settings.add(vCategory, vGroup, vKey, vValue, false); + _Settings.add(mCategory, vGroup, vKey, vValue, false); QString mPath = QFileInfo(mFileName).absolutePath(); if ( mPath.trimmed().isEmpty() ) { err = Settings_Error::eError_PathEmpty; @@ -214,10 +220,10 @@ return err; } - for ( const auto &group : _Settings.groups(vCategory) ) { + for ( const auto &group : _Settings.groups(mCategory) ) { mContent += QString("\n[%1]\n").arg(group); - for ( const auto &key : _Settings.keys(vCategory, group) ) { - mContent += QString("%1 = %2\n").arg(key).arg(_Settings.value(vCategory, group, key).toString()); + for ( const auto &key : _Settings.keys(mCategory, group) ) { + mContent += QString("%1 = %2\n").arg(key).arg(_Settings.value(mCategory, group, key).toString()); } } Index: sources/storage/Settings.h =================================================================== diff -u -rd866ef66b21f114f07cb80a07860900cd43daff0 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/storage/Settings.h (.../Settings.h) (revision d866ef66b21f114f07cb80a07860900cd43daff0) +++ sources/storage/Settings.h (.../Settings.h) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -45,6 +45,8 @@ const char *_duplicate_key_off = "duplicate_key_off"; const char *_settingsExt = "conf"; const char *_settingsFormat = "%1/%2.%3"; + const char *_settingsLocalSeparator = "_"; + struct Detail { QString category; QString location; @@ -100,22 +102,25 @@ return QString(literal.arg(vPath).arg(vFile).arg(_settingsExt)); } - bool isValid(const QString &vSettingFile); + bool exists(const QString &vSettingFile); - QString fileName(const QString &vCategory); + QString fileName(const QString &vCategory, const QString &vLocale); + bool parse(const Detail &vDetail); + public: Settings() {} enum Category_Enum { + eSettingsSystem = 0, // has to be the first one to read the other configs according to the locale set in the Systems.conf eInstructions , eConfigurationsDataList , // TODO: the category for this conf is not used. may need to be merged into the Settings, but since it is list, It needs a little more thought. eAlarms , eEvents , eMessagesUnhandled , - eSettingsSystem , eGenericConfirm , - }; + }; // IMPORTANT: not having a eCount in the enum is intentional. to make sure in switch no enum is missed when not using the default. + const int _categoryCount = eGenericConfirm; enum Key_Enum { eKeyTitle , @@ -131,25 +136,25 @@ }; int read (); - int save (const QString &vCategory, const QString &vGroup, const QString &vKey, const QString &vValue); + int saveSystem (const QString &vGroup, const QString &vKey, const QString &vValue); int configurationsMove (QString *vMessage = nullptr, bool vIsUpdate = false); int configurationsPOST (Location_Enum vLoc = Location_Enum::eSecured) { Q_UNUSED(vLoc); return true; } static QString category(Category_Enum vCategory) { - switch (vCategory) { // NOTE: don't use default + switch (vCategory) { // NOTE: don't use default case + case eSettingsSystem : return Storage::Settings_Category_SettingsSystem ; case eInstructions : return Storage::Settings_Category_Instructions ; case eConfigurationsDataList : return Storage::Settings_Category_ConfigurationsDataList ; case eAlarms : return Storage::Settings_Category_Alarms ; case eEvents : return Storage::Settings_Category_Events ; case eMessagesUnhandled : return Storage::Settings_Category_MessagesUnhandled ; - case eSettingsSystem : return Storage::Settings_Category_SettingsSystem ; case eGenericConfirm : return Storage::Settings_Category_GenericConfirm ; } return ""; } static QString key(Key_Enum vKey) { - switch (vKey) { // NOTE: don't use default + switch (vKey) { // NOTE: don't use default case case eKeyTitle : return Storage::Settings_Key_Title ; case eKeyMessage : return Storage::Settings_Key_Message ; case eKeyListTitle : return Storage::Settings_Key_ListTitle ; @@ -161,18 +166,18 @@ //Note: this funtion is specific to the settings and should not use the StorageGlobals function. static QString location(Location_Enum vLoc) { - switch (vLoc) { // NOTE: don't use default + switch (vLoc) { // NOTE: don't use default case case eInit : return Storage::Settings_Path_Init; case eSecured : return Storage::Settings_Path_Name; } return Storage::Settings_Path_Name; } + static bool isCategorySettingsSystem (const QString &vCategory) { return vCategory == category( eSettingsSystem ); } static bool isCategoryInstructions (const QString &vCategory) { return vCategory == category( eInstructions ); } static bool isCategoryConfigurationsDataList (const QString &vCategory) { return vCategory == category( eConfigurationsDataList ); } static bool isCategoryAlarms (const QString &vCategory) { return vCategory == category( eAlarms ); } static bool isCategoryMessagesUnhandled (const QString &vCategory) { return vCategory == category( eMessagesUnhandled ); } - static bool isCategorySettingsSystem (const QString &vCategory) { return vCategory == category( eSettingsSystem ); } static bool isCategoryConfirm (const QString &vCategory) { return vCategory == category( eGenericConfirm ); } static bool isKeyTitle (const QString &vKey ) { return vKey == key ( eKeyTitle ); } static bool isKeyMessage (const QString &vKey ) { return vKey == key ( eKeyMessage ); } Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -rf724589acaa51725f5e5f8a746404d01804efbcf -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision f724589acaa51725f5e5f8a746404d01804efbcf) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -99,7 +99,6 @@ const char *Settings_Category_Events = "Alarms/Events" ; const char *Settings_Category_MessagesUnhandled = "Messages/Unhandled" ; const char *Settings_Category_SettingsSystem = "Settings/System" ; - const char *Settings_Category_NoCANBus = "Development/NoCANBus" ; const char *Settings_Category_GenericConfirm = "Confirm/Confirm" ; const char *Settings_Key_Title = "Title" ; const char *Settings_Key_Message = "Message" ; Index: sources/storage/StorageGlobals.h =================================================================== diff -u -rf724589acaa51725f5e5f8a746404d01804efbcf -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision f724589acaa51725f5e5f8a746404d01804efbcf) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -62,7 +62,6 @@ extern const char *Settings_Category_Events ; extern const char *Settings_Category_MessagesUnhandled ; extern const char *Settings_Category_SettingsSystem ; - extern const char *Settings_Category_NoCANBus ; extern const char *Settings_Category_GenericConfirm ; // Settings - Keys extern const char *Settings_Key_Title ; Index: sources/view/settings/VLocalization.cpp =================================================================== diff -u -rd866ef66b21f114f07cb80a07860900cd43daff0 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/view/settings/VLocalization.cpp (.../VLocalization.cpp) (revision d866ef66b21f114f07cb80a07860900cd43daff0) +++ sources/view/settings/VLocalization.cpp (.../VLocalization.cpp) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -37,15 +37,14 @@ { Storage::Settings settings; - QString mCategory = Storage::Settings_Category_SettingsSystem; QString mLocale = ""; QString mLanguage = ""; mLocale = _localeMap.value(vLanguageIndex); - if ( settings.save (mCategory, "Localization", "Locale", mLocale ) ) goto lErr; + if ( settings.saveSystem("Localization", "Locale", mLocale ) ) goto lErr; mLanguage = _languageMap.value(vLanguageIndex); - if ( settings.save(mCategory, "Localization", "Language", mLanguage ) ) goto lErr; + if ( settings.saveSystem("Localization", "Language", mLanguage ) ) goto lErr; // FIXME: Notify UI with a message for success Index: sources/view/settings/VSettings.cpp =================================================================== diff -u -r5687815256ae070a9a207107088e3f72dd464da0 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/view/settings/VSettings.cpp (.../VSettings.cpp) (revision 5687815256ae070a9a207107088e3f72dd464da0) +++ sources/view/settings/VSettings.cpp (.../VSettings.cpp) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -40,15 +40,14 @@ PROPERTY_POST_CONNECTION(VSettings, servicePass ); PROPERTY_POST_CONNECTION(VSettings, alarmVolume ); PROPERTY_POST_CONNECTION(VSettings, roWaterMode ); - PROPERTY_POST_CONNECTION(VSettings, noCANBus ); init = true; } void VSettings::servicePass_post(const QString &vservicePass) { //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. Storage::Settings settings; - if ( settings.save(servicePassCategory(), servicePassGroup(), servicePassKey(), vservicePass) != 0 ) { + if ( settings.saveSystem(servicePassGroup(), servicePassKey(), vservicePass) != 0 ) { servicePass(""); // FIXME: Notify UI with a message } @@ -57,7 +56,7 @@ void VSettings::roWaterMode_post(const bool &vroWaterMode_post) { //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. Storage::Settings settings; - if ( settings.save(roWaterModeCategory(), roWaterModeGroup(), roWaterModeKey(), QString::number(vroWaterMode_post)) != 0 ) { + if ( settings.saveSystem(roWaterModeGroup(), roWaterModeKey(), QString::number(vroWaterMode_post)) != 0 ) { roWaterMode(false); // FIXME: Notify UI with a message } @@ -66,15 +65,9 @@ void VSettings::alarmVolume_post(const quint8 &valarmVolume) { //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. Storage::Settings settings; - settings.save(alarmVolumeCategory(), alarmVolumeGroup(), alarmVolumeKey(), QString::number(valarmVolume)); + settings.saveSystem(alarmVolumeGroup(), alarmVolumeKey(), QString::number(valarmVolume)); } -void VSettings::noCANBus_post(const bool &vnoCANBus) { - //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. - Storage::Settings settings; - settings.save(noCANBusCategory(), noCANBusGroup(), noCANBusKey(), QString::number(vnoCANBus)); -} - void VSettings::onActionReceive(const SettingsData &) { // TODO: this function needs to be moved to the controller, to execute in settings thread not the main thread. @@ -112,14 +105,6 @@ keyValue[key] = mAlarmVolume ; alarmVolume ( mAlarmVolume); } - else if ( isnoCANBus (category, group, key) ) { - bool mNoCANBus; - mNoCANBus = _Settings.value(category, group, key).toBool (); // returns 0/false if fails, so no error checking needed. - keyValue[key] = mNoCANBus ; - noCANBus ( mNoCANBus); - if (_noCANBus ) - LOG_APPED_UI(QString("System is working on NoCANBus set")); - } else { keyValue[key] = _Settings.value(category, group, key); } @@ -136,9 +121,8 @@ servicePass ( _servicePass ); alarmVolume ( _alarmVolume ); roWaterMode ( _roWaterMode ); - // noCANBus ( _noCANBus ); // This line has been put here to remind developers that it is intentionally removed, to not to add a default value. - //DEBUG qDebug() << servicePass() << roWaterMode() << alarmVolume() << noCANBus(); + //DEBUG qDebug() << servicePass() << roWaterMode() << alarmVolume(); adjustment(true); initConnectionsSettings(); Index: sources/view/settings/VSettings.h =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -ra75bc5b80ad4ebde50f028b550cd534e589bd059 --- sources/view/settings/VSettings.h (.../VSettings.h) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/view/settings/VSettings.h (.../VSettings.h) (revision a75bc5b80ad4ebde50f028b550cd534e589bd059) @@ -68,7 +68,6 @@ SETTINGS(QString , servicePass , "" , Storage::Settings_Category_SettingsSystem , "Service" , "Password" ) SETTINGS(quint8 , alarmVolume , 5 , Storage::Settings_Category_SettingsSystem , "Alarm" , "Volume" ) SETTINGS(bool , roWaterMode , false , Storage::Settings_Category_SettingsSystem , "RoWaterMode" , "RoWaterMode" ) - SETTINGS(bool , noCANBus , false , Storage::Settings_Category_NoCANBus , "Navigation" , "Create Treatment To Patient ID" ) TRIGGER (bool , encryptionPass, false )