2012-08-19 10:00:53 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#ifndef KWIN_USERACTIONS_H
|
|
|
|
#define KWIN_USERACTIONS_H
|
2013-12-12 13:17:26 +00:00
|
|
|
#include "ui_shortcutdialog.h"
|
2012-08-19 10:00:53 +00:00
|
|
|
|
2016-10-05 12:43:38 +00:00
|
|
|
#include <kwinglobals.h>
|
|
|
|
|
2013-04-25 15:21:54 +00:00
|
|
|
// Qt
|
2013-08-19 10:44:30 +00:00
|
|
|
#include <QDialog>
|
2012-08-19 10:00:53 +00:00
|
|
|
#include <QObject>
|
2019-08-10 07:57:32 +00:00
|
|
|
#include <QPointer>
|
2012-08-19 10:00:53 +00:00
|
|
|
|
|
|
|
class QAction;
|
|
|
|
class QRect;
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2015-03-06 10:33:51 +00:00
|
|
|
class AbstractClient;
|
2012-08-19 10:00:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Menu shown for a Client.
|
|
|
|
*
|
|
|
|
* The UserActionsMenu implements the Menu which is shown on:
|
|
|
|
* @li context-menu event on Window decoration
|
|
|
|
* @li window menu button
|
|
|
|
* @li Keyboard Shortcut (by default Alt+F3)
|
|
|
|
*
|
|
|
|
* The menu contains various window management related actions for the Client the menu is opened
|
|
|
|
* for, this is normally the active Client.
|
|
|
|
*
|
|
|
|
* The menu which is shown is tried to be as close as possible to the menu implemented in
|
|
|
|
* libtaskmanager, though there are differences as there are some actions only the window manager
|
|
|
|
* can provide and on the other hand the libtaskmanager cares also about things like e.g. grouping.
|
|
|
|
*
|
|
|
|
* Whenever the menu is changed it should be tried to also adjust the menu in libtaskmanager.
|
|
|
|
*
|
|
|
|
* @author Martin Gräßlin <mgraesslin@kde.org>
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-10-05 12:43:38 +00:00
|
|
|
class KWIN_EXPORT UserActionsMenu : public QObject
|
2012-08-19 10:00:53 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
explicit UserActionsMenu(QObject *parent = nullptr);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~UserActionsMenu() override;
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* Discards the constructed menu, so that it gets recreates
|
|
|
|
* on next show event.
|
|
|
|
* @see show
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void discard();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns Whether the menu is currently visible
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
bool isShown() const;
|
2015-09-22 12:44:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* grabs keyboard and mouse, workaround(?) for bug #351112
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-22 12:44:25 +00:00
|
|
|
void grabInput();
|
|
|
|
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* @returns Whether the menu has a Client set to operate on.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
bool hasClient() const;
|
|
|
|
/**
|
|
|
|
* Checks whether the given Client @p c is the Client
|
|
|
|
* for which the Menu is shown.
|
|
|
|
* @param c The Client to compare
|
|
|
|
* @returns Whether the Client is the one related to this Menu
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-06 10:33:51 +00:00
|
|
|
bool isMenuClient(const AbstractClient *c) const;
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* Closes the Menu and prepares it for next usage.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void close();
|
|
|
|
/**
|
|
|
|
* @brief Shows the menu at the given @p pos for the given @p client.
|
|
|
|
*
|
|
|
|
* @param pos The position where the menu should be shown.
|
|
|
|
* @param client The Client for which the Menu has to be shown.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-08-10 07:57:32 +00:00
|
|
|
void show(const QRect &pos, AbstractClient *client);
|
2012-08-19 10:00:53 +00:00
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
public Q_SLOTS:
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* Delayed initialization of the activity menu.
|
|
|
|
*
|
|
|
|
* The call to retrieve the current list of activities is performed in a thread and this
|
|
|
|
* slot is invoked once the list has been fetched. Only task of this method is to decide
|
|
|
|
* whether to show the activity menu and to invoke the initialization of it.
|
|
|
|
*
|
|
|
|
* @see initActivityPopup
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void showHideActivityMenu();
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
private Q_SLOTS:
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* The menu will become visible soon.
|
|
|
|
*
|
|
|
|
* Adjust the items according to the respective Client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void menuAboutToShow();
|
|
|
|
/**
|
|
|
|
* Adjusts the desktop popup to the current values and the location of
|
|
|
|
* the Client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void desktopPopupAboutToShow();
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* Adjusts the multipleDesktopsMenu popup to the current values and the location of
|
|
|
|
* the Client, Wayland only.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void multipleDesktopsPopupAboutToShow();
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* Adjusts the screen popup to the current values and the location of
|
|
|
|
* the Client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void screenPopupAboutToShow();
|
|
|
|
/**
|
|
|
|
* Adjusts the activity popup to the current values and the location of
|
|
|
|
* the Client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void activityPopupAboutToShow();
|
|
|
|
/**
|
|
|
|
* Sends the client to desktop \a desk
|
|
|
|
*
|
|
|
|
* @param action Invoked Action containing the Desktop as data element
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void slotSendToDesktop(QAction *action);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* Toggle whether the Client is on a desktop (Wayland only)
|
|
|
|
*
|
|
|
|
* @param action Invoked Action containing the Desktop as data element
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void slotToggleOnVirtualDesktop(QAction *action);
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* Sends the Client to screen \a screen
|
|
|
|
*
|
|
|
|
* @param action Invoked Action containing the Screen as data element
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void slotSendToScreen(QAction *action);
|
|
|
|
/**
|
|
|
|
* Toggles whether the Client is on the \a activity
|
|
|
|
*
|
|
|
|
* @param action Invoked Action containing the Id of the Activity to toggle the Client on
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void slotToggleOnActivity(QAction *action);
|
|
|
|
/**
|
|
|
|
* Performs a window operation.
|
|
|
|
*
|
|
|
|
* @param action Invoked Action containing the Window Operation to perform for the Client
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void slotWindowOperation(QAction *action);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Creates the menu if not already created.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void init();
|
|
|
|
/**
|
Make KWin action menu consistent with task manager, use action verbs for configure items and add more icons
Summary: {F7329676}
Test Plan: Open the context menu for a window (Alt+F3).
Reviewers: #kwin, #vdg, ndavis, davidedmundson
Reviewed By: #kwin, #vdg, ndavis, davidedmundson
Subscribers: davidedmundson, ndavis, #vdg, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23779
2019-09-07 22:07:20 +00:00
|
|
|
* Creates the Move to Desktop sub-menu.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void initDesktopPopup();
|
|
|
|
/**
|
Make KWin action menu consistent with task manager, use action verbs for configure items and add more icons
Summary: {F7329676}
Test Plan: Open the context menu for a window (Alt+F3).
Reviewers: #kwin, #vdg, ndavis, davidedmundson
Reviewed By: #kwin, #vdg, ndavis, davidedmundson
Subscribers: davidedmundson, ndavis, #vdg, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23779
2019-09-07 22:07:20 +00:00
|
|
|
* Creates the Move to Screen sub-menu.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void initScreenPopup();
|
|
|
|
/**
|
|
|
|
* Creates activity popup.
|
|
|
|
* I'm going with checkable ones instead of "copy to" and "move to" menus; I *think* it's an easier way.
|
|
|
|
* Oh, and an 'all' option too of course
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
void initActivityPopup();
|
|
|
|
/**
|
|
|
|
* Shows a helper Dialog to inform the user how to get back in case he triggered
|
|
|
|
* an action which hides the window decoration (e.g. NoBorder or Fullscreen).
|
|
|
|
* @param message The message type to be shown
|
|
|
|
* @param c The Client for which the dialog should be shown.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-08-10 07:57:32 +00:00
|
|
|
void helperDialog(const QString &message, AbstractClient *c);
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* The actual main context menu which is show when the UserActionsMenu is invoked.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
QMenu* m_menu;
|
|
|
|
/**
|
|
|
|
* The move to desktop sub menu.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
QMenu* m_desktopMenu;
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* The move to desktop sub menu, with the Wayland protocol.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
QMenu* m_multipleDesktopsMenu;
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* The move to screen sub menu.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
QMenu* m_screenMenu;
|
|
|
|
/**
|
|
|
|
* The activities sub menu.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
QMenu* m_activityMenu;
|
2012-08-31 11:28:31 +00:00
|
|
|
/**
|
|
|
|
* Menu for further entries added by scripts.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-31 11:28:31 +00:00
|
|
|
QMenu* m_scriptsMenu;
|
2012-08-19 10:00:53 +00:00
|
|
|
QAction* m_resizeOperation;
|
|
|
|
QAction* m_moveOperation;
|
|
|
|
QAction* m_maximizeOperation;
|
|
|
|
QAction* m_shadeOperation;
|
|
|
|
QAction* m_keepAboveOperation;
|
|
|
|
QAction* m_keepBelowOperation;
|
|
|
|
QAction* m_fullScreenOperation;
|
|
|
|
QAction* m_noBorderOperation;
|
|
|
|
QAction* m_minimizeOperation;
|
|
|
|
QAction* m_closeOperation;
|
2015-02-06 15:55:44 +00:00
|
|
|
QAction* m_shortcutOperation;
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* The Client for which the menu is shown.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-08-10 07:57:32 +00:00
|
|
|
QPointer<AbstractClient> m_client;
|
2018-02-16 19:55:06 +00:00
|
|
|
QAction *m_rulesOperation = nullptr;
|
|
|
|
QAction *m_applicationRulesOperation = nullptr;
|
2012-08-19 10:00:53 +00:00
|
|
|
};
|
2013-04-25 15:21:54 +00:00
|
|
|
|
|
|
|
class ShortcutDialog
|
2013-08-19 10:44:30 +00:00
|
|
|
: public QDialog
|
2013-04-25 15:21:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit ShortcutDialog(const QKeySequence& cut);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
void accept() override;
|
2013-04-25 15:21:54 +00:00
|
|
|
QKeySequence shortcut() const;
|
|
|
|
public Q_SLOTS:
|
2013-12-12 13:17:26 +00:00
|
|
|
void keySequenceChanged();
|
2013-07-22 14:07:39 +00:00
|
|
|
Q_SIGNALS:
|
2013-04-25 15:21:54 +00:00
|
|
|
void dialogDone(bool ok);
|
|
|
|
protected:
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
void done(int r) override;
|
2013-04-25 15:21:54 +00:00
|
|
|
private:
|
2013-12-12 13:17:26 +00:00
|
|
|
Ui::ShortcutDialog m_ui;
|
2013-04-25 15:21:54 +00:00
|
|
|
QKeySequence _shortcut;
|
|
|
|
};
|
|
|
|
|
2012-08-19 10:00:53 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif // KWIN_USERACTIONS_H
|