@@ -2,7 +2,6 @@ import QtQuick
22import QtQuick.Layouts
33import org.kde.kirigami as Kirigami
44import org.kde.plasma.plasmoid
5- import org.kde.plasma.components as PlasmaComponents
65import "./components"
76import "code/enum.js" as Enum
87import "code/globals.js" as Globals
@@ -11,19 +10,25 @@ import "code/utils.js" as Utils
1110Item {
1211 id: root
1312
14- Layout .preferredWidth : main .onDesktop ? content .implicitWidth : (main .horizontal ? content .implicitWidth : parent .height )
15- Layout .preferredHeight : main .onDesktop ? 0 : (main .horizontal ? parent .height : content .implicitHeight )
16- Layout .minimumWidth : Layout .preferredWidth
17- Layout .minimumHeight : Layout .preferredHeight
13+ Layout .preferredWidth : {
14+ if (main .onDesktop || main .horizontal && Plasmoid .configuration .expanding ) {
15+ return 0 ;
16+ }
17+ return main .horizontal ? Plasmoid .configuration .length : parent .width ;
18+ }
1819
19- property int framerate: Plasmoid .configuration .framerate
20- property int barGap: Plasmoid .configuration .barGap
21- property int barCount: {
22- if (visualizerStyle === Enum .VisualizerStyles .Wave ) {
23- return Math .max (2 , Plasmoid .configuration .barCount );
20+ Layout .preferredHeight : {
21+ if (main .onDesktop || ! main .horizontal && Plasmoid .configuration .expanding ) {
22+ return 0 ;
2423 }
25- return Plasmoid .configuration .barCount ;
24+ return main . horizontal ? parent . height : Plasmoid .configuration .length ;
2625 }
26+ Layout .fillWidth : main .horizontal && Plasmoid .configuration .expanding && ! main .onDesktop
27+ Layout .fillHeight : ! main .horizontal && Plasmoid .configuration .expanding && ! main .onDesktop
28+
29+ property int framerate: Plasmoid .configuration .framerate
30+ property int barGap: Plasmoid .configuration .barGap
31+ property int barCount: main .barCount
2732 property int barWidth: Plasmoid .configuration .barWidth
2833 property int noiseReduction: Plasmoid .configuration .noiseReduction
2934 property int monstercat: Plasmoid .configuration .monstercat
@@ -67,34 +72,31 @@ Item {
6772 return config;
6873 }
6974
70- RowLayout {
71- id: content
72- height: parent .height
73- anchors .horizontalCenter : parent .horizontalCenter
74- Visualizer {
75- id: visualizer
76- visualizerStyle: root .visualizerStyle
77- barWidth: root .barWidth
78- barGap: root .barGap
79- barCount: root .barCount
80- centeredBars: root .centeredBars
81- roundedBars: root .roundedBars
82- fillWave: root .fillWave
83- barColorsCfg: root .barColorsCfg
84- waveFillColorsCfg: root .waveFillColorsCfg
85- values: cava .values
86- debugMode: Plasmoid .configuration .debugMode
87- visible: ! cava .hasError
88- }
89- Kirigami .Icon {
90- Layout .preferredWidth : Kirigami .Units .iconSizes .roundedIconSize (Math .min (main .height , main .width ))
91- Layout .preferredHeight : Layout .preferredWidth
92- source: Qt .resolvedUrl (" ./icons/error.svg" ).toString ().replace (" file://" , " " )
93- active: mouseArea .containsMouse
94- isMask: true
95- color: Kirigami .Theme .negativeTextColor
96- visible: cava .hasError
97- }
75+ Visualizer {
76+ id: visualizer
77+ anchors .fill : parent
78+ visualizerStyle: root .visualizerStyle
79+ barWidth: root .barWidth
80+ barGap: root .barGap
81+ barCount: root .barCount
82+ centeredBars: root .centeredBars
83+ roundedBars: root .roundedBars
84+ fillWave: root .fillWave
85+ barColorsCfg: root .barColorsCfg
86+ waveFillColorsCfg: root .waveFillColorsCfg
87+ values: cava .values
88+ debugMode: Plasmoid .configuration .debugMode
89+ visible: ! cava .hasError && ! cava .idle
90+ }
91+ Kirigami .Icon {
92+ anchors .centerIn : parent
93+ width: Kirigami .Units .iconSizes .roundedIconSize (Math .min (main .height , main .width ))
94+ height: width
95+ source: Qt .resolvedUrl (" ./icons/error.svg" ).toString ().replace (" file://" , " " )
96+ active: mouseArea .containsMouse
97+ isMask: true
98+ color: Kirigami .Theme .negativeTextColor
99+ visible: cava .hasError
98100 }
99101
100102 MouseArea {
0 commit comments