Settings: removed isSettings everywhere as we can simply check if defaultValue is provided.

This commit is contained in:
Lemmy
2026-01-05 18:41:22 -05:00
parent 0f8219cfb2
commit ffa8cc58a1
37 changed files with 30 additions and 175 deletions
+6 -7
View File
@@ -13,8 +13,7 @@ RowLayout {
property bool checked: false
property bool hovering: false
property int baseSize: Math.round(Style.baseWidgetSize * 0.8 * Style.uiScaleRatio)
property bool isSettings: false
property var defaultValue: false
property var defaultValue: undefined
property string settingsPath: ""
signal toggled(bool checked)
@@ -26,16 +25,16 @@ RowLayout {
opacity: enabled ? 1.0 : 0.6
spacing: Style.marginM
readonly property bool isValueChanged: isSettings && (checked !== defaultValue)
readonly property string indicatorTooltip: isSettings ? I18n.tr("settings.indicator.default-value", {
"value": typeof defaultValue === "boolean" ? (defaultValue ? "true" : "false") : String(defaultValue)
}) : ""
readonly property bool isValueChanged: (defaultValue !== undefined) && (checked !== defaultValue)
readonly property string indicatorTooltip: defaultValue !== undefined ? I18n.tr("settings.indicator.default-value", {
"value": typeof defaultValue === "boolean" ? (defaultValue ? "true" : "false") : String(defaultValue)
}) : ""
NLabel {
label: root.label
description: root.description
visible: root.label !== "" || root.description !== ""
showIndicator: root.isSettings && root.isValueChanged
showIndicator: root.isValueChanged
indicatorTooltip: root.indicatorTooltip
}