From 5aef8ac4d72d757ef155b75dfe315a7427c4abde Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 26 Apr 2012 19:28:59 +0200 Subject: [PATCH] Separate destructive clean/rebuild actions from rest. Also clean up the use of icons to be more consistent. In the project context menu show the name of the project the actions apply to only once in "Set '%1' as Active Project" (and in the "Close Project '%1'") to avoid repetition. Change-Id: I7f2d7bc9e3ed60c915e0a2badfbdab5f854e9b6f Reviewed-by: Daniel Teske --- .../cmakeprojectmanager.cpp | 2 +- .../projectexplorer/projectexplorer.cpp | 189 +++++++++--------- .../projectexplorerconstants.h | 10 +- .../qt4projectmanagerplugin.cpp | 47 +++-- .../qt4projectmanagerplugin.h | 3 +- 5 files changed, 125 insertions(+), 126 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index c07f1fc551b..ffb92c142d0 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -81,7 +81,7 @@ CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage) m_runCMakeAction = new QAction(QIcon(), tr("Run CMake"), this); Core::Command *command = am->registerAction(m_runCMakeAction, Constants::RUNCMAKE, projectContext); command->setAttribute(Core::Command::CA_Hide); - mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PROJECT); + mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_DEPLOY); connect(m_runCMakeAction, SIGNAL(triggered()), this, SLOT(runCMake())); m_runCMakeActionContextMenu = new QAction(QIcon(), tr("Run CMake"), this); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 3213275bfa6..bdf78d7801d 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -183,20 +183,20 @@ struct ProjectExplorerPluginPrivate { QAction *m_closeAllProjects; QAction *m_buildProjectOnlyAction; Utils::ParameterAction *m_buildAction; - Utils::ParameterAction *m_buildActionContextMenu; + QAction *m_buildActionContextMenu; QAction *m_buildSessionAction; QAction *m_rebuildProjectOnlyAction; Utils::ParameterAction *m_rebuildAction; - Utils::ParameterAction *m_rebuildActionContextMenu; + QAction *m_rebuildActionContextMenu; QAction *m_rebuildSessionAction; QAction *m_cleanProjectOnlyAction; QAction *m_deployProjectOnlyAction; Utils::ParameterAction *m_deployAction; - Utils::ParameterAction *m_deployActionContextMenu; + QAction *m_deployActionContextMenu; QAction *m_deploySessionAction; Utils::ParameterAction *m_publishAction; Utils::ParameterAction *m_cleanAction; - Utils::ParameterAction *m_cleanActionContextMenu; + QAction *m_cleanActionContextMenu; QAction *m_cleanSessionAction; QAction *m_runAction; QAction *m_runActionContextMenu; @@ -214,7 +214,7 @@ struct ProjectExplorerPluginPrivate { QAction *m_searchOnFileSystem; QAction *m_showInGraphicalShell; QAction *m_openTerminalHere; - QAction *m_setStartupProjectAction; + Utils::ParameterAction *m_setStartupProjectAction; QAction *m_projectSelectorAction; QAction *m_projectSelectorActionMenu; QAction *m_projectSelectorActionQuick; @@ -472,21 +472,23 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // Groups // - mbuild->appendGroup(Constants::G_BUILD_SESSION); - mbuild->appendGroup(Constants::G_BUILD_PROJECT); - mbuild->appendGroup(Constants::G_BUILD_OTHER); + mbuild->appendGroup(Constants::G_BUILD_BUILD); + mbuild->appendGroup(Constants::G_BUILD_DEPLOY); + mbuild->appendGroup(Constants::G_BUILD_REBUILD); + mbuild->appendGroup(Constants::G_BUILD_CLEAN); mbuild->appendGroup(Constants::G_BUILD_CANCEL); mbuild->appendGroup(Constants::G_BUILD_RUN); msessionContextMenu->appendGroup(Constants::G_SESSION_BUILD); + msessionContextMenu->appendGroup(Constants::G_SESSION_REBUILD); msessionContextMenu->appendGroup(Constants::G_SESSION_FILES); msessionContextMenu->appendGroup(Constants::G_SESSION_OTHER); - msessionContextMenu->appendGroup(Constants::G_SESSION_CONFIG); msessionContextMenu->appendGroup(Constants::G_PROJECT_TREE); mprojectContextMenu->appendGroup(Constants::G_PROJECT_FIRST); mprojectContextMenu->appendGroup(Constants::G_PROJECT_BUILD); mprojectContextMenu->appendGroup(Constants::G_PROJECT_RUN); + mprojectContextMenu->appendGroup(Constants::G_PROJECT_REBUILD); mprojectContextMenu->appendGroup(Constants::G_PROJECT_FILES); mprojectContextMenu->appendGroup(Constants::G_PROJECT_LAST); mprojectContextMenu->appendGroup(Constants::G_PROJECT_TREE); @@ -534,8 +536,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Build.Sep"), globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); + cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext); + msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); sep = new QAction(this); sep->setSeparator(true); @@ -544,11 +546,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); - sep = new QAction(this); - sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext); - msessionContextMenu->addAction(cmd, Constants::G_SESSION_CONFIG); - sep = new QAction(this); sep->setSeparator(true); cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext); @@ -557,20 +554,24 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er sep = new QAction(this); sep->setSeparator(true); cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_OTHER); + mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_OTHER); - sep = new QAction(this); - sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_RUN); - mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); - sep = new QAction(this); sep->setSeparator(true); cmd = am->registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); + sep = new QAction(this); + sep->setSeparator(true); + cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext); + mbuild->addAction(cmd, Constants::G_BUILD_RUN); + + sep = new QAction(this); + sep->setSeparator(true); + cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Rebuild.Sep"), globalcontext); + mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); + // // Actions // @@ -662,7 +663,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this); cmd = am->registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B"))); - mbuild->addAction(cmd, Constants::G_BUILD_SESSION); + mbuild->addAction(cmd, Constants::G_BUILD_BUILD); + msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); + + // deploy session + d->m_deploySessionAction = new QAction(tr("Deploy All"), this); + cmd = am->registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext); + mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); // rebuild session action @@ -670,22 +677,16 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er rebuildIcon.addFile(QLatin1String(Constants::ICON_REBUILD_SMALL)); d->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this); cmd = am->registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_SESSION); - msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); - - // deploy session - d->m_deploySessionAction = new QAction(tr("Deploy All"), this); - cmd = am->registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_SESSION); - msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); + mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); + msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); // clean session QIcon cleanIcon = QIcon(QLatin1String(Constants::ICON_CLEAN)); cleanIcon.addFile(QLatin1String(Constants::ICON_CLEAN_SMALL)); d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this); cmd = am->registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_SESSION); - msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); + mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); + msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); // build action d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), @@ -695,34 +696,26 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_buildAction->text()); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B"))); - mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); + mbuild->addAction(cmd, Constants::G_BUILD_BUILD); // Add to mode bar Core::ModeManager::addAction(cmd->action(), Constants::P_ACTION_BUILDPROJECT); - // rebuild action - d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), - Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext); - cmd->setAttribute(Core::Command::CA_UpdateText); - cmd->setDescription(d->m_rebuildAction->text()); - mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); - // deploy action d->m_deployAction = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); cmd = am->registerAction(d->m_deployAction, Constants::DEPLOY, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_deployAction->text()); - mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); + mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); - // Publish action - d->m_publishAction = new Utils::ParameterAction(tr("Publish Project..."), tr("Publish Project \"%1\"..."), - Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext); + // rebuild action + d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), + Utils::ParameterAction::AlwaysEnabled, this); + cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); - cmd->setDescription(d->m_publishAction->text()); - mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); + cmd->setDescription(d->m_rebuildAction->text()); + mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); // clean action d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""), @@ -730,39 +723,52 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er cmd = am->registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_cleanAction->text()); - mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); + mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); + + // cancel build action + QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); + stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL)); + d->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this); + cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext); + mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); + + // run action + d->m_runAction = new QAction(runIcon, tr("Run"), this); + cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext); + cmd->setAttribute(Core::Command::CA_UpdateText); + + cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); + mbuild->addAction(cmd, Constants::G_BUILD_RUN); + + Core::ModeManager::addAction(cmd->action(), Constants::P_ACTION_RUN); + + // Run without deployment action + d->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this); + cmd = am->registerAction(d->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext); + mbuild->addAction(cmd, Constants::G_BUILD_RUN); + + // Publish action + d->m_publishAction = new Utils::ParameterAction(tr("Publish Project..."), tr("Publish Project \"%1\"..."), + Utils::ParameterAction::AlwaysEnabled, this); + cmd = am->registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext); + cmd->setAttribute(Core::Command::CA_UpdateText); + cmd->setDescription(d->m_publishAction->text()); + mbuild->addAction(cmd, Constants::G_BUILD_RUN); // build action (context menu) - d->m_buildActionContextMenu = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), - Utils::ParameterAction::AlwaysEnabled, this); + d->m_buildActionContextMenu = new QAction(tr("Build"), this); cmd = am->registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext); - cmd->setAttribute(Core::Command::CA_UpdateText); - cmd->setDescription(d->m_buildActionContextMenu->text()); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD); // rebuild action (context menu) - d->m_rebuildActionContextMenu = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), - Utils::ParameterAction::AlwaysEnabled, this); + d->m_rebuildActionContextMenu = new QAction(tr("Rebuild"), this); cmd = am->registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext); - cmd->setAttribute(Core::Command::CA_UpdateText); - cmd->setDescription(d->m_rebuildActionContextMenu->text()); - mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD); - - // deploy action (context menu) - d->m_deployActionContextMenu = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""), - Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext); - cmd->setAttribute(Core::Command::CA_UpdateText); - cmd->setDescription(d->m_deployActionContextMenu->text()); - mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD); + mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); // clean action (context menu) - d->m_cleanActionContextMenu = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""), - Utils::ParameterAction::AlwaysEnabled, this); + d->m_cleanActionContextMenu = new QAction(tr("Clean"), this); cmd = am->registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext); - cmd->setAttribute(Core::Command::CA_UpdateText); - cmd->setDescription(d->m_cleanActionContextMenu->text()); - mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD); + mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); // build without dependencies action d->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this); @@ -780,33 +786,16 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this); cmd = am->registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext); - // run action - d->m_runAction = new QAction(runIcon, tr("Run"), this); - cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext); - cmd->setAttribute(Core::Command::CA_UpdateText); - - cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); - mbuild->addAction(cmd, Constants::G_BUILD_RUN); - - Core::ModeManager::addAction(cmd->action(), Constants::P_ACTION_RUN); + // deploy action (context menu) + d->m_deployActionContextMenu = new QAction(tr("Deploy"), this); + cmd = am->registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext); + mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this); cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); - // run without deployment action - d->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this); - cmd = am->registerAction(d->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_RUN); - - // cancel build action - QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); - stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL)); - d->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this); - cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext); - mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); - // add new file action d->m_addNewFileAction = new QAction(tr("Add New..."), this); cmd = am->registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE, @@ -864,9 +853,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // mproject->addAction(cmd, Constants::G_FOLDER_FILES); // set startup project action - d->m_setStartupProjectAction = new QAction(tr("Set as Active Project"), this); + d->m_setStartupProjectAction = new Utils::ParameterAction(tr("Set as Active Project"), + tr("Set \"%1\" as Active Project"), + Utils::ParameterAction::AlwaysEnabled, this); cmd = am->registerAction(d->m_setStartupProjectAction, ProjectExplorer::Constants::SETSTARTUP, projecTreeContext); + cmd->setAttribute(Core::Command::CA_UpdateText); + cmd->setDescription(d->m_setStartupProjectAction->text()); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FIRST); // Collapse All. @@ -1720,6 +1713,7 @@ void ProjectExplorerPlugin::updateActions() d->m_buildAction->setParameter(projectName); d->m_rebuildAction->setParameter(projectName); d->m_cleanAction->setParameter(projectName); + d->m_publishAction->setParameter(projectName); d->m_buildAction->setEnabled(buildActionState.first); d->m_rebuildAction->setEnabled(buildActionState.first); @@ -1730,9 +1724,7 @@ void ProjectExplorerPlugin::updateActions() d->m_cleanAction->setToolTip(buildActionState.second); // Context menu actions - d->m_buildActionContextMenu->setParameter(projectNameContextMenu); - d->m_rebuildActionContextMenu->setParameter(projectNameContextMenu); - d->m_cleanActionContextMenu->setParameter(projectNameContextMenu); + d->m_setStartupProjectAction->setParameter(projectNameContextMenu); d->m_buildActionContextMenu->setEnabled(buildActionContextState.first); d->m_rebuildActionContextMenu->setEnabled(buildActionContextState.first); @@ -2299,7 +2291,6 @@ void ProjectExplorerPlugin::updateDeployActions() d->m_deployAction->setParameter(projectName); d->m_deployAction->setEnabled(enableDeployActions); - d->m_deployActionContextMenu->setParameter(projectNameContextMenu); d->m_deployActionContextMenu->setEnabled(enableDeployActionsContextMenu); d->m_deployProjectOnlyAction->setEnabled(enableDeployActions); diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index decd9d73508..6624fbf1acc 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -113,9 +113,10 @@ const char M_DEBUG_STARTDEBUGGING[] = "ProjectExplorer.Menu.Debug.StartDebugging const char M_SESSION[] = "ProjectExplorer.Menu.Session"; // Menu groups -const char G_BUILD_SESSION[] = "ProjectExplorer.Group.BuildSession"; -const char G_BUILD_PROJECT[] = "ProjectExplorer.Group.Build"; -const char G_BUILD_OTHER[] = "ProjectExplorer.Group.Other"; +const char G_BUILD_BUILD[] = "ProjectExplorer.Group.Build"; +const char G_BUILD_DEPLOY[] = "ProjectExplorer.Group.Deploy"; +const char G_BUILD_REBUILD[] = "ProjectExplorer.Group.Rebuild"; +const char G_BUILD_CLEAN[] = "ProjectExplorer.Group.Clean"; const char G_BUILD_RUN[] = "ProjectExplorer.Group.Run"; const char G_BUILD_CANCEL[] = "ProjectExplorer.Group.BuildCancel"; @@ -129,12 +130,13 @@ const char M_OPENFILEWITHCONTEXT[] = "Project.Menu.File.OpenWith"; // Context menu groups const char G_SESSION_BUILD[] = "Session.Group.Build"; +const char G_SESSION_REBUILD[] = "Session.Group.Rebuild"; const char G_SESSION_FILES[] = "Session.Group.Files"; const char G_SESSION_OTHER[] = "Session.Group.Other"; -const char G_SESSION_CONFIG[] = "Session.Group.Config"; const char G_PROJECT_FIRST[] = "Project.Group.Open"; const char G_PROJECT_BUILD[] = "Project.Group.Build"; +const char G_PROJECT_REBUILD[] = "Project.Group.Rebuild"; const char G_PROJECT_RUN[] = "Project.Group.Run"; const char G_PROJECT_FILES[] = "Project.Group.Files"; const char G_PROJECT_TREE[] = "Project.Group.Tree"; diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index 86231f6ba27..0fff2668c5b 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -186,40 +186,36 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * //register actions 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, projectContext); + m_buildSubProjectContextMenu = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""), + Utils::ParameterAction::AlwaysEnabled/*handled manually*/, + this); + command = am->registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); - mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PROJECT); - connect(m_runQMakeAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMake())); + command->setAttribute(Core::Command::CA_UpdateText); + command->setDescription(m_buildSubProjectContextMenu->text()); + msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); + connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); - m_runQMakeActionContextMenu = new QAction(qmakeIcon, tr("Run qmake"), this); + m_runQMakeActionContextMenu = new QAction(tr("Run qmake"), this); command = am->registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(m_runQMakeActionContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMakeContextMenu())); - QIcon buildIcon = QIcon(QLatin1String(ProjectExplorer::Constants::ICON_BUILD)); - buildIcon.addFile(QLatin1String(ProjectExplorer::Constants::ICON_BUILD_SMALL)); - m_buildSubProjectContextMenu = new QAction(buildIcon, tr("Build"), this); - command = am->registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext); + m_subProjectRebuildSeparator = new QAction(this); + m_subProjectRebuildSeparator->setSeparator(true); command->setAttribute(Core::Command::CA_Hide); + command = am->registerAction(m_subProjectRebuildSeparator, Core::Id("ProjectExplorer.SubprojectRebuild.Sep"), projectContext); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); - connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); - QIcon rebuildIcon = QIcon(QLatin1String(ProjectExplorer::Constants::ICON_REBUILD)); - rebuildIcon.addFile(QLatin1String(ProjectExplorer::Constants::ICON_REBUILD_SMALL)); - m_rebuildSubProjectContextMenu = new QAction(rebuildIcon, tr("Rebuild"), this); + m_rebuildSubProjectContextMenu = new QAction(tr("Rebuild"), this); command = am->registerAction(m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIRCONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(m_rebuildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(rebuildSubDirContextMenu())); - QIcon cleanIcon = QIcon(QLatin1String(ProjectExplorer::Constants::ICON_CLEAN)); - cleanIcon.addFile(QLatin1String(ProjectExplorer::Constants::ICON_CLEAN_SMALL)); - m_cleanSubProjectContextMenu = new QAction(cleanIcon, tr("Clean"), this); + m_cleanSubProjectContextMenu = new QAction(tr("Clean"), this); command = am->registerAction(m_cleanSubProjectContextMenu, Constants::CLEANSUBDIRCONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); @@ -231,16 +227,22 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildSubProjectAction->text()); - mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PROJECT); + mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); connect(m_buildSubProjectAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); + m_runQMakeAction = new QAction(tr("Run qmake"), this); + command = am->registerAction(m_runQMakeAction, Constants::RUNQMAKE, projectContext); + command->setAttribute(Core::Command::CA_Hide); + mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); + connect(m_runQMakeAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMake())); + m_rebuildSubProjectAction = new Utils::ParameterAction(tr("Rebuild Subproject"), tr("Rebuild Subproject \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_rebuildSubProjectAction->text()); - mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PROJECT); + mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_REBUILD); connect(m_rebuildSubProjectAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(rebuildSubDirContextMenu())); m_cleanSubProjectAction = new Utils::ParameterAction(tr("Clean Subproject"), tr("Clean Subproject \"%1\""), @@ -249,7 +251,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_cleanSubProjectAction->text()); - mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PROJECT); + mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_CLEAN); connect(m_cleanSubProjectAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(cleanSubDirContextMenu())); connect(m_projectExplorer, @@ -324,6 +326,7 @@ void Qt4ProjectManagerPlugin::updateContextMenu(Project *project, && qt4Project->activeTarget()->activeQt4BuildConfiguration()) { m_runQMakeActionContextMenu->setVisible(true); m_buildSubProjectContextMenu->setVisible(true); + m_subProjectRebuildSeparator->setVisible(true); m_rebuildSubProjectContextMenu->setVisible(true); m_cleanSubProjectContextMenu->setVisible(true); @@ -337,6 +340,7 @@ void Qt4ProjectManagerPlugin::updateContextMenu(Project *project, } else { m_runQMakeActionContextMenu->setVisible(false); m_buildSubProjectContextMenu->setVisible(false); + m_subProjectRebuildSeparator->setVisible(false); m_rebuildSubProjectContextMenu->setVisible(false); m_cleanSubProjectContextMenu->setVisible(false); } @@ -406,6 +410,7 @@ void Qt4ProjectManagerPlugin::currentNodeChanged(ProjectExplorer::Node *node, Pr m_buildSubProjectAction->setParameter(subProjectName); m_rebuildSubProjectAction->setParameter(subProjectName); m_cleanSubProjectAction->setParameter(subProjectName); + m_buildSubProjectContextMenu->setParameter(subProjectName); m_buildSubProjectAction->setVisible(subProjectActionsVisible); m_rebuildSubProjectAction->setVisible(subProjectActionsVisible); diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h index 0cfbc1b3206..a4b38b2e92a 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h @@ -99,7 +99,8 @@ private: QAction *m_runQMakeAction; QAction *m_runQMakeActionContextMenu; - QAction *m_buildSubProjectContextMenu; + Utils::ParameterAction *m_buildSubProjectContextMenu; + QAction *m_subProjectRebuildSeparator; QAction *m_rebuildSubProjectContextMenu; QAction *m_cleanSubProjectContextMenu; Utils::ParameterAction *m_buildSubProjectAction;