Commit c7e8b51d authored by hjk's avatar hjk
Browse files

core: use a class derived from QList<int> instead of a QList<int> for Core::Context

A mostly mechanical change.

Reviewed-By: con
parent a54fc1f6
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
......
......@@ -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());
......
......@@ -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;
}
......
......@@ -49,7 +49,7 @@ DesignModeContext::~DesignModeContext()
}
QList<int> DesignModeContext::context() const
Core::Context DesignModeContext::context() const
{
return m_context;
}
......
......@@ -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;
};
......
......@@ -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());
......
......@@ -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();
......
......@@ -54,7 +54,7 @@ InspectorContext::~InspectorContext()
}
QList<int> InspectorContext::context() const
Core::Context InspectorContext::context() const
{
return m_context;
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment