Index: denali.pro =================================================================== diff -u -r193d7f4cf456dbcf0b4aee1edbacdeb8d5706967 -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 --- denali.pro (.../denali.pro) (revision 193d7f4cf456dbcf0b4aee1edbacdeb8d5706967) +++ denali.pro (.../denali.pro) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -282,6 +282,7 @@ \ # ---------- Views - Settings sources/view/settings/VDateTime.h \ sources/view/settings/VSettings.h \ + sources/view/settings/VLocalization.h \ sources/view/settings/VBluetooth.h \ sources/view/settings/VNetworkModel.h \ sources/view/settings/VAdjustmentVersions.h \ @@ -552,6 +553,7 @@ sources/view/hd/alarm/VAlarmActiveList.cpp \ \ # ---------- Views - Settings sources/view/settings/VSettings.cpp \ + sources/view/settings/VLocalization.cpp \ sources/view/settings/VDateTime.cpp \ sources/view/settings/VBluetooth.cpp \ sources/view/settings/VNetworkModel.cpp \ Index: denali.qrc =================================================================== diff -u -rb6f86ce89361e33d989f6a9d01eb94c344a6384f -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 --- denali.qrc (.../denali.qrc) (revision b6f86ce89361e33d989f6a9d01eb94c344a6384f) +++ denali.qrc (.../denali.qrc) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -26,6 +26,7 @@ sources/gui/qml/pages/settings/SettingsFactoryReset.qml sources/gui/qml/pages/settings/SettingsDecommission.qml sources/gui/qml/pages/settings/SettingsInstitutionalRecord.qml + sources/gui/qml/pages/settings/SettingsLocalization.qml sources/gui/qml/dialogs/ConfirmDialog.qml Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -r26433c42f2efa2cb18af95f523581c7eeeff049d -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 26433c42f2efa2cb18af95f523581c7eeeff049d) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -38,6 +38,7 @@ #include "VView.h" // Settings #include "VSettings.h" +#include "VLocalization.h" #include "VAlarmStatus.h" #include "VAlarmActiveList.h" #include "VAdjustmentVersions.h" Index: sources/gui/qml/main.qml =================================================================== diff -u -r5687815256ae070a9a207107088e3f72dd464da0 -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 --- sources/gui/qml/main.qml (.../main.qml) (revision 5687815256ae070a9a207107088e3f72dd464da0) +++ sources/gui/qml/main.qml (.../main.qml) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -37,6 +37,7 @@ // Settings import VSettings 0.1 +import VLocalization 0.1 import VAdjustmentVersions 0.1 import VAdjustmentServiceMode 0.1 import VAdjustmentServiceDates 0.1 @@ -139,6 +140,7 @@ VDevice { id: vDevice } VSettings { id: vSettings } + VLocalization { id: vLocalization } VAdjustmentVersions { id: vAdjustmentVersions } VAdjustmentServiceMode { id: vAdjustmentServiceMode } VAdjustmentServiceDates { id: vAdjustmentServiceDates } Index: sources/gui/qml/pages/settings/SettingsLocalization.qml =================================================================== diff -u --- sources/gui/qml/pages/settings/SettingsLocalization.qml (revision 0) +++ sources/gui/qml/pages/settings/SettingsLocalization.qml (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -0,0 +1,114 @@ +/*! + * + * Copyright (c) 2023-2024 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file SettingsROInput.qml + * \author (last) Behrouz NematiPour + * \date (last) 18-Jul-2023 + * \author (original) Behrouz NematiPour + * \date (original) 18-Jul-2023 + * + */ + +// Qt +import QtQuick 2.12 +import QtQuick.Controls 2.12 // Switch + + +// Qml imports +import "qrc:/globals" + +/*! + * \brief SettingsROInput is the screen + * which enables the Ro Water Input + */ +SettingsBase { id: _root + itemIndex : SettingsStack.Localization + + confirmVisible : false + + Row { id: _settingsRoInputRow + anchors.centerIn: parent + + Text { id : _settingsLanguageLabel + text : qsTr("Language") + width : 150 + height : _settingsLanguageCombo.height + color : Colors.white + font.pixelSize : Fonts.fontPixelTextRectTitle + verticalAlignment : Text.AlignVCenter + horizontalAlignment : Text.AlignLeft + } + + // FIXME: This combobox needs to be a global Component + ComboBox { id : _settingsLanguageCombo + currentIndex : vLocalization.languageIndex + displayText : currentText + font.pixelSize : Fonts.fontPixelTextRectTitle + width : 300 + height : 55 + padding : 10 + model : vLocalization.languageList + + background : Rectangle { + color : Colors.transparent + border.color : enabled ? Colors.borderButton : Colors.borderDisableButton + radius : Variables.dialogRadius + } + + delegate: ItemDelegate { id : _settingsLanguageDelegate + width : _settingsLanguageCombo.width // + anchors.margins - 2 // 2 is the border width + height : 50 + contentItem: Text { + text : modelData + color : Colors.textMain + font : _settingsLanguageCombo.font + padding : 10 + verticalAlignment : Text.AlignVCenter + } + background : Rectangle { + anchors.fill : parent + anchors.margins : 10 / 2 + visible : _settingsLanguageDelegate.down || _settingsLanguageDelegate.highlighted || _settingsLanguageDelegate.visualFocus + color : _settingsLanguageDelegate.down ? Colors.backgroundButtonSelect : + Colors.backgroundButtonSelectDark + } + highlighted : _settingsLanguageCombo.highlightedIndex === index + } + popup: Popup { + y : _settingsLanguageCombo.height + x : - _settingsLanguageCombo.anchors.leftMargin + width : _settingsLanguageCombo.width + _settingsLanguageCombo.anchors.leftMargin + implicitHeight : contentItem.implicitHeight + contentItem : ListView { + clip : true + implicitHeight : contentHeight + currentIndex : _settingsLanguageCombo.highlightedIndex + model : _settingsLanguageCombo.popup.visible ? _settingsLanguageCombo.delegateModel : null + } + background: Rectangle { + color : Colors.backgroundMain + border.color : Colors.borderButton + radius : Variables.dialogRadius + } + } + } + } + + 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 -r26433c42f2efa2cb18af95f523581c7eeeff049d -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 26433c42f2efa2cb18af95f523581c7eeeff049d) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -46,7 +46,6 @@ readonly property bool loggedIn : serviceMode - readonly property bool visibleLanguage : false readonly property bool visibleSWUpdate : false readonly property bool visibleDGScheduling : false readonly property bool visibleCalibration : false @@ -71,6 +70,7 @@ readonly property bool visibleDeviceConfiguration : onlyManufacturing && loggedIn readonly property bool visibleDeviceRegistration : onlyManufacturing && loggedIn readonly property bool visibleInstitutionalRecord : true + readonly property bool visibleLocalization : true // loggedIn TODO: enum ItemsIndex { @@ -83,7 +83,7 @@ ServicePassword , SetDateTime , ExportLogs , - Language , + Localization , RoInput , Calibration , DeviceConfiguration , @@ -104,7 +104,7 @@ qsTr("Service" ), // servicePassword qsTr("Set Date And Time" ), // SetDateTime qsTr("Export Logs" ), // ExportLogs - qsTr("Set Language" ), // Language + qsTr("Set Language" ), // Localization qsTr("Water Input Mode" ), // RoInput qsTr("Calibration" ), // Calibration qsTr("Device Configuration" ), // Device Configuration @@ -125,7 +125,7 @@ true , // ServicePassword true , // SetDateTime true , // ExportLogs - true , // Language + true , // Localization true , // RoInput true , // Calibration true , // Device Configuration @@ -146,7 +146,7 @@ visibleServicePassword , // ServicePassword visibleSetDateTime , // SetDateTime visibleExportLogs , // ExportLogs - visibleLanguage , // Language + visibleLocalization , // Localization visibleRoInput , // RoInput visibleCalibration , // Calibration visibleDeviceConfiguration , // Device Configuration @@ -255,6 +255,10 @@ push( _settingsInstitutionalRecord ) break + case SettingsStack.Localization: + push( _settingLocalization ) + break + default: console.debug("Unknown Index", vIndex) break @@ -278,6 +282,7 @@ SettingsFactoryReset { id: _serviceFactoryReset } SettingsDecommission { id: _serviceDecommission } SettingsInstitutionalRecord { id: _settingsInstitutionalRecord } + SettingsLocalization { id: _settingLocalization } function gotoServiceMode( vservice ) { //DEBUG console.log (" 0 ---------- ", _GuiView.manufactMode, _GuiView.manufactSetup, vservice, stackView.initialItem, stackView.currentItem, stackView.depth) Index: sources/storage/Settings.h =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 --- sources/storage/Settings.h (.../Settings.h) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/storage/Settings.h (.../Settings.h) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -122,7 +122,7 @@ enum Key_Enum { eKeyTitle , eKeyMessage , - eKeyListTitle , + eKeyListTitle , eKeyConfirm , eKeyCancel , }; Index: sources/view/VView.h =================================================================== diff -u -r26433c42f2efa2cb18af95f523581c7eeeff049d -r90e68000c37bc14b0dfd5f18caf425c24cc0b5f4 --- sources/view/VView.h (.../VView.h) (revision 26433c42f2efa2cb18af95f523581c7eeeff049d) +++ sources/view/VView.h (.../VView.h) (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -111,6 +111,7 @@ REGISTER_TYPE( VDevice ) \ /* Settings */ \ REGISTER_TYPE( VSettings ) \ + REGISTER_TYPE( VLocalization ) \ REGISTER_TYPE( VAdjustmentVersions ) \ REGISTER_TYPE( VAdjustmentServiceMode ) \ REGISTER_TYPE( VAdjustmentServiceDates ) \ Index: sources/view/settings/VLocalization.cpp =================================================================== diff -u --- sources/view/settings/VLocalization.cpp (revision 0) +++ sources/view/settings/VLocalization.cpp (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -0,0 +1,58 @@ +/*! + * + * Copyright (c) 2023-2024 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VLocalization.cpp + * \author (last) Dara Navaei + * \date (last) 10-May-2024 + * \author (original) Behrouz NematiPour + * \date (original) 03-Apr-2023 + * + */ +#include "VLocalization.h" + +// Project +#include "GuiController.h" + +using namespace View; + +View::VLocalization::VLocalization(QObject *) { + initConnections(); +} + + +/*! + * \brief Connection Initializer + * \details All the class signal/slot connections are defined here. +*/ +void View::VLocalization::initConnections() { + ACTION_VIEW_CONNECTION(SettingsData) +} + +void View::VLocalization::doAdjustment(quint8 ) +{ +// _data.mStatus = vStatus ? 1 : 0; +// emit didAdjustment(_data); +} + +/*! + * \brief VLocalization::onSettingsDone + * \details fills the items below, read from the settings file, when the reading is notified done by ApplicationController. + * acidConcentrateOptions + */ +void View::VLocalization::onActionReceive(const SettingsData &) +{ + 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"); + + languageIndex(_languageMap.key(mLanguage)); + +} + Index: sources/view/settings/VLocalization.h =================================================================== diff -u --- sources/view/settings/VLocalization.h (revision 0) +++ sources/view/settings/VLocalization.h (revision 90e68000c37bc14b0dfd5f18caf425c24cc0b5f4) @@ -0,0 +1,63 @@ +/*! + * + * Copyright (c) 2023-2024 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VLocalization.h + * \author (last) Behrouz NematiPour + * \date (last) 31-Jul-2024 + * \author (original) Behrouz NematiPour + * \date (original) 03-Apr-2023 + * + */ +#pragma once + +// Qt +#include + +// Project +#include "main.h" // Doxygen : do not remove +#include "VView.h" +#include "MSettings.h" + +// namespace +namespace View { + +/*! + * \brief The VLocalization class + * \details View for Model's data representation. + * \sa Model::MLocalization + + */ +class VLocalization : public QObject +{ + Q_OBJECT + + QMap _languageMap { + {0, "English"}, + {1, "Spanish"}, + {2, "German"}, + {3, "French"} + }; + + // 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 + TRIGGER ( bool , adjustment , 0) + + PROPERTY( QString , notification ,"") + PROPERTY( quint8 , languageIndex , 0) + READONLY( QStringList, languageList, _languageMap.values()) + + VIEW_DEC_CLASS(VLocalization) + VIEW_DEC_SLOT(SettingsData) + +public slots: + void doAdjustment(quint8 vLanguageIndex); + +signals: + +}; +}