Lay the Control Center out as a resizable, editable grid

Modules are tiles on a 4-column grid, each 1x1 to 4x4 and adapting its
layout to its size. Edit Controls in the panel reorders by dragging,
resizes from a corner handle, removes with a badge and adds from a tray.
Connectivity splits into Wi-Fi, Bluetooth and Network tiles and Audio
into Sound and Microphone; right-clicking Sound extends it with output
devices and a volume slider per app. Adds a Caffeine tile. Config
version 2 migrates existing layouts in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-10-17 20:52:14 +02:00
1 parent 0dcf37346c
commit 11bdc4c751
32 files changed
+2147 -355

No files matched your search

+117 -27
View File
@@ -1,60 +1,150 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import "../components"
import "../core"
import "../theme"
// Small Control Center tile: round toggle, title and state; the whole tile toggles.
ControlCard {
// Toggle tile: icon, title and state. 1×1 is a round toggle, one row is a pill
// with labels beside the icon, taller tiles stack them. Left click toggles;
// right click opens the matching Settings page.
CCModule {
id: root
property string title
property string glyph
property string fallback
property string detail
property string page
property bool checked: false
// 1×1 shows the icon; modules with their own compact face turn it off.
property bool compactGlyph: true
signal clicked
padding: 10
heading: false
signal secondaryClicked
round: true
hovered: area.containsMouse && enabled
opacity: enabled ? 1 : 0.55
color: area.containsMouse && enabled ? Theme.hover : Theme.fill
color: compact && checked ? Theme.accent : hovered ? Theme.hover : Theme.fill
Accessible.role: Accessible.CheckBox
Accessible.name: title
Accessible.checked: checked
onSecondaryClicked: if (page)
ShellState.openSettings(page)
component Labels: ColumnLayout {
property int align: Text.AlignLeft
property int lines: 1
spacing: 1
Text {
text: root.title
color: Theme.text
font.pixelSize: root.wide && root.tall ? 14 : 12
font.weight: Font.DemiBold
elide: Text.ElideRight
horizontalAlignment: parent.align
Layout.fillWidth: true
}
Text {
text: root.detail
visible: text !== ""
color: Theme.textSecondary
font.pixelSize: 11
elide: Text.ElideRight
wrapMode: parent.lines > 1 ? Text.Wrap : Text.NoWrap
maximumLineCount: parent.lines
horizontalAlignment: parent.align
Layout.fillWidth: true
}
}
MouseArea {
id: area
parent: root
z: -1
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
onClicked: mouse => mouse.button === Qt.RightButton ? root.secondaryClicked() : root.clicked()
}
GlassToolTip {
visible: root.compact && area.containsMouse
delay: 500
text: root.title + (root.detail ? " · " + root.detail : "")
}
// 1×1: the circle itself is the toggle.
Text {
visible: root.compact && root.compactGlyph
x: root.background.x + (root.background.width - width) / 2
y: root.background.y + (root.background.height - height) / 2
text: Icons.available && root.glyph ? root.glyph : root.fallback
font.family: Icons.available && root.glyph ? Icons.family : ""
font.pixelSize: Math.round(root.background.width * 0.34)
font.weight: Font.DemiBold
color: root.checked ? Theme.accentText : Theme.text
scale: area.pressed ? 0.92 : 1
Behavior on scale {
NumberAnimation {
duration: Theme.duration / 2
}
}
}
// One row: icon beside the labels.
RowLayout {
Layout.fillWidth: true
visible: root.wide && !root.tall
anchors.fill: parent
anchors.leftMargin: (root.baseHeight - toggleRow.size) / 2
anchors.rightMargin: 14
spacing: 10
CCToggle {
id: toggleRow
size: Math.min(38, root.baseHeight - 20)
glyph: root.glyph
fallback: root.fallback
checked: root.checked
enabled: root.enabled
onClicked: root.clicked()
}
ColumnLayout {
Labels {
Layout.fillWidth: true
spacing: 0
Text {
text: root.title
color: Theme.text
font.pixelSize: 12
font.weight: Font.DemiBold
elide: Text.ElideRight
Layout.fillWidth: true
}
Text {
text: root.detail
visible: text !== ""
color: Theme.textSecondary
font.pixelSize: 11
elide: Text.ElideRight
Layout.fillWidth: true
}
}
}
// One column: icon above centred labels.
ColumnLayout {
visible: !root.wide && root.tall
anchors.centerIn: parent
width: parent.width - 16
spacing: 8
CCToggle {
size: Math.min(44, root.width - 24)
Layout.alignment: Qt.AlignHCenter
glyph: root.glyph
fallback: root.fallback
checked: root.checked
enabled: root.enabled
onClicked: root.clicked()
}
Labels {
align: Text.AlignHCenter
lines: Math.max(1, root.rows - 1)
Layout.fillWidth: true
}
}
// Large: icon top left, labels along the bottom.
CCToggle {
visible: root.wide && root.tall
x: 14
y: 14
size: 44
glyph: root.glyph
fallback: root.fallback
checked: root.checked
enabled: root.enabled
onClicked: root.clicked()
}
Labels {
visible: root.wide && root.tall
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 14
lines: root.rows - 1
}
}