Warning, /maui/mauikit-texteditor/src/controls.5/ColorSchemesPage.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.13
0002 import QtQuick.Controls 2.13
0003 import QtQuick.Layouts 1.3
0004
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.mauikit.texteditor 1.0 as TE
0007
0008 Maui.SettingsPage
0009 {
0010 id: control
0011 title: i18n("Colors")
0012
0013 property string currentTheme
0014 property color backgroundColor
0015
0016 signal colorsPicked(string backgroundColor, string textColor)
0017
0018 Maui.SectionGroup
0019 {
0020 title: i18n("Colors")
0021 description: i18n("Configure the style of the syntax highlighting. This configuration in not applied for rich text formats.")
0022
0023 Maui.SectionItem
0024 {
0025 label1.text: i18n("Color")
0026 label2.text: i18n("Editor background color.")
0027
0028 Maui.ColorsRow
0029 {
0030 spacing: Maui.Style.space.medium
0031 currentColor: control.backgroundColor
0032 colors: ["#333", "#fafafa", "#fff3e6", "#4c425b"]
0033
0034 onColorPicked:
0035 {
0036 currentColor = color
0037
0038 var textColor
0039
0040 switch(color)
0041 {
0042 case "#333": textColor = "#fafafa"; break;
0043 case "#fafafa": textColor = "#333"; break;
0044 case "#fff3e6": textColor = Qt.darker(color, 2); break;
0045 case "#4c425b": textColor = Qt.lighter(color, 2.5); break;
0046 default: textColor = Maui.Theme.textColor;
0047 }
0048
0049 control.colorsPicked(color, textColor)
0050 }
0051
0052 }
0053 }
0054
0055 Maui.SectionItem
0056 {
0057 label1.text: i18n("Theme")
0058 label2.text: i18n("Editor color scheme style.")
0059 columns: 1
0060
0061 GridLayout
0062 {
0063 columns: 3
0064 Layout.fillWidth: true
0065 opacity: enabled ? 1 : 0.5
0066
0067 Repeater
0068 {
0069 model: TE.ColorSchemesModel {}
0070
0071 delegate: Maui.GridBrowserDelegate
0072 {
0073 Layout.fillWidth: true
0074 checked: model.name === control.currentTheme
0075 onClicked: control.currentTheme = model.name
0076 label1.text: model.name
0077
0078 template.iconComponent: Rectangle
0079 {
0080 implicitHeight: Math.max(_layout.implicitHeight + topPadding + bottomPadding, 64)
0081
0082 color: control.backgroundColor
0083 radius: Maui.Style.radiusV
0084
0085 Column
0086 {
0087 id: _layout
0088 anchors.fill: parent
0089 anchors.margins: Maui.Style.space.small
0090
0091 spacing: 2
0092
0093 Text
0094 {
0095 wrapMode: Text.NoWrap
0096 elide: Text.ElideLeft
0097 width: parent.width
0098 text: "QWERTY { @ }"
0099 color: model.foreground
0100 font.family: settings.font.family
0101 }
0102
0103 Rectangle
0104 {
0105 radius: 2
0106 height: 8
0107 width: parent.width
0108 color: model.highlight
0109 }
0110
0111 Rectangle
0112 {
0113 radius: 2
0114 height: 8
0115 width: parent.width
0116 color: model.color3
0117 }
0118
0119 Rectangle
0120 {
0121 radius: 2
0122 height: 8
0123 width: parent.width
0124 color: model.color4
0125 }
0126
0127 Rectangle
0128 {
0129 radius: 2
0130 height: 8
0131 width: parent.width
0132 color: model.color5
0133 }
0134 }
0135 }
0136 }
0137 }
0138 }
0139 }
0140 }
0141
0142 }