parent
4a49b9f0d6
commit
bd28ebf5a0
4 changed files with 56 additions and 21 deletions
|
|
@ -374,10 +374,11 @@ Item {
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|
||||||
implicitWidth: slider.implicitWidth / 2
|
implicitWidth: slider.implicitWidth * 0.6
|
||||||
implicitHeight: currentPlayer.implicitHeight + Appearance.padding.small * 2
|
implicitHeight: currentPlayer.implicitHeight + Appearance.padding.smaller * 2
|
||||||
radius: Appearance.rounding.small
|
radius: Appearance.rounding.normal
|
||||||
color: Colours.palette.m3surfaceContainer
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
z: 1
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
disabled: Players.list.length <= 1
|
disabled: Players.list.length <= 1
|
||||||
|
|
@ -393,14 +394,13 @@ Item {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
IconImage {
|
PlayerIcon {
|
||||||
Layout.fillHeight: true
|
identity: Players.active?.identity ?? ""
|
||||||
implicitWidth: height
|
|
||||||
source: Players.active ? Icons.getAppIcon(Players.active.identity, "image-missing") : "image-missing"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.maximumWidth: playerSelector.implicitWidth - implicitHeight - parent.spacing - Appearance.padding.normal * 2
|
||||||
text: Players.active?.identity ?? "No players"
|
text: Players.active?.identity ?? "No players"
|
||||||
color: Colours.palette.m3onSecondaryContainer
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
@ -425,20 +425,19 @@ Item {
|
||||||
StyledClippingRect {
|
StyledClippingRect {
|
||||||
id: playerSelectorBg
|
id: playerSelectorBg
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
implicitWidth: playerSelector.expanded ? playerList.implicitWidth : playerSelector.implicitWidth
|
||||||
implicitHeight: playerSelector.expanded ? playerList.implicitHeight : playerSelector.implicitHeight
|
implicitHeight: playerSelector.expanded ? playerList.implicitHeight : playerSelector.implicitHeight
|
||||||
|
|
||||||
color: Colours.palette.m3secondaryContainer
|
color: Colours.palette.m3secondaryContainer
|
||||||
radius: Appearance.rounding.small
|
radius: Appearance.rounding.normal
|
||||||
opacity: playerSelector.expanded ? 1 : 0
|
opacity: playerSelector.expanded ? 1 : 0
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: playerList
|
id: playerList
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
@ -452,7 +451,8 @@ Item {
|
||||||
required property MprisPlayer modelData
|
required property MprisPlayer modelData
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: playerInner.implicitHeight + Appearance.padding.small * 2
|
implicitWidth: playerInner.implicitWidth + Appearance.padding.normal * 2
|
||||||
|
implicitHeight: playerInner.implicitHeight + Appearance.padding.smaller * 2
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
disabled: !playerSelector.expanded
|
disabled: !playerSelector.expanded
|
||||||
|
|
@ -469,17 +469,13 @@ Item {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
IconImage {
|
PlayerIcon {
|
||||||
Layout.fillHeight: true
|
identity: player.modelData.identity
|
||||||
implicitWidth: height
|
|
||||||
source: Icons.getAppIcon(player.modelData.identity, "image-missing")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.fillWidth: true
|
|
||||||
text: player.modelData.identity
|
text: player.modelData.identity
|
||||||
color: Colours.palette.m3onSecondaryContainer
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -492,6 +488,13 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
Anim {
|
||||||
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
|
@ -540,6 +543,34 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component PlayerIcon: Loader {
|
||||||
|
id: loader
|
||||||
|
|
||||||
|
required property string identity
|
||||||
|
readonly property string icon: Icons.getAppIcon(identity)
|
||||||
|
|
||||||
|
Layout.fillHeight: true
|
||||||
|
asynchronous: true
|
||||||
|
sourceComponent: icon === "image://icon/" ? fallbackIcon : playerImage
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: playerImage
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
implicitWidth: height
|
||||||
|
source: loader.icon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: fallbackIcon
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
text: loader.identity ? "animated_images" : "music_off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
component ElideText: StyledText {
|
component ElideText: StyledText {
|
||||||
id: elideText
|
id: elideText
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ ColumnLayout {
|
||||||
implicitHeight: adapterInner.implicitHeight + Appearance.padding.normal * 2
|
implicitHeight: adapterInner.implicitHeight + Appearance.padding.normal * 2
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
enabled: adapterPickerButton.expanded
|
disabled: !adapterPickerButton.expanded
|
||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
adapterPickerButton.expanded = false;
|
adapterPickerButton.expanded = false;
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,10 @@ Singleton {
|
||||||
property string osName
|
property string osName
|
||||||
|
|
||||||
function getAppIcon(name: string, fallback: string): string {
|
function getAppIcon(name: string, fallback: string): string {
|
||||||
return Quickshell.iconPath(DesktopEntries.heuristicLookup(name)?.icon, fallback);
|
const icon = DesktopEntries.heuristicLookup(name)?.icon;
|
||||||
|
if (fallback !== "undefined")
|
||||||
|
return Quickshell.iconPath(icon, fallback);
|
||||||
|
return Quickshell.iconPath(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAppCategoryIcon(name: string, fallback: string): string {
|
function getAppCategoryIcon(name: string, fallback: string): string {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ MouseArea {
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
enabled: !disabled
|
||||||
cursorShape: disabled ? undefined : Qt.PointingHandCursor
|
cursorShape: disabled ? undefined : Qt.PointingHandCursor
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue