Index: sources/gui/qml/pages/settings/SettingsLocalization.qml =================================================================== diff -u -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 -rd866ef66b21f114f07cb80a07860900cd43daff0 --- sources/gui/qml/pages/settings/SettingsLocalization.qml (.../SettingsLocalization.qml) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) +++ sources/gui/qml/pages/settings/SettingsLocalization.qml (.../SettingsLocalization.qml) (revision d866ef66b21f114f07cb80a07860900cd43daff0) @@ -27,9 +27,8 @@ */ SettingsBase { id: _root itemIndex : SettingsStack.Localization + confirmVisible : true - confirmVisible : false - Row { id: _settingsRoInputRow anchors.centerIn: parent @@ -98,16 +97,28 @@ } } + onConfirmClicked : { + _confirmDialog.titleText = _root.title + _confirmDialog.open() + } + + Connections { target: _confirmDialog + function onAccepted() { + if ( _confirmDialog.titleText == _root.title ) { // use the title as the indication of what has been confirmed and if that is related to this function. + vLocalization.doAdjustment(_settingsLanguageCombo.currentIndex) + } + } + } + Connections { target: _settingsLanguageCombo + function onCurrentIndexChanged() { notificationText = "" console.log("\t" + _settingsLanguageCombo.currentIndex) } function onCurrentTextChanged() { console.log(_settingsLanguageCombo.currentText, ":" , _settingsLanguageCombo.displayText) -// vSettings.language = _settingsLanguageCombo.currentText - } } } Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 -rd866ef66b21f114f07cb80a07860900cd43daff0 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision d866ef66b21f114f07cb80a07860900cd43daff0) @@ -102,9 +102,9 @@ qsTr("DG Cleaning" ), // DGCleaning qsTr("DG Scheduling" ), // DGScheduling qsTr("Service" ), // servicePassword - qsTr("Set Date And Time" ), // SetDateTime + qsTr("Date and Time" ), // SetDateTime qsTr("Export Logs" ), // ExportLogs - qsTr("Set Language" ), // Localization + qsTr("Language" ), // Localization qsTr("Water Input Mode" ), // RoInput qsTr("Calibration" ), // Calibration qsTr("Device Configuration" ), // Device Configuration Index: sources/storage/Settings.h =================================================================== diff -u -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 -rd866ef66b21f114f07cb80a07860900cd43daff0 --- sources/storage/Settings.h (.../Settings.h) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) +++ sources/storage/Settings.h (.../Settings.h) (revision d866ef66b21f114f07cb80a07860900cd43daff0) @@ -104,8 +104,6 @@ QString fileName(const QString &vCategory); - void update(); - public: Settings() {} Index: sources/view/settings/VLocalization.cpp =================================================================== diff -u -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 -rd866ef66b21f114f07cb80a07860900cd43daff0 --- sources/view/settings/VLocalization.cpp (.../VLocalization.cpp) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) +++ sources/view/settings/VLocalization.cpp (.../VLocalization.cpp) (revision d866ef66b21f114f07cb80a07860900cd43daff0) @@ -16,6 +16,7 @@ // Project #include "GuiController.h" +#include "Settings.h" using namespace View; @@ -32,10 +33,28 @@ ACTION_VIEW_CONNECTION(SettingsData) } -void View::VLocalization::doAdjustment(quint8 ) +void View::VLocalization::doAdjustment(quint8 vLanguageIndex) { -// _data.mStatus = vStatus ? 1 : 0; -// emit didAdjustment(_data); + 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; + + mLanguage = _languageMap.value(vLanguageIndex); + if ( settings.save(mCategory, "Localization", "Language", mLanguage ) ) goto lErr; + + // FIXME: Notify UI with a message for success + + + return; + +lErr: + LOG_DEBUG("Unsuccessfull configuration value storage for Language"); + } /*! @@ -47,12 +66,17 @@ { QString mCategory = Storage::Settings_Category_SettingsSystem; QString mLanguage = ""; - bool ok = false; + mLanguage = _Settings.value(mCategory, "Localization", "Language").toString(); - if ( !ok ) - LOG_DEBUG("incorrect configuration value for Language"); + if ( mLanguage.isEmpty() ) goto lErr; + languageIndex(_languageMap.key(mLanguage)); + return; +lErr: + LOG_DEBUG("incorrect configuration value for Language"); + // FIXME: Notify UI with a message + } Index: sources/view/settings/VLocalization.h =================================================================== diff -u -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 -rd866ef66b21f114f07cb80a07860900cd43daff0 --- sources/view/settings/VLocalization.h (.../VLocalization.h) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) +++ sources/view/settings/VLocalization.h (.../VLocalization.h) (revision d866ef66b21f114f07cb80a07860900cd43daff0) @@ -42,6 +42,13 @@ {3, "French"} }; + QMap _localeMap { + {0, "en"}, + {1, "es"}, + {2, "de"}, + {3, "fr"} + }; + // The property adjustment_Triggered has to be always true // and to always trigger the change event to work as a notifier for GUI // has been manually tested that it works perfectly fine