1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef ACTIONMANAGER_H
6#define ACTIONMANAGER_H
7
8#include "command.h"
9#include <QObject>
10#include <QHash>
11
12class ActionManagerPrivate;
13class ActionManager : public QObject
14{
15 Q_OBJECT
16public:
17 static ActionManager *getInstance();
18
19 Command *registerAction(QAction *action, const QString &id,
20 const QString &description = nullptr,
21 const QKeySequence defaultShortcut = QKeySequence(),
22 const QString &iconFileName = nullptr);
23 void unregisterAction(QString id);
24
25 Command *command(QString id);
26 QList<Command *> commands();
27
28 void readUserSetting();
29 void saveSetting();
30
31signals:
32
33private:
34 explicit ActionManager(QObject *parent = nullptr);
35 virtual ~ActionManager() override;
36
37 ActionManagerPrivate *const d;
38};
39
40#endif // ACTIONMANAGER_H
41