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
......@@ -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);
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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);
......
......@@ -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),
......
......@@ -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;
......
......@@ -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);
......
......@@ -83,7 +83,7 @@ PlainTextEditor::PlainTextEditor(QWidget *parent)
PlainTextEditor::~PlainTextEditor()
{}
QList<int> PlainTextEditorEditable::context() const
Core::Context PlainTextEditorEditable::context() const
{
return m_context;
}
......
......@@ -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
......
......@@ -178,7 +178,7 @@ private:
uint m_optionalActions;
QPointer<BaseTextEditor> m_currentEditor;
QList<int> m_contextId;
Core::Context m_contextId;
bool m_initialized;
};
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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();
......
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