mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-15 15:45:20 -04:00
refactor(settings): split network settings into tabs (#2633)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Modules.Settings
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
FocusScope {
|
||||
@@ -232,7 +233,52 @@ FocusScope {
|
||||
visible: active
|
||||
focus: active
|
||||
|
||||
sourceComponent: NetworkTab {}
|
||||
sourceComponent: NetworkStatusTab {}
|
||||
|
||||
onActiveChanged: {
|
||||
if (active && item)
|
||||
Qt.callLater(() => item.forceActiveFocus());
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: networkEthernetLoader
|
||||
anchors.fill: parent
|
||||
active: root.currentIndex === 39
|
||||
visible: active
|
||||
focus: active
|
||||
|
||||
sourceComponent: NetworkEthernetTab {}
|
||||
|
||||
onActiveChanged: {
|
||||
if (active && item)
|
||||
Qt.callLater(() => item.forceActiveFocus());
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: networkWifiLoader
|
||||
anchors.fill: parent
|
||||
active: root.currentIndex === 40
|
||||
visible: active
|
||||
focus: active
|
||||
|
||||
sourceComponent: NetworkWifiTab {}
|
||||
|
||||
onActiveChanged: {
|
||||
if (active && item)
|
||||
Qt.callLater(() => item.forceActiveFocus());
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: networkVpnLoader
|
||||
anchors.fill: parent
|
||||
active: root.currentIndex === 41
|
||||
visible: active
|
||||
focus: active
|
||||
|
||||
sourceComponent: NetworkVpnTab {}
|
||||
|
||||
onActiveChanged: {
|
||||
if (active && item)
|
||||
|
||||
@@ -53,20 +53,21 @@ FloatingWindow {
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
function setTabIndex(tabIndex: int) {
|
||||
if (tabIndex < 0)
|
||||
return;
|
||||
currentTabIndex = tabIndex;
|
||||
sidebar.autoExpandForTab(tabIndex);
|
||||
}
|
||||
|
||||
function showWithTab(tabIndex: int) {
|
||||
if (tabIndex >= 0) {
|
||||
currentTabIndex = tabIndex;
|
||||
sidebar.autoExpandForTab(tabIndex);
|
||||
}
|
||||
setTabIndex(tabIndex);
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function showWithTabName(tabName: string) {
|
||||
var idx = sidebar.resolveTabIndex(tabName);
|
||||
if (idx >= 0) {
|
||||
currentTabIndex = idx;
|
||||
sidebar.autoExpandForTab(idx);
|
||||
}
|
||||
setTabIndex(idx);
|
||||
visible = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -238,8 +238,33 @@ Rectangle {
|
||||
"id": "network",
|
||||
"text": I18n.tr("Network"),
|
||||
"icon": "wifi",
|
||||
"tabIndex": 7,
|
||||
"dmsOnly": true
|
||||
"dmsOnly": true,
|
||||
"children": [
|
||||
{
|
||||
"id": "network_status",
|
||||
"text": I18n.tr("Status"),
|
||||
"icon": "lan",
|
||||
"tabIndex": 7
|
||||
},
|
||||
{
|
||||
"id": "network_ethernet",
|
||||
"text": I18n.tr("Ethernet"),
|
||||
"icon": "settings_ethernet",
|
||||
"tabIndex": 39
|
||||
},
|
||||
{
|
||||
"id": "network_wifi",
|
||||
"text": I18n.tr("WiFi"),
|
||||
"icon": "wifi",
|
||||
"tabIndex": 40
|
||||
},
|
||||
{
|
||||
"id": "network_vpn",
|
||||
"text": I18n.tr("VPN"),
|
||||
"icon": "vpn_key",
|
||||
"tabIndex": 41
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "applications",
|
||||
|
||||
Reference in New Issue
Block a user