mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Bar-AudioVisualizer: Added setting to select one the scheme's color.
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user