Bar-AudioVisualizer: Added setting to select one the scheme's color.

This commit is contained in:
ItsLemmy
2025-10-31 22:00:19 -04:00
parent 998dbc540f
commit e29b4bf433
9 changed files with 118 additions and 9 deletions
+11
View File
@@ -1272,6 +1272,10 @@
"hide-when-idle": {
"label": "Ausblenden, wenn keine Medien wiedergegeben werden",
"description": "Wenn aktiviert, wird der Visualizer ausgeblendet, sofern keine Wiedergabe läuft."
},
"color-name": {
"description": "Wähle die Farbe für den Visualisierer aus.",
"label": "Füllfarbe"
}
},
"lock-keys": {
@@ -1572,6 +1576,13 @@
"hidden": "Ausblenden, wenn leer",
"transparent": "Transparent, wenn leer",
"visible": "Immer sichtbar"
},
"colors": {
"error": "Fehler",
"primary": "Primär",
"secondary": "Sekundär",
"tertiary": "Tertiär",
"onSurface": "An der Oberfläche"
}
},
"session-menu": {
+11
View File
@@ -1252,6 +1252,10 @@
"label": "Width",
"description": "Custom component width."
},
"color-name": {
"label": "Fill Color",
"description": "Select the color for the visualizer."
},
"hide-when-idle": {
"label": "Hide when no media is playing",
"description": "When enabled, the visualizer is hidden unless a player is actively playing."
@@ -1449,6 +1453,13 @@
"test": "Test"
},
"options": {
"colors": {
"primary": "Primary",
"secondary": "Secondary",
"tertiary": "Tertiary",
"error": "Error",
"onSurface": "On Surface"
},
"bar": {
"position": {
"top": "Top",
+11
View File
@@ -1255,6 +1255,10 @@
"hide-when-idle": {
"label": "Ocultar cuando no se reproduce",
"description": "Si está activado, el visualizador se oculta salvo que haya reproducción activa."
},
"color-name": {
"description": "Selecciona el color para el visualizador.",
"label": "Color de relleno"
}
},
"lock-keys": {
@@ -1555,6 +1559,13 @@
"hidden": "Ocultar cuando esté vacío",
"transparent": "Transparente cuando está vacío",
"visible": "Siempre visible"
},
"colors": {
"error": "Error",
"primary": "Primario",
"secondary": "Secundario",
"tertiary": "Terciario",
"onSurface": "En la superficie"
}
},
"session-menu": {
+11
View File
@@ -1255,6 +1255,10 @@
"hide-when-idle": {
"label": "Masquer lorsqu'aucun média n'est en lecture",
"description": "Si activé, le visualiseur est masqué sauf lorsqu'un lecteur est en lecture."
},
"color-name": {
"description": "Sélectionnez la couleur du visualiseur.",
"label": "Couleur de remplissage"
}
},
"lock-keys": {
@@ -1555,6 +1559,13 @@
"hidden": "Masquer si vide",
"transparent": "Transparent quand vide",
"visible": "Toujours visible"
},
"colors": {
"error": "Erreur",
"primary": "Primaire",
"secondary": "Secondaire",
"tertiary": "Tertiaire",
"onSurface": "En surface"
}
},
"session-menu": {
+11
View File
@@ -1255,6 +1255,10 @@
"hide-when-idle": {
"label": "Ocultar quando não houver reprodução",
"description": "Quando ativado, o visualizador fica oculto a menos que haja reprodução ativa."
},
"color-name": {
"description": "Selecione a cor para o visualizador.",
"label": "Cor de preenchimento"
}
},
"lock-keys": {
@@ -1555,6 +1559,13 @@
"hidden": "Ocultar Quando Vazio",
"transparent": "Transparente quando vazio",
"visible": "Sempre Visível"
},
"colors": {
"error": "Erro",
"primary": "Primário",
"secondary": "Secundário",
"tertiary": "Terciário",
"onSurface": "Na Superfície"
}
},
"session-menu": {
+11
View File
@@ -1255,6 +1255,10 @@
"hide-when-idle": {
"label": "无媒体播放时隐藏",
"description": "启用后,除非正在播放媒体,否则隐藏可视化显示。"
},
"color-name": {
"description": "选择可视化工具的颜色。",
"label": "填充颜色"
}
},
"lock-keys": {
@@ -1555,6 +1559,13 @@
"hidden": "当为空时隐藏",
"transparent": "空时透明",
"visible": "始终可见"
},
"colors": {
"error": "错误",
"primary": "主要的",
"secondary": "次要的",
"tertiary": "第三纪",
"onSurface": "表面之上"
}
},
"session-menu": {
+22 -4
View File
@@ -29,7 +29,25 @@ Item {
// Resolve settings: try user settings or defaults from BarWidgetRegistry
readonly property int visualizerWidth: widgetSettings.width !== undefined ? widgetSettings.width : widgetMetadata.width
readonly property bool hideWhenIdle: widgetSettings.hideWhenIdle !== undefined ? widgetSettings.hideWhenIdle : (widgetMetadata.hideWhenIdle !== undefined ? widgetMetadata.hideWhenIdle : false)
readonly property bool hideWhenIdle: widgetSettings.hideWhenIdle !== undefined ? widgetSettings.hideWhenIdle : widgetMetadata.hideWhenIdle
readonly property string colorName: widgetSettings.colorName !== undefined ? widgetSettings.colorName : widgetMetadata.colorName
readonly property color fillColor: {
switch (colorName) {
case "primary":
return Color.mPrimary
case "secondary":
return Color.mSecondary
case "tertiary":
return Color.mTertiary
case "error":
return Color.mError
case "onSurface":
default:
return Color.mOnSurface
}
}
readonly property bool shouldShow: (currentVisualizerType !== "" && currentVisualizerType !== "none") && (!hideWhenIdle || MediaService.isPlaying)
implicitWidth: shouldShow ? visualizerWidth : 0
@@ -108,8 +126,8 @@ Item {
LinearSpectrum {
anchors.fill: parent
values: CavaService.values
fillColor: root.fillColor
showMinimumSignal: true
fillColor: Color.mPrimary
}
}
@@ -118,8 +136,8 @@ Item {
MirroredSpectrum {
anchors.fill: parent
values: CavaService.values
fillColor: root.fillColor
showMinimumSignal: true
fillColor: Color.mPrimary
}
}
@@ -128,8 +146,8 @@ Item {
WaveSpectrum {
anchors.fill: parent
values: CavaService.values
fillColor: root.fillColor
showMinimumSignal: true
fillColor: Color.mPrimary
}
}
}
@@ -14,12 +14,14 @@ ColumnLayout {
property var widgetMetadata: null
// Local state
property bool valueHideWhenIdle: widgetData.hideWhenIdle !== undefined ? widgetData.hideWhenIdle : (widgetMetadata.hideWhenIdle !== undefined ? widgetMetadata.hideWhenIdle : false)
property bool valueHideWhenIdle: widgetData.hideWhenIdle !== undefined ? widgetData.hideWhenIdle : widgetMetadata.hideWhenIdle
property string valueColorName: widgetData.colorName !== undefined ? widgetData.colorName : widgetMetadata.colorName
function saveSettings() {
var settings = Object.assign({}, widgetData || {})
settings.width = parseInt(widthInput.text) || widgetMetadata.width
settings.hideWhenIdle = valueHideWhenIdle
settings.colorName = valueColorName
return settings
}
@@ -32,6 +34,30 @@ ColumnLayout {
placeholderText: I18n.tr("placeholders.enter-width-pixels")
}
NComboBox {
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.audio-visualizer.color-name.label")
description: I18n.tr("bar.widget-settings.audio-visualizer.color-name.description")
model: [{
"key": "primary",
"name": I18n.tr("options.colors.primary")
}, {
"key": "secondary",
"name": I18n.tr("options.colors.secondary")
}, {
"key": "tertiary",
"name": I18n.tr("options.colors.tertiary")
}, {
"key": "onSurface",
"name": I18n.tr("options.colors.onSurface")
}, {
"key": "error",
"name": I18n.tr("options.colors.error")
}]
currentKey: root.valueColorName
onSelected: key => root.valueColorName = key
}
NToggle {
label: I18n.tr("bar.widget-settings.audio-visualizer.hide-when-idle.label")
description: I18n.tr("bar.widget-settings.audio-visualizer.hide-when-idle.description")
+3 -4
View File
@@ -45,8 +45,7 @@ Singleton {
"allowUserSettings": true,
"showIcon": true,
"hideMode": "hidden",
"scrollingMode"// "visible", "hidden", "transparent"
: "hover",
"scrollingMode": "hover",
"maxWidth": 145,
"useFixedWidth": false,
"colorizeIcons": false
@@ -54,6 +53,7 @@ Singleton {
"AudioVisualizer": {
"allowUserSettings": true,
"width": 200,
"colorName": "primary",
"hideWhenIdle": false
},
"Battery": {
@@ -109,8 +109,7 @@ Singleton {
"MediaMini": {
"allowUserSettings": true,
"hideMode": "hidden",
"scrollingMode"// "visible", "hidden", "transparent"
: "hover",
"scrollingMode": "hover",
"maxWidth": 145,
"useFixedWidth": false,
"showAlbumArt": false,