aboutsummaryrefslogtreecommitdiff
path: root/src/gui/kstandardshortcutwatcher.h
blob: b6584ccf96b154109fea53835fd78c3f6f31f24e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
    SPDX-FileCopyrightText: 2022 David Redondo <kde@david-redondo.de>

    SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#ifndef KSTANDARDSHORTCUTWATCHER_H
#define KSTANDARDSHORTCUTWATCHER_H

#include "kstandardshortcut.h"

#include <QObject>

#include <memory>

#include <kconfiggui_export.h>

namespace KStandardShortcut
{
class StandardShortcutWatcherPrivate;

/**
 * Watches for changes made to standard shortcuts and notifies about those changes.
 * @see KStandardShortcut::shortcutWatcher
 * @since 5.91
 */
class KCONFIGGUI_EXPORT StandardShortcutWatcher : public QObject
{
    Q_OBJECT
public:
    ~StandardShortcutWatcher();
Q_SIGNALS:
    /**
     * The standardshortcut @p id was changed to @p shortcut
     */
    void shortcutChanged(KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &shortcut);

private:
    explicit StandardShortcutWatcher(QObject *parent = nullptr);
    friend KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher();
    std::unique_ptr<StandardShortcutWatcherPrivate> d;
};

/**
 * Returns the global KStandardShortcutWatcher instance of this program.
 * In addition to the notifying about changes it also keeps the information returned by the
 * functions in @p KStandardShortcut up to date.
 * The object is created by the first call to this function.
 * @since 5.91
 */
KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher();
}

#endif