1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 04:42:05 -04:00

refactor: start trimming AI bullcrap patterns

This commit is contained in:
bbedward
2025-07-17 13:25:35 -04:00
parent cc9b575a1d
commit 77cc9c288b
21 changed files with 541 additions and 1069 deletions

View File

@@ -9,9 +9,6 @@ import qs.Services
Item {
id: bluetoothTab
property bool bluetoothEnabled: false
property var bluetoothDevices: []
ScrollView {
anchors.fill: parent
clip: true
@@ -28,8 +25,8 @@ Item {
height: 60
radius: Theme.cornerRadius
color: bluetoothToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) :
(bluetoothTab.bluetoothEnabled ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.12))
border.color: bluetoothTab.bluetoothEnabled ? Theme.primary : "transparent"
(BluetoothService.enabled ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.12))
border.color: BluetoothService.enabled ? Theme.primary : "transparent"
border.width: 2
Row {
@@ -42,7 +39,7 @@ Item {
text: "bluetooth"
font.family: Theme.iconFont
font.pixelSize: Theme.iconSizeLarge
color: bluetoothTab.bluetoothEnabled ? Theme.primary : Theme.surfaceText
color: BluetoothService.enabled ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
@@ -53,12 +50,12 @@ Item {
Text {
text: "Bluetooth"
font.pixelSize: Theme.fontSizeLarge
color: bluetoothTab.bluetoothEnabled ? Theme.primary : Theme.surfaceText
color: BluetoothService.enabled ? Theme.primary : Theme.surfaceText
font.weight: Font.Medium
}
Text {
text: bluetoothTab.bluetoothEnabled ? "Enabled" : "Disabled"
text: BluetoothService.enabled ? "Enabled" : "Disabled"
font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
}
@@ -72,7 +69,7 @@ Item {
cursorShape: Qt.PointingHandCursor
onClicked: {
BluetoothService.toggleBluetooth()
BluetoothService.toggleAdapter()
}
}
}
@@ -80,7 +77,7 @@ Item {
Column {
width: parent.width
spacing: Theme.spacingM
visible: bluetoothTab.bluetoothEnabled
visible: BluetoothService.enabled
Text {
text: "Paired Devices"
@@ -90,7 +87,7 @@ Item {
}
Repeater {
model: bluetoothTab.bluetoothDevices
model: BluetoothService.pairedDevices
Rectangle {
width: parent.width
@@ -108,33 +105,11 @@ Item {
spacing: Theme.spacingM
Text {
text: {
switch (modelData.type) {
case "headset": return "headset"
case "mouse": return "mouse"
case "keyboard": return "keyboard"
case "phone": return "smartphone"
default: return "bluetooth"
}
}
text: modelData.iconName
font.family: Theme.iconFont
font.pixelSize: Theme.iconSize
color: {
if (modelData.connecting) return Theme.primary
if (modelData.connected) return Theme.primary
return Theme.surfaceText
}
color: modelData.connected ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
opacity: modelData.connecting ? 0.6 : 1.0
Behavior on opacity {
SequentialAnimation {
running: modelData.connecting
loops: Animation.Infinite
NumberAnimation { from: 1.0; to: 0.3; duration: 800 }
NumberAnimation { from: 0.3; to: 1.0; duration: 800 }
}
}
}
Column {
@@ -152,20 +127,26 @@ Item {
spacing: Theme.spacingXS
Text {
text: modelData.connectionStatus
text: modelData.connected ? "Connected" : "Disconnected"
font.pixelSize: Theme.fontSizeSmall
color: {
if (modelData.connecting) return Theme.primary
if (modelData.connectionFailed) return Theme.error
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
}
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
}
Text {
text: modelData.battery >= 0 ? "• " + modelData.battery + "%" : ""
text: {
if (modelData.batteryAvailable && modelData.batteryLevel >= 0) {
return "• " + modelData.batteryLevel + "%"
}
var btBattery = BatteryService.bluetoothDevices.find(dev =>
dev.name === modelData.name ||
dev.name.toLowerCase().includes(modelData.name.toLowerCase()) ||
modelData.name.toLowerCase().includes(dev.name.toLowerCase())
)
return btBattery ? "• " + btBattery.percentage + "%" : ""
}
font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
visible: modelData.battery >= 0
visible: text.length > 0
}
}
}
@@ -196,16 +177,13 @@ Item {
MouseArea {
id: btMenuButtonArea
anchors.fill: parent
hoverEnabled: !modelData.connecting
enabled: !modelData.connecting
cursorShape: modelData.connecting ? Qt.ArrowCursor : Qt.PointingHandCursor
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
if (!modelData.connecting) {
bluetoothContextMenuWindow.deviceData = modelData
let localPos = btMenuButtonArea.mapToItem(bluetoothTab, btMenuButtonArea.width / 2, btMenuButtonArea.height)
bluetoothContextMenuWindow.show(localPos.x, localPos.y)
}
bluetoothContextMenuWindow.deviceData = modelData
let localPos = btMenuButtonArea.mapToItem(bluetoothTab, btMenuButtonArea.width / 2, btMenuButtonArea.height)
bluetoothContextMenuWindow.show(localPos.x, localPos.y)
}
}
@@ -218,14 +196,11 @@ Item {
id: btDeviceArea
anchors.fill: parent
anchors.rightMargin: 40 // Don't overlap with menu button
hoverEnabled: !modelData.connecting
enabled: !modelData.connecting
cursorShape: modelData.connecting ? Qt.ArrowCursor : Qt.PointingHandCursor
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
if (!modelData.connecting) {
BluetoothService.toggleBluetoothDevice(modelData.mac)
}
BluetoothService.toggle(modelData.address)
}
}
}
@@ -235,7 +210,7 @@ Item {
Column {
width: parent.width
spacing: Theme.spacingM
visible: bluetoothTab.bluetoothEnabled
visible: BluetoothService.enabled
Row {
width: parent.width
@@ -264,7 +239,7 @@ Item {
spacing: Theme.spacingXS
Text {
text: BluetoothService.scanning ? "stop" : "bluetooth_searching"
text: BluetoothService.discovering ? "stop" : "bluetooth_searching"
font.family: Theme.iconFont
font.pixelSize: Theme.iconSize - 4
color: Theme.primary
@@ -273,7 +248,7 @@ Item {
Text {
id: scanText
text: BluetoothService.scanning ? "Stop Scanning" : "Start Scanning"
text: BluetoothService.discovering ? "Stop Scanning" : "Start Scanning"
font.pixelSize: Theme.fontSizeMedium
color: Theme.primary
font.weight: Font.Medium
@@ -288,10 +263,10 @@ Item {
cursorShape: Qt.PointingHandCursor
onClicked: {
if (BluetoothService.scanning) {
BluetoothService.stopDiscovery()
if (BluetoothService.discovering) {
BluetoothService.stopScan()
} else {
BluetoothService.startDiscovery()
BluetoothService.startScan()
}
}
}
@@ -317,18 +292,7 @@ Item {
spacing: Theme.spacingM
Text {
text: {
switch (modelData.type) {
case "headset": return "headset"
case "mouse": return "mouse"
case "keyboard": return "keyboard"
case "phone": return "smartphone"
case "watch": return "watch"
case "speaker": return "speaker"
case "tv": return "tv"
default: return "bluetooth"
}
}
text: modelData.iconName
font.family: Theme.iconFont
font.pixelSize: Theme.iconSize
color: modelData.paired ? Theme.secondary : Theme.surfaceText
@@ -350,21 +314,10 @@ Item {
spacing: Theme.spacingXS
Text {
text: {
if (modelData.paired && modelData.connected) return "Connected"
if (modelData.paired) return "Paired"
return "Signal: " + modelData.signalStrength
}
text: modelData.paired ? "Available" : "Not paired"
font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
}
Text {
text: modelData.rssi !== 0 ? "• " + modelData.rssi + " dBm" : ""
font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
visible: modelData.rssi !== 0
}
}
}
}
@@ -379,11 +332,11 @@ Item {
color: actionButtonArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
border.color: Theme.primary
border.width: 1
visible: modelData.canPair || modelData.paired
visible: true
Text {
anchors.centerIn: parent
text: modelData.paired ? (modelData.connected ? "Disconnect" : "Connect") : "Pair"
text: modelData.paired ? "Connect" : "Pair"
font.pixelSize: Theme.fontSizeSmall
color: Theme.primary
font.weight: Font.Medium
@@ -397,13 +350,9 @@ Item {
onClicked: {
if (modelData.paired) {
if (modelData.connected) {
BluetoothService.toggleBluetoothDevice(modelData.mac)
} else {
BluetoothService.connectDevice(modelData.mac)
}
BluetoothService.connect(modelData.address)
} else {
BluetoothService.pairDevice(modelData.mac)
BluetoothService.pair(modelData.address)
}
}
}
@@ -418,9 +367,9 @@ Item {
onClicked: {
if (modelData.paired) {
BluetoothService.toggleBluetoothDevice(modelData.mac)
BluetoothService.connect(modelData.address)
} else {
BluetoothService.pairDevice(modelData.mac)
BluetoothService.pair(modelData.address)
}
}
}
@@ -430,7 +379,7 @@ Item {
Column {
width: parent.width
spacing: Theme.spacingM
visible: BluetoothService.scanning && BluetoothService.availableDevices.length === 0
visible: BluetoothService.discovering && BluetoothService.availableDevices.length === 0
Row {
anchors.horizontalCenter: parent.horizontalCenter
@@ -473,7 +422,7 @@ Item {
text: "No devices found. Put your device in pairing mode and click Start Scanning."
font.pixelSize: Theme.fontSizeMedium
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
visible: BluetoothService.availableDevices.length === 0 && !BluetoothService.scanning
visible: BluetoothService.availableDevices.length === 0 && !BluetoothService.discovering
wrapMode: Text.WordWrap
width: parent.width
horizontalAlignment: Text.AlignHCenter
@@ -568,7 +517,7 @@ Item {
onClicked: {
if (bluetoothContextMenuWindow.deviceData) {
BluetoothService.toggleBluetoothDevice(bluetoothContextMenuWindow.deviceData.mac)
BluetoothService.toggle(bluetoothContextMenuWindow.deviceData.address)
}
bluetoothContextMenuWindow.hide()
}
@@ -634,7 +583,7 @@ Item {
onClicked: {
if (bluetoothContextMenuWindow.deviceData) {
BluetoothService.removeDevice(bluetoothContextMenuWindow.deviceData.mac)
BluetoothService.forget(bluetoothContextMenuWindow.deviceData.address)
}
bluetoothContextMenuWindow.hide()
}

View File

@@ -33,9 +33,9 @@ PanelWindow {
property bool powerOptionsExpanded: false
Rectangle {
width: Math.min(600, parent.width - Theme.spacingL * 2)
width: Math.min(600, Screen.width - Theme.spacingL * 2)
height: controlCenterPopup.powerOptionsExpanded ? 570 : 500
x: Math.max(Theme.spacingL, parent.width - width - Theme.spacingL)
x: Math.max(Theme.spacingL, Screen.width - width - Theme.spacingL)
y: Theme.barHeight + Theme.spacingXS
color: Theme.popupBackground()
radius: Theme.cornerRadiusLarge
@@ -560,7 +560,7 @@ PanelWindow {
tabs.push({name: "Audio", icon: "volume_up", id: "audio", available: true})
// Show Bluetooth only if available
if (root.bluetoothAvailable) {
if (BluetoothService.available) {
tabs.push({name: "Bluetooth", icon: "bluetooth", id: "bluetooth", available: true})
}
@@ -573,7 +573,7 @@ PanelWindow {
Rectangle {
property int tabCount: {
let count = 3 // Network + Audio + Display (always visible)
if (root.bluetoothAvailable) count++
if (BluetoothService.available) count++
return count
}
width: (parent.width - Theme.spacingXS * (tabCount - 1)) / tabCount
@@ -646,26 +646,10 @@ PanelWindow {
anchors.margins: Theme.spacingM
visible: controlCenterPopup.currentTab === "network"
// Bind properties from root
networkStatus: root.networkStatus
wifiAvailable: root.wifiAvailable
wifiEnabled: root.wifiEnabled
wifiToggling: root.wifiToggling
ethernetIP: root.ethernetIP
ethernetInterface: root.ethernetInterface
ethernetConnected: root.ethernetConnected
currentWifiSSID: root.currentWifiSSID
wifiIP: root.wifiIP
wifiSignalStrength: root.wifiSignalStrength
wifiNetworks: root.wifiNetworks
wifiScanning: root.wifiScanning
wifiConnectionStatus: root.wifiConnectionStatus
wifiPasswordSSID: root.wifiPasswordSSID
wifiPasswordInput: root.wifiPasswordInput
wifiPasswordDialogVisible: root.wifiPasswordDialogVisible
changingNetworkPreference: root.changingNetworkPreference
// Bind the auto-refresh flag
onWifiAutoRefreshEnabledChanged: {
root.wifiAutoRefreshEnabled = wifiAutoRefreshEnabled
}
@@ -682,11 +666,7 @@ PanelWindow {
BluetoothTab {
anchors.fill: parent
anchors.margins: Theme.spacingM
visible: root.bluetoothAvailable && controlCenterPopup.currentTab === "bluetooth"
// Bind properties from root
bluetoothEnabled: root.bluetoothEnabled
bluetoothDevices: root.bluetoothDevices
visible: BluetoothService.available && controlCenterPopup.currentTab === "bluetooth"
}
// Display Tab

View File

@@ -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 {