Index: denali.pro.user =================================================================== diff -u -rf93fd4a2a09a2c6d4db43196b9005f324ae7fa82 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- denali.pro.user (.../denali.pro.user) (revision f93fd4a2a09a2c6d4db43196b9005f324ae7fa82) +++ denali.pro.user (.../denali.pro.user) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -1,6 +1,6 @@ - + EnvironmentId Index: resources/settings/Service.conf =================================================================== diff -u --- resources/settings/Service.conf (revision 0) +++ resources/settings/Service.conf (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -0,0 +1,5 @@ +# this is the service password +# later needs to be encoded to something with the algorithm which is used for all other encryption like CANBus messages +# and will be encrypted on the application +[Service Password] +123 Index: sources/gui/qml/compounds/TouchGrid.qml =================================================================== diff -u -r2230a5b1b891f47b64165164710aa680ddfc7040 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/compounds/TouchGrid.qml (.../TouchGrid.qml) (revision 2230a5b1b891f47b64165164710aa680ddfc7040) +++ sources/gui/qml/compounds/TouchGrid.qml (.../TouchGrid.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -31,6 +31,7 @@ property var itemsUnit : [] property var itemsEnabled : [] + property var itemsVisible : [] property var itemsHasImage : [] property var itemsHasLine : [] property var itemsTouchable : [] @@ -80,6 +81,7 @@ width : _root.itemWidth radius : Variables.dialogRadius enabled : undef( _root.itemsEnabled[index], true ) + visible : undef( _root.itemsVisible[index], true ) onClicked : _root.itemClicked(index) Text { id : _itemsValue text : undef( _root.itemsValue[index], "") Index: sources/gui/qml/pages/TreatmentFlowBase.qml =================================================================== diff -u -r8a5dbf556a66524fbe4b60ac1573182a0bd27617 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/TreatmentFlowBase.qml (.../TreatmentFlowBase.qml) (revision 8a5dbf556a66524fbe4b60ac1573182a0bd27617) +++ sources/gui/qml/pages/TreatmentFlowBase.qml (.../TreatmentFlowBase.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -157,9 +157,11 @@ if ( stepName === undefined ) stepName = "" let group = vSettings.groupFormat.arg(stepName).arg(title.text) let settingsGroup = vSettings.settings[group] - // DEBUG : var settingsCategory = vSettings.category["Instructions/Instructions"] + // DEBUG : + // var settingsCategory = vSettings.category["Instructions/Instructions"] if ( settingsGroup !== undefined ) { - // DEBUG : console.debug(" 00000 ", group, settingsGroup, settingsCategory.groups) + // DEBUG : + // console.debug(" 00000 ", group, settingsGroup, settingsCategory.groups) _root.instructionlocation = settingsGroup.location _root.instructionStepNames = settingsGroup.keys _root.instructionStepImages = settingsGroup.values Index: sources/gui/qml/pages/UserConfirmation.qml =================================================================== diff -u -r7077e38c74db9cccb5496ffefcf8936c0916de76 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/UserConfirmation.qml (.../UserConfirmation.qml) (revision 7077e38c74db9cccb5496ffefcf8936c0916de76) +++ sources/gui/qml/pages/UserConfirmation.qml (.../UserConfirmation.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -30,8 +30,11 @@ objectName : "UserConfirmation" // SquishQt testability property bool isPassword: false - property string password: _password.textInput.text + readonly property string password: _password.textInput.text property alias message : _message.text + function clearPassword() { + _password.textInput.text = "" + } firstFocusInput : isPassword ? _password : undefined TextEntry { id : _password @@ -58,6 +61,7 @@ height : Variables.iconsDiameter source : "qrc:/images/iEye" } + MouseArea { anchors.fill: _showPassword onPressed : _password.textInput.echoMode = TextInput.Normal Index: sources/gui/qml/pages/settings/SettingsBase.qml =================================================================== diff -u -r6c5b5292ae3b3ebf979175dcb1256c88b1baf90c -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/settings/SettingsBase.qml (.../SettingsBase.qml) (revision 6c5b5292ae3b3ebf979175dcb1256c88b1baf90c) +++ sources/gui/qml/pages/settings/SettingsBase.qml (.../SettingsBase.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -27,21 +27,24 @@ ScreenItem { id: _root objectName: "_SettingsBase" - property var firstFocusInput : undefined + property int labelWidth : 200 + property int entryWidth : 100 + + property var firstFocusInput : undefined readonly - property int topMarginTitle : 100 - property int topMarginContent : 200 + property int topMarginTitle : 100 + property int topMarginContent : 200 - property int itemIndex : 0 - property alias title : _titleText.text + property int itemIndex : 0 + property alias title : _titleText.text - property alias notificationText : _information.text + property alias notificationText : _information.text - property alias backVisible : _backButton .visible - property alias backEnabled : _backButton .enabled - property alias confirmVisible : _confirmButton.visible - property alias confirmEnabled : _confirmButton.enabled - property alias confirmText : _confirmButton.text + property alias backVisible : _backButton .visible + property alias backEnabled : _backButton .enabled + property alias confirmVisible : _confirmButton.visible + property alias confirmEnabled : _confirmButton.enabled + property alias confirmText : _confirmButton.text signal backClicked() signal confirmClicked() @@ -101,7 +104,7 @@ textColor : Colors.white imageSource : "" text : "" - // anchors.bottomMargin: Variables.mainMenuHeight + Variables.minVGap + anchors.bottomMargin: Variables.mainMenuHeight + Variables.minVGap } onVisibleChanged: { Index: sources/gui/qml/pages/settings/SettingsDG.qml =================================================================== diff -u -rf93fd4a2a09a2c6d4db43196b9005f324ae7fa82 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/settings/SettingsDG.qml (.../SettingsDG.qml) (revision f93fd4a2a09a2c6d4db43196b9005f324ae7fa82) +++ sources/gui/qml/pages/settings/SettingsDG.qml (.../SettingsDG.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -45,8 +45,8 @@ } } - property int labelWidth : 200 - property int entryWidth : 100 + labelWidth : 200 + entryWidth : 100 property int titleIndent : 25 @@ -123,6 +123,7 @@ } Footer { + anchors.bottomMargin: Variables.mainMenuHeight + Variables.notificationHeight + Variables.minVGap childrenWidth: 300 children: [ TouchRect { text.text: qsTr("Water Flush") Index: sources/gui/qml/pages/settings/SettingsDateTime.qml =================================================================== diff -u -r7077e38c74db9cccb5496ffefcf8936c0916de76 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/settings/SettingsDateTime.qml (.../SettingsDateTime.qml) (revision 7077e38c74db9cccb5496ffefcf8936c0916de76) +++ sources/gui/qml/pages/settings/SettingsDateTime.qml (.../SettingsDateTime.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -29,8 +29,8 @@ */ SettingsBase { id: _root - property int labelWidth : 275 - property int entryWidth : 100 + labelWidth : 275 + entryWidth : 100 readonly property bool isValid : _year .textInput.acceptableInput && Index: sources/gui/qml/pages/settings/SettingsHome.qml =================================================================== diff -u -r1a8e9578b27bb3877116675d0b2361ce4f5b5539 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/settings/SettingsHome.qml (.../SettingsHome.qml) (revision 1a8e9578b27bb3877116675d0b2361ce4f5b5539) +++ sources/gui/qml/pages/settings/SettingsHome.qml (.../SettingsHome.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -16,9 +16,6 @@ // Qt import QtQuick 2.12 -// Project -import Gui.Actions 0.1 - // Qml imports import "qrc:/globals" import "qrc:/components" @@ -33,8 +30,9 @@ property alias itemsText : _settingItems.itemsText property alias itemsEnabled : _settingItems.itemsEnabled + property alias itemsVisible : _settingItems.itemsVisible - readonly property int rowCount : 5 // rowCount should be readonly because it depends on the available space on the screen + readonly property int rowCount : 5 readonly property int colCount : itemsText.length > rowCount ? Math.ceil(itemsText.length / rowCount) : 1 signal itemClicked(int vIndex) @@ -44,69 +42,38 @@ TouchGrid { id: _settingItems anchors.centerIn: _root onItemClicked : _root.itemClicked(vIndex) + rowCount : _root.rowCount + colCount : _root.colCount } // Test Codes - TouchRect { id : _clearAlarmCondition - objectName: "_clearAlarmCondition" - width : 300 - height : Variables.logoDiameter - animated: true + Row { + spacing : Variables.minVGap2 anchors { - top : parent.top - right : _usbButton.left - topMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 - rightMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 + top : parent.top + left: parent.left + topMargin : 35 + leftMargin : 35 } - text.text: qsTr("Clear Alarm Condition") - onClicked: { - _alarmItem.clearAlarm() + TouchRect { id : _clearAlarmCondition + objectName: "_clearAlarmCondition" + width : 300 + height : Variables.logoDiameter + text.text: qsTr("Clear Alarm Condition") + onClicked: _alarmItem.clearAlarm() } + USBButton { id: _usbButton } + ExportButton { id: _exportButton } } - USBButton { id: _usbButton - anchors { - top : parent.top - right : _exportButton.left - topMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 - rightMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 - } - } - - ExportButton { id: _exportButton - width: 150 - height: 50 - anchors { - top : parent.top - right : _poweroffButton.left - topMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 - rightMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 - } - } - - TouchRect { id : _poweroffButton - width: 150 - height: Variables.logoDiameter - anchors { - top : parent.top - right : parent.right - topMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 - rightMargin : (Variables.headerHeight - Variables.logoDiameter) / 2 - } - text.text: qsTr("Shutdown") - onPressed: { - _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.NoData) - } - } - // The Main menu need to hide in case we have any alarm, if not the menu is covered by keyboard but the alram does not. // So what happens is alarm shows up on keyboard but a little higher (main menu height) and it makes the UI not nice. // In the Sub Settings Screens we hide the main menu since those have back button, // but we need to show it back again in the settings home screen since it is a main screen and the only navigation is through the main menu. // So it overrides the parent logic. onVisibleChanged: { if (visible) { - _mainMenu.hidden = false + _mainMenu.hidden = serviceMode } } } Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -r6c5b5292ae3b3ebf979175dcb1256c88b1baf90c -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 6c5b5292ae3b3ebf979175dcb1256c88b1baf90c) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -17,6 +17,8 @@ import QtQuick 2.12 // Project +import Gui.Actions 0.1 + // Qml imports import "qrc:/globals" import "qrc:/components" @@ -33,13 +35,60 @@ stackView.initialItem : _settingsHome + property bool serviceMode : false + enum ItemsIndex { - SetDateTime , - WiFi , - Bluetooth , - DGSettings , - Services + Information , + VolumeBrightness, + WiFi , + Bluetooth , + DGSettings , + Services , + SetDateTime , + Language , + Calibration , + SWUpdate , + FactoryReset } + property var itemsText : [ + qsTr("Information" ), // Information + qsTr("Volume And Brightness" ), // VolumeBrightness + qsTr("Wi-Fi" ), // WiFi + qsTr("Bluetooth" ), // Bluetooth + qsTr("Dialysate Generator Settings" ), // DGSettings + qsTr("Services" ), // Services + qsTr("Set Date And Time" ), // SetDateTime + qsTr("Set Language" ), // Language + qsTr("Calibration " ), // Calibration + qsTr("Software Update" ), // SWUpdate + qsTr("Factory Reset" ), // FactoryReset + ] + property var itemsEnabled : [ + false , // Information + false , // VolumeBrightness + true , // WiFi + false , // Bluetooth + true , // DGSettings + true , // Services + true , // SetDateTime + false , // Language + false , // Calibration + false , // SWUpdate + false , // FactoryReset + ] + property var itemsVisible : [ + true , // Information + true , // VolumeBrightness + true , // WiFi + true , // Bluetooth + true , // DGSettings + ! serviceMode , // Services + serviceMode , // SetDateTime + serviceMode , // Language + serviceMode , // Calibration + serviceMode , // SWUpdate + serviceMode , // FactoryReset + ] SettingsDateTime { id: _settingsDateTime itemIndex : SettingsStack.SetDateTime @@ -61,21 +110,36 @@ itemIndex : SettingsStack.Services title : qsTr("Please Enter The Service Password") isPassword: true + onBackClicked : { + clearPassword() + _settingsHome.notificationText = "" + } + onConfirmClicked: { + if ( vSettings.settings["Service Password"] === undefined ) { + _settingsHome.notificationText = qsTr("No service password defined") + } + else { + if ( password === vSettings.settings["Service Password"].keys[0] ) { + _settingsHome.notificationText = "" + serviceMode = true + } + else { + _settingsHome.notificationText = qsTr("Incorrect service password") + } + } + clearPassword() + pop() + } } - property var itemsText : [ - qsTr("Set Date And Time" ), - qsTr("Wi-Fi" ), - qsTr("Bluetooth" ), - qsTr("Dialysate Generator Settings" ), - qsTr("Services" ), - ] - SettingsHome { id : _settingsHome backVisible : false - confirmVisible : false + confirmVisible : serviceMode + confirmText.text: qsTr("SHUTDOWN") + onConfirmClicked: _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.NoData) itemsText : _root.itemsText - itemsEnabled : [ 1,1,1,1,1,0,0,0,0,0 ] + itemsEnabled : _root.itemsEnabled + itemsVisible : _root.itemsVisible onItemClicked : { switch (vIndex) { case SettingsStack.SetDateTime: Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -r7077e38c74db9cccb5496ffefcf8936c0916de76 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 7077e38c74db9cccb5496ffefcf8936c0916de76) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -34,8 +34,9 @@ regExp:/^(([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))$/ } - readonly property int labelWidth : 200 - readonly property int inputWidth : 175 + labelWidth : 200 + entryWidth : 175 + readonly property int spacing : 20 readonly property int leftMargin : 50 readonly property int rightMargin : 50 @@ -69,7 +70,7 @@ // nextInput : _gateway // it's not needed to be entered in order all the time and also the keyboard needs to be hidden for the set result to be shown. textInput.text : vNetwork.ipAddress label.text : qsTr("IP Address") - textInput.width : inputWidth + textInput.width : entryWidth label.width : labelWidth validator : ipValidator onEnterPressed : { @@ -81,7 +82,7 @@ TextEntry { id : _gateway // nextInput : _subnetmask // it's not needed to be entered in order all the time and also the keyboard needs to be hidden for the set result to be shown. textInput.text : vNetwork.gateway - textInput.width : inputWidth + textInput.width : entryWidth label.width : labelWidth label.text : qsTr("Gateway") validator : ipValidator @@ -94,7 +95,7 @@ TextEntry { id : _subnetmask // nextInput : _dns // it's not needed to be entered in order all the time and also the keyboard needs to be hidden for the set result to be shown. textInput.text : vNetwork.subnetMask - textInput.width : inputWidth + textInput.width : entryWidth label.width : labelWidth label.text : qsTr("Subnet Mask") validator : ipValidator @@ -106,7 +107,7 @@ TextEntry { id : _dns textInput.text : vNetwork.dns - textInput.width : inputWidth + textInput.width : entryWidth label.width : labelWidth label.text : qsTr("DNS") validator : ipValidator @@ -135,7 +136,7 @@ color : Colors.textMain horizontalAlignment : TextInput.Alignleft text : vNetwork.ssid - width : inputWidth + width : entryWidth } } Index: sources/storage/Settings.cpp =================================================================== diff -u -r2216ac6ac7f77437a7c29ac8b4043be01bc4609e -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/storage/Settings.cpp (.../Settings.cpp) (revision 2216ac6ac7f77437a7c29ac8b4043be01bc4609e) +++ sources/storage/Settings.cpp (.../Settings.cpp) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -63,42 +63,61 @@ return 2; // TODO : Define an error enum when completed } + QList details; for (const auto &settingFile: settingFiles) { if (! isValid(settingFile.absoluteFilePath())) continue; QFile file(settingFile.absoluteFilePath()); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QString group = ""; - while ( ! file.atEnd() ) { - QString line = file.readLine().replace('\n',"").trimmed(); - if (line.contains("[")) { - line.replace("[","").replace("]", ""); - group = line; + Detail detail; + detail.content = file.readAll().trimmed(); + if (detail.content.isEmpty()) continue; + detail.location = settingFile.absolutePath() + "/"; + detail.category = QString(detail.location + settingFile.baseName()).remove(Storage::Settings_Path_Name); + details += detail; + } + } + + for (const auto &detail : details) { + QString group = ""; + QStringList lines = detail.content.split('\n'); + for (QString line : lines) { + // ignore empty lines + if ( line.trimmed().isEmpty() ) continue; + + // remove comments + int commentPosition = line.indexOf('#'); + if ( commentPosition == 0 ) continue; // comment line + if ( commentPosition > 0 ) // inline comment + line.truncate(commentPosition); + + if (line.contains("[") && line.contains("]")) { + line.replace("[","").replace("]", ""); + group = line.trimmed(); + } + 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(); - value = keyValue[1].trimmed(); - } - else { - key = line; - } - QString location= settingFile.absolutePath() + "/"; - QString category= QString(location + settingFile.baseName()).remove(Storage::Settings_Path_Name); - _Settings.add(group, key, QVariant(value), location, category); - // DEBUG: qDebug() << group << key << value << location << category; + line = line.trimmed(); + if ( ! line.isEmpty() ) { + QString key = ""; + QString value = ""; + if ( line.contains('=') ) { + QStringList keyValue = line.split('='); + key = keyValue[0].trimmed(); + value = keyValue[1].trimmed(); } + else { + key = line; + } + _Settings.add(group, key, QVariant(value), detail.location, detail.category); + // DEBUG: qDebug() << group << key << value << location << category; } } } + // qDebug() << group << line; } } return 0; Index: sources/storage/Settings.h =================================================================== diff -u -r94fc1cd187816ecbf176df26f9dc5601bf379f13 -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/storage/Settings.h (.../Settings.h) (revision 94fc1cd187816ecbf176df26f9dc5601bf379f13) +++ sources/storage/Settings.h (.../Settings.h) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -34,6 +34,11 @@ // Settings const char *_settingsExt = "conf"; const char *_settingsFormat = "%1/%2.%3"; + struct Detail { + QString category; + QString location; + QString content; + }; private: const QString makeSetting(const char *vPath, const char *vFile) { Index: sources/view/settings/VSettings.cpp =================================================================== diff -u -r2216ac6ac7f77437a7c29ac8b4043be01bc4609e -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 --- sources/view/settings/VSettings.cpp (.../VSettings.cpp) (revision 2216ac6ac7f77437a7c29ac8b4043be01bc4609e) +++ sources/view/settings/VSettings.cpp (.../VSettings.cpp) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) @@ -28,7 +28,8 @@ for (const auto &category : _Settings.categorys()) { QVariantMap details; QStringList groups = _Settings.groups(category); - // DEBUG: qDebug() << " ----- " << category << groups; + // DEBUG: + // qDebug() << " ----- " << category << groups; details["groups"] = groups; mCategorys[category] = details; }