dashboard: media player selector elide text
This commit is contained in:
parent
a7e88854bb
commit
c710ade94e
1 changed files with 27 additions and 3 deletions
|
|
@ -419,6 +419,8 @@ Item {
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
|
id: playerIcon
|
||||||
|
|
||||||
source: Icons.getAppIcon(player.modelData.identity, "image-missing")
|
source: Icons.getAppIcon(player.modelData.identity, "image-missing")
|
||||||
implicitSize: Math.round(identity.implicitHeight * 0.9)
|
implicitSize: Math.round(identity.implicitHeight * 0.9)
|
||||||
}
|
}
|
||||||
|
|
@ -426,9 +428,19 @@ Item {
|
||||||
StyledText {
|
StyledText {
|
||||||
id: identity
|
id: identity
|
||||||
|
|
||||||
text: player.modelData.identity
|
text: identityMetrics.elidedText
|
||||||
color: Colours.palette.m3onSecondaryContainer
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: identityMetrics
|
||||||
|
|
||||||
|
text: player.modelData.identity
|
||||||
|
font.family: identity.font.family
|
||||||
|
font.pointSize: identity.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: playerSelector.implicitWidth - playerIcon.implicitWidth - player.spacing - Appearance.padding.smaller * 2
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -464,7 +476,9 @@ Item {
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
source: Icons.getAppIcon(Players.active?.identity ?? "", "applications-multimedia")
|
id: currentIcon
|
||||||
|
|
||||||
|
source: Icons.getAppIcon(Players.active?.identity ?? "", "multimedia-player")
|
||||||
implicitSize: Math.round(currentIdentity.implicitHeight * 0.9)
|
implicitSize: Math.round(currentIdentity.implicitHeight * 0.9)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -472,8 +486,18 @@ Item {
|
||||||
id: currentIdentity
|
id: currentIdentity
|
||||||
|
|
||||||
animate: true
|
animate: true
|
||||||
text: Players.active?.identity ?? "No media"
|
text: currentIdentityMetrics.elidedText
|
||||||
color: Colours.palette.m3onSecondaryContainer
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: currentIdentityMetrics
|
||||||
|
|
||||||
|
text: Players.active?.identity ?? "No players"
|
||||||
|
font.family: currentIdentity.font.family
|
||||||
|
font.pointSize: currentIdentity.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: playerSelector.implicitWidth - currentIcon.implicitWidth - currentPlayer.spacing - Appearance.padding.smaller * 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue