diff options
Diffstat (limited to 'startupscreen/NetworkSettings')
-rw-r--r-- | startupscreen/NetworkSettings/CustomSwitch.qml | 114 | ||||
-rw-r--r-- | startupscreen/NetworkSettings/NetworkDelegate.qml | 117 | ||||
-rw-r--r-- | startupscreen/NetworkSettings/NetworkListView.qml | 115 | ||||
-rw-r--r-- | startupscreen/NetworkSettings/NetworkSettings.qml | 113 | ||||
-rw-r--r-- | startupscreen/NetworkSettings/NetworkSettingsPage.qml | 97 | ||||
-rw-r--r-- | startupscreen/NetworkSettings/PassphraseEnter.qml | 154 | ||||
-rw-r--r-- | startupscreen/NetworkSettings/QtButton.qml | 61 | ||||
-rw-r--r-- | startupscreen/NetworkSettings/ViewSettings.qml | 52 |
8 files changed, 823 insertions, 0 deletions
diff --git a/startupscreen/NetworkSettings/CustomSwitch.qml b/startupscreen/NetworkSettings/CustomSwitch.qml new file mode 100644 index 0000000..fa21d7f --- /dev/null +++ b/startupscreen/NetworkSettings/CustomSwitch.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 +import QtQuick.Controls + +Switch { + id: control + + property alias indicatorWidth: indicatorImg.width + property alias indicatorHeight: indicatorImg.height + + indicator: Image { + id: indicatorImg + width: 200 + height: 75 + sourceSize: Qt.size(width, height) + anchors.horizontalCenter: control.horizontalCenter + y: parent.height / 2 - height / 2 + source: "image://QtButton/10/#848895/transparent" + + Text { + id: offText + anchors.left: parent.left + anchors.leftMargin: parent.width * 0.075 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.55 + color: "#3b4155" + text: "OFF" + font.family: viewSettings.appFont + } + + Text { + id: onText + anchors.right: parent.right + anchors.rightMargin: parent.width * 0.1 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.55 + color: "#3b4155" + text: "ON" + font.family: viewSettings.appFont + } + + Binding { + target: qtHandle + property: "x" + value: control.checked ? indicatorImg.width - qtHandle.width - indicatorImg.width * 0.025 : indicatorImg.width * 0.025 + when: !mousearea.drag.active + } + + QtButton { + id: qtHandle + anchors.verticalCenter: parent.verticalCenter + width: parent.width * 0.475 + height: parent.height * 0.9 + fillColor: control.checked ? viewSettings.buttonGreenColor : viewSettings.buttonGrayColor + text: control.checked ? "ON" : "OFF" + borderColor: "transparent" + Behavior on x { + NumberAnimation { duration: 50 } + } + + MouseArea { + id: mousearea + anchors.fill: parent + drag.target: qtHandle + drag.axis: Drag.XAxis + drag.minimumX: indicatorImg.width * 0.005 + drag.maximumX: indicatorImg.width - width - indicatorImg.width * 0.005 + + onReleased: { + if (qtHandle.x > indicatorImg.width / 5 ) { + control.checked = true + } else { + control.checked = false + } + } + } + } + } +} diff --git a/startupscreen/NetworkSettings/NetworkDelegate.qml b/startupscreen/NetworkSettings/NetworkDelegate.qml new file mode 100644 index 0000000..1f352ed --- /dev/null +++ b/startupscreen/NetworkSettings/NetworkDelegate.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 2.0 +import QtDeviceUtilities.NetworkSettings + +Item { + id: networkDelegate + width: list.width + height: networkName.height * 3 + property alias nameLabelText: networkName.text + property alias ipLabelText: ipAddressLabel.text + property alias ipText: ipAddress.text + property bool isConnected: false + + signal clicked() + + Column { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + width: parent.width * 0.5 + + Text { + id: networkName + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + font.pixelSize: networkSettingsRoot.height * viewSettings.subTitleFontSize + font.family: viewSettings.appFont + color: isConnected ? viewSettings.buttonGreenColor : "white" + text: name + } + + Row { + id: ipRow + height: networkDelegate.height * 0.275 * opacity + spacing: networkDelegate.width * 0.0075 + Item { + width: viewSettings.margin(list.width) + height: 1 + } + + Text { + id: ipAddressLabel + height: parent.height + anchors.verticalCenter: parent.verticalCenter + text: qsTr("IP Address:") + color: isConnected ? viewSettings.buttonGreenColor : "white" + font.pixelSize: networkSettingsRoot.height * viewSettings.valueFontSize + font.family: viewSettings.appFont + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + } + + Text { + id: ipAddress + width: root.width * 0.15 + height: parent.height + anchors.verticalCenter: parent.verticalCenter + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + color: isConnected ? viewSettings.buttonGreenColor : "white" + text: qsTr("Not connected") + font.pixelSize: networkSettingsRoot.height * viewSettings.valueFontSize + font.family: viewSettings.appFont + font.styleName: isConnected ? "SemiBold" : "Regular" + } + } + } + + QtButton { + id: connectButton + fontFamily: viewSettings.appFont + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + fillColor: isConnected ? viewSettings.buttonGrayColor : viewSettings.buttonGreenColor + borderColor: "transparent" + text: isConnected ? qsTr("DISCONNECT") : qsTr("CONNECT") + enabled: true + onClicked: networkDelegate.clicked() + } + + Rectangle { + id: delegateBottom + width: networkDelegate.width + color: viewSettings.borderColor + height: 2 + anchors.bottom: networkDelegate.bottom + anchors.horizontalCenter: networkDelegate.horizontalCenter + } + + Behavior on height { NumberAnimation { duration: 200} } +} diff --git a/startupscreen/NetworkSettings/NetworkListView.qml b/startupscreen/NetworkSettings/NetworkListView.qml new file mode 100644 index 0000000..5ac722e --- /dev/null +++ b/startupscreen/NetworkSettings/NetworkListView.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 +import QtDeviceUtilities.NetworkSettings + + +Item { + id: root + + property var connectingService: null + property bool retryConnectAfterIdle: false + + Connections { + target: NetworkSettingsManager.userAgent + function onShowUserCredentialsInput() { + passphraseEnter.visible = true; + } + } + + function connectBySsid() { + passphraseEnter.showSsid = true + passphraseEnter.visible = true + } + + function connectingServiceStateChange() { + if (connectingService) { + if (connectingService.state === NetworkSettingsState.Failure) { + // If authentication failed, request connection again. That will + // initiate new passphrase request. + retryConnectAfterIdle = true + } else if (connectingService.state === NetworkSettingsState.Ready) { + // If connection succeeded, we no longer have service connecting + connectingService = null; + retryConnectAfterIdle = false; + } else if (connectingService.state === NetworkSettingsState.Idle) { + if (retryConnectAfterIdle) { + passphraseEnter.extraInfo = qsTr("Invalid passphrase"); + connectingService.connectService(); + } + retryConnectAfterIdle = false; + } + } + } + + NetworkDelegate { + id: manualConnectionPane + anchors.top: parent.top + anchors.right: parent.right + visible: wifiSwitch.checked + nameLabelText: qsTr("Manual connection") + ipLabelText: qsTr("Add a new connection manually") + ipText: "" + isConnected: false + onClicked: connectBySsid() + } + + ListView { + id: list + clip: true + focus: true + boundsBehavior: Flickable.DragOverBounds + model: NetworkSettingsManager.services + + anchors.top: manualConnectionPane.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + visible: wifiSwitch.checked + + delegate: NetworkDelegate { + isConnected: connected + ipText: isConnected ? NetworkSettingsManager.services.itemFromRow(index).ipv4.address + : (NetworkSettingsManager.services.itemFromRow(index).state === NetworkSettingsState.Idle) ? + qsTr("Not connected") : qsTr("Connecting") + onClicked: { + if (isConnected) { + NetworkSettingsManager.services.itemFromRow(index).disconnectService(); + } else { + root.connectingService = NetworkSettingsManager.services.itemFromRow(index) + if (root.connectingService) { + passphraseEnter.extraInfo = ""; + root.connectingService.connectService(); + root.connectingService.stateChanged.connect(connectingServiceStateChange); + } + } + } + } + } +} diff --git a/startupscreen/NetworkSettings/NetworkSettings.qml b/startupscreen/NetworkSettings/NetworkSettings.qml new file mode 100644 index 0000000..240dc25 --- /dev/null +++ b/startupscreen/NetworkSettings/NetworkSettings.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 +import QtDeviceUtilities.NetworkSettings + +Item { + id: networkSettingsRoot + anchors.fill: parent + + Component.onCompleted: NetworkSettingsManager.interfacesChanged() + + 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 + visible: wifiSwitch.visible + text: qsTr("WiFi") + font.pixelSize: networkSettingsRoot.height * viewSettings.subTitleFontSize + font.family: viewSettings.appFont + font.styleName: "SemiBold" + color: "white" + anchors.top: networkSettingsRoot.top + anchors.left: networkSettingsRoot.left + } + + CustomSwitch { + id: wifiSwitch + anchors.top: wlanText.bottom + anchors.left: wlanText.left + height: networkSettingsRoot.height * viewSettings.buttonHeight + indicatorWidth: networkSettingsRoot.height * viewSettings.buttonWidth + indicatorHeight: networkSettingsRoot.height * viewSettings.buttonHeight + checkable: visible && !wifiSwitchTimer.running + + onCheckedChanged: { + // Power on/off all WiFi interfaces + for (var i = 0; NetworkSettingsManager.interface(NetworkSettingsType.Wifi, i) !== null; i++) { + + NetworkSettingsManager.interface(NetworkSettingsType.Wifi, i).powered = checked + wifiSwitchTimer.start() + } + } + + // At least 1s between switching on/off + Timer { + id: wifiSwitchTimer + interval: 1000 + running: false + } + } + + Text { + id: networkListTextItem + text: qsTr("Available networks:") + font.pixelSize: networkSettingsRoot.height * viewSettings.subTitleFontSize + font.family: viewSettings.appFont + font.styleName: "SemiBold" + visible: wifiSwitch.checked + color: "white" + anchors.top: (wifiSwitch.visible === true) ? wifiSwitch.bottom : networkSettingsRoot.top + anchors.topMargin: font.pixelSize + } + + NetworkListView { + id: networkList + anchors.top: networkListTextItem.bottom + anchors.left: networkListTextItem.left + width: networkSettingsRoot.width + anchors.bottom: networkSettingsRoot.bottom + } + + // Popup for entering passphrase + PassphraseEnter { + id: passphraseEnter + } +} + diff --git a/startupscreen/NetworkSettings/NetworkSettingsPage.qml b/startupscreen/NetworkSettings/NetworkSettingsPage.qml new file mode 100644 index 0000000..f920145 --- /dev/null +++ b/startupscreen/NetworkSettings/NetworkSettingsPage.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 +import QtQuick.VirtualKeyboard + +Image { + id: root + anchors.fill: parent + source: "../assets/background.png" + + property int margin: viewSettings.margin(root.width) + + signal closed() + + ViewSettings { + id: viewSettings + } + + NetworkSettings { + anchors.margins: margin + } + + Image { + id: backButton + source: "../assets/icon_nok.png" + anchors.top: parent.top + anchors.right: parent.right + scale: 0.5 + opacity: 0.5 + MouseArea { + anchors.fill: parent + anchors.margins: -width + onPressed: backButton.scale = 0.4 + onReleased: backButton.scale = 0.5 + onClicked: loader.source = "" + } + } + + /* Keyboard input panel. + The keyboard is anchored to the bottom of the application. + */ + InputPanel { + id: inputPanel + z: 99 + y: root.height + anchors.left: root.left + anchors.right: root.right + + states: State { + name: "visible" + when: Qt.inputMethod.visible + PropertyChanges { + target: inputPanel + y: root.height - inputPanel.height + } + } + transitions: Transition { + from: "" + to: "visible" + reversible: true + ParallelAnimation { + NumberAnimation { + properties: "y" + duration: 250 + easing.type: Easing.InOutQuad + } + } + } + } +} + diff --git a/startupscreen/NetworkSettings/PassphraseEnter.qml b/startupscreen/NetworkSettings/PassphraseEnter.qml new file mode 100644 index 0000000..2068412 --- /dev/null +++ b/startupscreen/NetworkSettings/PassphraseEnter.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 +import QtQuick.Controls +import QtDeviceUtilities.NetworkSettings + +Image { + id: passphrasePopup + anchors.fill: parent + source: "../assets/background.png" + visible: false + + property string extraInfo: "" + property bool showSsid: false + property int margin: (width / 3 * 2) * 0.05 + property int spacing: margin * 0.5 + + onVisibleChanged: { + backButton.visible = !visible + if (!visible) { + networkSettingsRoot.forceActiveFocus() + } else { + if (showSsid) { + ssidField.forceActiveFocus() + } else { + passField.forceActiveFocus() + } + } + } + + Rectangle { + id: frame + color: "transparent" + border.color: viewSettings.borderColor + border.width: 3 + anchors.horizontalCenter: parent.horizontalCenter + y: inputPanel.y * .5 - height * .5 - margin + width: passphraseColumn.width * 1.1 + height: passphraseColumn.height * 1.1 + + Column { + id: passphraseColumn + anchors.centerIn: parent + spacing: passphrasePopup.spacing + + Text { + visible: showSsid + font.pixelSize: passphrasePopup.height * viewSettings.subTitleFontSize + font.family: viewSettings.appFont + color: "white" + text: qsTr("Enter SSID") + } + + TextField { + id: ssidField + visible: showSsid + width: passphrasePopup.width * 0.4 + height: passphrasePopup.height * 0.075 + color: "white" + background: Rectangle{ + color: "transparent" + border.color: ssidField.focus ? viewSettings.buttonGreenColor : viewSettings.buttonGrayColor + border.width: ssidField.focus ? width * 0.01 : 2 + } + } + + Text { + font.pixelSize: passphrasePopup.height * viewSettings.subTitleFontSize + font.family: viewSettings.appFont + color: "white" + text: qsTr("Enter Passphrase") + } + + Text { + font.pixelSize: passphrasePopup.height * viewSettings.valueFontSize + font.family: viewSettings.appFont + color: "red" + text: extraInfo + visible: extraInfo !== "" + } + + TextField { + id: passField + width: passphrasePopup.width * 0.4 + height: passphrasePopup.height * 0.075 + color: "white" + echoMode: TextInput.Password + background: Rectangle{ + color: "transparent" + border.color: passField.focus ? viewSettings.buttonGreenColor : viewSettings.buttonGrayColor + border.width: passField.focus ? width * 0.01 : 2 + } + } + + Row { + spacing: parent.width * 0.025 + + QtButton{ + id: setButton + text: qsTr("SET") + onClicked: { + if (showSsid) { + NetworkSettingsManager.connectBySsid(ssidField.text, passField.text) + showSsid = false + } else { + NetworkSettingsManager.userAgent.setPassphrase(passField.text) + } + passphrasePopup.visible = false; + } + } + + QtButton { + id: cancelButton + text: qsTr("CANCEL") + borderColor: "transparent" + fillColor: viewSettings.buttonGrayColor + onClicked: { + if (!showSsid) { + NetworkSettingsManager.userAgent.cancelInput() + } + showSsid = false + passphrasePopup.visible = false; + } + } + } + } + } +} diff --git a/startupscreen/NetworkSettings/QtButton.qml b/startupscreen/NetworkSettings/QtButton.qml new file mode 100644 index 0000000..e9f222e --- /dev/null +++ b/startupscreen/NetworkSettings/QtButton.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 + +Image { + id: root + width: buttonText.contentWidth + cutSize * 4 + source: "image://QtButton/" + cutSize + "/" + fillColor + "/" + borderColor + sourceSize: Qt.size(width, height) + + property string state: "enabled" + property int cutSize: 10 + property color fillColor: viewSettings.buttonGreenColor + property color borderColor: viewSettings.buttonGreenColor + property alias text: buttonText.text + property alias fontFamily: buttonText.font.family + + signal clicked() + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: root.clicked() + } + + Text { + id: buttonText + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: parent.height * 0.65 + font.family: viewSettings.appFont + color: "white" + } +} diff --git a/startupscreen/NetworkSettings/ViewSettings.qml b/startupscreen/NetworkSettings/ViewSettings.qml new file mode 100644 index 0000000..99c5a82 --- /dev/null +++ b/startupscreen/NetworkSettings/ViewSettings.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $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 + +QtObject { + id: viewSettings + readonly property string appFont: "Titillium Web" + readonly property color backgroundColor: "#00414a" + readonly property color borderColor: "#9d9faa" + readonly property color buttonGreenColor: "#2cde85" + readonly property color buttonGrayColor: "#9d9faa" + readonly property color buttonActiveColor: "#216729" + readonly property color scrollBarColor: "#2cde85" + + readonly property real spacing: 0.5 + readonly property real titleFontSize: 0.04 + readonly property real subTitleFontSize: 0.035 + readonly property real valueFontSize: 0.025 + readonly property real fieldHeight: 0.07 + readonly property real fieldTextHeight: 0.05 + readonly property real buttonHeight: 0.05 + + function margin(width) { + return (width / 3 * 2) * 0.05; + } +} |