Warning, /network/tokodon/src/content/ui/Settings/AppearancePage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 import QtQml
0005 import QtQuick
0006 import QtQuick.Controls 2 as QQC2
0007 import QtQuick.Dialogs
0008 import QtQuick.Layouts
0009 
0010 import org.kde.kirigamiaddons.formcard 1 as FormCard
0011 
0012 import org.kde.tokodon
0013 import org.kde.tokodon.private
0014 
0015 FormCard.FormCardPage {
0016     FormCard.FormHeader {
0017         title: i18nc("@title:group", "General")
0018     }
0019 
0020     FormCard.FormCard {
0021         FormCard.FormComboBoxDelegate {
0022             Layout.fillWidth: true
0023             id: colorTheme
0024             text: i18n("Color theme")
0025             textRole: "display"
0026             valueRole: "display"
0027             model: ColorSchemer.model
0028             Component.onCompleted: currentIndex = ColorSchemer.indexForScheme(Config.colorScheme);
0029             onCurrentValueChanged: {
0030                 ColorSchemer.apply(currentIndex);
0031                 Config.colorScheme = ColorSchemer.nameForIndex(currentIndex);
0032                 Config.save();
0033             }
0034         }
0035     }
0036 
0037     FormCard.FormHeader {
0038         title: i18nc("@title:group", "Posts")
0039     }
0040 
0041     FormCard.FormCard {
0042         FormCard.FormSwitchDelegate {
0043             id: showStats
0044             text: i18n("Show number of replies, favorites and boosts")
0045             checked: Config.showPostStats
0046             enabled: !Config.isShowPostStatsImmutable
0047             onToggled: {
0048                 Config.showPostStats = checked
0049                 Config.save()
0050             }
0051         }
0052 
0053         FormCard.FormDelegateSeparator {
0054             below: showStats; above: showLinkPreview
0055         }
0056 
0057         FormCard.FormSwitchDelegate {
0058             id: showLinkPreview
0059             text: i18n("Show link previews")
0060             checked: Config.showLinkPreview
0061             enabled: !Config.isShowLinkPreviewImmutable
0062             onToggled: {
0063                 Config.showLinkPreview = checked
0064                 Config.save()
0065             }
0066         }
0067 
0068         FormCard.FormDelegateSeparator {
0069             below: showLinkPreview; above: fontSelector
0070         }
0071 
0072         FormCard.FormButtonDelegate {
0073             id: fontSelector
0074             text: i18n("Content font")
0075             description: Config.defaultFont.family + " " + Config.defaultFont.pointSize + "pt"
0076             onClicked: fontDialog.open()
0077 
0078             FontDialog {
0079                 id: fontDialog
0080                 title: i18n("Please choose a font")
0081                 selectedFont: Config.defaultFont
0082                 onAccepted: {
0083                     Config.defaultFont = selectedFont;
0084                     Config.save();
0085                 }
0086             }
0087         }
0088     }
0089 
0090     FormCard.FormHeader {
0091         title: i18nc("@title:group", "Media")
0092     }
0093 
0094     FormCard.FormCard {
0095         FormCard.FormSwitchDelegate {
0096             id: cropMedia
0097             text: i18n("Crop images on the timeline to 16x9")
0098             checked: Config.cropMedia
0099             onToggled: {
0100                 Config.cropMedia = checked
0101                 Config.save()
0102             }
0103         }
0104 
0105         FormCard.FormDelegateSeparator {
0106             below: cropMedia; above: autoPlayGif
0107         }
0108 
0109         FormCard.FormSwitchDelegate {
0110             id: autoPlayGif
0111             text: i18n("Auto-play animated GIFs")
0112             checked: Config.autoPlayGif
0113             onToggled: {
0114                 Config.autoPlayGif = checked
0115                 Config.save()
0116             }
0117         }
0118     }
0119 }