Changeset View
Changeset View
Standalone View
Standalone View
kcms/keyboard/kcmui/package/contents/ui/Hardware.qml
- This file was added.
1 | import QtQuick 2.6 | ||||
---|---|---|---|---|---|
2 | import QtQuick.Layouts 1.3 | ||||
3 | import QtQuick.Controls 2.3 as Controls | ||||
4 | import org.kde.kirigami 2.4 as Kirigami | ||||
5 | import org.kde.kcm 1.1 as KCM | ||||
6 | | ||||
7 | KCM.SimpleKCM { | ||||
8 | id: root | ||||
9 | | ||||
10 | property var dataModel; | ||||
11 | signal changed(); | ||||
12 | | ||||
13 | Kirigami.FormLayout { | ||||
14 | id: formLayout | ||||
15 | | ||||
16 | Controls.ComboBox { | ||||
17 | id: keyboardModelComboBox | ||||
18 | Kirigami.FormData.label: i18n("Keyboard Model:") | ||||
19 | model: dataModel.keyboardModelModel | ||||
20 | textRole: "description" | ||||
21 | implicitWidth: textarea.width | ||||
22 | | ||||
23 | Binding on currentIndex { | ||||
24 | value: dataModel.currentIndex | ||||
25 | } | ||||
26 | | ||||
27 | MouseArea { | ||||
28 | anchors.fill: parent | ||||
29 | onWheel: { | ||||
30 | // disable wheel events | ||||
31 | } | ||||
32 | onPressed: { | ||||
33 | // propogate to ComboBox | ||||
34 | mouse.accepted = false; | ||||
35 | } | ||||
36 | onReleased: { | ||||
37 | // propogate to ComboBox | ||||
38 | mouse.accepted = false; | ||||
39 | } | ||||
40 | } | ||||
41 | onActivated: { | ||||
42 | dataModel.currentIndex = currentIndex; | ||||
43 | root.changed(); | ||||
44 | } | ||||
45 | } | ||||
46 | | ||||
47 | Item { | ||||
48 | Kirigami.FormData.isSection: true | ||||
49 | } | ||||
50 | | ||||
51 | TriSelector { | ||||
52 | Kirigami.FormData.label: i18n("Numlock on Plasma Startup:") | ||||
53 | Binding on tristate { | ||||
54 | value: dataModel.numlockOnStartup | ||||
55 | } | ||||
56 | tristate: dataModel.numlockOnStartup | ||||
57 | onChanged: { | ||||
58 | dataModel.numlockOnStartup = tristate; | ||||
59 | root.changed(); | ||||
60 | } | ||||
61 | } | ||||
62 | | ||||
63 | TriSelector { | ||||
64 | Kirigami.FormData.label: i18n("Keyboard Repeat:") | ||||
65 | Binding on tristate { | ||||
66 | value: dataModel.keyboardRepeat | ||||
67 | } | ||||
68 | onChanged: { | ||||
69 | dataModel.keyboardRepeat = tristate; | ||||
70 | root.changed(); | ||||
71 | } | ||||
72 | } | ||||
73 | | ||||
74 | Item { | ||||
75 | Kirigami.FormData.isSection: true | ||||
76 | } | ||||
77 | | ||||
78 | RowLayout { | ||||
79 | id: delay | ||||
80 | Kirigami.FormData.label: i18n("Delay:") | ||||
81 | | ||||
82 | Controls.Slider { | ||||
83 | id: delay_slider | ||||
84 | | ||||
85 | enabled: dataModel.keyboardRepeat === 0 | ||||
86 | | ||||
87 | Layout.fillWidth: true; | ||||
88 | width: 300 | ||||
89 | from: 100 | ||||
90 | value: dataModel.repeatDelay | ||||
91 | to: 5000 | ||||
92 | | ||||
93 | onMoved: { | ||||
94 | dataModel.repeatDelay = value; | ||||
95 | root.changed(); | ||||
96 | } | ||||
97 | } | ||||
98 | | ||||
99 | Controls.TextField { | ||||
100 | enabled: dataModel.keyboardRepeat === 0 | ||||
101 | Layout.fillWidth: false; | ||||
102 | Layout.preferredWidth: 150; | ||||
103 | id: delay_number_field; | ||||
104 | readOnly: true; | ||||
105 | text: Math.floor(delay_slider.value) + " ms"; | ||||
106 | } | ||||
107 | } | ||||
108 | | ||||
109 | RowLayout { | ||||
110 | Kirigami.FormData.label: i18n("Rate:") | ||||
111 | | ||||
112 | Controls.Slider { | ||||
113 | id: rate_slider | ||||
114 | | ||||
115 | enabled: dataModel.keyboardRepeat === 0 | ||||
116 | | ||||
117 | Layout.fillWidth: true; | ||||
118 | width: 300 | ||||
119 | from: 0.2 | ||||
120 | value: dataModel.repeatRate | ||||
121 | to: 50 | ||||
122 | | ||||
123 | onMoved: { | ||||
124 | dataModel.repeatRate = value; | ||||
125 | root.changed(); | ||||
126 | } | ||||
127 | } | ||||
128 | | ||||
129 | Controls.TextField { | ||||
130 | enabled: dataModel.keyboardRepeat === 0 | ||||
131 | Layout.fillWidth: false; | ||||
132 | Layout.preferredWidth: 150; | ||||
133 | id: rate_number_field; | ||||
134 | readOnly: true; | ||||
135 | text: parseFloat(rate_slider.value).toFixed(2) + " repeats/s"; | ||||
136 | } | ||||
137 | } | ||||
138 | | ||||
139 | Item { | ||||
140 | Kirigami.FormData.isSection: true | ||||
141 | } | ||||
142 | | ||||
143 | Controls.TextArea { | ||||
144 | Kirigami.FormData.label: i18n("Test area:") | ||||
145 | id: textarea | ||||
146 | implicitWidth: Math.max(parent.width / 3, delay.width) | ||||
147 | implicitHeight: 200 | ||||
148 | wrapMode: TextEdit.Wrap | ||||
149 | } | ||||
150 | | ||||
151 | } | ||||
152 | } |