Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -r577ab4647b2584d4e32b26797281ec1543d2e1aa -r7077e38c74db9cccb5496ffefcf8936c0916de76 --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 577ab4647b2584d4e32b26797281ec1543d2e1aa) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 7077e38c74db9cccb5496ffefcf8936c0916de76) @@ -17,67 +17,215 @@ import QtQuick 2.12 // Project -import Gui.Actions 0.1; +import Gui.Actions 0.1 // Qml imports import "qrc:/globals" import "qrc:/components" +import "qrc:/pages" /*! * \brief SettingsWiFi * The settings screen to setup the WiFi connection */ SettingsBase { id: _root - function setFocus() { - _hours.textInput.forceActiveFocus() - _keyboard.setVisible(true) - } - property var ipValidator: RegExpValidator { 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]))$/ } - property int labelWidth : 275 - property int inputWidth : 275 - property int spacing : 20 + readonly property int labelWidth : 200 + readonly property int inputWidth : 175 + readonly property int spacing : 20 + readonly property int leftMargin : 50 + readonly property int rightMargin : 50 + readonly property int topMargin : topMarginContent - 40 // moved up to top of the keyboard - readonly property bool isValid : false - // _year .textInput.acceptableInput && - // _month .textInput.acceptableInput && - // _day .textInput.acceptableInput && - // _hours .textInput.acceptableInput && - // _minutes.textInput.acceptableInput + readonly property bool isValid : + _ipAddress .textInput.acceptableInput && + _gateway .textInput.acceptableInput && + _subnetmask .textInput.acceptableInput && + _dns .textInput.acceptableInput - confirmEnabled: isValid - + confirmEnabled : isValid + confirmVisible : false // since the static setting is done one by one seems confirm is not needed for now. + firstFocusInput : _ipAddress notificationText: vNetwork.status onConfirmClicked: { - // vDateTime.doConfirm( - // _year .textInput.text , - // _month .textInput.text , - // _day .textInput.text , - // _hours .textInput.text , - // _minutes.textInput.text ) + vDateTime.doConfirm( + _ipAddress .textInput.text , + _gateway .textInput.text , + _subnetmask .textInput.text , + _dns .textInput.text ) } - Column { id: _container - spacing: _root.spacing - anchors.horizontalCenter: parent.horizontalCenter + Column { id : _ipColumn + spacing : _root.spacing + y : _root.topMargin + anchors.left : parent.left + anchors.leftMargin : _root.leftMargin - TextEntry { id: _ipAddress + TextEntry { id : _ipAddress + // 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") - width : inputWidth + textInput.width : inputWidth + label.width : labelWidth validator : ipValidator - nextInput : _gateway + onEnterPressed : { + _keyboard.setVisible(false) + vNetwork.doSetIPAddress(textInput.text) + } } - TextEntry { id: _gateway + 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 - width : inputWidth + textInput.width : inputWidth + label.width : labelWidth label.text : qsTr("Gateway") validator : ipValidator + onEnterPressed : { + _keyboard.setVisible(false) + vNetwork.doSetGateway(textInput.text) + } } + + 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 + label.width : labelWidth + label.text : qsTr("Subnet Mask") + validator : ipValidator + onEnterPressed : { + _keyboard.setVisible(false) + vNetwork.doSetSubnetMask(textInput.text) + } + } + + TextEntry { id : _dns + textInput.text : vNetwork.dns + textInput.width : inputWidth + label.width : labelWidth + label.text : qsTr("DNS") + validator : ipValidator + onEnterPressed : { + _keyboard.setVisible(false) + vNetwork.doSetDNS(textInput.text) + } + } } + + Row { id : _ssidRow + anchors.top : _ipColumn.bottom + anchors.topMargin : 50 + anchors.left : parent.left + anchors.leftMargin : _root.leftMargin + Text { id : _ssidLabel + font.pixelSize : Fonts.fontPixelTextRectExtra + color : Colors.textMain + horizontalAlignment : TextInput.Alignleft + width : labelWidth + text : qsTr("SSID") + } + + Text { id : _ssidText + font.pixelSize : Fonts.fontPixelTextRectExtra + color : Colors.textMain + horizontalAlignment : TextInput.Alignleft + text : vNetwork.ssid + width : inputWidth + } + } + + TouchRect { id : _scanButton + anchors.bottom : parent.bottom + anchors.bottomMargin: Variables.mainMenuHeight * 2 + Variables.minVGap + anchors.left : parent.left + anchors.leftMargin : _root.leftMargin + text.text : qsTr("SCAN") + width : 350 + isDefault : true + enabled :!vNetwork.scanInProgress + onClicked : vNetwork.doScan() + } + + ScrollBar { flickable : _networkList + anchors.fill: _networkList + } + ListView { id : _networkList + model : vNetwork + clip : true + spacing : 7 + y : _root.topMargin + width : 450 + anchors.top : _ipColumn.top + anchors.bottom : _scanButton.bottom + anchors.right : _root.right + anchors.rightMargin : _root.rightMargin + delegate : TouchRect { id : _delegate + + property bool isCurrrentNetwork: vNetwork.macAddress === macAddress + + clip : true + text.text : ssid + text.elide : Text.ElideLeft + width : _networkList.width - Variables.minVGap + height : 75 + radius : Variables.dialogRadius + + text.anchors.horizontalCenter : undefined + text.horizontalAlignment : Text.AlignLeft + text.leftPadding : 5 + border.width : 1 + + Text { id : _securityLevel + anchors { + left : parent.left + leftMargin : 10 + bottom : parent.bottom + } + font.pixelSize : Fonts.fontPixelDialogText + text : securityTypes + color : Colors.textMain + } + + Text { id : _isConnected + anchors { + right : parent.right + rightMargin : 10 + bottom : parent.bottom + } + font.pixelSize : Fonts.fontPixelDialogText + text : _delegate.isCurrrentNetwork ? qsTr("Connected") : "" + color : Colors.textMain + } + + onClicked : { + _userConfirmation.isPassword = ! _delegate.isCurrrentNetwork + _userConfirmation.ssid = ssid + _userConfirmation.macAddress = macAddress + push( _userConfirmation ) + _userConfirmation.setFocus() + } + } + } + + UserConfirmation { id : _userConfirmation + property string ssid : "" + property string macAddress : "" + property string separator : "\n" + // notificationText : vNetwork.status + message : qsTr("Do you want to disconnect from `%1`?").arg(ssid) + title : isPassword ? qsTr("Join") + separator + ssid : qsTr("Disconnect") + separator + ssid + onConfirmClicked : { + if ( isPassword ) { + vNetwork.doJoinNetwork ( macAddress, password ) + } else { + vNetwork.doDisconnectNetwork( macAddress ) + } + pop() + } + } }