mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-26 06:22:50 -05:00
refactor: start trimming AI bullcrap patterns
This commit is contained in:
@@ -11,32 +11,16 @@ Item {
|
||||
|
||||
property int networkSubTab: {
|
||||
// Default to WiFi tab if WiFi is connected, otherwise Ethernet
|
||||
if (networkStatus === "wifi") return 1
|
||||
else if (networkStatus === "ethernet") return 0
|
||||
if (NetworkService.networkStatus === "wifi") return 1
|
||||
else if (NetworkService.networkStatus === "ethernet") return 0
|
||||
else return 1 // Default to WiFi when nothing is connected
|
||||
}
|
||||
|
||||
// Expose properties that the parent needs to bind to
|
||||
property bool wifiAutoRefreshEnabled: false
|
||||
|
||||
// These should be bound from parent
|
||||
property string networkStatus: ""
|
||||
property bool wifiAvailable: false
|
||||
property bool wifiEnabled: false
|
||||
property bool wifiToggling: false
|
||||
property string ethernetIP: ""
|
||||
property string ethernetInterface: ""
|
||||
property bool ethernetConnected: false
|
||||
property string currentWifiSSID: ""
|
||||
property string wifiIP: ""
|
||||
property string wifiSignalStrength: ""
|
||||
property var wifiNetworks: []
|
||||
property bool wifiScanning: false
|
||||
property string wifiConnectionStatus: ""
|
||||
property string wifiPasswordSSID: ""
|
||||
property string wifiPasswordInput: ""
|
||||
property bool wifiPasswordDialogVisible: false
|
||||
property bool changingNetworkPreference: false
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
@@ -101,7 +85,7 @@ Item {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Text {
|
||||
text: networkTab.wifiEnabled ? "wifi" : "wifi_off"
|
||||
text: NetworkService.wifiEnabled ? "wifi" : "wifi_off"
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSize - 4
|
||||
color: networkTab.networkSubTab === 1 ? Theme.primary : Theme.surfaceText
|
||||
@@ -160,8 +144,8 @@ Item {
|
||||
height: 70
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.5)
|
||||
border.color: networkTab.networkStatus === "ethernet" ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
border.width: networkTab.networkStatus === "ethernet" ? 2 : 1
|
||||
border.color: NetworkService.networkStatus === "ethernet" ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
border.width: NetworkService.networkStatus === "ethernet" ? 2 : 1
|
||||
visible: true
|
||||
|
||||
Row {
|
||||
@@ -190,7 +174,7 @@ Item {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: networkTab.ethernetConnected ? (networkTab.ethernetIP || "Connected") : "Disconnected"
|
||||
text: NetworkService.ethernetConnected ? (NetworkService.ethernetIP || "Connected") : "Disconnected"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
}
|
||||
@@ -342,8 +326,8 @@ Item {
|
||||
height: 50
|
||||
radius: Theme.cornerRadius
|
||||
color: wifiToggleArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)
|
||||
visible: networkTab.wifiAvailable
|
||||
opacity: networkTab.wifiToggling ? 0.6 : 1.0
|
||||
visible: NetworkService.wifiAvailable
|
||||
opacity: NetworkService.wifiToggling ? 0.6 : 1.0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
@@ -360,17 +344,17 @@ Item {
|
||||
|
||||
Text {
|
||||
id: wifiToggleIcon
|
||||
text: networkTab.wifiToggling ? "sync" : "power_settings_new"
|
||||
text: NetworkService.wifiToggling ? "sync" : "power_settings_new"
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSize
|
||||
color: networkTab.wifiEnabled ? Theme.primary : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||
color: NetworkService.wifiEnabled ? Theme.primary : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
rotation: networkTab.wifiToggling ? wifiToggleIcon.rotation : 0
|
||||
rotation: NetworkService.wifiToggling ? wifiToggleIcon.rotation : 0
|
||||
|
||||
RotationAnimation {
|
||||
target: wifiToggleIcon
|
||||
property: "rotation"
|
||||
running: networkTab.wifiToggling
|
||||
running: NetworkService.wifiToggling
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
@@ -386,7 +370,7 @@ Item {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: networkTab.wifiToggling ? "Switching WiFi..." : (networkTab.wifiEnabled ? "Turn WiFi Off" : "Turn WiFi On")
|
||||
text: NetworkService.wifiToggling ? "Switching WiFi..." : (NetworkService.wifiEnabled ? "Turn WiFi Off" : "Turn WiFi On")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -413,7 +397,7 @@ Item {
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.5)
|
||||
border.color: networkTab.networkStatus === "wifi" ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
border.width: networkTab.networkStatus === "wifi" ? 2 : 1
|
||||
visible: networkTab.wifiAvailable && networkTab.wifiEnabled
|
||||
visible: NetworkService.wifiAvailable && NetworkService.wifiEnabled
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
@@ -423,10 +407,10 @@ Item {
|
||||
|
||||
Text {
|
||||
text: networkTab.networkStatus === "wifi" ?
|
||||
(networkTab.wifiSignalStrength === "excellent" ? "wifi" :
|
||||
networkTab.wifiSignalStrength === "good" ? "wifi_2_bar" :
|
||||
networkTab.wifiSignalStrength === "fair" ? "wifi_1_bar" :
|
||||
networkTab.wifiSignalStrength === "poor" ? "wifi_calling_3" : "wifi") : "wifi"
|
||||
(WifiService.wifiSignalStrength === "excellent" ? "wifi" :
|
||||
WifiService.wifiSignalStrength === "good" ? "wifi_2_bar" :
|
||||
WifiService.wifiSignalStrength === "fair" ? "wifi_1_bar" :
|
||||
WifiService.wifiSignalStrength === "poor" ? "wifi_calling_3" : "wifi") : "wifi"
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSizeLarge
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.primary : Theme.surfaceText
|
||||
@@ -438,14 +422,14 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Text {
|
||||
text: networkTab.networkStatus === "wifi" ? (networkTab.currentWifiSSID || "Connected") : "Not Connected"
|
||||
text: NetworkService.networkStatus === "wifi" ? (WifiService.currentWifiSSID || "Connected") : "Not Connected"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.primary : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Text {
|
||||
text: networkTab.networkStatus === "wifi" ? (networkTab.wifiIP || "Connected") : "Select a network below"
|
||||
text: NetworkService.networkStatus === "wifi" ? (NetworkService.wifiIP || "Connected") : "Select a network below"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
}
|
||||
@@ -496,10 +480,10 @@ Item {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: networkTab.changingNetworkPreference ? "Switching..." :
|
||||
(networkTab.networkStatus === "wifi" ? "" : "Prefer over Ethernet")
|
||||
text: NetworkService.changingNetworkPreference ? "Switching..." :
|
||||
(NetworkService.networkStatus === "wifi" ? "" : "Prefer over Ethernet")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: networkTab.networkStatus === "wifi" ? Theme.background : Theme.primary
|
||||
color: NetworkService.networkStatus === "wifi" ? Theme.background : Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
@@ -513,7 +497,7 @@ Item {
|
||||
enabled: !networkTab.changingNetworkPreference
|
||||
onClicked: {
|
||||
console.log("Force WiFi preference clicked")
|
||||
if (networkTab.networkStatus !== "wifi") {
|
||||
if (NetworkService.networkStatus !== "wifi") {
|
||||
NetworkService.setNetworkPreference("wifi")
|
||||
} else {
|
||||
NetworkService.setNetworkPreference("auto")
|
||||
@@ -528,7 +512,7 @@ Item {
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
visible: networkTab.wifiEnabled
|
||||
visible: NetworkService.wifiEnabled
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
@@ -547,21 +531,21 @@ Item {
|
||||
height: 32
|
||||
radius: 16
|
||||
color: refreshArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) :
|
||||
networkTab.wifiScanning ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.06) : "transparent"
|
||||
WifiService.isScanning ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.06) : "transparent"
|
||||
|
||||
Text {
|
||||
id: refreshIcon
|
||||
anchors.centerIn: parent
|
||||
text: networkTab.wifiScanning ? "sync" : "refresh"
|
||||
text: WifiService.isScanning ? "sync" : "refresh"
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSize - 4
|
||||
color: Theme.surfaceText
|
||||
rotation: networkTab.wifiScanning ? refreshIcon.rotation : 0
|
||||
rotation: WifiService.isScanning ? refreshIcon.rotation : 0
|
||||
|
||||
RotationAnimation {
|
||||
target: refreshIcon
|
||||
property: "rotation"
|
||||
running: networkTab.wifiScanning
|
||||
running: WifiService.isScanning
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
@@ -581,7 +565,7 @@ Item {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: !networkTab.wifiScanning
|
||||
enabled: !WifiService.isScanning
|
||||
onClicked: {
|
||||
if (NetworkService.wifiEnabled) {
|
||||
WifiService.scanWifi()
|
||||
@@ -598,27 +582,27 @@ Item {
|
||||
height: 40
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
if (networkTab.wifiConnectionStatus === "connecting") {
|
||||
if (WifiService.connectionStatus === "connecting") {
|
||||
return Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.12)
|
||||
} else if (networkTab.wifiConnectionStatus === "failed") {
|
||||
} else if (WifiService.connectionStatus === "failed") {
|
||||
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12)
|
||||
} else if (networkTab.wifiConnectionStatus === "connected") {
|
||||
} else if (WifiService.connectionStatus === "connected") {
|
||||
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.12)
|
||||
}
|
||||
return "transparent"
|
||||
}
|
||||
border.color: {
|
||||
if (networkTab.wifiConnectionStatus === "connecting") {
|
||||
if (WifiService.connectionStatus === "connecting") {
|
||||
return Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.3)
|
||||
} else if (networkTab.wifiConnectionStatus === "failed") {
|
||||
} else if (WifiService.connectionStatus === "failed") {
|
||||
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.3)
|
||||
} else if (networkTab.wifiConnectionStatus === "connected") {
|
||||
} else if (WifiService.connectionStatus === "connected") {
|
||||
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.3)
|
||||
}
|
||||
return "transparent"
|
||||
}
|
||||
border.width: networkTab.wifiConnectionStatus !== "" ? 1 : 0
|
||||
visible: networkTab.wifiConnectionStatus !== ""
|
||||
border.width: WifiService.connectionStatus !== "" ? 1 : 0
|
||||
visible: WifiService.connectionStatus !== ""
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
@@ -627,26 +611,26 @@ Item {
|
||||
Text {
|
||||
id: connectionIcon
|
||||
text: {
|
||||
if (networkTab.wifiConnectionStatus === "connecting") return "sync"
|
||||
if (networkTab.wifiConnectionStatus === "failed") return "error"
|
||||
if (networkTab.wifiConnectionStatus === "connected") return "check_circle"
|
||||
if (WifiService.connectionStatus === "connecting") return "sync"
|
||||
if (WifiService.connectionStatus === "failed") return "error"
|
||||
if (WifiService.connectionStatus === "connected") return "check_circle"
|
||||
return ""
|
||||
}
|
||||
font.family: Theme.iconFont
|
||||
font.pixelSize: Theme.iconSize - 6
|
||||
color: {
|
||||
if (networkTab.wifiConnectionStatus === "connecting") return Theme.warning
|
||||
if (networkTab.wifiConnectionStatus === "failed") return Theme.error
|
||||
if (networkTab.wifiConnectionStatus === "connected") return Theme.success
|
||||
if (WifiService.connectionStatus === "connecting") return Theme.warning
|
||||
if (WifiService.connectionStatus === "failed") return Theme.error
|
||||
if (WifiService.connectionStatus === "connected") return Theme.success
|
||||
return Theme.surfaceText
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
rotation: networkTab.wifiConnectionStatus === "connecting" ? connectionIcon.rotation : 0
|
||||
rotation: WifiService.connectionStatus === "connecting" ? connectionIcon.rotation : 0
|
||||
|
||||
RotationAnimation {
|
||||
target: connectionIcon
|
||||
property: "rotation"
|
||||
running: networkTab.wifiConnectionStatus === "connecting"
|
||||
running: WifiService.connectionStatus === "connecting"
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
@@ -663,16 +647,16 @@ Item {
|
||||
|
||||
Text {
|
||||
text: {
|
||||
if (networkTab.wifiConnectionStatus === "connecting") return "Connecting to " + WifiService.connectingSSID
|
||||
if (networkTab.wifiConnectionStatus === "failed") return "Failed to connect to " + WifiService.connectingSSID
|
||||
if (networkTab.wifiConnectionStatus === "connected") return "Connected to " + WifiService.connectingSSID
|
||||
if (WifiService.connectionStatus === "connecting") return "Connecting to " + WifiService.connectingSSID
|
||||
if (WifiService.connectionStatus === "failed") return "Failed to connect to " + WifiService.connectingSSID
|
||||
if (WifiService.connectionStatus === "connected") return "Connected to " + WifiService.connectingSSID
|
||||
return ""
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: {
|
||||
if (networkTab.wifiConnectionStatus === "connecting") return Theme.warning
|
||||
if (networkTab.wifiConnectionStatus === "failed") return Theme.error
|
||||
if (networkTab.wifiConnectionStatus === "connected") return Theme.success
|
||||
if (WifiService.connectionStatus === "connecting") return Theme.warning
|
||||
if (WifiService.connectionStatus === "failed") return Theme.error
|
||||
if (WifiService.connectionStatus === "connected") return Theme.success
|
||||
return Theme.surfaceText
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -689,7 +673,7 @@ Item {
|
||||
|
||||
// WiFi networks list (only show if WiFi is available and enabled)
|
||||
Repeater {
|
||||
model: networkTab.wifiAvailable && networkTab.wifiEnabled ? networkTab.wifiNetworks : []
|
||||
model: NetworkService.wifiAvailable && NetworkService.wifiEnabled ? WifiService.wifiNetworks : []
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
@@ -828,7 +812,7 @@ Item {
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
visible: !networkTab.wifiEnabled
|
||||
visible: !NetworkService.wifiEnabled
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Text {
|
||||
|
||||
Reference in New Issue
Block a user