MauiKit Terminal

ColorSchemesPage.qml
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import org.mauikit.controls as Maui
6import org.mauikit.terminal as Term
7
8/**
9 * @brief A page entry for picking one of the available color schemes for the terminal display
10 *
11 * @code
12import QtQuick
13import QtQuick.Controls
14import QtQuick.Layouts
15
16import org.mauikit.controls as Maui
17
18import org.mauikit.terminal as Term
19
20Maui.ApplicationWindow
21{
22 id: root
23
24 Maui.Page
25 {
26 Maui.Controls.showCSD: true
27 anchors.fill: parent
28
29 headBar.leftContent: ToolButton
30 {
31 icon.name: "love"
32 onClicked: _dialog.open()
33 }
34
35 Maui.SettingsDialog
36 {
37 id: _dialog
38
39 Maui.SectionItem
40 {
41 text: "Colors"
42 onClicked: _dialog.addPage(_colorsComp)
43 }
44 Component
45 {
46 id: _colorsComp
47 Term.ColorSchemesPage
48 {
49 currentColorScheme: _term.kterminal.colorScheme
50 onCurrentColorSchemeChanged: _term.kterminal.colorScheme = currentColorScheme
51 }
52
53 }
54 }
55
56 Term.Terminal
57 {
58 id: _term
59 anchors.fill: parent
60 kterminal.colorScheme: "Ubuntu"
61 }
62 }
63}
64
65
66 * @endcode
67 *
68 */
69Maui.SettingsPage
70{
71 id: control
72 title: i18n("Color Scheme")
73
74 property string currentColorScheme
75
76 Maui.SectionItem
77 {
78 label1.text: i18n("Color Scheme")
79 label2.text: i18n("Change the color scheme of the terminal.")
80
81 GridLayout
82 {
83 columns: 3
84 Layout.fillWidth: true
85 opacity: enabled ? 1 : 0.5
86
87 Repeater
88 {
89 model: Term.ColorSchemesModel {}
90
91 delegate: Maui.GridBrowserDelegate
92 {
93 Layout.fillWidth: true
94 checked: model.name === control.currentColorScheme
95 onClicked: control.currentColorScheme = model.name
96
97 template.iconComponent: Control
98 {
99 implicitHeight: Math.max(_layout.implicitHeight + topPadding + bottomPadding, 64)
100 padding: Maui.Style.space.small
101
102 background: Rectangle
103 {
104 color: model.background
105 radius: Maui.Style.radiusV
106 }
107
108 contentItem: Column
109 {
110 id:_layout
111 spacing: 2
112
113 Text
114 {
115 wrapMode: Text.NoWrap
116 elide: Text.ElideLeft
117 width: parent.width
118 // font.pointSize: Maui.Style.fontSizes.small
119 text: "Hello world!"
120 color: model.foreground
121 font.family: "Monospaced"
122 }
123
124 Rectangle
125 {
126 radius: 2
127 height: 8
128 width: parent.width
129 color: model.highlight
130 }
131
132 Rectangle
133 {
134 radius: 2
135 height: 8
136 width: parent.width
137 color: model.color3
138 }
139
140 Rectangle
141 {
142 radius: 2
143 height: 8
144 width: parent.width
145 color: model.color4
146 }
147 }
148 }
149
150 label1.text: model.name
151 }
152 }
153 }
154 }
155}
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.