Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -r159f2bb0317c7c3c0336e4cb80c7fef3f87e329a -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 159f2bb0317c7c3c0336e4cb80c7fef3f87e329a) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -15,7 +15,6 @@ // Qt import QtQuick 2.12 -import QtQuick.Controls 2.12 // Switch // Project import Gui.Actions 0.1 @@ -45,76 +44,95 @@ VolumeBrightness , WiFi , Bluetooth , - ExportLogs , - SetDateTime , - Language , - Services , DGCleaning , DGScheduling , + ServicePassword , + SetDateTime , + ExportLogs , + Language , RoInput , Calibration , + DeviceConfiguration , DeviceRegistration , SWUpdate , - FactoryReset + RootSSHAccess , + FactoryReset , + Decommission } property var itemsText : [ - qsTr("Information" ), // Information - qsTr("Volume And Brightness" ), // VolumeBrightness - qsTr("Wi-Fi" ), // WiFi - qsTr("Bluetooth Cuff" ), // Bluetooth - qsTr("Export Logs" ), // ExportLogs - qsTr("Set Date And Time" ), // SetDateTime - qsTr("Set Language" ), // Language - qsTr("Service" ), // Service - qsTr("DG Cleaning" ), // DGCleaning - qsTr("DG Scheduling" ), // DGScheduling - qsTr("Water Input Mode" ), // RoInput - qsTr("Calibration " ), // Calibration - qsTr("Device Registration" ), // DeviceRegistration - qsTr("Software Update" ), // SWUpdate - qsTr("Factory Reset" ), // FactoryReset + qsTr("Information" ), // Information + qsTr("Volume And Brightness" ), // VolumeBrightness + qsTr("Wi-Fi" ), // WiFi + qsTr("Bluetooth Cuff" ), // Bluetooth + qsTr("DG Cleaning" ), // DGCleaning + qsTr("DG Scheduling" ), // DGScheduling + qsTr("Service" ), // servicePassword + qsTr("Set Date And Time" ), // SetDateTime + qsTr("Export Logs" ), // ExportLogs + qsTr("Set Language" ), // Language + qsTr("Water Input Mode" ), // RoInput + qsTr("Calibration" ), // Calibration + qsTr("Device Configuration" ), // Device Configuration + qsTr("Device Registration" ), // DeviceRegistration + qsTr("Software Update" ), // SWUpdate + qsTr("Enable Root SSH" ), // RootSSHAccess + qsTr("Factory Reset" ), // FactoryReset + qsTr("Decommissioning" ), // Decommission ] property var itemsEnabled : [ - true , // Information - true , // VolumeBrightness - true , // WiFi - true , // Bluetooth - true , // ExportLogs - true , // SetDateTime - false , // Language - true , // Service - true , // DGCleaning - true , // DGScheduling - true , // RoInput - false , // Calibration - true , // DeviceRegistration - false , // SWUpdate - false , // FactoryReset + true , // Information + true , // VolumeBrightness + true , // WiFi + true , // Bluetooth + true , // DGCleaning + true , // DGScheduling + true , // ServicePassword + true , // SetDateTime + true , // ExportLogs + false , // Language + true , // RoInput + false , // Calibration + _GuiView.manufactMode , // Device Configuration + true , // DeviceRegistration + false , // SWUpdate + serviceMode , // RootSSHAccess + serviceMode , // FactoryReset + serviceMode , // Decommission ] property var itemsVisible : [ - true , // Information - true , // VolumeBrightness - true , // WiFi - true , // Bluetooth - true , // ExportLogs - serviceMode , // SetDateTime - false /* serviceMode phase 1B */ , // Language - ! serviceMode , // Service - true , // DGCleaning - false /* serviceMode phase 1B */ , // DGScheduling - true , // RoInput - false /* serviceMode phase 1B */ , // Calibration - true , // DeviceRegistration // FIXME: On the normal setting menu for now for development. - false /* serviceMode phase 1B */ , // SWUpdate - false /* serviceMode phase 1B */ , // FactoryReset + true , // Information + true , // VolumeBrightness + true , // WiFi + true , // Bluetooth + ! _GuiView.manufactSetup , // DGCleaning + false /* serviceMode phase 1B */ , // DGScheduling + ! serviceMode && ! _GuiView.manufactSetup , // ServicePassword + serviceMode , // SetDateTime + true , // ExportLogs + false /* serviceMode phase 1 */ , // Language + ! _GuiView.manufactSetup , // RoInput + false /* serviceMode phase 1 */ , // Calibration + _GuiView.manufactMode && serviceMode , // Device Configuration // && serviceMode added to make sure the service mode is confirmed by HD + _GuiView.manufactMode && serviceMode , // DeviceRegistration // && serviceMode added to make sure the service mode is confirmed by HD + false /* serviceMode phase 1 */ , // SWUpdate + serviceMode , // RootSSHAccess + serviceMode , // FactoryReset + serviceMode , // Decommission ] SettingsHome { id : _settingsHome - title : serviceMode ? qsTr("Service") : qsTr("Device Settings") + title : _GuiView.manufactSetup ? qsTr("Manufacturing Setup") : serviceMode ? qsTr("Service") : qsTr("Device Settings") backVisible : false confirmVisible : serviceMode - confirmText.text: qsTr("SHUTDOWN") - onConfirmClicked: _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.NoData) + confirmText.text: _GuiView.manufactSetup ? qsTr("QUIT") : qsTr("SHUTDOWN") + onConfirmClicked: { + if ( _GuiView.manufactSetup ) { + _GuiView.doQuitApplication() + } + else { + _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.NoData) + } + } itemsText : _root.itemsText itemsEnabled : _root.itemsEnabled itemsVisible : _root.itemsVisible @@ -147,7 +165,7 @@ push( _settingsDGScheduling ) break - case SettingsStack.Services: + case SettingsStack.ServicePassword: push(_servicePassword) _servicePassword.setFocus() break @@ -166,225 +184,59 @@ push( _settingsRoInput ) break + case SettingsStack.DeviceConfiguration: + push( _settingsDeviceConfiguration ) + break + case SettingsStack.DeviceRegistration: push( _settingsDeviceRegistration ) break - default: - console.debug("Unknown Index", vIndex) + case SettingsStack.RootSSHAccess: + vDevice.doInitRootSSHAccess() + push( _SettingsRootSSHAccess) break - } - } - } - SettingsBase { id: _settingsInformation - itemIndex : SettingsStack.Information - confirmVisible : false - onVisibleChanged: { - if ( visible ) { - vAdjustmentVersions .doAdjustment() - vAdjustmentServiceDates .doAdjustment() - } - } + case SettingsStack.FactoryReset: + push( _serviceFactoryReset ) + break - TouchGrid { - anchors.centerIn: parent - colCount : 2 - colSpacing : 50 - rowCount : 8 - rowSpacing : 0 - itemHeight : 50 - itemWidth : 550 - touchable : false - itemsHasLine: [ - 0, // title C1 - 1,1,1,1,1,1,1, - 0, // title C2 - 1,1,1,1, - ] - itemsValueLeftMargin: 300 - itemsValue : [ - "" , - Qt .application.version, - vAdjustmentVersions .hdVerDevice , - vAdjustmentVersions .hdVerFPGA , - vAdjustmentVersions .hdSerial , - vAdjustmentVersions .dgVerDevice , - vAdjustmentVersions .dgVerFPGA , - vAdjustmentVersions .dgSerial , - "", - vAdjustmentServiceDates .hdLastServiceDate , - vAdjustmentServiceDates .hdNextServiceDate , - vAdjustmentServiceDates .dgLastServiceDate , - vAdjustmentServiceDates .dgNextServiceDate , - ] - itemsText : [ - qsTr("Versions" ), // col1 title - qsTr("UI Version" ), - qsTr("HD Version" ), - qsTr("HD FPGA Version" ), - qsTr("HD Serial Number" ), - qsTr("DG Version" ), - qsTr("DG FPGA Version" ), - qsTr("DG Serial Number" ), + case SettingsStack.Decommission: + push( _serviceDecommission ) + break - qsTr("Service" ), // col2 title - qsTr("HD Last Service Date" ), - qsTr("HD Next Service Date" ), - qsTr("DG Last Service Date" ), - qsTr("DG Next Service Date" ), - - ] - } - } - - SettingsVolumeBrightness { id: _settingsVolumeBrightness - itemIndex : SettingsStack.VolumeBrightness - } - - SettingsDateTime { id: _settingsDateTime - itemIndex : SettingsStack.SetDateTime - } - - SettingsWiFi { id: _settingsWiFi - itemIndex : SettingsStack.WiFi - } - - SettingsBluetoothCuff { id: _settingsBluetooth - } - - SettingsDGCleaning { id: _settingsDGCleaning - itemIndex : SettingsStack.DGCleaning - } - - SettingsDGScheduling { id: _settingsDGScheduling - itemIndex : SettingsStack.DGScheduling - } - - SettingsExportLogs { id: _settingsExportLogs - itemIndex : SettingsStack.ExportLogs - } - - SettingsBase { id: _settingsRoInput - confirmVisible : false - itemIndex : SettingsStack.RoInput - - - Row { id: _settingsRoInputRow - anchors.centerIn: parent - - Text { id : _settingsRoInputLabel - text : qsTr("Pure Water Mode") - width : 300 - height : _settingsRoInputSwitch.height - color : Colors.white - font.pixelSize: Fonts.fontPixelButton - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignLeft + default: + console.debug("Unknown Index", vIndex) + break } - - Switch { id: _settingsRoInputSwitch - property bool active: true - - checked : vDuetRoWaterDG.status - - width : 85 - height : 85 - - indicator: Rectangle { - implicitWidth : Variables.sliderCircleDiameter * 1.7 - implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) - radius : implicitHeight - anchors.centerIn: parent - color : _settingsRoInputSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive - border.color : _settingsRoInputSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive - Rectangle { - property real diameter : Variables.sliderCircleDiameter - x: _settingsRoInputSwitch.checked ? parent.width - width : 0 - anchors.verticalCenter: parent.verticalCenter - width : diameter - height : diameter - radius : diameter - color : _settingsRoInputSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive - border { - width: Variables.progressbarHandlerBorderWidth - color: Colors.textMain - } - } - } - - contentItem: Text { - width : parent.width - height : parent.height - text : _settingsRoInputSwitch.checked ? qsTr("ON") : qsTr("OFF") - font.pixelSize: Fonts.fontPixelButton - color : _settingsRoInputSwitch.active ? Colors.textMain : Colors.textDisableButton - verticalAlignment : Text.AlignTop - horizontalAlignment : Text.AlignHCenter - } - } } - - Connections { target: _settingsRoInputSwitch - function onClicked() { - vDuetRoWaterDG.doAdjustment ( _settingsRoInputSwitch.checked ) - } - } - Connections { target: vDuetRoWaterDG - function onAdjustmentTriggered(vValue) { - if ( vDuetRoWaterDG.adjustment_Accepted ) { - _settingsRoInput.notificationText = "" - } - else { - _settingsRoInput.notificationText = vDuetRoWaterDG.notification // adjustment_ReasonText - } - vSettings.roWaterMode = vDuetRoWaterDG.status - } - } } - SettingsDeviceRegistration { id: _settingsDeviceRegistration } + SettingsInformation { id: _settingsInformation } + SettingsVolumeBrightness { id: _settingsVolumeBrightness } + SettingsWiFi { id: _settingsWiFi } + SettingsBluetoothCuff { id: _settingsBluetooth } + SettingsDGCleaning { id: _settingsDGCleaning } + SettingsDGScheduling { id: _settingsDGScheduling } + SettingsServicePassword { id: _servicePassword } + SettingsDateTime { id: _settingsDateTime } + SettingsExportLogs { id: _settingsExportLogs } + SettingsROInput { id: _settingsRoInput } + SettingsManufacturingSetup { id: _settingsDeviceConfiguration } + SettingsDeviceRegistration { id: _settingsDeviceRegistration } + SettingsRootSSHAccess { id: _SettingsRootSSHAccess } + SettingsFactoryReset { id: _serviceFactoryReset } + SettingsDecommission { id: _serviceDecommission } - UserConfirmation { id: _servicePassword - property bool isPassword_Accepted : false - property bool isDefaultPasswordSet : (vSettings.servicePass != "") - - itemIndex : SettingsStack.Services - title : isDefaultPasswordSet ? qsTr("Service Password") : qsTr("Set Service Password") - isPassword: true - showPasswordReEntryField: !isDefaultPasswordSet - onBackClicked : { - clearPassword() - if(!isDefaultPasswordSet){ - clearPasswordReEntry() - } - _settingsHome.notificationText = "" - } - onConfirmClicked: { - isPassword_Accepted = false - let password = _servicePassword.password - if ( !isDefaultPasswordSet ) { - let passwordReEntry = _servicePassword.passwordReEntry - if ( password != passwordReEntry ) { _servicePassword.notificationText = qsTr("Mismatched Password Entry"); return } - if (!vSettings.isPasswordValid(password)) { _servicePassword.notificationText = qsTr("Malformed Password Entry" ); return } - - vSettings.updatePassword(password) - _servicePassword.isPassword_Accepted = true - _servicePassword.notificationText = "" - clearPasswordReEntry() - } else { - if (!vSettings.isPasswordMatch(password)) { _servicePassword.notificationText = qsTr("Incorrect service password"); return } - - _servicePassword.isPassword_Accepted = true - _servicePassword.notificationText = "" - vAdjustmentServiceMode.doAdjustment() - if ( vSettings.noCANBus ) { // if NoCANBus is set don't wait for HD and go to service mode. - gotoServiceMode(true) - } - } - clearPassword() - pop() // pop back to settings screen and wait for the HD-OpMode change to Service_Mode to update the settings screen. - } + function gotoServiceMode( vservice ) { + //DEBUG console.log (" 0 ---------- ", _GuiView.manufactMode, _GuiView.manufactSetup, vservice, stackView.initialItem, stackView.currentItem, stackView.depth) + if ( ! _servicePassword.isPassword_Accepted ) return + serviceMode = vservice + if ( vservice ) + _mainMenu.hidden = true + else + if ( _settingsHome.visible ) + _mainMenu.hidden = false } Connections { target: vAdjustmentServiceMode @@ -398,25 +250,32 @@ } } - function gotoServiceMode( vservice ) { - if ( ! _servicePassword.isPassword_Accepted ) return - serviceMode = vservice - if ( vservice ) - _mainMenu.hidden = true - else - if ( _settingsHome.visible ) - _mainMenu.hidden = false - } - - Connections { target: vHDOperationMode function onServiceChanged ( vValue ) { gotoServiceMode( vValue )} function onStandbyWaitDisinfectChanged ( vValue ) { page( _settingsHome , vValue )} } + Connections { target: _GuiView + function onManufactModeChanged( vPass ) { + if ( _GuiView.manufactMode ) { + vSettings.checkServicePasswordSet() + stackView.initialItem = _servicePassword + } + else { + stackView.initialItem = _settingsHome + } + push(stackView.initialItem) + + //DEBUG console.log (" 1 ---------- ", _GuiView.manufactMode, _GuiView.manufactSetup, vPass, stackView.initialItem, stackView.currentItem, stackView.depth) + if ( _GuiView.manufactSetup ) { + _settingsHome.notificationText = vPass ? "" : qsTr("Application POST Failed") + } + } + } + onVisibleChanged: { if (visible) { - _mainMenu.hidden = serviceMode + _mainMenu.hidden = serviceMode || _GuiView.manufactSetup } else { stackView.initialItem = null