mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
NSettingsIndicator: add default setting indicator (#1080)
N*Widgets: show NSettingsIndicator if settings are not default
This commit is contained in:
@@ -19,6 +19,9 @@ RowLayout {
|
||||
property bool enabled: true
|
||||
property bool hovering: false
|
||||
property int baseSize: Style.baseWidgetSize
|
||||
property bool isSettings: false
|
||||
property var defaultValue: 0
|
||||
property string settingsPath: ""
|
||||
|
||||
// Convenience properties for common naming
|
||||
property alias minimum: root.from
|
||||
@@ -37,6 +40,11 @@ RowLayout {
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
readonly property bool isValueChanged: isSettings && (value !== defaultValue)
|
||||
readonly property string indicatorTooltip: isSettings ? I18n.tr("settings.indicator.default-value", {
|
||||
"value": String(defaultValue)
|
||||
}) : ""
|
||||
|
||||
Timer {
|
||||
id: repeatTimer
|
||||
repeat: true
|
||||
@@ -78,6 +86,8 @@ RowLayout {
|
||||
NLabel {
|
||||
label: root.label
|
||||
description: root.description
|
||||
showIndicator: root.isSettings && root.isValueChanged
|
||||
indicatorTooltip: root.indicatorTooltip
|
||||
}
|
||||
|
||||
// Main spinbox container
|
||||
@@ -405,4 +415,5 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user