Index: sources/gui/qml/pages/settings/SettingsRootSSHAccess.qml =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -rcb0e2dc027adf7e0fbe803b82bb9945b82c556a5 --- sources/gui/qml/pages/settings/SettingsRootSSHAccess.qml (.../SettingsRootSSHAccess.qml) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/gui/qml/pages/settings/SettingsRootSSHAccess.qml (.../SettingsRootSSHAccess.qml) (revision cb0e2dc027adf7e0fbe803b82bb9945b82c556a5) @@ -28,73 +28,157 @@ SettingsBase { id: _root itemIndex : SettingsStack.RootSSHAccess + readonly property int diameter : 85 + confirmVisible : false - Row { id: _settingsRootSSHAccessRow + Column { anchors.centerIn: parent + Row { id: _settingsRootSSHAccess_SSHDRow + Text { id: _settingsRootSSHAccess_SSHDLabel + text : qsTr("Enable SSH Login") + width : 300 + height : _settingsRootSSHAccess_SSHDSwitch.height + color : Colors.white + font.pixelSize : Fonts.fontPixelButton + verticalAlignment : Text.AlignVCenter + horizontalAlignment : Text.AlignLeft + } - Text { id : _settingsRootSSHAccessLabel - text : qsTr("Root SSH Login") - width : 300 - height : _settingsRootSSHAccessSwitch.height - color : Colors.white - font.pixelSize: Fonts.fontPixelButton - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignLeft - } + Switch { id: _settingsRootSSHAccess_SSHDSwitch + property bool active : true - Switch { id: _settingsRootSSHAccessSwitch - property bool active: true + width : _root.diameter + height : _root.diameter - checked : vDuetRoWaterDG.status + indicator : Rectangle { + implicitWidth : Variables.sliderCircleDiameter * 1.7 + implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) + radius : implicitHeight + anchors.centerIn : parent + color : _settingsRootSSHAccess_SSHDSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive + border.color : _settingsRootSSHAccess_SSHDSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive + Rectangle { + property real diameter : Variables.sliderCircleDiameter + x : _settingsRootSSHAccess_SSHDSwitch.checked ? parent.width - width : 0 + anchors.verticalCenter : parent.verticalCenter + width : diameter + height : diameter + radius : diameter + color : _settingsRootSSHAccess_SSHDSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive + border { + width : Variables.progressbarHandlerBorderWidth + color : Colors.textMain + } + } + } - width : 85 - height : 85 + contentItem : Text { + width : parent.width + height : parent.height + // text : qsTr("Enabled")// _settingsRootSSHAccessSwitch.checked ? qsTr("ON") : qsTr("OFF") + font.pixelSize : Fonts.fontPixelButton + color : _settingsRootSSHAccess_SSHDSwitch.active ? Colors.textMain : Colors.textDisableButton + verticalAlignment : Text.AlignTop + horizontalAlignment : Text.AlignHCenter + } + } + } - indicator: Rectangle { - implicitWidth : Variables.sliderCircleDiameter * 1.7 - implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) - radius : implicitHeight - anchors.centerIn: parent - color : _settingsRootSSHAccessSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive - border.color : _settingsRootSSHAccessSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive - Rectangle { - property real diameter : Variables.sliderCircleDiameter - x: _settingsRootSSHAccessSwitch.checked ? parent.width - width : 0 - anchors.verticalCenter: parent.verticalCenter - width : diameter - height : diameter - radius : diameter - color : _settingsRootSSHAccessSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive - border { - width: Variables.progressbarHandlerBorderWidth - color: Colors.textMain + Row { id: _settingsRootSSHAccess_RootRow + Text { id: _settingsRootSSHAccess_RootLabel + text : qsTr("Enable Root Login") + width : 300 + height : _settingsRootSSHAccess_RootSwitch.height + color : Colors.white + font.pixelSize : Fonts.fontPixelButton + verticalAlignment : Text.AlignVCenter + horizontalAlignment : Text.AlignLeft + } + + Switch { id: _settingsRootSSHAccess_RootSwitch + property bool active : _settingsRootSSHAccess_SSHDSwitch.checked + enabled : _settingsRootSSHAccess_RootSwitch.active + width : _root.diameter + height : _root.diameter + + indicator : Rectangle { + implicitWidth : Variables.sliderCircleDiameter * 1.7 + implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) + radius : implicitHeight + anchors.centerIn : parent + color : _settingsRootSSHAccess_RootSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive + border.color : _settingsRootSSHAccess_RootSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive + Rectangle { + property real diameter : Variables.sliderCircleDiameter + x : _settingsRootSSHAccess_RootSwitch.checked ? parent.width - width : 0 + anchors.verticalCenter : parent.verticalCenter + width : diameter + height : diameter + radius : diameter + color : _settingsRootSSHAccess_RootSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive + border { + width : Variables.progressbarHandlerBorderWidth + color : Colors.textMain + } } } - } - contentItem: Text { - width : parent.width - height : parent.height - // text : qsTr("Enabled")// _settingsRootSSHAccessSwitch.checked ? qsTr("ON") : qsTr("OFF") - font.pixelSize: Fonts.fontPixelButton - color : _settingsRootSSHAccessSwitch.active ? Colors.textMain : Colors.textDisableButton - verticalAlignment : Text.AlignTop - horizontalAlignment : Text.AlignHCenter + contentItem : Text { + width : parent.width + height : parent.height + // text : qsTr("Enabled")// _settingsRootSSHAccessSwitch.checked ? qsTr("ON") : qsTr("OFF") + font.pixelSize : Fonts.fontPixelButton + color : _settingsRootSSHAccess_RootSwitch.active ? Colors.textMain : Colors.textDisableButton + verticalAlignment : Text.AlignTop + horizontalAlignment : Text.AlignHCenter + } } } } - Connections { target: _settingsRootSSHAccessSwitch + function toCheckState() { + let sshd = _settingsRootSSHAccess_SSHDSwitch.checked + let root = _settingsRootSSHAccess_RootSwitch.checked + if ( ! sshd ) return Qt. Unchecked + else if ( ! root ) return Qt.PartiallyChecked + else return Qt. Checked + } + + function fromCheckState( vValue ) { + let sshd = false + let root = false + switch ( vValue ) { + case Qt. Unchecked: + break; + case Qt.PartiallyChecked: + sshd = true + root = false + break; + case Qt. Checked: + sshd = true + root = true + break; + } + _settingsRootSSHAccess_SSHDSwitch.checked = sshd + _settingsRootSSHAccess_RootSwitch.checked = root + } + + Connections { target: _settingsRootSSHAccess_SSHDSwitch function onClicked() { - vDevice.rootSSHAccess = _settingsRootSSHAccessSwitch.checked + vDevice.rootSSHAccess = toCheckState() } } + Connections { target: _settingsRootSSHAccess_RootSwitch + function onClicked() { + vDevice.rootSSHAccess = toCheckState() + } + } Connections { target: vDevice // in case the value is rejecte it will be set to the previous value // also the init value shall be set when navigate to the screen - function onRootSSHAccessChanged ( vValue ) { _settingsRootSSHAccessSwitch.checked = vValue } - function onStatusChanged ( vValue ) { _root.notificationText = vValue } + function onRootSSHAccessChanged ( vValue ) { fromCheckState ( vValue ) } + function onStatusChanged ( vValue ) { _root.notificationText = vValue } } }