forked from qt-creator/qt-creator
BlackBerry: De-noise blackberryruncontrolfactory.cpp
Change-Id: I19d50b7a707a769f71d2d0325eff84a21752ac87 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -55,16 +55,19 @@
|
|||||||
#include <analyzerbase/analyzerruncontrol.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Analyzer;
|
||||||
using namespace Qnx::Internal;
|
using namespace Debugger;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
|
namespace Qnx {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
BlackBerryRunControlFactory::BlackBerryRunControlFactory(QObject *parent)
|
BlackBerryRunControlFactory::BlackBerryRunControlFactory(QObject *parent)
|
||||||
: ProjectExplorer::IRunControlFactory(parent)
|
: IRunControlFactory(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackBerryRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration,
|
bool BlackBerryRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
|
||||||
ProjectExplorer::RunMode mode) const
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(mode);
|
Q_UNUSED(mode);
|
||||||
|
|
||||||
@@ -80,7 +83,7 @@ bool BlackBerryRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runC
|
|||||||
// not launch a second instance. Disable the Run button if the application is already
|
// not launch a second instance. Disable the Run button if the application is already
|
||||||
// running on the device.
|
// running on the device.
|
||||||
if (m_activeRunControls.contains(rc->key())) {
|
if (m_activeRunControls.contains(rc->key())) {
|
||||||
QPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[rc->key()];
|
QPointer<RunControl> activeRunControl = m_activeRunControls[rc->key()];
|
||||||
if (activeRunControl && activeRunControl.data()->isRunning())
|
if (activeRunControl && activeRunControl.data()->isRunning())
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
@@ -92,65 +95,64 @@ bool BlackBerryRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runC
|
|||||||
return activeDeployConf != 0;
|
return activeDeployConf != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createAnalyzerStartParameters(Analyzer::AnalyzerStartParameters *pStartParameters, BlackBerryRunConfiguration* runConfiguration, ProjectExplorer::RunMode mode)
|
static void createAnalyzerStartParameters(AnalyzerStartParameters *pStartParameters, BlackBerryRunConfiguration* runConfiguration, RunMode mode)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(pStartParameters, return);
|
QTC_ASSERT(pStartParameters, return);
|
||||||
pStartParameters->runMode = mode;
|
pStartParameters->runMode = mode;
|
||||||
if (mode == ProjectExplorer::QmlProfilerRunMode)
|
if (mode == QmlProfilerRunMode)
|
||||||
pStartParameters->startMode = Analyzer::StartLocal;
|
pStartParameters->startMode = StartLocal;
|
||||||
|
|
||||||
ProjectExplorer::Target *target = runConfiguration->target();
|
Target *target = runConfiguration->target();
|
||||||
ProjectExplorer::Kit *kit = target->kit();
|
Kit *kit = target->kit();
|
||||||
|
|
||||||
ProjectExplorer::IDevice::ConstPtr device = ProjectExplorer::DeviceKitInformation::device(kit);
|
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
if (device) {
|
if (device) {
|
||||||
pStartParameters->connParams = device->sshParameters();
|
pStartParameters->connParams = device->sshParameters();
|
||||||
pStartParameters->analyzerHost = device->qmlProfilerHost();
|
pStartParameters->analyzerHost = device->qmlProfilerHost();
|
||||||
}
|
}
|
||||||
pStartParameters->sysroot = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString();
|
pStartParameters->sysroot = SysRootKitInformation::sysRoot(kit).toString();
|
||||||
|
|
||||||
Debugger::DebuggerRunConfigurationAspect *aspect = runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
DebuggerRunConfigurationAspect *aspect = runConfiguration->extraAspect<DebuggerRunConfigurationAspect>();
|
||||||
if (aspect)
|
if (aspect)
|
||||||
pStartParameters->analyzerPort = aspect->qmlDebugServerPort();
|
pStartParameters->analyzerPort = aspect->qmlDebugServerPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Debugger::DebuggerStartParameters startParameters(BlackBerryRunConfiguration *runConfig)
|
static DebuggerStartParameters startParameters(BlackBerryRunConfiguration *runConfig)
|
||||||
{
|
{
|
||||||
Debugger::DebuggerStartParameters params;
|
DebuggerStartParameters params;
|
||||||
ProjectExplorer::Target *target = runConfig->target();
|
Target *target = runConfig->target();
|
||||||
ProjectExplorer::Kit *k = target->kit();
|
Kit *k = target->kit();
|
||||||
|
|
||||||
params.startMode = Debugger::AttachToRemoteServer;
|
params.startMode = AttachToRemoteServer;
|
||||||
params.debuggerCommand = Debugger::DebuggerKitInformation::debuggerCommand(k).toString();
|
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(k).toString();
|
||||||
params.sysRoot = ProjectExplorer::SysRootKitInformation::sysRoot(k).toString();
|
params.sysRoot = SysRootKitInformation::sysRoot(k).toString();
|
||||||
params.useCtrlCStub = true;
|
params.useCtrlCStub = true;
|
||||||
params.runConfiguration = runConfig;
|
params.runConfiguration = runConfig;
|
||||||
|
|
||||||
if (ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k))
|
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
|
||||||
params.toolChainAbi = tc->targetAbi();
|
params.toolChainAbi = tc->targetAbi();
|
||||||
|
|
||||||
params.executable = runConfig->localExecutableFilePath();
|
params.executable = runConfig->localExecutableFilePath();
|
||||||
params.displayName = runConfig->displayName();
|
params.displayName = runConfig->displayName();
|
||||||
params.remoteSetupNeeded = true;
|
params.remoteSetupNeeded = true;
|
||||||
|
|
||||||
Debugger::DebuggerRunConfigurationAspect *aspect
|
DebuggerRunConfigurationAspect *aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
|
||||||
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
|
||||||
if (aspect->useQmlDebugger()) {
|
if (aspect->useQmlDebugger()) {
|
||||||
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfig->target()->kit());
|
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfig->target()->kit());
|
||||||
if (device) {
|
if (device) {
|
||||||
params.qmlServerAddress = device->sshParameters().host;
|
params.qmlServerAddress = device->sshParameters().host;
|
||||||
params.qmlServerPort = aspect->qmlDebugServerPort();
|
params.qmlServerPort = aspect->qmlDebugServerPort();
|
||||||
params.languages |= Debugger::QmlLanguage;
|
params.languages |= QmlLanguage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aspect->useCppDebugger())
|
if (aspect->useCppDebugger())
|
||||||
params.languages |= Debugger::CppLanguage;
|
params.languages |= CppLanguage;
|
||||||
|
|
||||||
if (const ProjectExplorer::Project *project = runConfig->target()->project()) {
|
if (const Project *project = runConfig->target()->project()) {
|
||||||
params.projectSourceDirectory = project->projectDirectory().toString();
|
params.projectSourceDirectory = project->projectDirectory().toString();
|
||||||
if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
|
if (const BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
|
||||||
params.projectBuildDirectory = buildConfig->buildDirectory().toString();
|
params.projectBuildDirectory = buildConfig->buildDirectory().toString();
|
||||||
params.projectSourceFiles = project->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
|
params.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackBerryQtVersion *qtVersion =
|
BlackBerryQtVersion *qtVersion =
|
||||||
@@ -161,8 +163,8 @@ static Debugger::DebuggerStartParameters startParameters(BlackBerryRunConfigurat
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration,
|
RunControl *BlackBerryRunControlFactory::create(RunConfiguration *runConfiguration,
|
||||||
ProjectExplorer::RunMode mode, QString *errorMessage)
|
RunMode mode, QString *errorMessage)
|
||||||
{
|
{
|
||||||
BlackBerryRunConfiguration *rc = qobject_cast<BlackBerryRunConfiguration *>(runConfiguration);
|
BlackBerryRunConfiguration *rc = qobject_cast<BlackBerryRunConfiguration *>(runConfiguration);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
@@ -176,12 +178,12 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == ProjectExplorer::NormalRunMode) {
|
if (mode == NormalRunMode) {
|
||||||
BlackBerryRunControl *runControl = new BlackBerryRunControl(rc);
|
BlackBerryRunControl *runControl = new BlackBerryRunControl(rc);
|
||||||
m_activeRunControls[rc->key()] = runControl;
|
m_activeRunControls[rc->key()] = runControl;
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
if (mode == ProjectExplorer::QmlProfilerRunMode) {
|
if (mode == QmlProfilerRunMode) {
|
||||||
QtSupport::BaseQtVersion *qtVer = QtSupport::QtKitInformation::qtVersion(rc->target()->kit());
|
QtSupport::BaseQtVersion *qtVer = QtSupport::QtKitInformation::qtVersion(rc->target()->kit());
|
||||||
if (qtVer && qtVer->qtVersion() <= QtSupport::QtVersionNumber(4, 8, 6))
|
if (qtVer && qtVer->qtVersion() <= QtSupport::QtVersionNumber(4, 8, 6))
|
||||||
Core::MessageManager::write(tr("Target Qt version (%1) might not support QML profiling. "
|
Core::MessageManager::write(tr("Target Qt version (%1) might not support QML profiling. "
|
||||||
@@ -190,10 +192,10 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
|
|||||||
.arg(qtVer->qtVersionString()), Core::MessageManager::Flash
|
.arg(qtVer->qtVersionString()), Core::MessageManager::Flash
|
||||||
);
|
);
|
||||||
|
|
||||||
Analyzer::AnalyzerStartParameters params;
|
AnalyzerStartParameters params;
|
||||||
createAnalyzerStartParameters(¶ms, rc, mode);
|
createAnalyzerStartParameters(¶ms, rc, mode);
|
||||||
|
|
||||||
Analyzer::AnalyzerRunControl *runControl = Analyzer::AnalyzerManager::createRunControl(params, runConfiguration);
|
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfiguration);
|
||||||
BlackBerryApplicationRunner::LaunchFlags launchFlags(BlackBerryApplicationRunner::QmlDebugLaunch
|
BlackBerryApplicationRunner::LaunchFlags launchFlags(BlackBerryApplicationRunner::QmlDebugLaunch
|
||||||
| BlackBerryApplicationRunner::QmlDebugLaunchBlocking
|
| BlackBerryApplicationRunner::QmlDebugLaunchBlocking
|
||||||
| BlackBerryApplicationRunner::QmlProfilerLaunch);
|
| BlackBerryApplicationRunner::QmlProfilerLaunch);
|
||||||
@@ -207,8 +209,8 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
|
|||||||
connect(runControl, SIGNAL(finished()), runner, SLOT(stop()));
|
connect(runControl, SIGNAL(finished()), runner, SLOT(stop()));
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
Debugger::DebuggerRunControl * const runControl =
|
|
||||||
Debugger::DebuggerRunControlFactory::doCreate(startParameters(rc), errorMessage);
|
DebuggerRunControl *runControl = DebuggerRunControlFactory::doCreate(startParameters(rc), errorMessage);
|
||||||
if (!runControl)
|
if (!runControl)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -216,3 +218,6 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
|
|||||||
m_activeRunControls[rc->key()] = runControl;
|
m_activeRunControls[rc->key()] = runControl;
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qnx
|
||||||
|
Reference in New Issue
Block a user