From 646345f62ee45cc057e8af94f9703b46c705eeec Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 9 Feb 2023 14:03:09 +0000 Subject: [PATCH 01/16] add wifi page by Magnefire Essentially an updated version of f4a795b2a69c3325f3ed7d847226762619c78e4d from https://github.com/magnefire/asteroid-settings original commit info below: Author: MagneFire Date: Thu Feb 4 22:52:23 2021 +0100 [WIP] WiFi: Add WiFi page. CUrrently consists of: - Toggle WiFi on/off. - Scan for WiFi networks when adapter powered. - Testing for key input (InputPanel, too small needs tweaking). - Show list of scanned WiFi networks. --- src/qml/WiFiPage.qml | 124 +++++++++++++++++++++++++++++++++++++++++++ src/qml/main.qml | 50 +++++++++++++++++ src/resources.qrc | 1 + 3 files changed, 175 insertions(+) create mode 100644 src/qml/WiFiPage.qml diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml new file mode 100644 index 00000000..08356406 --- /dev/null +++ b/src/qml/WiFiPage.qml @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2021 - Darrel Griët + * Copyright (C) 2016 - Sylvia van Os + * Copyright (C) 2015 - Florent Revest + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.9 +import org.asteroid.controls 1.0 +import org.asteroid.utils 1.0 +import Connman 0.2 +import QtQuick.VirtualKeyboard 2.4 + +Item { + TechnologyModel { + id: wifiModel + name: "wifi" + onCountChanged: { + console.log("COUNT CHANGE " + count) + } + onScanRequestFinished: { + console.log("SCAN FINISH") + } + } + + NetworkTechnology { + id: wifiStatus + path: "/net/connman/technology/wifi" + onPoweredChanged: { + console.log("POWER CHANGE ") + powered + if (powered) + wifiModel.requestScan() + } + } + + InputPanel { + id: inputPanel + z: 99 + visible: active + anchors.left: parent.left + anchors.top: parent.top + anchors.topMargin: -Dims.h(25) + height: Dims.h(100) + + width: Dims.w(100) + externalLanguageSwitchEnabled: false + } + + + ListView { + model: wifiModel + visible: wifiStatus.powered + anchors.fill: parent + anchors.leftMargin: Dims.l(15) + anchors.rightMargin: Dims.l(15) + header: Item {height: Dims.h(15)} + footer: Item {height: Dims.h(15)} + + delegate: Item { + property var wifiName: modelData.name + width: parent.width + height: Dims.h(16) + Label { + id: btName + text: wifiName + } + Label { + anchors.top: btName.bottom + opacity: 0.8 + font.pixelSize: Dims.l(5) + font.weight: Font.Thin + text: { + if (modelData.connected) { + "Connected" + } else { + "Not set up" + } + } + } + } + } + + StatusPage { + //% "WiFi on" + property string bluetoothOnStr: qsTrId("id-wifi-on") + //% "WiFi off" + property string bluetoothOffStr: qsTrId("id-wifi-off") + //% "Connected" + property string connectedStr: qsTrId("id-connected") + //% "Not connected" + property string notConnectedStr: qsTrId("id-disconnected") + text: "

" + (wifiStatus.powered ? bluetoothOnStr : bluetoothOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) + icon: wifiStatus.powered ? "ios-wifi" : "ios-wifi-outline" + clickable: true + onClicked: wifiStatus.powered = !wifiStatus.powered + activeBackground: wifiStatus.powered + } + + TextField { + id: titleField + width: Dims.w(80) + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: Dims.h(25) + //% "Title" + previewText: qsTrId("id-title-field") + /*onTextChanged: { + console.log("OH "+text); + }*/ + } +} + diff --git a/src/qml/main.qml b/src/qml/main.qml index 6ebdfd87..03a6b600 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -33,6 +33,7 @@ Application { Component { id: timezoneLayer; TimezonePage { } } Component { id: languageLayer; LanguagePage { } } Component { id: bluetoothLayer; BluetoothPage { } } + Component { id: wifiLayer; WiFiPage { } } Component { id: displayLayer; DisplayPage { } } Component { id: soundLayer; SoundPage { } } Component { id: nightstandLayer; NightstandPage { } } @@ -141,6 +142,55 @@ Application { iconName: "ios-bluetooth-outline" onClicked: layerStack.push(bluetoothLayer) } + ListItem { + //% "WiFi" + title: qsTrId("id-wifi-page") + iconName: "ios-wifi-outline" + onClicked: layerStack.push(wifiLayer) + } + ListItem { + //% "Display" + title: qsTrId("id-display-page") + iconName: "ios-sunny-outline" + onClicked: layerStack.push(displayLayer) + } + ListItem { + //% "Sound" + title: qsTrId("id-sound-page") + iconName: "ios-volume-up" + onClicked: layerStack.push(soundLayer) + visible: DeviceInfo.hasSpeaker + } + ListItem { + //% "Nightstand" + title: qsTrId("id-nightstand-page") + iconName: "ios-moon-outline" + onClicked: layerStack.push(nightstandLayer) + } + ListItem { + //% "Units" + title: qsTrId("id-units-page") + iconName: "ios-speedometer-outline" + onClicked: layerStack.push(unitsLayer) + } + ListItem { + //% "Wallpaper" + title: qsTrId("id-wallpaper-page") + iconName: "ios-images-outline" + onClicked: layerStack.push(wallpaperLayer) + } + ListItem { + //% "Watchface" + title: qsTrId("id-watchface-page") + iconName: "ios-color-wand-outline" + onClicked: layerStack.push(watchfaceLayer) + } + ListItem { + //% "Launcher" + title: qsTrId("id-launcher-page") + iconName: "ios-apps-outline" + onClicked: layerStack.push(launcherLayer) + } ListItem { //% "USB" title: qsTrId("id-usb-page") diff --git a/src/resources.qrc b/src/resources.qrc index 46916774..be1f34c3 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -14,6 +14,7 @@ qml/WallpaperPage.qml qml/WatchfacePage.qml qml/WatchfaceSelector.qml + qml/WiFiPage.qml qml/LauncherPage.qml qml/USBPage.qml qml/PowerPage.qml From cc71d996e8a4ccbc5e4a8104e92e0edda6a514ea Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Mon, 6 Mar 2023 23:40:35 +0000 Subject: [PATCH 02/16] Visually clean up the wifi page. Wifi can be turned on or off, and networks show up in a list. There is currently no capability of connecting to wifi networks. --- src/qml/WiFiPage.qml | 100 +++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 46 deletions(-) diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index 08356406..79e84b24 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -45,30 +45,67 @@ Item { } } - InputPanel { - id: inputPanel - z: 99 - visible: active - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: -Dims.h(25) - height: Dims.h(100) - - width: Dims.w(100) - externalLanguageSwitchEnabled: false - } - - ListView { + id: wifiList model: wifiModel - visible: wifiStatus.powered anchors.fill: parent anchors.leftMargin: Dims.l(15) anchors.rightMargin: Dims.l(15) - header: Item {height: Dims.h(15)} - footer: Item {height: Dims.h(15)} + + header: Item { //this is just an asteroid statuspage, modified to collapse when wifi is toggled. + height: wifiStatus.powered ? Dims.h(60) : wifiList.height + Behavior on height { NumberAnimation { duration: 100 } } + + width: Dims.w(100) + anchors.horizontalCenter: parent.horizontalCenter + Rectangle { + id: statusBackground + anchors.centerIn: parent + anchors.verticalCenterOffset: -parent.height*0.13 + color: "black" + radius: width/2 + opacity: wifiStatus.powered ? 0.4 : 0.2 + width: parent.width*0.25 + height: width + } + Icon { + id: statusIcon + anchors.fill: statusBackground + anchors.margins: parent.width*0.03 + name: wifiStatus.powered ? "ios-wifi" : "ios-wifi-outline" + } + MouseArea { + id: statusMA + enabled: true + anchors.fill: statusBackground + onClicked: wifiStatus.powered = !wifiStatus.powered + } + + Label { + id: statusLabel + //% "WiFi on" + property string wifiOnStr: qsTrId("id-wifi-on") + //% "WiFi off" + property string wifiOffStr: qsTrId("id-wifi-off") + //% "Connected" + property string connectedStr: qsTrId("id-connected") + //% "Not connected" + property string notConnectedStr: qsTrId("id-disconnected") + text: "

" + (wifiStatus.powered ? wifiOnStr : wifiOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) + font.pixelSize: parent.width*0.05 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + anchors.left: parent.left; anchors.right: parent.right + anchors.leftMargin: parent.width*0.04; anchors.rightMargin: anchors.leftMargin + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.width*0.15 + } + } + footer: Item {height: wifiStatus.powered ? Dims.h(15) : 0} delegate: Item { + visible: wifiStatus.powered property var wifiName: modelData.name width: parent.width height: Dims.h(16) @@ -91,34 +128,5 @@ Item { } } } - - StatusPage { - //% "WiFi on" - property string bluetoothOnStr: qsTrId("id-wifi-on") - //% "WiFi off" - property string bluetoothOffStr: qsTrId("id-wifi-off") - //% "Connected" - property string connectedStr: qsTrId("id-connected") - //% "Not connected" - property string notConnectedStr: qsTrId("id-disconnected") - text: "

" + (wifiStatus.powered ? bluetoothOnStr : bluetoothOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) - icon: wifiStatus.powered ? "ios-wifi" : "ios-wifi-outline" - clickable: true - onClicked: wifiStatus.powered = !wifiStatus.powered - activeBackground: wifiStatus.powered - } - - TextField { - id: titleField - width: Dims.w(80) - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: Dims.h(25) - //% "Title" - previewText: qsTrId("id-title-field") - /*onTextChanged: { - console.log("OH "+text); - }*/ - } } From 995125873d8172a612f1941bfb99c8acad0595cb Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sun, 2 Apr 2023 18:23:43 +0100 Subject: [PATCH 03/16] Add login dialogue to wifi page --- src/qml/WiFiPage.qml | 265 +++++++++++++++++++++++++++++++++---------- 1 file changed, 203 insertions(+), 62 deletions(-) diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index 79e84b24..5fa5dac6 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -1,7 +1,9 @@ /* - * Copyright (C) 2021 - Darrel Griët - * Copyright (C) 2016 - Sylvia van Os - * Copyright (C) 2015 - Florent Revest + * Copyright (C) 2023 - Arseniy Movshev + * 2017-2022 - Chupligin Sergey + * 2021 - Darrel Griët + * 2016 - Sylvia van Os + * 2015 - Florent Revest * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,6 +19,9 @@ * along with this program. If not, see . */ +/* A large proportion of this code has been referenced from Nemomobile-UX Glacier-Settings, published at https://github.com/nemomobile-ux/glacier-settings/blob/master/src/plugins/wifi/WifiSettings.qml + */ + import QtQuick 2.9 import org.asteroid.controls 1.0 import org.asteroid.utils 1.0 @@ -24,6 +29,7 @@ import Connman 0.2 import QtQuick.VirtualKeyboard 2.4 Item { + id: root TechnologyModel { id: wifiModel name: "wifi" @@ -45,78 +51,95 @@ Item { } } + InputPanel { + id: inputPanel + z: 99 + visible: active + anchors.left: parent.left + anchors.top: parent.top + anchors.topMargin: -Dims.h(25) + height: Dims.h(100) + + width: Dims.w(100) + externalLanguageSwitchEnabled: false + } + + ListView { id: wifiList model: wifiModel - anchors.fill: parent - anchors.leftMargin: Dims.l(15) - anchors.rightMargin: Dims.l(15) - - header: Item { //this is just an asteroid statuspage, modified to collapse when wifi is toggled. - height: wifiStatus.powered ? Dims.h(60) : wifiList.height - Behavior on height { NumberAnimation { duration: 100 } } - - width: Dims.w(100) - anchors.horizontalCenter: parent.horizontalCenter - Rectangle { - id: statusBackground - anchors.centerIn: parent - anchors.verticalCenterOffset: -parent.height*0.13 - color: "black" - radius: width/2 - opacity: wifiStatus.powered ? 0.4 : 0.2 - width: parent.width*0.25 - height: width - } - Icon { - id: statusIcon - anchors.fill: statusBackground - anchors.margins: parent.width*0.03 - name: wifiStatus.powered ? "ios-wifi" : "ios-wifi-outline" - } - MouseArea { - id: statusMA - enabled: true - anchors.fill: statusBackground - onClicked: wifiStatus.powered = !wifiStatus.powered - } + width: parent.width*0.7 + anchors.horizontalCenter: parent.horizontalCenter + height: Dims.h(100) + header: Column { + width: parent.width + Item { + //this is literally a statuspage + width: root.width + height: wifiStatus.powered ? width*0.6 : root.height + Behavior on height { NumberAnimation { duration: 100 } } + anchors.horizontalCenter: parent.horizontalCenter + Rectangle { + id: statusIconBackground + anchors.centerIn: parent + anchors.verticalCenterOffset: -parent.width*0.13 + color: "black" + radius: width/2 + opacity: wifiStatus.powered ? 0.4 : 0.2 + width: parent.width*0.25 + height: width + Icon { + id: statusIcon + anchors.fill: statusIconBackground + anchors.margins: parent.width*0.12 + name: wifiStatus.powered ? "ios-wifi" : "ios-wifi-outline" + } + MouseArea { + id: statusMA + enabled: true + anchors.fill: parent + onClicked: wifiStatus.powered = !wifiStatus.powered + } + } - Label { - id: statusLabel - //% "WiFi on" - property string wifiOnStr: qsTrId("id-wifi-on") - //% "WiFi off" - property string wifiOffStr: qsTrId("id-wifi-off") - //% "Connected" - property string connectedStr: qsTrId("id-connected") - //% "Not connected" - property string notConnectedStr: qsTrId("id-disconnected") - text: "

" + (wifiStatus.powered ? wifiOnStr : wifiOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) - font.pixelSize: parent.width*0.05 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap - anchors.left: parent.left; anchors.right: parent.right - anchors.leftMargin: parent.width*0.04; anchors.rightMargin: anchors.leftMargin - anchors.verticalCenter: parent.verticalCenter - anchors.verticalCenterOffset: parent.width*0.15 + + Label { + id: statusLabel + font.pixelSize: parent.width*0.07 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + anchors.left: parent.left; anchors.right: parent.right + anchors.leftMargin: parent.width*0.04; anchors.rightMargin: anchors.leftMargin + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.width*0.15 + //% "WiFi on" + property string bluetoothOnStr: qsTrId("id-wifi-on") + //% "WiFi off" + property string bluetoothOffStr: qsTrId("id-wifi-off") + //% "Connected" + property string connectedStr: qsTrId("id-connected") + //% "Not connected" + property string notConnectedStr: qsTrId("id-disconnected") + text: "

" + (wifiStatus.powered ? bluetoothOnStr : bluetoothOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) + } } } - footer: Item {height: wifiStatus.powered ? Dims.h(15) : 0} + footer: Item {height: wifiStatus.powered ? parent.height*0.15 : 0} - delegate: Item { - visible: wifiStatus.powered + delegate: MouseArea { property var wifiName: modelData.name - width: parent.width - height: Dims.h(16) + visible: wifiStatus.powered + width: wifiList.width + height: width*0.23 Label { - id: btName + id: wifiNameLabel text: wifiName } Label { - anchors.top: btName.bottom + anchors.top: wifiNameLabel.bottom opacity: 0.8 - font.pixelSize: Dims.l(5) + font.pixelSize: parent.width*0.07 font.weight: Font.Thin text: { if (modelData.connected) { @@ -126,6 +149,124 @@ Item { } } } + onClicked: { + if (true) { + layerStack.push(firstTimeConnectDialog, {modelData: modelData}) + } else { + layerStack.push(dialog) + } + } + } + } + + + + Component { + id: firstTimeConnectDialog + Item { + id: dialogItem + property var modelData + + UserAgent { + id: userAgent + onUserInputRequested: { + var view = { + "fields": [] + }; + for (var key in fields) { + view.fields.push({ + "name": key, + "id": key.toLowerCase(), + "type": fields[key]["Type"], + "requirement": fields[key]["Requirement"] + }); + console.log(key + ":"); + for (var inkey in fields[key]) { + console.log(" " + inkey + ": " + fields[key][inkey]); + } + } + userAgent.sendUserReply({"Passphrase": passphraseField.text}) + } + + onErrorReported: { + console.log("Got error from model: " + error); + failDialog.subLabelText = error; + failDialog.open(); + } + } + Connections { + target: modelData + function onConnectRequestFailed(error) { + console.log(error) + } + + function onConnectedChanged(connected) { + if(connected) { + layerStack.pop(layerStack.currentLayer); + } + } + } + Flickable { + anchors.fill: parent + anchors.margins: Dims.l(15) + contentHeight: contentColumn.implicitHeight + Column { + id: contentColumn + width: parent.width + Item {height: dialogItem.height*0.15; width: parent.width} + Label{ + text: modelData.name + font.pixelSize: Dims.l(6) + } + Label{ + id: identityLabel + text: qsTr("Login")+":" + font.pixelSize: Dims.l(6) + visible: modelData.securityType === NetworkService.SecurityIEEE802 + } + + TextField{ + id: identityField + text: modelData.identity + width: parent.width + visible: modelData.securityType === NetworkService.SecurityIEEE802 + } + + Label{ + id: passphraseLabel + text: qsTr("Password")+":" + font.pixelSize: Dims.l(6) + visible: !(modelData.securityType == NetworkService.SecurityNone) + } + + TextField{ + id: passphraseField + text: modelData.passphrase + echoMode: TextInput.Password //smartwatches are hard to type on. it is worth adding a 'show password' button for this field + width: parent.width + visible: !(modelData.securityType == NetworkService.SecurityNone) + } + LabeledSwitch { + id: autoConnectCheckBox + width: parent.width + height: Dims.l(20) + text: "autoconnect" + } + + IconButton { + iconName: "ios-checkmark-circle" + height: width + width: parent.width*0.3 + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + modelData.passphrase = passphraseField.text; + modelData.identity = identityField.text + modelData.autoConnect = autoConnectCheckBox.checked + modelData.requestConnect(); + } + } + } + } } } } From bc739c989a17a9d4e7ed9cae36584d9ee5e852ee Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sun, 2 Apr 2023 18:35:58 +0100 Subject: [PATCH 04/16] Split off connection dialog into its own file, to improve code readability --- src/qml/WiFiConnectionDialog.qml | 148 ++++++++++++++++++++ src/qml/WiFiPage.qml | 230 +++++++------------------------ src/resources.qrc | 1 + 3 files changed, 201 insertions(+), 178 deletions(-) create mode 100644 src/qml/WiFiConnectionDialog.qml diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml new file mode 100644 index 00000000..d492cbcd --- /dev/null +++ b/src/qml/WiFiConnectionDialog.qml @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2023 - Arseniy Movshev + * 2017-2022 - Chupligin Sergey + * 2021 - Darrel Griët + * 2016 - Sylvia van Os + * 2015 - Florent Revest + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* A large proportion of this code has been referenced from Nemomobile-UX Glacier-Settings, published at https://github.com/nemomobile-ux/glacier-settings/blob/master/src/plugins/wifi/WifiSettings.qml + */ + +import QtQuick 2.9 +import org.asteroid.controls 1.0 +import org.asteroid.utils 1.0 +import Connman 0.2 +import QtQuick.VirtualKeyboard 2.4 + +Item { + id: dialogItem + property var modelData + + InputPanel { + id: inputPanel + z: 99 + visible: active + anchors.left: parent.left + anchors.top: parent.top + anchors.topMargin: -Dims.h(25) + height: Dims.h(100) + + width: Dims.w(100) + externalLanguageSwitchEnabled: false + } + + UserAgent { + id: userAgent + onUserInputRequested: { + var view = { + "fields": [] + }; + for (var key in fields) { + view.fields.push({ + "name": key, + "id": key.toLowerCase(), + "type": fields[key]["Type"], + "requirement": fields[key]["Requirement"] + }); + console.log(key + ":"); + for (var inkey in fields[key]) { + console.log(" " + inkey + ": " + fields[key][inkey]); + } + } + userAgent.sendUserReply({"Passphrase": passphraseField.text}) + } + + onErrorReported: { + console.log("Got error from model: " + error); + failDialog.subLabelText = error; + failDialog.open(); + } + } + Connections { + target: modelData + function onConnectRequestFailed(error) { + console.log(error) + } + + function onConnectedChanged(connected) { + if(connected) { + layerStack.pop(layerStack.currentLayer); + } + } + } + Flickable { + anchors.fill: parent + anchors.margins: Dims.l(15) + contentHeight: contentColumn.implicitHeight + Column { + id: contentColumn + width: parent.width + Item {height: dialogItem.height*0.15; width: parent.width} + Label { + text: modelData.name + font.pixelSize: Dims.l(6) + } + Label { + id: identityLabel + text: qsTr("Login")+":" + font.pixelSize: Dims.l(6) + visible: modelData.securityType === NetworkService.SecurityIEEE802 + } + + TextField { + id: identityField + text: modelData.identity + width: parent.width + visible: modelData.securityType === NetworkService.SecurityIEEE802 + } + + Label { + id: passphraseLabel + text: qsTr("Password")+":" + font.pixelSize: Dims.l(6) + visible: !(modelData.securityType == NetworkService.SecurityNone) + } + + TextField { + id: passphraseField + text: modelData.passphrase + echoMode: TextInput.Password //smartwatches are hard to type on. it is worth adding a 'show password' button for this field + width: parent.width + visible: !(modelData.securityType == NetworkService.SecurityNone) + } + LabeledSwitch { + id: autoConnectCheckBox + width: parent.width + height: Dims.l(20) + text: "autoconnect" + } + + IconButton { + iconName: "ios-checkmark-circle" + height: width + width: parent.width*0.3 + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + modelData.passphrase = passphraseField.text; + modelData.identity = identityField.text + modelData.autoConnect = autoConnectCheckBox.checked + modelData.requestConnect(); + } + } + } + } +} diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index 5fa5dac6..fd7dcec0 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -51,80 +51,64 @@ Item { } } - InputPanel { - id: inputPanel - z: 99 - visible: active - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: -Dims.h(25) - height: Dims.h(100) - - width: Dims.w(100) - externalLanguageSwitchEnabled: false - } - - ListView { id: wifiList model: wifiModel width: parent.width*0.7 anchors.horizontalCenter: parent.horizontalCenter - height: Dims.h(100) - header: Column { - width: parent.width - Item { - //this is literally a statuspage - width: root.width - height: wifiStatus.powered ? width*0.6 : root.height - Behavior on height { NumberAnimation { duration: 100 } } - anchors.horizontalCenter: parent.horizontalCenter - Rectangle { - id: statusIconBackground - anchors.centerIn: parent - anchors.verticalCenterOffset: -parent.width*0.13 - color: "black" - radius: width/2 - opacity: wifiStatus.powered ? 0.4 : 0.2 - width: parent.width*0.25 - height: width - Icon { - id: statusIcon - anchors.fill: statusIconBackground - anchors.margins: parent.width*0.12 - name: wifiStatus.powered ? "ios-wifi" : "ios-wifi-outline" - } - MouseArea { - id: statusMA - enabled: true - anchors.fill: parent - onClicked: wifiStatus.powered = !wifiStatus.powered - } + height: parent.height + header: Item { + //this is literally a statuspage + width: root.width + height: wifiStatus.powered ? width*0.6 : root.height + Behavior on height { NumberAnimation { duration: 100 } } + anchors.horizontalCenter: parent.horizontalCenter + Rectangle { + id: statusIconBackground + anchors.centerIn: parent + anchors.verticalCenterOffset: -parent.width*0.13 + color: "black" + radius: width/2 + opacity: wifiStatus.powered ? 0.4 : 0.2 + width: parent.width*0.25 + height: width + Icon { + id: statusIcon + anchors.fill: statusIconBackground + anchors.margins: parent.width*0.12 + name: wifiStatus.powered ? "ios-wifi" : "ios-wifi-outline" } + MouseArea { + id: statusMA + enabled: true + anchors.fill: parent + onClicked: wifiStatus.powered = !wifiStatus.powered + } + } - Label { - id: statusLabel - font.pixelSize: parent.width*0.07 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap - anchors.left: parent.left; anchors.right: parent.right - anchors.leftMargin: parent.width*0.04; anchors.rightMargin: anchors.leftMargin - anchors.verticalCenter: parent.verticalCenter - anchors.verticalCenterOffset: parent.width*0.15 - //% "WiFi on" - property string bluetoothOnStr: qsTrId("id-wifi-on") - //% "WiFi off" - property string bluetoothOffStr: qsTrId("id-wifi-off") - //% "Connected" - property string connectedStr: qsTrId("id-connected") - //% "Not connected" - property string notConnectedStr: qsTrId("id-disconnected") - text: "

" + (wifiStatus.powered ? bluetoothOnStr : bluetoothOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) - } + Label { + id: statusLabel + font.pixelSize: parent.width*0.07 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + anchors.left: parent.left; anchors.right: parent.right + anchors.leftMargin: parent.width*0.04; anchors.rightMargin: anchors.leftMargin + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.width*0.15 + //% "WiFi on" + property string bluetoothOnStr: qsTrId("id-wifi-on") + //% "WiFi off" + property string bluetoothOffStr: qsTrId("id-wifi-off") + //% "Connected" + property string connectedStr: qsTrId("id-connected") + //% "Not connected" + property string notConnectedStr: qsTrId("id-disconnected") + text: "

" + (wifiStatus.powered ? bluetoothOnStr : bluetoothOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) } } + footer: Item {height: wifiStatus.powered ? parent.height*0.15 : 0} delegate: MouseArea { @@ -150,124 +134,14 @@ Item { } } onClicked: { - if (true) { - layerStack.push(firstTimeConnectDialog, {modelData: modelData}) - } else { - layerStack.push(dialog) - } - } + layerStack.push(connectionDialog, {modelData: modelData}) + } } } - - Component { - id: firstTimeConnectDialog - Item { - id: dialogItem - property var modelData - - UserAgent { - id: userAgent - onUserInputRequested: { - var view = { - "fields": [] - }; - for (var key in fields) { - view.fields.push({ - "name": key, - "id": key.toLowerCase(), - "type": fields[key]["Type"], - "requirement": fields[key]["Requirement"] - }); - console.log(key + ":"); - for (var inkey in fields[key]) { - console.log(" " + inkey + ": " + fields[key][inkey]); - } - } - userAgent.sendUserReply({"Passphrase": passphraseField.text}) - } - - onErrorReported: { - console.log("Got error from model: " + error); - failDialog.subLabelText = error; - failDialog.open(); - } - } - Connections { - target: modelData - function onConnectRequestFailed(error) { - console.log(error) - } - - function onConnectedChanged(connected) { - if(connected) { - layerStack.pop(layerStack.currentLayer); - } - } - } - Flickable { - anchors.fill: parent - anchors.margins: Dims.l(15) - contentHeight: contentColumn.implicitHeight - Column { - id: contentColumn - width: parent.width - Item {height: dialogItem.height*0.15; width: parent.width} - Label{ - text: modelData.name - font.pixelSize: Dims.l(6) - } - Label{ - id: identityLabel - text: qsTr("Login")+":" - font.pixelSize: Dims.l(6) - visible: modelData.securityType === NetworkService.SecurityIEEE802 - } - - TextField{ - id: identityField - text: modelData.identity - width: parent.width - visible: modelData.securityType === NetworkService.SecurityIEEE802 - } - - Label{ - id: passphraseLabel - text: qsTr("Password")+":" - font.pixelSize: Dims.l(6) - visible: !(modelData.securityType == NetworkService.SecurityNone) - } - - TextField{ - id: passphraseField - text: modelData.passphrase - echoMode: TextInput.Password //smartwatches are hard to type on. it is worth adding a 'show password' button for this field - width: parent.width - visible: !(modelData.securityType == NetworkService.SecurityNone) - } - LabeledSwitch { - id: autoConnectCheckBox - width: parent.width - height: Dims.l(20) - text: "autoconnect" - } - - IconButton { - iconName: "ios-checkmark-circle" - height: width - width: parent.width*0.3 - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - modelData.passphrase = passphraseField.text; - modelData.identity = identityField.text - modelData.autoConnect = autoConnectCheckBox.checked - modelData.requestConnect(); - } - } - } - } - } + id: connectionDialog + WiFiConnectionDialog {} } } diff --git a/src/resources.qrc b/src/resources.qrc index be1f34c3..76ae05b9 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -14,6 +14,7 @@ qml/WallpaperPage.qml qml/WatchfacePage.qml qml/WatchfaceSelector.qml + qml/WiFiConnectionDialog.qml qml/WiFiPage.qml qml/LauncherPage.qml qml/USBPage.qml From 13f682823ae18d4b2188ba8ab57aca9d3b7aaa0f Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sun, 2 Apr 2023 19:07:00 +0100 Subject: [PATCH 05/16] Fix spacing --- src/qml/WiFiPage.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index fd7dcec0..1350d1e0 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -109,13 +109,13 @@ Item { } } - footer: Item {height: wifiStatus.powered ? parent.height*0.15 : 0} + footer: Item {height: wifiStatus.powered ? root.height*0.15 : 0; width: parent.width} delegate: MouseArea { property var wifiName: modelData.name visible: wifiStatus.powered width: wifiList.width - height: width*0.23 + height: wifiStatus.powered ? width*0.23 : 0 Label { id: wifiNameLabel text: wifiName From 512b10a2aebbc58fb1d11406d5a5edecfdeb10b5 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Mon, 3 Apr 2023 00:14:01 +0100 Subject: [PATCH 06/16] Differentiate between saved and available networks --- src/qml/WiFiPage.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index 1350d1e0..eb8e2f14 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -128,6 +128,8 @@ Item { text: { if (modelData.connected) { "Connected" + } else if (modelData.favorite){ + "Saved" } else { "Not set up" } From d6f838c08f9bdf10e3c3c462f33f94357b7f0417 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Mon, 3 Apr 2023 00:23:45 +0100 Subject: [PATCH 07/16] Add specific behaviours for saved or connected networks - tapping on a saved network initiates a connection - opening the settings on a saved or connected network won't show the login fields --- src/qml/WiFiConnectionDialog.qml | 59 ++++++++++++++++++-------------- src/qml/WiFiPage.qml | 4 +++ 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index d492cbcd..ae35e414 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -96,33 +96,38 @@ Item { text: modelData.name font.pixelSize: Dims.l(6) } - Label { - id: identityLabel - text: qsTr("Login")+":" - font.pixelSize: Dims.l(6) - visible: modelData.securityType === NetworkService.SecurityIEEE802 - } - - TextField { - id: identityField - text: modelData.identity + Column { + id: loginFieldsColumn width: parent.width - visible: modelData.securityType === NetworkService.SecurityIEEE802 - } + visible: !(modelData.connected || modelData.favorite) + Label { + id: identityLabel + text: qsTr("Login")+":" + font.pixelSize: Dims.l(6) + visible: modelData.securityType === NetworkService.SecurityIEEE802 + } - Label { - id: passphraseLabel - text: qsTr("Password")+":" - font.pixelSize: Dims.l(6) - visible: !(modelData.securityType == NetworkService.SecurityNone) - } + TextField { + id: identityField + text: modelData.identity + width: parent.width + visible: modelData.securityType === NetworkService.SecurityIEEE802 + } - TextField { - id: passphraseField - text: modelData.passphrase - echoMode: TextInput.Password //smartwatches are hard to type on. it is worth adding a 'show password' button for this field - width: parent.width - visible: !(modelData.securityType == NetworkService.SecurityNone) + Label { + id: passphraseLabel + text: qsTr("Password")+":" + font.pixelSize: Dims.l(6) + visible: !(modelData.securityType == NetworkService.SecurityNone) + } + + TextField { + id: passphraseField + text: modelData.passphrase + echoMode: TextInput.Password //smartwatches are hard to type on. it is worth adding a 'show password' button for this field + width: parent.width + visible: !(modelData.securityType == NetworkService.SecurityNone) + } } LabeledSwitch { id: autoConnectCheckBox @@ -137,8 +142,10 @@ Item { width: parent.width*0.3 anchors.horizontalCenter: parent.horizontalCenter onClicked: { - modelData.passphrase = passphraseField.text; - modelData.identity = identityField.text + if(!modelData.connected) { + modelData.passphrase = passphraseField.text; + modelData.identity = identityField.text + } modelData.autoConnect = autoConnectCheckBox.checked modelData.requestConnect(); } diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index eb8e2f14..581a09f7 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -136,7 +136,11 @@ Item { } } onClicked: { + if (modelData.favorite && !modelData.connected) { + modelData.requestConnect() + } else { layerStack.push(connectionDialog, {modelData: modelData}) + } } } } From 859dd99687007147eb9f452f8767506f187856bc Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Mon, 3 Apr 2023 01:33:27 +0100 Subject: [PATCH 08/16] Add status info and settings to connection page - add ip address on current network - add 'disconnect' button - add 'remove' button --- src/qml/WiFiConnectionDialog.qml | 83 ++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 10 deletions(-) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index ae35e414..32c19d1f 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -1,5 +1,6 @@ /* * Copyright (C) 2023 - Arseniy Movshev + * 2022 - Ed Beroset * 2017-2022 - Chupligin Sergey * 2021 - Darrel Griët * 2016 - Sylvia van Os @@ -50,26 +51,26 @@ Item { onUserInputRequested: { var view = { "fields": [] - }; + } for (var key in fields) { view.fields.push({ "name": key, "id": key.toLowerCase(), "type": fields[key]["Type"], "requirement": fields[key]["Requirement"] - }); - console.log(key + ":"); + }) + console.log(key + ":") for (var inkey in fields[key]) { - console.log(" " + inkey + ": " + fields[key][inkey]); + console.log(" " + inkey + ": " + fields[key][inkey]) } } userAgent.sendUserReply({"Passphrase": passphraseField.text}) } onErrorReported: { - console.log("Got error from model: " + error); - failDialog.subLabelText = error; - failDialog.open(); + console.log("Got error from model: " + error) + failDialog.subLabelText = error + failDialog.open() } } Connections { @@ -80,7 +81,7 @@ Item { function onConnectedChanged(connected) { if(connected) { - layerStack.pop(layerStack.currentLayer); + layerStack.pop(layerStack.currentLayer) } } } @@ -129,12 +130,74 @@ Item { visible: !(modelData.securityType == NetworkService.SecurityNone) } } + Column { + visible: modelData.connected + Label { + text: "IP Address: " + modelData.ipv4["Address"] + font.pixelSize: Dims.l(6) + } + Row { + width: parent.width + height: Dims.l(20) + // labelWidthRatio is the ratio of label width to the total width + property real labelWidthRatio: 0.7143 + // fontToHeightRatio is the ratio of the font size to the height + property real fontToHeightRatio: 0.3 + + Label { + text: "Disconnect" + font.pixelSize: parent.height * fontToHeightRatio + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + width: parent.width * labelWidthRatio + height: parent.height + } + + IconButton { + iconName: "ios-close-circle-outline" + height: parent.height + width: height + onClicked: { + modelData.requestDisconnect() + layerStack.pop(layerStack.currentLayer) + } + } + } + } LabeledSwitch { id: autoConnectCheckBox width: parent.width height: Dims.l(20) text: "autoconnect" } + Row { + visible: (modelData.connected || modelData.favorite) + width: parent.width + height: Dims.l(20) + // labelWidthRatio is the ratio of label width to the total width + property real labelWidthRatio: 0.7143 + // fontToHeightRatio is the ratio of the font size to the height + property real fontToHeightRatio: 0.3 + + Label { + text: "remove network" + font.pixelSize: parent.height * fontToHeightRatio + verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap + width: parent.width * labelWidthRatio + height: parent.height + } + + IconButton { + iconName: "ios-remove-circle-outline" + height: parent.height + width: height + onClicked: { + modelData.remove() + layerStack.pop(layerStack.currentLayer) + } + } + } IconButton { iconName: "ios-checkmark-circle" @@ -143,11 +206,11 @@ Item { anchors.horizontalCenter: parent.horizontalCenter onClicked: { if(!modelData.connected) { - modelData.passphrase = passphraseField.text; + modelData.passphrase = passphraseField.text modelData.identity = identityField.text } modelData.autoConnect = autoConnectCheckBox.checked - modelData.requestConnect(); + modelData.requestConnect() } } } From 2e1dcbf4d9e9ddea0f051465ef95c7be0386c349 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sat, 15 Apr 2023 17:27:10 +0100 Subject: [PATCH 09/16] WiFiPage: always open the connection dialog on press and hold --- src/qml/WiFiPage.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index 581a09f7..dfe58381 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -142,6 +142,7 @@ Item { layerStack.push(connectionDialog, {modelData: modelData}) } } + onPressAndHold: layerStack.push(connectionDialog, {modelData: modelData}) } } From 64ed598cb7e2bf17b8c0f1567902db7dec0de321 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 1 Jun 2023 11:35:28 +0100 Subject: [PATCH 10/16] WiFiConnectionDialog: make icon consistent with other checkmars in settings --- src/qml/WiFiConnectionDialog.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index 32c19d1f..8c49097e 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -200,9 +200,9 @@ Item { } IconButton { - iconName: "ios-checkmark-circle" + iconName: "ios-checkmark-circle-outline" height: width - width: parent.width*0.3 + width: Dims.w(20) anchors.horizontalCenter: parent.horizontalCenter onClicked: { if(!modelData.connected) { From 8c970e1986aa563e11847ea6f2273fd64d75437f Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 1 Jun 2023 11:38:12 +0100 Subject: [PATCH 11/16] WiFiConnectionDialog: resize elements to be consistent with other settings pages - make all rows same height - use new LabeledActionButton - make IP text fit in column - use dims to be consistent with other settings pages --- src/qml/WiFiConnectionDialog.qml | 97 ++++++++++++++------------------ 1 file changed, 42 insertions(+), 55 deletions(-) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index 8c49097e..f70688d6 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -33,6 +33,9 @@ Item { id: dialogItem property var modelData + property real rowHeight: Dims.h(25) + property real rowMargin: Dims.w(15) + InputPanel { id: inputPanel z: 99 @@ -87,20 +90,30 @@ Item { } Flickable { anchors.fill: parent - anchors.margins: Dims.l(15) contentHeight: contentColumn.implicitHeight Column { id: contentColumn width: parent.width - Item {height: dialogItem.height*0.15; width: parent.width} + Item {height: Dims.h(15); width: parent.width} Label { + anchors { + left: parent.left + right: parent.right + leftMargin: dialogItem.rowMargin + rightMargin: dialogItem.rowMargin + } text: modelData.name font.pixelSize: Dims.l(6) } Column { id: loginFieldsColumn - width: parent.width visible: !(modelData.connected || modelData.favorite) + anchors { + left: parent.left + right: parent.right + leftMargin: dialogItem.rowMargin + rightMargin: dialogItem.rowMargin + } Label { id: identityLabel text: qsTr("Login")+":" @@ -127,75 +140,49 @@ Item { text: modelData.passphrase echoMode: TextInput.Password //smartwatches are hard to type on. it is worth adding a 'show password' button for this field width: parent.width + height: dialogItem.rowHeight visible: !(modelData.securityType == NetworkService.SecurityNone) } } Column { visible: modelData.connected + width: parent.width Label { - text: "IP Address: " + modelData.ipv4["Address"] + anchors { + left: parent.left + right: parent.right + leftMargin: dialogItem.rowMargin + rightMargin: dialogItem.rowMargin + } + text: "IP: " + modelData.ipv4["Address"] + horizontalAlignment: Text.AlignHCenter font.pixelSize: Dims.l(6) } - Row { + LabeledActionButton { width: parent.width - height: Dims.l(20) - // labelWidthRatio is the ratio of label width to the total width - property real labelWidthRatio: 0.7143 - // fontToHeightRatio is the ratio of the font size to the height - property real fontToHeightRatio: 0.3 - - Label { - text: "Disconnect" - font.pixelSize: parent.height * fontToHeightRatio - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap - width: parent.width * labelWidthRatio - height: parent.height - } - - IconButton { - iconName: "ios-close-circle-outline" - height: parent.height - width: height - onClicked: { - modelData.requestDisconnect() - layerStack.pop(layerStack.currentLayer) - } + height: dialogItem.rowHeight + text: "Disconnect" + icon: "ios-close-circle-outline" + onClicked: { + modelData.requestDisconnect() + layerStack.pop(layerStack.currentLayer) } } } LabeledSwitch { id: autoConnectCheckBox width: parent.width - height: Dims.l(20) - text: "autoconnect" + height: dialogItem.rowHeight + text: "Autoconnect" } - Row { - visible: (modelData.connected || modelData.favorite) + LabeledActionButton { width: parent.width - height: Dims.l(20) - // labelWidthRatio is the ratio of label width to the total width - property real labelWidthRatio: 0.7143 - // fontToHeightRatio is the ratio of the font size to the height - property real fontToHeightRatio: 0.3 - - Label { - text: "remove network" - font.pixelSize: parent.height * fontToHeightRatio - verticalAlignment: Text.AlignVCenter - wrapMode: Text.Wrap - width: parent.width * labelWidthRatio - height: parent.height - } - - IconButton { - iconName: "ios-remove-circle-outline" - height: parent.height - width: height - onClicked: { - modelData.remove() - layerStack.pop(layerStack.currentLayer) - } + height: dialogItem.rowHeight + text: "Remove network" + icon: "ios-remove-circle-outline" + onClicked: { + modelData.remove() + layerStack.pop(layerStack.currentLayer) } } From 5af1c7a4f5c6f11baf5d58fc64ff49f72343e08c Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 1 Jun 2023 11:40:42 +0100 Subject: [PATCH 12/16] WiFiConnectionDialog: switch to marquee to accommodate wider SSIDs --- src/qml/WiFiConnectionDialog.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index f70688d6..affde3cf 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -95,7 +95,7 @@ Item { id: contentColumn width: parent.width Item {height: Dims.h(15); width: parent.width} - Label { + Marquee { anchors { left: parent.left right: parent.right @@ -104,6 +104,7 @@ Item { } text: modelData.name font.pixelSize: Dims.l(6) + height: Dims.l(8) } Column { id: loginFieldsColumn From 5940966400bca5a3362cf93612f0ff85a624c76f Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 1 Jun 2023 11:54:03 +0100 Subject: [PATCH 13/16] WiFiPage: use marquee to accommodate longer SSIDs and realign text - align all text to the middle --- src/qml/WiFiPage.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index dfe58381..f5f3bb09 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -116,12 +116,15 @@ Item { visible: wifiStatus.powered width: wifiList.width height: wifiStatus.powered ? width*0.23 : 0 - Label { + Marquee { id: wifiNameLabel text: wifiName + height: parent.height*0.6 + width: parent.width } Label { anchors.top: wifiNameLabel.bottom + anchors.horizontalCenter: parent.horizontalCenter opacity: 0.8 font.pixelSize: parent.width*0.07 font.weight: Font.Thin From 7069f16aa3dbc6c1a34a4ff98a6d763e6b65ef2d Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 1 Jun 2023 12:02:23 +0100 Subject: [PATCH 14/16] WiFiConnectionDialog: sync autoconnect checkbox with current value --- src/qml/WiFiConnectionDialog.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index affde3cf..6ff45ef4 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -175,6 +175,7 @@ Item { width: parent.width height: dialogItem.rowHeight text: "Autoconnect" + checked: modelData.autoConnect } LabeledActionButton { width: parent.width From 3deca501e20e9b064d04b52755e7305c32d30c2f Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 1 Jun 2023 12:05:17 +0100 Subject: [PATCH 15/16] Wifi pages: finalise translation IDs --- src/qml/WiFiConnectionDialog.qml | 10 +++++----- src/qml/WiFiPage.qml | 16 ++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index 6ff45ef4..3aeb20b6 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -117,7 +117,7 @@ Item { } Label { id: identityLabel - text: qsTr("Login")+":" + text: qsTrId("id-wifi-login")+":" font.pixelSize: Dims.l(6) visible: modelData.securityType === NetworkService.SecurityIEEE802 } @@ -131,7 +131,7 @@ Item { Label { id: passphraseLabel - text: qsTr("Password")+":" + text: qsTrId("id-wifi-password")+":" font.pixelSize: Dims.l(6) visible: !(modelData.securityType == NetworkService.SecurityNone) } @@ -162,7 +162,7 @@ Item { LabeledActionButton { width: parent.width height: dialogItem.rowHeight - text: "Disconnect" + text: qsTrId("id-wifi-disconnect") icon: "ios-close-circle-outline" onClicked: { modelData.requestDisconnect() @@ -174,13 +174,13 @@ Item { id: autoConnectCheckBox width: parent.width height: dialogItem.rowHeight - text: "Autoconnect" + text: qsTrId("id-wifi-autoconnect") checked: modelData.autoConnect } LabeledActionButton { width: parent.width height: dialogItem.rowHeight - text: "Remove network" + text: qsTrId("id-wifi-removenetwork") icon: "ios-remove-circle-outline" onClicked: { modelData.remove() diff --git a/src/qml/WiFiPage.qml b/src/qml/WiFiPage.qml index f5f3bb09..708653c8 100644 --- a/src/qml/WiFiPage.qml +++ b/src/qml/WiFiPage.qml @@ -97,15 +97,7 @@ Item { anchors.leftMargin: parent.width*0.04; anchors.rightMargin: anchors.leftMargin anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: parent.width*0.15 - //% "WiFi on" - property string bluetoothOnStr: qsTrId("id-wifi-on") - //% "WiFi off" - property string bluetoothOffStr: qsTrId("id-wifi-off") - //% "Connected" - property string connectedStr: qsTrId("id-connected") - //% "Not connected" - property string notConnectedStr: qsTrId("id-disconnected") - text: "

" + (wifiStatus.powered ? bluetoothOnStr : bluetoothOffStr) + "

\n" + (wifiStatus.connected ? connectedStr : notConnectedStr) + text: "

" + (wifiStatus.powered ? qsTrId("id-wifi-on"): qsTrId("id-wifi-off")) + "

\n" + (wifiStatus.connected ? qsTrId("id-wifi-connected") : qsTrId("id-wifi-disconnected")) } } @@ -130,11 +122,11 @@ Item { font.weight: Font.Thin text: { if (modelData.connected) { - "Connected" + qsTrId("id-wifi-connected") } else if (modelData.favorite){ - "Saved" + qsTrId("id-wifi-saved") } else { - "Not set up" + qsTrId("id-wifi-notsetup") } } } From b80e363be37c7e724990e1b905e48f542228b56e Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Thu, 1 Jun 2023 12:39:00 +0100 Subject: [PATCH 16/16] WiFiConnectionDialog: make sure that 'remove network' isn't visible before network has been added --- src/qml/WiFiConnectionDialog.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/WiFiConnectionDialog.qml b/src/qml/WiFiConnectionDialog.qml index 3aeb20b6..b7f7f80c 100644 --- a/src/qml/WiFiConnectionDialog.qml +++ b/src/qml/WiFiConnectionDialog.qml @@ -178,6 +178,7 @@ Item { checked: modelData.autoConnect } LabeledActionButton { + visible: modelData.connected || modelData.favorite width: parent.width height: dialogItem.rowHeight text: qsTrId("id-wifi-removenetwork")