Fixed all qmlfmt warnings/errors
This commit is contained in:
parent
b824cd7809
commit
2f4d52403b
6 changed files with 210 additions and 169 deletions
|
|
@ -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 {} \;
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
}
|
||||||
|
|
@ -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,61 +44,93 @@ 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"
|
||||||
sizeMultiplier: 0.7
|
sizeMultiplier: 0.7
|
||||||
onClicked: function() {
|
onClicked: function () {
|
||||||
Scaling.overrideEnabled = false
|
Scaling.overrideEnabled = false
|
||||||
Scaling.overrideScale = 1.0
|
Scaling.overrideScale = 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NDivider { Layout.fillWidth: true }
|
NDivider {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,169 +1,161 @@
|
||||||
// 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
|
// property real trackLength: currentPlayer ? currentPlayer.length : 0
|
||||||
// || "Unknown Album") : ""
|
// property bool canPlay: currentPlayer ? currentPlayer.canPlay : false
|
||||||
// property string trackArtUrl: currentPlayer ? (currentPlayer.trackArtUrl
|
// property bool canPause: currentPlayer ? currentPlayer.canPause : false
|
||||||
// || "") : ""
|
// property bool canGoNext: currentPlayer ? currentPlayer.canGoNext : false
|
||||||
// property real trackLength: currentPlayer ? currentPlayer.length : 0
|
// property bool canGoPrevious: currentPlayer ? currentPlayer.canGoPrevious : false
|
||||||
// property bool canPlay: currentPlayer ? currentPlayer.canPlay : false
|
// property bool canSeek: currentPlayer ? currentPlayer.canSeek : false
|
||||||
// property bool canPause: currentPlayer ? currentPlayer.canPause : false
|
// property bool hasPlayer: getAvailablePlayers().length > 0
|
||||||
// property bool canGoNext: currentPlayer ? currentPlayer.canGoNext : false
|
|
||||||
// property bool canGoPrevious: currentPlayer ? currentPlayer.canGoPrevious : false
|
|
||||||
// property bool canSeek: currentPlayer ? currentPlayer.canSeek : false
|
|
||||||
// property bool hasPlayer: getAvailablePlayers().length > 0
|
|
||||||
|
|
||||||
// Item {
|
// Item {
|
||||||
// Component.onCompleted: {
|
// Component.onCompleted: {
|
||||||
// updateCurrentPlayer()
|
// updateCurrentPlayer()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function getAvailablePlayers() {
|
// function getAvailablePlayers() {
|
||||||
// if (!Mpris.players || !Mpris.players.values) {
|
// if (!Mpris.players || !Mpris.players.values) {
|
||||||
// return []
|
// return []
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// let allPlayers = Mpris.players.values
|
// let allPlayers = Mpris.players.values
|
||||||
// let controllablePlayers = []
|
// let controllablePlayers = []
|
||||||
|
|
||||||
// for (var i = 0; i < allPlayers.length; i++) {
|
// for (var i = 0; i < allPlayers.length; i++) {
|
||||||
// let player = allPlayers[i]
|
// let player = allPlayers[i]
|
||||||
// if (player && player.canControl) {
|
// if (player && player.canControl) {
|
||||||
// controllablePlayers.push(player)
|
// controllablePlayers.push(player)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// return controllablePlayers
|
// return controllablePlayers
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function findActivePlayer() {
|
// function findActivePlayer() {
|
||||||
// let availablePlayers = getAvailablePlayers()
|
// let availablePlayers = getAvailablePlayers()
|
||||||
// if (availablePlayers.length === 0) {
|
// if (availablePlayers.length === 0) {
|
||||||
// return null
|
// return null
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (selectedPlayerIndex < availablePlayers.length) {
|
// if (selectedPlayerIndex < availablePlayers.length) {
|
||||||
// return availablePlayers[selectedPlayerIndex]
|
// return availablePlayers[selectedPlayerIndex]
|
||||||
// } else {
|
// } else {
|
||||||
// selectedPlayerIndex = 0
|
// selectedPlayerIndex = 0
|
||||||
// return availablePlayers[0]
|
// return availablePlayers[0]
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // Switch to the most recently active player
|
// // Switch to the most recently active player
|
||||||
// function updateCurrentPlayer() {
|
// function updateCurrentPlayer() {
|
||||||
// let newPlayer = findActivePlayer()
|
// let newPlayer = findActivePlayer()
|
||||||
// if (newPlayer !== currentPlayer) {
|
// if (newPlayer !== currentPlayer) {
|
||||||
// currentPlayer = newPlayer
|
// currentPlayer = newPlayer
|
||||||
// currentPosition = currentPlayer ? currentPlayer.position : 0
|
// currentPosition = currentPlayer ? currentPlayer.position : 0
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function playPause() {
|
// function playPause() {
|
||||||
// if (currentPlayer) {
|
// if (currentPlayer) {
|
||||||
// if (currentPlayer.isPlaying) {
|
// if (currentPlayer.isPlaying) {
|
||||||
// currentPlayer.pause()
|
// currentPlayer.pause()
|
||||||
// } else {
|
// } else {
|
||||||
// currentPlayer.play()
|
// currentPlayer.play()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function play() {
|
// function play() {
|
||||||
// if (currentPlayer && currentPlayer.canPlay) {
|
// if (currentPlayer && currentPlayer.canPlay) {
|
||||||
// currentPlayer.play()
|
// currentPlayer.play()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function pause() {
|
// function pause() {
|
||||||
// if (currentPlayer && currentPlayer.canPause) {
|
// if (currentPlayer && currentPlayer.canPause) {
|
||||||
// currentPlayer.pause()
|
// currentPlayer.pause()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function next() {
|
// function next() {
|
||||||
// if (currentPlayer && currentPlayer.canGoNext) {
|
// if (currentPlayer && currentPlayer.canGoNext) {
|
||||||
// currentPlayer.next()
|
// currentPlayer.next()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function previous() {
|
// function previous() {
|
||||||
// if (currentPlayer && currentPlayer.canGoPrevious) {
|
// if (currentPlayer && currentPlayer.canGoPrevious) {
|
||||||
// currentPlayer.previous()
|
// currentPlayer.previous()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function seek(position) {
|
// function seek(position) {
|
||||||
// if (currentPlayer && currentPlayer.canSeek) {
|
// if (currentPlayer && currentPlayer.canSeek) {
|
||||||
// currentPlayer.position = position
|
// currentPlayer.position = position
|
||||||
// currentPosition = position
|
// currentPosition = position
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // Seek to position based on ratio (0.0 to 1.0)
|
// // Seek to position based on ratio (0.0 to 1.0)
|
||||||
// function seekByRatio(ratio) {
|
// function seekByRatio(ratio) {
|
||||||
// if (currentPlayer && currentPlayer.canSeek && currentPlayer.length > 0) {
|
// if (currentPlayer && currentPlayer.canSeek && currentPlayer.length > 0) {
|
||||||
// let seekPosition = ratio * currentPlayer.length
|
// let seekPosition = ratio * currentPlayer.length
|
||||||
// currentPlayer.position = seekPosition
|
// currentPlayer.position = seekPosition
|
||||||
// currentPosition = seekPosition
|
// currentPosition = seekPosition
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // Update progress bar every second while playing
|
// // Update progress bar every second while playing
|
||||||
// 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 && currentPlayer.playbackState === MprisPlaybackState.Playing) {
|
||||||
// if (currentPlayer && currentPlayer.isPlaying
|
// currentPosition = currentPlayer.position
|
||||||
// && currentPlayer.playbackState === MprisPlaybackState.Playing) {
|
// } else {
|
||||||
// currentPosition = currentPlayer.position
|
// running = false
|
||||||
// } else {
|
// }
|
||||||
// running = false
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 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
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
|
||||||
|
|
||||||
// // Update current player when available players change
|
// // Update current player when available players change
|
||||||
// Connections {
|
// Connections {
|
||||||
// target: Mpris.players
|
// target: Mpris.players
|
||||||
// function onValuesChanged() {
|
// function onValuesChanged() {
|
||||||
// updateCurrentPlayer()
|
// updateCurrentPlayer()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Cava {
|
// Cava {
|
||||||
// id: cava
|
// id: cava
|
||||||
// count: 44
|
// count: 44
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // Expose cava values
|
// // Expose cava values
|
||||||
// property alias cavaValues: cava.values
|
// property alias cavaValues: cava.values
|
||||||
// }
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ RowLayout {
|
||||||
width: Style.baseWidgetSize * 1.625 * scaling
|
width: Style.baseWidgetSize * 1.625 * scaling
|
||||||
height: Style.baseWidgetSize * scaling
|
height: Style.baseWidgetSize * scaling
|
||||||
radius: height * 0.5
|
radius: height * 0.5
|
||||||
color: value ? Colors.accentPrimary :Colors.surfaceVariant
|
color: value ? Colors.accentPrimary : Colors.surfaceVariant
|
||||||
border.color: value ? Colors.accentPrimary : Colors.outline
|
border.color: value ? Colors.accentPrimary : Colors.outline
|
||||||
border.width: Math.min(1, Style.borderMedium * scaling)
|
border.width: Math.min(1, Style.borderMedium * scaling)
|
||||||
|
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue