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 {
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");

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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