MediaPlayer: more robust display

This commit is contained in:
quadbyte 2025-08-15 09:53:28 -04:00
parent 474bade65c
commit f0ef9ac7b0
2 changed files with 10 additions and 7 deletions

View file

@ -58,7 +58,7 @@ NBox {
ColumnLayout {
id: main
visible: MediaPlayer.currentPlayer
visible: MediaPlayer.currentPlayer && MediaPlayer.canPlay
spacing: Style.marginMedium * scaling
// Player selector
@ -229,12 +229,14 @@ NBox {
// Progress bar
Rectangle {
id: progressBarBackground
visible: (MediaPlayer.currentPlayer && MediaPlayer.trackLength > 0)
width: parent.width
height: 4 * scaling
radius: Style.radiusSmall * scaling
color: Colors.mSurfaceVariant
color: Colors.mSurface
Layout.fillWidth: true
property real progressRatio: {
if (!MediaPlayer.currentPlayer || !MediaPlayer.isPlaying || MediaPlayer.trackLength <= 0) {
return 0
@ -259,17 +261,15 @@ NBox {
// Interactive progress handle
Rectangle {
id: progressHandle
visible: (MediaPlayer.currentPlayer && MediaPlayer.trackLength > 0)
width: 16 * scaling
height: 16 * scaling
radius: width * 0.5
color: Colors.mPrimary
border.color: Colors.mSurface
border.width: Math.max(1 * Style.borderMedium * scaling)
x: Math.max(0, Math.min(parent.width - width, progressFill.width - width / 2))
anchors.verticalCenter: parent.verticalCenter
visible: MediaPlayer.trackLength > 0
scale: progressMouseArea.containsMouse || progressMouseArea.pressed ? 1.2 : 1.0
Behavior on scale {