Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/package/contents/ui/main.qml
Show All 16 Lines | 1 | /* | |||
---|---|---|---|---|---|
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.1 | 21 | import QtQuick 2.1 | ||
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
23 | import QtQuick.Controls 2.0 as QtControls | 23 | import QtQuick.Controls 2.0 as QtControls | ||
24 | import QtQuick.Dialogs 1.2 as QtDialogs | 24 | import QtQuick.Dialogs 1.2 as QtDialogs | ||
25 | | ||||
26 | // For KCMShell.open() | ||||
27 | import org.kde.kquickcontrolsaddons 2.0 | ||||
25 | import org.kde.kirigami 2.4 as Kirigami | 28 | import org.kde.kirigami 2.4 as Kirigami | ||
26 | import org.kde.kcm 1.1 as KCM | 29 | import org.kde.kcm 1.1 as KCM | ||
27 | 30 | | |||
28 | KCM.SimpleKCM { | 31 | KCM.SimpleKCM { | ||
29 | id: root | 32 | id: root | ||
30 | 33 | | |||
31 | KCM.ConfigModule.quickHelp: i18n("This module lets you configure the system fonts.") | 34 | KCM.ConfigModule.quickHelp: i18n("This module lets you configure the system fonts.") | ||
32 | 35 | | |||
36 | property var kscreenAction: Kirigami.Action { | ||||
broulik: Why this as a `property`, not just an `Action` with an `id`? | |||||
37 | visible: KCMShell.authorize("kcm_kscreen.desktop").length > 0 | ||||
38 | text: i18n("Change Display Scaling...") | ||||
39 | iconName: "preferences-desktop-display" | ||||
40 | onTriggered: KCMShell.open("kcm_kscreen.desktop") | ||||
41 | } | ||||
42 | | ||||
33 | ColumnLayout { | 43 | ColumnLayout { | ||
34 | 44 | | |||
35 | Kirigami.InlineMessage { | 45 | Kirigami.InlineMessage { | ||
36 | id: antiAliasingMessage | 46 | id: antiAliasingMessage | ||
37 | Layout.fillWidth: true | 47 | Layout.fillWidth: true | ||
38 | showCloseButton: true | 48 | showCloseButton: true | ||
39 | text: i18n("Some changes such as anti-aliasing or DPI will only affect newly started applications.") | 49 | text: i18n("Some changes such as anti-aliasing or DPI will only affect newly started applications.") | ||
40 | 50 | | |||
41 | Connections { | 51 | Connections { | ||
42 | target: kcm | 52 | target: kcm | ||
43 | onAliasingChangeApplied: antiAliasingMessage.visible = true | 53 | onAliasingChangeApplied: antiAliasingMessage.visible = true | ||
44 | } | 54 | } | ||
45 | } | 55 | } | ||
46 | 56 | | |||
57 | Kirigami.InlineMessage { | ||||
58 | id: hugeFontsMessage | ||||
59 | Layout.fillWidth: true | ||||
60 | showCloseButton: true | ||||
61 | text: i18n("Very large fonts may produce odd-looking results. Consider adjusting the global screen scale instead of using a very large font size.") | ||||
62 | | ||||
63 | Connections { | ||||
64 | target: kcm | ||||
65 | onFontsHaveChanged: { | ||||
66 | if (generalFontWidget.font.pointSize > 14 | ||||
67 | || fixedWidthFontWidget.font.pointSize > 14 | ||||
68 | || smallFontWidget.font.pointSize > 14 | ||||
69 | || toolbarFontWidget.font.pointSize > 14 | ||||
70 | || menuFontWidget.font.pointSize > 18) { | ||||
broulik: Why 18 here? | |||||
71 | hugeFontsMessage.visible = true | ||||
You could also just bind visible to the boolean expression in the if: hugeFontsMessage.visible = foo || bar || baz || bla broulik: You could also just bind `visible` to the boolean expression in the if:
```
hugeFontsMessage. | |||||
72 | } else { | ||||
73 | hugeFontsMessage.visible = false | ||||
74 | } | ||||
75 | } | ||||
76 | } | ||||
77 | | ||||
78 | actions: [ kscreenAction ] | ||||
79 | } | ||||
80 | | ||||
81 | Kirigami.InlineMessage { | ||||
82 | id: dpiTwiddledMessage | ||||
83 | Layout.fillWidth: true | ||||
84 | showCloseButton: true | ||||
85 | text: i18n("The recommended way to scale the user interface is using the global screen scaling feature.") | ||||
86 | actions: [ kscreenAction ] | ||||
87 | } | ||||
88 | | ||||
47 | Kirigami.FormLayout { | 89 | Kirigami.FormLayout { | ||
48 | id: formLayout | 90 | id: formLayout | ||
49 | readonly property int maxImplicitWidth: Math.max(adjustAllFontsButton.implicitWidth, excludeField.implicitWidth, subPixelCombo.implicitWidth, hintingCombo.implicitWidth) | 91 | readonly property int maxImplicitWidth: Math.max(adjustAllFontsButton.implicitWidth, excludeField.implicitWidth, subPixelCombo.implicitWidth, hintingCombo.implicitWidth) | ||
50 | 92 | | |||
51 | QtControls.Button { | 93 | QtControls.Button { | ||
52 | id: adjustAllFontsButton | 94 | id: adjustAllFontsButton | ||
53 | Layout.preferredWidth: formLayout.maxImplicitWidth | 95 | Layout.preferredWidth: formLayout.maxImplicitWidth | ||
54 | icon.name: "font-select-symbolic" | 96 | icon.name: "font-select-symbolic" | ||
Show All 11 Lines | |||||
66 | FontWidget { | 108 | FontWidget { | ||
67 | id: generalFontWidget | 109 | id: generalFontWidget | ||
68 | label: i18n("General:") | 110 | label: i18n("General:") | ||
69 | category: "font" | 111 | category: "font" | ||
70 | font: kcm.fontsSettings.font | 112 | font: kcm.fontsSettings.font | ||
71 | enabled: !kcm.fontsSettings.isImmutable("font") | 113 | enabled: !kcm.fontsSettings.isImmutable("font") | ||
72 | } | 114 | } | ||
73 | FontWidget { | 115 | FontWidget { | ||
116 | id: fixedWidthFontWidget | ||||
74 | label: i18n("Fixed width:") | 117 | label: i18n("Fixed width:") | ||
75 | category: "fixed" | 118 | category: "fixed" | ||
76 | font: kcm.fontsSettings.fixed | 119 | font: kcm.fontsSettings.fixed | ||
77 | enabled: !kcm.fontsSettings.isImmutable("fixed") | 120 | enabled: !kcm.fontsSettings.isImmutable("fixed") | ||
78 | } | 121 | } | ||
79 | FontWidget { | 122 | FontWidget { | ||
123 | id: smallFontWidget | ||||
80 | label: i18n("Small:") | 124 | label: i18n("Small:") | ||
81 | category: "smallestReadableFont" | 125 | category: "smallestReadableFont" | ||
82 | font: kcm.fontsSettings.smallestReadableFont | 126 | font: kcm.fontsSettings.smallestReadableFont | ||
83 | enabled: !kcm.fontsSettings.isImmutable("smallestReadableFont") | 127 | enabled: !kcm.fontsSettings.isImmutable("smallestReadableFont") | ||
84 | } | 128 | } | ||
85 | FontWidget { | 129 | FontWidget { | ||
130 | id: toolbarFontWidget | ||||
86 | label: i18n("Toolbar:") | 131 | label: i18n("Toolbar:") | ||
87 | category: "toolBarFont" | 132 | category: "toolBarFont" | ||
88 | font: kcm.fontsSettings.toolBarFont | 133 | font: kcm.fontsSettings.toolBarFont | ||
89 | enabled: !kcm.fontsSettings.isImmutable("toolBarFont") | 134 | enabled: !kcm.fontsSettings.isImmutable("toolBarFont") | ||
90 | } | 135 | } | ||
91 | FontWidget { | 136 | FontWidget { | ||
137 | id: menuFontWidget | ||||
92 | label: i18n("Menu:") | 138 | label: i18n("Menu:") | ||
93 | category: "menuFont" | 139 | category: "menuFont" | ||
94 | font: kcm.fontsSettings.menuFont | 140 | font: kcm.fontsSettings.menuFont | ||
95 | enabled: !kcm.fontsSettings.isImmutable("menuFont") | 141 | enabled: !kcm.fontsSettings.isImmutable("menuFont") | ||
96 | } | 142 | } | ||
97 | FontWidget { | 143 | FontWidget { | ||
98 | label: i18n("Window title:") | 144 | label: i18n("Window title:") | ||
99 | category: "activeFont" | 145 | category: "activeFont" | ||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 248 | QtControls.ComboBox { | |||
236 | } | 282 | } | ||
237 | } | 283 | } | ||
238 | 284 | | |||
239 | RowLayout { | 285 | RowLayout { | ||
240 | QtControls.CheckBox { | 286 | QtControls.CheckBox { | ||
241 | id: dpiCheckBox | 287 | id: dpiCheckBox | ||
242 | checked: kcm.fontsAASettings.dpi !== 0 | 288 | checked: kcm.fontsAASettings.dpi !== 0 | ||
243 | text: i18n("Force font DPI:") | 289 | text: i18n("Force font DPI:") | ||
244 | onClicked: kcm.fontsAASettings.dpi = (checked ? dpiSpinBox.value : 0) | 290 | onClicked: { | ||
291 | kcm.fontsAASettings.dpi = checked ? dpiSpinBox.value : 0 | ||||
292 | dpiTwiddledMessage.visible = checked | ||||
293 | } | ||||
245 | } | 294 | } | ||
246 | 295 | | |||
247 | QtControls.SpinBox { | 296 | QtControls.SpinBox { | ||
248 | id: dpiSpinBox | 297 | id: dpiSpinBox | ||
249 | stepSize: 24 | 298 | stepSize: 24 | ||
250 | editable: true | 299 | editable: true | ||
251 | enabled: dpiCheckBox.checked | 300 | enabled: dpiCheckBox.checked | ||
252 | value: kcm.fontsAASettings.dpi !== 0 ? kcm.fontsAASettings.dpi : 96 | 301 | value: kcm.fontsAASettings.dpi !== 0 ? kcm.fontsAASettings.dpi : 96 | ||
Show All 25 Lines |
Why this as a property, not just an Action with an id?