Files
noctalia-shell/Modules/Panels/Settings/Bar/WidgetSettings/MicrophoneSettings.qml
T
Lysec 9f8bf988f0 fix(ntextinput): use onTextChanged for autosave, onEditingFinished instead of onAccepted
- Switch most settings from onEditingFinished to onTextChanged so
changes save on every keystroke
- Replace onAccepted with onEditingFinished (Enter + blur) for search,
pager, wifi, bluetooth
- Keep onEditingFinished for pager, wallhaven, path inputs, and
validation fields
2026-03-18 17:50:46 +01:00

91 lines
2.7 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qs.Commons
import qs.Widgets
ColumnLayout {
id: root
spacing: Style.marginM
// Properties to receive data from parent
property var screen: null
property var widgetData: null
property var widgetMetadata: null
signal settingsChanged(var settings)
// Local state
property string valueDisplayMode: widgetData.displayMode !== undefined ? widgetData.displayMode : widgetMetadata.displayMode
property string valueMiddleClickCommand: widgetData.middleClickCommand !== undefined ? widgetData.middleClickCommand : widgetMetadata.middleClickCommand
property string valueIconColor: widgetData.iconColor !== undefined ? widgetData.iconColor : widgetMetadata.iconColor
property string valueTextColor: widgetData.textColor !== undefined ? widgetData.textColor : widgetMetadata.textColor
function saveSettings() {
var settings = Object.assign({}, widgetData || {});
settings.displayMode = valueDisplayMode;
settings.middleClickCommand = valueMiddleClickCommand;
settings.iconColor = valueIconColor;
settings.textColor = valueTextColor;
settingsChanged(settings);
}
NComboBox {
label: I18n.tr("common.display-mode")
description: I18n.tr("bar.volume.display-mode-description")
minimumWidth: 200
model: [
{
"key": "onhover",
"name": I18n.tr("display-modes.on-hover")
},
{
"key": "alwaysShow",
"name": I18n.tr("display-modes.always-show")
},
{
"key": "alwaysHide",
"name": I18n.tr("display-modes.always-hide")
}
]
currentKey: valueDisplayMode
onSelected: key => {
valueDisplayMode = key;
saveSettings();
}
defaultValue: widgetMetadata.displayMode
}
NColorChoice {
label: I18n.tr("common.select-icon-color")
currentKey: valueIconColor
onSelected: key => {
valueIconColor = key;
saveSettings();
}
defaultValue: widgetMetadata.iconColor
}
NColorChoice {
currentKey: valueTextColor
onSelected: key => {
valueTextColor = key;
saveSettings();
}
defaultValue: widgetMetadata.textColor
}
// Middle click command
NTextInput {
label: I18n.tr("bar.custom-button.middle-click-label")
description: I18n.tr("panels.audio.on-middle-clicked-description")
placeholderText: I18n.tr("panels.audio.external-mixer-placeholder")
text: valueMiddleClickCommand
onTextChanged: {
valueMiddleClickCommand = text
saveSettings()
}
defaultValue: widgetMetadata.middleClickCommand
}
}