From 88c4de60fd0b0d5100a4af68ed660d702bfde770 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 12 May 2020 10:04:48 +0300 Subject: [PATCH] [kcmkwin/kwinoptions] Use text to describe maximize button actions Summary: Currently, we use icons to display possible maximize button actions. The problem with those icons is that they are confusing even for me, a person who knows kwin in and out. The size_all icon implies that if you click the maximize button, you'll be able to move the window around. Same goes with the size_ver and size_hor icons, they indicate that user will start resizing the window in the vertical and horizontal direction, respectively. Test Plan: Before {F8312394} After {F8312395} Reviewers: #kwin, #vdg, ndavis Reviewed By: #vdg, ndavis Subscribers: ngraham, ndavis, broulik, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D29671 --- kcmkwin/kwinoptions/mouse.cpp | 120 ---------------------------------- kcmkwin/kwinoptions/mouse.h | 7 -- kcmkwin/kwinoptions/mouse.ui | 63 +++++++++++++----- 3 files changed, 45 insertions(+), 145 deletions(-) diff --git a/kcmkwin/kwinoptions/mouse.cpp b/kcmkwin/kwinoptions/mouse.cpp index 22c8a30318..a1f0fc8103 100644 --- a/kcmkwin/kwinoptions/mouse.cpp +++ b/kcmkwin/kwinoptions/mouse.cpp @@ -19,100 +19,13 @@ #include "mouse.h" -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - #include -#include -#include #include #include #include "kwinoptions_settings.h" - -namespace -{ - -QPixmap maxButtonPixmaps[3]; - -void createMaxButtonPixmaps() -{ - char const *maxButtonXpms[][3 + 13] = { - { - nullptr, nullptr, nullptr, - "...............", - ".......#.......", - "......###......", - ".....#####.....", - "..#....#....#..", - ".##....#....##.", - "###############", - ".##....#....##.", - "..#....#....#..", - ".....#####.....", - "......###......", - ".......#.......", - "..............." - }, - { - nullptr, nullptr, nullptr, - "...............", - ".......#.......", - "......###......", - ".....#####.....", - ".......#.......", - ".......#.......", - ".......#.......", - ".......#.......", - ".......#.......", - ".....#####.....", - "......###......", - ".......#.......", - "..............." - }, - { - nullptr, nullptr, nullptr, - "...............", - "...............", - "...............", - "...............", - "..#.........#..", - ".##.........##.", - "###############", - ".##.........##.", - "..#.........#..", - "...............", - "...............", - "...............", - "..............." - }, - }; - - QByteArray baseColor(". c " + KColorScheme(QPalette::Active, KColorScheme::View).background().color().name().toLatin1()); - QByteArray textColor("# c " + KColorScheme(QPalette::Active, KColorScheme::View).foreground().color().name().toLatin1()); - for (int t = 0; t < 3; ++t) { - maxButtonXpms[t][0] = "15 13 2 1"; - maxButtonXpms[t][1] = baseColor.constData(); - maxButtonXpms[t][2] = textColor.constData(); - maxButtonPixmaps[t] = QPixmap(maxButtonXpms[t]); - maxButtonPixmaps[t].setMask(maxButtonPixmaps[t].createHeuristicMask()); - } -} - -} // namespace - KWinMouseConfigForm::KWinMouseConfigForm(QWidget *parent) : QWidget(parent) { @@ -125,45 +38,15 @@ KWinActionsConfigForm::KWinActionsConfigForm(QWidget *parent) setupUi(parent); } -void KTitleBarActionsConfig::paletteChanged() -{ - createMaxButtonPixmaps(); - for (int i=0; i<3; ++i) { - m_ui->kcfg_MaximizeButtonLeftClickCommand->setItemIcon(i, maxButtonPixmaps[i]); - m_ui->kcfg_MaximizeButtonMiddleClickCommand->setItemIcon(i, maxButtonPixmaps[i]); - m_ui->kcfg_MaximizeButtonRightClickCommand->setItemIcon(i, maxButtonPixmaps[i]); - } - -} - KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent) : KCModule(parent), standAlone(_standAlone) , m_ui(new KWinMouseConfigForm(this)) , m_settings(settings) { addConfig(m_settings, this); - - // create the items for the maximize button actions - createMaxButtonPixmaps(); - for (int i=0; i<3; ++i) { - m_ui->kcfg_MaximizeButtonLeftClickCommand->addItem(maxButtonPixmaps[i], QString()); - m_ui->kcfg_MaximizeButtonMiddleClickCommand->addItem(maxButtonPixmaps[i], QString()); - m_ui->kcfg_MaximizeButtonRightClickCommand->addItem(maxButtonPixmaps[i], QString()); - } - createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonLeftClickCommand); - createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonMiddleClickCommand); - createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonRightClickCommand); - load(); } -void KTitleBarActionsConfig::createMaximizeButtonTooltips(KComboBox *combo) -{ - combo->setItemData(0, i18n("Maximize"), Qt::ToolTipRole); - combo->setItemData(1, i18n("Maximize (vertical only)"), Qt::ToolTipRole); - combo->setItemData(2, i18n("Maximize (horizontal only)"), Qt::ToolTipRole); -} - void KTitleBarActionsConfig::showEvent(QShowEvent *ev) { if (!standAlone) { @@ -176,9 +59,6 @@ void KTitleBarActionsConfig::showEvent(QShowEvent *ev) void KTitleBarActionsConfig::changeEvent(QEvent *ev) { - if (ev->type() == QEvent::PaletteChange) { - paletteChanged(); - } ev->accept(); } diff --git a/kcmkwin/kwinoptions/mouse.h b/kcmkwin/kwinoptions/mouse.h index b6cf62a48d..8302e1b232 100644 --- a/kcmkwin/kwinoptions/mouse.h +++ b/kcmkwin/kwinoptions/mouse.h @@ -25,7 +25,6 @@ class KConfig; #include -#include #include #include "ui_actions.h" @@ -68,12 +67,6 @@ private: KWinMouseConfigForm *m_ui; KWinOptionsSettings *m_settings; - - void createMaximizeButtonTooltips(KComboBox* combo); - -private Q_SLOTS: - void paletteChanged(); - }; class KWindowActionsConfig : public KCModule diff --git a/kcmkwin/kwinoptions/mouse.ui b/kcmkwin/kwinoptions/mouse.ui index c600d313a9..da8ffcff52 100644 --- a/kcmkwin/kwinoptions/mouse.ui +++ b/kcmkwin/kwinoptions/mouse.ui @@ -607,15 +607,24 @@ - - - 0 - 0 - - Behavior on <em>left</em> click onto the maximize button. + + + Maximize + + + + + Maximize (vertical only) + + + + + Maximize (horizontal only) + + @@ -633,15 +642,24 @@ - - - 0 - 0 - - Behavior on <em>middle</em> click onto the maximize button. + + + Maximize + + + + + Maximize (vertical only) + + + + + Maximize (horizontal only) + + @@ -659,15 +677,24 @@ - - - 0 - 0 - - Behavior on <em>right</em> click onto the maximize button. + + + Maximize + + + + + Maximize (vertical only) + + + + + Maximize (horizontal only) + +