From 0f495d04f317d60a1b1d3e7849321e46fc6c405c Mon Sep 17 00:00:00 2001 From: rekols Date: Mon, 31 May 2021 23:39:58 +0800 Subject: [PATCH] Separate WLAN and Wired --- src/images/sidebar/dark/network.svg | 13 +- src/images/sidebar/dark/wlan.svg | 55 +++++++ src/images/sidebar/light/network.svg | 15 +- src/images/sidebar/light/wlan.svg | 55 +++++++ src/qml/Battery/Main.qml | 1 + src/qml/SideBar.qml | 23 ++- src/qml/User/Main.qml | 2 + src/qml/WLAN/Main.qml | 140 ++++++++++++++++++ src/qml/{Network => WLAN}/WifiItem.qml | 0 src/qml/{Network => WLAN}/WifiView.qml | 0 .../WirelessDetailsDialog.qml | 0 src/qml/{Network => Wired}/Main.qml | 68 +-------- src/qml/{Network => Wired}/WiredItem.qml | 0 src/resources.qrc | 13 +- translations/en_US.ts | 64 +++++--- translations/zh_CN.ts | 70 ++++++--- 16 files changed, 391 insertions(+), 128 deletions(-) create mode 100644 src/images/sidebar/dark/wlan.svg create mode 100644 src/images/sidebar/light/wlan.svg create mode 100644 src/qml/WLAN/Main.qml rename src/qml/{Network => WLAN}/WifiItem.qml (100%) rename src/qml/{Network => WLAN}/WifiView.qml (100%) rename src/qml/{Network => WLAN}/WirelessDetailsDialog.qml (100%) rename src/qml/{Network => Wired}/Main.qml (65%) rename src/qml/{Network => Wired}/WiredItem.qml (100%) diff --git a/src/images/sidebar/dark/network.svg b/src/images/sidebar/dark/network.svg index 0c48009..7222159 100644 --- a/src/images/sidebar/dark/network.svg +++ b/src/images/sidebar/dark/network.svg @@ -12,7 +12,7 @@ version="1.1" id="svg4" sodipodi:docname="network.svg" - inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"> + inkscape:version="1.0.2 (e86c870879, 2021-01-15)"> @@ -36,19 +36,20 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="2160" - inkscape:window-height="1272" + inkscape:window-height="1258" id="namedview6" showgrid="false" inkscape:zoom="45.9375" inkscape:cx="8" inkscape:cy="8" inkscape:window-x="0" - inkscape:window-y="30" + inkscape:window-y="35" inkscape:window-maximized="1" inkscape:current-layer="svg4" inkscape:document-rotation="0" /> + d="M 2.9999995,0.9999998 C 1.3379994,0.9999998 -3.75e-7,2.3379999 -3.75e-7,3.9999999 V 9.9999996 C -3.75e-7,11.662 1.3379994,13 2.9999995,13 c 0,1.108 0.892001,2 2.000001,2 H 11 c 1.108,0 2,-0.892 2,-2 1.662,0 3,-1.338 3,-3.0000004 V 3.9999999 c 0,-1.662 -1.338,-3.0000001 -3,-3.0000001 z m 0,1.0000001 H 13 c 1.108,0 2,0.892 2,2 V 9.9999996 C 15,11.108 14.108,12 13,12 h -1 v 1 c 0,0.554 -0.446,1 -1,1 H 5.0000005 c -0.5540001,0 -1,-0.446 -1,-1 V 12 H 2.9999995 C 1.8919994,12 0.99999943,11.108 0.99999943,9.9999996 V 3.9999999 c 0,-1.108 0.89199997,-2 2.00000007,-2 z m 1.000001,2 c -0.554,0 -1.000001,0.446 -1.000001,1 v 3.9999997 c 0,0.554 0.446001,1 1.000001,1 0.554,0 1,-0.446 1,-1 V 4.9999999 c 0,-0.554 -0.446,-1 -1,-1 z m 4,0 c -0.554,0 -1,0.446 -1,1 v 3.9999997 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 4.9999999 c 0,-0.554 -0.446,-1 -1,-1 z m 3.9999995,0 c -0.554,0 -1,0.446 -1,1 v 3.9999997 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 4.9999999 c 0,-0.554 -0.446,-1 -1,-1 z" + style="color:#363636;fill:#ffffff;fill-opacity:1" + class="ColorScheme-Text" + id="path5" /> diff --git a/src/images/sidebar/dark/wlan.svg b/src/images/sidebar/dark/wlan.svg new file mode 100644 index 0000000..41ac370 --- /dev/null +++ b/src/images/sidebar/dark/wlan.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/src/images/sidebar/light/network.svg b/src/images/sidebar/light/network.svg index fd6b19e..69cad68 100644 --- a/src/images/sidebar/light/network.svg +++ b/src/images/sidebar/light/network.svg @@ -11,8 +11,8 @@ height="16" version="1.1" id="svg4" - sodipodi:docname="language.svg" - inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"> + sodipodi:docname="network.svg" + inkscape:version="1.0.2 (e86c870879, 2021-01-15)"> @@ -36,19 +36,20 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="2160" - inkscape:window-height="1312" + inkscape:window-height="1258" id="namedview6" showgrid="false" inkscape:zoom="45.9375" inkscape:cx="8" inkscape:cy="8" inkscape:window-x="0" - inkscape:window-y="30" + inkscape:window-y="35" inkscape:window-maximized="1" inkscape:current-layer="svg4" inkscape:document-rotation="0" /> + d="M 2.9999994,0.99999965 C 1.3379994,0.99999965 -4e-7,2.3379997 -4e-7,3.9999997 V 9.9999994 C -4e-7,11.662 1.3379994,13 2.9999994,13 c 0,1.108 0.892001,2 2.000001,2 H 11 c 1.108,0 2,-0.892 2,-2 1.662,0 3,-1.338 3,-3.0000006 V 3.9999997 c 0,-1.662 -1.338,-3.00000005 -3,-3.00000005 z m 0,1.00000005 H 13 c 1.108,0 2,0.892 2,2 V 9.9999994 C 15,11.108 14.108,12 13,12 h -1 v 1 c 0,0.554 -0.446,1 -1,1 H 5.0000004 c -0.554,0 -1,-0.446 -1,-1 v -1 h -1.000001 c -1.108,0 -2,-0.892 -2,-2.0000006 V 3.9999997 c 0,-1.108 0.892,-2 2,-2 z m 1.000001,2 c -0.554,0 -1.000001,0.446 -1.000001,1 v 3.9999997 c 0,0.554 0.446001,1 1.000001,1 0.554,0 1,-0.446 1,-1 V 4.9999997 c 0,-0.554 -0.446,-1 -1,-1 z m 4,0 c -0.554,0 -1,0.446 -1,1 v 3.9999997 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 4.9999997 c 0,-0.554 -0.446,-1 -1,-1 z m 3.9999996,0 c -0.554,0 -1,0.446 -1,1 v 3.9999997 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 4.9999997 c 0,-0.554 -0.446,-1 -1,-1 z" + style="color:#363636;fill:currentColor" + class="ColorScheme-Text" + id="path5" /> diff --git a/src/images/sidebar/light/wlan.svg b/src/images/sidebar/light/wlan.svg new file mode 100644 index 0000000..ff3f1e2 --- /dev/null +++ b/src/images/sidebar/light/wlan.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/src/qml/Battery/Main.qml b/src/qml/Battery/Main.qml index 76db482..8edc9ec 100644 --- a/src/qml/Battery/Main.qml +++ b/src/qml/Battery/Main.qml @@ -120,6 +120,7 @@ ItemPage { RoundedItem { visible: history.count > 2 + spacing: 0 Label { text: qsTr("History") diff --git a/src/qml/SideBar.qml b/src/qml/SideBar.qml index 9f157ff..181b0ad 100644 --- a/src/qml/SideBar.qml +++ b/src/qml/SideBar.qml @@ -49,9 +49,17 @@ Item { id: listModel ListElement { - title: qsTr("Network") + title: qsTr("WLAN") name: "network" - page: "qrc:/qml/Network/Main.qml" + page: "qrc:/qml/WLAN/Main.qml" + iconSource: "wlan.svg" + category: qsTr("Network and connection") + } + + ListElement { + title: qsTr("Wired") + name: "wired" + page: "qrc:/qml/Wired/Main.qml" iconSource: "network.svg" category: qsTr("Network and connection") } @@ -148,7 +156,7 @@ Item { spacing: FishUI.Units.smallSpacing leftMargin: FishUI.Units.largeSpacing rightMargin: FishUI.Units.largeSpacing - topMargin: FishUI.Units.largeSpacing + topMargin: 0 ScrollBar.vertical: ScrollBar {} @@ -164,13 +172,14 @@ Item { section.property: "category" section.delegate: Item { width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin - height: FishUI.Units.fontMetrics.height + FishUI.Units.smallSpacing * 3 + height: FishUI.Units.fontMetrics.height + FishUI.Units.largeSpacing + FishUI.Units.smallSpacing Text { anchors.fill: parent anchors.leftMargin: FishUI.Units.smallSpacing - anchors.topMargin: FishUI.Units.smallSpacing - anchors.bottomMargin: FishUI.Units.smallSpacing * 2 + anchors.rightMargin: FishUI.Units.largeSpacing + anchors.topMargin: FishUI.Units.largeSpacing + anchors.bottomMargin: FishUI.Units.smallSpacing color: FishUI.Theme.disabledTextColor text: section } @@ -179,7 +188,7 @@ Item { delegate: Item { id: item width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin - height: FishUI.Units.fontMetrics.height + FishUI.Units.largeSpacing * 2 + height: FishUI.Units.fontMetrics.height + FishUI.Units.largeSpacing * 1.5 property bool isCurrent: listView.currentIndex === index diff --git a/src/qml/User/Main.qml b/src/qml/User/Main.qml index 93b25d1..23e02f6 100644 --- a/src/qml/User/Main.qml +++ b/src/qml/User/Main.qml @@ -52,6 +52,8 @@ ItemPage { spacing: FishUI.Units.largeSpacing * 2 RoundedItem { + visible: _userView.count > 0 + ListView { id: _userView model: userModel diff --git a/src/qml/WLAN/Main.qml b/src/qml/WLAN/Main.qml new file mode 100644 index 0000000..1fa19cd --- /dev/null +++ b/src/qml/WLAN/Main.qml @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2021 CutefishOS Team. + * + * Author: revenmartin + * + * 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 + * 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.4 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 + +import FishUI 1.0 as FishUI +import Cutefish.NetworkManagement 1.0 as NM + +import "../" + +ItemPage { + id: control + headerTitle: qsTr("WLAN") + + property var itemHeight: 45 + property var settingsMap: ({}) + + NM.Handler { + id: handler + } + + NM.WifiSettings { + id: wifiSettings + } + + NM.NetworkModel { + id: networkModel + } + + NM.EnabledConnections { + id: enabledConnections + } + + NM.IdentityModel { + id: connectionModel + } + + NM.Configuration { + id: configuration + } + + Component.onCompleted: handler.requestScan() + + Timer { + id: scanTimer + interval: 10200 + repeat: true + running: control.visible + onTriggered: handler.requestScan() + } + + Scrollable { + anchors.fill: parent + contentHeight: mainLayout.implicitHeight + + ColumnLayout { + id: mainLayout + anchors.fill: parent + anchors.bottomMargin: FishUI.Units.largeSpacing + spacing: FishUI.Units.largeSpacing * 2 + + RoundedItem { + WifiView { + Layout.fillWidth: true + visible: enabledConnections.wirelessHwEnabled + } + } + + // Hotspot + // 还未完善 +// RoundedItem { +// id: hotspotItem +// visible: handler.hotspotSupported + +// RowLayout { +// Label { +// text: qsTr("Hotspot") +// color: FishUI.Theme.disabledTextColor +// } + +// Item { +// Layout.fillWidth: true +// } + +// Switch { +// Layout.fillHeight: true +// rightPadding: 0 + +// onToggled: { +// if (checked) { +// handler.createHotspot() +// } else { +// handler.stopHotspot() +// } +// } +// } +// } + +// Item { +// height: FishUI.Units.largeSpacing +// } + +// TextField { +// id: ssidName +// text: configuration.hotspotName +// placeholderText: qsTr("SSID") +// } + +// TextField { +// id: hotspotPassword +// placeholderText: qsTr("Password") +// text: configuration.hotspotPassword +// } +// } + + Item { + height: FishUI.Units.largeSpacing + } + } + } +} diff --git a/src/qml/Network/WifiItem.qml b/src/qml/WLAN/WifiItem.qml similarity index 100% rename from src/qml/Network/WifiItem.qml rename to src/qml/WLAN/WifiItem.qml diff --git a/src/qml/Network/WifiView.qml b/src/qml/WLAN/WifiView.qml similarity index 100% rename from src/qml/Network/WifiView.qml rename to src/qml/WLAN/WifiView.qml diff --git a/src/qml/Network/WirelessDetailsDialog.qml b/src/qml/WLAN/WirelessDetailsDialog.qml similarity index 100% rename from src/qml/Network/WirelessDetailsDialog.qml rename to src/qml/WLAN/WirelessDetailsDialog.qml diff --git a/src/qml/Network/Main.qml b/src/qml/Wired/Main.qml similarity index 65% rename from src/qml/Network/Main.qml rename to src/qml/Wired/Main.qml index fc7ee80..7768f7a 100644 --- a/src/qml/Network/Main.qml +++ b/src/qml/Wired/Main.qml @@ -1,7 +1,7 @@ /* * Copyright (C) 2021 CutefishOS Team. * - * Author: revenmartin + * Author: rekols * * 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 @@ -29,7 +29,7 @@ import "../" ItemPage { id: control - headerTitle: qsTr("Network") + headerTitle: qsTr("Wired") property var itemHeight: 45 property var settingsMap: ({}) @@ -58,16 +58,6 @@ ItemPage { id: configuration } - Component.onCompleted: handler.requestScan() - - Timer { - id: scanTimer - interval: 10200 - repeat: true - running: control.visible - onTriggered: handler.requestScan() - } - Scrollable { anchors.fill: parent contentHeight: mainLayout.implicitHeight @@ -78,60 +68,6 @@ ItemPage { anchors.bottomMargin: FishUI.Units.largeSpacing spacing: FishUI.Units.largeSpacing * 2 - RoundedItem { - WifiView { - Layout.fillWidth: true - visible: enabledConnections.wirelessHwEnabled - } - } - - // Hotspot - // 还未完善 -// RoundedItem { -// id: hotspotItem -// visible: handler.hotspotSupported - -// RowLayout { -// Label { -// text: qsTr("Hotspot") -// color: FishUI.Theme.disabledTextColor -// } - -// Item { -// Layout.fillWidth: true -// } - -// Switch { -// Layout.fillHeight: true -// rightPadding: 0 - -// onToggled: { -// if (checked) { -// handler.createHotspot() -// } else { -// handler.stopHotspot() -// } -// } -// } -// } - -// Item { -// height: FishUI.Units.largeSpacing -// } - -// TextField { -// id: ssidName -// text: configuration.hotspotName -// placeholderText: qsTr("SSID") -// } - -// TextField { -// id: hotspotPassword -// placeholderText: qsTr("Password") -// text: configuration.hotspotPassword -// } -// } - // Wired connection RoundedItem { visible: enabledConnections.wwanHwEnabled diff --git a/src/qml/Network/WiredItem.qml b/src/qml/Wired/WiredItem.qml similarity index 100% rename from src/qml/Network/WiredItem.qml rename to src/qml/Wired/WiredItem.qml diff --git a/src/resources.qrc b/src/resources.qrc index 25301ef..6ae99df 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -70,11 +70,6 @@ images/sidebar/light/language.svg images/sidebar/light/network.svg images/sidebar/light/wallpaper.svg - qml/Network/WifiView.qml - qml/Network/Main.qml - qml/Network/WifiItem.qml - qml/Network/WirelessDetailsDialog.qml - qml/Network/WiredItem.qml qml/RoundedItem.qml images/powersave.svg images/performance.svg @@ -98,5 +93,13 @@ images/sidebar/light/power.svg images/sidebar/dark/power.svg images/balance.svg + qml/WLAN/Main.qml + qml/Wired/Main.qml + qml/Wired/WiredItem.qml + qml/WLAN/WifiItem.qml + qml/WLAN/WifiView.qml + qml/WLAN/WirelessDetailsDialog.qml + images/sidebar/light/wlan.svg + images/sidebar/dark/wlan.svg diff --git a/translations/en_US.ts b/translations/en_US.ts index bf2a2a2..a7eae80 100644 --- a/translations/en_US.ts +++ b/translations/en_US.ts @@ -215,27 +215,27 @@ - + History - + W - + Last Charged to - + Maximum Capacity - + No battery found @@ -321,6 +321,8 @@ + + Wired @@ -355,7 +357,7 @@ - + Add user @@ -379,72 +381,83 @@ Color + + + WLAN + + SideBar - + User - + Display - Network + WLAN + Network and connection - + + Wired + + + + Display and appearance - + Appearance - + Background - + Dock - - + + System - + Language - + Battery - + About @@ -471,21 +484,25 @@ WifiItem + Password + Show password + Cancel + Connect @@ -494,6 +511,7 @@ WifiView + WLAN @@ -502,51 +520,61 @@ WirelessDetailsDialog + Auto-Join + Security + Signal + IPv4 Address + IPv6 Address + MAC Address + Gateway + DNS + Close + Forget this network diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index baed445..b83585d 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -215,27 +215,27 @@ 最近7天 - + History 历史 - + W 瓦特 - + Last Charged to 上一次充电至 - + Maximum Capacity 最大容量 - + No battery found 找不到电池 @@ -321,6 +321,8 @@ + + Wired 有线网络 @@ -355,7 +357,7 @@ 用户 - + Add user 添加用户 @@ -379,72 +381,87 @@ Color 纯色 + + + WLAN + WLAN + SideBar - + Display 显示 - Network - 网络 + 网络 + Network and connection 网络与连接 - + Display and appearance 显示与外观 - + Appearance 外观 - + Dock 程序坞 - + User 用户 - + Background 背景 - + + WLAN + WLAN + + + + Wired + 有线网络 + + - + + System 系统 - + Language 语言 - + Battery 电池 - + About 关于 @@ -471,21 +488,25 @@ WifiItem + Password 密码 + Show password 显示密码 + Cancel 取消 + Connect 连接 @@ -494,6 +515,7 @@ WifiView + WLAN WLAN @@ -502,51 +524,61 @@ WirelessDetailsDialog + Auto-Join 自动加入网络 + Security 安全性 + Signal 信号 + IPv4 Address IPv4地址 + IPv6 Address IPv6地址 + MAC Address MAC地址 + Gateway 路由器 + DNS DNS + Forget this network 忘记这个网络 + Close 关闭