Warning, /maui/strike/src/views/widgets/SettingsDialog.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 import org.slike.strike 1.0 as Strike
0009
0010 Maui.SettingsDialog
0011 {
0012 id: control
0013
0014 Component
0015 {
0016 id: _editorPageComponent
0017 Maui.SettingsPage
0018 {
0019 title: i18n("Editor")
0020 Maui.SectionGroup
0021 {
0022 title: i18n("Editor")
0023 description: i18n("Configure the look and feel of the editor. The settings are applied globally")
0024
0025
0026 Maui.SectionItem
0027 {
0028 label1.text: i18n("Auto Save")
0029 label2.text: i18n("Auto saves your file every 5 seconds.")
0030 Switch
0031 {
0032 checkable: true
0033 checked: settings.autoSave
0034 onToggled: settings.autoSave = !settings.autoSave
0035 }
0036 }
0037
0038
0039 Maui.SectionItem
0040 {
0041 label1.text: i18n("Syntax Highlighting")
0042 Switch
0043 {
0044 checkable: true
0045 // checked: settings.autoSave
0046 // onToggled: settings.autoSave = !settings.autoSave
0047 }
0048 }
0049
0050 Maui.SectionItem
0051 {
0052 label1.text: i18n("Line Numbers")
0053 label2.text: i18n("Display the line numbers on the left side")
0054
0055 Switch
0056 {
0057 checkable: true
0058 checked: settings.showLineNumbers
0059 onToggled: settings.showLineNumbers = !settings.showLineNumbers
0060 }
0061 }
0062 }
0063
0064 Maui.SectionGroup
0065 {
0066 title: i18n("Style")
0067 description: i18n("Configure the style of the syntax highlighting. This configuration in not applied for rich text formats")
0068 visible: settings.enableSyntaxHighlighting
0069
0070 Maui.SectionItem
0071 {
0072 label1.text: i18n("Tab Spacing")
0073
0074 SpinBox
0075 {
0076 from: 0; to : 500
0077 value: settings.tabSpace
0078 onValueChanged: settings.tabSpace = value
0079 }
0080 }
0081
0082 Maui.SectionItem
0083 {
0084 label1.text: i18n("Fonts")
0085 label2.text: i18n("Configure the fonts family and style.")
0086
0087 ToolButton
0088 {
0089 checkable: true
0090 onToggled: control.addPage(_fontsPageComponent)
0091 icon.name: "go-next"
0092 }
0093 }
0094
0095 Maui.SectionItem
0096 {
0097 label1.text: i18n("Colors")
0098 label2.text: i18n("Configure the color scheme of the syntax highlighting.")
0099 enabled: settings.enableSyntaxHighlighting
0100 ToolButton
0101 {
0102 checkable: true
0103 onToggled: control.addPage(_stylePageComponent)
0104 icon.name: "go-next"
0105 }
0106 }
0107 }
0108 }
0109 }
0110
0111 Component
0112 {
0113 id: _fontsPageComponent
0114
0115 Maui.SettingsPage
0116 {
0117 title: i18n("Fonts")
0118 Maui.FontPicker
0119 {
0120 Layout.fillWidth: true
0121 mfont: settings.font
0122 model.onlyMonospaced: true
0123 onFontModified:
0124 {
0125 settings.font = font
0126 }
0127 }
0128 }
0129 }
0130
0131 Maui.SectionItem
0132 {
0133 label1.text: i18n("Editor")
0134 label2.text: i18n("Configure the look and feel of the text editor.")
0135 ToolButton
0136 {
0137 checkable: true
0138 onToggled: control.addPage(_editorPageComponent)
0139 icon.name: "go-next"
0140 }
0141 }
0142
0143 Maui.SectionItem
0144 {
0145 label1.text: i18n("Builder")
0146 label2.text: i18n("Configure the build steps commands.")
0147 ToolButton
0148 {
0149 checkable: true
0150 // onToggled: control.addPage(_stylePageComponent)
0151 icon.name: "go-next"
0152 }
0153 }
0154
0155 Maui.SectionItem
0156 {
0157 label1.text: i18n("Plugins")
0158 label2.text: i18n("Toggle available plugins.")
0159 ToolButton
0160 {
0161 checkable: true
0162 // onToggled: control.addPage(_stylePageComponent)
0163 icon.name: "go-next"
0164 }
0165 }
0166
0167 Maui.SectionItem
0168 {
0169 label1.text: i18n("Tools")
0170 label2.text: i18n("More tools.")
0171 ToolButton
0172 {
0173 checkable: true
0174 // onToggled: control.addPage(_stylePageComponent)
0175 icon.name: "go-next"
0176 }
0177 }
0178
0179 Component
0180 {
0181 id:_stylePageComponent
0182 Maui.SettingsPage
0183 {
0184 title: i18n("Style")
0185
0186 Maui.SectionGroup
0187 {
0188 title: i18n("Style")
0189 description: i18n("Configure the style of the syntax highliting. This configuration in not applied for rich text formats")
0190
0191 Maui.SectionItem
0192 {
0193 label1.text: i18n("Color")
0194 label2.text: i18n("Editor background color")
0195 Maui.ColorsRow
0196 {
0197 spacing: Maui.Style.space.medium
0198 currentColor: appSettings.backgroundColor
0199 colors: ["#333", "#fafafa", "#fff3e6", "#4c425b"]
0200
0201 onColorPicked:
0202 {
0203 currentColor = color
0204
0205 var textColor
0206
0207 switch(color)
0208 {
0209 case "#333": textColor = "#fafafa"; break;
0210 case "#fafafa": textColor = "#333"; break;
0211 case "#fff3e6": textColor = Qt.darker(color, 2); break;
0212 case "#4c425b": textColor = Qt.lighter(color, 2.5); break;
0213 default: textColor = Maui.Theme.textColor;
0214 }
0215
0216 switchBackgroundColor(color, textColor)
0217 }
0218
0219 }
0220 }
0221
0222 Maui.SectionItem
0223 {
0224 label1.text: i18n("Theme")
0225 label2.text: i18n("Editor color scheme style")
0226 columns: 1
0227
0228 GridLayout
0229 {
0230 columns: 3
0231 Layout.fillWidth: true
0232 opacity: enabled ? 1 : 0.5
0233 Repeater
0234 {
0235 model: TE.ColorSchemesModel
0236 {
0237 }
0238
0239 delegate: Maui.GridBrowserDelegate
0240 {
0241 Layout.fillWidth: true
0242 checked: model.name === settings.theme
0243 onClicked: settings.theme = model.name
0244
0245 template.iconComponent: Rectangle
0246 {
0247 implicitHeight: _previewLayout.implicitHeight + Maui.Style.space.small*2
0248 color: appSettings.backgroundColor
0249 radius: Maui.Style.radiusV
0250
0251 Column
0252 {
0253 id: _previewLayout
0254 anchors.fill: parent
0255 anchors.margins: Maui.Style.space.small
0256 spacing: 2
0257
0258 Text
0259 {
0260 wrapMode: Text.NoWrap
0261 elide: Text.ElideLeft
0262 width: parent.width
0263 // font.pointSize: Maui.Style.fontSizes.small
0264 text: "Hello world!"
0265 color: model.foreground
0266 font.family: settings.font.family
0267 }
0268
0269 Rectangle
0270 {
0271 radius: 2
0272 height: 8
0273 width: parent.width
0274 color: model.highlight
0275 }
0276
0277 Rectangle
0278 {
0279 radius: 2
0280 height: 8
0281 width: parent.width
0282 color: model.color3
0283 }
0284
0285 Rectangle
0286 {
0287 radius: 2
0288 height: 8
0289 width: parent.width
0290 color: model.color4
0291 }
0292
0293 Rectangle
0294 {
0295 radius: 2
0296 height: 8
0297 width: parent.width
0298 color: model.color5
0299 }
0300 }
0301 }
0302
0303 label1.text: model.name
0304 }
0305 }
0306 }
0307 }
0308
0309 }
0310 }
0311 }
0312
0313 function switchBackgroundColor(backgroundColor, textColor)
0314 {
0315 settings.backgroundColor = backgroundColor
0316 settings.textColor = textColor
0317 }
0318 }