From c6b5855b446c73f8a60cc3d4427fc445e0ba400d Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Tue, 23 Feb 2016 09:13:21 +0200 Subject: Migrate settings UI to use Qt Quick Controls 2 Task-number: QTEE-1057 Change-Id: I389d784241d4b68384765dfde4b572e7652eb76c Reviewed-by: Teemu Holappa --- src/settingsui/network/AddressListEntry.qml | 108 +++++ src/settingsui/network/ComboBoxEntry.qml | 65 +++ src/settingsui/network/EditWiredSettings.qml | 615 +++++++----------------- src/settingsui/network/IpAddressTextField.qml | 8 +- src/settingsui/network/NetworkSettings.qml | 54 +-- src/settingsui/network/WifiSelectorDelegate.qml | 61 +-- src/settingsui/network/WifiSettings.qml | 108 +++-- src/settingsui/network/WifiSignalMonitor.qml | 38 +- src/settingsui/network/WiredSettings.qml | 151 +++--- 9 files changed, 539 insertions(+), 669 deletions(-) create mode 100644 src/settingsui/network/AddressListEntry.qml create mode 100644 src/settingsui/network/ComboBoxEntry.qml (limited to 'src/settingsui/network') diff --git a/src/settingsui/network/AddressListEntry.qml b/src/settingsui/network/AddressListEntry.qml new file mode 100644 index 0000000..45c161f --- /dev/null +++ b/src/settingsui/network/AddressListEntry.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 + +RowLayout { + id: root + spacing: 10 + property alias model: repeater.model + property bool modified: false + property alias title: label.text + + Label { + id: label + Layout.preferredWidth: content.titleWidth + horizontalAlignment: Text.AlignRight + Layout.alignment: Qt.AlignTop + Layout.topMargin: 10 + } + ColumnLayout { + spacing: 10 + Layout.fillWidth: true + + Repeater { + id: repeater + visible: count > 0 + RowLayout { + spacing: 10 + TextField { + text: edit + Layout.fillWidth: true + onEditingFinished: { + root.modified = true; + edit = text; + } + } + Button { + Layout.preferredWidth: height + text: "-" + visible: repeater.count > 0 + onClicked: { + root.modified = true; + root.model.remove(index); + } + } + Button { + Layout.preferredWidth: height + visible: index === repeater.count - 1 + text: "+" + onClicked: root.model.append("") + + Layout.alignment: Qt.AlignRight + } + } + } + RowLayout { + visible: repeater.count === 0 + spacing: 10 + TextField { + id: nameServerEntryItem + Layout.fillWidth: true + text: "" + onAccepted: root.model.append(text) + } + Button { + Layout.preferredWidth: height + text: "+" + onClicked: nameServerEntryItem.accepted() + } + } + } +} diff --git a/src/settingsui/network/ComboBoxEntry.qml b/src/settingsui/network/ComboBoxEntry.qml new file mode 100644 index 0000000..791f2d5 --- /dev/null +++ b/src/settingsui/network/ComboBoxEntry.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 + +RowLayout { + id: root + spacing: 10 + width: parent.width + + property alias title: label.text + property alias currentIndex: cb.currentIndex + property alias delegate: cb.delegate + property alias textRole: cb.textRole + property alias model: cb.model + property int titleWidth: -1 + + Label { + id: label + Layout.preferredWidth: root.titleWidth + horizontalAlignment: Text.AlignRight + Layout.alignment: Qt.AlignVCenter + } + ComboBox { + id: cb + textRole: "text" + Layout.fillWidth: true + } +} diff --git a/src/settingsui/network/EditWiredSettings.qml b/src/settingsui/network/EditWiredSettings.qml index 1249e46..48a6abb 100644 --- a/src/settingsui/network/EditWiredSettings.qml +++ b/src/settingsui/network/EditWiredSettings.qml @@ -33,18 +33,17 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import "../common" +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 import com.theqtcompany.settings.network 1.0 Item { id: root property string title: qsTr("Ethernet Settings") property var service: undefined - property bool ipv4Changed: false property bool ipv6Changed: false property bool nameserversChanged: false @@ -63,21 +62,19 @@ Item { Flickable { anchors.fill: parent anchors.top: saveButton.bottom - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) + anchors.margins: 20 contentHeight: content.height contentWidth: width - interactive: !ipv4Method.popupVisible && !ipv6Method.popupVisible && !proxyMethodSel.popupVisible + Column { id: content width: parent.width - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - property int titleWidth: Math.round(width * 0.382) - property int groupWidth: Math.round(width - saveButton.width - 10 * Flat.FlatStyle.scaleFactor) + spacing: 10 + property int titleWidth: width * 0.382 + property int groupWidth: width - saveButton.width - 10 //IPv4 Config GroupBox { - flat: false width: content.groupWidth Layout.fillWidth: true title: qsTr("IPv4") @@ -85,135 +82,74 @@ Item { ColumnLayout { anchors.fill: parent - ListModel { - id: methodsModel - - ListElement { - text: "DHCP" - method: NetworkSettingsIPv4.Dhcp - } - ListElement { - text: "Manual" - method: NetworkSettingsIPv4.Manual - } - ListElement { - text: "Off" - method: NetworkSettingsIPv4.Off - } - } + ComboBoxEntry { + title: qsTr("Connection method:") + titleWidth: content.titleWidth + model: ListModel { + id: methodsModel - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Connection method") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - - CustomCombobox { - id: ipv4Method - model: methodsModel - Component.onCompleted: selectedIndex = service.ipv4.method - - onSelectedIndexChanged : { - ipv4Changed = true; - service.ipv4.method = model.get(selectedIndex).method; + ListElement { + text: "DHCP" + method: NetworkSettingsIPv4.Dhcp } - delegate: FlatStyledDropdownDelegate { } - } - } - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv4.method === NetworkSettingsIPv4.Dhcp - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight + ListElement { + text: "Manual" + method: NetworkSettingsIPv4.Manual } - TextLabel { - text: service.ipv4.address + ListElement { + text: "Off" + method: NetworkSettingsIPv4.Off } } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Mask") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv4.mask - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv4.gateway - } + Component.onCompleted: currentIndex = service.ipv4.method + onCurrentIndexChanged: { + ipv4Changed = true; + service.ipv4.method = model.get(currentIndex).method; } } - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv4.method === NetworkSettingsIPv4.Manual + GridLayout { + columnSpacing: 10 + rows: 3 + columns: 2 + visible: service.ipv4.method !== NetworkSettingsIPv4.Off + width: parent.width - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - IpAddressTextField { - id: ipv4Address - text: service.ipv4.address - onTextChanged: ipv4Changed = true; - - onAccepted: if (text.length > 0) service.ipv4.address = text - } + Label { + text: qsTr("Address:") + Layout.preferredWidth: content.titleWidth + horizontalAlignment: Text.AlignRight } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Mask") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - IpAddressTextField { - id: ipv4Mask - text: service.ipv4.mask - onTextChanged: ipv4Changed = true; - onAccepted: if (text.length > 0) service.ipv4.mask = text - } + IpAddressTextField { + id: ipv4Address + text: service.ipv4.address + onTextChanged: ipv4Changed = true; + onAccepted: if (text.length > 0) service.ipv4.address = text + enabled: service.ipv4.method === NetworkSettingsIPv4.Manual } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - IpAddressTextField { - id: ipv4Gateway - text: service.ipv4.gateway - - onTextChanged: ipv4Changed = true - - onAccepted: if (text.length > 0) service.ipv4.gateway = text - } + Label { + text: qsTr("Mask:") + Layout.preferredWidth: content.titleWidth + horizontalAlignment: Text.AlignRight + } + IpAddressTextField { + id: ipv4Mask + text: service.ipv4.mask + onTextChanged: ipv4Changed = true; + onAccepted: if (text.length > 0) service.ipv4.mask = text + enabled: service.ipv4.method === NetworkSettingsIPv4.Manual + } + Label { + text: qsTr("Router:") + Layout.preferredWidth: content.titleWidth + horizontalAlignment: Text.AlignRight + } + IpAddressTextField { + id: ipv4Gateway + text: service.ipv4.gateway + onTextChanged: ipv4Changed = true + onAccepted: if (text.length > 0) service.ipv4.gateway = text + enabled: service.ipv4.method === NetworkSettingsIPv4.Manual } } } @@ -221,7 +157,6 @@ Item { //IPv6 Config GroupBox { - flat: false width: content.groupWidth Layout.fillWidth: true title: qsTr("IPv6") @@ -229,384 +164,179 @@ Item { ColumnLayout { anchors.fill: parent - ListModel { - id: ipv6methodsmodel - - ListElement { - text: qsTr("Auto") - method: NetworkSettingsIPv6.Auto - } - ListElement { - text: qsTr("Manual") - method: NetworkSettingsIPv6.Manual - } - ListElement { - text: qsTr("Off") - method: NetworkSettingsIPv6.Off - } - } + ComboBoxEntry { + title: qsTr("Connection method:") + titleWidth: content.titleWidth + model: ListModel { + id: ipv6methodsmodel - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Connection method: ") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - - CustomCombobox { - id: ipv6Method - model: ipv6methodsmodel - Component.onCompleted: selectedIndex = service.ipv6.method - onSelectedIndexChanged : { - ipv6Changed = true; - service.ipv6.method = model.get(selectedIndex).method; + ListElement { + text: qsTr("Auto") + method: NetworkSettingsIPv6.Auto } - delegate: FlatStyledDropdownDelegate { } - } - } - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv6.method === NetworkSettingsIPv6.Auto - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight + ListElement { + text: qsTr("Manual") + method: NetworkSettingsIPv6.Manual } - TextLabel { - text: service.ipv6.address + ListElement { + text: qsTr("Off") + method: NetworkSettingsIPv6.Off } } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv6.gateway - } - } + Component.onCompleted: currentIndex = service.ipv6.method - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Prefix length") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv6.prefixLength - } + onCurrentIndexChanged: { + ipv6Changed = true; + service.ipv6.method = model.get(currentIndex).method; } } - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv6.method === NetworkSettingsIPv6.Manual - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextField { - id: ipv6Address - text: service.ipv6.address - onTextChanged: ipv6Changed = true; - onAccepted: if (text.length > 0) service.ipv6.address = text - } + GridLayout { + columnSpacing: 10 + rows: 3 + columns: 2 + visible: service.ipv6.method !== NetworkSettingsIPv6.Off + + Label { + text: qsTr("Address:") + Layout.preferredWidth: content.titleWidth + horizontalAlignment: Text.AlignRight } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextField { - id: ipv6Gateway - text: service.ipv6.gateway - onTextChanged: ipv6Changed = true; - onAccepted: if (text.length > 0) service.ipv4.gateway = text - } + TextField { + id: ipv6Address + text: service.ipv6.address + Layout.fillWidth: true + onTextChanged: ipv6Changed = true; + onAccepted: if (text.length > 0) service.ipv6.address = text + enabled: service.ipv6.method === NetworkSettingsIPv6.Manual + } + Label { + text: qsTr("Router:") + Layout.preferredWidth: content.titleWidth + horizontalAlignment: Text.AlignRight } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Prefix length") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextField { - id: ipv6PrefixLength - text: service.ipv6.prefixLength - validator: IntValidator { bottom: 0; top: 255 } - - onTextChanged: ipv6Changed = true - - onAccepted: if (text.length > 0) service.ipv6.prefixLength = parseInt(text) - } + TextField { + id: ipv6Gateway + text: service.ipv6.gateway + Layout.fillWidth: true + onTextChanged: ipv6Changed = true; + onAccepted: if (text.length > 0) service.ipv4.gateway = text + enabled: service.ipv6.method === NetworkSettingsIPv6.Manual + } + Label { + text: qsTr("Prefix length:") + Layout.preferredWidth: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextField { + id: ipv6PrefixLength + text: service.ipv6.prefixLength + Layout.fillWidth: true + validator: IntValidator { bottom: 0; top: 255 } + onTextChanged: ipv6Changed = true + onAccepted: if (text.length > 0) service.ipv6.prefixLength = parseInt(text) + enabled: service.ipv6.method === NetworkSettingsIPv6.Manual } } } } - GroupBox { - flat: false width: content.groupWidth Layout.fillWidth: true title: qsTr("Name servers") ColumnLayout { anchors.fill: parent - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - Column { - Repeater { - model: service.nameservers - - Row { - TextField { - text: edit - onTextChanged: { - nameserversChanged = true; - edit = text; - } - } - Button { - implicitWidth: height - text: "-" - onClicked: { - service.nameservers.remove(index); - nameserversChanged = true; - } - } - Button { - implicitWidth: height - visible: index==service.nameservers.count-1 - text: "+" - onClicked: service.nameservers.append("") - } - } - } - } - Row { - TextField { - id: nameServerEntryItem - visible: service.nameservers.count === 0 - text: "" - onAccepted: service.nameservers.append(text) - } - Button { - implicitWidth: height - visible: nameServerEntryItem.visible - text: "+" - onClicked: nameServerEntryItem.accepted() - } - } + AddressListEntry { + title: qsTr("Address:") + model: service.nameservers + modified: nameserversChanged } } } - GroupBox { - flat: false width: content.groupWidth Layout.fillWidth: true title: qsTr("Domains") ColumnLayout { anchors.fill: parent - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - Column { - Repeater { - model: service.domains - Row { - TextField { - text: edit - onTextChanged: { - root.domainsChanged = true; - edit = text; - } - } - Button { - implicitWidth: height - text: "-" - onClicked: { - service.domains.remove(index); - domainsChanged.domainsChanged = true; - } - } - Button { - implicitWidth: height - visible: index==service.domains.count-1 - text: "+" - onClicked: service.domains.append("") - } - } - } - } - Row { - TextField { - id: domainsEntryItem - visible: service.domains.count === 0 - text: "" - onAccepted: service.domains.append(text) - } - Button { - implicitWidth: height - visible: domainsEntryItem.visible - text: "+" - onClicked: domainsEntryItem.accepted() - } - } + AddressListEntry { + title: qsTr("Address:") + model: service.domains + modified: domainsChanged } } } - GroupBox { - flat: false width: content.groupWidth Layout.fillWidth: true title: qsTr("Proxy Settings") ColumnLayout { - anchors.fill: parent - - ListModel { - id: proxyMethodModel + id: proxyLayout + width: parent.width - ListElement { - text: qsTr("Direct") - method: NetworkSettingsProxy.Direct - } - ListElement { - text: qsTr("Auto") - method: NetworkSettingsProxy.Auto - } - ListElement { - text: qsTr("Manual") - method: NetworkSettingsProxy.Manual - } - } + ComboBoxEntry { + title: qsTr("Configuration:") + titleWidth: content.titleWidth + model: ListModel { + id: proxyMethodModel - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Configuration") - width: content.titleWidth - horizontalAlignment: Text.AlignRight + ListElement { + text: qsTr("Direct") + method: NetworkSettingsProxy.Direct + } + ListElement { + text: qsTr("Auto") + method: NetworkSettingsProxy.Auto + } + ListElement { + text: qsTr("Manual") + method: NetworkSettingsProxy.Manual + } } + Component.onCompleted: currentIndex = service.proxy.method - CustomCombobox { - id: proxyMethodSel - model: proxyMethodModel - Component.onCompleted: selectedIndex = service.proxy.method - onSelectedIndexChanged : { - proxyChanged = true; - service.proxy.method = model.get(selectedIndex).method; - } - delegate: FlatStyledDropdownDelegate { } + onCurrentIndexChanged: { + proxyChanged = true; + service.proxy.method = model.get(currentIndex).method; } } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + RowLayout { + spacing: 10 visible: service.proxy.method !== NetworkSettingsProxy.Direct - TextLabel { - text: service.proxy.method === NetworkSettingsProxy.Manual ? qsTr("Proxy address") : qsTr("Automatic configuration URL") - width: content.titleWidth + Label { + text: service.proxy.method === NetworkSettingsProxy.Manual ? qsTr("Proxy address:") : qsTr("Configuration URL:") + Layout.preferredWidth: content.titleWidth horizontalAlignment: Text.AlignRight + Layout.alignment: Qt.AlignVCenter + elide: Label.ElideRight } TextField { id: proxyUrl text: service.proxy.url + Layout.fillWidth: true onTextChanged: proxyChanged = true; onAccepted: service.proxy.url = text; } } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + AddressListEntry { + model: service.proxy.excludes + modified: proxyChanged + title: qsTr("No proxy for:") visible: service.proxy.method === NetworkSettingsProxy.Manual - - TextLabel { - text: qsTr("No proxy for") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - - Column { - Repeater { - model: service.proxy.excludes - - Row { - TextField { - text: edit - onTextChanged: edit = text - } - Button { - implicitWidth: height - text: "-" - onClicked: { - service.proxy.excludes.remove(index); - proxyChanged = true; - } - } - Button { - implicitWidth: height - visible: index==service.proxy.excludes.count-1 - text: "+" - onClicked: service.proxy.excludes.append("") - } - } - } - } - Row { - TextField { - id: proxyEntryItem - visible: service.proxy.excludes.count === 0 - text: "" - onAccepted: service.proxy.excludes.append(text) - } - Button { - implicitWidth: height - visible: proxyEntryItem.visible - text: "+" - onClicked: proxyEntryItem.accepted() - } - } } } } } } - Button { id: saveButton anchors.right: parent.right anchors.top: parent.top - anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) - anchors.rightMargin: Math.round(40 * Flat.FlatStyle.scaleFactor) + anchors.margins: 20 text: qsTr("Save") onClicked: { @@ -631,6 +361,7 @@ Item { if (domainsChanged) { service.setupDomainsConfig(); } + if (proxyChanged) { proxyUrl.accepted(); service.setupNetworkSettingsProxy(); diff --git a/src/settingsui/network/IpAddressTextField.qml b/src/settingsui/network/IpAddressTextField.qml index 102d458..e7e90ab 100644 --- a/src/settingsui/network/IpAddressTextField.qml +++ b/src/settingsui/network/IpAddressTextField.qml @@ -33,9 +33,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 TextField { Layout.fillWidth: true diff --git a/src/settingsui/network/NetworkSettings.qml b/src/settingsui/network/NetworkSettings.qml index 2eed812..d516426 100644 --- a/src/settingsui/network/NetworkSettings.qml +++ b/src/settingsui/network/NetworkSettings.qml @@ -33,21 +33,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import "../common" +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 import com.theqtcompany.settings.network 1.0 Item { property string title: qsTr("Network Settings") GroupBox { id: networkSelect - anchors.fill: parent anchors.rightMargin: parent.width * 0.618 - anchors.leftMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) - anchors.topMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) + anchors.leftMargin: 20 + anchors.topMargin: 20 + anchors.bottomMargin: 20 + anchors.fill: parent title: qsTr("Select Connection") function stateToStr(serviceState) { @@ -70,45 +71,37 @@ Item { return qsTr("Undefined"); } } - ColumnLayout { - width: networkSelect.width - ExclusiveGroup { - id: exgroup - } + width: parent.width Repeater { model: NetworkSettingsManager.interfaces Button { - implicitWidth: networkSelect.width - Math.round(20 * Flat.FlatStyle.scaleFactor) - implicitHeight: Math.round(54 * Flat.FlatStyle.scaleFactor) + Layout.fillWidth: true + implicitHeight: 54 checkable: true - exclusiveGroup: exgroup - Row { + label: Row { anchors.fill: parent - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + spacing: 10 Image { - id: typeId - height: parent.height - width: height + id: typeId + height: parent.height + width: height } - Column { - height: Math.round(parent.height * 0.7) + height: parent.height * .7 spacing: 0 anchors.verticalCenter: parent.verticalCenter - TextLabel { + Label { text: name } - - TextLabel { + Label { text: networkSelect.stateToStr(modelData.state) - font.pixelSize: Math.round(12 * Flat.FlatStyle.scaleFactor) + font.pixelSize: 12 } - } } @@ -131,7 +124,10 @@ Item { NetworkDetails { id: networkDetails + anchors.leftMargin: networkSelect.width + 40 + anchors.topMargin: 20 + anchors.rightMargin: 20 + anchors.bottomMargin: 20 anchors.fill: parent - anchors.leftMargin: networkSelect.width + Math.round(20 * Flat.FlatStyle.scaleFactor) } } diff --git a/src/settingsui/network/WifiSelectorDelegate.qml b/src/settingsui/network/WifiSelectorDelegate.qml index 72216a6..17ec931 100644 --- a/src/settingsui/network/WifiSelectorDelegate.qml +++ b/src/settingsui/network/WifiSelectorDelegate.qml @@ -33,58 +33,39 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import "../common" +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 import com.theqtcompany.settings.network 1.0 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -Item { +ItemDelegate { id: root - property bool checkable: true - property bool checked: false - property bool pressed: false + autoExclusive: true + checkable: true property bool connect: modelData["connected"] - signal clicked() + width: parent.width + contentItem: Item { + width: root.width - MouseArea { - id: delegateButton - anchors.fill: parent - hoverEnabled: true - onPressed: root.pressed = true - onClicked: root.clicked() - onEntered: checked = !checked - - Rectangle { - anchors.fill: parent - color: root.checked ? Flat.FlatStyle.disabledColor : "transparent" - opacity: root.checked ? 0.15 : 1.0 - } - Rectangle { - color: Flat.FlatStyle.darkFrameColor - width: parent.width - height: Flat.FlatStyle.onePixel - anchors.bottom: parent.bottom - } - TextLabel { + Label { id: text + leftPadding: root.indicator.width + root.spacing anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) + anchors.top:parent.top + anchors.right: signalMonitor.left + anchors.bottom:parent.bottom + elide: Text.ElideRight horizontalAlignment: Text.AlignLeft - text: modelData["name"] + verticalAlignment: Text.AlignVCenter + text:modelData["name"] } WifiSignalMonitor { - anchors.verticalCenter: parent.verticalCenter + id: signalMonitor anchors.right: parent.right - anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) - height: Math.round(parent.height * .8) + height: parent.height width: height - signalStrength: modelData["signalStrength"] - connected: modelData["connected"] } } } diff --git a/src/settingsui/network/WifiSettings.qml b/src/settingsui/network/WifiSettings.qml index 352ec3c..b51452d 100644 --- a/src/settingsui/network/WifiSettings.qml +++ b/src/settingsui/network/WifiSettings.qml @@ -33,121 +33,130 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import "../common" +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 import com.theqtcompany.settings.network 1.0 Item { id: root anchors.fill: parent - anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) + Component.onCompleted: NetworkSettingsManager.services.type = NetworkSettingsType.Wifi; - Component.onCompleted: { - NetworkSettingsManager.services.type = NetworkSettingsType.Wifi; - } GroupBox { id: content title: qsTr("Wireless Settings") anchors.fill: parent - Layout.fillWidth: true - flat: true ColumnLayout { - spacing: Math.round(20 * Flat.FlatStyle.scaleFactor) + spacing: 20 width: parent.width - Row { + + RowLayout { + spacing: 10 id: enableSwitch width: parent.width - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - width: root.width*0.382 + + Label { + Layout.preferredWidth: root.width * 0.382 + Layout.alignment: Qt.AlignVCenter horizontalAlignment: Text.AlignRight - text: selectedInterface.powered ? qsTr("Disable Wifi") : qsTr("Enable Wifi") + text: selectedInterface.powered ? qsTr("Wi-Fi OFF") : qsTr("Wi-Fi ON") } Switch { checked: selectedInterface.powered onCheckedChanged: selectedInterface.powered = checked } } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + RowLayout { + spacing: 10 width: parent.width - TextLabel { - id: labelText - text: qsTr("Selected network ") - width: content.width*0.382 + Label { + Layout.preferredWidth: root.width * 0.382 + text: qsTr("Current network") horizontalAlignment: Text.AlignRight + Layout.alignment: Qt.AlignVCenter } - - CustomCombobox { + ComboBoxEntry { id: networkSelection model: NetworkSettingsManager.services - visible: selectedInterface.powered - width: Math.round(200 * Flat.FlatStyle.scaleFactor) textRole: "name" - onSelectedIndexChanged : if (selectedIndex >= 0) model.itemFromRow(selectedIndex).connectService(); + Layout.fillWidth: true + onCurrentIndexChanged: if (currentIndex >= 0) model.itemFromRow(currentIndex).connectService(); delegate: WifiSelectorDelegate { - id: delegate - onConnectChanged: if (connect) networkSelection.setSelectIndexToVal(modelData.name, "name"); + onConnectChanged: if (connect) networkSelection.currentIndex = networkSelection.find(modelData.name) } } } - GroupBox { id: connectView title: qsTr("Enter a password") - flat: false visible: false + Layout.fillWidth: true ColumnLayout { - Row { + width: parent.width + + RowLayout { id: errorView - property alias text: text.text visible: text.text !== "" + spacing: 10 + property alias text: text.text - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) Image { - source: "../icons/Alert_yellow_1x.png" + source: "Alert_yellow_1x.png" + Layout.alignment: Qt.AlignVCenter } Text { id: text color: "#face20" text: "" + Layout.alignment: Qt.AlignVCenter } } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + RowLayout { + spacing: 10 visible: false - TextLabel { - text: qsTr("User name") - width: root.width*0.382 + width: parent.width + + Label { + text: qsTr("User name:") horizontalAlignment: Text.AlignRight + Layout.preferredWidth: root.width * 0.382 + Layout.alignment: Qt.AlignVCenter } TextField { text: "" inputMethodHints: Qt.ImhNoPredictiveText + Layout.alignment: Qt.AlignVCenter + Layout.fillWidth: true } } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Password") + RowLayout { + spacing: 10 + width: parent.width + + Label { + text: qsTr("Password:") horizontalAlignment: Text.AlignRight + Layout.preferredWidth: root.width * 0.382 + Layout.alignment: Qt.AlignVCenter } TextField { id: password text: "" echoMode: TextInput.Password inputMethodHints: Qt.ImhNoPredictiveText + Layout.alignment: Qt.AlignVCenter + Layout.fillWidth: true } } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + RowLayout { + spacing: 10 + Button { text: qsTr("Connect") onClicked: { @@ -162,19 +171,18 @@ Item { } } } - Button { id: disconnect text: qsTr("Disconnect") visible: selectedInterface.state === NetworkSettingsState.Online || selectedInterface.state === NetworkSettingsState.Ready onClicked: { + console.log("disconnect"); NetworkSettingsManager.services.itemFromRow(networkSelection.selectedIndex).disconnectService(); networkSelection.selectedIndex = -1; } } } - Connections { target: NetworkSettingsUserAgent onShowUserCredentialsInput : { diff --git a/src/settingsui/network/WifiSignalMonitor.qml b/src/settingsui/network/WifiSignalMonitor.qml index 35d9e53..40a0837 100644 --- a/src/settingsui/network/WifiSignalMonitor.qml +++ b/src/settingsui/network/WifiSignalMonitor.qml @@ -33,11 +33,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.5 +import QtQuick 2.6 Item { id: root - property bool scanning: false property int signalStrength: 100 property bool connected: false @@ -63,21 +62,30 @@ Item { } Image { + id: sprite + property int currentFrame: 0 anchors.fill: parent source: "Wifi_lightgray_2x.png" - } + clip: true - AnimatedSprite { - id: sprite - anchors.fill: parent - source: connected ? "WifiAnim_qt_2x.png" : "WifiAnim_black_2x.png" - frameDuration: 500 - frameCount: 4 - currentFrame: 3 - frameSync: false - frameWidth: 32 - frameHeight: 32 - loops: 40 - running: scanning + Timer { + id: scanningTimer + running: scanning + interval: 250 + repeat: true + onTriggered: { + if (sprite.currentFrame < 4) + sprite.currentFrame++ + else + sprite.currentFrame = 0 + } + } + + Image { + height: parent.height + width: parent.width * 4 + source: "WifiAnim_black_2x.png" + x: -parent.currentFrame * width / 4 + } } } diff --git a/src/settingsui/network/WiredSettings.qml b/src/settingsui/network/WiredSettings.qml index aad97fe..9359484 100644 --- a/src/settingsui/network/WiredSettings.qml +++ b/src/settingsui/network/WiredSettings.qml @@ -33,17 +33,16 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import "../common" +import QtQuick 2.6 +import QtQuick.Layouts 1.3 +import Qt.labs.controls 1.0 +import Qt.labs.controls.material 1.0 +import Qt.labs.controls.universal 1.0 import com.theqtcompany.settings.network 1.0 Item { id: root anchors.fill: parent - anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) property bool editMode: false property var service: null property string title: qsTr("Network"); @@ -51,129 +50,103 @@ Item { Component.onCompleted: { NetworkSettingsManager.services.type = NetworkSettingsType.Wired; root.service = NetworkSettingsManager.services.itemFromRow(0); - } - - ListModel { - id: methodsModel - - ListElement { - text: "DHCP" - method: NetworkSettingsIPv4.Dhcp - } - ListElement { - text: "Manual" - method: NetworkSettingsIPv4.Manual - } - ListElement { - text: "Off" - method: NetworkSettingsIPv4.Off - } + ipv4Method.currentIndex = service.ipv4.method } GroupBox { title: qsTr("Ethernet Connection") anchors.fill: parent - Layout.fillWidth: true - flat: true + Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Row { - TextLabel { - text: qsTr("Connection method: ") + spacing: 10 + width: parent.width + + ComboBoxEntry { + id: ipv4Method + title: qsTr("Connection method:") + model: ListModel { + id: methodsModel + + ListElement { + text: "DHCP" + method: NetworkSettingsIPv4.Dhcp + } + ListElement { + text: "Manual" + method: NetworkSettingsIPv4.Manual + } + ListElement { + text: "Off" + method: NetworkSettingsIPv4.Off + } } - CustomCombobox { - id: ipv4Method - model: methodsModel - Component.onCompleted: selectedIndex = service.ipv4.method - onSelectedIndexChanged : { - if (model.get(selectedIndex).method !== NetworkSettingsIPv4.Dhcp) { - service.ipv4.method = model.get(selectedIndex).method; - editMode = true; - } - else { - //Enable DHCP - if (service.ipv4.method !== model.get(selectedIndex).method) { - service.ipv4.method = model.get(selectedIndex).method; - service.setupIpv4Config(); - } - - editMode = false; + Component.onCompleted: currentIndex = service.ipv4.method + onCurrentIndexChanged: { + if (model.get(currentIndex).method !== NetworkSettingsIPv4.Dhcp) { + service.ipv4.method = model.get(currentIndex).method; + editMode = true; + } + else if (service){ + //Enable DHCP + if (service.ipv4.method !== model.get(currentIndex).method) { + service.ipv4.method = model.get(currentIndex).method; + service.setupIpv4Config(); } + editMode = false; } - delegate: FlatStyledDropdownDelegate { } } } - - Row { + GridLayout { + columns: 2 + rows: 4 + width: parent.width visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { + + Label { text: qsTr("IP Address: ") - } - TextLabel { - text: service.ipv4.address - visible: !editMode + width: parent.width * .3 } IpAddressTextField { id: ipv4Address - placeholderText: service.ipv4.address - visible: editMode + text: service.ipv4.address + enabled: editMode onAccepted: if (text.length > 0) service.ipv4.address = text } - } - - Row { - visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { + Label { text: qsTr("Mask: ") } - TextLabel { - text: service.ipv4.mask - visible: !editMode - } IpAddressTextField { id: ipv4Mask - placeholderText: service.ipv4.mask - visible: editMode + text: service.ipv4.mask + enabled: editMode onAccepted: if (text.length > 0) service.ipv4.mask = text } - } - - Row { - visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { + Label { text: qsTr("Router: ") } - TextLabel { - text: service.ipv4.gateway - visible: !editMode - } IpAddressTextField { id: ipv4Gateway - placeholderText: service.ipv4.gateway - visible: editMode + text: service.ipv4.gateway + enabled: editMode onAccepted: if (text.length > 0) service.ipv4.gateway = text } - } - - Row { - visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { + Label { text: qsTr("DNS server: ") } Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + spacing: 10 Repeater { model: service.nameservers - TextLabel { + Label { text: display } } } } - Row { + spacing: 10 Button { text: qsTr("Save") visible: editMode @@ -191,17 +164,15 @@ Item { visible: editMode onClicked: { editMode = false; - methodSelection.currentIndex = service.ipv4.method + ipv4Method.currentIndex = service.ipv4.method } } } Button { text: qsTr("Edit") visible: !editMode - - onClicked: stackView.push({item: Qt.resolvedUrl("EditWiredSettings.qml"), properties: {service: root.service}}); + onClicked: stackView.push(Qt.resolvedUrl("EditWiredSettings.qml"), {service: root.service}); } } } } - -- cgit v1.2.3