Warning, /office/klevernotes/src/contents/ui/settings/PluginsTab.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 org.kde.Klever 1.0
0011 
0012 import "qrc:/contents/ui/sharedComponents"
0013 
0014 ColumnLayout {
0015     id: root
0016 
0017     Layout.fillWidth: true
0018     Layout.fillHeight: true
0019 
0020     FormCard.FormHeader {
0021         title: i18nc("@title", "Utility plugins")
0022         Layout.fillWidth: true
0023     }
0024 
0025     FormCard.FormCard {
0026         id: utilityCard
0027 
0028         Layout.fillWidth: true
0029 
0030         FormCard.FormSwitchDelegate {
0031             id: noteMapperCheck
0032 
0033             text: i18nc("@label:checkbox", "Enable note linking")
0034             description: i18nc("@description:checkbox", "Note linking allows you to create a link from one note to another.") 
0035                 + "\n" + i18nc("@description:checkbox", "Advice: restart the app once activated.")
0036             checked: Config.noteMapEnabled
0037 
0038             onCheckedChanged: if (checked != Config.noteMapEnabled) {
0039                 Config.noteMapEnabled = checked
0040             }
0041         }
0042 
0043         ExpendingFormSwitch {
0044             id: pumlCheck
0045 
0046             text: i18nc("@label:checkbox", "Enable PlantUML")
0047             description: i18nc("@description:checkbox", "PlantUML let's you create diagram.") 
0048                 + "\n" + i18nc("@description:checkbox", "Note: creating diagrams can be slow. If you have a large number of diagrams, displaying them as images would be easier.")
0049             checked: Config.pumlEnabled
0050 
0051             onCheckedChanged: if (checked != Config.pumlEnabled) {
0052                 Config.pumlEnabled = checked
0053             }
0054 
0055             FormCard.FormSwitchDelegate {
0056                 id: pumlDarkSwitch
0057 
0058                 text: i18nc("@lable:switch", "Enable dark background")
0059                 description: i18nc("@description:switch", "PlantUML diagram will have a dark background.")
0060                 checked: Config.pumlDark
0061 
0062                 onCheckedChanged: if (checked != Config.pumlDark) {
0063                     Config.pumlDark = checked
0064                 }
0065             }
0066         }
0067     }
0068 
0069     FormCard.FormHeader {
0070         title: i18nc("@title", "Cosmetic plugins")
0071         Layout.fillWidth: true
0072     }
0073 
0074     FormCard.FormCard {
0075         id: appearanceCard
0076 
0077         Layout.fillWidth: true
0078 
0079         ExpendingFormSwitch {
0080             id: highlitingCheck
0081 
0082             text: i18nc("@label:checkbox", "Enable code syntax highlighting")
0083             description: "<a href='https://invent.kde.org/office/klevernotes#syntax-highlighting'>" + i18nc("@description:checkbox", "List of supported highlighters") + "</a>"
0084             checked: Config.codeSynthaxHighlightEnabled
0085 
0086             onCheckedChanged: if (checked != Config.codeSynthaxHighlightEnabled) {
0087                 Config.codeSynthaxHighlightEnabled = checked
0088             }
0089 
0090             FormCard.FormComboBoxDelegate {
0091                 id: highlighterCombobox
0092 
0093                 text: i18nc("@label:combobox", "Highlighter")
0094                 model: HighlightHelper.highlighters 
0095 
0096                 onModelChanged: if (model.length !== 0) {
0097                     const baseIndex = 0;
0098 
0099                     if (Config.codeSynthaxHighlighter.length === 0) {
0100                         highlighterCombobox.currentIndex = baseIndex
0101                         return
0102                     }
0103 
0104                     const inModelIndex = indexOfValue(Config.codeSynthaxHighlighter)
0105 
0106                     highlighterCombobox.currentIndex = inModelIndex === -1
0107                         ? baseIndex
0108                         : inModelIndex
0109                 }
0110                 onCurrentValueChanged: {
0111                     const highlighter = highlighterCombobox.currentValue
0112                     if (highlighter != Config.codeSynthaxHighlighter) Config.codeSynthaxHighlighter = highlighter
0113                 }
0114             } 
0115 
0116             FormCard.FormComboBoxDelegate {
0117                 id: styleCombobox
0118                 
0119                 property bool configStyleSet: false
0120 
0121                 text: i18nc("@label:combobox", "Highlighter style")
0122                 model: HighlightHelper.getHighlighterStyle(highlighterCombobox.currentValue)
0123 
0124                 onCurrentValueChanged: {
0125                     if (!styleCombobox.configStyleSet) {
0126                         const baseIndex = 0;
0127 
0128                         if (Config.codeSynthaxHighlighterStyle.length === 0) {
0129                             styleCombobox.currentIndex = baseIndex
0130                             return
0131                         }
0132 
0133                         const inModelIndex = indexOfValue(Config.codeSynthaxHighlighterStyle)
0134 
0135                         styleCombobox.currentIndex = inModelIndex === -1
0136                             ? baseIndex
0137                             : inModelIndex
0138 
0139                         styleCombobox.configStyleSet = true
0140                     }
0141                     if (currentValue != Config.codeSynthaxHighlighterStyle) Config.codeSynthaxHighlighterStyle = currentValue
0142                 }
0143             }
0144         }
0145     
0146         FormCard.FormDelegateSeparator { above: highlitingCheck; below: emojiCheck }
0147 
0148         ExpendingFormSwitch {
0149             id: emojiCheck
0150 
0151             text: i18nc("@label:checkbox", "Enable quick emoji")
0152             description: i18nc("@description:checkbox, will be followed by the corresponding syntax, spacing between the end of the sentence and the syntax is already there", 
0153                 "Quickly write emoji using the following syntax") + " :<i>" + i18nc("@exemple, something representing a possible emoji short name", "emoji_name") + "</i>:"
0154             checked: Config.quickEmojiEnabled
0155 
0156             onCheckedChanged: if (checked != Config.quickEmojiEnabled) {
0157                 Config.quickEmojiEnabled = checked
0158             }
0159 
0160             FormCard.FormComboBoxDelegate {
0161                 id: tonesCombobox
0162 
0163 
0164                 text: i18nc("@label:combobox", "Default emoji tone")
0165                 textRole: "text"
0166                 valueRole: "value"
0167                 model: [
0168                     { value: "None", text: i18nc("@combobox:entry, As in 'default skin tone' (for an emoji), see '🫶'", "Default") + " 🫶" },
0169                     { value: "light skin tone", text: i18nc("@combobox:entry, As in 'light skin tone' (for an emoji), see '🫶🏻'", "Light") + " 🫶🏻" },
0170                     { value: "medium-light skin tone", text: i18nc("@combobox:entry, As in 'medium light skin tone' (for an emoji), see '🫶🏼'", "Medium light") + " 🫶🏼" },
0171                     { value: "medium skin tone", text: i18nc("@combobox:entry, As in 'Medium skin tone' (for an emoji), see '🫶🏽'", "Medium") + " 🫶🏽" },
0172                     { value: "medium-dark skin tone", text: i18nc("@combobox:entry, As in 'Medium-dark skin tone' (for an emoji), see '🫶🏾'", "Medium dark") + " 🫶🏾" },
0173                     { value: "dark skin tone", text: i18nc("@combobox:entry, As in 'dark skin tone' (for an emoji), see '🫶🏿'", "Dark") + " 🫶🏿" }
0174                 ]
0175 
0176                 Component.onCompleted: {
0177                     currentIndex = indexOfValue(Config.emojiTone)
0178                 }
0179                 onCurrentValueChanged: {
0180                     if (currentValue != Config.emojiTone) Config.emojiTone = currentValue
0181                 }
0182             }
0183 
0184             FormCard.FormSwitchDelegate {
0185                 id: quickEmojiDialogSwitch
0186 
0187                 text: i18nc("@lable:switch", "Enable quick emoji dialog")
0188                 description: i18nc("@description:switch", "The emoji dialog insert the 'quick emoji' syntax instead of the actual emoji inside the text.")
0189                 checked: Config.quickEmojiDialogEnabled
0190 
0191                 onCheckedChanged: if (checked != Config.quickEmojiDialogEnabled) {
0192                     Config.quickEmojiDialogEnabled = checked
0193                 }
0194             }
0195         }
0196     }
0197 }