From b591cf219f6c485eb054b628d62475a752f0ffa3 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Thu, 29 Aug 2019 18:32:41 +0200 Subject: wired: add service configuration form Add a new UI form to facilitate wired networks configuration. This form will allow static addressing configuration and customizing dns addresses. Please note that this commit only provides the visual part and doesn't implement the functionality, which will follow in separate commits. Bug-AGL: SPEC-2676 Signed-off-by: Raquel Medina Change-Id: Ib851f0ed14d2885185d1c6b9292c627ef954d15b --- app/wired/ConfigDialog.qml | 323 +++++++++++++++++++++++++++++++++++++++++++++ app/wired/Wired.qml | 30 ++++- app/wired/wired.qrc | 1 + 3 files changed, 350 insertions(+), 4 deletions(-) create mode 100644 app/wired/ConfigDialog.qml diff --git a/app/wired/ConfigDialog.qml b/app/wired/ConfigDialog.qml new file mode 100644 index 0000000..3244799 --- /dev/null +++ b/app/wired/ConfigDialog.qml @@ -0,0 +1,323 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * Copyright (C) 2019 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.3 +import AGL.Demo.Controls 1.0 + + +Dialog { + id: root + property string serviceName: undefined + property alias xpos: root.x + property alias ypos: root.y + property alias maxpwidth: root.width + property alias maxpheight: root.height + property alias staticAddress: m_staticAddress.text + property alias staticNetmask: m_staticNetmask.text + property alias staticGateway: m_staticGateway.text + property alias dnslist: m_dnslist.text + + property bool isIPv4: true + property bool isStatic: false + property bool isManualDNS: false + + signal finished(string svc, string ipv, string ipa, string nm, string gw, string dns) + + visible: false + z: 1 + focus: true + modal: true + footer: DialogButtonBox { + Button { text: "APPLY" + DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole + } + Button { text: "CLOSE" + DialogButtonBox.buttonRole: DialogButtonBox.RejectRole + } + Button { text: "RESET" + DialogButtonBox.buttonRole: DialogButtonBox.ResetRole + } + background: Rectangle { + border.color : '#00ADDC' + color: '#848286' + } + } + + background: Rectangle { + border.color : '#00ADDC' + color: 'transparent' + } + + function setDefaultValues() { + isIPv4 = true + isStatic = false + isManualDNS = false + staticAddress = "" + staticNetmask = "" + staticGateway = "" + dnslist = "" + } + + onIsIPv4Changed: { + verSwitch.checked = isIPv4 + } + + onIsStaticChanged: { + modeSwitch.checked = isStatic + } + + onIsManualDNSChanged: { + dnsSwitch.checked = isManualDNS + } + + onAccepted: { + if (isIPv4 === false) { + console.log("IPv6 not supported by settings application") + setDefaultValues() + } else { + finished(serviceName,"IPv4", staticAddress, staticNetmask, staticGateway, dnslist) + } + } + + onReset: { + setDefaultValues() + } + + Item { + id: container + anchors.centerIn: parent + anchors.fill: parent + ColumnLayout { + anchors.fill: parent + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft + spacing: 8 + visible: true + Label { + id: nwLabel + font.pixelSize: 28 + color: '#080C0F' + text: "Network:" + Layout.preferredWidth: 200 + } + Label { + id: svcLabel + font.pixelSize: 28 + color: '#66FF99' + text: serviceName + } + } + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft + spacing: 8 + visible: true + Label { + id: ipvlabel + font.pixelSize: 28 + color: '#080C0F' + text: "IP version:" + Layout.preferredWidth: 200 + } + Label { + id: ipv6label + font.pixelSize: 28 + color: root.isIPv4? '#848286':'#0DF9FF' + text: "IPv6" + Layout.preferredWidth: 80 + } + Switch { + id: verSwitch + scale: 0.5 + checked : root.isIPv4 + onCheckedChanged: { root.isIPv4 = checked } + } + Label { + id: ipv4label + font.pixelSize: 28 + color: root.isIPv4? '#0DF9FF':'#848286' + text: "IPv4" + } + } + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + spacing: 8 + visible: root.isIPv4? false : true + Label { + font.pixelSize: 28 + color: 'white' + text: "IPv6 not supported by Settings application" + } + } + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft + spacing: 8 + visible: root.isIPv4? true : false + Label { + id: modelabel + font.pixelSize: 28 + color: '#080C0F' + text: "Addressing:" + Layout.preferredWidth: 200 + } + Label { + id: dhcplabel + font.pixelSize: 28 + color: root.isStatic? '#848286':'#0DF9FF' + text: "DHCP" + Layout.preferredWidth: 80 + } + Switch { + id: modeSwitch + scale: 0.5 + checked : root.isStatic + onCheckedChanged: { root.isStatic = checked } + } + Label { + id: staticlabel + font.pixelSize: 28 + color: root.isStatic? '#0DF9FF':'#848286' + text: "Static" + } + } + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + spacing: 16 + visible: (root.isStatic && root.isIPv4)? true : false + ColumnLayout { + Layout.fillWidth: true + Label { + id: address + font.pixelSize: 28 + color: '#080C0F' + text: "address:" + } + TextField { + id: m_staticAddress + font.pixelSize: 28 + Layout.fillWidth: true + placeholderText: "address" + } + } + ColumnLayout { + Layout.fillWidth: true + Label { + id: netmask + font.pixelSize: 28 + color: '#080C0F' + text: "netmask:" + } + TextField { + id: m_staticNetmask + font.pixelSize: 28 + Layout.fillWidth: true + placeholderText: "netmask" + } + } + ColumnLayout { + Layout.fillWidth: true + Label { + id: gateway + font.pixelSize: 28 + color: '#080C0F' + text: "gateway:" + } + TextField { + id: m_staticGateway + font.pixelSize: 28 + Layout.fillWidth: true + placeholderText: "gateway" + } + } + } + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft + spacing: 8 + visible: root.isIPv4? true : false + Label { + id: dnslabel + font.pixelSize: 28 + color: '#080C0F' + text: "DNS address:" + Layout.preferredWidth: 200 + } + Label { + id: customdnslabel + font.pixelSize: 28 + color: root.isManualDNS? '#848286':'#0DF9FF' + text: "Auto" + Layout.preferredWidth: 80 + } + Switch { + id: dnsSwitch + scale: 0.5 + checked : root.isManualDNS + onCheckedChanged: { root.isManualDNS = checked } + } + Label { + id: autodnslabel + font.pixelSize: 28 + color: root.isManualDNS? '#0DF9FF':'#848286' + text: "Manual" + } + } + RowLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + spacing: 16 + visible: (root.isManualDNS && root.isIPv4)? true : false + ColumnLayout { + Layout.fillWidth: true + Label { + id: dnsList + font.pixelSize: 28 + color: '#080C0F' + text: "DNS list:" + } + TextField { + id: m_dnslist + font.pixelSize: 28 + Layout.fillWidth: true + placeholderText: "List DNS semicolon separated" + } + } + } + + Keyboard { + id: keyboard + Layout.fillWidth: true + Layout.fillHeight: true + Layout.preferredHeight: 1 + target: activeFocusControl + } + } + } +} diff --git a/app/wired/Wired.qml b/app/wired/Wired.qml index a200824..6e3e28b 100644 --- a/app/wired/Wired.qml +++ b/app/wired/Wired.qml @@ -15,9 +15,9 @@ * limitations under the License. */ -import QtQuick 2.6 +import QtQuick 2.11 import QtQuick.Layouts 1.1 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.4 import AGL.Demo.Controls 1.0 import ".." @@ -40,7 +40,7 @@ SettingPage { id: networkNameText text: service color: '#66FF99' - font.pixelSize: 48 + font.pixelSize: 38 font.bold: sstate === "ready" || sstate === "online" } @@ -52,6 +52,29 @@ SettingPage { color: "white" } } + Column { + anchors.left: networkName.right + anchors.leftMargin: 50 + Button { + visible: sstate === "ready" + || sstate === "online" + font.pixelSize: 18 + text: "CONFIGURE" + onClicked: { + customconf.open() + } + + ConfigDialog { + id: customconf + parent: Overlay.overlay + maxpwidth: 744 + maxpheight: 744 + xpos: (parent.width - maxpwidth)/2 + ypos: (parent.height - maxpheight) + serviceName: service + } + } + } onClicked: { if ((sstate === "ready") || sstate === "online") { console.log("Disconnecting from ->", service) @@ -88,6 +111,5 @@ SettingPage { onInputRequest: { console.log("Only unauthenticated access implemented for wired") } - } } diff --git a/app/wired/wired.qrc b/app/wired/wired.qrc index 71cc1b3..1abeee7 100644 --- a/app/wired/wired.qrc +++ b/app/wired/wired.qrc @@ -1,6 +1,7 @@ Wired.qml + ConfigDialog.qml images/HMI_Settings_WiredIcon.svg -- cgit 1.2.3-korg