diff options
Diffstat (limited to 'src/plugins')
96 files changed, 333 insertions, 345 deletions
diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 2793cf4095..cc42420356 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -319,7 +319,7 @@ public: QWidget *widget() { return m_editor; } - QList<int> context() const { return m_context; } + Core::Context context() const { return m_context; } bool createNew(const QString & /* contents */ = QString()) { m_editor->setData(QByteArray()); @@ -354,7 +354,7 @@ private: BinEditor *m_editor; QString m_displayName; BinEditorFile *m_file; - QList<int> m_context; + Core::Context m_context; QToolBar *m_toolBar; Utils::LineColumnLabel *m_cursorPositionLabel; }; diff --git a/src/plugins/bineditor/bineditorplugin.h b/src/plugins/bineditor/bineditorplugin.h index 634dbcada3..38ab9e503c 100644 --- a/src/plugins/bineditor/bineditorplugin.h +++ b/src/plugins/bineditor/bineditorplugin.h @@ -69,7 +69,7 @@ private slots: void updateCurrentEditor(Core::IContext *object); private: - QList<int> m_context; + Core::Context m_context; QAction *registerNewAction(const QString &id, const QString &title = QString()); QAction *registerNewAction(const QString &id, QObject *receiver, const char *slot, const QString &title = QString()); diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 62a23af069..c5221b34b8 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -303,7 +303,7 @@ BookmarkContext::BookmarkContext(BookmarkView *widget) m_context << UniqueIDManager::instance()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); } -QList<int> BookmarkContext::context() const +Context BookmarkContext::context() const { return m_context; } @@ -321,7 +321,7 @@ BookmarkManager::BookmarkManager() : m_bookmarkIcon(QLatin1String(":/bookmarks/images/bookmark.png")), m_selectionModel(new QItemSelectionModel(this, this)) { - connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*,QList<int>)), + connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*,Core::Context)), this, SLOT(updateActionStatus())); connect(ProjectExplorerPlugin::instance()->session(), SIGNAL(sessionLoaded()), diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index 1743ef97cb..489b3cd24e 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -161,11 +161,11 @@ class BookmarkContext : public Core::IContext { public: BookmarkContext(BookmarkView *widget); - virtual QList<int> context() const; + virtual Core::Context context() const; virtual QWidget *widget(); private: BookmarkView *m_bookmarkView; - QList<int> m_context; + Core::Context m_context; }; class BookmarkViewFactory : public Core::INavigationWidgetFactory diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index c604ca7088..94376fe345 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -69,13 +69,9 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) { Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); - - QList<int> context = QList<int>() << core->uniqueIDManager()-> - uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); - QList<int> textcontext, globalcontext; - textcontext << core->uniqueIDManager()-> - uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); - globalcontext << Core::Constants::C_GLOBAL_ID; + Core::UniqueIDManager *uidm = core->uniqueIDManager(); + Core::Context textcontext(uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR)); + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 9c6c927184..bb4fa19377 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -56,7 +56,7 @@ CMakeEditorEditable::CMakeEditorEditable(CMakeEditor *editor) m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); } -QList<int> CMakeEditorEditable::context() const +Core::Context CMakeEditorEditable::context() const { return m_context; } diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h index 6be2ba4b27..e28aecafb5 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.h +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h @@ -53,14 +53,14 @@ class CMakeEditorEditable : public TextEditor::BaseTextEditorEditable { public: CMakeEditorEditable(CMakeEditor *); - QList<int> context() const; + Core::Context context() const; bool duplicateSupported() const { return true; } Core::IEditor *duplicate(QWidget *parent); QString id() const; bool isTemporary() const { return false; } private: - QList<int> m_context; + Core::Context m_context; }; class CMakeEditor : public TextEditor::BaseTextEditor diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index ff219e117f..3f0a22a026 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -265,7 +265,7 @@ bool ActionManagerPrivate::hasContext(int context) const return m_context.contains(context); } -void ActionManagerPrivate::setContext(const QList<int> &context) +void ActionManagerPrivate::setContext(const Context &context) { // here are possibilities for speed optimization if necessary: // let commands (de-)register themselves for contexts @@ -276,9 +276,9 @@ void ActionManagerPrivate::setContext(const QList<int> &context) it.value()->setCurrentContext(m_context); } -bool ActionManagerPrivate::hasContext(QList<int> context) const +bool ActionManagerPrivate::hasContext(const Context &context) const { - for (int i=0; i<m_context.count(); ++i) { + for (int i = 0; i < m_context.count(); ++i) { if (context.contains(m_context.at(i))) return true; } @@ -321,7 +321,7 @@ ActionContainer *ActionManagerPrivate::createMenuBar(const QString &id) return mbc; } -Command *ActionManagerPrivate::registerAction(QAction *action, const QString &id, const QList<int> &context) +Command *ActionManagerPrivate::registerAction(QAction *action, const QString &id, const Context &context) { Action *a = 0; Command *c = registerOverridableAction(action, id, false); @@ -377,7 +377,7 @@ Command *ActionManagerPrivate::registerOverridableAction(QAction *action, const return a; } -Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) +Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QString &id, const Context &context) { Shortcut *sc = 0; int uid = UniqueIDManager::instance()->uniqueIdentifier(id); @@ -404,7 +404,7 @@ Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QStri sc->setShortcut(shortcut); if (context.isEmpty()) - sc->setContext(QList<int>() << 0); + sc->setContext(Context(0)); else sc->setContext(context); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.h b/src/plugins/coreplugin/actionmanager/actionmanager.h index bb205e93dc..05f4f782e8 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager.h @@ -45,6 +45,7 @@ namespace Core { class ActionContainer; class Command; +class Context; class CORE_EXPORT ActionManager : public QObject { @@ -56,8 +57,8 @@ public: virtual ActionContainer *createMenu(const QString &id) = 0; virtual ActionContainer *createMenuBar(const QString &id) = 0; - virtual Command *registerAction(QAction *action, const QString &id, const QList<int> &context) = 0; - virtual Command *registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) = 0; + virtual Command *registerAction(QAction *action, const QString &id, const Context &context) = 0; + virtual Command *registerShortcut(QShortcut *shortcut, const QString &id, const Context &context) = 0; virtual Command *command(const QString &id) const = 0; virtual ActionContainer *actionContainer(const QString &id) const = 0; diff --git a/src/plugins/coreplugin/actionmanager/actionmanager_p.h b/src/plugins/coreplugin/actionmanager/actionmanager_p.h index 7a183b6e26..41f746ba81 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager_p.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager_p.h @@ -31,6 +31,7 @@ #define ACTIONMANAGERPRIVATE_H #include <coreplugin/actionmanager/actionmanager.h> +#include <coreplugin/icontext.h> #include <QtCore/QMap> #include <QtCore/QHash> @@ -64,7 +65,7 @@ public: explicit ActionManagerPrivate(MainWindow *mainWnd); ~ActionManagerPrivate(); - void setContext(const QList<int> &context); + void setContext(const Context &context); static ActionManagerPrivate *instance(); void saveSettings(QSettings *settings); @@ -85,19 +86,19 @@ public: ActionContainer *createMenuBar(const QString &id); Command *registerAction(QAction *action, const QString &id, - const QList<int> &context); + const Context &context); Command *registerShortcut(QShortcut *shortcut, const QString &id, - const QList<int> &context); + const Context &context); Core::Command *command(const QString &id) const; Core::ActionContainer *actionContainer(const QString &id) const; private: - bool hasContext(QList<int> context) const; + bool hasContext(const Context &context) const; Command *registerOverridableAction(QAction *action, const QString &id, bool checkUnique); - static ActionManagerPrivate* m_instance; + static ActionManagerPrivate *m_instance; QList<int> m_defaultGroups; typedef QHash<int, CommandPrivate *> IdCmdMap; @@ -109,7 +110,7 @@ private: // typedef QMap<int, int> GlobalGroupMap; // GlobalGroupMap m_globalgroups; // - QList<int> m_context; + Context m_context; MainWindow *m_mainWnd; }; diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index 015f4f344c..d45cdcaa41 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -30,6 +30,7 @@ #include "command_p.h" #include "icore.h" +#include "icontext.h" #include "uniqueidmanager.h" #include <QtCore/QDebug> @@ -238,7 +239,7 @@ QShortcut *CommandPrivate::shortcut() const return 0; } -QList<int> CommandPrivate::context() const +Core::Context CommandPrivate::context() const { return m_context; } @@ -295,12 +296,12 @@ QShortcut *Shortcut::shortcut() const return m_shortcut; } -void Shortcut::setContext(const QList<int> &context) +void Shortcut::setContext(const Core::Context &context) { m_context = context; } -QList<int> Shortcut::context() const +Core::Context Shortcut::context() const { return m_context; } @@ -333,7 +334,7 @@ QString Shortcut::defaultText() const return m_defaultText; } -bool Shortcut::setCurrentContext(const QList<int> &context) +bool Shortcut::setCurrentContext(const Context &context) { foreach (int ctxt, m_context) { if (context.contains(ctxt)) { @@ -431,7 +432,7 @@ QKeySequence Action::keySequence() const return m_action->shortcut(); } -bool Action::setCurrentContext(const QList<int> &context) +bool Action::setCurrentContext(const Core::Context &context) { m_context = context; @@ -484,7 +485,7 @@ static inline QString msgActionWarning(QAction *newAction, int k, QAction *oldAc return msg; } -void Action::addOverrideAction(QAction *action, const QList<int> &context) +void Action::addOverrideAction(QAction *action, const Core::Context &context) { if (context.isEmpty()) { m_contextActionMap.insert(0, action); diff --git a/src/plugins/coreplugin/actionmanager/command.h b/src/plugins/coreplugin/actionmanager/command.h index 2d842b13f8..3e2b82aafe 100644 --- a/src/plugins/coreplugin/actionmanager/command.h +++ b/src/plugins/coreplugin/actionmanager/command.h @@ -43,6 +43,8 @@ QT_END_NAMESPACE namespace Core { +class Context; + class CORE_EXPORT Command : public QObject { Q_OBJECT @@ -65,7 +67,7 @@ public: virtual QAction *action() const = 0; virtual QShortcut *shortcut() const = 0; - virtual QList<int> context() const = 0; + virtual Context context() const = 0; virtual void setAttribute(CommandAttribute attr) = 0; virtual void removeAttribute(CommandAttribute attr) = 0; diff --git a/src/plugins/coreplugin/actionmanager/command_p.h b/src/plugins/coreplugin/actionmanager/command_p.h index 6c99cab2e9..12ed105afd 100644 --- a/src/plugins/coreplugin/actionmanager/command_p.h +++ b/src/plugins/coreplugin/actionmanager/command_p.h @@ -60,19 +60,19 @@ public: QAction *action() const; QShortcut *shortcut() const; - QList<int> context() const; + Context context() const; void setAttribute(CommandAttribute attr); void removeAttribute(CommandAttribute attr); bool hasAttribute(CommandAttribute attr) const; - virtual bool setCurrentContext(const QList<int> &context) = 0; + virtual bool setCurrentContext(const Context &context) = 0; QString stringWithAppendedShortcut(const QString &str) const; protected: - QList<int> m_context; + Context m_context; QString m_category; int m_attributes; int m_id; @@ -98,9 +98,9 @@ public: void setShortcut(QShortcut *shortcut); QShortcut *shortcut() const; - void setContext(const QList<int> &context); - QList<int> context() const; - bool setCurrentContext(const QList<int> &context); + void setContext(const Context &context); + Context context() const; + bool setCurrentContext(const Context &context); bool isActive() const; private: @@ -126,9 +126,9 @@ public: void setLocations(const QList<CommandLocation> &locations); QList<CommandLocation> locations() const; - bool setCurrentContext(const QList<int> &context); + bool setCurrentContext(const Context &context); bool isActive() const; - void addOverrideAction(QAction *action, const QList<int> &context); + void addOverrideAction(QAction *action, const Context &context); protected: void updateToolTipWithKeySequence(); diff --git a/src/plugins/coreplugin/basemode.h b/src/plugins/coreplugin/basemode.h index 8266931729..77ead779b8 100644 --- a/src/plugins/coreplugin/basemode.h +++ b/src/plugins/coreplugin/basemode.h @@ -58,7 +58,7 @@ public: int priority() const { return m_priority; } QWidget *widget() { return m_widget; } QString id() const { return m_id; } - QList<int> context() const { return m_context; } + Context context() const { return m_context; } QString contextHelpId() const { return m_helpId; } void setDisplayName(const QString &name) { m_displayName = name; } @@ -67,7 +67,7 @@ public: void setWidget(QWidget *widget) { m_widget = widget; } void setId(const QString &id) { m_id = id; } void setContextHelpId(const QString &helpId) { m_helpId = helpId; } - void setContext(const QList<int> &context) { m_context = context; } + void setContext(const Context &context) { m_context = context; } private: QString m_displayName; @@ -76,7 +76,7 @@ private: QWidget *m_widget; QString m_id; QString m_helpId; - QList<int> m_context; + Context m_context; }; } // namespace Core diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp index 99d76f3539..52614f6dad 100644 --- a/src/plugins/coreplugin/coreimpl.cpp +++ b/src/plugins/coreplugin/coreimpl.cpp @@ -191,7 +191,7 @@ QStatusBar *CoreImpl::statusBar() const return m_mainwindow->statusBar(); } -void CoreImpl::updateAdditionalContexts(const QList<int> &remove, const QList<int> &add) +void CoreImpl::updateAdditionalContexts(const Context &remove, const Context &add) { m_mainwindow->updateAdditionalContexts(remove, add); } diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h index efd971f3b6..4c2ee110b0 100644 --- a/src/plugins/coreplugin/coreimpl.h +++ b/src/plugins/coreplugin/coreimpl.h @@ -82,7 +82,7 @@ public: // Adds and removes additional active contexts, these contexts are appended // to the currently active contexts. - void updateAdditionalContexts(const QList<int> &remove, const QList<int> &add); + void updateAdditionalContexts(const Context &remove, const Context &add); bool hasContext(int context) const; void addContextObject(IContext *context); void removeContextObject(IContext *context); diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp index 211961662b..91fa3ee3f9 100644 --- a/src/plugins/coreplugin/designmode.cpp +++ b/src/plugins/coreplugin/designmode.cpp @@ -87,7 +87,7 @@ bool DesignModeCoreListener::coreAboutToClose() struct DesignEditorInfo { int widgetIndex; QStringList mimeTypes; - QList<int> context; + Context context; QWidget *widget; }; @@ -101,7 +101,7 @@ struct DesignModePrivate { EditorManager *m_editorManager; QStackedWidget *m_stackWidget; - QList<int> m_activeContext; + Context m_activeContext; }; DesignModePrivate::DesignModePrivate(DesignMode *q, EditorManager *editorManager) : @@ -134,10 +134,10 @@ DesignMode::~DesignMode() delete d; } -QList<int> DesignMode::context() const +Context DesignMode::context() const { - static QList<int> contexts = QList<int>() << - Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::C_DESIGN_MODE); + static Context contexts( + Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::C_DESIGN_MODE)); return contexts; } @@ -181,7 +181,7 @@ QStringList DesignMode::registeredMimeTypes() const */ void DesignMode::registerDesignWidget(QWidget *widget, const QStringList &mimeTypes, - const QList<int> &context) + const Context &context) { int index = d->m_stackWidget->addWidget(widget); @@ -235,7 +235,7 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor) disconnect(d->m_currentEditor.data(), SIGNAL(changed()), this, SLOT(updateActions())); if (!mimeEditorAvailable) { - setActiveContext(QList<int>()); + setActiveContext(Context()); if (core->modeManager()->currentMode() == this) core->modeManager()->activateMode(Core::Constants::MODE_EDIT); setEnabled(false); @@ -260,14 +260,14 @@ void DesignMode::updateContext(Core::IMode *newMode, Core::IMode *oldMode) { if (newMode == this) { // Apply active context - Core::ICore::instance()->updateAdditionalContexts(QList<int>(), d->m_activeContext); + Core::ICore::instance()->updateAdditionalContexts(Context(), d->m_activeContext); } else if (oldMode == this) { // Remove active context - Core::ICore::instance()->updateAdditionalContexts(d->m_activeContext, QList<int>()); + Core::ICore::instance()->updateAdditionalContexts(d->m_activeContext, Context()); } } -void DesignMode::setActiveContext(const QList<int> &context) +void DesignMode::setActiveContext(const Context &context) { if (d->m_activeContext == context) return; diff --git a/src/plugins/coreplugin/designmode.h b/src/plugins/coreplugin/designmode.h index 03da5f61de..6eee5e7782 100644 --- a/src/plugins/coreplugin/designmode.h +++ b/src/plugins/coreplugin/designmode.h @@ -59,13 +59,13 @@ public: void registerDesignWidget(QWidget *widget, const QStringList &mimeTypes, - const QList<int> &context); + const Context &context); void unregisterDesignWidget(QWidget *widget); QStringList registeredMimeTypes() const; // IContext - QList<int> context() const; + Context context() const; QWidget *widget(); // IMode @@ -83,7 +83,7 @@ private slots: void updateContext(Core::IMode *newMode, Core::IMode *oldMode); private: - void setActiveContext(const QList<int> &context); + void setActiveContext(const Context &context); DesignModePrivate *d; friend class Internal::DesignModeCoreListener; diff --git a/src/plugins/coreplugin/editmode.cpp b/src/plugins/coreplugin/editmode.cpp index be98bcb033..3b1d490695 100644 --- a/src/plugins/coreplugin/editmode.cpp +++ b/src/plugins/coreplugin/editmode.cpp @@ -115,12 +115,12 @@ QString EditMode::id() const return QLatin1String(Constants::MODE_EDIT); } -QList<int> EditMode::context() const +Context EditMode::context() const { - static QList<int> contexts = QList<int>() << - UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDIT_MODE) << - UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDITORMANAGER) << - UniqueIDManager::instance()->uniqueIdentifier(Constants::C_NAVIGATION_PANE); + static Context contexts( + UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDIT_MODE), + UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDITORMANAGER) , + UniqueIDManager::instance()->uniqueIdentifier(Constants::C_NAVIGATION_PANE)); return contexts; } diff --git a/src/plugins/coreplugin/editmode.h b/src/plugins/coreplugin/editmode.h index 82a10d1bcb..0e2900cd39 100644 --- a/src/plugins/coreplugin/editmode.h +++ b/src/plugins/coreplugin/editmode.h @@ -58,7 +58,7 @@ public: int priority() const; QWidget* widget(); QString id() const; - QList<int> context() const; + Context context() const; private slots: void grabEditorManager(Core::IMode *mode); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index dfbacfafb3..abf2674f84 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -250,7 +250,7 @@ EditorManager *EditorManager::m_instance = 0; static Command *createSeparator(ActionManager *am, QObject *parent, const QString &name, - const QList<int> &context) + const Context &context) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); @@ -267,14 +267,15 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) : connect(m_d->m_core, SIGNAL(contextAboutToChange(Core::IContext *)), this, SLOT(handleContextChange(Core::IContext *))); - const QList<int> gc = QList<int>() << Constants::C_GLOBAL_ID; - const QList<int> editManagerContext = - QList<int>() << m_d->m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER); + UniqueIDManager *uidm = m_d->m_core->uniqueIDManager(); + const Context gc = Context(Constants::C_GLOBAL_ID); + const Context editManagerContext = + Context(uidm->uniqueIdentifier(Constants::C_EDITORMANAGER)); // combined context for edit & design modes - const QList<int> editDesignContext = - QList<int>() << m_d->m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER) - << m_d->m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_DESIGN_MODE); + const Context editDesignContext = + Context(uidm->uniqueIdentifier(Constants::C_EDITORMANAGER), + uidm->uniqueIdentifier(Constants::C_DESIGN_MODE)); ActionManager *am = m_d->m_core->actionManager(); ActionContainer *mfile = am->actionContainer(Constants::M_FILE); diff --git a/src/plugins/coreplugin/icontext.h b/src/plugins/coreplugin/icontext.h index 95df4fb975..f7ea8ad5fd 100644 --- a/src/plugins/coreplugin/icontext.h +++ b/src/plugins/coreplugin/icontext.h @@ -39,6 +39,15 @@ QT_END_NAMESPACE namespace Core { +class CORE_EXPORT Context : public QList<int> +{ +public: + Context() {} + explicit Context(int c1) { append(c1); } + Context(int c1, int c2) { append(c1); append(c2); } + Context(int c1, int c2, int c3) { append(c1); append(c2); append(c3); } +}; + class CORE_EXPORT IContext : public QObject { Q_OBJECT @@ -46,7 +55,7 @@ public: IContext(QObject *parent = 0) : QObject(parent) {} virtual ~IContext() {} - virtual QList<int> context() const = 0; + virtual Context context() const = 0; virtual QWidget *widget() = 0; virtual QString contextHelpId() const { return QString(); } }; @@ -54,20 +63,20 @@ public: class BaseContext : public Core::IContext { public: - BaseContext(QWidget *widget, const QList<int> &context, QObject *parent = 0) + BaseContext(QWidget *widget, const Context &context, QObject *parent = 0) : Core::IContext(parent), m_widget(widget), m_context(context) { } - QList<int> context() const { return m_context; } + Context context() const { return m_context; } QWidget *widget() { return m_widget; } private: QWidget *m_widget; - QList<int> m_context; + Context m_context; }; } // namespace Core diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 4eb3c89718..0259efa960 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -48,6 +48,7 @@ QT_END_NAMESPACE namespace Core { class ActionManager; +class Context; class EditorManager; class FileManager; class HelpManager; @@ -111,7 +112,7 @@ public: virtual IContext *currentContextObject() const = 0; // Adds and removes additional active contexts, these contexts are appended // to the currently active contexts. - virtual void updateAdditionalContexts(const QList<int> &remove, const QList<int> &add) = 0; + virtual void updateAdditionalContexts(const Context &remove, const Context &add) = 0; virtual bool hasContext(int context) const = 0; virtual void addContextObject(IContext *context) = 0; virtual void removeContextObject(IContext *context) = 0; @@ -125,7 +126,7 @@ signals: void optionsDialogRequested(); void coreAboutToClose(); void contextAboutToChange(Core::IContext *context); - void contextChanged(Core::IContext *context, const QList<int> &additionalContexts); + void contextChanged(Core::IContext *context, const Core::Context &additionalContexts); }; } // namespace Core diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index fbbf028b3d..4306b2ecbb 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -112,7 +112,7 @@ MainWindow::MainWindow() : EventFilteringMainWindow(), m_coreImpl(new CoreImpl(this)), m_uniqueIDManager(new UniqueIDManager()), - m_globalContext(QList<int>() << Constants::C_GLOBAL_ID), + m_globalContext(Constants::C_GLOBAL_ID), m_additionalContexts(m_globalContext), // keep this in sync with main() in app/main.cpp m_settings(new QSettings(QSettings::IniFormat, QSettings::UserScope, @@ -493,7 +493,7 @@ void MainWindow::registerDefaultContainers() static Command *createSeparator(ActionManager *am, QObject *parent, const QString &name, - const QList<int> &context) + const Context &context) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); @@ -1196,7 +1196,7 @@ void MainWindow::writeSettings() m_navigationWidget->saveSettings(m_settings); } -void MainWindow::updateAdditionalContexts(const QList<int> &remove, const QList<int> &add) +void MainWindow::updateAdditionalContexts(const Context &remove, const Context &add) { foreach (const int context, remove) { if (context == 0) @@ -1225,14 +1225,14 @@ bool MainWindow::hasContext(int context) const void MainWindow::updateContext() { - QList<int> contexts; + Context contexts; if (m_activeContext) contexts += m_activeContext->context(); contexts += m_additionalContexts; - QList<int> uniquecontexts; + Context uniquecontexts; for (int i = 0; i < contexts.size(); ++i) { const int c = contexts.at(i); if (!uniquecontexts.contains(c)) diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 3b890439b0..43c5d625b1 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -31,6 +31,7 @@ #define MAINWINDOW_H #include "core_global.h" +#include "icontext.h" #include "dialogs/iwizard.h" #include "eventfilteringmainwindow.h" @@ -117,7 +118,7 @@ public: IContext * currentContextObject() const; QStatusBar *statusBar() const; - void updateAdditionalContexts(const QList<int> &remove, const QList<int> &add); + void updateAdditionalContexts(const Context &remove, const Context &add); bool hasContext(int context) const; void setSuppressNavigationWidget(bool suppress); @@ -178,8 +179,8 @@ private: CoreImpl *m_coreImpl; UniqueIDManager *m_uniqueIDManager; - QList<int> m_globalContext; - QList<int> m_additionalContexts; + Context m_globalContext; + Context m_additionalContexts; QSettings *m_settings; QSettings *m_globalSettings; SettingsDatabase *m_settingsDatabase; diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 702b00e1da..00edf5e083 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -57,7 +57,8 @@ namespace Core { -struct ModeManagerPrivate { +struct ModeManagerPrivate +{ explicit ModeManagerPrivate(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack, ModeManager *q); @@ -70,7 +71,7 @@ struct ModeManagerPrivate { QVector<IMode*> m_modes; QVector<Command*> m_modeShortcuts; QSignalMapper *m_signalMapper; - QList<int> m_addedContexts; + Context m_addedContexts; int m_oldCurrent; }; @@ -178,7 +179,7 @@ void ModeManager::objectAdded(QObject *obj) const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->id(); QShortcut *shortcut = new QShortcut(d->m_mainWindow); shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName())); - Command *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID); + Command *cmd = am->registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL_ID)); d->m_modeShortcuts.insert(index, cmd); connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip())); diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index df0bbf0b6b..bc23bdf18e 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -30,6 +30,7 @@ #include "navigationwidget.h" #include "icore.h" +#include "icontext.h" #include "coreconstants.h" #include "inavigationwidgetfactory.h" #include "modemanager.h" @@ -347,8 +348,8 @@ void NavigationWidget::objectAdded(QObject * obj) ICore *core = ICore::instance(); ActionManager *am = core->actionManager(); - QList<int> navicontext = QList<int>() << core->uniqueIDManager()-> - uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE); + Context navicontext(core->uniqueIDManager()-> + uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE)); QString id = factory->id(); QShortcut *shortcut = new QShortcut(this); diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index 6c0a43df97..42877e108e 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -282,8 +282,7 @@ void OutputPaneManager::init() { ActionManager *am = Core::ICore::instance()->actionManager(); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); - QList<int> globalcontext; - globalcontext.append(Core::Constants::C_GLOBAL_ID); + Context globalcontext = Context(Core::Constants::C_GLOBAL_ID); // Window->Output Panes ActionContainer *mpanes = am->createMenu(Constants::M_WINDOW_PANES); @@ -357,7 +356,7 @@ void OutputPaneManager::init() actionId.remove(QLatin1Char(' ')); QAction *action = new QAction(outPane->displayName(), this); - Command *cmd = am->registerAction(action, actionId, QList<int>() << Constants::C_GLOBAL_ID); + Command *cmd = am->registerAction(action, actionId, Context(Constants::C_GLOBAL_ID)); mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup"); m_actions.insert(cmd->action(), idx); diff --git a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp index ad6868a85f..b2566707ea 100644 --- a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp +++ b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp @@ -80,7 +80,7 @@ QSettings *CorePrototype::settings() const return callee()->settings(); } -void CorePrototype::updateAdditionalContexts(const QList<int> &remove, const QList<int> &add) +void CorePrototype::updateAdditionalContexts(const Context &remove, const Context &add) { callee()->updateAdditionalContexts(remove, add); } diff --git a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h index 46acca4cc5..dcfb808ea5 100644 --- a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h +++ b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h @@ -46,12 +46,12 @@ class CorePrototype : public QObject, public QScriptable { Q_OBJECT - Q_PROPERTY(Core::MessageManager* messageManager READ messageManager DESIGNABLE false SCRIPTABLE true STORED false) - Q_PROPERTY(Core::FileManager* fileManager READ fileManager DESIGNABLE false SCRIPTABLE true STORED false) - Q_PROPERTY(Core::EditorManager* editorManager READ editorManager DESIGNABLE false SCRIPTABLE true STORED false) + Q_PROPERTY(Core::MessageManager *messageManager READ messageManager DESIGNABLE false SCRIPTABLE true STORED false) + Q_PROPERTY(Core::FileManager *fileManager READ fileManager DESIGNABLE false SCRIPTABLE true STORED false) + Q_PROPERTY(Core::EditorManager *editorManager READ editorManager DESIGNABLE false SCRIPTABLE true STORED false) - Q_PROPERTY(QMainWindow* mainWindow READ mainWindow DESIGNABLE false SCRIPTABLE true STORED false) - Q_PROPERTY(QSettings* settings READ settings DESIGNABLE false SCRIPTABLE true STORED false) + Q_PROPERTY(QMainWindow *mainWindow READ mainWindow DESIGNABLE false SCRIPTABLE true STORED false) + Q_PROPERTY(QSettings *settings READ settings DESIGNABLE false SCRIPTABLE true STORED false) public: typedef Core::ICore ICore; @@ -66,7 +66,7 @@ public: QSettings *settings() const; public slots: - void updateAdditionalContexts(const QList<int> &remove, const QList<int> &add); + void updateAdditionalContexts(const Context &remove, const Context &add); QString toString() const; private: diff --git a/src/plugins/coreplugin/statusbarwidget.cpp b/src/plugins/coreplugin/statusbarwidget.cpp index ba28d13b98..f41fa11b1c 100644 --- a/src/plugins/coreplugin/statusbarwidget.cpp +++ b/src/plugins/coreplugin/statusbarwidget.cpp @@ -36,7 +36,7 @@ using namespace Core; StatusBarWidget::StatusBarWidget(QObject *parent) : IContext(parent), m_widget(0), - m_context(QList<int>()), + m_context(), m_defaultPosition(StatusBarWidget::First) { } @@ -46,7 +46,7 @@ StatusBarWidget::~StatusBarWidget() delete m_widget; } -QList<int> StatusBarWidget::context() const +Context StatusBarWidget::context() const { return m_context; } @@ -68,7 +68,7 @@ QWidget *StatusBarWidget::setWidget(QWidget *widget) return oldWidget; } -void StatusBarWidget::setContext(const QList<int> &context) +void StatusBarWidget::setContext(const Context &context) { m_context = context; } diff --git a/src/plugins/coreplugin/statusbarwidget.h b/src/plugins/coreplugin/statusbarwidget.h index e08b153d30..184d0bb35b 100644 --- a/src/plugins/coreplugin/statusbarwidget.h +++ b/src/plugins/coreplugin/statusbarwidget.h @@ -46,17 +46,17 @@ public: StatusBarWidget(QObject *parent = 0); ~StatusBarWidget(); - QList<int> context() const; + Context context() const; QWidget *widget(); StatusBarWidget::StatusBarPosition position() const; QWidget *setWidget(QWidget *widget); - void setContext(const QList<int> &context); + void setContext(const Context &context); void setPosition(StatusBarWidget::StatusBarPosition position); private: QPointer<QWidget> m_widget; - QList<int> m_context; + Context m_context; StatusBarWidget::StatusBarPosition m_defaultPosition; }; diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index 47cbf0091b..71011c738f 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -83,8 +83,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m Q_UNUSED(error_message) // Create the globalcontext list to register actions accordingly - QList<int> globalcontext; - globalcontext << UniqueIDManager::instance()->uniqueIdentifier(Core::Constants::C_GLOBAL); + Core::Context globalcontext(UniqueIDManager::instance()->uniqueIdentifier(Core::Constants::C_GLOBAL)); // Create the settings Page m_settings->fromSettings(Core::ICore::instance()->settings()); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index a078ee72ff..44d50edaca 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1724,7 +1724,7 @@ void CPPEditor::keyPressEvent(QKeyEvent *e) finishRename(); } -QList<int> CPPEditorEditable::context() const +Core::Context CPPEditorEditable::context() const { return m_context; } diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 044bc08510..3053aba12e 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -169,7 +169,7 @@ class CPPEditorEditable : public TextEditor::BaseTextEditorEditable Q_OBJECT public: CPPEditorEditable(CPPEditor *); - QList<int> context() const; + Core::Context context() const; bool duplicateSupported() const { return true; } Core::IEditor *duplicate(QWidget *parent); @@ -179,7 +179,7 @@ public: virtual bool open(const QString & fileName); private: - QList<int> m_context; + Core::Context m_context; }; class CPPEditor : public TextEditor::BaseTextEditor diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 6d0b7bbc41..52d71821dd 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -121,10 +121,10 @@ QStringList CppEditorFactory::mimeTypes() const ///////////////////////////////// CppPlugin ////////////////////////////////// static inline - Core::Command *createSeparator(Core::ActionManager *am, - QObject *parent, - const QList<int> &context, - const char *id) +Core::Command *createSeparator(Core::ActionManager *am, + QObject *parent, + Core::Context &context, + const char *id) { QAction *separator = new QAction(parent); separator->setSeparator(true); @@ -231,8 +231,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess wizardParameters.setId(QLatin1String("C.Header")); addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core)); - QList<int> context; - context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); + Core::Context context(core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR)); Core::ActionManager *am = core->actionManager(); Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); @@ -274,8 +273,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cppToolsMenu->addAction(cmd); // Update context in global context - QList<int> globalContext; - globalContext.append(Core::Constants::C_GLOBAL_ID); + Core::Context globalContext(Core::Constants::C_GLOBAL_ID); cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR2)); m_updateCodeModelAction = new QAction(tr("Update Code Model"), this); cmd = am->registerAction(m_updateCodeModelAction, QLatin1String(Constants::UPDATE_CODEMODEL), globalContext); diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 61173c8e5f..b06cb5743a 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -132,7 +132,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) // Actions m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); - QList<int> context = QList<int>() << m_context; + Core::Context context(m_context); QAction *switchAction = new QAction(tr("Switch Header/Source"), this); Core::Command *command = am->registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context); diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index a5b2fba5a2..2542157d75 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -204,8 +204,8 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { static inline Core::Command *createSeparator(QObject *parent, Core::ActionManager *ami, - const char*id, - const QList<int> &globalcontext) + const char *id, + const Core::Context &globalcontext) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); @@ -257,8 +257,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes toolsContainer->addMenu(cvsMenu); m_menuAction = cvsMenu->menu()->menuAction(); - QList<int> globalcontext; - globalcontext << core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); + Core::Context globalcontext(core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL)); Core::Command *command; @@ -380,7 +379,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes m_commandLocator->appendCommand(command); // Actions of the submit editor - QList<int> cvscommitcontext; + Core::Context cvscommitcontext; cvscommitcontext << Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::CVSCOMMITEDITOR); m_submitCurrentLogAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 146e27e391..2b5eac0538 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -72,6 +72,7 @@ #include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/findplaceholder.h> +#include <coreplugin/icontext.h> #include <coreplugin/icore.h> #include <coreplugin/icorelistener.h> #include <coreplugin/manhattanstyle.h> @@ -877,7 +878,7 @@ public: QString m_previousMode; TextEditor::BaseTextMark *m_locationMark; - int m_gdbRunningContext; + Core::Context m_gdbRunningContext; AttachRemoteParameters m_attachRemoteParameters; QAction *m_startExternalAction; @@ -968,7 +969,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) m_sessionEngine = 0; m_debugMode = 0; m_locationMark = 0; - m_gdbRunningContext = 0; + m_gdbRunningContext = Core::Context(0); m_debugMode = 0; m_uiSwitcher = 0; @@ -987,20 +988,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er Core::ActionManager *am = core->actionManager(); QTC_ASSERT(am, return false); - const QList<int> globalcontext = QList<int>() - << CC::C_GLOBAL_ID; - - const QList<int> cppcontext = QList<int>() - << uidm->uniqueIdentifier(PE::LANG_CXX); - - const QList<int> cppDebuggercontext = QList<int>() - << uidm->uniqueIdentifier(C_CPPDEBUGGER); - - const QList<int> cppeditorcontext = QList<int>() - << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); - - const QList<int> texteditorcontext = QList<int>() - << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); + const Core::Context globalcontext(CC::C_GLOBAL_ID); + const Core::Context cppDebuggercontext(uidm->uniqueIdentifier(C_CPPDEBUGGER)); + const Core::Context cppeditorcontext(uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR)); m_stopIcon = QIcon(_(":/debugger/images/debugger_stop_small.png")); m_stopIcon.addFile(":/debugger/images/debugger_stop.png"); @@ -1218,18 +1208,17 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er errorMessage->clear(); } - m_gdbRunningContext = uidm->uniqueIdentifier(Constants::GDBRUNNING); + m_gdbRunningContext = Core::Context(uidm->uniqueIdentifier(Constants::GDBRUNNING)); // Register factory of DebuggerRunControl. m_debuggerRunControlFactory = new DebuggerRunControlFactory (m_plugin, DebuggerEngineType(cmdLineEnabledEngines)); m_plugin->addAutoReleasedObject(m_debuggerRunControlFactory); - QList<int> context; - context.append(uidm->uniqueIdentifier(CC::C_EDITORMANAGER)); - context.append(uidm->uniqueIdentifier(C_DEBUGMODE)); - context.append(uidm->uniqueIdentifier(CC::C_NAVIGATION_PANE)); - m_debugMode->setContext(context); + m_debugMode->setContext(Core::Context( + uidm->uniqueIdentifier(CC::C_EDITORMANAGER), + uidm->uniqueIdentifier(C_DEBUGMODE), + uidm->uniqueIdentifier(CC::C_NAVIGATION_PANE))); m_reverseToolButton = 0; @@ -1271,7 +1260,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er am->actionContainer(PE::M_DEBUG_STARTDEBUGGING); cmd = am->registerAction(m_actions.continueAction, - PE::DEBUG, QList<int>() << m_gdbRunningContext); + PE::DEBUG, m_gdbRunningContext); mstart->addAction(cmd, CC::G_DEFAULT_ONE); cmd = am->registerAction(m_startExternalAction, @@ -2096,9 +2085,9 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) const bool startIsContinue = (m_state == InferiorStopped); ICore *core = ICore::instance(); if (startIsContinue) - core->updateAdditionalContexts(QList<int>(), QList<int>() << m_gdbRunningContext); + core->updateAdditionalContexts(Core::Context(), m_gdbRunningContext); else - core->updateAdditionalContexts(QList<int>() << m_gdbRunningContext, QList<int>()); + core->updateAdditionalContexts(m_gdbRunningContext, Core::Context()); const bool started = m_state == InferiorRunning || m_state == InferiorRunningRequested diff --git a/src/plugins/debugger/debuggeruiswitcher.cpp b/src/plugins/debugger/debuggeruiswitcher.cpp index bfa3b8f6a1..f5b05cab17 100644 --- a/src/plugins/debugger/debuggeruiswitcher.cpp +++ b/src/plugins/debugger/debuggeruiswitcher.cpp @@ -87,9 +87,9 @@ struct DebuggerUISwitcherPrivate Internal::DebuggerMainWindow *m_mainWindow; // global context - QList<int> m_globalContext; + Core::Context m_globalContext; - QHash<int, QList<int> > m_contextsForLanguage; + QHash<int, Core::Context> m_contextsForLanguage; QActionGroup *m_languageActionGroup; @@ -213,9 +213,7 @@ void DebuggerUISwitcher::createViewsMenuItems() { Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); - - QList<int> globalcontext; - globalcontext << Core::Constants::C_GLOBAL_ID; + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); QMenu *mLang = d->m_languageMenu->menu(); mLang->setTitle(tr("&Languages")); @@ -237,7 +235,7 @@ DebuggerUISwitcher *DebuggerUISwitcher::instance() return DebuggerUISwitcherPrivate::m_instance; } -void DebuggerUISwitcher::addLanguage(const QString &langName, const QList<int> &context) +void DebuggerUISwitcher::addLanguage(const QString &langName, const Core::Context &context) { //qDebug() << "ADD UI LANGUAGE: " << langName; d->m_toolBars.insert(langName, 0); @@ -310,8 +308,8 @@ void DebuggerUISwitcher::changeDebuggerUI(const QString &langName) QHashIterator<int, Core::Command *> iter(d->m_menuCommands); Core::ICore *core = Core::ICore::instance(); - const QList<int> &oldContexts = d->m_contextsForLanguage.value(d->m_activeLanguage); - const QList<int> &newContexts = d->m_contextsForLanguage.value(langId); + const Core::Context &oldContexts = d->m_contextsForLanguage.value(d->m_activeLanguage); + const Core::Context &newContexts = d->m_contextsForLanguage.value(langId); core->updateAdditionalContexts(oldContexts, newContexts); d->m_activeLanguage = langId; @@ -401,7 +399,7 @@ QDockWidget *DebuggerUISwitcher::createDockWidget(const QString &langName, if (d->m_languages.indexOf(langName) != d->m_activeLanguage) dockWidget->hide(); - QList<int> langContext = d->m_contextsForLanguage.value(d->m_languages.indexOf(langName)); + Core::Context langContext = d->m_contextsForLanguage.value(d->m_languages.indexOf(langName)); Core::ActionManager *am = Core::ICore::instance()->actionManager(); QAction *action = dockWidget->toggleViewAction(); diff --git a/src/plugins/debugger/debuggeruiswitcher.h b/src/plugins/debugger/debuggeruiswitcher.h index 52a4e1cb3a..ef6c669aa7 100644 --- a/src/plugins/debugger/debuggeruiswitcher.h +++ b/src/plugins/debugger/debuggeruiswitcher.h @@ -33,13 +33,14 @@ #include "debugger_global.h" #include <QtCore/QObject> +#include <QtCore/QMultiHash> QT_FORWARD_DECLARE_CLASS(QDockWidget); -#include <QtCore/QMultiHash> namespace Core { class ActionContainer; class Command; + class Context; class BaseMode; class IMode; } @@ -68,7 +69,7 @@ public: static DebuggerUISwitcher *instance(); // debuggable languages are registered with this function. - void addLanguage(const QString &langName, const QList<int> &context); + void addLanguage(const QString &langName, const Core::Context &context); // debugger toolbars are registered with this function void setToolbar(const QString &langName, QWidget *widget); diff --git a/src/plugins/designer/designercontext.cpp b/src/plugins/designer/designercontext.cpp index 7e28f1df68..d614982e38 100644 --- a/src/plugins/designer/designercontext.cpp +++ b/src/plugins/designer/designercontext.cpp @@ -43,7 +43,7 @@ enum { debug = 0 }; namespace Designer { namespace Internal { -DesignerContext::DesignerContext(const QList<int> contexts, +DesignerContext::DesignerContext(const Core::Context &contexts, QWidget *widget, QObject *parent) : Core::IContext(parent), @@ -52,7 +52,7 @@ DesignerContext::DesignerContext(const QList<int> contexts, { } -QList<int> DesignerContext::context() const +Core::Context DesignerContext::context() const { return m_context; } diff --git a/src/plugins/designer/designercontext.h b/src/plugins/designer/designercontext.h index 4b0a0827c3..fea80eac0b 100644 --- a/src/plugins/designer/designercontext.h +++ b/src/plugins/designer/designercontext.h @@ -44,16 +44,16 @@ class DesignerContext : public Core::IContext { Q_DISABLE_COPY(DesignerContext) public: - explicit DesignerContext(const QList<int> contexts, + explicit DesignerContext(const Core::Context &contexts, QWidget *widget, QObject *parent = 0); - virtual QList<int> context() const; + virtual Core::Context context() const; virtual QWidget *widget(); virtual QString contextHelpId() const; private: - const QList<int> m_context; + const Core::Context m_context; QWidget *m_widget; }; diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 54779835b5..492f0c420c 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -119,7 +119,7 @@ static inline QIcon designerIcon(const QString &iconName) // Create a menu separator static inline QAction *createSeparator(QObject *parent, Core::ActionManager *am, - const QList<int> &context, + const Core::Context &context, Core::ActionContainer *container, const QString &name = QString(), const QString &group = QString()) @@ -220,7 +220,7 @@ FormEditorW::~FormEditorW() // Add an actioon to toggle the view state of a dock window void FormEditorW::addDockViewAction(Core::ActionManager *am, Core::ActionContainer *viewMenu, - int index, const QList<int> &context, + int index, const Core::Context &context, const QString &title, const QString &id) { if (const QDockWidget *dw = m_editorWidget->designerDockWidgets()[index]) { @@ -334,7 +334,9 @@ void FormEditorW::fullInit() Core::UniqueIDManager *idMan = Core::UniqueIDManager::instance(); int editorManagerContext = idMan->uniqueIdentifier(QLatin1String(Core::Constants::C_EDITORMANAGER)); - m_context = new DesignerContext(QList<int>() << m_contexts << editorManagerContext, m_modeWidget, this); + Core::Context designerContexts = m_contexts; + designerContexts.append(Core::Context(editorManagerContext)); + m_context = new DesignerContext(designerContexts, m_modeWidget, this); m_core->addContextObject(m_context); m_designMode->registerDesignWidget(m_modeWidget, QStringList(QLatin1String(FORM_MIMETYPE)), m_contexts); @@ -625,7 +627,7 @@ void FormEditorW::bindShortcut(Core::Command *command, QAction *action) // Create an action to activate a designer tool QAction *FormEditorW::createEditModeAction(QActionGroup *ag, - const QList<int> &context, + const Core::Context &context, Core::ActionManager *am, Core::ActionContainer *medit, const QString &actionName, @@ -651,7 +653,7 @@ QAction *FormEditorW::createEditModeAction(QActionGroup *ag, // Create a tool action Core::Command *FormEditorW::addToolAction(QAction *a, Core::ActionManager *am, - const QList<int> &context, const QString &name, + const Core::Context &context, const QString &name, Core::ActionContainer *c1, const QString &keySequence) { Core::Command *command = am->registerAction(a, name, context); diff --git a/src/plugins/designer/formeditorw.h b/src/plugins/designer/formeditorw.h index b2627a1c6b..09f9e011b3 100644 --- a/src/plugins/designer/formeditorw.h +++ b/src/plugins/designer/formeditorw.h @@ -30,11 +30,13 @@ #ifndef FORMEDITORW_H #define FORMEDITORW_H +#include "designerconstants.h" + +#include "coreplugin/icontext.h" + +#include <QtCore/QMap> #include <QtCore/QObject> #include <QtCore/QStringList> -#include <QtCore/QMap> - -#include "designerconstants.h" QT_BEGIN_NAMESPACE @@ -136,11 +138,11 @@ private: void setupActions(); void setupViewActions(); - inline void addDockViewAction(Core::ActionManager *am, - Core::ActionContainer *viewMenu, - int index, - const QList<int> &context, - const QString &title, const QString &id); + void addDockViewAction(Core::ActionManager *am, + Core::ActionContainer *viewMenu, + int index, + const Core::Context &context, + const QString &title, const QString &id); Core::ActionContainer *createPreviewStyleMenu(Core::ActionManager *am, QActionGroup *actionGroup); @@ -148,7 +150,7 @@ private: void critical(const QString &errorMessage); void bindShortcut(Core::Command *command, QAction *action); QAction *createEditModeAction(QActionGroup *ag, - const QList<int> &context, + const Core::Context &context, Core::ActionManager *am, Core::ActionContainer *medit, const QString &actionName, @@ -157,7 +159,7 @@ private: const QString &iconName = QString(), const QString &keySequence = QString()); Core::Command *addToolAction(QAction *a, Core::ActionManager *am, - const QList<int> &context, const QString &name, + const Core::Context &context, const QString &name, Core::ActionContainer *c1, const QString &keySequence = QString()); QToolBar *createEditorToolBar() const; @@ -184,7 +186,7 @@ private: QSignalMapper *m_shortcutMapper; DesignerContext *m_context; - QList<int> m_contexts; + Core::Context m_contexts; QStringList m_toolActionIds; QWidget *m_modeWidget; diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index 76d606a9a2..dc1487f259 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -53,13 +53,14 @@ namespace Designer { -struct FormWindowEditorPrivate { +struct FormWindowEditorPrivate +{ explicit FormWindowEditorPrivate(Internal::DesignerXmlEditor *editor, QDesignerFormWindowInterface *form); TextEditor::PlainTextEditorEditable m_textEditable; Internal::FormWindowFile m_file; - QList<int> m_context; + Core::Context m_context; }; FormWindowEditorPrivate::FormWindowEditorPrivate(Internal::DesignerXmlEditor *editor, @@ -221,7 +222,7 @@ bool FormWindowEditor::restoreState(const QByteArray &state) return d->m_textEditable.restoreState(state); } -QList<int> FormWindowEditor::context() const +Core::Context FormWindowEditor::context() const { return d->m_context; } diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h index d432189d29..08380fc5af 100644 --- a/src/plugins/designer/formwindoweditor.h +++ b/src/plugins/designer/formwindoweditor.h @@ -91,7 +91,7 @@ public: virtual QString preferredMode() const; // IContext - virtual QList<int> context() const; + virtual Core::Context context() const; virtual QWidget *widget(); // For uic code model support diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index f080c15f16..41a6188578 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -587,8 +587,7 @@ bool FakeVimPluginPrivate::initialize() Core::ActionManager *actionManager = Core::ICore::instance()->actionManager(); QTC_ASSERT(actionManager, return false); - QList<int> globalcontext; - globalcontext << Core::Constants::C_GLOBAL_ID; + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); m_fakeVimOptionsPage = new FakeVimOptionPage; q->addObject(m_fakeVimOptionsPage); diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp index 65aaebb2ea..3f2c51263e 100644 --- a/src/plugins/find/findplugin.cpp +++ b/src/plugins/find/findplugin.cpp @@ -41,6 +41,7 @@ #include <coreplugin/actionmanager/command.h> #include <coreplugin/coreconstants.h> #include <coreplugin/icore.h> +#include <coreplugin/icontext.h> #include <extensionsystem/pluginmanager.h> @@ -191,7 +192,7 @@ void FindPlugin::setupMenu() mfind->appendGroup(Constants::G_FIND_FILTERS); mfind->appendGroup(Constants::G_FIND_FLAGS); mfind->appendGroup(Constants::G_FIND_ACTIONS); - QList<int> globalcontext = QList<int>() << Core::Constants::C_GLOBAL_ID; + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); Core::Command *cmd; QAction *separator; separator = new QAction(this); @@ -219,7 +220,7 @@ void FindPlugin::setupFilterMenuItems() QList<IFindFilter*> findInterfaces = ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); Core::Command *cmd; - QList<int> globalcontext = QList<int>() << Core::Constants::C_GLOBAL_ID; + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); Core::ActionContainer *mfindadvanced = am->actionContainer(Constants::M_FIND_ADVANCED); d->m_filterActions.clear(); diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 3c70e3ae01..baca9e7e3c 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -32,6 +32,7 @@ #include "textfindconstants.h" #include <coreplugin/coreconstants.h> +#include <coreplugin/icontext.h> #include <coreplugin/icore.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actioncontainer.h> @@ -129,10 +130,8 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen // need to make sure QStringList is registered as metatype QMetaTypeId<QStringList>::qt_metatype_id(); - //register actions - QList<int> globalcontext; - globalcontext << Core::Constants::C_GLOBAL_ID; - + // register actions + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); Core::ActionManager *am = Core::ICore::instance()->actionManager(); Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND); Core::Command *cmd; diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp index 264265be6d..2db56b5007 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp @@ -111,7 +111,7 @@ ProjectFilesEditable::ProjectFilesEditable(ProjectFilesEditor *editor) ProjectFilesEditable::~ProjectFilesEditable() { } -QList<int> ProjectFilesEditable::context() const +Core::Context ProjectFilesEditable::context() const { return m_context; } diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.h b/src/plugins/genericprojectmanager/genericprojectfileseditor.h index 6345cf8438..bcca374f1f 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.h +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.h @@ -79,7 +79,7 @@ public: ProjectFilesEditable(ProjectFilesEditor *editor); virtual ~ProjectFilesEditable(); - virtual QList<int> context() const; + virtual Core::Context context() const; virtual QString id() const; virtual bool duplicateSupported() const; @@ -88,7 +88,7 @@ public: virtual bool isTemporary() const { return false; } private: - QList<int> m_context; + Core::Context m_context; }; class ProjectFilesEditor: public TextEditor::BaseTextEditor diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 941d8d49a7..60d2636b4c 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -174,7 +174,7 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { }; static Core::Command *createSeparator(Core::ActionManager *am, - const QList<int> &context, + const Core::Context &context, const QString &id, QObject *parent) { @@ -187,7 +187,7 @@ static Core::Command *createSeparator(Core::ActionManager *am, ParameterActionCommandPair GitPlugin::createParameterAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, - const QString &id, const QList<int> &context, + const QString &id, const Core::Context &context, bool addToLocator) { Utils::ParameterAction *action = new Utils::ParameterAction(defaultText, parameterText, @@ -205,7 +205,7 @@ ParameterActionCommandPair ParameterActionCommandPair GitPlugin::createFileAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, - const QString &id, const QList<int> &context, bool addToLocator, + const QString &id, const Core::Context &context, bool addToLocator, const char *pluginSlot) { const ParameterActionCommandPair rc = createParameterAction(am, ac, defaultText, parameterText, id, context, addToLocator); @@ -218,7 +218,7 @@ ParameterActionCommandPair ParameterActionCommandPair GitPlugin::createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, - const QString &id, const QList<int> &context, bool addToLocator, + const QString &id, const Core::Context &context, bool addToLocator, const char *pluginSlot) { const ParameterActionCommandPair rc = createParameterAction(am, ac, defaultText, parameterText, id, context, addToLocator); @@ -231,7 +231,7 @@ ParameterActionCommandPair ActionCommandPair GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &text, const QString &id, - const QList<int> &context, bool addToLocator) + const Core::Context &context, bool addToLocator) { QAction *action = new QAction(text, this); Core::Command *command = am->registerAction(action, id, context); @@ -246,7 +246,7 @@ ActionCommandPair ActionCommandPair GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &text, const QString &id, - const QList<int> &context, bool addToLocator, + const Core::Context &context, bool addToLocator, const char *pluginSlot) { const ActionCommandPair rc = createRepositoryAction(am, ac, text, id, context, addToLocator); @@ -259,7 +259,7 @@ ActionCommandPair ActionCommandPair GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &text, const QString &id, - const QList<int> &context, bool addToLocator, + const Core::Context &context, bool addToLocator, GitClientMemberFunc func) { // Set the member func as data and connect to generic slot @@ -282,7 +282,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_core = Core::ICore::instance(); m_gitClient = new GitClient(this); // Create the globalcontext list to register actions accordingly - QList<int> globalcontext; + Core::Context globalcontext; globalcontext << m_core->uniqueIDManager()->uniqueIdentifier(Core::Constants::C_GLOBAL); // Create the settings Page @@ -493,7 +493,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) } // Submit editor - QList<int> submitContext; + Core::Context submitContext; submitContext.push_back(m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::C_GITSUBMITEDITOR))); m_submitCurrentAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this); Core::Command *command = actionManager->registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 676362cc69..4f317e33ec 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -53,6 +53,7 @@ namespace Core { class IEditorFactory; class ICore; class Command; +class Context; class ActionManager; class ActionContainer; } @@ -135,36 +136,36 @@ private: inline ParameterActionCommandPair createParameterAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, - const QString &id, const QList<int> &context, bool addToLocator); + const QString &id, const Core::Context &context, bool addToLocator); inline ParameterActionCommandPair createFileAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, - const QString &id, const QList<int> &context, bool addToLocator, + const QString &id, const Core::Context &context, bool addToLocator, const char *pluginSlot); inline ParameterActionCommandPair createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, - const QString &id, const QList<int> &context, bool addToLocator); + const QString &id, const Core::Context &context, bool addToLocator); inline ParameterActionCommandPair createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, - const QString &id, const QList<int> &context, bool addToLocator, + const QString &id, const Core::Context &context, bool addToLocator, const char *pluginSlot); inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &text, const QString &id, - const QList<int> &context, bool addToLocator); + const Core::Context &context, bool addToLocator); inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &text, const QString &id, - const QList<int> &context, + const Core::Context &context, bool addToLocator, const char *pluginSlot); inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, const QString &text, const QString &id, - const QList<int> &context, + const Core::Context &context, bool addToLocator, GitClientMemberFunc); bool isCommitEditorOpen() const; diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 57c7e769ac..4fca676f65 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -120,10 +120,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) Q_UNUSED(arguments) Q_UNUSED(error) m_core = Core::ICore::instance(); - QList<int> globalcontext; - globalcontext << Core::Constants::C_GLOBAL_ID; - QList<int> modecontext; - modecontext << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_MODE_HELP); + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); + Core::Context modecontext(m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_MODE_HELP)); const QString &locale = qApp->property("qtc_locale").toString(); if (!locale.isEmpty()) { @@ -304,7 +302,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) this, SLOT(modeChanged(Core::IMode*))); addAutoReleasedObject(m_mode = new HelpMode(m_splitter, m_centralWidget)); - m_mode->setContext(QList<int>() << modecontext); + m_mode->setContext(modecontext); return true; } @@ -343,9 +341,8 @@ void HelpPlugin::aboutToShutdown() void HelpPlugin::setupUi() { // side bar widgets and shortcuts - QList<int> modecontext; Core::ActionManager *am = m_core->actionManager(); - modecontext << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_MODE_HELP); + Core::Context modecontext(m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_MODE_HELP)); IndexWindow *indexWindow = new IndexWindow(); indexWindow->setWindowTitle(tr(SB_INDEX)); @@ -523,12 +520,12 @@ void HelpPlugin::createRightPaneContextViewer() Aggregation::Aggregate *agg = new Aggregation::Aggregate(); agg->add(m_helpViewerForSideBar); agg->add(new HelpViewerFindSupport(m_helpViewerForSideBar)); - m_core->addContextObject(new Core::BaseContext(m_helpViewerForSideBar, QList<int>() - << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_HELP_SIDEBAR), this)); + m_core->addContextObject(new Core::BaseContext(m_helpViewerForSideBar,Core::Context( + m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_HELP_SIDEBAR)), this)); QAction *copy = new QAction(this); Core::Command *cmd = m_core->actionManager()->registerAction(copy, Core::Constants::COPY, - QList<int>() << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_HELP_SIDEBAR)); + Core::Context(m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_HELP_SIDEBAR))); copy->setText(cmd->action()->text()); copy->setIcon(cmd->action()->icon()); diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp index 74ee25a110..ec4485c130 100644 --- a/src/plugins/imageviewer/imageviewer.cpp +++ b/src/plugins/imageviewer/imageviewer.cpp @@ -51,7 +51,7 @@ namespace Internal { struct ImageViewerPrivate { - QList<int> context; + Core::Context context; QString displayName; ImageViewerFile *file; ImageView *imageView; @@ -109,7 +109,7 @@ ImageViewer::~ImageViewer() delete d_ptr->toolbar; } -QList<int> ImageViewer::context() const +Core::Context ImageViewer::context() const { return d_ptr->context; } diff --git a/src/plugins/imageviewer/imageviewer.h b/src/plugins/imageviewer/imageviewer.h index cb68a67e5b..903a21170a 100644 --- a/src/plugins/imageviewer/imageviewer.h +++ b/src/plugins/imageviewer/imageviewer.h @@ -52,7 +52,7 @@ public: explicit ImageViewer(QWidget *parent = 0); ~ImageViewer(); - QList<int> context() const; + Core::Context context() const; QWidget *widget(); bool createNew(const QString &contents = QString()); diff --git a/src/plugins/imageviewer/imagevieweractionhandler.cpp b/src/plugins/imageviewer/imagevieweractionhandler.cpp index 2aa15e4910..39c9f8a9be 100644 --- a/src/plugins/imageviewer/imagevieweractionhandler.cpp +++ b/src/plugins/imageviewer/imagevieweractionhandler.cpp @@ -57,7 +57,7 @@ struct ImageViewerActionHandlerPrivate QPointer<QAction> actionBackground; QPointer<QAction> actionOutline; - QList<int> context; + Core::Context context; QPointer<QSignalMapper> signalMapper; }; @@ -126,7 +126,7 @@ void ImageViewerActionHandler::createActions() } QAction *ImageViewerActionHandler::registerNewAction(int actionId, const QString &id, - const QString &title, const QList<int> &context, const QKeySequence &key) + const QString &title, const Core::Context &context, const QKeySequence &key) { Core::ActionManager *actionManager = Core::ICore::instance()->actionManager(); Core::Command *command = 0; diff --git a/src/plugins/imageviewer/imagevieweractionhandler.h b/src/plugins/imageviewer/imagevieweractionhandler.h index 417e8fb79c..603612ef5c 100644 --- a/src/plugins/imageviewer/imagevieweractionhandler.h +++ b/src/plugins/imageviewer/imagevieweractionhandler.h @@ -31,11 +31,15 @@ #ifndef IMAGEVIEWERACTIONHANDLER_H #define IMAGEVIEWERACTIONHANDLER_H -#include <QObject> +#include "coreplugin/icontext.h" + +#include <QtCore/QObject> #include <QtCore/QScopedPointer> -QT_FORWARD_DECLARE_CLASS(QAction) -QT_FORWARD_DECLARE_CLASS(QKeySequence) +QT_BEGIN_NAMESPACE +class QAction; +class QKeySequence; +QT_END_NAMESPACE namespace ImageViewer { namespace Internal { @@ -65,7 +69,7 @@ protected: \return Created and registered action, 0 if something goes wrong */ QAction *registerNewAction(int actionId, const QString &id, const QString &title, - const QList<int> &context, const QKeySequence &key); + const Core::Context &context, const QKeySequence &key); private: QScopedPointer<struct ImageViewerActionHandlerPrivate> d_ptr; diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp index 5d59c7605b..32f70c8e77 100644 --- a/src/plugins/locator/locatorplugin.cpp +++ b/src/plugins/locator/locatorplugin.cpp @@ -106,14 +106,14 @@ bool LocatorPlugin::initialize(const QStringList &, QString *) m_locatorWidget->setEnabled(false); Core::StatusBarWidget *view = new Core::StatusBarWidget; view->setWidget(m_locatorWidget); - view->setContext(QList<int>() << core->uniqueIDManager() - ->uniqueIdentifier(QLatin1String("LocatorWidget"))); + view->setContext(Core::Context(core->uniqueIDManager() + ->uniqueIdentifier(QLatin1String("LocatorWidget")))); view->setPosition(Core::StatusBarWidget::First); addAutoReleasedObject(view); const QString actionId = QLatin1String("QtCreator.Locate"); QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); - Core::Command *cmd = core->actionManager()->registerAction(action, actionId, QList<int>() << Core::Constants::C_GLOBAL_ID); + Core::Command *cmd = core->actionManager()->registerAction(action, actionId, Core::Context(Core::Constants::C_GLOBAL_ID)); cmd->setDefaultKeySequence(QKeySequence("Ctrl+K")); connect(action, SIGNAL(triggered()), this, SLOT(openLocator())); diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index 2584468570..0eba38a9ac 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -207,7 +207,7 @@ QStringList MercurialPlugin::standardArguments() const void MercurialPlugin::createMenu() { - QList<int> context = QList<int>()<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Core::Constants::C_GLOBAL)); + Core::Context context(core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Core::Constants::C_GLOBAL))); // Create menu item for Mercurial mercurialContainer = actionManager->createMenu(QLatin1String("Mercurial.MercurialMenu")); @@ -230,7 +230,7 @@ void MercurialPlugin::createMenu() m_menuAction = mercurialContainer->menu()->menuAction(); } -void MercurialPlugin::createFileActions(const QList<int> &context) +void MercurialPlugin::createFileActions(const Core::Context &context) { Core::Command *command; @@ -335,7 +335,7 @@ void MercurialPlugin::statusCurrentFile() m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile()); } -void MercurialPlugin::createDirectoryActions(const QList<int> &context) +void MercurialPlugin::createDirectoryActions(const Core::Context &context) { QAction *action; Core::Command *command; @@ -403,7 +403,7 @@ void MercurialPlugin::statusMulti() m_client->status(state.topLevel()); } -void MercurialPlugin::createRepositoryActions(const QList<int> &context) +void MercurialPlugin::createRepositoryActions(const Core::Context &context) { QAction *action = new QAction(tr("Pull..."), this); m_repositoryActionList.append(action); @@ -534,7 +534,7 @@ void MercurialPlugin::outgoing() void MercurialPlugin::createSubmitEditorActions() { - QList<int> context = QList<int>()<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::COMMIT_ID)); + Core::Context context(core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::COMMIT_ID))); Core::Command *command; editorCommit = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this); @@ -677,7 +677,7 @@ void MercurialPlugin::deleteCommitLog() } } -void MercurialPlugin::createRepositoryManagementActions(const QList<int> &context) +void MercurialPlugin::createRepositoryManagementActions(const Core::Context &context) { //TODO create menu for these options Q_UNUSED(context); @@ -689,14 +689,14 @@ void MercurialPlugin::createRepositoryManagementActions(const QList<int> &contex // mercurialContainer->addAction(command); } -void MercurialPlugin::createLessUsedActions(const QList<int> &context) +void MercurialPlugin::createLessUsedActions(const Core::Context &context) { //TODO create menue for these options Q_UNUSED(context); return; } -void MercurialPlugin::createSeparator(const QList<int> &context, const QString &id) +void MercurialPlugin::createSeparator(const Core::Context &context, const QString &id) { QAction *action = new QAction(this); action->setSeparator(true); diff --git a/src/plugins/mercurial/mercurialplugin.h b/src/plugins/mercurial/mercurialplugin.h index 9c9d4b6a82..0dec3d2a86 100644 --- a/src/plugins/mercurial/mercurialplugin.h +++ b/src/plugins/mercurial/mercurialplugin.h @@ -33,6 +33,7 @@ #include "mercurialsettings.h" #include <vcsbase/vcsbaseplugin.h> +#include <coreplugin/icontext.h> #include <QtCore/QFileInfo> #include <QtCore/QHash> @@ -139,12 +140,12 @@ private: //methods void createMenu(); void createSubmitEditorActions(); - void createSeparator(const QList<int> &context, const QString &id); - void createFileActions(const QList<int> &context); - void createDirectoryActions(const QList<int> &context); - void createRepositoryActions(const QList<int> &context); - void createRepositoryManagementActions(const QList<int> &context); - void createLessUsedActions(const QList<int> &context); + void createSeparator(const Core::Context &context, const QString &id); + void createFileActions(const Core::Context &context); + void createDirectoryActions(const Core::Context &context); + void createRepositoryActions(const Core::Context &context); + void createRepositoryManagementActions(const Core::Context &context); + void createLessUsedActions(const Core::Context &context); void deleteCommitLog(); //Variables diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index b693ff5854..18d3a5793a 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -218,15 +218,15 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { static inline Core::Command *createSeparator(QObject *parent, Core::ActionManager *ami, - const char*id, - const QList<int> &globalcontext) + const char *id, + const Core::Context &globalcontext) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); return ami->registerAction(tmpaction, id, globalcontext); } -bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString * errorMessage) +bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage) { typedef VCSBase::VCSEditorFactory<PerforceEditor> PerforceEditorFactory; typedef VCSBase::VCSSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory; @@ -267,12 +267,9 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString * e mtools->addMenu(mperforce); m_menuAction = mperforce->menu()->menuAction(); - QList<int> globalcontext; - globalcontext << Core::Constants::C_GLOBAL_ID; - - QList<int> perforcesubmitcontext; - perforcesubmitcontext << Core::UniqueIDManager::instance()-> - uniqueIdentifier(Constants::PERFORCESUBMITEDITOR_CONTEXT); + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); + Core::Context perforcesubmitcontext( + Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::PERFORCESUBMITEDITOR_CONTEXT)); Core::Command *command; diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index 4d6bb74751..4be18a9d60 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -82,8 +82,7 @@ OutputPane::OutputPane() // Stop Core::ActionManager *am = Core::ICore::instance()->actionManager(); - QList<int> globalcontext; - globalcontext.append(Core::Constants::C_GLOBAL_ID); + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); m_stopAction = new QAction(QIcon(Constants::ICON_STOP), tr("Stop"), this); m_stopAction->setToolTip(tr("Stop")); @@ -385,8 +384,7 @@ OutputWindow::OutputWindow(QWidget *parent) static uint usedIds = 0; Core::ICore *core = Core::ICore::instance(); - QList<int> context; - context << core->uniqueIDManager()->uniqueIdentifier(QString(Constants::C_APP_OUTPUT) + QString().setNum(usedIds++)); + Core::Context context(core->uniqueIDManager()->uniqueIdentifier(QString(Constants::C_APP_OUTPUT) + QString().setNum(usedIds++))); m_outputWindowContext = new Core::BaseContext(this, context); core->addContextObject(m_outputWindowContext); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 26ef517c93..6b28c2ab87 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -264,11 +264,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_proWindow = new ProjectWindow; - QList<int> globalcontext; - globalcontext.append(Core::Constants::C_GLOBAL_ID); - - QList<int> pecontext; - pecontext << core->uniqueIDManager()->uniqueIdentifier(Constants::C_PROJECTEXPLORER); + Core::Context globalcontext(Core::Constants::C_GLOBAL_ID); + Core::Context pecontext(core->uniqueIDManager()->uniqueIdentifier(Constants::C_PROJECTEXPLORER)); d->m_projectsMode = new Core::BaseMode; d->m_projectsMode->setDisplayName(tr("Projects")); @@ -276,7 +273,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_projectsMode->setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png"))); d->m_projectsMode->setPriority(Constants::P_MODE_SESSION); d->m_projectsMode->setWidget(d->m_proWindow); - d->m_projectsMode->setContext(QList<int>() << pecontext); + d->m_projectsMode->setContext(pecontext); d->m_projectsMode->setEnabled(session()->startupProject()); d->m_projectsMode->setContextHelpId(QLatin1String("Managing Projects")); addAutoReleasedObject(d->m_projectsMode); @@ -1311,8 +1308,8 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node bool projectChanged = false; if (d->m_currentProject != project) { - QList<int> oldContext; - QList<int> newContext; + Core::Context oldContext; + Core::Context newContext; if (d->m_currentProject) { oldContext.append(d->m_currentProject->projectManager()->projectContext()); diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 1be6b8ec42..ab5d47070e 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -94,11 +94,11 @@ class TaskWindowContext : public Core::IContext { public: TaskWindowContext(QWidget *widget); - virtual QList<int> context() const; + virtual Core::Context context() const; virtual QWidget *widget(); private: QWidget *m_taskList; - QList<int> m_context; + Core::Context m_context; }; class TaskModel : public QAbstractItemModel @@ -1006,7 +1006,7 @@ TaskWindowContext::TaskWindowContext(QWidget *widget) m_context << uidm->uniqueIdentifier(Core::Constants::C_PROBLEM_PANE); } -QList<int> TaskWindowContext::context() const +Core::Context TaskWindowContext::context() const { return m_context; } diff --git a/src/plugins/qmldesigner/designmodecontext.cpp b/src/plugins/qmldesigner/designmodecontext.cpp index 2b3c1bcbc0..b2c06eb816 100644 --- a/src/plugins/qmldesigner/designmodecontext.cpp +++ b/src/plugins/qmldesigner/designmodecontext.cpp @@ -49,7 +49,7 @@ DesignModeContext::~DesignModeContext() } -QList<int> DesignModeContext::context() const +Core::Context DesignModeContext::context() const { return m_context; } diff --git a/src/plugins/qmldesigner/designmodecontext.h b/src/plugins/qmldesigner/designmodecontext.h index 90dcb94eee..381f8b1fb8 100644 --- a/src/plugins/qmldesigner/designmodecontext.h +++ b/src/plugins/qmldesigner/designmodecontext.h @@ -51,13 +51,13 @@ public: DesignModeContext(DesignModeWidget *widget); ~DesignModeContext(); - QList<int> context() const; + Core::Context context() const; QWidget *widget(); QString contextHelpId() const; private: - QList<int> m_context; + Core::Context m_context; DesignModeWidget *m_widget; }; diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index f58402bf0f..29935e128c 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -120,10 +120,7 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error Core::ICore *core = Core::ICore::instance(); const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(QmlDesigner::Constants::C_FORMEDITOR)); - const QList<int> context = QList<int>() << uid; - - const QList<int> switchContext = QList<int>() << uid - << core->uniqueIDManager()->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID); + const Core::Context switchContext(core->uniqueIDManager()->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID)); Core::ActionManager *am = core->actionManager(); @@ -167,7 +164,7 @@ void BauhausPlugin::createDesignModeWidget() m_context = new DesignModeContext(m_mainWidget); creatorCore->addContextObject(m_context); Core::UniqueIDManager *uuidManager = Core::UniqueIDManager::instance(); - QList<int> formEditorContext = QList<int> () << uuidManager->uniqueIdentifier(Constants::C_FORMEDITOR); + Core::Context formEditorContext(uuidManager->uniqueIdentifier(Constants::C_FORMEDITOR)); // Revert to saved actionManager->registerAction(m_revertToSavedAction, @@ -263,8 +260,8 @@ void BauhausPlugin::createDesignModeWidget() connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)), this, SLOT(textEditorsClosed(QList<Core::IEditor*>))); - connect(creatorCore, SIGNAL(contextChanged(Core::IContext*,QList<int>)), - this, SLOT(contextChanged(Core::IContext*,QList<int>))); + connect(creatorCore, SIGNAL(contextChanged(Core::IContext*,Core::Context)), + this, SLOT(contextChanged(Core::IContext*,Core::Context))); } @@ -278,11 +275,11 @@ void BauhausPlugin::updateEditor(Core::IEditor *editor) } } -void BauhausPlugin::contextChanged(Core::IContext *context, const QList<int> &additionalContexts) +void BauhausPlugin::contextChanged(Core::IContext *context, const Core::Context &additionalContexts) { Q_UNUSED(context) - foreach(int additionalContext, additionalContexts) { + foreach (int additionalContext, additionalContexts) { if (m_context->context().contains(additionalContext)) { m_isActive = true; m_mainWidget->showEditor(m_editorManager->currentEditor()); diff --git a/src/plugins/qmldesigner/qmldesignerplugin.h b/src/plugins/qmldesigner/qmldesignerplugin.h index bd1194547b..b39b74f5f8 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.h +++ b/src/plugins/qmldesigner/qmldesignerplugin.h @@ -42,6 +42,7 @@ class QAction; QT_END_NAMESPACE namespace Core { + class Context; class IContext; class IWizard; class ICore; @@ -85,7 +86,7 @@ private slots: void textEditorsClosed(QList<Core::IEditor *> editors); void updateActions(Core::IEditor* editor); void updateEditor(Core::IEditor *editor); - void contextChanged(Core::IContext *context, const QList<int> &additionalContexts); + void contextChanged(Core::IContext *context, const Core::Context &additionalContexts); private: void createDesignModeWidget(); diff --git a/src/plugins/qmlinspector/inspectorcontext.cpp b/src/plugins/qmlinspector/inspectorcontext.cpp index c735e44d3f..b3c0c05b04 100644 --- a/src/plugins/qmlinspector/inspectorcontext.cpp +++ b/src/plugins/qmlinspector/inspectorcontext.cpp @@ -54,7 +54,7 @@ InspectorContext::~InspectorContext() } -QList<int> InspectorContext::context() const +Core::Context InspectorContext::context() const { return m_context; } diff --git a/src/plugins/qmlinspector/inspectorcontext.h b/src/plugins/qmlinspector/inspectorcontext.h index e73b3e4f23..b25ed0926d 100644 --- a/src/plugins/qmlinspector/inspectorcontext.h +++ b/src/plugins/qmlinspector/inspectorcontext.h @@ -55,7 +55,7 @@ public: InspectorContext(QWidget *widget); ~InspectorContext(); - QList<int> context() const; + Core::Context context() const; QWidget *widget(); QString contextHelpId() const; @@ -67,7 +67,7 @@ public slots: void setContextHelpId(const QString &helpId); private: - QList<int> m_context; + Core::Context m_context; QWidget *m_widget; QString m_contextHelpId; diff --git a/src/plugins/qmlinspector/qmlinspector.cpp b/src/plugins/qmlinspector/qmlinspector.cpp index 04a782dd1e..07d01961a0 100644 --- a/src/plugins/qmlinspector/qmlinspector.cpp +++ b/src/plugins/qmlinspector/qmlinspector.cpp @@ -462,7 +462,7 @@ void QmlInspector::createDockWidgets() Core::ActionManager *am = core->actionManager(); Core::ActionContainer *mstart = am->actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING); Core::Command *cmd = am->registerAction(m_simultaneousDebugAction, Constants::M_DEBUG_SIMULTANEOUSLY, - QList<int>() << m_context->context()); + m_context->context()); cmd->setAttribute(Core::Command::CA_Hide); mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE); diff --git a/src/plugins/qmlinspector/qmlinspectorplugin.cpp b/src/plugins/qmlinspector/qmlinspectorplugin.cpp index 9677557441..011828ee2d 100644 --- a/src/plugins/qmlinspector/qmlinspectorplugin.cpp +++ b/src/plugins/qmlinspector/qmlinspectorplugin.cpp @@ -101,7 +101,7 @@ bool QmlInspectorPlugin::initialize(const QStringList &arguments, QString *error Debugger::DebuggerUISwitcher *uiSwitcher = pluginManager->getObject<Debugger::DebuggerUISwitcher>(); uiSwitcher->addLanguage(Qml::Constants::LANG_QML, - QList<int>() << core->uniqueIDManager()->uniqueIdentifier(Constants::C_INSPECTOR)); + Core::Context(core->uniqueIDManager()->uniqueIdentifier(Constants::C_INSPECTOR))); m_inspector = new QmlInspector; m_inspector->createDockWidgets(); addObject(m_inspector); diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index cd32175be8..40479d8d62 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -713,7 +713,7 @@ bool QmlJSEditorEditable::open(const QString &fileName) return b; } -QmlJSTextEditor::Context QmlJSEditorEditable::context() const +Core::Context QmlJSEditorEditable::context() const { return m_context; } diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 22b06ddcc8..6d561053ce 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -64,7 +64,7 @@ class QmlJSEditorEditable : public TextEditor::BaseTextEditorEditable public: QmlJSEditorEditable(QmlJSTextEditor *); - QList<int> context() const; + Core::Context context() const; bool duplicateSupported() const { return true; } Core::IEditor *duplicate(QWidget *parent); @@ -74,7 +74,7 @@ public: virtual QString preferredMode() const; private: - QList<int> m_context; + Core::Context m_context; }; struct Declaration @@ -204,8 +204,6 @@ class QmlJSTextEditor : public TextEditor::BaseTextEditor Q_OBJECT public: - typedef QList<int> Context; - QmlJSTextEditor(QWidget *parent = 0); ~QmlJSTextEditor(); @@ -262,7 +260,7 @@ private: SemanticHighlighter::Source currentSource(bool force = false); - const Context m_context; + const Core::Context m_context; QTimer *m_updateDocumentTimer; QTimer *m_updateUsesTimer; diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 3efbfe7115..2bf79f5a55 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -110,7 +110,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e m_modelManager = new ModelManager(this); addAutoReleasedObject(m_modelManager); - QList<int> context; + Core::Context context; context << core->uniqueIDManager()->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID) << core->uniqueIDManager()->uniqueIdentifier(QmlDesigner::Constants::C_QT_QUICK_TOOLS_MENU); @@ -140,8 +140,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e mtools->addMenu(menuQtQuick); m_actionPreview = new QAction("&Preview", this); - QList<int> toolsMenuContext = QList<int>() - << core->uniqueIDManager()->uniqueIdentifier(QmlDesigner::Constants::C_QT_QUICK_TOOLS_MENU); + Core::Context toolsMenuContext(core->uniqueIDManager()->uniqueIdentifier(QmlDesigner::Constants::C_QT_QUICK_TOOLS_MENU)); Core::Command *cmd = addToolAction(m_actionPreview, am, toolsMenuContext, QLatin1String("QtQuick.Preview"), menuQtQuick, tr("Ctrl+Alt+R")); connect(cmd->action(), SIGNAL(triggered()), SLOT(openPreview())); @@ -220,7 +219,7 @@ void QmlJSEditorPlugin::followSymbolUnderCursor() } Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, Core::ActionManager *am, - const QList<int> &context, const QString &name, + Core::Context &context, const QString &name, Core::ActionContainer *c1, const QString &keySequence) { Core::Command *command = am->registerAction(a, name, context); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h index bf632ecc69..af6e5f9280 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.h +++ b/src/plugins/qmljseditor/qmljseditorplugin.h @@ -31,6 +31,7 @@ #define QMLJSEDITORPLUGIN_H #include <extensionsystem/iplugin.h> +#include <coreplugin/icontext.h> #include <QtCore/QPointer> QT_FORWARD_DECLARE_CLASS(QAction) @@ -93,7 +94,7 @@ private Q_SLOTS: void quickFixNow(); private: - Core::Command *addToolAction(QAction *a, Core::ActionManager *am, const QList<int> &context, const QString &name, + Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const QString &name, Core::ActionContainer *c1, const QString &keySequence); static QmlJSEditorPlugin *m_instance; diff --git a/src/plugins/qt4projectmanager/profileeditor.cpp b/src/plugins/qt4projectmanager/profileeditor.cpp index 84ecab593a..ec88fb9358 100644 --- a/src/plugins/qt4projectmanager/profileeditor.cpp +++ b/src/plugins/qt4projectmanager/profileeditor.cpp @@ -62,7 +62,7 @@ ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor) // m_contexts << uidm->uniqueIdentifier(Qt4ProjectManager::Constants::PROJECT_KIND); } -QList<int> ProFileEditorEditable::context() const +Core::Context ProFileEditorEditable::context() const { return m_context; } diff --git a/src/plugins/qt4projectmanager/profileeditor.h b/src/plugins/qt4projectmanager/profileeditor.h index 30047ae9af..28e4f3d33d 100644 --- a/src/plugins/qt4projectmanager/profileeditor.h +++ b/src/plugins/qt4projectmanager/profileeditor.h @@ -55,14 +55,14 @@ class ProFileEditorEditable : public TextEditor::BaseTextEditorEditable { public: ProFileEditorEditable(ProFileEditor *); - QList<int> context() const; + Core::Context context() const; bool duplicateSupported() const { return true; } Core::IEditor *duplicate(QWidget *parent); QString id() const; bool isTemporary() const { return false; } private: - QList<int> m_context; + Core::Context m_context; }; class ProFileEditor : public TextEditor::BaseTextEditor diff --git a/src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp index 83059b69fb..2e02ec6a3e 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp @@ -39,6 +39,7 @@ #include <coreplugin/actionmanager/command.h> #include <coreplugin/coreconstants.h> #include <coreplugin/icore.h> +#include <coreplugin/icontext.h> #include <coreplugin/modemanager.h> #include <projectexplorer/projectexplorer.h> @@ -84,7 +85,7 @@ QemuRuntimeManager::QemuRuntimeManager(QObject *parent) Core::ICore *core = Core::ICore::instance(); Core::ActionManager *actionManager = core->actionManager(); Core::Command *qemuCommand = actionManager->registerAction(m_qemuAction, - "MaemoEmulator", QList<int>() << Core::Constants::C_GLOBAL_ID); + "MaemoEmulator", Core::Context(Core::Constants::C_GLOBAL_ID)); qemuCommand->setAttribute(Core::Command::CA_UpdateText); qemuCommand->setAttribute(Core::Command::CA_UpdateIcon); diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index b35be397a7..4273b5bd69 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -175,7 +175,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * //register actions m_projectContext = core->uniqueIDManager()-> uniqueIdentifier(Qt4ProjectManager::Constants::PROJECT_ID); - QList<int> context = QList<int>() << m_projectContext; + Core::Context context(m_projectContext); Core::Command *command; QIcon qmakeIcon(QLatin1String(":/qt4projectmanager/images/run_qmake.png")); @@ -225,7 +225,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * connect(m_projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project *)), this, SLOT(currentProjectChanged())); - Core::ActionContainer *contextMenu= am->createMenu(Qt4ProjectManager::Constants::M_CONTEXT); + Core::ActionContainer *contextMenu = am->createMenu(Qt4ProjectManager::Constants::M_CONTEXT); Core::Command *cmd; diff --git a/src/plugins/resourceeditor/resourceeditorfactory.h b/src/plugins/resourceeditor/resourceeditorfactory.h index 13be080f89..49d9e2c60e 100644 --- a/src/plugins/resourceeditor/resourceeditorfactory.h +++ b/src/plugins/resourceeditor/resourceeditorfactory.h @@ -31,6 +31,7 @@ #define RRESOURCEEDITORFACTORY_H #include <coreplugin/editormanager/ieditorfactory.h> +#include <coreplugin/icontext.h> #include <QtCore/QStringList> @@ -44,8 +45,6 @@ class ResourceEditorFactory : public Core::IEditorFactory Q_OBJECT public: - typedef QList<int> Context; - explicit ResourceEditorFactory(ResourceEditorPlugin *plugin); virtual QStringList mimeTypes() const; @@ -58,7 +57,7 @@ public: private: const QStringList m_mimeTypes; - Context m_context; + Core::Context m_context; ResourceEditorPlugin *m_plugin; }; diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp index 2638df860b..3202328c8f 100644 --- a/src/plugins/resourceeditor/resourceeditorplugin.cpp +++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp @@ -90,7 +90,7 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err Core::ActionManager * const actionManager = core->actionManager(); int const contextId = core->uniqueIDManager()->uniqueIdentifier( Constants::C_RESOURCEEDITOR); - const QList<int> context = QList<int>() << contextId; + const Core::Context context(contextId); m_undoAction = new QAction(tr("&Undo"), this); m_redoAction = new QAction(tr("&Redo"), this); actionManager->registerAction(m_undoAction, Core::Constants::UNDO, context); diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index 9977bd8660..21af9efc8b 100644 --- a/src/plugins/resourceeditor/resourceeditorw.cpp +++ b/src/plugins/resourceeditor/resourceeditorw.cpp @@ -66,7 +66,7 @@ QString ResourceEditorFile::mimeType() const } -ResourceEditorW::ResourceEditorW(const QList<int> &context, +ResourceEditorW::ResourceEditorW(const Core::Context &context, ResourceEditorPlugin *plugin, QWidget *parent) : m_context(context), diff --git a/src/plugins/resourceeditor/resourceeditorw.h b/src/plugins/resourceeditor/resourceeditorw.h index 79e11bd3a1..b05f5eee3a 100644 --- a/src/plugins/resourceeditor/resourceeditorw.h +++ b/src/plugins/resourceeditor/resourceeditorw.h @@ -51,8 +51,6 @@ class ResourceEditorFile Q_OBJECT public: - typedef QList<int> Context; - ResourceEditorFile(ResourceEditorW *parent = 0); //IFile @@ -78,9 +76,7 @@ class ResourceEditorW : public Core::IEditor Q_OBJECT public: - typedef QList<int> Context; - - ResourceEditorW(const Context &context, + ResourceEditorW(const Core::Context &context, ResourceEditorPlugin *plugin, QWidget *parent = 0); ~ResourceEditorW(); @@ -99,7 +95,7 @@ public: bool restoreState(const QByteArray &/*state*/) { return true; } // ContextInterface - Context context() const { return m_context; } + Core::Context context() const { return m_context; } QWidget *widget(); void setSuggestedFileName(const QString &fileName); @@ -114,7 +110,7 @@ private: const QString m_fileFilter; QString m_displayName; QString m_suggestedName; - const Context m_context; + const Core::Context m_context; QPointer<SharedTools::QrcEditor> m_resourceEditor; ResourceEditorFile *m_resourceFile; ResourceEditorPlugin *m_plugin; diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 1799dde4ba..fe2ac398db 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -252,7 +252,7 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { static inline Core::Command *createSeparator(QObject *parent, Core::ActionManager *ami, const char*id, - const QList<int> &globalcontext) + const Core::Context &globalcontext) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); @@ -304,8 +304,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e subversionMenu->menu()->setTitle(tr("&Subversion")); toolsContainer->addMenu(subversionMenu); m_menuAction = subversionMenu->menu()->menuAction(); - QList<int> globalcontext; - globalcontext << core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); + Core::Context globalcontext(core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL)); Core::Command *command; @@ -457,7 +456,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); // Actions of the submit editor - QList<int> svncommitcontext; + Core::Context svncommitcontext; svncommitcontext << Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::SUBVERSIONCOMMITEDITOR); m_submitCurrentLogAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this); diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index ce933292c0..c1936a6d8e 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -83,7 +83,7 @@ PlainTextEditor::PlainTextEditor(QWidget *parent) PlainTextEditor::~PlainTextEditor() {} -QList<int> PlainTextEditorEditable::context() const +Core::Context PlainTextEditorEditable::context() const { return m_context; } diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h index c57aba920c..b6814774a0 100644 --- a/src/plugins/texteditor/plaintexteditor.h +++ b/src/plugins/texteditor/plaintexteditor.h @@ -51,7 +51,7 @@ class TEXTEDITOR_EXPORT PlainTextEditorEditable : public BaseTextEditorEditable Q_OBJECT public: PlainTextEditorEditable(PlainTextEditor *); - QList<int> context() const; + Core::Context context() const; bool duplicateSupported() const { return true; } Core::IEditor *duplicate(QWidget *parent); @@ -59,7 +59,7 @@ public: virtual QString id() const; private: - QList<int> m_context; + Core::Context m_context; }; class TEXTEDITOR_EXPORT PlainTextEditor : public BaseTextEditor diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h index 331c788d31..9effbb39d5 100644 --- a/src/plugins/texteditor/texteditoractionhandler.h +++ b/src/plugins/texteditor/texteditoractionhandler.h @@ -178,7 +178,7 @@ private: uint m_optionalActions; QPointer<BaseTextEditor> m_currentEditor; - QList<int> m_contextId; + Core::Context m_contextId; bool m_initialized; }; diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index f1226743ff..3367f3e617 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -117,7 +117,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe addAutoReleasedObject(m_lineNumberFilter); int contextId = core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); - QList<int> context = QList<int>() << contextId; + Core::Context context(contextId); Core::ActionManager *am = core->actionManager(); // Add shortcut for invoking automatic completion diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 2e6520c00b..db5047ed4f 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -76,7 +76,7 @@ class VCSBaseEditorEditable : public TextEditor::BaseTextEditorEditable public: VCSBaseEditorEditable(VCSBaseEditor *, const VCSBaseEditorParameters *type); - QList<int> context() const; + Core::Context context() const; bool duplicateSupported() const { return false; } Core::IEditor *duplicate(QWidget * /*parent*/) { return 0; } @@ -91,7 +91,7 @@ signals: private: QString m_id; - QList<int> m_context; + Core::Context m_context; bool m_temporary; }; @@ -106,7 +106,7 @@ VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor, << uidm->uniqueIdentifier(QLatin1String(TextEditor::Constants::C_TEXTEDITOR)); } -QList<int> VCSBaseEditorEditable::context() const +Core::Context VCSBaseEditorEditable::context() const { return m_context; } diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 98241014c8..58f9f23ddd 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -93,7 +93,7 @@ struct VCSBaseSubmitEditorPrivate QString m_displayName; QString m_checkScriptWorkingDirectory; VCSBase::Internal::SubmitEditorFile *m_file; - QList<int> m_contexts; + Core::Context m_contexts; QPointer<QAction> m_diffAction; QPointer<QAction> m_submitAction; @@ -377,7 +377,7 @@ QWidget *VCSBaseSubmitEditor::toolBar() return m_d->m_toolWidget; } -QList<int> VCSBaseSubmitEditor::context() const +Core::Context VCSBaseSubmitEditor::context() const { return m_d->m_contexts; } diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.h b/src/plugins/vcsbase/vcsbasesubmiteditor.h index 0794c37204..545e213836 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.h +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.h @@ -145,7 +145,7 @@ public: virtual QString id() const; virtual QWidget *toolBar(); - virtual QList<int> context() const; + virtual Core::Context context() const; virtual QWidget *widget(); virtual QByteArray saveState() const; diff --git a/src/plugins/welcome/welcomemode.cpp b/src/plugins/welcome/welcomemode.cpp index d13ef68e7c..c8c0025543 100644 --- a/src/plugins/welcome/welcomemode.cpp +++ b/src/plugins/welcome/welcomemode.cpp @@ -148,10 +148,10 @@ QString WelcomeMode::id() const return QLatin1String(Core::Constants::MODE_WELCOME); } -QList<int> WelcomeMode::context() const +Core::Context WelcomeMode::context() const { - static QList<int> contexts = QList<int>() - << Core::UniqueIDManager::instance()->uniqueIdentifier(Core::Constants::C_WELCOME_MODE); + static Core::Context contexts = + Core::Context(Core::UniqueIDManager::instance()->uniqueIdentifier(Core::Constants::C_WELCOME_MODE)); return contexts; } diff --git a/src/plugins/welcome/welcomemode.h b/src/plugins/welcome/welcomemode.h index 42acdb7378..47cac9b4c3 100644 --- a/src/plugins/welcome/welcomemode.h +++ b/src/plugins/welcome/welcomemode.h @@ -60,7 +60,7 @@ public: int priority() const; QWidget *widget(); QString id() const; - QList<int> context() const; + Core::Context context() const; void activated(); QString contextHelpId() const { return QLatin1String("Qt Creator Manual"); } void initPlugins(); |