diff --git a/src/kcms/decoration/package/contents/ui/ConfigureTitlebar.qml b/src/kcms/decoration/package/contents/ui/ConfigureTitlebar.qml new file mode 100644 index 0000000000..1408544923 --- /dev/null +++ b/src/kcms/decoration/package/contents/ui/ConfigureTitlebar.qml @@ -0,0 +1,69 @@ +/* + SPDX-FileCopyrightText: 2019 Valerio Pilo + SPDX-FileCopyrightText: 2023 Joshua Goins + + SPDX-License-Identifier: LGPL-2.0-only +*/ + +import QtQuick 2.15 +import QtQuick.Layouts 1.15 +import QtQuick.Controls 2.15 as QQC2 + +import org.kde.kcm 1.6 as KCM +import org.kde.kirigami 2.20 as Kirigami + +KCM.AbstractKCM { + title: i18n("Titlebar Buttons") + + framedView: false + + Rectangle { + anchors.fill: parent + Kirigami.Theme.inherit: false + Kirigami.Theme.colorSet: Kirigami.Theme.View + color: Kirigami.Theme.backgroundColor + + Buttons { + anchors.fill: parent + anchors.margins: Kirigami.Units.largeSpacing + } + } + + footer: ColumnLayout { + QQC2.CheckBox { + id: closeOnDoubleClickOnMenuCheckBox + text: i18nc("checkbox label", "Close windows by double clicking the menu button") + checked: kcm.settings.closeOnDoubleClickOnMenu + onToggled: { + kcm.settings.closeOnDoubleClickOnMenu = checked; + infoLabel.visible = checked; + } + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "closeOnDoubleClickOnMenu" + } + } + + Kirigami.InlineMessage { + Layout.fillWidth: true + id: infoLabel + type: Kirigami.MessageType.Information + text: i18nc("popup tip", "Click and hold on the menu button to show the menu.") + showCloseButton: true + visible: false + } + + QQC2.CheckBox { + id: showToolTipsCheckBox + text: i18nc("checkbox label", "Show titlebar button tooltips") + checked: kcm.settings.showToolTips + onToggled: kcm.settings.showToolTips = checked + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "showToolTips" + } + } + } +} diff --git a/src/kcms/decoration/package/contents/ui/Themes.qml b/src/kcms/decoration/package/contents/ui/Themes.qml index 855b6b69c8..03c49b483f 100644 --- a/src/kcms/decoration/package/contents/ui/Themes.qml +++ b/src/kcms/decoration/package/contents/ui/Themes.qml @@ -26,6 +26,8 @@ KCM.GridView { view.implicitCellWidth: Kirigami.Units.gridUnit * 18 + framedView: false + view.delegate: KCM.GridDelegate { id: delegate text: model.display diff --git a/src/kcms/decoration/package/contents/ui/main.qml b/src/kcms/decoration/package/contents/ui/main.qml index 9c53d0cd8e..5290e48f30 100644 --- a/src/kcms/decoration/package/contents/ui/main.qml +++ b/src/kcms/decoration/package/contents/ui/main.qml @@ -1,5 +1,6 @@ /* SPDX-FileCopyrightText: 2019 Valerio Pilo + SPDX-FileCopyrightText: 2023 Joshua Goins SPDX-License-Identifier: LGPL-2.0-only */ @@ -12,166 +13,66 @@ import org.kde.kcm 1.6 as KCM import org.kde.kirigami 2.20 as Kirigami import org.kde.newstuff 1.85 as NewStuff -Kirigami.Page { +KCM.AbstractKCM { id: root KCM.ConfigModule.quickHelp: i18n("This module lets you configure the window decorations.") title: kcm.name - SystemPalette { - id: palette - colorGroup: SystemPalette.Active - } - - // To match SimpleKCM's borders of Page + headerParent/footerParent (also specified in raw pixels) - leftPadding: Kirigami.Settings.isMobile ? 0 : 8 - topPadding: leftPadding - rightPadding: leftPadding - bottomPadding: leftPadding + framedView: false implicitWidth: Kirigami.Units.gridUnit * 48 implicitHeight: Kirigami.Units.gridUnit * 33 - // TODO: replace this TabBar-plus-Frame-in-a-ColumnLayout with whatever shakes - // out of https://bugs.kde.org/show_bug.cgi?id=394296 - ColumnLayout { - id: tabLayout + Themes { + id: themes + anchors.fill: parent - spacing: 0 - QQC2.TabBar { - id: tabBar - // Tab styles generally assume that they're touching the inner layout, - // not the frame, so we need to move the tab bar down a pixel and make - // sure it's drawn on top of the frame - z: 1 - Layout.bottomMargin: -1 - Layout.fillWidth: true - QQC2.TabButton { - text: i18nc("tab label", "Theme") - } + KCM.SettingStateBinding { + target: themes + configObject: kcm.settings + settingName: "pluginName" + } + } - QQC2.TabButton { - text: i18nc("tab label", "Titlebar Buttons") + footer: RowLayout { + QQC2.Label { + text: i18nc("Selector label", "Window border size:") + } + + QQC2.ComboBox { + id: borderSizeComboBox + model: kcm.borderSizesModel + currentIndex: kcm.borderIndex + onActivated: kcm.borderIndex = currentIndex; + KCM.SettingHighlighter { + highlight: kcm.borderIndex !== 0 } } - QQC2.Frame { - Layout.fillWidth: true - Layout.fillHeight: true - // Note: StackLayout does not support neither anchor.margins, not Layout.margins properties. - StackLayout { - anchors.fill: parent - - currentIndex: tabBar.currentIndex - - ColumnLayout { - spacing: 0 - - Themes { - id: themes - - Layout.fillWidth: true - Layout.fillHeight: true - - KCM.SettingStateBinding { - target: themes - configObject: kcm.settings - settingName: "pluginName" - } - } - - RowLayout { - // default bottom padding of a Frame is fine. - Layout.topMargin: Kirigami.Units.smallSpacing - // no right margin is OK for button, but bad for text label on the left. - Layout.leftMargin: Kirigami.Units.smallSpacing - - QQC2.Label { - text: i18nc("Selector label", "Window border size:") - } - - QQC2.ComboBox { - id: borderSizeComboBox - model: kcm.borderSizesModel - currentIndex: kcm.borderIndex - onActivated: kcm.borderIndex = currentIndex; - KCM.SettingHighlighter { - highlight: kcm.borderIndex !== 0 - } - } - - Kirigami.ActionToolBar { - flat: false - alignment: Qt.AlignRight - actions: [ - NewStuff.Action { - text: i18nc("button text", "Get New Window Decorations...") - configFile: "window-decorations.knsrc" - onEntryEvent: (entry, event) => { - if (event === NewStuff.Engine.StatusChangedEvent) { - kcm.reloadKWinSettings(); - } else if (event === NewStuff.Engine.EntryAdoptedEvent) { - kcm.load(); - } - } - } - ] + Kirigami.ActionToolBar { + flat: false + alignment: Qt.AlignRight + actions: [ + Kirigami.Action { + text: i18nc("button text", "Configure Titlebar Buttons…") + icon.name: "configure" + onTriggered: kcm.push("ConfigureTitlebar.qml") + }, + NewStuff.Action { + text: i18nc("button text", "Get New Window Decorations…") + configFile: "window-decorations.knsrc" + onEntryEvent: (entry, event) => { + if (event === NewStuff.Engine.StatusChangedEvent) { + kcm.reloadKWinSettings(); + } else if (event === NewStuff.Engine.EntryAdoptedEvent) { + kcm.load(); } } } - - ColumnLayout { - spacing: 0 - - Buttons { - Layout.fillWidth: true - Layout.fillHeight: true - Layout.margins: Kirigami.Units.smallSpacing - } - - ColumnLayout { - Layout.margins: Kirigami.Units.smallSpacing - - QQC2.CheckBox { - id: closeOnDoubleClickOnMenuCheckBox - text: i18nc("checkbox label", "Close windows by double clicking the menu button") - checked: kcm.settings.closeOnDoubleClickOnMenu - onToggled: { - kcm.settings.closeOnDoubleClickOnMenu = checked; - infoLabel.visible = checked; - } - - KCM.SettingStateBinding { - configObject: kcm.settings - settingName: "closeOnDoubleClickOnMenu" - } - } - - Kirigami.InlineMessage { - Layout.fillWidth: true - id: infoLabel - type: Kirigami.MessageType.Information - text: i18nc("popup tip", "Click and hold on the menu button to show the menu.") - showCloseButton: true - visible: false - } - - QQC2.CheckBox { - id: showToolTipsCheckBox - text: i18nc("checkbox label", "Show titlebar button tooltips") - checked: kcm.settings.showToolTips - onToggled: kcm.settings.showToolTips = checked - - KCM.SettingStateBinding { - configObject: kcm.settings - settingName: "showToolTips" - } - } - } - } - } + ] } } }