Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -r94c7a571dc12f24aa072ac2b14199432ce9f3821 -rabb959f145f8af64bab3b8f24314bf0ba8f3bb0e --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 94c7a571dc12f24aa072ac2b14199432ce9f3821) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision abb959f145f8af64bab3b8f24314bf0ba8f3bb0e) @@ -14,13 +14,13 @@ */ // Qt -import QtQuick 2.12 +import QtQuick 2.15 // Project -import Gui.Actions 0.1 // Qml imports import "qrc:/globals" +import "qrc:/compounds" import "qrc:/components" import "qrc:/pages" @@ -44,163 +44,219 @@ readonly property int topMargin : 160 readonly property bool isConnected : vDevice.ssid !== "" + confirmVisible : false - readonly property bool isValid : - _ipAddress .textInput.acceptableInput - && _gateway .textInput.acceptableInput - && _subnetmask .textInput.acceptableInput - && _dns .textInput.acceptableInput - - confirmEnabled : isValid - confirmVisible : false // since the static setting is done one by one seems confirm is not needed for now. - firstFocusInput : _ipAddress notificationText: vDevice.status - Column { id : _ipColumn - spacing : _root.spacing - y : _root.topMargin - anchors.left : parent.left - anchors.leftMargin : _root.leftMargin - TextEntry { id : _ssid - nextInput : _ipAddress // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.ssid - label.text : qsTr("SSID") - textInput.width : entryWidth - label.width : labelWidth - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + contentItem: Item { id: _contentRow + anchors.fill: parent - TextEntry { id : _ipAddress - nextInput : _gateway // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.ipAddress - textInput.visible: _root.isConnected - label.text : qsTr("IP Address") - textInput.width : entryWidth - label.width : labelWidth - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + Item { id: _wifiItem + anchors { + left : parent.left + verticalCenter : parent.verticalCenter + } - TextEntry { id : _gateway - nextInput : _subnetmask // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.gateway - textInput.visible: _root.isConnected - textInput.width : entryWidth - label.width : labelWidth - label.text : qsTr("Gateway") - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + width : parent.width / 2.5 + height : parent.height - TextEntry { id : _subnetmask - nextInput : _dns // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. - textInput.text : vDevice.subnetMask - textInput.visible: _root.isConnected - textInput.width : entryWidth - label.width : labelWidth - label.text : qsTr("Subnet Mask") - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } + Text { id : _wifiInfoTitle + anchors { + top : parent.top + left: parent.left + } + width : parent.width + height : 60 + text : qsTr("Current Wi-Fi Information") + font.pixelSize : Fonts.fontPixelButton + font.weight : Font.Medium + color : Colors.offWhite - TextEntry { id : _dns - textInput.text : vDevice.dns - textInput.visible: _root.isConnected - textInput.width : entryWidth - textInput.wrapMode : Text.WordWrap - label.width : labelWidth - label.text : qsTr("DNS") - hasCursor : false // set false for now to disable the static IP entry for phase 1 - textInput.color : Colors.textMain - } - } - - 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 : vDevice.wifiListEnabled - onClicked : vDevice.wifiList = "" - } - - ScrollBar { flickable : _networkList - anchors.fill: _networkList - } - ListView { id : _networkList - model : vDevice - 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 - readonly property color networkDelegateTextColor : wifiSupported ? Colors.textMain : Colors.textDisableButton - readonly property string postSecurityTypeLabel : wifiSupported ? "" : " - " + qsTr("Not Supported") - readonly property bool isConnected : wifiConnected - onIsConnectedChanged: { - if ( isConnected ) { - vDevice.doInitWifiInfo() + Line { id: _divider + color : Colors.panelBorderColor + anchors { + bottom : parent.bottom + bottomMargin: 10 + left : parent.left + right : parent.right + } } } - clip : true - text.text : wifiSsid - text.elide : Text.ElideLeft - text.color : _delegate.networkDelegateTextColor - width : _networkList.width - Variables.minVGap - height : 75 - radius : Variables.dialogRadius - - text.anchors.horizontalCenter : undefined - text.horizontalAlignment : Text.AlignLeft - text.leftPadding : 5 - border.width : 1 - borderColor : wifiConnected ? Colors.borderButtonSelected : Colors.borderButton - - Text { id : _securityLevel + TouchGrid { id: _currentWifi anchors { - left : parent.left - leftMargin : 10 - bottom : parent.bottom + top : _wifiInfoTitle.bottom + left: _wifiInfoTitle.left } - font.pixelSize : Fonts.fontPixelDialogText - text : wifiSecurityTypes + _delegate.postSecurityTypeLabel - color : _delegate.networkDelegateTextColor + width : parent.width + touchable : false + alignCenter : false + rowCount : 5 + colCount : 1 + itemWidth : width + itemsText : [ qsTr("SSID") , + qsTr("IP Address") , + qsTr("Gateway") , + qsTr("Subnet Mask") , + qsTr("DNS") ] + lineColor : Colors.panelBorderColor + + itemsValue : [ vDevice.ssid , + _root.isConnected ? vDevice.ipAddress : "" , + vDevice.gateway , + vDevice.subnetMask , + vDevice.dns ] + + delegateColor : Colors.transparent + itemsHasLine : Array(itemsText.length).fill(true) // sets all to true + itemsHasImage : Array(itemsText.length).fill(false) // sets all to false } + } - Text { id : _isConnected + Column { id: _networkColumn anchors { - right : parent.right - rightMargin : 10 - bottom : parent.bottom + right : parent.right + verticalCenter : parent.verticalCenter } - font.pixelSize : Fonts.fontPixelDialogText - text : wifiConnected ? qsTr("Connected") : "" - color : _delegate.networkDelegateTextColor - } + width : parent.width / 2.5 + height : parent.height - onClicked : { - if( wifiSupported ) { - _userConfirmation.isPassword = ! wifiConnected - _userConfirmation.ssid = wifiSsid - _userConfirmation.macAddress = wifiMacAddress - push( _userConfirmation ) - _userConfirmation.setFocus() + Rectangle { id: _header + width : parent.width + height : 75 + color : Colors.panelBackgroundColor + radius : 9 + + border { + width: 1 + color: Colors.panelBorderColor + } + + Text { id: _title + text : qsTr("Available Networks") + color : Colors.offWhite + font.family : Fonts.fontFamilyFixed + font.weight : Font.DemiBold + font.pixelSize : Fonts.fontPixelTextRectTitle + anchors { + left : parent.left + leftMargin : Variables.defaultMargin + verticalCenter : parent.verticalCenter + } + } + + IconButton { id: _refreshIcon + anchors { + right : parent.right + rightMargin : Variables.defaultMargin + verticalCenter : parent.verticalCenter + } + iconSize : Variables.iconsDiameter + iconImageSource : enabled ? "qrc:/images/iRefresh" : "qrc:/images/iRefreshDisabled" + enabled : vDevice.wifiListEnabled + + onPressed : vDevice.wifiList = "" + } } - } + + Item { id: _wifiListItem + width : parent.width + height : _contentRow.height + + ScrollBar { + flickable : _networkList + anchors.fill : _networkList + scrollColor : Colors.scrollBarColor + handleWidth : 5 + } + + ListView { id : _networkList + model : vDevice.model + clip : true + width : parent.width + height : parent.height + + + delegate : TouchRect { id : _delegate + readonly property color networkDelegateTextColor : wifiSupported ? Colors.textMain : Colors.textDisableButton + readonly property string postSecurityTypeLabel : wifiSupported ? "" : " - " + qsTr("Not Supported") + readonly property bool isConnected : wifiConnected + onIsConnectedChanged: { + if ( isConnected ) { + vDevice.doInitWifiInfo() + } + } + + clip : true + text.text : wifiSsid + text.elide : Text.ElideLeft + text.color : _delegate.networkDelegateTextColor + width : _networkList.width - Variables.minVGap + height : 75 + radius : Variables.dialogRadius + + text.anchors.horizontalCenter : undefined + text.horizontalAlignment : Text.AlignLeft + text.leftPadding : 5 + border.width : 1 + borderColor : wifiConnected ? Colors.borderButtonSelected : Colors.borderButton + + Text { id : _securityLevel + anchors { + left : parent.left + leftMargin : 10 + bottom : parent.bottom + } + font.pixelSize : Fonts.fontPixelDialogText + text : wifiSecurityTypes + _delegate.postSecurityTypeLabel + color : _delegate.networkDelegateTextColor + } + + Text { id : _isConnected + anchors { + right : parent.right + rightMargin : 10 + bottom : parent.bottom + } + font.pixelSize : Fonts.fontPixelDialogText + text : wifiConnected ? qsTr("Connected") : "" + color : _delegate.networkDelegateTextColor + } + + onClicked : { + if( wifiSupported ) { + _userConfirmation.isPassword = ! wifiConnected + _userConfirmation.ssid = wifiSsid + _userConfirmation.macAddress = wifiMacAddress + push( _userConfirmation ) + _userConfirmation.setFocus() + } + } + } + } + } +// } + } } + +// 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 : vDevice.wifiListEnabled +// onClicked : vDevice.wifiList = "" +// } + + + + UserConfirmation { id : _userConfirmation property string ssid : "" property string macAddress : ""