forked from qt-creator/qt-creator
Debugger: Move startupRunConfiguration to RunConfiguration
It's not really debugger-specific. Change-Id: I2246e08d896df1d625ecce9b8b5428e7ea398851 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -30,11 +30,7 @@
|
|||||||
|
|
||||||
#include "../debuggermainwindow.h"
|
#include "../debuggermainwindow.h"
|
||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <QWidget>
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
@@ -3416,19 +3416,10 @@ static bool buildTypeAccepted(QFlags<ToolMode> toolMode, BuildConfiguration::Bui
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *startupRunConfiguration()
|
|
||||||
{
|
|
||||||
if (Project *pro = SessionManager::startupProject()) {
|
|
||||||
if (const Target *target = pro->activeTarget())
|
|
||||||
return target->activeRunConfiguration();
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BuildConfiguration::BuildType startupBuildType()
|
static BuildConfiguration::BuildType startupBuildType()
|
||||||
{
|
{
|
||||||
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
|
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
|
||||||
if (RunConfiguration *runConfig = startupRunConfiguration()) {
|
if (RunConfiguration *runConfig = RunConfiguration::startupRunConfiguration()) {
|
||||||
if (const BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
|
if (const BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
|
||||||
buildType = buildConfig->buildType();
|
buildType = buildConfig->buildType();
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "environmentaspect.h"
|
#include "environmentaspect.h"
|
||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
#include "runnables.h"
|
#include "runnables.h"
|
||||||
|
#include "session.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
@@ -243,6 +244,20 @@ void RunConfiguration::ctor()
|
|||||||
[this] { return displayName(); }, false);
|
[this] { return displayName(); }, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns the RunConfiguration of the currently active target
|
||||||
|
* of the startup project, if such exists, or \c nullptr otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
RunConfiguration *RunConfiguration::startupRunConfiguration()
|
||||||
|
{
|
||||||
|
if (Project *pro = SessionManager::startupProject()) {
|
||||||
|
if (const Target *target = pro->activeTarget())
|
||||||
|
return target->activeRunConfiguration();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Checks whether a run configuration is enabled.
|
Checks whether a run configuration is enabled.
|
||||||
*/
|
*/
|
||||||
|
@@ -281,6 +281,8 @@ public:
|
|||||||
|
|
||||||
void addExtraAspect(IRunConfigurationAspect *aspect);
|
void addExtraAspect(IRunConfigurationAspect *aspect);
|
||||||
|
|
||||||
|
static RunConfiguration *startupRunConfiguration();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
void requestRunActionsUpdate();
|
void requestRunActionsUpdate();
|
||||||
|
@@ -587,8 +587,8 @@ void QmlProfilerTool::attachToWaitingApplication()
|
|||||||
|
|
||||||
Debugger::selectPerspective(Constants::QmlProfilerPerspectiveId);
|
Debugger::selectPerspective(Constants::QmlProfilerPerspectiveId);
|
||||||
|
|
||||||
RunConfiguration *rc = Debugger::startupRunConfiguration();
|
auto runConfig = RunConfiguration::startupRunConfiguration();
|
||||||
auto runControl = new RunControl(rc, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
auto profiler = new QmlProfilerRunner(runControl);
|
auto profiler = new QmlProfilerRunner(runControl);
|
||||||
profiler->setServerUrl(serverUrl);
|
profiler->setServerUrl(serverUrl);
|
||||||
|
|
||||||
|
@@ -277,7 +277,7 @@ CallgrindTool::CallgrindTool(QObject *parent)
|
|||||||
menu->addAction(ActionManager::registerAction(action, CallgrindRemoteActionId),
|
menu->addAction(ActionManager::registerAction(action, CallgrindRemoteActionId),
|
||||||
Debugger::Constants::G_ANALYZER_REMOTE_TOOLS);
|
Debugger::Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||||
QObject::connect(action, &QAction::triggered, this, [this, action] {
|
QObject::connect(action, &QAction::triggered, this, [this, action] {
|
||||||
RunConfiguration *runConfig = startupRunConfiguration();
|
auto runConfig = RunConfiguration::startupRunConfiguration();
|
||||||
if (!runConfig) {
|
if (!runConfig) {
|
||||||
showCannotStartDialog(action->text());
|
showCannotStartDialog(action->text());
|
||||||
return;
|
return;
|
||||||
|
@@ -440,7 +440,7 @@ MemcheckTool::MemcheckTool(QObject *parent)
|
|||||||
menu->addAction(ActionManager::registerAction(action, "Memcheck.Remote"),
|
menu->addAction(ActionManager::registerAction(action, "Memcheck.Remote"),
|
||||||
Debugger::Constants::G_ANALYZER_REMOTE_TOOLS);
|
Debugger::Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||||
QObject::connect(action, &QAction::triggered, this, [this, action] {
|
QObject::connect(action, &QAction::triggered, this, [this, action] {
|
||||||
RunConfiguration *runConfig = startupRunConfiguration();
|
auto runConfig = RunConfiguration::startupRunConfiguration();
|
||||||
if (!runConfig) {
|
if (!runConfig) {
|
||||||
showCannotStartDialog(action->text());
|
showCannotStartDialog(action->text());
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user