LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / coreplugin / actionmanager / actionmanager_p.h
blob2c2f440bf7e76db358fa75723faf2b003e8d707b
1 /**
2 ******************************************************************************
4 * @file actionmanager_p.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @addtogroup GCSPlugins GCS Plugins
8 * @{
9 * @addtogroup CorePlugin Core Plugin
10 * @{
11 * @brief The Core GCS plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef ACTIONMANAGERPRIVATE_H
30 #define ACTIONMANAGERPRIVATE_H
32 #include <coreplugin/actionmanager/actionmanager.h>
34 #include <QtCore/QMap>
35 #include <QtCore/QHash>
36 #include <QtCore/QMultiHash>
38 QT_BEGIN_NAMESPACE
39 class QSettings;
40 QT_END_NAMESPACE
42 struct CommandLocation {
43 int m_container;
44 int m_position;
47 namespace Core {
48 class UniqueIDManager;
50 namespace Internal {
51 class ActionContainerPrivate;
52 class MainWindow;
53 class CommandPrivate;
55 class ActionManagerPrivate : public Core::ActionManager {
56 Q_OBJECT
58 public:
59 explicit ActionManagerPrivate(MainWindow *mainWnd);
60 ~ActionManagerPrivate();
62 void setContext(const QList<int> &context);
63 static ActionManagerPrivate *instance();
65 void saveSettings(QSettings *settings);
66 QList<int> defaultGroups() const;
68 QList<CommandPrivate *> commands() const;
69 QList<ActionContainerPrivate *> containers() const;
71 bool hasContext(int context) const;
73 Command *command(int uid) const;
74 ActionContainer *actionContainer(int uid) const;
76 void readSettings(QSettings *settings);
78 // ActionManager Interface
79 ActionContainer *createMenu(const QString &id);
80 ActionContainer *createMenuBar(const QString &id);
82 Command *registerAction(QAction *action, const QString &id,
83 const QList<int> &context);
84 Command *registerShortcut(QShortcut *shortcut, const QString &id,
85 const QList<int> &context);
87 Core::Command *command(const QString &id) const;
88 Core::ActionContainer *actionContainer(const QString &id) const;
90 private:
91 bool hasContext(QList<int> context) const;
92 Command *registerOverridableAction(QAction *action, const QString &id,
93 bool checkUnique);
95 static ActionManagerPrivate *m_instance;
96 QList<int> m_defaultGroups;
98 typedef QHash<int, CommandPrivate *> IdCmdMap;
99 IdCmdMap m_idCmdMap;
101 typedef QHash<int, ActionContainerPrivate *> IdContainerMap;
102 IdContainerMap m_idContainerMap;
104 // typedef QMap<int, int> GlobalGroupMap;
105 // GlobalGroupMap m_globalgroups;
107 QList<int> m_context;
109 MainWindow *m_mainWnd;
111 } // namespace Internal
112 } // namespace Core
114 #endif // ACTIONMANAGERPRIVATE_H