mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
network: cleaning up duplicate settings and simplifying logic
This commit is contained in:
@@ -1844,6 +1844,15 @@
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.panels"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.user-interface.settings-panel-sidebar-label",
|
||||
"descriptionKey": "panels.user-interface.settings-panel-sidebar-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 1,
|
||||
"tabLabel": "panels.user-interface.title",
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.panels"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.general.screen-corners-show-corners-label",
|
||||
"descriptionKey": "panels.general.screen-corners-show-corners-description",
|
||||
|
||||
@@ -316,13 +316,7 @@ Singleton {
|
||||
property real panelBackgroundOpacity: 0.93
|
||||
property bool panelsAttachedToBar: true
|
||||
property string settingsPanelMode: "attached" // "centered", "attached", "window"
|
||||
// Details view mode persistence for panels
|
||||
property string wifiDetailsViewMode: "grid" // "grid" or "list"
|
||||
property string bluetoothDetailsViewMode: "grid" // "grid" or "list"
|
||||
// Persist the last-opened view for the unified network panel: "wifi" | "ethernet"
|
||||
property string networkPanelView: "wifi"
|
||||
// Bluetooth available devices list: hide items without a name
|
||||
property bool bluetoothHideUnnamedDevices: false
|
||||
|
||||
property bool boxBorderEnabled: false
|
||||
}
|
||||
|
||||
@@ -556,6 +550,7 @@ Singleton {
|
||||
property bool airplaneModeEnabled: false
|
||||
property bool bluetoothRssiPollingEnabled: false // Opt-in Bluetooth RSSI polling (uses bluetoothctl)
|
||||
property int bluetoothRssiPollIntervalMs: 60000 // Polling interval in milliseconds for RSSI queries
|
||||
property string networkPanelView: "wifi"
|
||||
property string wifiDetailsViewMode: "grid" // "grid" or "list"
|
||||
property string bluetoothDetailsViewMode: "grid" // "grid" or "list"
|
||||
property bool bluetoothHideUnnamedDevices: false
|
||||
|
||||
@@ -18,10 +18,10 @@ SmartPanel {
|
||||
property string passwordSsid: ""
|
||||
property string expandedSsid: ""
|
||||
|
||||
// Info panel collapsed by default, view mode persisted under Settings.data.ui.wifiDetailsViewMode
|
||||
// Info panel collapsed by default, view mode persisted in settings
|
||||
// Ethernet details UI state (mirrors Wi‑Fi info behavior)
|
||||
property bool ethernetInfoExpanded: false
|
||||
property bool ethernetDetailsGrid: (Settings.data && Settings.data.ui && Settings.data.network.wifiDetailsViewMode !== undefined) ? (Settings.data.network.wifiDetailsViewMode === "grid") : true
|
||||
property bool ethernetDetailsGrid: (Settings.data.network.wifiDetailsViewMode === "grid")
|
||||
|
||||
// Unified panel view mode: "wifi" | "ethernet" (persisted)
|
||||
property string panelViewMode: "wifi"
|
||||
@@ -29,8 +29,9 @@ SmartPanel {
|
||||
|
||||
onPanelViewModeChanged: {
|
||||
// Persist last view (only after restored the initial value)
|
||||
if (panelViewPersistEnabled && Settings.data && Settings.data.ui && Settings.data.ui.networkPanelView !== undefined)
|
||||
if (panelViewPersistEnabled) {
|
||||
Settings.data.ui.networkPanelView = panelViewMode;
|
||||
}
|
||||
// Reset transient states to avoid layout artifacts
|
||||
passwordSsid = "";
|
||||
expandedSsid = "";
|
||||
@@ -71,7 +72,7 @@ SmartPanel {
|
||||
// Also fetch Ethernet details if connected
|
||||
NetworkService.refreshActiveEthernetDetails();
|
||||
// Restore last view if valid, otherwise choose what's available (prefer Wi‑Fi when both exist)
|
||||
if (Settings.data && Settings.data.ui && Settings.data.ui.networkPanelView) {
|
||||
if (Settings.data.ui.networkPanelView) {
|
||||
const last = Settings.data.ui.networkPanelView;
|
||||
if (last === "ethernet" && NetworkService.hasEthernet()) {
|
||||
panelViewMode = "ethernet";
|
||||
@@ -645,9 +646,7 @@ SmartPanel {
|
||||
baseSize: Style.baseWidgetSize * 0.8
|
||||
onClicked: {
|
||||
ethernetDetailsGrid = !ethernetDetailsGrid;
|
||||
if (Settings.data && Settings.data.ui) {
|
||||
Settings.data.ui.wifiDetailsViewMode = ethernetDetailsGrid ? "grid" : "list";
|
||||
}
|
||||
Settings.data.network.wifiDetailsViewMode = ethernetDetailsGrid ? "grid" : "list";
|
||||
}
|
||||
z: 1
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ NBox {
|
||||
property string infoSsid: ""
|
||||
// Local layout toggle for details: true = grid (2 cols), false = rows (1 col)
|
||||
// Persisted under Settings.data.network.wifiDetailsViewMode
|
||||
property bool detailsGrid: (Settings.data && Settings.data.ui && Settings.data.network.wifiDetailsViewMode !== undefined) ? (Settings.data.network.wifiDetailsViewMode === "grid") : true
|
||||
property bool detailsGrid: (Settings.data.network.wifiDetailsViewMode === "grid")
|
||||
|
||||
signal passwordRequested(string ssid)
|
||||
signal passwordSubmitted(string ssid, string password)
|
||||
|
||||
@@ -49,7 +49,7 @@ Item {
|
||||
readonly property var availableDevices: {
|
||||
var list = root.unnamedAvailableDevices;
|
||||
|
||||
if (Settings.data && Settings.data.ui && Settings.data.network.bluetoothHideUnnamedDevices) {
|
||||
if (Settings.data.network.bluetoothHideUnnamedDevices) {
|
||||
list = list.filter(function (dev) {
|
||||
var dn = dev.name || dev.deviceName || "";
|
||||
var s = String(dn).trim();
|
||||
@@ -78,7 +78,7 @@ Item {
|
||||
|
||||
// For managing expanded device details
|
||||
property string expandedDeviceKey: ""
|
||||
property bool detailsGrid: (Settings.data && Settings.data.ui && Settings.data.network.bluetoothDetailsViewMode !== undefined) ? (Settings.data.network.bluetoothDetailsViewMode === "grid") : true
|
||||
property bool detailsGrid: (Settings.data.network.bluetoothDetailsViewMode === "grid")
|
||||
|
||||
// Combined visibility check: tab must be visible AND the window must be visible
|
||||
readonly property bool effectivelyVisible: root.visible && Window.window && Window.window.visible
|
||||
@@ -533,9 +533,7 @@ Item {
|
||||
baseSize: Style.baseWidgetSize * 0.8
|
||||
onClicked: {
|
||||
root.detailsGrid = !root.detailsGrid;
|
||||
if (Settings.data && Settings.data.ui) {
|
||||
Settings.data.network.bluetoothDetailsViewMode = root.detailsGrid ? "grid" : "list";
|
||||
}
|
||||
Settings.data.network.bluetoothDetailsViewMode = root.detailsGrid ? "grid" : "list";
|
||||
}
|
||||
z: 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user