Share demand counting and jump easing; split Settings sidebar
Add services/Demand.qml, which holds one count on a service's demand counter while active. It replaces 13 hand-written consumer counters across the bar, Control Center, dashboard, media and desktop widgets. The desktop Cava widget now releases Cava while its desktop is covered. Add components/JumpValue.qml for the "animate only visible jumps" rule shared by the dashboard gauge and resource bars. Move the Settings sidebar (search and navigation) into settings/SettingsSidebar.qml and the drag handle into settings/controls/SettingsDragArea.qml, halving Settings.qml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
99e64a7713
commit
bf0ef09cec
18 files changed
+595
-570
No files matched your search
@@ -35,8 +35,10 @@ GlassPill {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
Component.onCompleted: CavaService.widgetConsumers++
|
||||
Component.onDestruction: CavaService.widgetConsumers--
|
||||
Demand {
|
||||
service: CavaService
|
||||
counter: "widgetConsumers"
|
||||
}
|
||||
// Cava emits 24 bands; each pill bar averages its share of them.
|
||||
function level(index) {
|
||||
const all = CavaService.bars, n = options.bars, from = Math.floor(index * all.length / n), to = Math.max(from + 1, Math.floor((index + 1) * all.length / n));
|
||||
|
||||
@@ -6,8 +6,9 @@ import "../../core"
|
||||
GlassButton {
|
||||
property string metric: "cpu"
|
||||
implicitHeight: ModuleRegistry.pillHeight
|
||||
Component.onCompleted: MetricsService.consumers++
|
||||
Component.onDestruction: MetricsService.consumers--
|
||||
Demand {
|
||||
service: MetricsService
|
||||
}
|
||||
text: {
|
||||
switch (metric) {
|
||||
case "cpu":
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import QtQuick
|
||||
import "../theme"
|
||||
|
||||
// Follows `target`, easing only visible jumps (at least `threshold`); smaller
|
||||
// changes snap. Easing every small sample change kept windows rendering at the
|
||||
// display's refresh rate.
|
||||
QtObject {
|
||||
id: root
|
||||
property real target
|
||||
property real threshold: 2
|
||||
property int duration: Theme.duration * 2
|
||||
property real value
|
||||
property bool animate: false
|
||||
onTargetChanged: {
|
||||
animate = Math.abs(target - value) >= threshold;
|
||||
value = target;
|
||||
}
|
||||
Component.onCompleted: value = target
|
||||
Behavior on value {
|
||||
enabled: root.animate
|
||||
NumberAnimation {
|
||||
duration: root.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,9 @@ import "../../theme"
|
||||
// Wi-Fi, Bluetooth and live throughput; labels open the matching Settings page.
|
||||
ControlCard {
|
||||
id: root
|
||||
Component.onCompleted: MetricsService.consumers++
|
||||
Component.onDestruction: MetricsService.consumers--
|
||||
Demand {
|
||||
service: MetricsService
|
||||
}
|
||||
component Entry: RowLayout {
|
||||
id: entry
|
||||
property alias toggle: toggle
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import QtQuick
|
||||
import "../components"
|
||||
import "../theme"
|
||||
|
||||
// Ring gauge (0–100) with a centred label; null values draw an empty ring.
|
||||
@@ -12,23 +13,11 @@ Item {
|
||||
property string caption: ""
|
||||
implicitWidth: size
|
||||
implicitHeight: size
|
||||
readonly property real target: Number.isFinite(value) ? Math.max(0, Math.min(100, value)) : 0
|
||||
// Only visible jumps animate: easing every small sample change kept the
|
||||
// window rendering at the display's refresh rate.
|
||||
property real shown
|
||||
property bool easeJump: false
|
||||
Component.onCompleted: shown = target
|
||||
onTargetChanged: {
|
||||
easeJump = Math.abs(target - shown) >= 2;
|
||||
shown = target;
|
||||
}
|
||||
Behavior on shown {
|
||||
enabled: root.easeJump
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
JumpValue {
|
||||
id: level
|
||||
target: Number.isFinite(root.value) ? Math.max(0, Math.min(100, root.value)) : 0
|
||||
}
|
||||
readonly property real shown: level.value
|
||||
onShownChanged: canvas.requestPaint()
|
||||
onColorChanged: canvas.requestPaint()
|
||||
Canvas {
|
||||
|
||||
@@ -18,21 +18,19 @@ Item {
|
||||
readonly property var player: MediaService.player
|
||||
// Streams report no length or absurd ones; show them as live.
|
||||
readonly property bool live: MediaService.length <= 0 || MediaService.length > 7 * 86400
|
||||
property bool subscribed: false
|
||||
onCurrentChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (subscribed) {
|
||||
MediaService.progressConsumers--;
|
||||
CavaService.widgetConsumers--;
|
||||
onCurrentChanged: if (current)
|
||||
EasyEffectsService.refresh()
|
||||
Component.onCompleted: if (current)
|
||||
EasyEffectsService.refresh()
|
||||
Demand {
|
||||
service: MediaService
|
||||
counter: "progressConsumers"
|
||||
active: root.current
|
||||
}
|
||||
function sync() {
|
||||
if (current === subscribed)
|
||||
return;
|
||||
MediaService.progressConsumers += current ? 1 : -1;
|
||||
CavaService.widgetConsumers += current ? 1 : -1;
|
||||
subscribed = current;
|
||||
if (current)
|
||||
EasyEffectsService.refresh();
|
||||
Demand {
|
||||
service: CavaService
|
||||
counter: "widgetConsumers"
|
||||
active: root.current
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
@@ -5,6 +5,7 @@ import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import ".."
|
||||
import "../../widgets/faces" as Faces
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
|
||||
@@ -16,19 +17,14 @@ Item {
|
||||
implicitHeight: row.implicitHeight
|
||||
// Collectors only run while this tab is on screen.
|
||||
readonly property bool live: current
|
||||
property bool subscribed: false
|
||||
onLiveChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (subscribed) {
|
||||
MetricsService.consumers--;
|
||||
MediaService.progressConsumers--;
|
||||
Demand {
|
||||
service: MetricsService
|
||||
active: root.live
|
||||
}
|
||||
function sync() {
|
||||
if (live === subscribed)
|
||||
return;
|
||||
MetricsService.consumers += live ? 1 : -1;
|
||||
MediaService.progressConsumers += live ? 1 : -1;
|
||||
subscribed = live;
|
||||
Demand {
|
||||
service: MediaService
|
||||
counter: "progressConsumers"
|
||||
active: root.live
|
||||
}
|
||||
readonly property var disk: (MetricsService.snapshot.storage || []).find(s => s.available) || ({})
|
||||
|
||||
@@ -215,14 +211,9 @@ Item {
|
||||
property string fallback
|
||||
property string label
|
||||
spacing: 8
|
||||
readonly property real target: Number.isFinite(value) ? Math.max(0, Math.min(100, value)) : 0
|
||||
// Only visible jumps animate (see Gauge).
|
||||
property real shown
|
||||
property bool easeJump: false
|
||||
Component.onCompleted: shown = target
|
||||
onTargetChanged: {
|
||||
easeJump = Math.abs(target - shown) >= 2;
|
||||
shown = target;
|
||||
JumpValue {
|
||||
id: level
|
||||
target: Number.isFinite(bar.value) ? Math.max(0, Math.min(100, bar.value)) : 0
|
||||
}
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -242,16 +233,9 @@ Item {
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
height: Math.max(parent.width, parent.height * bar.shown / 100)
|
||||
height: Math.max(parent.width, parent.height * level.value / 100)
|
||||
radius: 5
|
||||
color: bar.shown > 85 ? Theme.urgent : Theme.accentVivid
|
||||
Behavior on height {
|
||||
enabled: bar.easeJump
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
color: level.target > 85 ? Theme.urgent : Theme.accentVivid
|
||||
}
|
||||
}
|
||||
Text {
|
||||
|
||||
@@ -11,16 +11,9 @@ Item {
|
||||
property bool current: false
|
||||
implicitWidth: grid.implicitWidth
|
||||
implicitHeight: grid.implicitHeight
|
||||
property bool subscribed: false
|
||||
onCurrentChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (subscribed)
|
||||
MetricsService.consumers--
|
||||
function sync() {
|
||||
if (current === subscribed)
|
||||
return;
|
||||
MetricsService.consumers += current ? 1 : -1;
|
||||
subscribed = current;
|
||||
Demand {
|
||||
service: MetricsService
|
||||
active: root.current
|
||||
}
|
||||
readonly property var gpu: MetricsService.gpu
|
||||
readonly property bool hasGpu: gpu.percent !== undefined && gpu.percent !== null
|
||||
|
||||
@@ -6,24 +6,10 @@ import "../theme"
|
||||
Item {
|
||||
id: root
|
||||
implicitHeight: 28
|
||||
property bool mounted: false
|
||||
property bool subscribed: false
|
||||
function sync() {
|
||||
const next = mounted && visible;
|
||||
if (next !== subscribed) {
|
||||
CavaService.consumers += next ? 1 : -1;
|
||||
subscribed = next;
|
||||
Demand {
|
||||
service: CavaService
|
||||
active: root.visible
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
mounted = true;
|
||||
sync();
|
||||
}
|
||||
Component.onDestruction: {
|
||||
if (subscribed)
|
||||
CavaService.consumers--;
|
||||
}
|
||||
onVisibleChanged: sync()
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
spacing: 3
|
||||
|
||||
@@ -9,28 +9,14 @@ GlassPanel {
|
||||
id: root
|
||||
objectName: "mediaCard"
|
||||
property bool compact: false
|
||||
property bool mounted: false
|
||||
property bool subscribed: false
|
||||
readonly property bool showProgress: ConfigService.ready && ConfigService.data.media.showProgress
|
||||
implicitWidth: compact ? 340 : 480
|
||||
implicitHeight: body.implicitHeight + 36
|
||||
function sync() {
|
||||
const next = mounted && visible && showProgress;
|
||||
if (next !== subscribed) {
|
||||
MediaService.progressConsumers += next ? 1 : -1;
|
||||
subscribed = next;
|
||||
Demand {
|
||||
service: MediaService
|
||||
counter: "progressConsumers"
|
||||
active: root.visible && root.showProgress
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
mounted = true;
|
||||
sync();
|
||||
}
|
||||
Component.onDestruction: {
|
||||
if (subscribed)
|
||||
MediaService.progressConsumers--;
|
||||
}
|
||||
onVisibleChanged: sync()
|
||||
onShowProgressChanged: sync()
|
||||
Connections {
|
||||
target: MediaService
|
||||
function onTitleChanged() {
|
||||
|
||||
@@ -12,8 +12,9 @@ GlassPanel {
|
||||
property bool compact: false
|
||||
implicitWidth: 390
|
||||
implicitHeight: body.implicitHeight + 32
|
||||
Component.onCompleted: MetricsService.consumers++
|
||||
Component.onDestruction: MetricsService.consumers--
|
||||
Demand {
|
||||
service: MetricsService
|
||||
}
|
||||
ColumnLayout {
|
||||
id: body
|
||||
anchors {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import QtQuick
|
||||
|
||||
// Holds one count on a service's demand counter while `active`, released when
|
||||
// inactive or destroyed. Services run their samplers and processes only while
|
||||
// counted, so idle views cost nothing.
|
||||
QtObject {
|
||||
id: root
|
||||
required property var service
|
||||
property string counter: "consumers"
|
||||
property bool active: true
|
||||
property bool held: false
|
||||
function sync() {
|
||||
const next = active && !!service;
|
||||
if (next === held)
|
||||
return;
|
||||
service[counter] += next ? 1 : -1;
|
||||
held = next;
|
||||
}
|
||||
onActiveChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (held)
|
||||
service[counter]--
|
||||
}
|
||||
@@ -3,6 +3,7 @@ singleton TrayService 1.0 TrayService.qml
|
||||
singleton ApplicationsService 1.0 ApplicationsService.qml
|
||||
singleton HyprlandService 1.0 HyprlandService.qml
|
||||
ProviderJob 1.0 ProviderJob.qml
|
||||
Demand 1.0 Demand.qml
|
||||
singleton WallpaperService 1.0 WallpaperService.qml
|
||||
singleton MediaService 1.0 MediaService.qml
|
||||
singleton CavaService 1.0 CavaService.qml
|
||||
|
||||
@@ -87,40 +87,14 @@ PanelWindow {
|
||||
readonly property var currentPage: SettingsRegistry.page(ShellState.settingsPage) || SettingsRegistry.page("about")
|
||||
readonly property var currentGroup: SettingsRegistry.groups.find(g => g.id === currentPage.group) || null
|
||||
|
||||
// Sidebar entries: group captions followed by their pages.
|
||||
readonly property int captionHeight: 30
|
||||
readonly property int gapHeight: 12
|
||||
readonly property int itemHeight: 40
|
||||
readonly property int itemSpacing: 2
|
||||
readonly property var navEntries: {
|
||||
const entries = [];
|
||||
for (const group of SettingsRegistry.groups) {
|
||||
const pages = SettingsRegistry.pages.filter(p => p.group === group.id);
|
||||
if (pages.length === 0)
|
||||
continue;
|
||||
entries.push({
|
||||
kind: group.title ? "caption" : "gap",
|
||||
title: group.title
|
||||
});
|
||||
for (const p of pages)
|
||||
entries.push({
|
||||
kind: "page",
|
||||
page: p
|
||||
});
|
||||
// Search lives in the sidebar; these forward to it for shortcuts and tests.
|
||||
readonly property bool searchActive: sidebar.searchActive
|
||||
readonly property var searchResults: sidebar.searchResults
|
||||
function openSearch() {
|
||||
sidebar.openSearch();
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
function entryHeight(entry) {
|
||||
return entry.kind === "page" ? itemHeight : entry.kind === "caption" ? captionHeight : gapHeight;
|
||||
}
|
||||
function entryY(pageId) {
|
||||
let y = 0;
|
||||
for (const entry of navEntries) {
|
||||
if (entry.kind === "page" && entry.page.id === pageId)
|
||||
return y;
|
||||
y += entryHeight(entry) + itemSpacing;
|
||||
}
|
||||
return -1;
|
||||
function chooseResult(result) {
|
||||
sidebar.chooseResult(result);
|
||||
}
|
||||
function step(direction) {
|
||||
const ids = SettingsRegistry.pages.map(p => p.id);
|
||||
@@ -128,43 +102,13 @@ PanelWindow {
|
||||
ShellState.openSettings(ids[(index + direction + ids.length) % ids.length]);
|
||||
}
|
||||
|
||||
// Search
|
||||
property bool searchActive: false
|
||||
property int searchIndex: 0
|
||||
readonly property var searchResults: SettingsRegistry.search(searchField.text)
|
||||
function openSearch() {
|
||||
searchActive = true;
|
||||
searchField.forceActiveFocus();
|
||||
}
|
||||
function closeSearch() {
|
||||
searchActive = false;
|
||||
searchField.clear();
|
||||
panel.forceActiveFocus();
|
||||
}
|
||||
function chooseResult(result) {
|
||||
if (!result)
|
||||
return;
|
||||
closeSearch();
|
||||
ShellState.revealSetting(result.page, result.setting);
|
||||
}
|
||||
onSearchResultsChanged: searchIndex = 0
|
||||
// Keep the selected sidebar entry in view.
|
||||
function revealNavEntry() {
|
||||
const y = entryY(ShellState.settingsPage);
|
||||
if (y < 0 || nav.height <= 0)
|
||||
return;
|
||||
if (y < nav.contentY)
|
||||
nav.contentY = y;
|
||||
else if (y + itemHeight > nav.contentY + nav.height)
|
||||
nav.contentY = Math.min(nav.contentHeight - nav.height, y + itemHeight - nav.height);
|
||||
}
|
||||
Connections {
|
||||
target: ShellState
|
||||
function onSettingsOpenChanged() {
|
||||
if (!ShellState.settingsOpen && root.searchActive)
|
||||
root.closeSearch();
|
||||
sidebar.closeSearch();
|
||||
if (ShellState.settingsOpen)
|
||||
Qt.callLater(root.revealNavEntry);
|
||||
Qt.callLater(sidebar.revealNavEntry);
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
@@ -174,18 +118,6 @@ PanelWindow {
|
||||
onTriggered: ShellState.settingsHighlight = ""
|
||||
}
|
||||
|
||||
// Drag handle for moving the panel; double-click recentres it.
|
||||
component DragArea: MouseArea {
|
||||
id: handle
|
||||
anchors.fill: parent
|
||||
cursorShape: pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor
|
||||
onPressed: mouse => root.beginDrag(handle, mouse.x, mouse.y)
|
||||
onPositionChanged: mouse => root.moveDrag(handle, mouse.x, mouse.y)
|
||||
onReleased: root.endDrag()
|
||||
onCanceled: root.endDrag()
|
||||
onDoubleClicked: root.recenter()
|
||||
}
|
||||
|
||||
// Hyprland routes every pointer event to a layer with exclusive keyboard
|
||||
// focus, so clicks outside the panel arrive here with out-of-bounds
|
||||
// coordinates. Qt Quick still delivers them to items extending past the
|
||||
@@ -231,377 +163,14 @@ PanelWindow {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
// Sidebar
|
||||
Rectangle {
|
||||
SettingsSidebar {
|
||||
id: sidebar
|
||||
window: root
|
||||
cornerRadius: panel.radius
|
||||
visible: root.wide
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 252
|
||||
topLeftRadius: panel.radius
|
||||
bottomLeftRadius: panel.radius
|
||||
color: Qt.alpha(Theme.tint, 0.15)
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 14
|
||||
spacing: 12
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 36
|
||||
DragArea {
|
||||
objectName: "settingsDragHandle"
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Settings"
|
||||
color: Theme.text
|
||||
font.pixelSize: 17
|
||||
font.weight: Font.DemiBold
|
||||
opacity: root.searchActive ? 0 : 1
|
||||
scale: root.searchActive ? 0.92 : 1
|
||||
visible: opacity > 0.01
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
// The search button widens into the search field.
|
||||
Item {
|
||||
id: searchMorph
|
||||
property real progress: root.searchActive ? 1 : 0
|
||||
Behavior on progress {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 36 + (parent.width - 36) * progress
|
||||
height: 36
|
||||
clip: true
|
||||
GlassTextField {
|
||||
id: searchField
|
||||
objectName: "settingsSearch"
|
||||
anchors.fill: parent
|
||||
leftPadding: 36
|
||||
rightPadding: 36
|
||||
placeholderText: "Search settings…"
|
||||
opacity: searchMorph.progress
|
||||
enabled: root.searchActive
|
||||
background: Rectangle {
|
||||
radius: height / 2
|
||||
color: Theme.surfaceVariant
|
||||
border.color: searchField.activeFocus ? Theme.accent : Theme.border
|
||||
}
|
||||
Keys.onEscapePressed: root.closeSearch()
|
||||
Keys.onDownPressed: root.searchIndex = Math.min(root.searchResults.length - 1, root.searchIndex + 1)
|
||||
Keys.onUpPressed: root.searchIndex = Math.max(0, root.searchIndex - 1)
|
||||
Keys.onReturnPressed: root.chooseResult(root.searchResults[root.searchIndex])
|
||||
Keys.onEnterPressed: root.chooseResult(root.searchResults[root.searchIndex])
|
||||
}
|
||||
Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
radius: 18
|
||||
color: !root.searchActive && searchButton.containsMouse ? Qt.alpha(Theme.text, 0.1) : Theme.transparent
|
||||
GlassIcon {
|
||||
anchors.centerIn: parent
|
||||
glyph: ""
|
||||
fallback: "⌕"
|
||||
size: 28
|
||||
glyphSize: 16
|
||||
color: Theme.transparent
|
||||
border.width: 0
|
||||
glyphColor: root.searchActive ? Theme.textSecondary : Theme.text
|
||||
}
|
||||
MouseArea {
|
||||
id: searchButton
|
||||
objectName: "settingsSearchButton"
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.searchActive ? searchField.forceActiveFocus() : root.openSearch()
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
width: 36
|
||||
height: 36
|
||||
radius: 18
|
||||
visible: searchMorph.progress > 0.5
|
||||
opacity: searchMorph.progress
|
||||
color: closeSearchArea.containsMouse ? Qt.alpha(Theme.text, 0.1) : Theme.transparent
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "×"
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 18
|
||||
}
|
||||
MouseArea {
|
||||
id: closeSearchArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.closeSearch()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
// Navigation
|
||||
Flickable {
|
||||
id: nav
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentHeight: navColumn.implicitHeight
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
opacity: root.searchActive ? 0 : 1
|
||||
visible: opacity > 0.01
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
policy: ScrollBar.AsNeeded
|
||||
opacity: active ? 1 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: 3
|
||||
radius: 2
|
||||
color: Qt.alpha(Theme.text, 0.2)
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: activeHighlight
|
||||
readonly property real target: root.entryY(ShellState.settingsPage)
|
||||
visible: target >= 0
|
||||
width: nav.width
|
||||
height: root.itemHeight
|
||||
y: target
|
||||
radius: Math.max(10, Theme.radius * 0.55)
|
||||
color: Theme.accent
|
||||
Behavior on y {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 1.3
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: navColumn
|
||||
width: nav.width
|
||||
spacing: root.itemSpacing
|
||||
Repeater {
|
||||
model: root.navEntries
|
||||
Item {
|
||||
id: entry
|
||||
required property var modelData
|
||||
readonly property bool isPage: modelData.kind === "page"
|
||||
readonly property bool selected: isPage && modelData.page.id === ShellState.settingsPage
|
||||
width: navColumn.width
|
||||
height: root.entryHeight(modelData)
|
||||
Text {
|
||||
visible: entry.modelData.kind === "caption"
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 8
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 6
|
||||
text: String(entry.modelData.title || "").toUpperCase()
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
font.weight: Font.DemiBold
|
||||
font.letterSpacing: 1.2
|
||||
}
|
||||
Rectangle {
|
||||
visible: entry.isPage
|
||||
anchors.fill: parent
|
||||
radius: activeHighlight.radius
|
||||
color: !entry.selected && itemArea.containsMouse ? Qt.alpha(Theme.text, 0.07) : Theme.transparent
|
||||
scale: itemArea.pressed ? 0.98 : 1
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
// Selected items shift right as the highlight lands.
|
||||
anchors.leftMargin: 6 + (entry.selected ? 3 * Theme.intensity : 0)
|
||||
anchors.rightMargin: 10
|
||||
spacing: 10
|
||||
Behavior on anchors.leftMargin {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 1.3
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
GlassIcon {
|
||||
glyph: entry.isPage ? entry.modelData.page.icon : ""
|
||||
image: entry.isPage ? entry.modelData.page.image || "" : ""
|
||||
fallback: entry.isPage ? entry.modelData.page.title.charAt(0) : ""
|
||||
size: 28
|
||||
glyphSize: 15
|
||||
color: entry.selected ? Qt.alpha(Theme.accentText, 0.14) : Theme.surfaceVariant
|
||||
glyphColor: entry.selected ? Theme.accentText : Theme.text
|
||||
}
|
||||
Text {
|
||||
text: entry.isPage ? entry.modelData.page.title : ""
|
||||
color: entry.selected ? Theme.accentText : itemArea.containsMouse ? Theme.text : Qt.alpha(Theme.text, 0.82)
|
||||
font.pixelSize: 13
|
||||
font.weight: entry.selected ? Font.DemiBold : Font.Medium
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: itemArea
|
||||
objectName: entry.isPage ? "settingsNav-" + entry.modelData.page.id : ""
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: ShellState.openSettings(entry.modelData.page.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Search results
|
||||
ListView {
|
||||
id: results
|
||||
objectName: "settingsSearchResults"
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
spacing: 4
|
||||
model: root.searchResults
|
||||
currentIndex: root.searchIndex
|
||||
opacity: root.searchActive ? 1 : 0
|
||||
visible: opacity > 0.01
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
highlightFollowsCurrentItem: false
|
||||
onCurrentIndexChanged: positionViewAtIndex(currentIndex, ListView.Contain)
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
delegate: Rectangle {
|
||||
id: result
|
||||
required property var modelData
|
||||
required property int index
|
||||
readonly property bool selected: index === root.searchIndex
|
||||
width: results.width
|
||||
height: 50
|
||||
radius: Math.max(10, Theme.radius * 0.55)
|
||||
color: selected ? Theme.accent : resultArea.containsMouse ? Qt.alpha(Theme.text, 0.08) : Theme.fill
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8 + (result.selected ? 3 : 0)
|
||||
anchors.rightMargin: 10
|
||||
spacing: 10
|
||||
Behavior on anchors.leftMargin {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
GlassIcon {
|
||||
glyph: result.modelData.icon
|
||||
image: result.modelData.image || ""
|
||||
fallback: result.modelData.detail.charAt(0)
|
||||
size: 28
|
||||
glyphSize: 14
|
||||
color: result.selected ? Qt.alpha(Theme.accentText, 0.14) : Theme.surfaceVariant
|
||||
glyphColor: result.selected ? Theme.accentText : Theme.text
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 1
|
||||
Text {
|
||||
text: result.modelData.title
|
||||
color: result.selected ? Theme.accentText : Theme.text
|
||||
font.pixelSize: 12
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: result.modelData.setting ? "in " + result.modelData.detail : result.modelData.detail
|
||||
color: result.selected ? Qt.alpha(Theme.accentText, 0.75) : Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: resultArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: root.searchIndex = result.index
|
||||
onClicked: root.chooseResult(result.modelData)
|
||||
}
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: root.searchActive && results.count === 0
|
||||
width: parent.width - 20
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: searchField.text.trim() ? "No settings match “" + searchField.text.trim() + "”" : "Type to search pages and settings"
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 6
|
||||
text: root.searchActive ? "↑↓ select · Enter open · Esc back" : "Ctrl+F search · Ctrl+Tab next page"
|
||||
color: Qt.alpha(Theme.textSecondary, 0.8)
|
||||
font.pixelSize: 10
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
onSearchClosed: panel.forceActiveFocus()
|
||||
}
|
||||
Rectangle {
|
||||
visible: root.wide
|
||||
@@ -621,7 +190,9 @@ PanelWindow {
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: pageHeader.implicitHeight
|
||||
DragArea {}
|
||||
SettingsDragArea {
|
||||
window: root
|
||||
}
|
||||
RowLayout {
|
||||
id: pageHeader
|
||||
anchors.fill: parent
|
||||
@@ -698,7 +269,7 @@ PanelWindow {
|
||||
target: ShellState
|
||||
function onSettingsPageChanged() {
|
||||
enterAnimation.restart();
|
||||
Qt.callLater(root.revealNavEntry);
|
||||
Qt.callLater(sidebar.revealNavEntry);
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
|
||||
@@ -0,0 +1,452 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../components"
|
||||
import "../core"
|
||||
import "../theme"
|
||||
import "controls"
|
||||
|
||||
// Settings sidebar: title, the search field that morphs from its button, page
|
||||
// navigation grouped by section, and search results.
|
||||
Rectangle {
|
||||
id: root
|
||||
// The Settings window: drag handles move it.
|
||||
required property var window
|
||||
property real cornerRadius: 0
|
||||
topLeftRadius: cornerRadius
|
||||
bottomLeftRadius: cornerRadius
|
||||
color: Qt.alpha(Theme.tint, 0.15)
|
||||
signal searchClosed
|
||||
|
||||
// Sidebar entries: group captions followed by their pages.
|
||||
readonly property int captionHeight: 30
|
||||
readonly property int gapHeight: 12
|
||||
readonly property int itemHeight: 40
|
||||
readonly property int itemSpacing: 2
|
||||
readonly property var navEntries: {
|
||||
const entries = [];
|
||||
for (const group of SettingsRegistry.groups) {
|
||||
const pages = SettingsRegistry.pages.filter(p => p.group === group.id);
|
||||
if (pages.length === 0)
|
||||
continue;
|
||||
entries.push({
|
||||
kind: group.title ? "caption" : "gap",
|
||||
title: group.title
|
||||
});
|
||||
for (const p of pages)
|
||||
entries.push({
|
||||
kind: "page",
|
||||
page: p
|
||||
});
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
function entryHeight(entry) {
|
||||
return entry.kind === "page" ? itemHeight : entry.kind === "caption" ? captionHeight : gapHeight;
|
||||
}
|
||||
function entryY(pageId) {
|
||||
let y = 0;
|
||||
for (const entry of navEntries) {
|
||||
if (entry.kind === "page" && entry.page.id === pageId)
|
||||
return y;
|
||||
y += entryHeight(entry) + itemSpacing;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Search
|
||||
property bool searchActive: false
|
||||
property int searchIndex: 0
|
||||
readonly property var searchResults: SettingsRegistry.search(searchField.text)
|
||||
function openSearch() {
|
||||
searchActive = true;
|
||||
searchField.forceActiveFocus();
|
||||
}
|
||||
function closeSearch() {
|
||||
searchActive = false;
|
||||
searchField.clear();
|
||||
root.searchClosed();
|
||||
}
|
||||
function chooseResult(result) {
|
||||
if (!result)
|
||||
return;
|
||||
closeSearch();
|
||||
ShellState.revealSetting(result.page, result.setting);
|
||||
}
|
||||
onSearchResultsChanged: searchIndex = 0
|
||||
// Keep the selected sidebar entry in view.
|
||||
function revealNavEntry() {
|
||||
const y = entryY(ShellState.settingsPage);
|
||||
if (y < 0 || nav.height <= 0)
|
||||
return;
|
||||
if (y < nav.contentY)
|
||||
nav.contentY = y;
|
||||
else if (y + itemHeight > nav.contentY + nav.height)
|
||||
nav.contentY = Math.min(nav.contentHeight - nav.height, y + itemHeight - nav.height);
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 14
|
||||
spacing: 12
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 36
|
||||
SettingsDragArea {
|
||||
objectName: "settingsDragHandle"
|
||||
window: root.window
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Settings"
|
||||
color: Theme.text
|
||||
font.pixelSize: 17
|
||||
font.weight: Font.DemiBold
|
||||
opacity: root.searchActive ? 0 : 1
|
||||
scale: root.searchActive ? 0.92 : 1
|
||||
visible: opacity > 0.01
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
// The search button widens into the search field.
|
||||
Item {
|
||||
id: searchMorph
|
||||
property real progress: root.searchActive ? 1 : 0
|
||||
Behavior on progress {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 36 + (parent.width - 36) * progress
|
||||
height: 36
|
||||
clip: true
|
||||
GlassTextField {
|
||||
id: searchField
|
||||
objectName: "settingsSearch"
|
||||
anchors.fill: parent
|
||||
leftPadding: 36
|
||||
rightPadding: 36
|
||||
placeholderText: "Search settings…"
|
||||
opacity: searchMorph.progress
|
||||
enabled: root.searchActive
|
||||
background: Rectangle {
|
||||
radius: height / 2
|
||||
color: Theme.surfaceVariant
|
||||
border.color: searchField.activeFocus ? Theme.accent : Theme.border
|
||||
}
|
||||
Keys.onEscapePressed: root.closeSearch()
|
||||
Keys.onDownPressed: root.searchIndex = Math.min(root.searchResults.length - 1, root.searchIndex + 1)
|
||||
Keys.onUpPressed: root.searchIndex = Math.max(0, root.searchIndex - 1)
|
||||
Keys.onReturnPressed: root.chooseResult(root.searchResults[root.searchIndex])
|
||||
Keys.onEnterPressed: root.chooseResult(root.searchResults[root.searchIndex])
|
||||
}
|
||||
Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
radius: 18
|
||||
color: !root.searchActive && searchButton.containsMouse ? Qt.alpha(Theme.text, 0.1) : Theme.transparent
|
||||
GlassIcon {
|
||||
anchors.centerIn: parent
|
||||
glyph: ""
|
||||
fallback: "⌕"
|
||||
size: 28
|
||||
glyphSize: 16
|
||||
color: Theme.transparent
|
||||
border.width: 0
|
||||
glyphColor: root.searchActive ? Theme.textSecondary : Theme.text
|
||||
}
|
||||
MouseArea {
|
||||
id: searchButton
|
||||
objectName: "settingsSearchButton"
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.searchActive ? searchField.forceActiveFocus() : root.openSearch()
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
width: 36
|
||||
height: 36
|
||||
radius: 18
|
||||
visible: searchMorph.progress > 0.5
|
||||
opacity: searchMorph.progress
|
||||
color: closeSearchArea.containsMouse ? Qt.alpha(Theme.text, 0.1) : Theme.transparent
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "×"
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 18
|
||||
}
|
||||
MouseArea {
|
||||
id: closeSearchArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.closeSearch()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
// Navigation
|
||||
Flickable {
|
||||
id: nav
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentHeight: navColumn.implicitHeight
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
opacity: root.searchActive ? 0 : 1
|
||||
visible: opacity > 0.01
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
policy: ScrollBar.AsNeeded
|
||||
opacity: active ? 1 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: 3
|
||||
radius: 2
|
||||
color: Qt.alpha(Theme.text, 0.2)
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: activeHighlight
|
||||
readonly property real target: root.entryY(ShellState.settingsPage)
|
||||
visible: target >= 0
|
||||
width: nav.width
|
||||
height: root.itemHeight
|
||||
y: target
|
||||
radius: Math.max(10, Theme.radius * 0.55)
|
||||
color: Theme.accent
|
||||
Behavior on y {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 1.3
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: navColumn
|
||||
width: nav.width
|
||||
spacing: root.itemSpacing
|
||||
Repeater {
|
||||
model: root.navEntries
|
||||
Item {
|
||||
id: entry
|
||||
required property var modelData
|
||||
readonly property bool isPage: modelData.kind === "page"
|
||||
readonly property bool selected: isPage && modelData.page.id === ShellState.settingsPage
|
||||
width: navColumn.width
|
||||
height: root.entryHeight(modelData)
|
||||
Text {
|
||||
visible: entry.modelData.kind === "caption"
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 8
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 6
|
||||
text: String(entry.modelData.title || "").toUpperCase()
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
font.weight: Font.DemiBold
|
||||
font.letterSpacing: 1.2
|
||||
}
|
||||
Rectangle {
|
||||
visible: entry.isPage
|
||||
anchors.fill: parent
|
||||
radius: activeHighlight.radius
|
||||
color: !entry.selected && itemArea.containsMouse ? Qt.alpha(Theme.text, 0.07) : Theme.transparent
|
||||
scale: itemArea.pressed ? 0.98 : 1
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
// Selected items shift right as the highlight lands.
|
||||
anchors.leftMargin: 6 + (entry.selected ? 3 * Theme.intensity : 0)
|
||||
anchors.rightMargin: 10
|
||||
spacing: 10
|
||||
Behavior on anchors.leftMargin {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 1.3
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
GlassIcon {
|
||||
glyph: entry.isPage ? entry.modelData.page.icon : ""
|
||||
image: entry.isPage ? entry.modelData.page.image || "" : ""
|
||||
fallback: entry.isPage ? entry.modelData.page.title.charAt(0) : ""
|
||||
size: 28
|
||||
glyphSize: 15
|
||||
color: entry.selected ? Qt.alpha(Theme.accentText, 0.14) : Theme.surfaceVariant
|
||||
glyphColor: entry.selected ? Theme.accentText : Theme.text
|
||||
}
|
||||
Text {
|
||||
text: entry.isPage ? entry.modelData.page.title : ""
|
||||
color: entry.selected ? Theme.accentText : itemArea.containsMouse ? Theme.text : Qt.alpha(Theme.text, 0.82)
|
||||
font.pixelSize: 13
|
||||
font.weight: entry.selected ? Font.DemiBold : Font.Medium
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: itemArea
|
||||
objectName: entry.isPage ? "settingsNav-" + entry.modelData.page.id : ""
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: ShellState.openSettings(entry.modelData.page.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Search results
|
||||
ListView {
|
||||
id: results
|
||||
objectName: "settingsSearchResults"
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
spacing: 4
|
||||
model: root.searchResults
|
||||
currentIndex: root.searchIndex
|
||||
opacity: root.searchActive ? 1 : 0
|
||||
visible: opacity > 0.01
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
highlightFollowsCurrentItem: false
|
||||
onCurrentIndexChanged: positionViewAtIndex(currentIndex, ListView.Contain)
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
delegate: Rectangle {
|
||||
id: result
|
||||
required property var modelData
|
||||
required property int index
|
||||
readonly property bool selected: index === root.searchIndex
|
||||
width: results.width
|
||||
height: 50
|
||||
radius: Math.max(10, Theme.radius * 0.55)
|
||||
color: selected ? Theme.accent : resultArea.containsMouse ? Qt.alpha(Theme.text, 0.08) : Theme.fill
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8 + (result.selected ? 3 : 0)
|
||||
anchors.rightMargin: 10
|
||||
spacing: 10
|
||||
Behavior on anchors.leftMargin {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutQuint
|
||||
}
|
||||
}
|
||||
GlassIcon {
|
||||
glyph: result.modelData.icon
|
||||
image: result.modelData.image || ""
|
||||
fallback: result.modelData.detail.charAt(0)
|
||||
size: 28
|
||||
glyphSize: 14
|
||||
color: result.selected ? Qt.alpha(Theme.accentText, 0.14) : Theme.surfaceVariant
|
||||
glyphColor: result.selected ? Theme.accentText : Theme.text
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 1
|
||||
Text {
|
||||
text: result.modelData.title
|
||||
color: result.selected ? Theme.accentText : Theme.text
|
||||
font.pixelSize: 12
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: result.modelData.setting ? "in " + result.modelData.detail : result.modelData.detail
|
||||
color: result.selected ? Qt.alpha(Theme.accentText, 0.75) : Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: resultArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: root.searchIndex = result.index
|
||||
onClicked: root.chooseResult(result.modelData)
|
||||
}
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: root.searchActive && results.count === 0
|
||||
width: parent.width - 20
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: searchField.text.trim() ? "No settings match “" + searchField.text.trim() + "”" : "Type to search pages and settings"
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 6
|
||||
text: root.searchActive ? "↑↓ select · Enter open · Esc back" : "Ctrl+F search · Ctrl+Tab next page"
|
||||
color: Qt.alpha(Theme.textSecondary, 0.8)
|
||||
font.pixelSize: 10
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import QtQuick
|
||||
|
||||
// Drag handle for moving the Settings panel; double-click recentres it.
|
||||
MouseArea {
|
||||
id: handle
|
||||
required property var window
|
||||
anchors.fill: parent
|
||||
cursorShape: pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor
|
||||
onPressed: mouse => window.beginDrag(handle, mouse.x, mouse.y)
|
||||
onPositionChanged: mouse => window.moveDrag(handle, mouse.x, mouse.y)
|
||||
onReleased: window.endDrag()
|
||||
onCanceled: window.endDrag()
|
||||
onDoubleClicked: window.recenter()
|
||||
}
|
||||
@@ -12,17 +12,10 @@ Item {
|
||||
property bool desktopVisible: true
|
||||
// Faces showing live metrics keep the shared collector running only while shown.
|
||||
property bool usesMetrics: false
|
||||
readonly property bool sampling: usesMetrics && desktopVisible
|
||||
property bool counted: false
|
||||
function count(next) {
|
||||
if (next !== counted) {
|
||||
MetricsService.consumers += next ? 1 : -1;
|
||||
counted = next;
|
||||
Demand {
|
||||
service: MetricsService
|
||||
active: face.usesMetrics && face.desktopVisible
|
||||
}
|
||||
}
|
||||
onSamplingChanged: count(sampling)
|
||||
Component.onCompleted: count(sampling)
|
||||
Component.onDestruction: count(false)
|
||||
// Reference size for typography that scales with the widget.
|
||||
readonly property real unit: Math.min(width, height * 2)
|
||||
}
|
||||
@@ -6,8 +6,12 @@ import "../../theme"
|
||||
// Cava bars for system audio: rising bars, or mirrored around the centre line.
|
||||
Face {
|
||||
id: root
|
||||
Component.onCompleted: CavaService.widgetConsumers++
|
||||
Component.onDestruction: CavaService.widgetConsumers--
|
||||
// Cava runs only while this widget's desktop is visible.
|
||||
Demand {
|
||||
service: CavaService
|
||||
counter: "widgetConsumers"
|
||||
active: root.desktopVisible
|
||||
}
|
||||
readonly property bool mirror: variant === "mirror"
|
||||
Row {
|
||||
id: bars
|
||||
|
||||
Reference in new issue
Block a user