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