From 5d7151e79e04d8a6073ecb4ea4a14c5c9bdcfc52 Mon Sep 17 00:00:00 2001 From: ATMDA Date: Sun, 9 Nov 2025 17:54:16 -0500 Subject: controlcenter: network and audio panels --- modules/BatteryMonitor.qml | 2 +- modules/background/DesktopClock.qml | 1 - modules/controlcenter/NavRail.qml | 2 +- modules/controlcenter/Panes.qml | 22 ++++++---------------- modules/controlcenter/Session.qml | 7 +++++++ modules/controlcenter/WindowFactory.qml | 2 +- modules/controlcenter/WindowTitle.qml | 2 +- services/Network.qml | 21 ++++++++++++++++++--- 8 files changed, 35 insertions(+), 24 deletions(-) diff --git a/modules/BatteryMonitor.qml b/modules/BatteryMonitor.qml index d24cff2..7a3be12 100644 --- a/modules/BatteryMonitor.qml +++ b/modules/BatteryMonitor.qml @@ -15,7 +15,7 @@ Scope { function onOnBatteryChanged(): void { if (UPower.onBattery) { if (Config.utilities.toasts.chargingChanged) - Toaster.toast(qsTr("Charger unplugged"), qsTr("Battery is discharging"), "power_off"); + Toaster.toast(qsTr("Charger unplugged"), qsTr("Battery is now on AC"), "power_off"); } else { if (Config.utilities.toasts.chargingChanged) Toaster.toast(qsTr("Charger plugged in"), qsTr("Battery is charging"), "power"); diff --git a/modules/background/DesktopClock.qml b/modules/background/DesktopClock.qml index 2de325c..6dc6b6b 100644 --- a/modules/background/DesktopClock.qml +++ b/modules/background/DesktopClock.qml @@ -12,7 +12,6 @@ Item { anchors.centerIn: parent text: Time.format(Config.services.useTwelveHourClock ? "hh:mm:ss A" : "hh:mm:ss") - font.family: Appearance.font.family.clock font.pointSize: Appearance.font.size.extraLarge font.bold: true } diff --git a/modules/controlcenter/NavRail.qml b/modules/controlcenter/NavRail.qml index 22c13a3..70438a6 100644 --- a/modules/controlcenter/NavRail.qml +++ b/modules/controlcenter/NavRail.qml @@ -168,7 +168,7 @@ Item { } NavItem { - icon: "tune" + icon: "volume_up" label: "audio" } } diff --git a/modules/controlcenter/Panes.qml b/modules/controlcenter/Panes.qml index 2548c3d..cc4a4cb 100644 --- a/modules/controlcenter/Panes.qml +++ b/modules/controlcenter/Panes.qml @@ -1,6 +1,8 @@ pragma ComponentBehavior: Bound import "bluetooth" +import "network" +import "audio" import qs.components import qs.services import qs.config @@ -23,14 +25,8 @@ ClippingRectangle { Pane { index: 0 - sourceComponent: Item { - StyledText { - anchors.centerIn: parent - text: qsTr("Work in progress") - color: Colours.palette.m3outline - font.pointSize: Appearance.font.size.extraLarge - font.weight: 500 - } + sourceComponent: NetworkPane { + session: root.session } } @@ -43,14 +39,8 @@ ClippingRectangle { Pane { index: 2 - sourceComponent: Item { - StyledText { - anchors.centerIn: parent - text: qsTr("Work in progress") - color: Colours.palette.m3outline - font.pointSize: Appearance.font.size.extraLarge - font.weight: 500 - } + sourceComponent: AudioPane { + session: root.session } } diff --git a/modules/controlcenter/Session.qml b/modules/controlcenter/Session.qml index a143470..b716b20 100644 --- a/modules/controlcenter/Session.qml +++ b/modules/controlcenter/Session.qml @@ -11,6 +11,7 @@ QtObject { property bool navExpanded: false readonly property Bt bt: Bt {} + readonly property Network network: Network {} onActiveChanged: activeIndex = panes.indexOf(active) onActiveIndexChanged: active = panes[activeIndex] @@ -22,4 +23,10 @@ QtObject { property bool fabMenuOpen property bool editingDeviceName } + + component Network: QtObject { + property var active + property bool showPasswordDialog: false + property var pendingNetwork + } } diff --git a/modules/controlcenter/WindowFactory.qml b/modules/controlcenter/WindowFactory.qml index c5b7535..14d85da 100644 --- a/modules/controlcenter/WindowFactory.qml +++ b/modules/controlcenter/WindowFactory.qml @@ -38,7 +38,7 @@ Singleton { implicitWidth: cc.implicitWidth implicitHeight: cc.implicitHeight - title: qsTr("Caelestia Settings - %1").arg(cc.active.slice(0, 1).toUpperCase() + cc.active.slice(1)) + title: qsTr("Settings") ControlCenter { id: cc diff --git a/modules/controlcenter/WindowTitle.qml b/modules/controlcenter/WindowTitle.qml index fb71608..b65746b 100644 --- a/modules/controlcenter/WindowTitle.qml +++ b/modules/controlcenter/WindowTitle.qml @@ -19,7 +19,7 @@ StyledRect { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom - text: qsTr("Caelestia Settings - %1").arg(root.session.active) + text: qsTr("Settings") font.capitalization: Font.Capitalize font.pointSize: Appearance.font.size.larger font.weight: 500 diff --git a/services/Network.qml b/services/Network.qml index 2c31065..f2c403e 100644 --- a/services/Network.qml +++ b/services/Network.qml @@ -27,13 +27,20 @@ Singleton { } function connectToNetwork(ssid: string, password: string): void { - // TODO: Implement password - connectProc.exec(["nmcli", "conn", "up", ssid]); + // First try to connect to an existing connection + // If that fails, create a new connection + if (password && password.length > 0) { + connectProc.exec(["nmcli", "device", "wifi", "connect", ssid, "password", password]); + } else { + // Try to connect to existing connection first + connectProc.exec(["nmcli", "device", "wifi", "connect", ssid]); + } } function disconnectFromNetwork(): void { if (active) { - disconnectProc.exec(["nmcli", "connection", "down", active.ssid]); + // Find the device name first, then disconnect + disconnectProc.exec(["nmcli", "device", "disconnect", "wifi"]); } } @@ -86,6 +93,10 @@ Singleton { Process { id: connectProc + onExited: { + // Refresh network list after connection attempt + getNetworks.running = true; + } stdout: SplitParser { onRead: getNetworks.running = true } @@ -97,6 +108,10 @@ Singleton { Process { id: disconnectProc + onExited: { + // Refresh network list after disconnection + getNetworks.running = true; + } stdout: SplitParser { onRead: getNetworks.running = true } -- cgit v1.2.3-freya