Warning, /office/klevernotes/src/contents/ui/settings/DisplayPreview.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: GPL-2.0-or-later 0002 // SPDX-FileCopyrightText: 2023 Louis Schul <schul9louis@gmail.com> 0003 0004 import QtQuick 2.15 0005 import QtQuick.Layouts 1.15 0006 0007 import org.kde.kirigami 2.19 as Kirigami 0008 import org.kde.kirigamiaddons.formcard 1.0 as FormCard 0009 0010 import "qrc:/contents/ui/textEditor" 0011 0012 import org.kde.Klever 1.0 0013 0014 FormCard.FormCard { 0015 FormCard.FormComboBoxDelegate { 0016 readonly property var styles: KleverUtility.getCssStylesList() 0017 readonly property var stylesNames: Object.keys(styles) 0018 readonly property var styleName: KleverUtility.getName(Config.stylePath).replace(".css", "") 0019 0020 text: i18nc("@label:combobox", "Style:") 0021 0022 model: stylesNames 0023 currentIndex: stylesNames.indexOf(styleName) 0024 0025 onCurrentValueChanged: { 0026 const path = styles[currentValue] 0027 0028 if (Config.stylePath !== path) Config.stylePath = path; 0029 } 0030 } 0031 0032 TextDisplay { 0033 id: displayer 0034 0035 path: "qrc:" 0036 text: DocumentHandler.readFile(":/demo_note.md") 0037 0038 visible: true 0039 0040 Layout.fillWidth: true 0041 Layout.preferredHeight: Kirigami.Units.gridUnit * 20 0042 } 0043 0044 RowLayout { 0045 SettingsColorButton { 0046 name: "text" 0047 title: i18nc("@label:button", "Text color:") 0048 0049 Kirigami.Theme.colorSet: Kirigami.Theme.View 0050 Kirigami.Theme.inherit: false 0051 color: (Config.viewTextColor !== "None") ? Config.viewTextColor : Kirigami.Theme.textColor 0052 0053 Layout.preferredWidth: displayer.width / 2 0054 } 0055 0056 SettingsColorButton { 0057 name: "title" 0058 title: i18nc("@label:button", "Title color:") 0059 0060 Kirigami.Theme.colorSet: Kirigami.Theme.View 0061 Kirigami.Theme.inherit: false 0062 color: (Config.viewTitleColor !== "None") ? Config.viewTitleColor : Kirigami.Theme.disabledTextColor 0063 0064 Layout.preferredWidth: displayer.width / 2 0065 } 0066 } 0067 RowLayout { 0068 SettingsColorButton { 0069 name: "link" 0070 title: i18nc("@label:button", "Link color:") 0071 0072 Kirigami.Theme.colorSet: Kirigami.Theme.View 0073 Kirigami.Theme.inherit: false 0074 color: (Config.viewLinkColor !== "None") ? Config.viewLinkColor : Kirigami.Theme.linkColor 0075 0076 Layout.preferredWidth: displayer.width / 2 0077 } 0078 0079 SettingsColorButton { 0080 name: "visitedLink" 0081 title: i18nc("@label:button", "Visited Link color:") 0082 0083 Kirigami.Theme.colorSet: Kirigami.Theme.View 0084 Kirigami.Theme.inherit: false 0085 color: (Config.viewVisitedLinkColor !== "None") ? Config.viewVisitedLinkColor : Kirigami.Theme.visitedLinkColor 0086 0087 Layout.preferredWidth: displayer.width / 2 0088 } 0089 } 0090 0091 RowLayout { 0092 SettingsColorButton { 0093 name: "code" 0094 title: i18nc("@label:button", "Code color:") 0095 0096 Kirigami.Theme.colorSet: Kirigami.Theme.View 0097 Kirigami.Theme.inherit: false 0098 color: (Config.viewCodeColor !== "None") ? Config.viewCodeColor : Kirigami.Theme.alternateBackgroundColor 0099 0100 Layout.alignment: Qt.AlignHCenter 0101 Layout.preferredWidth: displayer.width / 2 0102 } 0103 0104 SettingsColorButton { 0105 name: "highlight" 0106 title: i18nc("@label:button", "Highlight color:") 0107 0108 Kirigami.Theme.colorSet: Kirigami.Theme.View 0109 Kirigami.Theme.inherit: false 0110 color: (Config.viewHighlightColor !== "None") ? Config.viewHighlightColor : Kirigami.Theme.highlightColor 0111 0112 Layout.alignment: Qt.AlignHCenter 0113 Layout.preferredWidth: displayer.width / 2 0114 } 0115 } 0116 0117 FontPicker { 0118 label: i18nc("@label:textbox", "General font:") 0119 configFont: Config.viewFont 0120 0121 Layout.fillWidth: true 0122 0123 onNewFontChanged: if (text !== newFont) { 0124 Config.viewFont = newFont 0125 } 0126 } 0127 0128 FontPicker { 0129 label: i18nc("@label:textbox", "Code block font:") 0130 configFont: Config.codeFont 0131 0132 Layout.fillWidth: true 0133 0134 onNewFontChanged: if (text !== newFont) { 0135 Config.codeFont = newFont 0136 } 0137 } 0138 }