autofmt+settings db

This commit is contained in:
Lemmy
2026-02-13 16:09:25 -05:00
parent 50e2055028
commit f08b1d5666
9 changed files with 104 additions and 73 deletions
+56 -45
View File
@@ -377,6 +377,62 @@
"subTab": 1, "subTab": 1,
"subTabLabel": "common.templates" "subTabLabel": "common.templates"
}, },
{
"labelKey": "common.bluetooth",
"descriptionKey": null,
"widget": "NLabel",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": null
},
{
"labelKey": "panels.connections.hide-unnamed-devices-label",
"descriptionKey": "panels.connections.hide-unnamed-devices-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": null
},
{
"labelKey": "panels.connections.disable-discoverability-label",
"descriptionKey": "panels.connections.disable-discoverability-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": null
},
{
"labelKey": "panels.connections.bluetooth-rssi-polling-label",
"descriptionKey": "panels.connections.bluetooth-rssi-polling-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": null
},
{
"labelKey": "panels.connections.bluetooth-rssi-polling-interval-label",
"descriptionKey": "panels.connections.bluetooth-rssi-polling-interval-description",
"widget": "NSpinBox",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": null
},
{
"labelKey": "toast.airplane-mode.title",
"descriptionKey": null,
"widget": "NLabel",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": null
},
{
"labelKey": "common.wifi",
"descriptionKey": null,
"widget": "NLabel",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": null
},
{ {
"labelKey": "common.position", "labelKey": "common.position",
"descriptionKey": "panels.control-center.position-description", "descriptionKey": "panels.control-center.position-description",
@@ -1036,51 +1092,6 @@
"subTab": 0, "subTab": 0,
"subTabLabel": "common.appearance" "subTabLabel": "common.appearance"
}, },
{
"labelKey": "actions.enable-wifi",
"descriptionKey": "panels.connections.wifi-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": 0,
"subTabLabel": "common.wifi"
},
{
"labelKey": "actions.enable-bluetooth",
"descriptionKey": "panels.connections.bluetooth-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": 1,
"subTabLabel": "common.bluetooth"
},
{
"labelKey": "panels.connections.hide-unnamed-devices-label",
"descriptionKey": "panels.connections.hide-unnamed-devices-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": 1,
"subTabLabel": "common.bluetooth"
},
{
"labelKey": "panels.connections.disable-discoverability-label",
"descriptionKey": "panels.connections.disable-discoverability-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": 1,
"subTabLabel": "common.bluetooth"
},
{
"labelKey": "panels.connections.bluetooth-rssi-polling-label",
"descriptionKey": "panels.connections.bluetooth-rssi-polling-description",
"widget": "NToggle",
"tab": 15,
"tabLabel": "panels.connections.title",
"subTab": 1,
"subTabLabel": "common.bluetooth"
},
{ {
"labelKey": "panels.notifications.duration-respect-expire-label", "labelKey": "panels.notifications.duration-respect-expire-label",
"descriptionKey": "panels.notifications.duration-respect-expire-description", "descriptionKey": "panels.notifications.duration-respect-expire-description",
+1 -1
View File
@@ -71,7 +71,7 @@ Item {
NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled); NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled);
} else if (action === "wifi-settings") { } else if (action === "wifi-settings") {
SettingsPanelService.openToTab(SettingsPanel.Tab.Connections, 0, screen); SettingsPanelService.openToTab(SettingsPanel.Tab.Connections, 0, screen);
}else if (action === "widget-settings") { } else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings); BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
} }
} }
@@ -17,7 +17,7 @@ NIconButtonHot {
} }
onRightClicked: { onRightClicked: {
if (!Settings.data.network.airplaneModeEnabled) { if (!Settings.data.network.airplaneModeEnabled) {
BluetoothService.setBluetoothEnabled(!BluetoothService.enabled) BluetoothService.setBluetoothEnabled(!BluetoothService.enabled);
} }
} }
} }
@@ -54,7 +54,7 @@ NIconButtonHot {
} }
onRightClicked: { onRightClicked: {
if (!Settings.data.network.airplaneModeEnabled) { if (!Settings.data.network.airplaneModeEnabled) {
NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled) NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled);
} }
} }
} }
@@ -183,7 +183,9 @@ Item {
} }
NText { NText {
text: I18n.tr("panels.connections.bluetooth-discoverable", {hostName: HostService.hostName}) text: I18n.tr("panels.connections.bluetooth-discoverable", {
hostName: HostService.hostName
})
visible: (BluetoothService.enabled && isDiscoverable) visible: (BluetoothService.enabled && isDiscoverable)
richTextEnabled: true richTextEnabled: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@@ -328,9 +330,9 @@ Item {
description: I18n.tr("panels.connections.disable-discoverability-description") description: I18n.tr("panels.connections.disable-discoverability-description")
checked: Settings.data.network.disableDiscoverability checked: Settings.data.network.disableDiscoverability
onToggled: checked => { onToggled: checked => {
Settings.data.network.disableDiscoverability = checked; Settings.data.network.disableDiscoverability = checked;
BluetoothService.setDiscoverable(!checked); BluetoothService.setDiscoverable(!checked);
} }
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
visible: !btprefs.showOnlyLists && BluetoothService.enabled visible: !btprefs.showOnlyLists && BluetoothService.enabled
} }
@@ -100,4 +100,4 @@ Item {
} }
} }
} }
} }
+9 -3
View File
@@ -165,11 +165,17 @@ Singleton {
} }
function isBluetoothDevice(device) { function isBluetoothDevice(device) {
if (!device) {return false;} if (!device) {
return false;
}
// Check for Quickshell Bluetooth device property // Check for Quickshell Bluetooth device property
if (device.batteryAvailable !== undefined) {return true;} if (device.batteryAvailable !== undefined) {
return true;
}
// Check for UPower device path indicating it's a Bluetooth device // Check for UPower device path indicating it's a Bluetooth device
if (device.nativePath && (device.nativePath.includes("bluez") || device.nativePath.includes("bluetooth"))) {return true;} if (device.nativePath && (device.nativePath.includes("bluez") || device.nativePath.includes("bluetooth"))) {
return true;
}
return false; return false;
} }
+24 -12
View File
@@ -146,8 +146,8 @@ Singleton {
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
var output = this.text || ""; var output = this.text || "";
var wifiBlocked = /^\d+:.*Wireless LAN[^\n]*\n\s*Soft blocked:\s*yes/im.test(output) var wifiBlocked = /^\d+:.*Wireless LAN[^\n]*\n\s*Soft blocked:\s*yes/im.test(output);
var btBlocked = /^\d+:.*Bluetooth[^\n]*\n\s*Soft blocked:\s*yes/im.test(output) var btBlocked = /^\d+:.*Bluetooth[^\n]*\n\s*Soft blocked:\s*yes/im.test(output);
var isAirplaneModeActive = wifiBlocked && btBlocked; var isAirplaneModeActive = wifiBlocked && btBlocked;
// Check if airplane mode has been toggled // Check if airplane mode has been toggled
@@ -156,13 +156,13 @@ Singleton {
NetworkService.setWifiEnabled(false); NetworkService.setWifiEnabled(false);
Settings.data.network.airplaneModeEnabled = true; Settings.data.network.airplaneModeEnabled = true;
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.enabled"), "plane"); ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.enabled"), "plane");
Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter blocked") Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter blocked");
} else if (!isAirplaneModeActive && root.airplaneModeEnabled) { } else if (!isAirplaneModeActive && root.airplaneModeEnabled) {
root.airplaneModeToggled = true; root.airplaneModeToggled = true;
NetworkService.setWifiEnabled(true); NetworkService.setWifiEnabled(true);
Settings.data.network.airplaneModeEnabled = false; Settings.data.network.airplaneModeEnabled = false;
ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.disabled"), "plane-off"); ToastService.showNotice(I18n.tr("toast.airplane-mode.title"), I18n.tr("common.disabled"), "plane-off");
Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter unblocked") Logger.i("AirplaneMode", "Wi-Fi & Bluetooth adapter unblocked");
} else { } else {
var isCurrentlyEnabled = (adapter && adapter.enabled) || root.ctlPowered; var isCurrentlyEnabled = (adapter && adapter.enabled) || root.ctlPowered;
var stateChanged = isCurrentlyEnabled !== root._lastEnabledState; var stateChanged = isCurrentlyEnabled !== root._lastEnabledState;
@@ -192,7 +192,9 @@ Singleton {
Process { Process {
id: ctlShowProcess id: ctlShowProcess
running: false running: false
stdout: StdioCollector { id: ctlStdout } stdout: StdioCollector {
id: ctlStdout
}
onExited: function (exitCode, exitStatus) { onExited: function (exitCode, exitStatus) {
try { try {
var text = ctlStdout.text || ""; var text = ctlStdout.text || "";
@@ -208,13 +210,19 @@ Singleton {
foundController = true; foundController = true;
} }
var mp = line.match(/\bPowered:\s*(yes|no)\b/i); var mp = line.match(/\bPowered:\s*(yes|no)\b/i);
if (mp) { powered = (mp[1].toLowerCase() === "yes"); } if (mp) {
powered = (mp[1].toLowerCase() === "yes");
}
var md = line.match(/\bDiscoverable:\s*(yes|no)\b/i); var md = line.match(/\bDiscoverable:\s*(yes|no)\b/i);
if (md) { discoverable = (md[1].toLowerCase() === "yes"); } if (md) {
discoverable = (md[1].toLowerCase() === "yes");
}
var ms = line.match(/\bDiscovering:\s*(yes|no)\b/i); var ms = line.match(/\bDiscovering:\s*(yes|no)\b/i);
if (ms) { discovering = (ms[1].toLowerCase() === "yes"); } if (ms) {
discovering = (ms[1].toLowerCase() === "yes");
}
} }
root.ctlAvailable = foundController; // Assign findings. root.ctlAvailable = foundController; // Assign findings.
root.ctlPowered = powered; // Assign findings. root.ctlPowered = powered; // Assign findings.
@@ -502,10 +510,14 @@ Singleton {
return ""; return "";
} }
try { try {
if (device.pairing) return "pairing"; if (device.pairing)
if (device.blocked) return "blocked"; return "pairing";
if (device.state === BluetoothDevice.Connecting) return "connecting"; if (device.blocked)
if (device.state === BluetoothDevice.Disconnecting) return "disconnecting"; return "blocked";
if (device.state === BluetoothDevice.Connecting)
return "connecting";
if (device.state === BluetoothDevice.Disconnecting)
return "disconnecting";
} catch (_) {} } catch (_) {}
return ""; return "";
} }
+5 -5
View File
@@ -851,7 +851,7 @@ Singleton {
for (var i = 0; i < parts.length; i++) { for (var i = 0; i < parts.length; i++) {
var p = parts[i]; var p = parts[i];
if (p && p.length > 0) { if (p && p.length > 0) {
compact.push(p); compact.push(p);
} }
} }
// Find a token that represents Mbit/s and use the previous number // Find a token that represents Mbit/s and use the previous number
@@ -1270,8 +1270,8 @@ Singleton {
root.connectingTo = ""; root.connectingTo = "";
Logger.i("Network", "Connected to network: '" + connectProcess.ssid + "'"); Logger.i("Network", "Connected to network: '" + connectProcess.ssid + "'");
ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("toast.wifi.connected", { ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("toast.wifi.connected", {
"ssid": connectProcess.ssid "ssid": connectProcess.ssid
}), "wifi"); }), "wifi");
// Still do a scan to get accurate signal and security info // Still do a scan to get accurate signal and security info
delayedScanTimer.interval = 5000; delayedScanTimer.interval = 5000;
@@ -1316,8 +1316,8 @@ Singleton {
onStreamFinished: { onStreamFinished: {
Logger.i("Network", "Disconnected from network: '" + disconnectProcess.ssid + "'"); Logger.i("Network", "Disconnected from network: '" + disconnectProcess.ssid + "'");
ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("toast.wifi.disconnected", { ToastService.showNotice(I18n.tr("common.wifi"), I18n.tr("toast.wifi.disconnected", {
"ssid": disconnectProcess.ssid "ssid": disconnectProcess.ssid
}), "wifi-off"); }), "wifi-off");
// Immediately update UI on successful disconnect // Immediately update UI on successful disconnect
root.updateNetworkStatus(disconnectProcess.ssid, false); root.updateNetworkStatus(disconnectProcess.ssid, false);