chore: fix unqualified access

This commit is contained in:
2 * r + 2 * t 2026-03-20 23:42:36 +11:00
parent a3b3c88f02
commit c3fd5aa905
27 changed files with 297 additions and 259 deletions

View file

@ -81,20 +81,20 @@ ScrollBar {
// Sync nonAnimPosition with flickable when not animating // Sync nonAnimPosition with flickable when not animating
Connections { Connections {
function onContentYChanged() { function onContentYChanged() {
if (!animating && !fullMouse.pressed) { if (!root.animating && !fullMouse.pressed) {
_updatingFromFlickable = true; root._updatingFromFlickable = true;
const contentHeight = flickable.contentHeight; const contentHeight = root.flickable.contentHeight;
const height = flickable.height; const height = root.flickable.height;
if (contentHeight > height) { if (contentHeight > height) {
nonAnimPosition = Math.max(0, Math.min(1, flickable.contentY / (contentHeight - height))); root.nonAnimPosition = Math.max(0, Math.min(1, root.flickable.contentY / (contentHeight - height)));
} else { } else {
nonAnimPosition = 0; root.nonAnimPosition = 0;
} }
_updatingFromFlickable = false; root._updatingFromFlickable = false;
} }
} }
target: flickable target: root.flickable
} }
Connections { Connections {

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import ".." import ".."
import qs.components import qs.components
import qs.components.controls import qs.components.controls
@ -33,8 +35,8 @@ StyledRect {
Connections { Connections {
function onContainsMouseChanged() { function onContainsMouseChanged() {
const newHovered = toggleStateLayer.containsMouse; const newHovered = toggleStateLayer.containsMouse;
if (hovered !== newHovered) { if (root.hovered !== newHovered) {
hovered = newHovered; root.hovered = newHovered;
} }
} }

View file

@ -5,6 +5,7 @@ import "../controls"
import "../images" import "../images"
import qs.services import qs.services
import qs.config import qs.config
import qs.utils
import Caelestia.Models import Caelestia.Models
import Quickshell import Quickshell
import QtQuick import QtQuick
@ -104,7 +105,7 @@ Item {
model: FileSystemModel { model: FileSystemModel {
path: { path: {
if (root.dialog.cwd[0] === "Home") if (root.dialog.cwd[0] === "Home")
return `${Paths.home}/${root.dialog.cwd.slice(1).join("/")}`; return Paths.home + `/${root.dialog.cwd.slice(1).join("/")}`;
else else
return root.dialog.cwd.join("/"); return root.dialog.cwd.join("/");
} }

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import qs.components import qs.components
import qs.services import qs.services
import qs.utils import qs.utils
@ -90,7 +92,8 @@ ColumnLayout {
Repeater { Repeater {
model: ScriptModel { model: ScriptModel {
values: { values: {
const windows = Hypr.toplevels.values.filter(c => c.workspace?.id === root.ws); const ws = root.ws;
const windows = Hypr.toplevels.values.filter(c => c.workspace?.id === ws);
const maxIcons = Config.bar.workspaces.maxWindowIcons; const maxIcons = Config.bar.workspaces.maxWindowIcons;
return maxIcons > 0 ? windows.slice(0, maxIcons) : windows; return maxIcons > 0 ? windows.slice(0, maxIcons) : windows;
} }

View file

@ -85,6 +85,8 @@ ColumnLayout {
} }
delegate: Item { delegate: Item {
id: kbDelegate
required property int layoutIndex required property int layoutIndex
required property string label required property string label
readonly property bool isDisabled: layoutIndex > 3 readonly property bool isDisabled: layoutIndex > 3
@ -98,8 +100,8 @@ ColumnLayout {
id: layer id: layer
function onClicked(): void { function onClicked(): void {
if (!isDisabled) if (!kbDelegate.isDisabled)
kb.switchTo(layoutIndex); kb.switchTo(kbDelegate.layoutIndex);
} }
anchors.left: parent.left anchors.left: parent.left
@ -107,7 +109,7 @@ ColumnLayout {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
implicitHeight: parent.height - 4 implicitHeight: parent.height - 4
radius: Appearance.rounding.full radius: Appearance.rounding.full
enabled: !isDisabled enabled: !kbDelegate.isDisabled
} }
StyledText { StyledText {
@ -118,9 +120,9 @@ ColumnLayout {
anchors.right: layer.right anchors.right: layer.right
anchors.leftMargin: Appearance.padding.small anchors.leftMargin: Appearance.padding.small
anchors.rightMargin: Appearance.padding.small anchors.rightMargin: Appearance.padding.small
text: label text: kbDelegate.label
elide: Text.ElideRight elide: Text.ElideRight
opacity: isDisabled ? 0.4 : 1.0 opacity: kbDelegate.isDisabled ? 0.4 : 1.0
} }
} }
} }

View file

@ -137,9 +137,9 @@ Item {
command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/base.xml"] command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/base.xml"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: _buildXmlMap(text) onStreamFinished: model._buildXmlMap(text)
} }
onRunningChanged: if (!running && (typeof exitCode !== "undefined") && exitCode !== 0) onRunningChanged: if (!running && (typeof _xkbXmlBase.exitCode !== "undefined") && _xkbXmlBase.exitCode !== 0)
_xkbXmlEvdev.running = true _xkbXmlEvdev.running = true
} }
@ -148,7 +148,7 @@ Item {
command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/evdev.xml"] command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/evdev.xml"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: _buildXmlMap(text) onStreamFinished: model._buildXmlMap(text)
} }
} }
@ -162,7 +162,7 @@ Item {
const j = JSON.parse(text); const j = JSON.parse(text);
const raw = (j?.str || j?.value || "").toString().trim(); const raw = (j?.str || j?.value || "").toString().trim();
if (raw.length) { if (raw.length) {
_setLayouts(raw); model._setLayouts(raw);
_fetchActiveLayouts.running = true; _fetchActiveLayouts.running = true;
return; return;
} }
@ -183,7 +183,7 @@ Item {
const kb = dev?.keyboards?.find(k => k.main) || dev?.keyboards?.[0]; const kb = dev?.keyboards?.find(k => k.main) || dev?.keyboards?.[0];
const raw = (kb?.layout || "").trim(); const raw = (kb?.layout || "").trim();
if (raw.length) if (raw.length)
_setLayouts(raw); model._setLayouts(raw);
} catch (e) {} } catch (e) {}
_fetchActiveLayouts.running = true; _fetchActiveLayouts.running = true;
} }
@ -201,14 +201,14 @@ Item {
const kb = dev?.keyboards?.find(k => k.main) || dev?.keyboards?.[0]; const kb = dev?.keyboards?.find(k => k.main) || dev?.keyboards?.[0];
const idx = kb?.active_layout_index ?? -1; const idx = kb?.active_layout_index ?? -1;
activeIndex = idx >= 0 ? idx : -1; model.activeIndex = idx >= 0 ? idx : -1;
activeLabel = (idx >= 0 && idx < _layoutsModel.count) ? _layoutsModel.get(idx).label : ""; model.activeLabel = (idx >= 0 && idx < _layoutsModel.count) ? _layoutsModel.get(idx).label : "";
} catch (e) { } catch (e) {
activeIndex = -1; model.activeIndex = -1;
activeLabel = ""; model.activeLabel = "";
} }
_rebuildVisible(); model._rebuildVisible();
} }
} }
} }

View file

@ -22,7 +22,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Animation duration scale") label: qsTr("Animation duration scale")
value: rootPane.animDurationsScale value: root.rootPane.animDurationsScale
from: 0.1 from: 0.1
to: 5.0 to: 5.0
decimals: 1 decimals: 1
@ -33,8 +33,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.animDurationsScale = newValue; root.rootPane.animDurationsScale = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }

View file

@ -17,19 +17,19 @@ CollapsibleSection {
SwitchRow { SwitchRow {
label: qsTr("Background enabled") label: qsTr("Background enabled")
checked: rootPane.backgroundEnabled checked: root.rootPane.backgroundEnabled
onToggled: checked => { onToggled: checked => {
rootPane.backgroundEnabled = checked; root.rootPane.backgroundEnabled = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
SwitchRow { SwitchRow {
label: qsTr("Wallpaper enabled") label: qsTr("Wallpaper enabled")
checked: rootPane.wallpaperEnabled checked: root.rootPane.wallpaperEnabled
onToggled: checked => { onToggled: checked => {
rootPane.wallpaperEnabled = checked; root.rootPane.wallpaperEnabled = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -42,23 +42,23 @@ CollapsibleSection {
SwitchRow { SwitchRow {
label: qsTr("Desktop Clock enabled") label: qsTr("Desktop Clock enabled")
checked: rootPane.desktopClockEnabled checked: root.rootPane.desktopClockEnabled
onToggled: checked => { onToggled: checked => {
rootPane.desktopClockEnabled = checked; root.rootPane.desktopClockEnabled = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
SectionContainer { SectionContainer {
id: posContainer id: posContainer
readonly property var pos: (rootPane.desktopClockPosition || "top-left").split('-') readonly property var pos: (root.rootPane.desktopClockPosition || "top-left").split('-')
readonly property string currentV: pos[0] readonly property string currentV: pos[0]
readonly property string currentH: pos[1] readonly property string currentH: pos[1]
function updateClockPos(v, h) { function updateClockPos(v, h) {
rootPane.desktopClockPosition = v + "-" + h; root.rootPane.desktopClockPosition = v + "-" + h;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
contentSpacing: Appearance.spacing.small contentSpacing: Appearance.spacing.small
@ -72,7 +72,7 @@ CollapsibleSection {
SplitButtonRow { SplitButtonRow {
label: qsTr("Vertical Position") label: qsTr("Vertical Position")
enabled: rootPane.desktopClockEnabled enabled: root.rootPane.desktopClockEnabled
menuItems: [ menuItems: [
MenuItem { MenuItem {
@ -108,7 +108,7 @@ CollapsibleSection {
SplitButtonRow { SplitButtonRow {
label: qsTr("Horizontal Position") label: qsTr("Horizontal Position")
enabled: rootPane.desktopClockEnabled enabled: root.rootPane.desktopClockEnabled
expandedZ: 99 expandedZ: 99
menuItems: [ menuItems: [
@ -145,10 +145,10 @@ CollapsibleSection {
SwitchRow { SwitchRow {
label: qsTr("Invert colors") label: qsTr("Invert colors")
checked: rootPane.desktopClockInvertColors checked: root.rootPane.desktopClockInvertColors
onToggled: checked => { onToggled: checked => {
rootPane.desktopClockInvertColors = checked; root.rootPane.desktopClockInvertColors = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -163,10 +163,10 @@ CollapsibleSection {
SwitchRow { SwitchRow {
label: qsTr("Enabled") label: qsTr("Enabled")
checked: rootPane.desktopClockShadowEnabled checked: root.rootPane.desktopClockShadowEnabled
onToggled: checked => { onToggled: checked => {
rootPane.desktopClockShadowEnabled = checked; root.rootPane.desktopClockShadowEnabled = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -177,7 +177,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Opacity") label: qsTr("Opacity")
value: rootPane.desktopClockShadowOpacity * 100 value: root.rootPane.desktopClockShadowOpacity * 100
from: 0 from: 0
to: 100 to: 100
suffix: "%" suffix: "%"
@ -189,8 +189,8 @@ CollapsibleSection {
parseValueFunction: text => parseInt(text) parseValueFunction: text => parseInt(text)
onValueModified: newValue => { onValueModified: newValue => {
rootPane.desktopClockShadowOpacity = newValue / 100; root.rootPane.desktopClockShadowOpacity = newValue / 100;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -202,7 +202,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Blur") label: qsTr("Blur")
value: rootPane.desktopClockShadowBlur * 100 value: root.rootPane.desktopClockShadowBlur * 100
from: 0 from: 0
to: 100 to: 100
suffix: "%" suffix: "%"
@ -214,8 +214,8 @@ CollapsibleSection {
parseValueFunction: text => parseInt(text) parseValueFunction: text => parseInt(text)
onValueModified: newValue => { onValueModified: newValue => {
rootPane.desktopClockShadowBlur = newValue / 100; root.rootPane.desktopClockShadowBlur = newValue / 100;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -232,19 +232,19 @@ CollapsibleSection {
SwitchRow { SwitchRow {
label: qsTr("Enabled") label: qsTr("Enabled")
checked: rootPane.desktopClockBackgroundEnabled checked: root.rootPane.desktopClockBackgroundEnabled
onToggled: checked => { onToggled: checked => {
rootPane.desktopClockBackgroundEnabled = checked; root.rootPane.desktopClockBackgroundEnabled = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
SwitchRow { SwitchRow {
label: qsTr("Blur enabled") label: qsTr("Blur enabled")
checked: rootPane.desktopClockBackgroundBlur checked: root.rootPane.desktopClockBackgroundBlur
onToggled: checked => { onToggled: checked => {
rootPane.desktopClockBackgroundBlur = checked; root.rootPane.desktopClockBackgroundBlur = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -255,7 +255,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Opacity") label: qsTr("Opacity")
value: rootPane.desktopClockBackgroundOpacity * 100 value: root.rootPane.desktopClockBackgroundOpacity * 100
from: 0 from: 0
to: 100 to: 100
suffix: "%" suffix: "%"
@ -267,8 +267,8 @@ CollapsibleSection {
parseValueFunction: text => parseInt(text) parseValueFunction: text => parseInt(text)
onValueModified: newValue => { onValueModified: newValue => {
rootPane.desktopClockBackgroundOpacity = newValue / 100; root.rootPane.desktopClockBackgroundOpacity = newValue / 100;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -283,19 +283,19 @@ CollapsibleSection {
SwitchRow { SwitchRow {
label: qsTr("Visualiser enabled") label: qsTr("Visualiser enabled")
checked: rootPane.visualiserEnabled checked: root.rootPane.visualiserEnabled
onToggled: checked => { onToggled: checked => {
rootPane.visualiserEnabled = checked; root.rootPane.visualiserEnabled = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
SwitchRow { SwitchRow {
label: qsTr("Visualiser auto hide") label: qsTr("Visualiser auto hide")
checked: rootPane.visualiserAutoHide checked: root.rootPane.visualiserAutoHide
onToggled: checked => { onToggled: checked => {
rootPane.visualiserAutoHide = checked; root.rootPane.visualiserAutoHide = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -306,7 +306,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Visualiser rounding") label: qsTr("Visualiser rounding")
value: rootPane.visualiserRounding value: root.rootPane.visualiserRounding
from: 0 from: 0
to: 10 to: 10
stepSize: 1 stepSize: 1
@ -318,8 +318,8 @@ CollapsibleSection {
parseValueFunction: text => parseInt(text) parseValueFunction: text => parseInt(text)
onValueModified: newValue => { onValueModified: newValue => {
rootPane.visualiserRounding = Math.round(newValue); root.rootPane.visualiserRounding = Math.round(newValue);
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -331,7 +331,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Visualiser spacing") label: qsTr("Visualiser spacing")
value: rootPane.visualiserSpacing value: root.rootPane.visualiserSpacing
from: 0 from: 0
to: 2 to: 2
validator: DoubleValidator { validator: DoubleValidator {
@ -340,8 +340,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.visualiserSpacing = newValue; root.rootPane.visualiserSpacing = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }

View file

@ -22,7 +22,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Border rounding") label: qsTr("Border rounding")
value: rootPane.borderRounding value: root.rootPane.borderRounding
from: 0.1 from: 0.1
to: 100 to: 100
decimals: 1 decimals: 1
@ -33,8 +33,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.borderRounding = newValue; root.rootPane.borderRounding = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -46,7 +46,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Border thickness") label: qsTr("Border thickness")
value: rootPane.borderThickness value: root.rootPane.borderThickness
from: 0 from: 0
to: 100 to: 100
decimals: 1 decimals: 1
@ -57,8 +57,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.borderThickness = newValue; root.rootPane.borderThickness = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }

View file

@ -22,6 +22,8 @@ CollapsibleSection {
model: Schemes.list model: Schemes.list
delegate: StyledRect { delegate: StyledRect {
id: schemeDelegate
required property var modelData required property var modelData
Layout.fillWidth: true Layout.fillWidth: true
@ -36,8 +38,8 @@ CollapsibleSection {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
const name = modelData.name; const name = schemeDelegate.modelData.name;
const flavour = modelData.flavour; const flavour = schemeDelegate.modelData.flavour;
const schemeKey = `${name} ${flavour}`; const schemeKey = `${name} ${flavour}`;
Schemes.currentScheme = schemeKey; Schemes.currentScheme = schemeKey;
@ -72,9 +74,9 @@ CollapsibleSection {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
border.width: 1 border.width: 1
border.color: Qt.alpha(`#${modelData.colours?.outline}`, 0.5) border.color: Qt.alpha(`#${schemeDelegate.modelData.colours?.outline}`, 0.5)
color: `#${modelData.colours?.surface}` color: `#${schemeDelegate.modelData.colours?.surface}`
radius: Appearance.rounding.full radius: Appearance.rounding.full
implicitWidth: iconPlaceholder.implicitWidth implicitWidth: iconPlaceholder.implicitWidth
implicitHeight: iconPlaceholder.implicitWidth implicitHeight: iconPlaceholder.implicitWidth
@ -101,7 +103,7 @@ CollapsibleSection {
anchors.right: parent.right anchors.right: parent.right
implicitWidth: preview.implicitWidth implicitWidth: preview.implicitWidth
color: `#${modelData.colours?.primary}` color: `#${schemeDelegate.modelData.colours?.primary}`
radius: Appearance.rounding.full radius: Appearance.rounding.full
} }
} }
@ -112,12 +114,12 @@ CollapsibleSection {
spacing: 0 spacing: 0
StyledText { StyledText {
text: modelData.flavour ?? "" text: schemeDelegate.modelData.flavour ?? ""
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }
StyledText { StyledText {
text: modelData.name ?? "" text: schemeDelegate.modelData.name ?? ""
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small
color: Colours.palette.m3outline color: Colours.palette.m3outline
@ -129,7 +131,7 @@ CollapsibleSection {
Loader { Loader {
asynchronous: true asynchronous: true
active: isCurrent active: schemeDelegate.isCurrent
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"

View file

@ -22,6 +22,8 @@ CollapsibleSection {
model: M3Variants.list model: M3Variants.list
delegate: StyledRect { delegate: StyledRect {
id: variantDelegate
required property var modelData required property var modelData
Layout.fillWidth: true Layout.fillWidth: true
@ -33,7 +35,7 @@ CollapsibleSection {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
const variant = modelData.variant; const variant = variantDelegate.modelData.variant;
Schemes.currentVariant = variant; Schemes.currentVariant = variant;
Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]); Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]);
@ -64,19 +66,19 @@ CollapsibleSection {
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
MaterialIcon { MaterialIcon {
text: modelData.icon text: variantDelegate.modelData.icon
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
fill: modelData.variant === Schemes.currentVariant ? 1 : 0 fill: variantDelegate.modelData.variant === Schemes.currentVariant ? 1 : 0
} }
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
text: modelData.name text: variantDelegate.modelData.name
font.weight: modelData.variant === Schemes.currentVariant ? 500 : 400 font.weight: variantDelegate.modelData.variant === Schemes.currentVariant ? 500 : 400
} }
MaterialIcon { MaterialIcon {
visible: modelData.variant === Schemes.currentVariant visible: variantDelegate.modelData.variant === Schemes.currentVariant
text: "check" text: "check"
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large

View file

@ -45,9 +45,11 @@ CollapsibleSection {
} }
delegate: StyledRect { delegate: StyledRect {
id: sansDelegate
required property string modelData required property string modelData
required property int index required property int index
readonly property bool isCurrent: modelData === rootPane.fontFamilySans readonly property bool isCurrent: modelData === root.rootPane.fontFamilySans
width: ListView.view.width width: ListView.view.width
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
@ -57,8 +59,8 @@ CollapsibleSection {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
rootPane.fontFamilySans = modelData; root.rootPane.fontFamilySans = sansDelegate.modelData;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -73,7 +75,7 @@ CollapsibleSection {
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
StyledText { StyledText {
text: modelData text: sansDelegate.modelData
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }
@ -83,7 +85,7 @@ CollapsibleSection {
Loader { Loader {
asynchronous: true asynchronous: true
active: isCurrent active: sansDelegate.isCurrent
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"
@ -127,9 +129,11 @@ CollapsibleSection {
} }
delegate: StyledRect { delegate: StyledRect {
id: monoDelegate
required property string modelData required property string modelData
required property int index required property int index
readonly property bool isCurrent: modelData === rootPane.fontFamilyMono readonly property bool isCurrent: modelData === root.rootPane.fontFamilyMono
width: ListView.view.width width: ListView.view.width
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
@ -139,8 +143,8 @@ CollapsibleSection {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
rootPane.fontFamilyMono = modelData; root.rootPane.fontFamilyMono = monoDelegate.modelData;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -155,7 +159,7 @@ CollapsibleSection {
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
StyledText { StyledText {
text: modelData text: monoDelegate.modelData
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }
@ -165,7 +169,7 @@ CollapsibleSection {
Loader { Loader {
asynchronous: true asynchronous: true
active: isCurrent active: monoDelegate.isCurrent
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"
@ -211,9 +215,11 @@ CollapsibleSection {
} }
delegate: StyledRect { delegate: StyledRect {
id: materialDelegate
required property string modelData required property string modelData
required property int index required property int index
readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial readonly property bool isCurrent: modelData === root.rootPane.fontFamilyMaterial
width: ListView.view.width width: ListView.view.width
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0) color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
@ -223,8 +229,8 @@ CollapsibleSection {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
rootPane.fontFamilyMaterial = modelData; root.rootPane.fontFamilyMaterial = materialDelegate.modelData;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -239,7 +245,7 @@ CollapsibleSection {
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
StyledText { StyledText {
text: modelData text: materialDelegate.modelData
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }
@ -249,7 +255,7 @@ CollapsibleSection {
Loader { Loader {
asynchronous: true asynchronous: true
active: isCurrent active: materialDelegate.isCurrent
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"
@ -272,7 +278,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Font size scale") label: qsTr("Font size scale")
value: rootPane.fontSizeScale value: root.rootPane.fontSizeScale
from: 0.7 from: 0.7
to: 1.5 to: 1.5
decimals: 2 decimals: 2
@ -283,8 +289,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.fontSizeScale = newValue; root.rootPane.fontSizeScale = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }

View file

@ -22,7 +22,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Padding scale") label: qsTr("Padding scale")
value: rootPane.paddingScale value: root.rootPane.paddingScale
from: 0.5 from: 0.5
to: 2.0 to: 2.0
decimals: 1 decimals: 1
@ -33,8 +33,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.paddingScale = newValue; root.rootPane.paddingScale = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -46,7 +46,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Rounding scale") label: qsTr("Rounding scale")
value: rootPane.roundingScale value: root.rootPane.roundingScale
from: 0.1 from: 0.1
to: 5.0 to: 5.0
decimals: 1 decimals: 1
@ -57,8 +57,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.roundingScale = newValue; root.rootPane.roundingScale = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -70,7 +70,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Spacing scale") label: qsTr("Spacing scale")
value: rootPane.spacingScale value: root.rootPane.spacingScale
from: 0.1 from: 0.1
to: 2.0 to: 2.0
decimals: 1 decimals: 1
@ -81,8 +81,8 @@ CollapsibleSection {
} }
onValueModified: newValue => { onValueModified: newValue => {
rootPane.spacingScale = newValue; root.rootPane.spacingScale = newValue;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }

View file

@ -17,10 +17,10 @@ CollapsibleSection {
SwitchRow { SwitchRow {
label: qsTr("Transparency enabled") label: qsTr("Transparency enabled")
checked: rootPane.transparencyEnabled checked: root.rootPane.transparencyEnabled
onToggled: checked => { onToggled: checked => {
rootPane.transparencyEnabled = checked; root.rootPane.transparencyEnabled = checked;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
@ -31,7 +31,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Transparency base") label: qsTr("Transparency base")
value: rootPane.transparencyBase * 100 value: root.rootPane.transparencyBase * 100
from: 0 from: 0
to: 100 to: 100
suffix: "%" suffix: "%"
@ -43,8 +43,8 @@ CollapsibleSection {
parseValueFunction: text => parseInt(text) parseValueFunction: text => parseInt(text)
onValueModified: newValue => { onValueModified: newValue => {
rootPane.transparencyBase = newValue / 100; root.rootPane.transparencyBase = newValue / 100;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }
@ -56,7 +56,7 @@ CollapsibleSection {
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Transparency layers") label: qsTr("Transparency layers")
value: rootPane.transparencyLayers * 100 value: root.rootPane.transparencyLayers * 100
from: 0 from: 0
to: 100 to: 100
suffix: "%" suffix: "%"
@ -68,8 +68,8 @@ CollapsibleSection {
parseValueFunction: text => parseInt(text) parseValueFunction: text => parseInt(text)
onValueModified: newValue => { onValueModified: newValue => {
rootPane.transparencyLayers = newValue / 100; root.rootPane.transparencyLayers = newValue / 100;
rootPane.saveConfig(); root.rootPane.saveConfig();
} }
} }
} }

View file

@ -86,16 +86,18 @@ Item {
model: Audio.sinks model: Audio.sinks
delegate: StyledRect { delegate: StyledRect {
id: outputDeviceDelegate
required property var modelData required property var modelData
Layout.fillWidth: true Layout.fillWidth: true
color: Audio.sink?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" color: Audio.sink?.id === outputDeviceDelegate.modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent"
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
Audio.setAudioSink(modelData); Audio.setAudioSink(outputDeviceDelegate.modelData);
} }
} }
@ -110,9 +112,9 @@ Item {
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
MaterialIcon { MaterialIcon {
text: Audio.sink?.id === modelData.id ? "speaker" : "speaker_group" text: Audio.sink?.id === outputDeviceDelegate.modelData.id ? "speaker" : "speaker_group"
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
fill: Audio.sink?.id === modelData.id ? 1 : 0 fill: Audio.sink?.id === outputDeviceDelegate.modelData.id ? 1 : 0
} }
StyledText { StyledText {
@ -120,8 +122,8 @@ Item {
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
text: modelData.description || qsTr("Unknown") text: outputDeviceDelegate.modelData.description || qsTr("Unknown")
font.weight: Audio.sink?.id === modelData.id ? 500 : 400 font.weight: Audio.sink?.id === outputDeviceDelegate.modelData.id ? 500 : 400
} }
} }
@ -164,16 +166,18 @@ Item {
model: Audio.sources model: Audio.sources
delegate: StyledRect { delegate: StyledRect {
id: inputDeviceDelegate
required property var modelData required property var modelData
Layout.fillWidth: true Layout.fillWidth: true
color: Audio.source?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" color: Audio.source?.id === inputDeviceDelegate.modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent"
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
Audio.setAudioSource(modelData); Audio.setAudioSource(inputDeviceDelegate.modelData);
} }
} }
@ -190,7 +194,7 @@ Item {
MaterialIcon { MaterialIcon {
text: "mic" text: "mic"
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
fill: Audio.source?.id === modelData.id ? 1 : 0 fill: Audio.source?.id === inputDeviceDelegate.modelData.id ? 1 : 0
} }
StyledText { StyledText {
@ -198,8 +202,8 @@ Item {
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
text: modelData.description || qsTr("Unknown") text: inputDeviceDelegate.modelData.description || qsTr("Unknown")
font.weight: Audio.source?.id === modelData.id ? 500 : 400 font.weight: Audio.source?.id === inputDeviceDelegate.modelData.id ? 500 : 400
} }
} }
@ -489,6 +493,8 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
delegate: ColumnLayout { delegate: ColumnLayout {
id: streamDelegate
required property var modelData required property var modelData
required property int index required property int index
@ -509,7 +515,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
text: Audio.getStreamName(modelData) text: Audio.getStreamName(streamDelegate.modelData)
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
font.weight: 500 font.weight: 500
} }
@ -522,27 +528,27 @@ Item {
bottom: 0 bottom: 0
top: 100 top: 100
} }
enabled: !Audio.getStreamMuted(modelData) enabled: !Audio.getStreamMuted(streamDelegate.modelData)
Component.onCompleted: { Component.onCompleted: {
text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); text = Math.round(Audio.getStreamVolume(streamDelegate.modelData) * 100).toString();
} }
Connections { Connections {
function onAudioChanged() { function onAudioChanged() {
if (!streamVolumeInput.hasFocus && modelData?.audio) { if (!streamVolumeInput.hasFocus && streamDelegate.modelData?.audio) {
streamVolumeInput.text = Math.round(modelData.audio.volume * 100).toString(); streamVolumeInput.text = Math.round(streamDelegate.modelData.audio.volume * 100).toString();
} }
} }
target: modelData target: streamDelegate.modelData
} }
onTextEdited: text => { onTextEdited: text => {
if (hasFocus) { if (hasFocus) {
const val = parseInt(text); const val = parseInt(text);
if (!isNaN(val) && val >= 0 && val <= 100) { if (!isNaN(val) && val >= 0 && val <= 100) {
Audio.setStreamVolume(modelData, val / 100); Audio.setStreamVolume(streamDelegate.modelData, val / 100);
} }
} }
} }
@ -550,7 +556,7 @@ Item {
onEditingFinished: { onEditingFinished: {
const val = parseInt(text); const val = parseInt(text);
if (isNaN(val) || val < 0 || val > 100) { if (isNaN(val) || val < 0 || val > 100) {
text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); text = Math.round(Audio.getStreamVolume(streamDelegate.modelData) * 100).toString();
} }
} }
} }
@ -559,7 +565,7 @@ Item {
text: "%" text: "%"
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
opacity: Audio.getStreamMuted(modelData) ? 0.5 : 1 opacity: Audio.getStreamMuted(streamDelegate.modelData) ? 0.5 : 1
} }
StyledRect { StyledRect {
@ -567,11 +573,11 @@ Item {
implicitHeight: streamMuteIcon.implicitHeight + Appearance.padding.normal * 2 implicitHeight: streamMuteIcon.implicitHeight + Appearance.padding.normal * 2
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
color: Audio.getStreamMuted(modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer color: Audio.getStreamMuted(streamDelegate.modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
Audio.setStreamMuted(modelData, !Audio.getStreamMuted(modelData)); Audio.setStreamMuted(streamDelegate.modelData, !Audio.getStreamMuted(streamDelegate.modelData));
} }
} }
@ -579,21 +585,23 @@ Item {
id: streamMuteIcon id: streamMuteIcon
anchors.centerIn: parent anchors.centerIn: parent
text: Audio.getStreamMuted(modelData) ? "volume_off" : "volume_up" text: Audio.getStreamMuted(streamDelegate.modelData) ? "volume_off" : "volume_up"
color: Audio.getStreamMuted(modelData) ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer color: Audio.getStreamMuted(streamDelegate.modelData) ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer
} }
} }
} }
StyledSlider { StyledSlider {
id: streamSlider
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: Appearance.padding.normal * 3 implicitHeight: Appearance.padding.normal * 3
value: Audio.getStreamVolume(modelData) value: Audio.getStreamVolume(streamDelegate.modelData)
enabled: !Audio.getStreamMuted(modelData) enabled: !Audio.getStreamMuted(streamDelegate.modelData)
opacity: enabled ? 1 : 0.5 opacity: enabled ? 1 : 0.5
onMoved: { onMoved: {
Audio.setStreamVolume(modelData, value); Audio.setStreamVolume(streamDelegate.modelData, value);
if (!streamVolumeInput.hasFocus) { if (!streamVolumeInput.hasFocus) {
streamVolumeInput.text = Math.round(value * 100).toString(); streamVolumeInput.text = Math.round(value * 100).toString();
} }
@ -601,12 +609,12 @@ Item {
Connections { Connections {
function onAudioChanged() { function onAudioChanged() {
if (modelData?.audio) { if (streamDelegate.modelData?.audio) {
value = modelData.audio.volume; streamSlider.value = streamDelegate.modelData.audio.volume;
} }
} }
target: modelData target: streamDelegate.modelData
} }
} }
} }

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import qs.components import qs.components
import qs.components.controls import qs.components.controls
import qs.services import qs.services
@ -66,10 +68,10 @@ StyledRect {
// Create binding in Component.onCompleted // Create binding in Component.onCompleted
Component.onCompleted: { Component.onCompleted: {
if (modelData.state !== undefined && modelData.state) { if (button.modelData.state !== undefined && button.modelData.state) {
_checked = modelData.state; _checked = button.modelData.state;
} else if (root.rootItem && modelData.propertyName) { } else if (root.rootItem && button.modelData.propertyName) {
const propName = modelData.propertyName; const propName = button.modelData.propertyName;
const rootItem = root.rootItem; const rootItem = root.rootItem;
_checked = Qt.binding(function () { _checked = Qt.binding(function () {
return rootItem[propName] ?? false; return rootItem[propName] ?? false;
@ -88,9 +90,9 @@ StyledRect {
Layout.preferredWidth: implicitWidth + (stateLayer.pressed ? Appearance.padding.large : internalChecked ? Appearance.padding.smaller : 0) Layout.preferredWidth: implicitWidth + (stateLayer.pressed ? Appearance.padding.large : internalChecked ? Appearance.padding.smaller : 0)
onClicked: { onClicked: {
if (modelData.onToggled && root.rootItem && modelData.propertyName) { if (button.modelData.onToggled && root.rootItem && button.modelData.propertyName) {
const currentValue = root.rootItem[modelData.propertyName] ?? false; const currentValue = root.rootItem[button.modelData.propertyName] ?? false;
modelData.onToggled(!currentValue); button.modelData.onToggled(!currentValue);
} }
} }

View file

@ -28,6 +28,8 @@ GridView {
} }
delegate: Item { delegate: Item {
id: wpDelegate
required property var modelData required property var modelData
required property int index required property int index
readonly property bool isCurrent: modelData && modelData.path === Wallpapers.actualCurrent readonly property bool isCurrent: modelData && modelData.path === Wallpapers.actualCurrent
@ -39,27 +41,27 @@ GridView {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
Wallpapers.setWallpaper(modelData.path); Wallpapers.setWallpaper(wpDelegate.modelData.path);
} }
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: itemMargin anchors.leftMargin: wpDelegate.itemMargin
anchors.rightMargin: itemMargin anchors.rightMargin: wpDelegate.itemMargin
anchors.topMargin: itemMargin anchors.topMargin: wpDelegate.itemMargin
anchors.bottomMargin: itemMargin anchors.bottomMargin: wpDelegate.itemMargin
radius: itemRadius radius: wpDelegate.itemRadius
} }
StyledClippingRect { StyledClippingRect {
id: image id: image
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: itemMargin anchors.leftMargin: wpDelegate.itemMargin
anchors.rightMargin: itemMargin anchors.rightMargin: wpDelegate.itemMargin
anchors.topMargin: itemMargin anchors.topMargin: wpDelegate.itemMargin
anchors.bottomMargin: itemMargin anchors.bottomMargin: wpDelegate.itemMargin
color: Colours.tPalette.m3surfaceContainer color: Colours.tPalette.m3surfaceContainer
radius: itemRadius radius: wpDelegate.itemRadius
antialiasing: true antialiasing: true
layer.enabled: true layer.enabled: true
layer.smooth: true layer.smooth: true
@ -67,7 +69,7 @@ GridView {
CachingImage { CachingImage {
id: cachingImage id: cachingImage
path: modelData.path path: wpDelegate.modelData.path
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
cache: true cache: true
@ -91,7 +93,7 @@ GridView {
id: fallbackImage id: fallbackImage
anchors.fill: parent anchors.fill: parent
source: fallbackTimer.triggered && cachingImage.status !== Image.Ready ? modelData.path : "" source: fallbackTimer.triggered && cachingImage.status !== Image.Ready ? wpDelegate.modelData.path : ""
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
cache: true cache: true
@ -167,13 +169,13 @@ GridView {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: itemMargin anchors.leftMargin: wpDelegate.itemMargin
anchors.rightMargin: itemMargin anchors.rightMargin: wpDelegate.itemMargin
anchors.topMargin: itemMargin anchors.topMargin: wpDelegate.itemMargin
anchors.bottomMargin: itemMargin anchors.bottomMargin: wpDelegate.itemMargin
color: "transparent" color: "transparent"
radius: itemRadius + border.width radius: wpDelegate.itemRadius + border.width
border.width: isCurrent ? 2 : 0 border.width: wpDelegate.isCurrent ? 2 : 0
border.color: Colours.palette.m3primary border.color: Colours.palette.m3primary
antialiasing: true antialiasing: true
smooth: true smooth: true
@ -190,7 +192,7 @@ GridView {
anchors.top: parent.top anchors.top: parent.top
anchors.margins: Appearance.padding.small anchors.margins: Appearance.padding.small
visible: isCurrent visible: wpDelegate.isCurrent
text: "check_circle" text: "check_circle"
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
@ -207,10 +209,10 @@ GridView {
anchors.rightMargin: Appearance.padding.normal + Appearance.spacing.normal / 2 anchors.rightMargin: Appearance.padding.normal + Appearance.spacing.normal / 2
anchors.bottomMargin: Appearance.padding.normal anchors.bottomMargin: Appearance.padding.normal
text: modelData.name text: wpDelegate.modelData.name
font.pointSize: Appearance.font.size.smaller font.pointSize: Appearance.font.size.smaller
font.weight: 500 font.weight: 500
color: isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface color: wpDelegate.isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface
elide: Text.ElideMiddle elide: Text.ElideMiddle
maximumLineCount: 1 maximumLineCount: 1
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter

View file

@ -102,7 +102,7 @@ Item {
anchors.fill: parent anchors.fill: parent
onSelectedAppChanged: { onSelectedAppChanged: {
root.session.launcher.active = root.selectedApp; session.launcher.active = selectedApp;
updateToggleState(); updateToggleState();
} }
@ -117,7 +117,7 @@ Item {
Connections { Connections {
function onActiveChanged() { function onActiveChanged() {
root.selectedApp = root.session.launcher.active; root.selectedApp = root.session.launcher.active;
updateToggleState(); root.updateToggleState();
} }
target: root.session.launcher target: root.session.launcher
@ -133,7 +133,7 @@ Item {
Connections { Connections {
function onAppsChanged() { function onAppsChanged() {
updateFilteredApps(); root.updateFilteredApps();
} }
target: allAppsDb target: allAppsDb
@ -299,10 +299,12 @@ Item {
clip: true clip: true
StyledScrollBar.vertical: StyledScrollBar { StyledScrollBar.vertical: StyledScrollBar {
flickable: parent flickable: appsListView
} }
delegate: StyledRect { delegate: StyledRect {
id: appDelegate
required property var modelData required property var modelData
readonly property bool isSelected: root.selectedApp === modelData readonly property bool isSelected: root.selectedApp === modelData
@ -328,7 +330,7 @@ Item {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
root.session.launcher.active = modelData; root.session.launcher.active = appDelegate.modelData;
} }
} }
@ -345,20 +347,20 @@ Item {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
implicitSize: 32 implicitSize: 32
source: { source: {
const entry = modelData.entry; const entry = appDelegate.modelData.entry;
return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing";
} }
} }
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
text: modelData.name || modelData.entry?.name || qsTr("Unknown") text: appDelegate.modelData.name || appDelegate.modelData.entry?.name || qsTr("Unknown")
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }
Loader { Loader {
readonly property bool isHidden: modelData ? Strings.testRegexList(Config.launcher.hiddenApps, modelData.id) : false readonly property bool isHidden: appDelegate.modelData ? Strings.testRegexList(Config.launcher.hiddenApps, appDelegate.modelData.id) : false
readonly property bool isFav: modelData ? Strings.testRegexList(Config.launcher.favouriteApps, modelData.id) : false readonly property bool isFav: appDelegate.modelData ? Strings.testRegexList(Config.launcher.favouriteApps, appDelegate.modelData.id) : false
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
asynchronous: true asynchronous: true
@ -513,7 +515,7 @@ Item {
ColumnLayout { ColumnLayout {
id: appDetailsLayout id: appDetailsLayout
readonly property var displayedApp: parent && parent.displayedApp !== undefined ? parent.displayedApp : null readonly property var displayedApp: parent?.displayedApp ?? null // qmllint disable missing-property
anchors.fill: parent anchors.fill: parent
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
@ -522,7 +524,7 @@ Item {
Layout.leftMargin: Appearance.padding.large * 2 Layout.leftMargin: Appearance.padding.large * 2
Layout.rightMargin: Appearance.padding.large * 2 Layout.rightMargin: Appearance.padding.large * 2
Layout.topMargin: Appearance.padding.large * 2 Layout.topMargin: Appearance.padding.large * 2
visible: displayedApp === null visible: appDetailsLayout.displayedApp === null
icon: "apps" icon: "apps"
title: qsTr("Launcher Applications") title: qsTr("Launcher Applications")
} }
@ -532,7 +534,7 @@ Item {
Layout.leftMargin: Appearance.padding.large * 2 Layout.leftMargin: Appearance.padding.large * 2
Layout.rightMargin: Appearance.padding.large * 2 Layout.rightMargin: Appearance.padding.large * 2
Layout.topMargin: Appearance.padding.large * 2 Layout.topMargin: Appearance.padding.large * 2
visible: displayedApp !== null visible: appDetailsLayout.displayedApp !== null
implicitWidth: Math.max(appIconImage.implicitWidth, appTitleText.implicitWidth) implicitWidth: Math.max(appIconImage.implicitWidth, appTitleText.implicitWidth)
implicitHeight: appIconImage.implicitHeight + Appearance.spacing.normal + appTitleText.implicitHeight implicitHeight: appIconImage.implicitHeight + Appearance.spacing.normal + appTitleText.implicitHeight
@ -562,7 +564,7 @@ Item {
id: appTitleText id: appTitleText
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: displayedApp ? (displayedApp.name || displayedApp.entry?.name || qsTr("Application Details")) : "" text: appDetailsLayout.displayedApp.displayedApp ? (appDetailsLayout.displayedApp.displayedApp.displayedApp.name || appDetailsLayout.displayedApp.displayedApp.displayedApp.entry?.name || qsTr("Application Details")) : ""
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
font.bold: true font.bold: true
} }

View file

@ -70,7 +70,7 @@ DeviceList {
id: stateLayer id: stateLayer
function onClicked(): void { function onClicked(): void {
root.session.ethernet.active = modelData; root.session.ethernet.active = ethernetItem.modelData;
} }
} }
@ -87,12 +87,12 @@ DeviceList {
implicitHeight: icon.implicitHeight + Appearance.padding.normal * 2 implicitHeight: icon.implicitHeight + Appearance.padding.normal * 2
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
color: modelData.connected ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh color: ethernetItem.modelData.connected ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh
StyledRect { StyledRect {
anchors.fill: parent anchors.fill: parent
radius: parent.radius radius: parent.radius
color: Qt.alpha(modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface, stateLayer.pressed ? 0.1 : stateLayer.containsMouse ? 0.08 : 0) color: Qt.alpha(ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface, stateLayer.pressed ? 0.1 : stateLayer.containsMouse ? 0.08 : 0)
} }
MaterialIcon { MaterialIcon {
@ -101,8 +101,8 @@ DeviceList {
anchors.centerIn: parent anchors.centerIn: parent
text: "cable" text: "cable"
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
fill: modelData.connected ? 1 : 0 fill: ethernetItem.modelData.connected ? 1 : 0
color: modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
Behavior on fill { Behavior on fill {
Anim {} Anim {}
@ -117,7 +117,7 @@ DeviceList {
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
text: modelData.interface || qsTr("Unknown") text: ethernetItem.modelData.interface || qsTr("Unknown")
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -127,10 +127,10 @@ DeviceList {
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
text: modelData.connected ? qsTr("Connected") : qsTr("Disconnected") text: ethernetItem.modelData.connected ? qsTr("Connected") : qsTr("Disconnected")
color: modelData.connected ? Colours.palette.m3primary : Colours.palette.m3outline color: ethernetItem.modelData.connected ? Colours.palette.m3primary : Colours.palette.m3outline
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small
font.weight: modelData.connected ? 500 : 400 font.weight: ethernetItem.modelData.connected ? 500 : 400
elide: Text.ElideRight elide: Text.ElideRight
} }
} }
@ -143,18 +143,18 @@ DeviceList {
implicitHeight: connectIcon.implicitHeight + Appearance.padding.smaller * 2 implicitHeight: connectIcon.implicitHeight + Appearance.padding.smaller * 2
radius: Appearance.rounding.full radius: Appearance.rounding.full
color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.connected ? 1 : 0) color: Qt.alpha(Colours.palette.m3primaryContainer, ethernetItem.modelData.connected ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
if (modelData.connected && modelData.connection) { if (ethernetItem.modelData.connected && ethernetItem.modelData.connection) {
Nmcli.disconnectEthernet(modelData.connection, () => {}); Nmcli.disconnectEthernet(ethernetItem.modelData.connection, () => {});
} else { } else {
Nmcli.connectEthernet(modelData.connection || "", modelData.interface || "", () => {}); Nmcli.connectEthernet(ethernetItem.modelData.connection || "", ethernetItem.modelData.interface || "", () => {});
} }
} }
color: modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
} }
MaterialIcon { MaterialIcon {
@ -162,8 +162,8 @@ DeviceList {
anchors.centerIn: parent anchors.centerIn: parent
animate: true animate: true
text: modelData.connected ? "link_off" : "link" text: ethernetItem.modelData.connected ? "link_off" : "link"
color: modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
} }
} }
} }

View file

@ -170,11 +170,11 @@ DeviceDetails {
Connections { Connections {
function onActiveChanged() { function onActiveChanged() {
updateDeviceDetails(); root.updateDeviceDetails();
} }
function onWirelessDeviceDetailsChanged() { function onWirelessDeviceDetailsChanged() {
if (network && network.ssid) { if (root.network && root.network.ssid) {
const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); const isActive = root.network.active || (Nmcli.active && Nmcli.active.ssid === root.network.ssid);
if (isActive && Nmcli.wirelessDeviceDetails && Nmcli.wirelessDeviceDetails !== null) { if (isActive && Nmcli.wirelessDeviceDetails && Nmcli.wirelessDeviceDetails !== null) {
connectionUpdateTimer.stop(); connectionUpdateTimer.stop();
} }
@ -189,10 +189,10 @@ DeviceDetails {
interval: 500 interval: 500
repeat: true repeat: true
running: network && network.ssid running: root.network && root.network.ssid
onTriggered: { onTriggered: {
if (network) { if (root.network) {
const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); const isActive = root.network.active || (Nmcli.active && Nmcli.active.ssid === root.network.ssid);
if (isActive) { if (isActive) {
if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) { if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) {
Nmcli.getWirelessDeviceDetails("", () => {}); Nmcli.getWirelessDeviceDetails("", () => {});

View file

@ -104,18 +104,20 @@ DeviceList {
delegate: Component { delegate: Component {
StyledRect { StyledRect {
id: networkDelegate
required property var modelData required property var modelData
width: ListView.view ? ListView.view.width : undefined width: ListView.view ? ListView.view.width : undefined
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.activeItem === modelData ? Colours.tPalette.m3surfaceContainer.a : 0) color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.activeItem === networkDelegate.modelData ? Colours.tPalette.m3surfaceContainer.a : 0)
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
root.session.network.active = modelData; root.session.network.active = networkDelegate.modelData;
if (modelData && modelData.ssid) { if (networkDelegate.modelData && networkDelegate.modelData.ssid) {
root.checkSavedProfileForNetwork(modelData.ssid); root.checkSavedProfileForNetwork(networkDelegate.modelData.ssid);
} }
} }
} }
@ -135,16 +137,16 @@ DeviceList {
implicitHeight: icon.implicitHeight + Appearance.padding.normal * 2 implicitHeight: icon.implicitHeight + Appearance.padding.normal * 2
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
color: modelData.active ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh color: networkDelegate.modelData.active ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh
MaterialIcon { MaterialIcon {
id: icon id: icon
anchors.centerIn: parent anchors.centerIn: parent
text: Icons.getNetworkIcon(modelData.strength, modelData.isSecure) text: Icons.getNetworkIcon(networkDelegate.modelData.strength, networkDelegate.modelData.isSecure)
font.pointSize: Appearance.font.size.large font.pointSize: Appearance.font.size.large
fill: modelData.active ? 1 : 0 fill: networkDelegate.modelData.active ? 1 : 0
color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface color: networkDelegate.modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
} }
} }
@ -158,7 +160,7 @@ DeviceList {
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
text: modelData.ssid || qsTr("Unknown") text: networkDelegate.modelData.ssid || qsTr("Unknown")
} }
RowLayout { RowLayout {
@ -168,18 +170,18 @@ DeviceList {
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
text: { text: {
if (modelData.active) if (networkDelegate.modelData.active)
return qsTr("Connected"); return qsTr("Connected");
if (modelData.isSecure && modelData.security && modelData.security.length > 0) { if (networkDelegate.modelData.isSecure && networkDelegate.modelData.security && networkDelegate.modelData.security.length > 0) {
return modelData.security; return networkDelegate.modelData.security;
} }
if (modelData.isSecure) if (networkDelegate.modelData.isSecure)
return qsTr("Secured"); return qsTr("Secured");
return qsTr("Open"); return qsTr("Open");
} }
color: modelData.active ? Colours.palette.m3primary : Colours.palette.m3outline color: networkDelegate.modelData.active ? Colours.palette.m3primary : Colours.palette.m3outline
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small
font.weight: modelData.active ? 500 : 400 font.weight: networkDelegate.modelData.active ? 500 : 400
elide: Text.ElideRight elide: Text.ElideRight
} }
} }
@ -190,14 +192,14 @@ DeviceList {
implicitHeight: connectIcon.implicitHeight + Appearance.padding.smaller * 2 implicitHeight: connectIcon.implicitHeight + Appearance.padding.smaller * 2
radius: Appearance.rounding.full radius: Appearance.rounding.full
color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.active ? 1 : 0) color: Qt.alpha(Colours.palette.m3primaryContainer, networkDelegate.modelData.active ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
if (modelData.active) { if (networkDelegate.modelData.active) {
Nmcli.disconnectFromNetwork(); Nmcli.disconnectFromNetwork();
} else { } else {
NetworkConnection.handleConnect(modelData, root.session, null); NetworkConnection.handleConnect(networkDelegate.modelData, root.session, null);
} }
} }
} }
@ -206,8 +208,8 @@ DeviceList {
id: connectIcon id: connectIcon
anchors.centerIn: parent anchors.centerIn: parent
text: modelData.active ? "link_off" : "link" text: networkDelegate.modelData.active ? "link_off" : "link"
color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface color: networkDelegate.modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
} }
} }
} }

View file

@ -71,9 +71,7 @@ Item {
enabled: session.network.showPasswordDialog && !isClosing enabled: session.network.showPasswordDialog && !isClosing
focus: enabled focus: enabled
Keys.onEscapePressed: { Keys.onEscapePressed: closeDialog()
closeDialog();
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@ -86,7 +84,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: closeDialog() onClicked: root.closeDialog()
} }
} }
@ -132,7 +130,7 @@ Item {
} }
} }
Keys.onEscapePressed: closeDialog() Keys.onEscapePressed: root.closeDialog()
ColumnLayout { ColumnLayout {
id: content id: content
@ -465,7 +463,7 @@ Item {
triggeredOnStart: false triggeredOnStart: false
onTriggered: { onTriggered: {
repeatCount++; repeatCount++;
checkConnectionStatus(); root.checkConnectionStatus();
} }
onRunningChanged: { onRunningChanged: {
@ -486,7 +484,7 @@ Item {
connectionMonitor.stop(); connectionMonitor.stop();
connectButton.connecting = false; connectButton.connecting = false;
connectButton.text = qsTr("Connect"); connectButton.text = qsTr("Connect");
closeDialog(); root.closeDialog();
} }
} }
} }
@ -495,7 +493,7 @@ Item {
Connections { Connections {
function onActiveChanged() { function onActiveChanged() {
if (root.visible) { if (root.visible) {
checkConnectionStatus(); root.checkConnectionStatus();
} }
} }
function onConnectionFailed(ssid: string) { function onConnectionFailed(ssid: string) {

View file

@ -78,7 +78,7 @@ Item {
asynchronous: true asynchronous: true
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
active: modelData && Strings.testRegexList(Config.launcher.favouriteApps, modelData.id) active: root.modelData && Strings.testRegexList(Config.launcher.favouriteApps, root.modelData.id)
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "favorite" text: "favorite"

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import qs.components import qs.components
import qs.components.controls import qs.components.controls
import qs.services import qs.services

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import qs.components import qs.components
import qs.services import qs.services
import qs.config import qs.config

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import qs.config import qs.config
import qs.utils import qs.utils
import Caelestia import Caelestia

View file

@ -25,12 +25,12 @@ Singleton {
if (!Config.utilities.toasts.nowPlaying) { if (!Config.utilities.toasts.nowPlaying) {
return; return;
} }
if (active.trackArtist != "" && active.trackTitle != "") { if (root.active.trackArtist != "" && root.active.trackTitle != "") {
Toaster.toast(qsTr("Now Playing"), qsTr("%1 - %2").arg(active.trackArtist).arg(active.trackTitle), "music_note"); Toaster.toast(qsTr("Now Playing"), qsTr("%1 - %2").arg(root.active.trackArtist).arg(root.active.trackTitle), "music_note");
} }
} }
target: active target: root.active
} }
PersistentProperties { PersistentProperties {