mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-09 06:55:37 -05:00
Update media loading transitions
This commit is contained in:
@@ -8,10 +8,31 @@ Rectangle {
|
|||||||
property var activePlayer: null
|
property var activePlayer: null
|
||||||
property bool hasActiveMedia: false
|
property bool hasActiveMedia: false
|
||||||
|
|
||||||
|
// Add a stable visibility property that doesn't flicker during track changes
|
||||||
|
property bool stableVisible: false
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
visible: hasActiveMedia
|
// Use a timer to stabilize visibility during track changes
|
||||||
width: hasActiveMedia ? Math.min(280, mediaRow.implicitWidth + Theme.spacingS * 2) : 0
|
Timer {
|
||||||
|
id: visibilityTimer
|
||||||
|
interval: 1000 // 1 second delay before hiding
|
||||||
|
onTriggered: root.stableVisible = root.hasActiveMedia
|
||||||
|
}
|
||||||
|
|
||||||
|
onHasActiveMediaChanged: {
|
||||||
|
if (hasActiveMedia) {
|
||||||
|
// Show immediately when media becomes available
|
||||||
|
stableVisible = true
|
||||||
|
visibilityTimer.stop()
|
||||||
|
} else {
|
||||||
|
// Delay hiding to avoid flicker during track changes
|
||||||
|
visibilityTimer.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
visible: stableVisible
|
||||||
|
width: stableVisible ? Math.min(280, mediaRow.implicitWidth + Theme.spacingS * 2) : 0
|
||||||
height: 30
|
height: 30
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08)
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08)
|
||||||
@@ -54,7 +75,10 @@ Rectangle {
|
|||||||
width: 140
|
width: 140
|
||||||
|
|
||||||
text: {
|
text: {
|
||||||
if (!activePlayer) return "Unknown Track"
|
// Handle the case when activePlayer is temporarily null during track changes
|
||||||
|
if (!activePlayer || !activePlayer.trackTitle) {
|
||||||
|
return "Loading..."
|
||||||
|
}
|
||||||
|
|
||||||
// Check if it's web media by looking at player identity
|
// Check if it's web media by looking at player identity
|
||||||
let identity = activePlayer.identity || ""
|
let identity = activePlayer.identity || ""
|
||||||
@@ -108,7 +132,8 @@ Rectangle {
|
|||||||
radius: 10
|
radius: 10
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: prevArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
color: prevArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
visible: activePlayer && activePlayer.canGoPrevious
|
visible: stableVisible
|
||||||
|
opacity: (activePlayer && activePlayer.canGoPrevious) ? 1.0 : 0.3
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -136,6 +161,8 @@ Rectangle {
|
|||||||
radius: 12
|
radius: 12
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: activePlayer?.playbackState === 1 ? Theme.primary : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
|
color: activePlayer?.playbackState === 1 ? Theme.primary : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
|
||||||
|
visible: stableVisible
|
||||||
|
opacity: activePlayer ? 1.0 : 0.3
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -162,7 +189,8 @@ Rectangle {
|
|||||||
radius: 10
|
radius: 10
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: nextArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
color: nextArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||||
visible: activePlayer && activePlayer.canGoNext
|
visible: stableVisible
|
||||||
|
opacity: (activePlayer && activePlayer.canGoNext) ? 1.0 : 0.3
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|||||||
Reference in New Issue
Block a user