From 8a171a47ff26306a9d8fba104191777c76619e79 Mon Sep 17 00:00:00 2001 From: Dimitris Kardarakos Date: Tue, 16 Feb 2021 20:19:23 +0200 Subject: [PATCH] Make article text configurable When reading a long article it is common to need to adjust the font size. Moreover, you may want this setting to apply only to this use case. So, a set of configuration options have been added to offer this functionality. --- src/alligatorsettings.kcfg | 8 ++++++++ src/qml/EntryPage.qml | 1 + src/qml/SettingsPage.qml | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/alligatorsettings.kcfg b/src/alligatorsettings.kcfg index 5d2dcb41..b8d4fa15 100644 --- a/src/alligatorsettings.kcfg +++ b/src/alligatorsettings.kcfg @@ -9,6 +9,14 @@ 2 + + + 10 + + + + true + 3 diff --git a/src/qml/EntryPage.qml b/src/qml/EntryPage.qml index 03489cb4..13a971f0 100644 --- a/src/qml/EntryPage.qml +++ b/src/qml/EntryPage.qml @@ -27,6 +27,7 @@ Kirigami.ScrollablePage { Layout.fillWidth: true onLinkActivated: Qt.openUrlExternally(link) onWidthChanged: text = entry.adjustedContent(width, font.pixelSize) + font.pointSize: _settings && !(_settings.articleFontUseSystem) ? _settings.articleFontSize : Kirigami.Units.fontMetrics.font.pointSize } actions.main: Kirigami.Action { diff --git a/src/qml/SettingsPage.qml b/src/qml/SettingsPage.qml index c7cd3c98..75e53fc6 100644 --- a/src/qml/SettingsPage.qml +++ b/src/qml/SettingsPage.qml @@ -27,11 +27,29 @@ Kirigami.ScrollablePage { currentIndex: settings.deleteAfterType model: [i18n("Never"), i18n("Posts"), i18n("Days"), i18n("Weeks"), i18n("Months")] } + + Controls.SpinBox { + id: articleFontSizeSpinBox + enabled: !useSystemFontCheckBox.checked + value: settings.articleFontSize + Kirigami.FormData.label: i18n("Font size:") + from: 6 + to: 20 + } + + Controls.CheckBox { + id: useSystemFontCheckBox + checked: settings.articleFontUseSystem + text: i18n("Use system default") + } + Controls.Button { text: i18n("Save") onClicked: { settings.deleteAfterCount = deleteAfterCount.text settings.deleteAfterType = deleteAfterType.currentIndex + settings.articleFontSize = articleFontSizeSpinBox.value + settings.articleFontUseSystem = useSystemFontCheckBox.checked settings.save() pageStack.pop() }