forked from qt-creator/qt-creator
QMakeProjectManager: Denoise code
Use "using Core;" instead of prefixing Core:: all over the place. Change-Id: I00b50da731bf2b4bf442c587566d11a3ef921834 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
@@ -71,6 +71,7 @@
|
|||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
using namespace QmakeProjectManager::Internal;
|
using namespace QmakeProjectManager::Internal;
|
||||||
using namespace QmakeProjectManager;
|
using namespace QmakeProjectManager;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -94,8 +95,8 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
const Core::Context projectContext(QmakeProjectManager::Constants::PROJECT_ID);
|
const Context projectContext(QmakeProjectManager::Constants::PROJECT_ID);
|
||||||
Core::Context projecTreeContext(ProjectExplorer::Constants::C_PROJECT_TREE);
|
Context projecTreeContext(ProjectExplorer::Constants::C_PROJECT_TREE);
|
||||||
|
|
||||||
Utils::MimeDatabase::addMimeTypes(QLatin1String(":qmakeprojectmanager/QmakeProjectManager.mimetypes.xml"));
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":qmakeprojectmanager/QmakeProjectManager.mimetypes.xml"));
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
addAutoReleasedObject(new CustomWidgetWizard);
|
addAutoReleasedObject(new CustomWidgetWizard);
|
||||||
|
|
||||||
addAutoReleasedObject(new CustomWizardMetaFactory<CustomQmakeProjectWizard>
|
addAutoReleasedObject(new CustomWizardMetaFactory<CustomQmakeProjectWizard>
|
||||||
(QLatin1String("qmakeproject"), Core::IWizardFactory::ProjectWizard));
|
(QLatin1String("qmakeproject"), IWizardFactory::ProjectWizard));
|
||||||
|
|
||||||
addAutoReleasedObject(new QMakeStepFactory);
|
addAutoReleasedObject(new QMakeStepFactory);
|
||||||
addAutoReleasedObject(new MakeStepFactory);
|
addAutoReleasedObject(new MakeStepFactory);
|
||||||
@@ -129,97 +130,97 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
addAutoReleasedObject(new ProFileEditorFactory);
|
addAutoReleasedObject(new ProFileEditorFactory);
|
||||||
|
|
||||||
//menus
|
//menus
|
||||||
Core::ActionContainer *mbuild =
|
ActionContainer *mbuild =
|
||||||
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
|
ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
|
||||||
Core::ActionContainer *mproject =
|
ActionContainer *mproject =
|
||||||
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
|
ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
|
||||||
Core::ActionContainer *msubproject =
|
ActionContainer *msubproject =
|
||||||
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
|
ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
|
||||||
Core::ActionContainer *mfile =
|
ActionContainer *mfile =
|
||||||
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_FILECONTEXT);
|
ActionManager::actionContainer(ProjectExplorer::Constants::M_FILECONTEXT);
|
||||||
|
|
||||||
//register actions
|
//register actions
|
||||||
Core::Command *command;
|
Command *command;
|
||||||
|
|
||||||
m_buildSubProjectContextMenu = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""),
|
m_buildSubProjectContextMenu = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled/*handled manually*/,
|
Utils::ParameterAction::AlwaysEnabled/*handled manually*/,
|
||||||
this);
|
this);
|
||||||
command = Core::ActionManager::registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext);
|
command = ActionManager::registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
command->setDescription(m_buildSubProjectContextMenu->text());
|
command->setDescription(m_buildSubProjectContextMenu->text());
|
||||||
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
|
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
|
||||||
connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(buildSubDirContextMenu()));
|
connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(buildSubDirContextMenu()));
|
||||||
|
|
||||||
m_runQMakeActionContextMenu = new QAction(tr("Run qmake"), this);
|
m_runQMakeActionContextMenu = new QAction(tr("Run qmake"), this);
|
||||||
command = Core::ActionManager::registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext);
|
command = ActionManager::registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(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);
|
||||||
connect(m_runQMakeActionContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(runQMakeContextMenu()));
|
connect(m_runQMakeActionContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(runQMakeContextMenu()));
|
||||||
|
|
||||||
command = msubproject->addSeparator(projectContext, ProjectExplorer::Constants::G_PROJECT_BUILD,
|
command = msubproject->addSeparator(projectContext, ProjectExplorer::Constants::G_PROJECT_BUILD,
|
||||||
&m_subProjectRebuildSeparator);
|
&m_subProjectRebuildSeparator);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
|
|
||||||
m_rebuildSubProjectContextMenu = new QAction(tr("Rebuild"), this);
|
m_rebuildSubProjectContextMenu = new QAction(tr("Rebuild"), this);
|
||||||
command = Core::ActionManager::registerAction(
|
command = ActionManager::registerAction(
|
||||||
m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIRCONTEXTMENU, projectContext);
|
m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIRCONTEXTMENU, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(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_qmakeProjectManager, SLOT(rebuildSubDirContextMenu()));
|
connect(m_rebuildSubProjectContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(rebuildSubDirContextMenu()));
|
||||||
|
|
||||||
m_cleanSubProjectContextMenu = new QAction(tr("Clean"), this);
|
m_cleanSubProjectContextMenu = new QAction(tr("Clean"), this);
|
||||||
command = Core::ActionManager::registerAction(
|
command = ActionManager::registerAction(
|
||||||
m_cleanSubProjectContextMenu, Constants::CLEANSUBDIRCONTEXTMENU, projectContext);
|
m_cleanSubProjectContextMenu, Constants::CLEANSUBDIRCONTEXTMENU, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(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_qmakeProjectManager, SLOT(cleanSubDirContextMenu()));
|
connect(m_cleanSubProjectContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(cleanSubDirContextMenu()));
|
||||||
|
|
||||||
m_buildFileContextMenu = new QAction(tr("Build"), this);
|
m_buildFileContextMenu = new QAction(tr("Build"), this);
|
||||||
command = Core::ActionManager::registerAction(m_buildFileContextMenu, Constants::BUILDFILECONTEXTMENU, projectContext);
|
command = ActionManager::registerAction(m_buildFileContextMenu, Constants::BUILDFILECONTEXTMENU, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER);
|
mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER);
|
||||||
connect(m_buildFileContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(buildFileContextMenu()));
|
connect(m_buildFileContextMenu, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(buildFileContextMenu()));
|
||||||
|
|
||||||
m_buildSubProjectAction = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""),
|
m_buildSubProjectAction = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled, this);
|
Utils::ParameterAction::AlwaysEnabled, this);
|
||||||
command = Core::ActionManager::registerAction(m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext);
|
command = ActionManager::registerAction(m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
command->setDescription(m_buildSubProjectAction->text());
|
command->setDescription(m_buildSubProjectAction->text());
|
||||||
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
||||||
connect(m_buildSubProjectAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(buildSubDirContextMenu()));
|
connect(m_buildSubProjectAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(buildSubDirContextMenu()));
|
||||||
|
|
||||||
m_runQMakeAction = new QAction(tr("Run qmake"), this);
|
m_runQMakeAction = new QAction(tr("Run qmake"), this);
|
||||||
const Core::Context globalcontext(Core::Constants::C_GLOBAL);
|
const Context globalcontext(Core::Constants::C_GLOBAL);
|
||||||
command = Core::ActionManager::registerAction(m_runQMakeAction, Constants::RUNQMAKE, globalcontext);
|
command = ActionManager::registerAction(m_runQMakeAction, Constants::RUNQMAKE, globalcontext);
|
||||||
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
||||||
connect(m_runQMakeAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(runQMake()));
|
connect(m_runQMakeAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(runQMake()));
|
||||||
|
|
||||||
m_rebuildSubProjectAction = new Utils::ParameterAction(tr("Rebuild Subproject"), tr("Rebuild Subproject \"%1\""),
|
m_rebuildSubProjectAction = new Utils::ParameterAction(tr("Rebuild Subproject"), tr("Rebuild Subproject \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled, this);
|
Utils::ParameterAction::AlwaysEnabled, this);
|
||||||
command = Core::ActionManager::registerAction(m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext);
|
command = ActionManager::registerAction(m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
command->setDescription(m_rebuildSubProjectAction->text());
|
command->setDescription(m_rebuildSubProjectAction->text());
|
||||||
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_REBUILD);
|
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_REBUILD);
|
||||||
connect(m_rebuildSubProjectAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(rebuildSubDirContextMenu()));
|
connect(m_rebuildSubProjectAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(rebuildSubDirContextMenu()));
|
||||||
|
|
||||||
m_cleanSubProjectAction = new Utils::ParameterAction(tr("Clean Subproject"), tr("Clean Subproject \"%1\""),
|
m_cleanSubProjectAction = new Utils::ParameterAction(tr("Clean Subproject"), tr("Clean Subproject \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled, this);
|
Utils::ParameterAction::AlwaysEnabled, this);
|
||||||
command = Core::ActionManager::registerAction(m_cleanSubProjectAction, Constants::CLEANSUBDIR, projectContext);
|
command = ActionManager::registerAction(m_cleanSubProjectAction, Constants::CLEANSUBDIR, projectContext);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
command->setDescription(m_cleanSubProjectAction->text());
|
command->setDescription(m_cleanSubProjectAction->text());
|
||||||
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_CLEAN);
|
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_CLEAN);
|
||||||
connect(m_cleanSubProjectAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(cleanSubDirContextMenu()));
|
connect(m_cleanSubProjectAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(cleanSubDirContextMenu()));
|
||||||
|
|
||||||
m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""),
|
m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled, this);
|
Utils::ParameterAction::AlwaysEnabled, this);
|
||||||
command = Core::ActionManager::registerAction(m_buildFileAction, Constants::BUILDFILE);
|
command = ActionManager::registerAction(m_buildFileAction, Constants::BUILDFILE);
|
||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
command->setAttribute(Core::Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
command->setDescription(m_buildFileAction->text());
|
command->setDescription(m_buildFileAction->text());
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+B")));
|
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+B")));
|
||||||
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
||||||
@@ -235,22 +236,22 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged,
|
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged,
|
||||||
this, &QmakeProjectManagerPlugin::updateContextActions);
|
this, &QmakeProjectManagerPlugin::updateContextActions);
|
||||||
|
|
||||||
Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(QmakeProjectManager::Constants::M_CONTEXT);
|
ActionContainer *contextMenu = ActionManager::createMenu(QmakeProjectManager::Constants::M_CONTEXT);
|
||||||
|
|
||||||
Core::Context proFileEditorContext = Core::Context(QmakeProjectManager::Constants::PROFILE_EDITOR_ID);
|
Context proFileEditorContext = Context(QmakeProjectManager::Constants::PROFILE_EDITOR_ID);
|
||||||
|
|
||||||
command = Core::ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR);
|
command = ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR);
|
||||||
contextMenu->addAction(command);
|
contextMenu->addAction(command);
|
||||||
|
|
||||||
m_addLibraryAction = new QAction(tr("Add Library..."), this);
|
m_addLibraryAction = new QAction(tr("Add Library..."), this);
|
||||||
command = Core::ActionManager::registerAction(m_addLibraryAction,
|
command = ActionManager::registerAction(m_addLibraryAction,
|
||||||
Constants::ADDLIBRARY, proFileEditorContext);
|
Constants::ADDLIBRARY, proFileEditorContext);
|
||||||
connect(m_addLibraryAction, SIGNAL(triggered()),
|
connect(m_addLibraryAction, SIGNAL(triggered()),
|
||||||
m_qmakeProjectManager, SLOT(addLibrary()));
|
m_qmakeProjectManager, SLOT(addLibrary()));
|
||||||
contextMenu->addAction(command);
|
contextMenu->addAction(command);
|
||||||
|
|
||||||
m_addLibraryActionContextMenu = new QAction(tr("Add Library..."), this);
|
m_addLibraryActionContextMenu = new QAction(tr("Add Library..."), this);
|
||||||
command = Core::ActionManager::registerAction(m_addLibraryActionContextMenu,
|
command = ActionManager::registerAction(m_addLibraryActionContextMenu,
|
||||||
Constants::ADDLIBRARY, projecTreeContext);
|
Constants::ADDLIBRARY, projecTreeContext);
|
||||||
connect(m_addLibraryActionContextMenu, SIGNAL(triggered()),
|
connect(m_addLibraryActionContextMenu, SIGNAL(triggered()),
|
||||||
m_qmakeProjectManager, SLOT(addLibraryContextMenu()));
|
m_qmakeProjectManager, SLOT(addLibraryContextMenu()));
|
||||||
@@ -259,11 +260,11 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
|
|
||||||
contextMenu->addSeparator(proFileEditorContext);
|
contextMenu->addSeparator(proFileEditorContext);
|
||||||
|
|
||||||
command = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
|
command = ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
|
||||||
contextMenu->addAction(command);
|
contextMenu->addAction(command);
|
||||||
|
|
||||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
|
||||||
this, SLOT(updateBuildFileAction()));
|
this, &QmakeProjectManagerPlugin::updateBuildFileAction);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -394,7 +395,7 @@ void QmakeProjectManagerPlugin::updateBuildFileAction()
|
|||||||
bool visible = false;
|
bool visible = false;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
|
||||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
if (IDocument *currentDocument= EditorManager::currentDocument()) {
|
||||||
Utils::FileName file = currentDocument->filePath();
|
Utils::FileName file = currentDocument->filePath();
|
||||||
Node *node = SessionManager::nodeForFile(file);
|
Node *node = SessionManager::nodeForFile(file);
|
||||||
Project *project = SessionManager::projectForFile(file);
|
Project *project = SessionManager::projectForFile(file);
|
||||||
|
|||||||
Reference in New Issue
Block a user