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>
52 } // namespace Internal
54 class CORE_EXPORT ModeManager
: public QObject
{
58 ModeManager(Internal::MainWindow
*mainWindow
, MyTabWidget
*modeStack
);
61 static ModeManager
*instance()
66 IMode
*currentMode() const;
67 IMode
*mode(const QString
&id
) const;
69 void addAction(Command
*command
, int priority
, QMenu
*menu
= 0);
70 void addWidget(QWidget
*widget
);
71 void updateModeNameIcon(IMode
*mode
, const QIcon
&icon
, const QString
&label
);
72 QVector
<IMode
*> modes() const
76 void reorderModes(QMap
<QString
, int> priorities
);
79 void currentModeAboutToChange(Core::IMode
*mode
);
80 void currentModeChanged(Core::IMode
*mode
);
81 void newModeOrder(QVector
<IMode
*> modes
);
84 void activateMode(const QString
&id
);
85 void activateModeByWorkspaceName(const QString
&id
);
86 void setFocusToCurrentMode();
87 void triggerAction(const QString
&actionId
);
90 void objectAdded(QObject
*obj
);
91 void aboutToRemoveObject(QObject
*obj
);
92 void currentTabAboutToChange(int index
);
93 void currentTabChanged(int index
);
94 void updateModeToolTip();
95 void tabMoved(int from
, int to
);
98 int indexOf(const QString
&id
) const;
99 void setDefaultKeyshortcuts();
101 static ModeManager
*m_instance
;
102 Internal::MainWindow
*m_mainWindow
;
103 MyTabWidget
*m_modeStack
;
104 QMap
<Command
*, int> m_actions
;
105 QVector
<IMode
*> m_modes
;
106 QVector
<Command
*> m_modeShortcuts
;
107 QSignalMapper
*m_signalMapper
;
108 QList
<int> m_addedContexts
;
109 QList
<int> m_tabOrder
;
110 bool m_isReprioritizing
;
114 #endif // MODEMANAGER_H