Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwinrules/package/contents/ui/ValueEditor.qml
Show All 39 Lines | 30 | Loader { | |||
---|---|---|---|---|---|
40 | sourceComponent: { | 40 | sourceComponent: { | ||
41 | switch (controlType) { | 41 | switch (controlType) { | ||
42 | case RuleItem.Boolean: return booleanEditor | 42 | case RuleItem.Boolean: return booleanEditor | ||
43 | case RuleItem.String: return stringEditor | 43 | case RuleItem.String: return stringEditor | ||
44 | case RuleItem.Integer: return integerEditor | 44 | case RuleItem.Integer: return integerEditor | ||
45 | case RuleItem.Option: return optionEditor | 45 | case RuleItem.Option: return optionEditor | ||
46 | case RuleItem.FlagsOption: return flagsEditor | 46 | case RuleItem.FlagsOption: return flagsEditor | ||
47 | case RuleItem.Percentage: return percentageEditor | 47 | case RuleItem.Percentage: return percentageEditor | ||
48 | case RuleItem.Coordinate: return coordinateEditor | 48 | case RuleItem.Point: return coordinateEditor | ||
49 | case RuleItem.Size: return coordinateEditor | ||||
49 | case RuleItem.Shortcut: return shortcutEditor | 50 | case RuleItem.Shortcut: return shortcutEditor | ||
50 | default: return emptyEditor | 51 | default: return emptyEditor | ||
51 | } | 52 | } | ||
52 | } | 53 | } | ||
53 | 54 | | |||
54 | Component { | 55 | Component { | ||
55 | id: emptyEditor | 56 | id: emptyEditor | ||
56 | Item {} | 57 | Item {} | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | |||||
149 | } | 150 | } | ||
150 | 151 | | |||
151 | Component { | 152 | Component { | ||
152 | id: coordinateEditor | 153 | id: coordinateEditor | ||
153 | RowLayout { | 154 | RowLayout { | ||
154 | id: coordItem | 155 | id: coordItem | ||
155 | spacing: Kirigami.Units.smallSpacing | 156 | spacing: Kirigami.Units.smallSpacing | ||
156 | 157 | | |||
157 | property var coords: ruleValue ? ruleValue.split(',') : [0, 0] | 158 | readonly property var coord: (controlType == RuleItem.Size) ? Qt.size(coordX.value, coordY.value) | ||
159 | : Qt.point(coordX.value, coordY.value) | ||||
160 | onCoordChanged: valueEditor.valueEdited(coord) | ||||
158 | 161 | | |||
159 | QQC2.SpinBox { | 162 | QQC2.SpinBox { | ||
160 | id: coordX | 163 | id: coordX | ||
161 | editable: true | 164 | editable: true | ||
162 | Layout.preferredWidth: 50 // 50% | 165 | Layout.preferredWidth: 50 // 50% | ||
163 | Layout.fillWidth: true | 166 | Layout.fillWidth: true | ||
164 | from: 0 | 167 | from: 0 | ||
165 | to: 4098 | 168 | to: 4098 | ||
166 | value: coords[0] | 169 | value: (controlType == RuleItem.Size) ? ruleValue.width : ruleValue.x | ||
167 | onValueModified: valueEditor.valueEdited(coordX.value + "," + coordY.value) | | |||
168 | } | 170 | } | ||
169 | QQC2.Label { | 171 | QQC2.Label { | ||
170 | id: coordSeparator | 172 | id: coordSeparator | ||
171 | Layout.preferredWidth: implicitWidth | 173 | Layout.preferredWidth: implicitWidth | ||
172 | text: i18nc("(x, y) coordinates separator in size/position","x") | 174 | text: i18nc("(x, y) coordinates separator in size/position","x") | ||
173 | horizontalAlignment: Text.AlignHCenter | 175 | horizontalAlignment: Text.AlignHCenter | ||
174 | } | 176 | } | ||
175 | QQC2.SpinBox { | 177 | QQC2.SpinBox { | ||
176 | id: coordY | 178 | id: coordY | ||
177 | editable: true | 179 | editable: true | ||
178 | from: 0 | 180 | from: 0 | ||
179 | to: 4098 | 181 | to: 4098 | ||
180 | Layout.preferredWidth: 50 // 50% | 182 | Layout.preferredWidth: 50 // 50% | ||
181 | Layout.fillWidth: true | 183 | Layout.fillWidth: true | ||
182 | value: coords[1] | 184 | value: (controlType == RuleItem.Size) ? ruleValue.height : ruleValue.y | ||
183 | onValueModified: valueEditor.valueEdited(coordX.value + "," + coordY.value) | | |||
184 | } | 185 | } | ||
185 | } | 186 | } | ||
186 | } | 187 | } | ||
187 | 188 | | |||
188 | Component { | 189 | Component { | ||
189 | id: shortcutEditor | 190 | id: shortcutEditor | ||
190 | RowLayout { | 191 | RowLayout { | ||
191 | Item { | 192 | Item { | ||
Show All 9 Lines |