summaryrefslogtreecommitdiffstats
path: root/basicsuite/launchersettings/WifiNetworkList.qml
diff options
context:
space:
mode:
Diffstat (limited to 'basicsuite/launchersettings/WifiNetworkList.qml')
-rw-r--r--basicsuite/launchersettings/WifiNetworkList.qml188
1 files changed, 91 insertions, 97 deletions
diff --git a/basicsuite/launchersettings/WifiNetworkList.qml b/basicsuite/launchersettings/WifiNetworkList.qml
index b30d230..806b021 100644
--- a/basicsuite/launchersettings/WifiNetworkList.qml
+++ b/basicsuite/launchersettings/WifiNetworkList.qml
@@ -1,112 +1,98 @@
-/****************************************************************************
+/******************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: For any questions to Digia, please use the contact form at
-** http://www.qt.io
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the examples of the Qt Enterprise Embedded.
+** This file is part of the Qt Enterprise Embedded.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:COMM$
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
**
-****************************************************************************/
+******************************************************************************/
import QtQuick 2.2
-import QtQuick.Controls 1.2
+import QtQuick.Controls 1.4
import B2Qt.Wifi 1.0
Item {
+
Component {
id: listDelegate
+
Rectangle {
id: networkBox
property bool expanded: false
property bool isCurrentNetwork: WifiManager.currentSSID === ssid
property bool connected: isCurrentNetwork && WifiManager.networkState === WifiManager.Connected
property int notExpandedHeight: ssidLabel.height + bssidLabel.height + engine.mm(4)
- property int expandedHeight: notExpandedHeight + passwordInput.height + connectionButton.height + engine.mm(7)
- property int connectedExpandedHeight: notExpandedHeight + connectionButton.height + engine.mm(4)
- height: expanded ? (connected ? connectedExpandedHeight : expandedHeight) : notExpandedHeight
+ property int expandedHeight: notExpandedHeight + connectionButton.height + engine.mm(8)
+ height: expanded ? expandedHeight : notExpandedHeight
width: parent.width
clip: true
- color: "#5C5C5C"
- border.color: "black"
- border.width: 1
Component.onDestruction: if (expanded) networkView.expandedNetworkBox = null
onHeightChanged: if (expanded) networkView.positionViewAtIndex(index, ListView.Contain)
Behavior on height { NumberAnimation { duration: 500; easing.type: Easing.InOutCubic } }
- Text {
- id: ssidLabel
+ CheckBox {
+ id: connectedCheckBox
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: engine.mm(1)
anchors.leftMargin: engine.mm(2)
+ checked: connected
+ }
+
+ Label {
+ id: ssidLabel
+ anchors.top: parent.top
+ anchors.left: connectedCheckBox.right
+ anchors.margins: engine.mm(1)
+ anchors.leftMargin: engine.mm(2)
font.pixelSize: engine.smallFontSize()
font.bold: true
- color: "#E6E6E6"
+ color: "black"
text: isCurrentNetwork ? ssid + networkView.networkStateText : ssid
Component.onCompleted: networkView.setNetworkStateText(WifiManager.networkState)
}
- Text {
+ Label {
id: bssidLabel
anchors.top: ssidLabel.bottom
- anchors.left: parent.left
+ anchors.left: connectedCheckBox.right
anchors.margins: engine.mm(1)
- anchors.leftMargin: engine.mm(6)
+ anchors.leftMargin: engine.mm(2)
text: bssid
- color: "#E6E6E6"
- font.pixelSize: ssidLabel.font.pixelSize * 0.8
+ color: "black"
+ font.pixelSize: ssidLabel.font.pixelSize
}
- Text {
+ Label {
id: flagsLabel
anchors.top: bssidLabel.top
- anchors.left: bssidLabel.right
- anchors.leftMargin: engine.mm(7)
- text: (supportsWPA2 ? "WPA2 " : "")
- + (supportsWPA ? "WPA " : "")
- + (supportsWEP ? "WEP " : "")
- + (supportsWPS ? "WPS " : "");
- color: "#E6E6E6"
- font.pixelSize: ssidLabel.font.pixelSize * 0.8
- font.italic: true
+ anchors.right: parent.right
+ text: (supportsWPA2 ? qsTr("WPA2 ") : "")
+ + (supportsWPA ? qsTr("WPA ") : "")
+ + (supportsWEP ? qsTr("WEP ") : "")
+ + (supportsWPS ? qsTr("WPS ") : "");
+ color: "black"
+ font.pixelSize: ssidLabel.font.pixelSize
+ font.bold: true
}
ProgressBar {
id: signalStrengthBar
height: engine.mm(3)
- width: networkBox.width * 0.5
+ width: networkBox.width * 0.25
anchors.margins: engine.mm(2)
anchors.right: parent.right
anchors.top: parent.top
@@ -136,25 +122,24 @@ Item {
TextField {
id: passwordInput
anchors.top: flagsLabel.bottom
- anchors.topMargin: engine.mm(3)
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width * 0.36
- height: font.pixelSize * 2.4
- placeholderText: "Enter Password"
+ anchors.topMargin: engine.mm(6)
+ anchors.right: connectionButton.left
+ anchors.rightMargin: mainLayout.defaultMargin * .25
+ anchors.left: ssidLabel.left
+ placeholderText: qsTr("Enter Password")
visible: !connected
- font.pixelSize: engine.smallFontSize() * 0.8
+ font.pixelSize: engine.smallFontSize()
echoMode: TextInput.Password
inputMethodHints: Qt.ImhNoPredictiveText
}
Button {
id: connectionButton
- style: SettingsButtonStyle {}
- y: connected ? passwordInput.y
- : passwordInput.y + passwordInput.height + engine.mm(2)
- width: passwordInput.width
- anchors.horizontalCenter: parent.horizontalCenter
- text: connected ? "Disconnect" : "Connect"
+ width: parent.width * .4
+ anchors.right: parent.right
+ anchors.top: flagsLabel.bottom
+ anchors.topMargin: engine.mm(6)
+ text: connected ? qsTr("Disconnect") : qsTr("Connect")
onClicked: {
if (connected) {
WifiManager.disconnect()
@@ -179,34 +164,43 @@ Item {
id: config
}
- ListView {
- id: networkView
+ GroupBox {
anchors.fill: parent
- model: WifiManager.networks
- delegate: listDelegate
-
- property string networkStateText: ""
- property QtObject expandedNetworkBox: null
- property bool hasExpandedNetworkBox: expandedNetworkBox !== null
-
- function setNetworkStateText(networkState) {
- if (networkState === WifiManager.ObtainingIPAddress)
- networkView.networkStateText = " (obtaining ip..)"
- else if (networkState === WifiManager.DhcpRequestFailed)
- networkView.networkStateText = " (dhcp request failed)"
- else if (networkState === WifiManager.Connected)
- networkView.networkStateText = " (connected)"
- else if (networkState === WifiManager.Authenticating)
- networkView.networkStateText = " (authenticating..)"
- else if (networkState === WifiManager.HandshakeFailed)
- networkView.networkStateText = " (wrong password)"
- else if (networkState === WifiManager.Disconnected)
- networkView.networkStateText = ""
- }
- Connections {
- target: WifiManager
- onNetworkStateChanged: networkView.setNetworkStateText(networkState)
+ Item {
+ anchors.fill: parent
+ clip: true
+
+ ListView {
+ id: networkView
+ anchors.fill: parent
+ model: WifiManager.networks
+ delegate: listDelegate
+
+ property string networkStateText: ""
+ property QtObject expandedNetworkBox: null
+ property bool hasExpandedNetworkBox: expandedNetworkBox !== null
+
+ function setNetworkStateText(networkState) {
+ if (networkState === WifiManager.ObtainingIPAddress)
+ networkView.networkStateText = qsTr(" (obtaining ip..)")
+ else if (networkState === WifiManager.DhcpRequestFailed)
+ networkView.networkStateText = qsTr(" (dhcp request failed)")
+ else if (networkState === WifiManager.Connected)
+ networkView.networkStateText = qsTr(" (connected)")
+ else if (networkState === WifiManager.Authenticating)
+ networkView.networkStateText = qsTr(" (authenticating..)")
+ else if (networkState === WifiManager.HandshakeFailed)
+ networkView.networkStateText = qsTr(" (wrong password)")
+ else if (networkState === WifiManager.Disconnected)
+ networkView.networkStateText = ""
+ }
+
+ Connections {
+ target: WifiManager
+ onNetworkStateChanged: networkView.setNetworkStateText(networkState)
+ }
+ }
}
}
}