summaryrefslogtreecommitdiff
path: root/raveos-calamares-theme/etc/calamares/branding/raveos/keyboardq.qml
blob: adae7c4497332f04bc8c21524a4a2767d671cd3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
import io.calamares.core 1.0
import io.calamares.ui 1.0

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import "RaveOS"
import RaveOSNative 1.0

Rectangle {
    id: billentyuzet
    color: Stilus.hatter

    readonly property var layoutok: config.keyboardLayoutsModel
    readonly property string aktivKod: layoutok.currentIndex >= 0
        ? layoutok.data(layoutok.index(layoutok.currentIndex, 0), Qt.UserRole + 1) : ""
    readonly property var valtozatok: config.keyboardVariantsModel
    readonly property string valtozatKod: valtozatok.currentIndex >= 0
        ? (valtozatok.data(valtozatok.index(valtozatok.currentIndex, 0), Qt.UserRole) || "") : ""
    readonly property var sorok: Billentyuzet.gombok(aktivKod, valtozatKod)
    readonly property var behuzasok: [0, 0.5, 0.75, 0.25]
    readonly property bool kiemeles: {
        var db = 0
        for (var i = 0; i < sorok.length; ++i)
            for (var j = 0; j < sorok[i].length; ++j)
                if (sorok[i][j].length > 0 && sorok[i][j].charCodeAt(0) > 127)
                    ++db
        return db > 0 && db <= 15
    }

    component Cimke: Text {
        color: Stilus.szovegHalvany
        font.family: Stilus.font
        font.pixelSize: 12
    }

    ColumnLayout {
        anchors.fill: parent
        anchors.topMargin: 48
        anchors.bottomMargin: 32
        anchors.leftMargin: 56
        anchors.rightMargin: 56
        spacing: 24

        Fejlec {
            Layout.fillWidth: true
            felirat: qsTr("KEYBOARD")
            cim: qsTr("KEYBOARD LAYOUT")
        }

        RowLayout {
            Layout.fillWidth: true
            Layout.fillHeight: true
            spacing: 24

            ColumnLayout {
                Layout.fillWidth: true
                Layout.fillHeight: true
                Layout.preferredWidth: 1
                spacing: 6

                Cimke { text: qsTr("Layout") }

                Rectangle {
                    Layout.fillWidth: true
                    Layout.fillHeight: true
                    color: Stilus.felulet
                    border.width: 1
                    border.color: Stilus.keret

                    ListView {
                        id: lista
                        anchors.fill: parent
                        anchors.margins: 1
                        clip: true
                        model: billentyuzet.layoutok
                        currentIndex: billentyuzet.layoutok.currentIndex
                        boundsBehavior: Flickable.StopAtBounds
                        ScrollBar.vertical: Gorgeto {}
                        Component.onCompleted: Qt.callLater(function() { lista.positionViewAtIndex(lista.currentIndex, ListView.Center) })

                        delegate: Rectangle {
                            readonly property bool kivalasztva: index === lista.currentIndex
                            width: lista.width
                            height: 40
                            color: kivalasztva ? Stilus.zold : (hover.hovered ? Stilus.aktiv : "transparent")

                            Rectangle {
                                anchors.left: parent.left
                                anchors.right: parent.right
                                anchors.bottom: parent.bottom
                                height: 1
                                color: Stilus.aktiv
                            }

                            RowLayout {
                                anchors.fill: parent
                                anchors.leftMargin: 14
                                anchors.rightMargin: 24
                                spacing: 12

                                Text {
                                    Layout.fillWidth: true
                                    text: model.label
                                    elide: Text.ElideRight
                                    color: parent.parent.kivalasztva ? Stilus.zoldonSzoveg : Stilus.szoveg
                                    font.family: Stilus.font
                                    font.pixelSize: 14
                                    font.weight: parent.parent.kivalasztva ? Font.DemiBold : Font.Normal
                                }

                                Text {
                                    text: model.key
                                    color: parent.parent.kivalasztva ? Stilus.zoldonSzoveg : Stilus.szovegHalvany
                                    font.family: Stilus.mono
                                    font.pixelSize: 12
                                }
                            }

                            HoverHandler { id: hover }

                            TapHandler {
                                onTapped: billentyuzet.layoutok.currentIndex = index
                            }
                        }
                    }
                }
            }

            ColumnLayout {
                Layout.fillWidth: true
                Layout.alignment: Qt.AlignTop
                Layout.preferredWidth: 1
                spacing: 16

                ColumnLayout {
                    Layout.fillWidth: true
                    spacing: 6

                    Cimke { text: qsTr("Variant") }

                    Valaszto {
                        Layout.fillWidth: true
                        model: config.keyboardVariantsModel
                        textRole: "label"
                        currentIndex: config.keyboardVariantsModel.currentIndex
                        onActivated: config.keyboardVariantsModel.currentIndex = index
                    }
                }

                ColumnLayout {
                    Layout.fillWidth: true
                    spacing: 6

                    Cimke { text: qsTr("Keyboard model") }

                    Valaszto {
                        Layout.fillWidth: true
                        model: config.keyboardModelsModel
                        textRole: "label"
                        currentIndex: config.keyboardModelsModel.currentIndex
                        onActivated: config.keyboardModelsModel.currentIndex = index
                    }
                }

                ColumnLayout {
                    Layout.fillWidth: true
                    spacing: 6

                    Cimke { text: qsTr("Test") }

                    TextField {
                        Layout.fillWidth: true
                        implicitHeight: 44
                        leftPadding: 12
                        placeholderText: qsTr("Type here: árvíztűrő tükörfúrógép")
                        placeholderTextColor: Stilus.szovegHalvany
                        color: Stilus.szoveg
                        font.family: Stilus.font
                        font.pixelSize: 14
                        background: Rectangle {
                            color: Stilus.felulet
                            border.width: 1
                            border.color: parent.activeFocus ? Stilus.zold : Stilus.keretErosebb
                        }
                    }
                }
            }
        }

        Rectangle {
            id: rajzKeret
            visible: billentyuzet.sorok.length > 0
            Layout.fillWidth: true
            Layout.preferredHeight: rajz.height + 28
            color: Stilus.felulet
            border.width: 1
            border.color: Stilus.keret

            readonly property real gombKoz: 6
            readonly property real gombMeret: Math.min(52, (width - 28 - 12 * gombKoz) / 13.75)

            Column {
                id: rajz
                anchors.centerIn: parent
                spacing: rajzKeret.gombKoz

                Repeater {
                    model: billentyuzet.sorok

                    Row {
                        readonly property var gombok: modelData
                        leftPadding: billentyuzet.behuzasok[index] * (rajzKeret.gombMeret + rajzKeret.gombKoz)
                        spacing: rajzKeret.gombKoz

                        Repeater {
                            model: parent.gombok

                            Rectangle {
                                readonly property bool ekezet: billentyuzet.kiemeles && modelData.length > 0 && modelData.charCodeAt(0) > 127
                                width: rajzKeret.gombMeret
                                height: rajzKeret.gombMeret * 0.85
                                color: ekezet ? "#2f3a2c" : Stilus.hatter
                                border.width: 1
                                border.color: Stilus.keretErosebb

                                Text {
                                    anchors.centerIn: parent
                                    text: modelData
                                    color: parent.ekezet ? "#8fcf7e" : Stilus.szovegMasodlagos
                                    font.family: Stilus.mono
                                    font.pixelSize: Math.max(11, rajzKeret.gombMeret * 0.32)
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}