MediaMini: add fixed width option

This commit is contained in:
Sakari
2025-10-17 15:28:32 +08:00
parent 8e5e003f8a
commit 19bfeb2a40
9 changed files with 40 additions and 0 deletions
+6
View File
@@ -40,6 +40,7 @@ Item {
// Maximum widget width with user settings support
readonly property real maxWidth: (widgetSettings.maxWidth !== undefined) ? widgetSettings.maxWidth : Math.max(widgetMetadata.maxWidth, screen.width * 0.06)
readonly property bool useFixedWidth: (widgetSettings.useFixedWidth !== undefined) ? widgetSettings.useFixedWidth : widgetMetadata.useFixedWidth
readonly property bool hasActivePlayer: MediaService.currentPlayer !== null
readonly property string placeholderText: I18n.tr("bar.widget-settings.media-mini.no-active-player")
@@ -111,6 +112,11 @@ Item {
// Dynamic width: adapt to content but respect maximum width setting
readonly property real dynamicWidth: {
// If using fixed width mode, always use maxWidth
if (useFixedWidth) {
return maxWidth
}
// Otherwise, adapt to content
if (!hasActivePlayer) {
return maxWidth
}