blob: 6bb522a7d613fb17ac1290aeaa9edaf3b6bdd0a4 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "../core_global.h"
#include "../coreconstants.h"
#include "../icontext.h"
#include "command.h"
#include <QObject>
#include <QList>
QT_BEGIN_NAMESPACE
class QAction;
class QString;
QT_END_NAMESPACE
namespace Core {
class ActionContainer;
class Command;
class Context;
namespace Internal {
class CorePlugin;
class MainWindow;
} // Internal
class CORE_EXPORT ActionManager : public QObject
{
Q_OBJECT
public:
static ActionManager *instance();
static ActionContainer *createMenu(Utils::Id id);
static ActionContainer *createMenuBar(Utils::Id id);
static ActionContainer *createTouchBar(Utils::Id id,
const QIcon &icon,
const QString &text = QString());
static Command *registerAction(QAction *action, Utils::Id id,
const Context &context = Context(Constants::C_GLOBAL),
bool scriptable = false);
static Command *command(Utils::Id id);
static ActionContainer *actionContainer(Utils::Id id);
static QList<Command *> commands();
static void unregisterAction(QAction *action, Utils::Id id);
static void setPresentationModeEnabled(bool enabled);
static bool isPresentationModeEnabled();
static QString withNumberAccelerator(const QString &text, const int number);
signals:
void commandListChanged();
void commandAdded(Utils::Id id);
private:
ActionManager(QObject *parent = nullptr);
~ActionManager() override;
static void saveSettings();
static void setContext(const Context &context);
friend class Core::Internal::CorePlugin; // initialization
friend class Core::Internal::MainWindow; // saving settings and setting context
};
} // namespace Core
|