Drop the dashboard's now-unused Open from clock toggle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
201 lines
8.1 KiB
QML
201 lines
8.1 KiB
QML
pragma ComponentBehavior: Bound
|
||
import QtQuick
|
||
import QtQuick.Layouts
|
||
import "../controls"
|
||
import "../../components"
|
||
import "../../core"
|
||
import "../../services"
|
||
import "../../theme"
|
||
|
||
SettingsPage {
|
||
id: root
|
||
readonly property var options: ConfigService.data.dashboard
|
||
readonly property var placements: ["top-left", "top-center", "top-right", "center"]
|
||
function edit(index, enabled) {
|
||
const list = options.tabs.map(t => Object.assign({}, t));
|
||
list[index].enabled = enabled;
|
||
ConfigService.setValue("dashboard.tabs", list);
|
||
}
|
||
function move(index, step) {
|
||
const list = options.tabs.slice();
|
||
const to = index + step;
|
||
if (to < 0 || to >= list.length)
|
||
return;
|
||
const entry = list.splice(index, 1)[0];
|
||
list.splice(to, 0, entry);
|
||
ConfigService.setValue("dashboard.tabs", list);
|
||
}
|
||
SettingsSection {
|
||
title: "Dashboard"
|
||
description: "A tabbed glass panel below the bar. Open it with “glassmxrph dashboard [tab]”, or bind that to a key. ←/→, Tab and 1–4 switch tabs."
|
||
PreferenceToggle {
|
||
label: "Enable dashboard"
|
||
icon: ""
|
||
setting: "dashboard.enabled"
|
||
}
|
||
PreferenceToggle {
|
||
label: "Remember last tab"
|
||
description: "Otherwise it opens on the first tab"
|
||
icon: ""
|
||
setting: "dashboard.rememberTab"
|
||
}
|
||
SettingRow {
|
||
title: "Preview"
|
||
icon: ""
|
||
GlassButton {
|
||
objectName: "dashboardOpenButton"
|
||
text: "Open dashboard"
|
||
enabled: root.options.enabled
|
||
onClicked: ShellState.openDashboard("")
|
||
}
|
||
}
|
||
}
|
||
SettingsSection {
|
||
title: "Placement"
|
||
PreferenceChoice {
|
||
label: "Position"
|
||
icon: ""
|
||
setting: "dashboard.position"
|
||
choices: root.placements
|
||
}
|
||
SettingRow {
|
||
title: "Screen"
|
||
description: "Click a spot to move the dashboard"
|
||
icon: ""
|
||
below: Item {
|
||
Layout.fillWidth: true
|
||
implicitHeight: 150
|
||
// Miniature screen with the bar and the four possible spots.
|
||
Rectangle {
|
||
id: screenPreview
|
||
objectName: "dashboardPlacementPreview"
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
width: 240
|
||
height: 140
|
||
radius: 10
|
||
color: Theme.fill
|
||
border.width: 1
|
||
border.color: Theme.hairline
|
||
Rectangle {
|
||
x: 6
|
||
y: 6
|
||
width: parent.width - 12
|
||
height: 8
|
||
radius: 4
|
||
color: Theme.surfaceVariant
|
||
border.width: 1
|
||
border.color: Theme.hairline
|
||
}
|
||
Repeater {
|
||
model: root.placements
|
||
Rectangle {
|
||
id: spot
|
||
required property string modelData
|
||
readonly property bool active: root.options.position === modelData
|
||
objectName: "dashboardSpot-" + modelData
|
||
width: 64
|
||
height: 38
|
||
radius: 7
|
||
x: modelData === "top-left" ? 10 : modelData === "top-right" ? screenPreview.width - width - 10 : (screenPreview.width - width) / 2
|
||
y: modelData === "center" ? 76 : 22
|
||
color: active ? Qt.alpha(Theme.accent, 0.55) : spotArea.containsMouse ? Theme.hover : Theme.transparent
|
||
border.width: 1
|
||
border.color: active ? Theme.accentVivid : Qt.alpha(Theme.text, 0.18)
|
||
z: active ? 2 : 1
|
||
Behavior on color {
|
||
ColorAnimation {
|
||
duration: Theme.duration
|
||
}
|
||
}
|
||
Text {
|
||
anchors.centerIn: parent
|
||
visible: spot.active || spotArea.containsMouse
|
||
text: spot.modelData
|
||
color: Theme.text
|
||
font.pixelSize: 10
|
||
}
|
||
MouseArea {
|
||
id: spotArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
cursorShape: Qt.PointingHandCursor
|
||
onClicked: ConfigService.setValue("dashboard.position", spot.modelData)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
SettingsSection {
|
||
title: "Tabs"
|
||
description: "Order and visibility of the dashboard tabs"
|
||
Repeater {
|
||
model: root.options.tabs
|
||
SettingRow {
|
||
id: tabRow
|
||
required property var modelData
|
||
required property int index
|
||
readonly property var entry: DashboardRegistry.entry(modelData.id)
|
||
title: entry ? entry.title : modelData.id + " (unavailable)"
|
||
description: entry ? entry.description : ""
|
||
icon: entry ? entry.glyph : ""
|
||
GlassIconButton {
|
||
objectName: "dash-up-" + tabRow.modelData.id
|
||
text: "↑"
|
||
enabled: tabRow.index > 0
|
||
onClicked: root.move(tabRow.index, -1)
|
||
Accessible.name: "Move " + tabRow.title + " up"
|
||
}
|
||
GlassIconButton {
|
||
objectName: "dash-down-" + tabRow.modelData.id
|
||
text: "↓"
|
||
enabled: tabRow.index < root.options.tabs.length - 1
|
||
onClicked: root.move(tabRow.index, 1)
|
||
Accessible.name: "Move " + tabRow.title + " down"
|
||
}
|
||
GlassToggle {
|
||
objectName: "dash-enable-" + tabRow.modelData.id
|
||
checked: tabRow.modelData.enabled
|
||
// Keep at least one tab.
|
||
enabled: !checked || root.options.tabs.filter(t => t.enabled).length > 1
|
||
onClicked: root.edit(tabRow.index, checked)
|
||
}
|
||
}
|
||
}
|
||
Flow {
|
||
Layout.fillWidth: true
|
||
Layout.margins: 8
|
||
spacing: 8
|
||
visible: addRepeater.count > 0
|
||
Repeater {
|
||
id: addRepeater
|
||
model: Object.keys(DashboardRegistry.tabs).filter(id => !root.options.tabs.some(t => t.id === id))
|
||
GlassButton {
|
||
required property string modelData
|
||
text: "+ " + DashboardRegistry.tabs[modelData].title
|
||
onClicked: ConfigService.setValue("dashboard.tabs", root.options.tabs.concat([
|
||
{
|
||
id: modelData,
|
||
enabled: true
|
||
}
|
||
]))
|
||
}
|
||
}
|
||
}
|
||
}
|
||
SettingsSection {
|
||
title: "Media"
|
||
PreferenceToggle {
|
||
label: "EasyEffects equalizer"
|
||
description: EasyEffectsService.known && !EasyEffectsService.installed ? "EasyEffects is not installed" : "Ten-band equalizer and presets in the Media tab"
|
||
icon: ""
|
||
setting: "dashboard.easyEffects"
|
||
}
|
||
}
|
||
SettingNote {
|
||
text: "The equalizer writes its own EasyEffects output preset, glassmxrph_eq, and starts EasyEffects in service mode when you apply. Restart and Shut down ask for confirmation."
|
||
}
|
||
Component.onCompleted: EasyEffectsService.refresh()
|
||
}
|