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
9 * @addtogroup CorePlugin Core Plugin
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
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>
42 struct CommandLocation
{
48 class UniqueIDManager
;
51 class ActionContainerPrivate
;
55 class ActionManagerPrivate
: public Core::ActionManager
{
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;
91 bool hasContext(QList
<int> context
) const;
92 Command
*registerOverridableAction(QAction
*action
, const QString
&id
,
95 static ActionManagerPrivate
*m_instance
;
96 QList
<int> m_defaultGroups
;
98 typedef QHash
<int, CommandPrivate
*> 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
114 #endif // ACTIONMANAGERPRIVATE_H