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
+4
View File
@@ -1075,6 +1075,10 @@
"label": "Maximale Breite",
"description": "Stellt die maximale Horizontalgröße des Widgets ein. Das Widget wird sich an kürzere Inhalte anpassen."
},
"use-fixed-width": {
"label": "Feste Breite verwenden",
"description": "Wenn aktiviert, verwendet das Widget immer die maximale Breite, anstatt sich dynamisch an den Inhalt anzupassen."
},
"scrolling-mode": {
"label": "Scrollmodus",
"description": "Steuern, wann Textscrolling für lange Track-Titel aktiviert ist."
+4
View File
@@ -1058,6 +1058,10 @@
"label": "Maximum Width",
"description": "Sets the maximum horizontal size of the widget. The widget will shrink to fit shorter content."
},
"use-fixed-width": {
"label": "Use Fixed Width",
"description": "When enabled, the widget will always use the maximum width instead of dynamically adjusting to content."
},
"scrolling-mode": {
"label": "Scrolling mode",
"description": "Control when text scrolling is enabled for long track titles."
+4
View File
@@ -1058,6 +1058,10 @@
"label": "Ancho Máximo",
"description": "Establece el tamaño horizontal máximo del widget. El widget se reducirá para adaptarse a contenido más corto."
},
"use-fixed-width": {
"label": "Usar Ancho Fijo",
"description": "Cuando está activado, el widget siempre usará el ancho máximo en lugar de ajustarse dinámicamente al contenido."
},
"scrolling-mode": {
"label": "Modo de desplazamiento",
"description": "Controlar cuándo está habilitado el desplazamiento de texto para títulos de pista largos."
+4
View File
@@ -1054,6 +1054,10 @@
"label": "Largeur Maximale",
"description": "Définit la taille horizontale maximale du widget. Le widget se rétrécira pour s'adapter à un contenu plus court."
},
"use-fixed-width": {
"label": "Utiliser une Largeur Fixe",
"description": "Lorsque activé, le widget utilisera toujours la largeur maximale au lieu de s'ajuster dynamiquement au contenu."
},
"scrolling-mode": {
"label": "Mode de défilement",
"description": "Contrôler quand le défilement de texte est activé pour les titres de piste longs."
+4
View File
@@ -1058,6 +1058,10 @@
"label": "Largura Máxima",
"description": "Define o tamanho horizontal máximo do widget. O widget será reduzido para se adequar a conteúdo mais curto."
},
"use-fixed-width": {
"label": "Usar Largura Fixa",
"description": "Quando ativado, o widget sempre usará a largura máxima em vez de ajustar dinamicamente ao conteúdo."
},
"scrolling-mode": {
"label": "Modo de rolagem",
"description": "Controlar quando a rolagem de texto está habilitada para títulos de faixa longos."
+4
View File
@@ -1058,6 +1058,10 @@
"label": "最大宽度",
"description": "设置小部件的最大水平尺寸。当内容较短时,小部件会自动收缩以适应内容。"
},
"use-fixed-width": {
"label": "使用固定宽度",
"description": "启用后,小部件将始终使用最大宽度,而不根据内容动态调整。"
},
"scrolling-mode": {
"label": "滚动模式",
"description": "控制何时为长曲目标题启用文本滚动。"
+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
}
@@ -20,6 +20,7 @@ ColumnLayout {
property string valueVisualizerType: widgetData.visualizerType || widgetMetadata.visualizerType
property string valueScrollingMode: widgetData.scrollingMode || widgetMetadata.scrollingMode
property int valueMaxWidth: widgetData.maxWidth !== undefined ? widgetData.maxWidth : widgetMetadata.maxWidth
property bool valueUseFixedWidth: widgetData.useFixedWidth !== undefined ? widgetData.useFixedWidth : widgetMetadata.useFixedWidth
Component.onCompleted: {
if (widgetData && widgetData.hideMode !== undefined) {
@@ -35,6 +36,7 @@ ColumnLayout {
settings.visualizerType = valueVisualizerType
settings.scrollingMode = valueScrollingMode
settings.maxWidth = parseInt(widthInput.text) || widgetMetadata.maxWidth
settings.useFixedWidth = valueUseFixedWidth
return settings
}
@@ -98,6 +100,13 @@ ColumnLayout {
text: valueMaxWidth
}
NToggle {
label: I18n.tr("bar.widget-settings.media-mini.use-fixed-width.label")
description: I18n.tr("bar.widget-settings.media-mini.use-fixed-width.description")
checked: valueUseFixedWidth
onToggled: checked => valueUseFixedWidth = checked
}
NComboBox {
label: I18n.tr("bar.widget-settings.media-mini.scrolling-mode.label")
description: I18n.tr("bar.widget-settings.media-mini.scrolling-mode.description")
+1
View File
@@ -89,6 +89,7 @@ Singleton {
"scrollingMode"// "visible", "hidden", "transparent"
: "hover",
"maxWidth": 145,
"useFixedWidth": false,
"showAlbumArt": false,
"showVisualizer": false,
"visualizerType": "linear"