Bar: MediaMini player (Play/Pause + title)

This commit is contained in:
quadbyte 2025-08-15 12:14:16 -04:00
parent 33bec01e98
commit 5bf6659ba7
3 changed files with 39 additions and 7 deletions

View file

@ -52,13 +52,9 @@ Variants {
anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginSmall * scaling
// Debug show monitor name
// NText {
// text: screen.name
// anchors.verticalCenter: parent.verticalCenter
// font.weight: Style.fontWeightBold
// }
SystemMonitor {}
MediaMini {}
}
// Center

36
Modules/Bar/MediaMini.qml Normal file
View file

@ -0,0 +1,36 @@
import QtQuick
import QtQuick.Layouts
import qs.Services
import qs.Widgets
Item {
id: root
width: visible ? mediaRow.width : 0
height: Style.barHeight * scaling
visible: Settings.data.bar.showMedia && (MediaPlayer.canPlay || MediaPlayer.canPause)
RowLayout {
id: mediaRow
height: parent.height
spacing: Style.spacingTiniest * scaling
NIconButton {
icon: MediaPlayer.isPlaying ? "pause" : "play_arrow"
tooltipText: "Play/pause media"
sizeMultiplier: 0.8
showBorder: false
onClicked: MediaPlayer.playPause()
}
// Track info
NText {
text: MediaPlayer.trackTitle + " - " + MediaPlayer.trackArtist
color: Colors.mOnSurface
font.pointSize: Style.fontSizeSmall * scaling
elide: Text.ElideRight
Layout.maximumWidth: 200 * scaling
Layout.alignment: Qt.AlignVCenter
}
}
}

View file

@ -172,7 +172,7 @@ NBox {
anchors.fill: parent
anchors.margins: Style.marginTiny * scaling
imagePath: MediaPlayer.trackArtUrl
fallbackIcon: "image"
fallbackIcon: "music_note"
borderColor: Colors.mOutline
borderWidth: Math.max(1, Style.borderThin * scaling)
imageRadius: width * 0.5