dashboard: dont update pane if not current
This commit is contained in:
parent
c710ade94e
commit
b8a22eaa28
6 changed files with 23 additions and 9 deletions
|
|
@ -51,17 +51,25 @@ Item {
|
||||||
currentIndex: tabs.currentIndex
|
currentIndex: tabs.currentIndex
|
||||||
|
|
||||||
ClippingWrapperRectangle {
|
ClippingWrapperRectangle {
|
||||||
|
id: dash
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Dash {}
|
Dash {
|
||||||
|
shouldUpdate: visible && dash.ListView.isCurrentItem
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClippingWrapperRectangle {
|
ClippingWrapperRectangle {
|
||||||
|
id: media
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Media {}
|
Media {
|
||||||
|
shouldUpdate: visible && media.ListView.isCurrentItem
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClippingWrapperRectangle {
|
ClippingWrapperRectangle {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import QtQuick.Layouts
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property bool shouldUpdate
|
||||||
|
|
||||||
rowSpacing: Appearance.spacing.normal
|
rowSpacing: Appearance.spacing.normal
|
||||||
columnSpacing: Appearance.spacing.normal
|
columnSpacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
|
@ -72,6 +74,8 @@ GridLayout {
|
||||||
|
|
||||||
Media {
|
Media {
|
||||||
id: media
|
id: media
|
||||||
|
|
||||||
|
shouldUpdate: root.shouldUpdate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ import QtQuick.Effects
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property bool shouldUpdate
|
||||||
|
|
||||||
property real playerProgress: {
|
property real playerProgress: {
|
||||||
const active = Players.active;
|
const active = Players.active;
|
||||||
return active?.length ? active.position / active.length : 0;
|
return active?.length ? active.position / active.length : 0;
|
||||||
|
|
@ -39,7 +41,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
running: root.visible && (Players.active?.isPlaying ?? false)
|
running: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
interval: DashboardConfig.mediaUpdateInterval
|
interval: DashboardConfig.mediaUpdateInterval
|
||||||
triggeredOnStart: true
|
triggeredOnStart: true
|
||||||
repeat: true
|
repeat: true
|
||||||
|
|
@ -52,7 +54,7 @@ Item {
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
onRead: data => {
|
onRead: data => {
|
||||||
root.cava = data.slice(0, -1).split(";").map(v => parseInt(v, 10));
|
root.cava = data.slice(0, -1).split(";").map(v => parseInt(v, 10));
|
||||||
if (visualiser.visible)
|
if (root.shouldUpdate)
|
||||||
visualiser.requestPaint();
|
visualiser.requestPaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -535,7 +537,7 @@ Item {
|
||||||
anchors.left: details.right
|
anchors.left: details.right
|
||||||
anchors.leftMargin: Appearance.spacing.large
|
anchors.leftMargin: Appearance.spacing.large
|
||||||
|
|
||||||
playing: visible && (Players.active?.isPlaying ?? false)
|
playing: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
speed: BeatDetector.bpm / 300
|
speed: BeatDetector.bpm / 300
|
||||||
source: "root:/assets/bongocat.gif"
|
source: "root:/assets/bongocat.gif"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import QtQuick.Shapes
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property bool shouldUpdate
|
||||||
|
|
||||||
property real playerProgress: {
|
property real playerProgress: {
|
||||||
const active = Players.active;
|
const active = Players.active;
|
||||||
return active?.length ? active.position / active.length : 0;
|
return active?.length ? active.position / active.length : 0;
|
||||||
|
|
@ -28,7 +30,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
running: root.visible && (Players.active?.isPlaying ?? false)
|
running: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
interval: DashboardConfig.mediaUpdateInterval
|
interval: DashboardConfig.mediaUpdateInterval
|
||||||
triggeredOnStart: true
|
triggeredOnStart: true
|
||||||
repeat: true
|
repeat: true
|
||||||
|
|
@ -218,7 +220,7 @@ Item {
|
||||||
anchors.bottomMargin: Appearance.padding.large
|
anchors.bottomMargin: Appearance.padding.large
|
||||||
anchors.margins: Appearance.padding.large * 2
|
anchors.margins: Appearance.padding.large * 2
|
||||||
|
|
||||||
playing: visible && (Players.active?.isPlaying ?? false)
|
playing: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
speed: BeatDetector.bpm / 300
|
speed: BeatDetector.bpm / 300
|
||||||
source: "root:/assets/bongocat.gif"
|
source: "root:/assets/bongocat.gif"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import "root:/config"
|
||||||
import "root:/utils"
|
import "root:/utils"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Widgets
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import "root:/widgets"
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import "root:/utils"
|
import "root:/utils"
|
||||||
import Quickshell.Io
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue