From d2e5d0664a5ac1d32f788f853c415788ebfe5524 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Mon, 29 Sep 2025 21:42:47 -0400 Subject: [PATCH] Font: added reset button for scaling --- Assets/Translations/en.json | 1 + Modules/Settings/Tabs/DisplayTab.qml | 4 +- Modules/Settings/Tabs/GeneralTab.qml | 68 ++++++++++++++++++++++------ Widgets/NValueSlider.qml | 2 +- 4 files changed, 58 insertions(+), 17 deletions(-) diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 1ded8fcf..a9d7b1c7 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -56,6 +56,7 @@ } }, "fonts": { + "reset-scaling": "Reset scaling", "section": { "label": "Fonts", "description": "Choose the fonts used throughout the interface." diff --git a/Modules/Settings/Tabs/DisplayTab.qml b/Modules/Settings/Tabs/DisplayTab.qml index d2f50dd2..6eb9dca2 100644 --- a/Modules/Settings/Tabs/DisplayTab.qml +++ b/Modules/Settings/Tabs/DisplayTab.qml @@ -126,7 +126,7 @@ ColumnLayout { // Reset button container Item { - Layout.preferredWidth: 40 * scaling + Layout.preferredWidth: 30 * scaling Layout.preferredHeight: 30 * scaling NIconButton { @@ -168,7 +168,7 @@ ColumnLayout { // Empty container to match scale row layout Item { - Layout.preferredWidth: 40 * scaling + Layout.preferredWidth: 30 * scaling Layout.preferredHeight: 30 * scaling // Method text positioned in the button area diff --git a/Modules/Settings/Tabs/GeneralTab.qml b/Modules/Settings/Tabs/GeneralTab.qml index 45be5b9c..405a5cd9 100644 --- a/Modules/Settings/Tabs/GeneralTab.qml +++ b/Modules/Settings/Tabs/GeneralTab.qml @@ -243,14 +243,34 @@ ColumnLayout { description: I18n.tr("settings.general.fonts.default.scale.description") } - NValueSlider { + RowLayout { + spacing: Style.marginL * scaling Layout.fillWidth: true - from: 0.75 - to: 1.25 - stepSize: 0.01 - value: Settings.data.ui.fontDefaultScale - onMoved: value => Settings.data.ui.fontDefaultScale = value - text: Math.floor(Settings.data.ui.fontDefaultScale * 100) + "%" + + NValueSlider { + Layout.fillWidth: true + from: 0.75 + to: 1.25 + stepSize: 0.01 + value: Settings.data.ui.fontDefaultScale + onMoved: value => Settings.data.ui.fontDefaultScale = value + text: Math.floor(Settings.data.ui.fontDefaultScale * 100) + "%" + } + + // Reset button container + Item { + Layout.preferredWidth: 30 * scaling + Layout.preferredHeight: 30 * scaling + + NIconButton { + icon: "refresh" + baseSize: Style.baseWidgetSize * 0.9 + tooltipText: I18n.tr("settings.general.fonts.reset-scaling") + onClicked: Settings.data.ui.fontDefaultScale = 1.0 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + } + } } } @@ -260,14 +280,34 @@ ColumnLayout { description: I18n.tr("settings.general.fonts.monospace.scale.description") } - NValueSlider { + RowLayout { + spacing: Style.marginL * scaling Layout.fillWidth: true - from: 0.75 - to: 1.25 - stepSize: 0.01 - value: Settings.data.ui.fontFixedScale - onMoved: value => Settings.data.ui.fontFixedScale = value - text: Math.floor(Settings.data.ui.fontFixedScale * 100) + "%" + + NValueSlider { + Layout.fillWidth: true + from: 0.75 + to: 1.25 + stepSize: 0.01 + value: Settings.data.ui.fontFixedScale + onMoved: value => Settings.data.ui.fontFixedScale = value + text: Math.floor(Settings.data.ui.fontFixedScale * 100) + "%" + } + + // Reset button container + Item { + Layout.preferredWidth: 30 * scaling + Layout.preferredHeight: 30 * scaling + + NIconButton { + icon: "refresh" + baseSize: Style.baseWidgetSize * 0.9 + tooltipText: I18n.tr("settings.general.fonts.reset-scaling") + onClicked: Settings.data.ui.fontFixedScale = 1.0 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + } + } } } } diff --git a/Widgets/NValueSlider.qml b/Widgets/NValueSlider.qml index 67f6089f..32d8ed76 100644 --- a/Widgets/NValueSlider.qml +++ b/Widgets/NValueSlider.qml @@ -42,7 +42,7 @@ RowLayout { text: root.text family: Settings.data.ui.fontFixed Layout.alignment: Qt.AlignVCenter - Layout.preferredWidth: 50 * scaling + Layout.preferredWidth: 45 * scaling horizontalAlignment: Text.AlignRight } }