controlcenter: network and audio panels

This commit is contained in:
ATMDA 2025-11-09 17:54:16 -05:00
parent c0ea060ffe
commit 5d7151e79e
8 changed files with 35 additions and 24 deletions

View file

@ -15,7 +15,7 @@ Scope {
function onOnBatteryChanged(): void { function onOnBatteryChanged(): void {
if (UPower.onBattery) { if (UPower.onBattery) {
if (Config.utilities.toasts.chargingChanged) 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 { } else {
if (Config.utilities.toasts.chargingChanged) if (Config.utilities.toasts.chargingChanged)
Toaster.toast(qsTr("Charger plugged in"), qsTr("Battery is charging"), "power"); Toaster.toast(qsTr("Charger plugged in"), qsTr("Battery is charging"), "power");

View file

@ -12,7 +12,6 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
text: Time.format(Config.services.useTwelveHourClock ? "hh:mm:ss A" : "hh:mm:ss") 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.pointSize: Appearance.font.size.extraLarge
font.bold: true font.bold: true
} }

View file

@ -168,7 +168,7 @@ Item {
} }
NavItem { NavItem {
icon: "tune" icon: "volume_up"
label: "audio" label: "audio"
} }
} }

View file

@ -1,6 +1,8 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import "bluetooth" import "bluetooth"
import "network"
import "audio"
import qs.components import qs.components
import qs.services import qs.services
import qs.config import qs.config
@ -23,14 +25,8 @@ ClippingRectangle {
Pane { Pane {
index: 0 index: 0
sourceComponent: Item { sourceComponent: NetworkPane {
StyledText { session: root.session
anchors.centerIn: parent
text: qsTr("Work in progress")
color: Colours.palette.m3outline
font.pointSize: Appearance.font.size.extraLarge
font.weight: 500
}
} }
} }
@ -43,14 +39,8 @@ ClippingRectangle {
Pane { Pane {
index: 2 index: 2
sourceComponent: Item { sourceComponent: AudioPane {
StyledText { session: root.session
anchors.centerIn: parent
text: qsTr("Work in progress")
color: Colours.palette.m3outline
font.pointSize: Appearance.font.size.extraLarge
font.weight: 500
}
} }
} }

View file

@ -11,6 +11,7 @@ QtObject {
property bool navExpanded: false property bool navExpanded: false
readonly property Bt bt: Bt {} readonly property Bt bt: Bt {}
readonly property Network network: Network {}
onActiveChanged: activeIndex = panes.indexOf(active) onActiveChanged: activeIndex = panes.indexOf(active)
onActiveIndexChanged: active = panes[activeIndex] onActiveIndexChanged: active = panes[activeIndex]
@ -22,4 +23,10 @@ QtObject {
property bool fabMenuOpen property bool fabMenuOpen
property bool editingDeviceName property bool editingDeviceName
} }
component Network: QtObject {
property var active
property bool showPasswordDialog: false
property var pendingNetwork
}
} }

View file

@ -38,7 +38,7 @@ Singleton {
implicitWidth: cc.implicitWidth implicitWidth: cc.implicitWidth
implicitHeight: cc.implicitHeight implicitHeight: cc.implicitHeight
title: qsTr("Caelestia Settings - %1").arg(cc.active.slice(0, 1).toUpperCase() + cc.active.slice(1)) title: qsTr("Settings")
ControlCenter { ControlCenter {
id: cc id: cc

View file

@ -19,7 +19,7 @@ StyledRect {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
text: qsTr("Caelestia Settings - %1").arg(root.session.active) text: qsTr("Settings")
font.capitalization: Font.Capitalize font.capitalization: Font.Capitalize
font.pointSize: Appearance.font.size.larger font.pointSize: Appearance.font.size.larger
font.weight: 500 font.weight: 500

View file

@ -27,13 +27,20 @@ Singleton {
} }
function connectToNetwork(ssid: string, password: string): void { function connectToNetwork(ssid: string, password: string): void {
// TODO: Implement password // First try to connect to an existing connection
connectProc.exec(["nmcli", "conn", "up", ssid]); // 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 { function disconnectFromNetwork(): void {
if (active) { 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 { Process {
id: connectProc id: connectProc
onExited: {
// Refresh network list after connection attempt
getNetworks.running = true;
}
stdout: SplitParser { stdout: SplitParser {
onRead: getNetworks.running = true onRead: getNetworks.running = true
} }
@ -97,6 +108,10 @@ Singleton {
Process { Process {
id: disconnectProc id: disconnectProc
onExited: {
// Refresh network list after disconnection
getNetworks.running = true;
}
stdout: SplitParser { stdout: SplitParser {
onRead: getNetworks.running = true onRead: getNetworks.running = true
} }