diff options
Diffstat (limited to 'examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network')
6 files changed, 34 insertions, 63 deletions
diff --git a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CMakeLists.txt b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CMakeLists.txt index 183c9fb..ea3dc22 100644 --- a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CMakeLists.txt +++ b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CMakeLists.txt @@ -5,7 +5,6 @@ set(qml_files "ComboBoxEntry.qml" "EditWiredSettings.qml" "IpAddressTextField.qml" - "NetworkDetails.qml" "NetworkListView.qml" "NetworkSettings.qml" "PassphraseEnter.qml" diff --git a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CustomSwitch.qml b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CustomSwitch.qml index 34b0421..394629b 100644 --- a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CustomSwitch.qml +++ b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/CustomSwitch.qml @@ -81,11 +81,6 @@ Switch { when: !mousearea.drag.active } - MouseArea { - anchors.fill: parent - onClicked: control.checked = !control.checked - } - QtButton { id: qtHandle anchors.verticalCenter: parent.verticalCenter @@ -106,8 +101,6 @@ Switch { drag.minimumX: indicatorImg.width * 0.005 drag.maximumX: indicatorImg.width - width - indicatorImg.width * 0.005 - onClicked: control.checked = !control.checked - onReleased: { if (qtHandle.x > indicatorImg.width / 5 ) { control.checked = true diff --git a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkDetails.qml b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkDetails.qml deleted file mode 100644 index 88b0946..0000000 --- a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkDetails.qml +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick - -Loader { - id: root - property var selectedInterface:undefined - anchors.fill: parent -} diff --git a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkListView.qml b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkListView.qml index 68498b5..b4f3d0e 100644 --- a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkListView.qml +++ b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkListView.qml @@ -36,16 +36,16 @@ ListView { clip: true property var connectingService: null property bool retryConnectAfterIdle: false + + focus: true + boundsBehavior: Flickable.DragOverBounds + model: NetworkSettingsManager.services + function connectBySsid() { passphraseEnter.showSsid = true passphraseEnter.visible = true } - Component.onCompleted: { - NetworkSettingsManager.services.type = NetworkSettingsType.Unknown; - } - model: NetworkSettingsManager.services - delegate: Item { id: networkDelegate width: list.width @@ -61,7 +61,7 @@ ListView { font.pixelSize: Globals.subTitleFontSize font.family: Globals.appFont color: connected ? Globals.buttonGreenColor : "white" - text: name + text: (modelData.type === NetworkSettingsType.Wired) ? modelData["name"] + " (" + modelData["id"] + ")" : name } Row { id: ipRow @@ -107,7 +107,7 @@ ListView { fillColor: connected ? Globals.buttonGrayColor : Globals.buttonGreenColor borderColor: "transparent" text: connected ? qsTr("DISCONNECT") : qsTr("CONNECT") - height: Globals.buttonHeight + enabled: true onClicked: { if (connected) { NetworkSettingsManager.services.itemFromRow(index).disconnectService(); @@ -130,7 +130,6 @@ ListView { anchors.horizontalCenter: networkDelegate.horizontalCenter } Behavior on height { NumberAnimation { duration: 200} } - } Connections { @@ -143,7 +142,7 @@ ListView { // Popup for entering passphrase PassphraseEnter { id: passphraseEnter - parent: root + parent: list.parent visible: false } @@ -166,6 +165,4 @@ ListView { } } } - - focus: true } diff --git a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkSettings.qml b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkSettings.qml index 2b59c61..6c486f6 100644 --- a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkSettings.qml +++ b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/NetworkSettings.qml @@ -33,12 +33,24 @@ import DeviceUtilities.SettingsUI Item { id: networkSettingsRoot - property string title: qsTr("Network Settings") anchors.fill: parent + Connections { + target: NetworkSettingsManager + function onInterfacesChanged() { + if (NetworkSettingsManager.interface(NetworkSettingsType.Wifi, 0) !== null) { + wifiSwitch.visible = true + wifiSwitch.checked = Qt.binding(function() { return NetworkSettingsManager.interface(NetworkSettingsType.Wifi, 0).powered }) + } else { + wifiSwitch.visible = false + } + } + } + Text { id: wlanText - text: qsTr("WLAN") + visible: wifiSwitch.visible + text: qsTr("WiFi") font.pixelSize: networkSettingsRoot.height * Globals.subTitleFontSize font.family: Globals.appFont font.styleName: "SemiBold" @@ -46,6 +58,7 @@ Item { anchors.top: networkSettingsRoot.top anchors.left: networkSettingsRoot.left } + CustomSwitch { id: wifiSwitch anchors.top: wlanText.bottom @@ -53,8 +66,7 @@ Item { height: networkSettingsRoot.height * Globals.buttonHeight indicatorWidth: networkSettingsRoot.height * Globals.buttonWidth indicatorHeight: networkSettingsRoot.height * Globals.buttonHeight - property bool wiFiAvailable: NetworkSettingsManager.interface(NetworkSettingsType.Wifi, 0) !== null - checkable: wiFiAvailable && !wifiSwitchTimer.running + checkable: visible && !wifiSwitchTimer.running onCheckedChanged: { // Power on/off all WiFi interfaces @@ -77,6 +89,7 @@ Item { anchors.left: wifiSwitch.right anchors.right: manualDisconnect.left anchors.rightMargin: 10 + visible: wifiSwitch.visible enabled: wifiSwitch.checked fillColor: enabled ? Globals.buttonGreenColor : Globals.buttonGrayColor borderColor: "transparent" @@ -86,10 +99,12 @@ Item { networkList.connectBySsid() } } + QtButton { id: manualDisconnect anchors.top: wlanText.bottom anchors.right: networkSettingsRoot.right + visible: wifiSwitch.visible enabled: NetworkSettingsManager.currentWifiConnection fillColor: enabled ? Globals.buttonGreenColor : Globals.buttonGrayColor borderColor: "transparent" @@ -101,16 +116,18 @@ Item { } } } + Text { id: networkListTextItem - text: qsTr("Network list:") + text: qsTr("Available networks:") font.pixelSize: networkSettingsRoot.height * Globals.subTitleFontSize font.family: Globals.appFont font.styleName: "SemiBold" color: "white" - anchors.top: wifiSwitch.bottom + anchors.top: (wifiSwitch.visible === true) ? wifiSwitch.bottom : networkSettingsRoot.top anchors.topMargin: 10 } + NetworkListView { id: networkList anchors.top: networkListTextItem.bottom diff --git a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/PassphraseEnter.qml b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/PassphraseEnter.qml index f0978d2..ab85201 100644 --- a/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/PassphraseEnter.qml +++ b/examples/deviceutilities/settingsuiapp/DeviceUtilities/SettingsUI/Network/PassphraseEnter.qml @@ -60,7 +60,7 @@ Rectangle { Text { visible: showSsid - font.pixelSize: parent.height * Globals.subTitleFontSize + font.pixelSize: passphrasePopup.height * Globals.subTitleFontSize font.family: Globals.appFont color: "white" text: qsTr("Enter SSID") @@ -80,14 +80,14 @@ Rectangle { } Text { - font.pixelSize: parent.height * Globals.subTitleFontSize + font.pixelSize: passphrasePopup.height * Globals.subTitleFontSize font.family: Globals.appFont color: "white" text: qsTr("Enter Passphrase") } Text { - font.pixelSize: parent.height * Globals.valueFontSize + font.pixelSize: passphrasePopup.height * Globals.valueFontSize font.family: Globals.appFont color: "red" text: extraInfo |