2 ******************************************************************************
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
32 #include <QtCore/QObject>
33 #include <QtCore/QList>
34 #include <QtCore/QMap>
35 #include <QtCore/QVector>
37 #include <coreplugin/core_global.h>
54 } // namespace Internal
56 class CORE_EXPORT ModeManager
: public QObject
{
60 ModeManager(Internal::MainWindow
*mainWindow
, MyTabWidget
*modeStack
);
63 static ModeManager
*instance()
68 IMode
*currentMode() const;
69 IMode
*mode(const QString
&id
) const;
71 void addAction(Command
*command
, int priority
, QMenu
*menu
= 0);
72 void addWidget(QWidget
*widget
);
73 void updateModeNameIcon(IMode
*mode
, const QIcon
&icon
, const QString
&label
);
74 QVector
<IMode
*> modes() const
78 void reorderModes(QMap
<QString
, int> priorities
);
81 void currentModeAboutToChange(Core::IMode
*mode
);
82 void currentModeChanged(Core::IMode
*mode
);
83 void newModeOrder(QVector
<IMode
*> modes
);
86 void activateMode(const QString
&id
);
87 void activateModeByWorkspaceName(const QString
&id
);
88 void setFocusToCurrentMode();
89 void triggerAction(const QString
&actionId
);
92 void objectAdded(QObject
*obj
);
93 void aboutToRemoveObject(QObject
*obj
);
94 void currentTabAboutToChange(int index
);
95 void currentTabChanged(int index
);
96 void updateModeToolTip();
97 void tabMoved(int from
, int to
);
100 int indexOf(const QString
&id
) const;
101 void setDefaultKeyshortcuts();
103 static ModeManager
*m_instance
;
104 Internal::MainWindow
*m_mainWindow
;
105 MyTabWidget
*m_modeStack
;
106 QMap
<Command
*, int> m_actions
;
107 QVector
<IMode
*> m_modes
;
108 QVector
<Command
*> m_modeShortcuts
;
109 QSignalMapper
*m_signalMapper
;
110 QList
<int> m_addedContexts
;
111 QList
<int> m_tabOrder
;
112 bool m_isReprioritizing
;
116 #endif // MODEMANAGER_H