forked from qt-creator/qt-creator
Fixes: Run from the context menu runs the startupProject
Task: Reported on mailing list.
This commit is contained in:
@@ -521,6 +521,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
|||||||
cmd = am->registerAction(m_runAction, Constants::RUN, globalcontext);
|
cmd = am->registerAction(m_runAction, Constants::RUN, globalcontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
|
||||||
mbuild->addAction(cmd, Constants::G_BUILD_RUN);
|
mbuild->addAction(cmd, Constants::G_BUILD_RUN);
|
||||||
|
|
||||||
|
m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
|
||||||
|
cmd = am->registerAction(m_runActionContextMenu, Constants::RUNCONTEXTMENU, globalcontext);
|
||||||
mproject->addAction(cmd, Constants::G_PROJECT_RUN);
|
mproject->addAction(cmd, Constants::G_PROJECT_RUN);
|
||||||
|
|
||||||
Core::ActionContainer *mrc = am->createMenu(Constants::RUNCONFIGURATIONMENU);
|
Core::ActionContainer *mrc = am->createMenu(Constants::RUNCONFIGURATIONMENU);
|
||||||
@@ -616,6 +619,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
|||||||
connect(m_cleanAction, SIGNAL(triggered()), this, SLOT(cleanProject()));
|
connect(m_cleanAction, SIGNAL(triggered()), this, SLOT(cleanProject()));
|
||||||
connect(m_cleanSessionAction, SIGNAL(triggered()), this, SLOT(cleanSession()));
|
connect(m_cleanSessionAction, SIGNAL(triggered()), this, SLOT(cleanSession()));
|
||||||
connect(m_runAction, SIGNAL(triggered()), this, SLOT(runProject()));
|
connect(m_runAction, SIGNAL(triggered()), this, SLOT(runProject()));
|
||||||
|
connect(m_runActionContextMenu, SIGNAL(triggered()), this, SLOT(runProjectContextMenu()));
|
||||||
connect(m_cancelBuildAction, SIGNAL(triggered()), this, SLOT(cancelBuild()));
|
connect(m_cancelBuildAction, SIGNAL(triggered()), this, SLOT(cancelBuild()));
|
||||||
connect(m_debugAction, SIGNAL(triggered()), this, SLOT(debugProject()));
|
connect(m_debugAction, SIGNAL(triggered()), this, SLOT(debugProject()));
|
||||||
connect(m_dependenciesAction, SIGNAL(triggered()), this, SLOT(editDependencies()));
|
connect(m_dependenciesAction, SIGNAL(triggered()), this, SLOT(editDependencies()));
|
||||||
@@ -1348,7 +1352,16 @@ void ProjectExplorerPlugin::cleanSession()
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::runProject()
|
void ProjectExplorerPlugin::runProject()
|
||||||
{
|
{
|
||||||
Project *pro = startupProject();
|
runProjectImpl(startupProject());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectExplorerPlugin::runProjectContextMenu()
|
||||||
|
{
|
||||||
|
runProjectImpl(m_currentProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectExplorerPlugin::runProjectImpl(Project *pro)
|
||||||
|
{
|
||||||
if (!pro)
|
if (!pro)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1434,10 +1447,14 @@ IRunConfigurationRunner *ProjectExplorerPlugin::findRunner(QSharedPointer<RunCon
|
|||||||
void ProjectExplorerPlugin::updateRunAction()
|
void ProjectExplorerPlugin::updateRunAction()
|
||||||
{
|
{
|
||||||
const Project *project = startupProject();
|
const Project *project = startupProject();
|
||||||
const bool canRun = project && findRunner(project->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
|
bool canRun = project && findRunner(project->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
|
||||||
const bool canDebug = project && !m_debuggingRunControl && findRunner(project->activeRunConfiguration(), ProjectExplorer::Constants::DEBUGMODE);
|
const bool canDebug = project && !m_debuggingRunControl && findRunner(project->activeRunConfiguration(), ProjectExplorer::Constants::DEBUGMODE);
|
||||||
const bool building = m_buildManager->isBuilding();
|
const bool building = m_buildManager->isBuilding();
|
||||||
m_runAction->setEnabled(canRun && !building);
|
m_runAction->setEnabled(canRun && !building);
|
||||||
|
|
||||||
|
canRun = m_currentProject && findRunner(m_currentProject->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
|
||||||
|
m_runActionContextMenu->setEnabled(canRun && !building);
|
||||||
|
|
||||||
m_debugAction->setEnabled(canDebug && !building);
|
m_debugAction->setEnabled(canDebug && !building);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ private slots:
|
|||||||
void restoreSession();
|
void restoreSession();
|
||||||
void loadSession(const QString &session);
|
void loadSession(const QString &session);
|
||||||
void runProject();
|
void runProject();
|
||||||
|
void runProjectContextMenu();
|
||||||
void savePersistentSettings();
|
void savePersistentSettings();
|
||||||
void goToTaskWindow();
|
void goToTaskWindow();
|
||||||
|
|
||||||
@@ -188,6 +189,7 @@ private slots:
|
|||||||
void currentModeChanged(Core::IMode *mode);
|
void currentModeChanged(Core::IMode *mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void runProjectImpl(Project *pro);
|
||||||
void setCurrent(Project *project, QString filePath, Node *node);
|
void setCurrent(Project *project, QString filePath, Node *node);
|
||||||
|
|
||||||
QStringList allFilesWithDependencies(Project *pro);
|
QStringList allFilesWithDependencies(Project *pro);
|
||||||
@@ -223,6 +225,7 @@ private:
|
|||||||
QAction *m_cleanAction;
|
QAction *m_cleanAction;
|
||||||
QAction *m_cleanSessionAction;
|
QAction *m_cleanSessionAction;
|
||||||
QAction *m_runAction;
|
QAction *m_runAction;
|
||||||
|
QAction *m_runActionContextMenu;
|
||||||
QAction *m_cancelBuildAction;
|
QAction *m_cancelBuildAction;
|
||||||
QAction *m_debugAction;
|
QAction *m_debugAction;
|
||||||
QAction *m_dependenciesAction;
|
QAction *m_dependenciesAction;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ const char * const BUILDCONFIGURATIONMENU = "ProjectExplorer.BuildConfigurationM
|
|||||||
const char * const CANCELBUILD = "ProjectExplorer.CancelBuild";
|
const char * const CANCELBUILD = "ProjectExplorer.CancelBuild";
|
||||||
const char * const RUNCONFIGURATIONMENU = "ProjectExplorer.RunConfigurationMenu";
|
const char * const RUNCONFIGURATIONMENU = "ProjectExplorer.RunConfigurationMenu";
|
||||||
const char * const RUN = "ProjectExplorer.Run";
|
const char * const RUN = "ProjectExplorer.Run";
|
||||||
|
const char * const RUNCONTEXTMENU = "ProjectExplorer.RunContextMenu";
|
||||||
const char * const STOP = "ProjectExplorer.Stop";
|
const char * const STOP = "ProjectExplorer.Stop";
|
||||||
const char * const DEBUG = "ProjectExplorer.Debug";
|
const char * const DEBUG = "ProjectExplorer.Debug";
|
||||||
const char * const DEPENDENCIES = "ProjectExplorer.Dependencies";
|
const char * const DEPENDENCIES = "ProjectExplorer.Dependencies";
|
||||||
|
|||||||
Reference in New Issue
Block a user