Fixed all qmlfmt warnings/errors

This commit is contained in:
quadbyte 2025-08-10 14:49:43 -04:00
parent b824cd7809
commit 2f4d52403b
6 changed files with 210 additions and 169 deletions

View file

@ -4,5 +4,4 @@
# Can be installed from AUR "qmlfmt-git" # Can be installed from AUR "qmlfmt-git"
# Requires qt6-5compat # Requires qt6-5compat
#find . -name "*.qml" -exec sh -c 'echo "Formatting $0..."; qmlfmt -e -b 120 -t 2 -i 2 -w "$0"' {} \;
find . -name "*.qml" -print -exec qmlfmt -e -b 120 -t 2 -i 2 -w {} \; find . -name "*.qml" -print -exec qmlfmt -e -b 120 -t 2 -i 2 -w {} \;

View file

@ -0,0 +1,8 @@
pragma Singleton
import Quickshell
import qs.Services
Item {
id: root
}

View file

@ -6,10 +6,10 @@ import Quickshell.Wayland
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
/* /*
An experiment/demo panel to tweaks widgets An experiment/demo panel to tweaks widgets
*/ */
NLoader { NLoader {
id: root id: root
@ -32,7 +32,9 @@ NLoader {
anchors.centerIn: parent anchors.centerIn: parent
// Prevent closing when clicking in the panel bg // Prevent closing when clicking in the panel bg
MouseArea { anchors.fill: parent } MouseArea {
anchors.fill: parent
}
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
@ -42,50 +44,80 @@ NLoader {
// NIconButton // NIconButton
ColumnLayout { ColumnLayout {
spacing: 16 * scaling spacing: 16 * scaling
NText { text: "NIconButton"; color: Colors.accentSecondary } NText {
text: "NIconButton"
color: Colors.accentSecondary
}
NIconButton { NIconButton {
id: myIconButton id: myIconButton
icon: "refresh" icon: "refresh"
onEntered: function() { myTooltip.show() } onEntered: function () {
onExited: function() { myTooltip.hide() } myTooltip.show()
}
onExited: function () {
myTooltip.hide()
}
}
NTooltip {
id: myTooltip
target: myIconButton
positionAbove: false
text: "Hello world"
} }
NTooltip { id: myTooltip; target: myIconButton; positionAbove: false; text: "Hello world"; }
NDivider { Layout.fillWidth: true } NDivider {
Layout.fillWidth: true
}
} }
// NToggle // NToggle
ColumnLayout { ColumnLayout {
spacing: Style.marginLarge * scaling spacing: Style.marginLarge * scaling
uniformCellSizes: true uniformCellSizes: true
NText { text: "NToggle + NTooltip"; color: Colors.accentSecondary } NText {
text: "NToggle + NTooltip"
color: Colors.accentSecondary
}
NToggle { NToggle {
label: "Label" label: "Label"
description: "Description" description: "Description"
onToggled: function(value: bool) { console.log("NToggle: " + value) } onToggled: function (value) {
console.log("NToggle: " + value)
}
} }
NDivider {
NDivider { Layout.fillWidth: true } Layout.fillWidth: true
}
} }
// NSlider // NSlider
ColumnLayout { ColumnLayout {
spacing: 16 * scaling spacing: 16 * scaling
NText { text: "Scaling"; color: Colors.accentSecondary } NText {
text: "Scaling"
color: Colors.accentSecondary
}
RowLayout { RowLayout {
spacing: Style.marginSmall * scaling spacing: Style.marginSmall * scaling
NText { text: `${Math.round(Scaling.overrideScale * 100)}%`; Layout.alignment: Qt.AlignVCenter } NText {
text: `${Math.round(Scaling.overrideScale * 100)}%`
Layout.alignment: Qt.AlignVCenter
}
NSlider { NSlider {
id: scaleSlider id: scaleSlider
from: 0.6 from: 0.6
to: 1.8 to: 1.8
stepSize: 0.01 stepSize: 0.01
value: Scaling.overrideScale value: Scaling.overrideScale
onMoved: function() { Scaling.overrideScale = value } onMoved: function () {
onPressedChanged: function() { Scaling.overrideEnabled = true } Scaling.overrideScale = value
}
onPressedChanged: function () {
Scaling.overrideEnabled = true
}
} }
NIconButton { NIconButton {
icon: "restart_alt" icon: "restart_alt"
@ -96,7 +128,9 @@ NLoader {
} }
} }
} }
NDivider { Layout.fillWidth: true } NDivider {
Layout.fillWidth: true
}
} }
} }
} }

View file

@ -1,2 +1,10 @@
pragma Singleton
import Quickshell
import qs.Services
// Weather logic and caching // Weather logic and caching
// Calendar Hollidays logic and caching // Calendar Hollidays logic and caching
Singleton {
id: root
}

View file

@ -1,25 +1,20 @@
// pragma Singleton pragma Singleton
// import QtQuick import Quickshell
// import Quickshell import Quickshell.Services.Mpris
// import Quickshell.Services.Mpris import qs.Services
// import qs.Services
// Singleton { Singleton {
// id: manager id: root
// property var currentPlayer: null // property var currentPlayer: null
// property real currentPosition: 0 // property real currentPosition: 0
// property int selectedPlayerIndex: 0 // property int selectedPlayerIndex: 0
// property bool isPlaying: currentPlayer ? currentPlayer.isPlaying : false // property bool isPlaying: currentPlayer ? currentPlayer.isPlaying : false
// property string trackTitle: currentPlayer ? (currentPlayer.trackTitle // property string trackTitle: currentPlayer ? (currentPlayer.trackTitle || "Unknown Track") : ""
// || "Unknown Track") : "" // property string trackArtist: currentPlayer ? (currentPlayer.trackArtist || "Unknown Artist") : ""
// property string trackArtist: currentPlayer ? (currentPlayer.trackArtist // property string trackAlbum: currentPlayer ? (currentPlayer.trackAlbum || "Unknown Album") : ""
// || "Unknown Artist") : "" // property string trackArtUrl: currentPlayer ? (currentPlayer.trackArtUrl || "") : ""
// property string trackAlbum: currentPlayer ? (currentPlayer.trackAlbum
// || "Unknown Album") : ""
// property string trackArtUrl: currentPlayer ? (currentPlayer.trackArtUrl
// || "") : ""
// property real trackLength: currentPlayer ? currentPlayer.length : 0 // property real trackLength: currentPlayer ? currentPlayer.length : 0
// property bool canPlay: currentPlayer ? currentPlayer.canPlay : false // property bool canPlay: currentPlayer ? currentPlayer.canPlay : false
// property bool canPause: currentPlayer ? currentPlayer.canPause : false // property bool canPause: currentPlayer ? currentPlayer.canPause : false
@ -129,13 +124,11 @@
// Timer { // Timer {
// id: positionTimer // id: positionTimer
// interval: 1000 // interval: 1000
// running: currentPlayer && currentPlayer.isPlaying // running: currentPlayer && currentPlayer.isPlaying && currentPlayer.length > 0
// && currentPlayer.length > 0
// && currentPlayer.playbackState === MprisPlaybackState.Playing // && currentPlayer.playbackState === MprisPlaybackState.Playing
// repeat: true // repeat: true
// onTriggered: { // onTriggered: {
// if (currentPlayer && currentPlayer.isPlaying // if (currentPlayer && currentPlayer.isPlaying && currentPlayer.playbackState === MprisPlaybackState.Playing) {
// && currentPlayer.playbackState === MprisPlaybackState.Playing) {
// currentPosition = currentPlayer.position // currentPosition = currentPlayer.position
// } else { // } else {
// running = false // running = false
@ -145,8 +138,7 @@
// // Reset position when switching to inactive player // // Reset position when switching to inactive player
// onCurrentPlayerChanged: { // onCurrentPlayerChanged: {
// if (!currentPlayer || !currentPlayer.isPlaying // if (!currentPlayer || !currentPlayer.isPlaying || currentPlayer.playbackState !== MprisPlaybackState.Playing) {
// || currentPlayer.playbackState !== MprisPlaybackState.Playing) {
// currentPosition = 0 // currentPosition = 0
// } // }
// } // }
@ -166,4 +158,4 @@
// // Expose cava values // // Expose cava values
// property alias cavaValues: cava.values // property alias cavaValues: cava.values
// } }

View file

@ -11,7 +11,7 @@ RowLayout {
property string description: "" property string description: ""
property bool value: false property bool value: false
property bool hovering: false property bool hovering: false
property var onToggled: function (value: bool) {} property var onToggled: function (value) {}
Layout.fillWidth: true Layout.fillWidth: true
@ -70,8 +70,8 @@ RowLayout {
onEntered: hovering = true onEntered: hovering = true
onExited: hovering = false onExited: hovering = false
onClicked: { onClicked: {
value = !value; value = !value
root.onToggled(value); root.onToggled(value)
} }
} }
} }