diff --git a/kcms/fonts/package/contents/ui/main.qml b/kcms/fonts/package/contents/ui/main.qml --- a/kcms/fonts/package/contents/ui/main.qml +++ b/kcms/fonts/package/contents/ui/main.qml @@ -31,16 +31,13 @@ Kirigami.FormLayout { id: formLayout - readonly property int maxImplicitWidth: Math.max(adjustAllFontsButton.implicitWidth, Math.max(antiAliasingComboBox.implicitWidth, Math.max(excludeField.implicitWidth, Math.max(subPixelCombo.implicitWidth, hintingCombo.implicitWidth)))) + readonly property int maxImplicitWidth: Math.max(adjustAllFontsButton.implicitWidth, subPixelCombo.implicitWidth, hintingCombo.implicitWidth) - QtControls.Button { - id: adjustAllFontsButton - Layout.preferredWidth: formLayout.maxImplicitWidth - text: i18n("&Adjust All Fonts...") - - onClicked: kcm.adjustAllFonts(); + Item { + Kirigami.FormData.label: i18n("System Fonts Selection") + Kirigami.FormData.isSection: true } - + FontWidget { id: generalFontWidget label: i18n("General:") @@ -73,71 +70,106 @@ font: kcm.windowTitleFont } - Kirigami.Separator { - Kirigami.FormData.isSection: true - } - - QtControls.ComboBox { - id: antiAliasingComboBox + QtControls.Button { + id: adjustAllFontsButton Layout.preferredWidth: formLayout.maxImplicitWidth - Kirigami.FormData.label: i18n("Use anti-aliasing:") - - model: [i18n("Enabled"), i18n("Vendor Default"), i18n("Disabled")] + text: i18n("&Adjust All Fonts...") - currentIndex: kcm.fontAASettings.antiAliasing - onCurrentIndexChanged: kcm.fontAASettings.antiAliasing = antiAliasingComboBox.currentIndex + onClicked: kcm.adjustAllFonts(); } - - QtControls.CheckBox { - id: excludeCheckBox - checked: kcm.fontAASettings.exclude - onCheckedChanged: kcm.fontAASettings.exclude = checked; - text: i18n("Exclude range from anti-aliasing") - Layout.fillWidth: true - enabled: antiAliasingComboBox.currentIndex == 0 + + // Add some space between the two sections + Item { + Kirigami.FormData.isSection: true + } + + Item { + Kirigami.FormData.label: i18n("Font Rendering") + Kirigami.FormData.isSection: true } + QtControls.ButtonGroup { + id: antiAliasingGroup + } + QtControls.RadioButton { + Kirigami.FormData.label: i18n("Anti-Aliasing:") + text: "Vendor Default" + QtControls.ButtonGroup.group: antiAliasingGroup + onCheckedChanged: { + if(checked) { + kcm.fontAASettings.antiAliasing = 1 + } + } + checked: kcm.fontAASettings.antiAliasing == 1 + } + QtControls.RadioButton { + text: "Enabled" + QtControls.ButtonGroup.group: antiAliasingGroup + onCheckedChanged: { + if(checked) { + kcm.fontAASettings.antiAliasing = 0 + } + } + checked: kcm.fontAASettings.antiAliasing == 0 + } RowLayout { - id: excludeField - Layout.preferredWidth: formLayout.maxImplicitWidth - enabled: antiAliasingComboBox.currentIndex == 0 + QtControls.RadioButton{ + id: excludeRadioButton + QtControls.ButtonGroup.group: antiAliasingGroup + text: "Disabled from " + onCheckedChanged: { + if(checked) { + kcm.fontAASettings.antiAliasing = 0 + } + kcm.fontAASettings.exclude = checked + } + checked: kcm.fontAASettings.antiAliasing == 0 + } QtControls.SpinBox { id: excludeFromSpinBox + enabled: excludeRadioButton.checked stepSize: 1 onValueChanged: kcm.fontAASettings.excludeFrom = value textFromValue: function(value, locale) { return i18n("%1 pt", value)} - enabled: excludeCheckBox.checked } - QtControls.Label { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter text: i18n("to") } - QtControls.SpinBox { id: excludeToSpinBox + enabled: excludeRadioButton.checked stepSize: 1 onValueChanged: kcm.fontAASettings.excludeTo = value textFromValue: function(value, locale) { return i18n("%1 pt", value)} - enabled: excludeCheckBox.checked } Connections { target: kcm.fontAASettings onExcludeFromChanged: excludeFromSpinBox.value = kcm.fontAASettings.excludeFrom; onExcludeToChanged: excludeToSpinBox.value = kcm.fontAASettings.excludeTo; } } + QtControls.RadioButton { + text: "Disabled" + QtControls.ButtonGroup.group: antiAliasingGroup + onCheckedChanged: { + if(checked) { + kcm.fontAASettings.antiAliasing = 2 + } + } + checked: kcm.fontAASettings.antiAliasing == 2 + } QtControls.ComboBox { id: subPixelCombo + enabled: kcm.fontAASettings.antiAliasing == 0 Layout.preferredWidth: formLayout.maxImplicitWidth Kirigami.FormData.label: i18n("Sub-pixel rendering type:") currentIndex: kcm.fontAASettings.subPixelCurrentIndex onCurrentIndexChanged: kcm.fontAASettings.subPixelCurrentIndex = currentIndex; model: kcm.fontAASettings.subPixelOptionsModel textRole: "display" - enabled: antiAliasingComboBox.currentIndex == 0 popup.height: popup.implicitHeight delegate: QtControls.ItemDelegate { id: subPixelDelegate @@ -168,13 +200,13 @@ QtControls.ComboBox { id: hintingCombo + enabled: kcm.fontAASettings.antiAliasing == 0 Layout.preferredWidth: formLayout.maxImplicitWidth Kirigami.FormData.label: i18n("Hinting style:") currentIndex: kcm.fontAASettings.hintingCurrentIndex onCurrentTextChanged: kcm.fontAASettings.hintingCurrentIndex = currentIndex; model: kcm.fontAASettings.hintingOptionsModel textRole: "display" - enabled: antiAliasingComboBox.currentIndex == 0 popup.height: popup.implicitHeight delegate: QtControls.ItemDelegate { id: hintingDelegate @@ -203,32 +235,47 @@ } } + QtControls.ButtonGroup { + id: dpiGroup + } + QtControls.RadioButton { + Kirigami.FormData.label: i18n("Fonts DPI:") + enabled: kcm.fontAASettings.antiAliasing == 0 + text: "Default" + QtControls.ButtonGroup.group: dpiGroup + onCheckedChanged: { + if(checked) { + kcm.fontAASettings.dpi = 96 + } + } + checked: kcm.fontAASettings.dpi == 96 + } RowLayout { - QtControls.CheckBox { - id: dpiCheckBox - checked: dpiSpinBox.value != 96 - text: i18n("Force Fonts DPI:") + enabled: kcm.fontAASettings.antiAliasing == 0 + QtControls.RadioButton { + id: forceDPIRadioButton + text: "Force to" + QtControls.ButtonGroup.group: dpiGroup onCheckedChanged: { - if (!dpiCheckBox.checked) { - dpiSpinBox.enabled = false; - kcm.fontAASettings.dpi = 0; - } else { - dpiSpinBox.enabled = true; + if(checked) { + kcm.fontAASettings.dpi = dpiSpinBox.value } } + checked: kcm.fontAASettings.dpi != 96 } - QtControls.SpinBox { id: dpiSpinBox + enabled: forceDPIRadioButton.checked + Kirigami.FormData.label: i18n("Force Fonts DPI:") stepSize: 24 - enabled: dpiCheckBox.checked value: kcm.fontAASettings.dpi onValueChanged: kcm.fontAASettings.dpi = dpiSpinBox.value + textFromValue: function(value, locale) { return i18n("%1 dpi", value)} to: 1000 from: 96 } } - + QtDialogs.FontDialog { id: fontDialog title: "Choose a font"