C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
93 lines
2.3 KiB
QML
93 lines
2.3 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import ZShell.Config
|
|
import qs.Components
|
|
import qs.Modules.Bar.Components.Common
|
|
import qs.Helpers
|
|
import qs.Services
|
|
|
|
WidgetBase {
|
|
id: root
|
|
|
|
readonly property string currentMedia: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
|
|
readonly property int textWidth: Math.min(metrics.width, 200)
|
|
|
|
implicitHeight: horizontal ? baseSize : layout.implicitHeight + Tokens.padding.small * 2
|
|
implicitWidth: horizontal ? layout.implicitWidth + Tokens.padding.small * 2 : baseSize
|
|
radius: Tokens.rounding.full
|
|
|
|
Behavior on implicitHeight {
|
|
enabled: !root.horizontal
|
|
|
|
Anim {
|
|
}
|
|
}
|
|
Behavior on implicitWidth {
|
|
enabled: root.horizontal
|
|
|
|
Anim {
|
|
}
|
|
}
|
|
|
|
TextMetrics {
|
|
id: metrics
|
|
|
|
font: mediatext.font
|
|
text: mediatext.text
|
|
}
|
|
|
|
GridLayout {
|
|
id: layout
|
|
|
|
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.small
|
|
anchors.fill: parent
|
|
anchors.leftMargin: root.horizontal ? Tokens.padding.small : 0
|
|
anchors.rightMargin: root.horizontal ? Tokens.padding.small : 0
|
|
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.small
|
|
columns: root.horizontal ? -1 : 1
|
|
|
|
Behavior on implicitWidth {
|
|
Anim {
|
|
}
|
|
}
|
|
|
|
MaterialIcon {
|
|
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
|
animate: true
|
|
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
|
font.pointSize: Tokens.font.size.larger
|
|
text: Players.active?.isPlaying ? "music_note" : "music_off"
|
|
}
|
|
|
|
MarqueeText {
|
|
id: mediatext
|
|
|
|
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
|
animate: true
|
|
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
|
font.pointSize: Tokens.font.size.normal
|
|
horizontalAlignment: Text.AlignHCenter
|
|
implicitHeight: root.horizontal ? root.implicitHeight : root.textWidth
|
|
implicitWidth: root.horizontal ? root.textWidth : root.implicitWidth
|
|
marqueeEnabled: false
|
|
pauseMs: 4000
|
|
text: root.currentMedia
|
|
vertical: !root.horizontal
|
|
}
|
|
}
|
|
|
|
CustomMouseArea {
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
|
|
onContainsMouseChanged: {
|
|
if (!containsMouse) {
|
|
mediatext.marqueeEnabled = false;
|
|
} else {
|
|
mediatext.marqueeEnabled = true;
|
|
mediatext.anim.start();
|
|
}
|
|
}
|
|
}
|
|
}
|