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.
This commit is contained in:
Dimitris Kardarakos 2021-02-16 20:19:23 +02:00
parent c24eef7fe5
commit 8a171a47ff
3 changed files with 27 additions and 0 deletions

View File

@ -9,6 +9,14 @@
<label>Delete after count</label> <label>Delete after count</label>
<default>2</default> <default>2</default>
</entry> </entry>
<entry name="articleFontSize" type="Int">
<label>Article font size</label>
<default>10</default>
</entry>
<entry name="articleFontUseSystem" type="Bool">
<label>Use default system font</label>
<default>true</default>
</entry>
<entry name="deleteAfterType" type="Int"> <entry name="deleteAfterType" type="Int">
<label>Delete after type</label> <label>Delete after type</label>
<default>3</default> <default>3</default>

View File

@ -27,6 +27,7 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true Layout.fillWidth: true
onLinkActivated: Qt.openUrlExternally(link) onLinkActivated: Qt.openUrlExternally(link)
onWidthChanged: text = entry.adjustedContent(width, font.pixelSize) onWidthChanged: text = entry.adjustedContent(width, font.pixelSize)
font.pointSize: _settings && !(_settings.articleFontUseSystem) ? _settings.articleFontSize : Kirigami.Units.fontMetrics.font.pointSize
} }
actions.main: Kirigami.Action { actions.main: Kirigami.Action {

View File

@ -27,11 +27,29 @@ Kirigami.ScrollablePage {
currentIndex: settings.deleteAfterType currentIndex: settings.deleteAfterType
model: [i18n("Never"), i18n("Posts"), i18n("Days"), i18n("Weeks"), i18n("Months")] 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 { Controls.Button {
text: i18n("Save") text: i18n("Save")
onClicked: { onClicked: {
settings.deleteAfterCount = deleteAfterCount.text settings.deleteAfterCount = deleteAfterCount.text
settings.deleteAfterType = deleteAfterType.currentIndex settings.deleteAfterType = deleteAfterType.currentIndex
settings.articleFontSize = articleFontSizeSpinBox.value
settings.articleFontUseSystem = useSystemFontCheckBox.checked
settings.save() settings.save()
pageStack.pop() pageStack.pop()
} }