Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/package/contents/ui/main.qml
Show All 33 Lines | 33 | ColumnLayout { | |||
---|---|---|---|---|---|
34 | 34 | | |||
35 | Kirigami.InlineMessage { | 35 | Kirigami.InlineMessage { | ||
36 | id: antiAliasingMessage | 36 | id: antiAliasingMessage | ||
37 | Layout.fillWidth: true | 37 | Layout.fillWidth: true | ||
38 | showCloseButton: true | 38 | showCloseButton: true | ||
39 | text: i18n("Some changes such as anti-aliasing or DPI will only affect newly started applications.") | 39 | text: i18n("Some changes such as anti-aliasing or DPI will only affect newly started applications.") | ||
40 | 40 | | |||
41 | Connections { | 41 | Connections { | ||
42 | target: kcm.fontAASettings | 42 | target: kcm | ||
43 | onAliasingChangeApplied: antiAliasingMessage.visible = true | 43 | onAliasingChangeApplied: antiAliasingMessage.visible = true | ||
44 | } | 44 | } | ||
45 | } | 45 | } | ||
46 | 46 | | |||
47 | Kirigami.FormLayout { | 47 | Kirigami.FormLayout { | ||
48 | id: formLayout | 48 | id: formLayout | ||
49 | readonly property int maxImplicitWidth: Math.max(adjustAllFontsButton.implicitWidth, excludeField.implicitWidth, subPixelCombo.implicitWidth, hintingCombo.implicitWidth) | 49 | readonly property int maxImplicitWidth: Math.max(adjustAllFontsButton.implicitWidth, excludeField.implicitWidth, subPixelCombo.implicitWidth, hintingCombo.implicitWidth) | ||
50 | 50 | | |||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
102 | } | 102 | } | ||
103 | 103 | | |||
104 | Kirigami.Separator { | 104 | Kirigami.Separator { | ||
105 | Kirigami.FormData.isSection: true | 105 | Kirigami.FormData.isSection: true | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | QtControls.CheckBox { | 108 | QtControls.CheckBox { | ||
109 | id: antiAliasingCheckBox | 109 | id: antiAliasingCheckBox | ||
110 | checked: kcm.fontAASettings.antiAliasing | 110 | checked: kcm.fontsAASettings.antiAliasing | ||
111 | onCheckedChanged: kcm.fontAASettings.antiAliasing = checked | 111 | onCheckedChanged: kcm.fontsAASettings.antiAliasing = checked | ||
112 | Kirigami.FormData.label: i18n("Anti-Aliasing:") | 112 | Kirigami.FormData.label: i18n("Anti-Aliasing:") | ||
113 | text: i18n("Enable") | 113 | text: i18n("Enable") | ||
114 | Layout.fillWidth: true | 114 | Layout.fillWidth: true | ||
115 | } | 115 | } | ||
116 | 116 | | |||
117 | QtControls.CheckBox { | 117 | QtControls.CheckBox { | ||
118 | id: excludeCheckBox | 118 | id: excludeCheckBox | ||
119 | checked: kcm.fontAASettings.exclude | 119 | checked: kcm.fontsAASettings.exclude | ||
120 | onCheckedChanged: kcm.fontAASettings.exclude = checked; | 120 | onCheckedChanged: kcm.fontsAASettings.exclude = checked; | ||
121 | text: i18n("Exclude range from anti-aliasing") | 121 | text: i18n("Exclude range from anti-aliasing") | ||
122 | Layout.fillWidth: true | 122 | Layout.fillWidth: true | ||
123 | enabled: antiAliasingCheckBox.checked | 123 | enabled: antiAliasingCheckBox.checked | ||
124 | } | 124 | } | ||
125 | 125 | | |||
126 | RowLayout { | 126 | RowLayout { | ||
127 | id: excludeField | 127 | id: excludeField | ||
128 | Layout.preferredWidth: formLayout.maxImplicitWidth | 128 | Layout.preferredWidth: formLayout.maxImplicitWidth | ||
129 | enabled: antiAliasingCheckBox.checked | 129 | enabled: antiAliasingCheckBox.checked | ||
130 | QtControls.SpinBox { | 130 | QtControls.SpinBox { | ||
131 | id: excludeFromSpinBox | 131 | id: excludeFromSpinBox | ||
132 | stepSize: 1 | 132 | stepSize: 1 | ||
133 | onValueChanged: kcm.fontAASettings.excludeFrom = value | 133 | onValueChanged: kcm.fontsAASettings.excludeFrom = value | ||
134 | textFromValue: function(value, locale) { return i18n("%1 pt", value)} | 134 | textFromValue: function(value, locale) { return i18n("%1 pt", value)} | ||
135 | valueFromText: function(text, locale) { return parseInt(text) } | 135 | valueFromText: function(text, locale) { return parseInt(text) } | ||
136 | editable: true | 136 | editable: true | ||
137 | enabled: excludeCheckBox.checked | 137 | enabled: excludeCheckBox.checked | ||
138 | value: kcm.fontsAASettings.excludeFrom | ||||
138 | } | 139 | } | ||
139 | 140 | | |||
140 | QtControls.Label { | 141 | QtControls.Label { | ||
141 | Layout.fillWidth: true | 142 | Layout.fillWidth: true | ||
142 | horizontalAlignment: Text.AlignHCenter | 143 | horizontalAlignment: Text.AlignHCenter | ||
143 | text: i18n("to") | 144 | text: i18n("to") | ||
144 | enabled: excludeCheckBox.checked | 145 | enabled: excludeCheckBox.checked | ||
145 | } | 146 | } | ||
146 | 147 | | |||
147 | QtControls.SpinBox { | 148 | QtControls.SpinBox { | ||
148 | id: excludeToSpinBox | 149 | id: excludeToSpinBox | ||
149 | stepSize: 1 | 150 | stepSize: 1 | ||
150 | onValueChanged: kcm.fontAASettings.excludeTo = value | 151 | onValueChanged: kcm.fontsAASettings.excludeTo = value | ||
151 | textFromValue: function(value, locale) { return i18n("%1 pt", value)} | 152 | textFromValue: function(value, locale) { return i18n("%1 pt", value)} | ||
152 | valueFromText: function(text, locale) { return parseInt(text) } | 153 | valueFromText: function(text, locale) { return parseInt(text) } | ||
153 | editable: true | 154 | editable: true | ||
154 | enabled: excludeCheckBox.checked | 155 | enabled: excludeCheckBox.checked | ||
156 | value: kcm.fontsAASettings.excludeTo | ||||
155 | } | 157 | } | ||
156 | Connections { | 158 | Connections { | ||
157 | target: kcm.fontAASettings | 159 | target: kcm.fontsAASettings | ||
158 | onExcludeFromChanged: excludeFromSpinBox.value = kcm.fontAASettings.excludeFrom; | 160 | onExcludeFromChanged: excludeFromSpinBox.value = kcm.fontsAASettings.excludeFrom; | ||
159 | onExcludeToChanged: excludeToSpinBox.value = kcm.fontAASettings.excludeTo; | 161 | onExcludeToChanged: excludeToSpinBox.value = kcm.fontsAASettings.excludeTo; | ||
160 | } | 162 | } | ||
161 | } | 163 | } | ||
162 | 164 | | |||
163 | QtControls.ComboBox { | 165 | QtControls.ComboBox { | ||
164 | id: subPixelCombo | 166 | id: subPixelCombo | ||
165 | Layout.preferredWidth: formLayout.maxImplicitWidth | 167 | Layout.preferredWidth: formLayout.maxImplicitWidth | ||
166 | Kirigami.FormData.label: i18nc("Used as a noun, and precedes a combobox full of options", "Sub-pixel rendering:") | 168 | Kirigami.FormData.label: i18nc("Used as a noun, and precedes a combobox full of options", "Sub-pixel rendering:") | ||
167 | currentIndex: kcm.fontAASettings.subPixelCurrentIndex | 169 | currentIndex: kcm.subPixelCurrentIndex | ||
168 | onCurrentIndexChanged: kcm.fontAASettings.subPixelCurrentIndex = currentIndex; | 170 | onCurrentIndexChanged: kcm.subPixelCurrentIndex = currentIndex; | ||
169 | model: kcm.fontAASettings.subPixelOptionsModel | 171 | model: kcm.subPixelOptionsModel | ||
170 | textRole: "display" | 172 | textRole: "display" | ||
171 | enabled: antiAliasingCheckBox.checked | 173 | enabled: antiAliasingCheckBox.checked | ||
172 | popup.height: popup.implicitHeight | 174 | popup.height: popup.implicitHeight | ||
173 | delegate: QtControls.ItemDelegate { | 175 | delegate: QtControls.ItemDelegate { | ||
174 | id: subPixelDelegate | 176 | id: subPixelDelegate | ||
175 | onWidthChanged: { | 177 | onWidthChanged: { | ||
176 | subPixelCombo.popup.width = Math.max(subPixelCombo.popup.width, width) | 178 | subPixelCombo.popup.width = Math.max(subPixelCombo.popup.width, width) | ||
177 | } | 179 | } | ||
178 | contentItem: ColumnLayout { | 180 | contentItem: ColumnLayout { | ||
179 | id: subPixelLayout | 181 | id: subPixelLayout | ||
180 | Kirigami.Heading { | 182 | Kirigami.Heading { | ||
181 | id: subPixelComboText | 183 | id: subPixelComboText | ||
182 | text: model.display | 184 | text: model.display | ||
183 | level: 5 | 185 | level: 5 | ||
184 | } | 186 | } | ||
185 | Image { | 187 | Image { | ||
186 | id: subPixelComboImage | 188 | id: subPixelComboImage | ||
187 | source: "image://preview/" + model.index + "_" + kcm.fontAASettings.hintingCurrentIndex + ".png" | 189 | source: "image://preview/" + model.index + "_" + kcm.hintingCurrentIndex + ".png" | ||
188 | // Setting sourceSize here is necessary as a workaround for QTBUG-38127 | 190 | // Setting sourceSize here is necessary as a workaround for QTBUG-38127 | ||
189 | // | 191 | // | ||
190 | // With this bug, images requested from a QQuickImageProvider have an incorrect scale with devicePixelRatio != 1 when sourceSize is not set. | 192 | // With this bug, images requested from a QQuickImageProvider have an incorrect scale with devicePixelRatio != 1 when sourceSize is not set. | ||
191 | // | 193 | // | ||
192 | // TODO: Check if QTBUG-38127 is fixed and remove the next two lines. | 194 | // TODO: Check if QTBUG-38127 is fixed and remove the next two lines. | ||
193 | sourceSize.width: 1 | 195 | sourceSize.width: 1 | ||
194 | sourceSize.height: 1 | 196 | sourceSize.height: 1 | ||
195 | } | 197 | } | ||
196 | } | 198 | } | ||
197 | } | 199 | } | ||
198 | } | 200 | } | ||
199 | 201 | | |||
200 | QtControls.ComboBox { | 202 | QtControls.ComboBox { | ||
201 | id: hintingCombo | 203 | id: hintingCombo | ||
202 | Layout.preferredWidth: formLayout.maxImplicitWidth | 204 | Layout.preferredWidth: formLayout.maxImplicitWidth | ||
203 | Kirigami.FormData.label: i18nc("Used as a noun, and precedes a combobox full of options", "Hinting:") | 205 | Kirigami.FormData.label: i18nc("Used as a noun, and precedes a combobox full of options", "Hinting:") | ||
204 | currentIndex: kcm.fontAASettings.hintingCurrentIndex | 206 | currentIndex: kcm.hintingCurrentIndex | ||
205 | onCurrentTextChanged: kcm.fontAASettings.hintingCurrentIndex = currentIndex; | 207 | onCurrentTextChanged: kcm.hintingCurrentIndex = currentIndex; | ||
206 | model: kcm.fontAASettings.hintingOptionsModel | 208 | model: kcm.hintingOptionsModel | ||
207 | textRole: "display" | 209 | textRole: "display" | ||
208 | enabled: antiAliasingCheckBox.checked | 210 | enabled: antiAliasingCheckBox.checked | ||
209 | popup.height: popup.implicitHeight | 211 | popup.height: popup.implicitHeight | ||
210 | delegate: QtControls.ItemDelegate { | 212 | delegate: QtControls.ItemDelegate { | ||
211 | id: hintingDelegate | 213 | id: hintingDelegate | ||
212 | onWidthChanged: { | 214 | onWidthChanged: { | ||
213 | hintingCombo.popup.width = Math.max(hintingCombo.popup.width, width) | 215 | hintingCombo.popup.width = Math.max(hintingCombo.popup.width, width) | ||
214 | } | 216 | } | ||
215 | contentItem: ColumnLayout { | 217 | contentItem: ColumnLayout { | ||
216 | id: hintingLayout | 218 | id: hintingLayout | ||
217 | Kirigami.Heading { | 219 | Kirigami.Heading { | ||
218 | id: hintingComboText | 220 | id: hintingComboText | ||
219 | text: model.display | 221 | text: model.display | ||
220 | level: 5 | 222 | level: 5 | ||
221 | } | 223 | } | ||
222 | Image { | 224 | Image { | ||
223 | id: hintingComboImage | 225 | id: hintingComboImage | ||
224 | source: "image://preview/" + kcm.fontAASettings.subPixelCurrentIndex + "_" + model.index + ".png" | 226 | source: "image://preview/" + kcm.subPixelCurrentIndex + "_" + model.index + ".png" | ||
225 | // Setting sourceSize here is necessary as a workaround for QTBUG-38127 | 227 | // Setting sourceSize here is necessary as a workaround for QTBUG-38127 | ||
226 | // | 228 | // | ||
227 | // With this bug, images requested from a QQuickImageProvider have an incorrect scale with devicePixelRatio != 1 when sourceSize is not set. | 229 | // With this bug, images requested from a QQuickImageProvider have an incorrect scale with devicePixelRatio != 1 when sourceSize is not set. | ||
228 | // | 230 | // | ||
229 | // TODO: Check if QTBUG-38127 is fixed and remove the next two lines. | 231 | // TODO: Check if QTBUG-38127 is fixed and remove the next two lines. | ||
230 | sourceSize.width: 1 | 232 | sourceSize.width: 1 | ||
231 | sourceSize.height: 1 | 233 | sourceSize.height: 1 | ||
232 | } | 234 | } | ||
233 | } | 235 | } | ||
234 | } | 236 | } | ||
235 | } | 237 | } | ||
236 | 238 | | |||
237 | RowLayout { | 239 | RowLayout { | ||
238 | QtControls.CheckBox { | 240 | QtControls.CheckBox { | ||
239 | id: dpiCheckBox | 241 | id: dpiCheckBox | ||
240 | checked: kcm.fontAASettings.dpi !== 0 | 242 | checked: kcm.fontsAASettings.dpi !== 0 | ||
usta: I am really away from qml thing but are you sure this one correct ? I mean isnt this should be… | |||||
bport: No dpi is declared inside fontsAASettings | |||||
241 | text: i18n("Force font DPI:") | 243 | text: i18n("Force font DPI:") | ||
242 | onClicked: kcm.fontAASettings.dpi = (checked ? dpiSpinBox.value : 0) | 244 | onClicked: kcm.fontsAASettings.dpi = (checked ? dpiSpinBox.value : 0) | ||
243 | } | 245 | } | ||
244 | 246 | | |||
245 | QtControls.SpinBox { | 247 | QtControls.SpinBox { | ||
246 | id: dpiSpinBox | 248 | id: dpiSpinBox | ||
247 | stepSize: 24 | 249 | stepSize: 24 | ||
248 | editable: true | 250 | editable: true | ||
249 | enabled: dpiCheckBox.checked | 251 | enabled: dpiCheckBox.checked | ||
250 | value: kcm.fontAASettings.dpi !== 0 ? kcm.fontAASettings.dpi : 96 | 252 | value: kcm.fontsAASettings.dpi !== 0 ? kcm.fontsAASettings.dpi : 96 | ||
251 | onValueModified: kcm.fontAASettings.dpi = value | 253 | onValueModified: kcm.fontsAASettings.dpi = value | ||
252 | // to: need to divide to stepSize | 254 | // to: need to divide to stepSize | ||
253 | to: 1008 | 255 | to: 1008 | ||
254 | // lowest vaue here can be == stepSize, that is because 0 means off | 256 | // lowest vaue here can be == stepSize, that is because 0 means off | ||
255 | from: 24 | 257 | from: 24 | ||
256 | } | 258 | } | ||
257 | } | 259 | } | ||
258 | 260 | | |||
259 | QtDialogs.FontDialog { | 261 | QtDialogs.FontDialog { | ||
Show All 16 Lines |
I am really away from qml thing but are you sure this one correct ? I mean isnt this should be
kcm.dpi instead of kcm.fontsAASettings.dpi ??