Commit 08010472 authored by dt's avatar dt

Make project context a Core::Context

Also properly initialize m_projectContext in Qt4Manager, fixing the
disabled "Run QMake" action
parent 6ef602d1
......@@ -53,11 +53,11 @@ CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage)
: m_settingsPage(cmakeSettingsPage)
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_projectContext = uidm->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_projectContext = Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
}
int CMakeManager::projectContext() const
Core::Context CMakeManager::projectContext() const
{
return m_projectContext;
}
......
......@@ -52,7 +52,7 @@ class CMakeManager : public ProjectExplorer::IProjectManager
public:
CMakeManager(CMakeSettingsPage *cmakeSettingsPage);
virtual int projectContext() const;
virtual Core::Context projectContext() const;
virtual int projectLanguage() const;
virtual ProjectExplorer::Project *openProject(const QString &fileName);
......@@ -76,7 +76,7 @@ public:
private:
static QString qtVersionForQMake(const QString &qmakePath);
static QPair<QString, QString> findQtDir(const ProjectExplorer::Environment &env);
int m_projectContext;
Core::Context m_projectContext;
int m_projectLanguage;
CMakeSettingsPage *m_settingsPage;
};
......
......@@ -45,14 +45,14 @@ using namespace GenericProjectManager::Internal;
Manager::Manager()
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_projectContext = uidm->uniqueIdentifier(GenericProjectManager::Constants::PROJECTCONTEXT);
m_projectContext = Core::Context(GenericProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
}
Manager::~Manager()
{ }
int Manager::projectContext() const
Core::Context Manager::projectContext() const
{ return m_projectContext; }
int Manager::projectLanguage() const
......
......@@ -45,7 +45,7 @@ public:
Manager();
virtual ~Manager();
virtual int projectContext() const;
virtual Core::Context projectContext() const;
virtual int projectLanguage() const;
virtual QString mimeType() const;
......@@ -57,7 +57,7 @@ public:
void unregisterProject(GenericProject *project);
private:
int m_projectContext;
Core::Context m_projectContext;
int m_projectLanguage;
QList<GenericProject *> m_projects;
};
......
......@@ -32,6 +32,7 @@
#include "projectexplorer_export.h"
#include <coreplugin/icontext.h>
#include <QtCore/QObject>
namespace ProjectExplorer {
......@@ -46,7 +47,7 @@ class PROJECTEXPLORER_EXPORT IProjectManager
public:
IProjectManager() {}
virtual int projectContext() const = 0; //TODO move into project
virtual Core::Context projectContext() const = 0; //TODO move into project
virtual int projectLanguage() const = 0; //TODO move into project
virtual QString mimeType() const = 0;
......
......@@ -48,14 +48,14 @@ namespace Internal {
Manager::Manager()
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_projectContext = uidm->uniqueIdentifier(QmlProjectManager::Constants::PROJECTCONTEXT);
m_projectContext = Core::Context(QmlProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = uidm->uniqueIdentifier(QmlProjectManager::Constants::LANG_QML);
}
Manager::~Manager()
{ }
int Manager::projectContext() const
Core::Context Manager::projectContext() const
{ return m_projectContext; }
int Manager::projectLanguage() const
......
......@@ -46,7 +46,7 @@ public:
Manager();
virtual ~Manager();
virtual int projectContext() const;
virtual Core::Context projectContext() const;
virtual int projectLanguage() const;
virtual QString mimeType() const;
......@@ -58,7 +58,7 @@ public:
void unregisterProject(QmlProject *project);
private:
int m_projectContext;
Core::Context m_projectContext;
int m_projectLanguage;
QList<QmlProject *> m_projects;
};
......
......@@ -165,7 +165,7 @@ void Qt4Manager::uiEditorContentsChanged()
m_dirty = true;
}
int Qt4Manager::projectContext() const
Core::Context Qt4Manager::projectContext() const
{
return m_plugin->projectContext();
}
......
......@@ -75,7 +75,7 @@ public:
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
// ProjectExplorer::IProjectManager
int projectContext() const;
Core::Context projectContext() const;
int projectLanguage() const;
virtual QString mimeType() const;
......
......@@ -52,6 +52,7 @@
#include "qt-maemo/maemomanager.h"
#include "qt-s60/s60manager.h"
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildmanager.h>
......@@ -93,6 +94,7 @@ Qt4ProjectManagerPlugin::~Qt4ProjectManagerPlugin()
bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
m_projectContext = Core::Context(Qt4ProjectManager::Constants::PROJECT_ID);
ProFileParser::initialize();
ProFileEvaluator::initialize();
......@@ -172,18 +174,17 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
am->actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
//register actions
Core::Context context(Qt4ProjectManager::Constants::PROJECT_ID);
Core::Command *command;
QIcon qmakeIcon(QLatin1String(":/qt4projectmanager/images/run_qmake.png"));
qmakeIcon.addFile(QLatin1String(":/qt4projectmanager/images/run_qmake_small.png"));
m_runQMakeAction = new QAction(qmakeIcon, tr("Run qmake"), this);
command = am->registerAction(m_runQMakeAction, Constants::RUNQMAKE, context);
command = am->registerAction(m_runQMakeAction, Constants::RUNQMAKE, m_projectContext);
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PROJECT);
connect(m_runQMakeAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMake()));
m_runQMakeActionContextMenu = new QAction(qmakeIcon, tr("Run qmake"), this);
command = am->registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, context);
command = am->registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, m_projectContext);
command->setAttribute(Core::Command::CA_Hide);
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
......@@ -192,7 +193,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
QIcon buildIcon(ProjectExplorer::Constants::ICON_BUILD);
buildIcon.addFile(ProjectExplorer::Constants::ICON_BUILD_SMALL);
m_buildSubProjectContextMenu = new QAction(buildIcon, tr("Build"), this);
command = am->registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIR, context);
command = am->registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIR, m_projectContext);
command->setAttribute(Core::Command::CA_Hide);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu()));
......@@ -200,7 +201,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
QIcon rebuildIcon(ProjectExplorer::Constants::ICON_REBUILD);
rebuildIcon.addFile(ProjectExplorer::Constants::ICON_REBUILD_SMALL);
m_rebuildSubProjectContextMenu = new QAction(rebuildIcon, tr("Rebuild"), this);
command = am->registerAction(m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIR, context);
command = am->registerAction(m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIR, m_projectContext);
command->setAttribute(Core::Command::CA_Hide);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_rebuildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(rebuildSubDirContextMenu()));
......@@ -208,7 +209,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
QIcon cleanIcon(ProjectExplorer::Constants::ICON_CLEAN);
cleanIcon.addFile(ProjectExplorer::Constants::ICON_CLEAN_SMALL);
m_cleanSubProjectContextMenu = new QAction(cleanIcon, tr("Clean"), this);
command = am->registerAction(m_cleanSubProjectContextMenu, Constants::CLEANSUBDIR, context);
command = am->registerAction(m_cleanSubProjectContextMenu, Constants::CLEANSUBDIR, m_projectContext);
command->setAttribute(Core::Command::CA_Hide);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_cleanSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(cleanSubDirContextMenu()));
......
......@@ -31,6 +31,7 @@
#define QT4PROJECTMANAGERPLUGIN_H
#include <extensionsystem/iplugin.h>
#include <coreplugin/icontext.h>
QT_BEGIN_NAMESPACE
class QAction;
......@@ -66,7 +67,7 @@ public:
bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized();
int projectContext() const { return m_projectContext; }
Core::Context projectContext() const { return m_projectContext; }
private slots:
void updateContextMenu(ProjectExplorer::Project *project,
......@@ -92,7 +93,7 @@ private:
QAction *m_rebuildSubProjectContextMenu;
QAction *m_cleanSubProjectContextMenu;
GettingStartedWelcomePage *m_welcomePage;
int m_projectContext;
Core::Context m_projectContext;
};
} // namespace Internal
......
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