diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/dashboard/Content.qml | 32 | ||||
| -rw-r--r-- | modules/dashboard/Dash.qml | 3 | ||||
| -rw-r--r-- | modules/dashboard/Media.qml | 8 | ||||
| -rw-r--r-- | modules/dashboard/dash/Media.qml | 6 |
4 files changed, 27 insertions, 22 deletions
diff --git a/modules/dashboard/Content.qml b/modules/dashboard/Content.qml index 33171e0..4f4e242 100644 --- a/modules/dashboard/Content.qml +++ b/modules/dashboard/Content.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import "root:/widgets" import "root:/services" import "root:/config" @@ -82,20 +84,20 @@ Item { RowLayout { id: row - Dash { - Layout.alignment: Qt.AlignTop - shouldUpdate: visible && this === view.currentItem - visibilities: root.visibilities + Pane { + sourceComponent: Dash { + visibilities: root.visibilities + } } - Media { - Layout.alignment: Qt.AlignTop - shouldUpdate: visible && this === view.currentItem - visibilities: root.visibilities + Pane { + sourceComponent: Media { + visibilities: root.visibilities + } } - Performance { - Layout.alignment: Qt.AlignTop + Pane { + sourceComponent: Performance {} } } @@ -124,4 +126,14 @@ Item { easing.bezierCurve: Appearance.anim.curves.emphasized } } + + component Pane: Loader { + Layout.alignment: Qt.AlignTop + + Component.onCompleted: active = Qt.binding(() => { + const vx = Math.floor(view.visibleArea.xPosition * view.contentWidth); + const vex = Math.floor(vx + view.visibleArea.widthRatio * view.contentWidth); + return (vx >= x && vx <= x + implicitWidth) || (vex >= x && vex <= x + implicitWidth); + }) + } } diff --git a/modules/dashboard/Dash.qml b/modules/dashboard/Dash.qml index 869ad90..56312ba 100644 --- a/modules/dashboard/Dash.qml +++ b/modules/dashboard/Dash.qml @@ -7,7 +7,6 @@ import QtQuick.Layouts GridLayout { id: root - required property bool shouldUpdate required property var visibilities rowSpacing: Appearance.spacing.normal @@ -77,8 +76,6 @@ GridLayout { Media { id: media - - shouldUpdate: root.shouldUpdate } } diff --git a/modules/dashboard/Media.qml b/modules/dashboard/Media.qml index 58e942b..24f504a 100644 --- a/modules/dashboard/Media.qml +++ b/modules/dashboard/Media.qml @@ -15,7 +15,6 @@ import QtQuick.Layouts Item { id: root - required property bool shouldUpdate required property PersistentProperties visibilities property real playerProgress: { @@ -41,7 +40,7 @@ Item { } Timer { - running: root.shouldUpdate && (Players.active?.isPlaying ?? false) + running: Players.active?.isPlaying ?? false interval: Config.dashboard.mediaUpdateInterval triggeredOnStart: true repeat: true @@ -52,8 +51,7 @@ Item { target: Cava function onValuesChanged(): void { - if (root.shouldUpdate) - visualiser.requestPaint(); + visualiser.requestPaint(); } } @@ -523,7 +521,7 @@ Item { width: visualiser.width * 0.75 height: visualiser.height * 0.75 - playing: root.shouldUpdate && (Players.active?.isPlaying ?? false) + playing: Players.active?.isPlaying ?? false speed: BeatDetector.bpm / 300 source: Paths.expandTilde(Config.paths.mediaGif) asynchronous: true diff --git a/modules/dashboard/dash/Media.qml b/modules/dashboard/dash/Media.qml index 464f349..1ff93a8 100644 --- a/modules/dashboard/dash/Media.qml +++ b/modules/dashboard/dash/Media.qml @@ -8,8 +8,6 @@ import QtQuick.Shapes Item { id: root - required property bool shouldUpdate - property real playerProgress: { const active = Players.active; return active?.length ? active.position / active.length : 0; @@ -28,7 +26,7 @@ Item { } Timer { - running: root.shouldUpdate && (Players.active?.isPlaying ?? false) + running: Players.active?.isPlaying ?? false interval: Config.dashboard.mediaUpdateInterval triggeredOnStart: true repeat: true @@ -219,7 +217,7 @@ Item { anchors.bottomMargin: Appearance.padding.large anchors.margins: Appearance.padding.large * 2 - playing: root.shouldUpdate && (Players.active?.isPlaying ?? false) + playing: Players.active?.isPlaying ?? false speed: BeatDetector.bpm / 300 source: Paths.expandTilde(Config.paths.mediaGif) asynchronous: true |