1 | /* |
2 | SPDX-FileCopyrightText: 2022 David Redondo <kde@david-redondo.de> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #ifndef KSTANDARDSHORTCUTWATCHER_H |
8 | #define KSTANDARDSHORTCUTWATCHER_H |
9 | |
10 | #include "kstandardshortcut.h" |
11 | |
12 | #include <QObject> |
13 | |
14 | #include <memory> |
15 | |
16 | #include <kconfiggui_export.h> |
17 | |
18 | namespace KStandardShortcut |
19 | { |
20 | class StandardShortcutWatcherPrivate; |
21 | |
22 | /** |
23 | * Watches for changes made to standard shortcuts and notifies about those changes. |
24 | * @see KStandardShortcut::shortcutWatcher |
25 | * @since 5.91 |
26 | */ |
27 | class KCONFIGGUI_EXPORT StandardShortcutWatcher : public QObject |
28 | { |
29 | Q_OBJECT |
30 | public: |
31 | ~StandardShortcutWatcher(); |
32 | Q_SIGNALS: |
33 | /** |
34 | * The standardshortcut @p id was changed to @p shortcut |
35 | */ |
36 | void shortcutChanged(KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &shortcut); |
37 | |
38 | private: |
39 | KCONFIGGUI_NO_EXPORT explicit StandardShortcutWatcher(QObject *parent = nullptr); |
40 | |
41 | friend KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher(); |
42 | std::unique_ptr<StandardShortcutWatcherPrivate> d; |
43 | }; |
44 | |
45 | /** |
46 | * Returns the global KStandardShortcutWatcher instance of this program. |
47 | * In addition to the notifying about changes it also keeps the information returned by the |
48 | * functions in @p KStandardShortcut up to date. |
49 | * The object is created by the first call to this function. |
50 | * @since 5.91 |
51 | */ |
52 | KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher(); |
53 | } |
54 | |
55 | #endif |
56 | |