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 | * \class KStandardShortcut::StandardShortcutWatcher |
24 | * \inmodule KConfigGui |
25 | * |
26 | * Watches for changes made to standard shortcuts and notifies about those changes. |
27 | * \sa KStandardShortcut::shortcutWatcher |
28 | * \since 5.91 |
29 | */ |
30 | class KCONFIGGUI_EXPORT StandardShortcutWatcher : public QObject |
31 | { |
32 | Q_OBJECT |
33 | public: |
34 | ~StandardShortcutWatcher(); |
35 | Q_SIGNALS: |
36 | /*! |
37 | * The standardshortcut \a id was changed to \a shortcut |
38 | */ |
39 | void shortcutChanged(KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &shortcut); |
40 | |
41 | private: |
42 | KCONFIGGUI_NO_EXPORT explicit StandardShortcutWatcher(QObject *parent = nullptr); |
43 | |
44 | friend KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher(); |
45 | std::unique_ptr<StandardShortcutWatcherPrivate> d; |
46 | }; |
47 | |
48 | /*! |
49 | * Returns the global KStandardShortcutWatcher instance of this program. |
50 | * In addition to the notifying about changes it also keeps the information returned by the |
51 | * functions in KStandardShortcut up to date. |
52 | * The object is created by the first call to this function. |
53 | * \since 5.91 |
54 | * \relates KStandardShortcut::StandardShortcutWatcher |
55 | */ |
56 | KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher(); |
57 | } |
58 | |
59 | #endif |
60 | |