ProjectExplorer: Add runStartupProject() convenience function

The usage pattern seems to be used often enough to justify a function.

Change-Id: Iecdeb2b42879f419154902e685d0d13e8cae8b33
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
hjk
2015-02-19 17:20:38 +01:00
parent 6fb766bf43
commit 54ce123a26
6 changed files with 18 additions and 36 deletions

View File

@@ -709,9 +709,6 @@ public:
void showSettingsDialog(); void showSettingsDialog();
void updateDebugWithoutDeployMenu(); void updateDebugWithoutDeployMenu();
void debugProject();
void debugProjectWithoutDeploy();
void debugProjectBreakMain();
void startAndDebugApplication(); void startAndDebugApplication();
void startRemoteCdbSession(); void startRemoteCdbSession();
void startRemoteServer(); void startRemoteServer();
@@ -819,7 +816,7 @@ public slots:
void handleExecStep() void handleExecStep()
{ {
if (currentEngine()->state() == DebuggerNotReady) { if (currentEngine()->state() == DebuggerNotReady) {
debugProjectBreakMain(); ProjectExplorerPlugin::runStartupProject(DebugRunModeWithBreakOnMain);
} else { } else {
currentEngine()->resetLocation(); currentEngine()->resetLocation();
if (boolSetting(OperateByInstruction)) if (boolSetting(OperateByInstruction))
@@ -832,7 +829,7 @@ public slots:
void handleExecNext() void handleExecNext()
{ {
if (currentEngine()->state() == DebuggerNotReady) { if (currentEngine()->state() == DebuggerNotReady) {
debugProjectBreakMain(); ProjectExplorerPlugin::runStartupProject(DebugRunModeWithBreakOnMain);
} else { } else {
currentEngine()->resetLocation(); currentEngine()->resetLocation();
if (boolSetting(OperateByInstruction)) if (boolSetting(OperateByInstruction))
@@ -1327,21 +1324,6 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
setProxyAction(m_visibleStartAction, Id(Constants::DEBUG)); setProxyAction(m_visibleStartAction, Id(Constants::DEBUG));
} }
void DebuggerPluginPrivate::debugProject()
{
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode);
}
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
{
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode, true);
}
void DebuggerPluginPrivate::debugProjectBreakMain()
{
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunModeWithBreakOnMain);
}
void DebuggerPluginPrivate::startAndDebugApplication() void DebuggerPluginPrivate::startAndDebugApplication()
{ {
DebuggerStartParameters sp; DebuggerStartParameters sp;
@@ -2652,11 +2634,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
debuggerIcon.addFile(QLatin1String(":/projectexplorer/images/debugger_start.png")); debuggerIcon.addFile(QLatin1String(":/projectexplorer/images/debugger_start.png"));
act->setIcon(debuggerIcon); act->setIcon(debuggerIcon);
act->setText(tr("Start Debugging")); act->setText(tr("Start Debugging"));
connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::debugProject); connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(DebugRunMode); });
act = m_debugWithoutDeployAction = new QAction(this); act = m_debugWithoutDeployAction = new QAction(this);
act->setText(tr("Start Debugging Without Deployment")); act->setText(tr("Start Debugging Without Deployment"));
connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::debugProjectWithoutDeploy); connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(DebugRunMode, true); });
act = m_startAndDebugApplicationAction = new QAction(this); act = m_startAndDebugApplicationAction = new QAction(this);
act->setText(tr("Start and Debug External Application...")); act->setText(tr("Start and Debug External Application..."));

View File

@@ -2256,12 +2256,12 @@ void ProjectExplorerPlugin::cleanSession()
void ProjectExplorerPlugin::runProject() void ProjectExplorerPlugin::runProject()
{ {
runProject(SessionManager::startupProject(), NormalRunMode); runStartupProject(NormalRunMode);
} }
void ProjectExplorerPlugin::runProjectWithoutDeploy() void ProjectExplorerPlugin::runProjectWithoutDeploy()
{ {
runProject(SessionManager::startupProject(), NormalRunMode, true); runStartupProject(NormalRunMode, true);
} }
void ProjectExplorerPlugin::runProjectContextMenu() void ProjectExplorerPlugin::runProjectContextMenu()
@@ -2390,6 +2390,11 @@ void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool fo
runRunConfiguration(rc, mode, forceSkipDeploy); runRunConfiguration(rc, mode, forceSkipDeploy);
} }
void ProjectExplorerPlugin::runStartupProject(RunMode runMode, bool forceSkipDeploy)
{
runProject(SessionManager::startupProject(), runMode, forceSkipDeploy);
}
void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc, void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
RunMode runMode, RunMode runMode,
const bool forceSkipDeploy) const bool forceSkipDeploy)

View File

@@ -99,6 +99,7 @@ public:
static bool canRun(Project *pro, RunMode runMode, QString *whyNot = 0); static bool canRun(Project *pro, RunMode runMode, QString *whyNot = 0);
static void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false); static void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false);
static void runStartupProject(RunMode runMode, bool forceSkipDeploy = false);
static void runRunConfiguration(RunConfiguration *rc, RunMode runMode, static void runRunConfiguration(RunConfiguration *rc, RunMode runMode,
const bool forceSkipDeploy = false); const bool forceSkipDeploy = false);

View File

@@ -498,8 +498,7 @@ void QmlProfilerTool::startLocalTool()
AnalyzerManager::showMode(); AnalyzerManager::showMode();
// ### not sure if we're supposed to check if the RunConFiguration isEnabled // ### not sure if we're supposed to check if the RunConFiguration isEnabled
Project *pro = SessionManager::startupProject(); ProjectExplorerPlugin::runStartupProject(QmlProfilerRunMode);
ProjectExplorerPlugin::runProject(pro, QmlProfilerRunMode);
} }
void QmlProfilerTool::startRemoteTool() void QmlProfilerTool::startRemoteTool()

View File

@@ -560,8 +560,7 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa
void CallgrindTool::startLocalTool() void CallgrindTool::startLocalTool()
{ {
if (checkForLocalStart(ReleaseMode)) { if (checkForLocalStart(ReleaseMode)) {
Project *pro = SessionManager::startupProject(); ProjectExplorerPlugin::runStartupProject(CallgrindRunMode);
ProjectExplorerPlugin::runProject(pro, CallgrindRunMode);
d->setBusyCursor(true); d->setBusyCursor(true);
} }
} }

View File

@@ -599,10 +599,8 @@ void MemcheckTool::setBusyCursor(bool busy)
void MemcheckTool::startLocalTool() void MemcheckTool::startLocalTool()
{ {
if (checkForLocalStart(DebugMode)) { if (checkForLocalStart(DebugMode))
Project *pro = SessionManager::startupProject(); ProjectExplorerPlugin::runStartupProject(MemcheckRunMode);
ProjectExplorerPlugin::runProject(pro, MemcheckRunMode);
}
} }
void MemcheckTool::startRemoteTool() void MemcheckTool::startRemoteTool()
@@ -622,10 +620,8 @@ MemcheckWithGdbTool::MemcheckWithGdbTool(QObject *parent) :
void MemcheckWithGdbTool::startLocalTool() void MemcheckWithGdbTool::startLocalTool()
{ {
if (checkForLocalStart(DebugMode)) { if (checkForLocalStart(DebugMode))
Project *pro = SessionManager::startupProject(); ProjectExplorerPlugin::runStartupProject(MemcheckWithGdbRunMode);
ProjectExplorerPlugin::runProject(pro, MemcheckWithGdbRunMode);
}
} }
void MemcheckWithGdbTool::startRemoteTool() void MemcheckWithGdbTool::startRemoteTool()