Export S60DeviceRunConfiguration class

Allow class to be used in QmlProfiler. The patch moves
S60DeviceDebugRunControl(Factory) classes into their own files. Also,
make qt4Target(), qtVersion() protected and use the generic target()
method instead outside of the class.

Change-Id: I29e7609cf75d54e186fe2b9d66f52241f4fb4948
Reviewed-on: http://codereview.qt.nokia.com/425
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Paweł Polański <jaggernod@gmail.com>
This commit is contained in:
Kai Koehne
2011-06-09 12:39:39 +02:00
parent 527aa1d66c
commit e1448381bc
13 changed files with 369 additions and 283 deletions

View File

@@ -74,7 +74,7 @@ CodaRunControl::CodaRunControl(RunConfiguration *runConfiguration, const QString
{ {
const S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); const S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(s60runConfig, return); QTC_ASSERT(s60runConfig, return);
const S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(s60runConfig->qt4Target()->activeDeployConfiguration()); const S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(s60runConfig->target()->activeDeployConfiguration());
QTC_ASSERT(activeDeployConf, return); QTC_ASSERT(activeDeployConf, return);
S60DeployConfiguration::CommunicationChannel channel = activeDeployConf->communicationChannel(); S60DeployConfiguration::CommunicationChannel channel = activeDeployConf->communicationChannel();

View File

@@ -33,7 +33,8 @@ SOURCES += $$PWD/s60manager.cpp \
$$PWD/s60publishingbuildsettingspageovi.cpp \ $$PWD/s60publishingbuildsettingspageovi.cpp \
$$PWD/s60publishingresultspageovi.cpp \ $$PWD/s60publishingresultspageovi.cpp \
$$PWD/symbianqtversionfactory.cpp \ $$PWD/symbianqtversionfactory.cpp \
$$PWD/symbianqtversion.cpp $$PWD/symbianqtversion.cpp \
$$PWD/s60devicedebugruncontrol.cpp
HEADERS += $$PWD/s60manager.h \ HEADERS += $$PWD/s60manager.h \
$$PWD/sbsv2parser.h \ $$PWD/sbsv2parser.h \
@@ -70,7 +71,8 @@ HEADERS += $$PWD/s60manager.h \
$$PWD/s60publishingbuildsettingspageovi.h \ $$PWD/s60publishingbuildsettingspageovi.h \
$$PWD/s60publishingresultspageovi.h \ $$PWD/s60publishingresultspageovi.h \
$$PWD/symbianqtversionfactory.h \ $$PWD/symbianqtversionfactory.h \
$$PWD/symbianqtversion.h $$PWD/symbianqtversion.h \
$$PWD/s60devicedebugruncontrol.h
FORMS += $$PWD/s60createpackagestep.ui \ FORMS += $$PWD/s60createpackagestep.ui \
$$PWD/s60certificatedetailsdialog.ui \ $$PWD/s60certificatedetailsdialog.ui \

View File

@@ -47,11 +47,11 @@ class BaseQtVersion;
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
class Qt4ProFileNode; class Qt4ProFileNode;
class S60DeviceRunConfiguration;
namespace Internal { namespace Internal {
class Qt4SymbianTarget; class Qt4SymbianTarget;
class S60DeployConfigurationFactory; class S60DeployConfigurationFactory;
class S60DeviceRunConfiguration;
class S60DeployConfiguration : public ProjectExplorer::DeployConfiguration class S60DeployConfiguration : public ProjectExplorer::DeployConfiguration
{ {

View File

@@ -59,10 +59,12 @@ class IOutputParser;
} }
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
class S60DeviceRunConfiguration;
namespace Internal { namespace Internal {
class BuildConfiguration; class BuildConfiguration;
class S60DeviceRunConfiguration;
struct CommunicationChannel; struct CommunicationChannel;
class S60DeployStepFactory : public ProjectExplorer::IBuildStepFactory class S60DeployStepFactory : public ProjectExplorer::IBuildStepFactory

View File

@@ -0,0 +1,250 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "s60devicedebugruncontrol.h"
#include "codaruncontrol.h"
#include "qt4symbiantarget.h"
#include "s60deployconfiguration.h"
#include "s60devicerunconfiguration.h"
#include <coreplugin/icore.h>
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/project.h>
#include <utils/qtcassert.h>
#include <QtCore/QFileInfo>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
using namespace Qt4ProjectManager;
// Return symbol file which should co-exist with the executable.
// location in debug builds. This can be 'foo.sym' (ABLD) or 'foo.exe.sym' (Raptor)
static inline QString symbolFileFromExecutable(const QString &executable)
{
// 'foo.exe.sym' (Raptor)
const QFileInfo raptorSymFi(executable + QLatin1String(".sym"));
if (raptorSymFi.isFile())
return raptorSymFi.absoluteFilePath();
// 'foo.sym' (ABLD)
const int lastDotPos = executable.lastIndexOf(QLatin1Char('.'));
if (lastDotPos != -1) {
const QString symbolFileName = executable.mid(0, lastDotPos) + QLatin1String(".sym");
const QFileInfo symbolFileNameFi(symbolFileName);
if (symbolFileNameFi.isFile())
return symbolFileNameFi.absoluteFilePath();
}
return QString();
}
// Create start parameters from run configuration
static Debugger::DebuggerStartParameters s60DebuggerStartParams(const S60DeviceRunConfiguration *rc)
{
Debugger::DebuggerStartParameters sp;
QTC_ASSERT(rc, return sp);
const S60DeployConfiguration *activeDeployConf =
qobject_cast<S60DeployConfiguration *>(rc->target()->activeDeployConfiguration());
QTC_ASSERT(activeDeployConf, return sp);
const QString debugFileName = QString::fromLatin1("%1:\\sys\\bin\\%2.exe")
.arg(activeDeployConf->installationDrive()).arg(rc->targetName());
sp.remoteChannel = activeDeployConf->serialPortName();
sp.processArgs = rc->commandLineArguments();
if (rc->useQmlDebugger() && !rc->useCppDebugger())
sp.startMode = Debugger::AttachToRemote;
else
sp.startMode = Debugger::StartInternal;
sp.toolChainAbi = rc->abi();
sp.executable = debugFileName;
sp.executableUid = rc->executableUid();
sp.serverAddress = activeDeployConf->deviceAddress();
sp.serverPort = activeDeployConf->devicePort().toInt();
sp.displayName = rc->displayName();
sp.qmlServerPort = rc->qmlDebugServerPort();
if (rc->useQmlDebugger()) {
QString qmlArgs = rc->qmlCommandLineArguments();
if (sp.processArgs.length())
sp.processArgs.prepend(" ");
sp.processArgs.prepend(qmlArgs);
}
sp.communicationChannel = activeDeployConf->communicationChannel() == S60DeployConfiguration::CommunicationCodaTcpConnection?
Debugger::DebuggerStartParameters::CommunicationChannelTcpIp:
Debugger::DebuggerStartParameters::CommunicationChannelUsb;
sp.debugClient = activeDeployConf->communicationChannel() == S60DeployConfiguration::CommunicationTrkSerialConnection?
Debugger::DebuggerStartParameters::SymbianDebugClientTrk:
Debugger::DebuggerStartParameters::SymbianDebugClientCoda;
if (const ProjectExplorer::Project *project = rc->target()->project()) {
sp.projectSourceDirectory = project->projectDirectory();
if (const ProjectExplorer::BuildConfiguration *buildConfig = rc->target()->activeBuildConfiguration()) {
sp.projectBuildDirectory = buildConfig->buildDirectory();
}
sp.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles);
}
QTC_ASSERT(sp.executableUid, return sp);
// Prefer the '*.sym' file over the '.exe', which should exist at the same
// location in debug builds. This can be 'foo.exe' (ABLD) or 'foo.exe.sym' (Raptor)
sp.symbolFileName = symbolFileFromExecutable(rc->localExecutableFileName());
return sp;
}
S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc,
const Debugger::DebuggerStartParameters &sp,
const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes) :
Debugger::DebuggerRunControl(rc, sp, masterSlaveEngineTypes),
m_codaRunControl(NULL),
m_codaState(ENotUsingCodaRunControl)
{
if (startParameters().symbolFileName.isEmpty()) {
const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.\n").
arg(rc->localExecutableFileName());
appendMessage(msg, Utils::ErrorMessageFormat);
}
if (masterSlaveEngineTypes.first == Debugger::QmlEngineType) {
connect(engine(), SIGNAL(requestRemoteSetup()), this, SLOT(remoteSetupRequested()));
connect(engine(), SIGNAL(stateChanged(Debugger::DebuggerState)), this, SLOT(qmlEngineStateChanged(Debugger::DebuggerState)));
}
}
void S60DeviceDebugRunControl::start()
{
appendMessage(tr("Launching debugger...\n"), Utils::NormalMessageFormat);
Debugger::DebuggerRunControl::start();
}
bool S60DeviceDebugRunControl::promptToStop(bool *) const
{
// We override the settings prompt
return Debugger::DebuggerRunControl::promptToStop(0);
}
void S60DeviceDebugRunControl::remoteSetupRequested()
{
// This is called from Engine->setupInferior(), ie InferiorSetupRequested state
QTC_ASSERT(runConfiguration()->useQmlDebugger() && !runConfiguration()->useCppDebugger(), return);
m_codaRunControl = new CodaRunControl(runConfiguration(), Debugger::Constants::DEBUGMODE);
connect(m_codaRunControl, SIGNAL(connected()), this, SLOT(codaConnected()));
connect(m_codaRunControl, SIGNAL(finished()), this, SLOT(codaFinished()));
connect(m_codaRunControl, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)), this, SLOT(handleMessageFromCoda(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)));
connect(this, SIGNAL(finished()), this, SLOT(handleDebuggingFinished()));
m_codaState = EWaitingForCodaConnection;
m_codaRunControl->connect();
}
void S60DeviceDebugRunControl::codaFinished()
{
if (m_codaRunControl) {
m_codaRunControl->deleteLater();
m_codaRunControl = NULL;
}
if (m_codaState == EWaitingForCodaConnection) {
engine()->handleRemoteSetupFailed(QLatin1String("CODA failed to initialise")); // TODO sort out this error string? Unlikely we'll ever hit this state anyway.
} else {
debuggingFinished();
}
m_codaState = ENotUsingCodaRunControl;
}
void S60DeviceDebugRunControl::codaConnected()
{
QTC_ASSERT(m_codaState == EWaitingForCodaConnection, return);
m_codaState = ECodaConnected;
engine()->handleRemoteSetupDone(-1, 0); // calls notifyInferiorSetupOk()
}
void S60DeviceDebugRunControl::qmlEngineStateChanged(const Debugger::DebuggerState &state)
{
if (state == Debugger::EngineRunRequested)
m_codaRunControl->run();
}
void S60DeviceDebugRunControl::handleDebuggingFinished()
{
if (m_codaRunControl) {
m_codaRunControl->stop(); // We'll get a callback to our codaFinished() slot when it's done
}
}
void S60DeviceDebugRunControl::handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, Utils::OutputFormat format)
{
// This only gets used when QmlEngine is the master debug engine. If GDB is running, messages are handled via the gdb adapter
Q_UNUSED(aCodaRunControl)
Q_UNUSED(format)
engine()->showMessage(msg, Debugger::AppOutput);
}
//
S60DeviceDebugRunControlFactory::S60DeviceDebugRunControlFactory(QObject *parent) :
IRunControlFactory(parent)
{
}
bool S60DeviceDebugRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const
{
return mode == QLatin1String(Debugger::Constants::DEBUGMODE)
&& qobject_cast<S60DeviceRunConfiguration *>(runConfiguration) != 0;
}
ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
{
S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(rc && mode == QLatin1String(Debugger::Constants::DEBUGMODE), return 0);
const Debugger::DebuggerStartParameters startParameters = s60DebuggerStartParams(rc);
const Debugger::ConfigurationCheck check = Debugger::checkDebugConfiguration(startParameters);
if (!check) {
Core::ICore::instance()->showWarningWithOptions(S60DeviceDebugRunControl::tr("Debugger for Symbian Platform"),
check.errorMessage, check.errorDetailsString(), check.settingsCategory, check.settingsPage);
return 0;
}
return new S60DeviceDebugRunControl(rc, startParameters, check.masterSlaveEngineTypes);
}
QString S60DeviceDebugRunControlFactory::displayName() const
{
return S60DeviceDebugRunControl::tr("Debug on Device");
}
ProjectExplorer::RunConfigWidget *S60DeviceDebugRunControlFactory::createConfigurationWidget(RunConfiguration* /*runConfiguration */)
{
return 0;
}

View File

@@ -0,0 +1,88 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef S60DEVICEDEBUGRUNCONTROL_H
#define S60DEVICEDEBUGRUNCONTROL_H
#include <debugger/debuggerrunner.h>
namespace Qt4ProjectManager {
class S60DeviceRunConfiguration;
class CodaRunControl;
namespace Internal {
class S60DeviceDebugRunControl : public Debugger::DebuggerRunControl
{
Q_DISABLE_COPY(S60DeviceDebugRunControl)
Q_OBJECT
public:
explicit S60DeviceDebugRunControl(S60DeviceRunConfiguration *runConfiguration,
const Debugger::DebuggerStartParameters &sp,
const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes);
virtual void start();
virtual bool promptToStop(bool *optionalPrompt = 0) const;
private slots:
void remoteSetupRequested();
void codaConnected();
void qmlEngineStateChanged(const Debugger::DebuggerState &state);
void codaFinished();
void handleDebuggingFinished();
void handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, Utils::OutputFormat format);
private:
CodaRunControl *m_codaRunControl;
enum {
ENotUsingCodaRunControl = 0,
EWaitingForCodaConnection,
ECodaConnected
} m_codaState;
};
class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFactory
{
public:
explicit S60DeviceDebugRunControlFactory(QObject *parent = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const;
ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
QString displayName() const;
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration * /*runConfiguration */);
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // S60DEVICEDEBUGRUNCONTROL_H

View File

@@ -31,34 +31,18 @@
**************************************************************************/ **************************************************************************/
#include "s60devicerunconfiguration.h" #include "s60devicerunconfiguration.h"
#include "s60devicerunconfigurationwidget.h"
#include "s60deployconfiguration.h"
#include "qt4project.h" #include "qt4project.h"
#include "qt4target.h"
#include "s60manager.h"
#include "s60runconfigbluetoothstarter.h"
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "qt4symbiantarget.h" #include "qt4symbiantarget.h"
#include "codaruncontrol.h" #include "qt4target.h"
#include "s60deployconfiguration.h"
#include "s60devicerunconfigurationwidget.h"
#include "s60manager.h"
#include "symbianqtversion.h" #include "symbianqtversion.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
#include <qtsupport/qtoutputformatter.h> #include <qtsupport/qtoutputformatter.h>
#include <qtsupport/baseqtversion.h>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtCore/QFileInfo>
#include <QtCore/QDateTime>
#include <QtCore/QDir>
#include <QtNetwork/QTcpSocket>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
@@ -406,204 +390,3 @@ RunConfiguration *S60DeviceRunConfigurationFactory::clone(Target *parent, RunCon
S60DeviceRunConfiguration *old = static_cast<S60DeviceRunConfiguration *>(source); S60DeviceRunConfiguration *old = static_cast<S60DeviceRunConfiguration *>(source);
return new S60DeviceRunConfiguration(t, old); return new S60DeviceRunConfiguration(t, old);
} }
// ======== S60DeviceDebugRunControl
// Return symbol file which should co-exist with the executable.
// location in debug builds. This can be 'foo.sym' (ABLD) or 'foo.exe.sym' (Raptor)
static inline QString symbolFileFromExecutable(const QString &executable)
{
// 'foo.exe.sym' (Raptor)
const QFileInfo raptorSymFi(executable + QLatin1String(".sym"));
if (raptorSymFi.isFile())
return raptorSymFi.absoluteFilePath();
// 'foo.sym' (ABLD)
const int lastDotPos = executable.lastIndexOf(QLatin1Char('.'));
if (lastDotPos != -1) {
const QString symbolFileName = executable.mid(0, lastDotPos) + QLatin1String(".sym");
const QFileInfo symbolFileNameFi(symbolFileName);
if (symbolFileNameFi.isFile())
return symbolFileNameFi.absoluteFilePath();
}
return QString();
}
// Create start parameters from run configuration
static Debugger::DebuggerStartParameters s60DebuggerStartParams(const S60DeviceRunConfiguration *rc)
{
Debugger::DebuggerStartParameters sp;
QTC_ASSERT(rc, return sp);
const S60DeployConfiguration *activeDeployConf =
qobject_cast<S60DeployConfiguration *>(rc->qt4Target()->activeDeployConfiguration());
QTC_ASSERT(activeDeployConf, return sp);
const QString debugFileName = QString::fromLatin1("%1:\\sys\\bin\\%2.exe")
.arg(activeDeployConf->installationDrive()).arg(rc->targetName());
sp.remoteChannel = activeDeployConf->serialPortName();
sp.processArgs = rc->commandLineArguments();
if (rc->useQmlDebugger() && !rc->useCppDebugger())
sp.startMode = Debugger::AttachToRemote;
else
sp.startMode = Debugger::StartInternal;
sp.toolChainAbi = rc->abi();
sp.executable = debugFileName;
sp.executableUid = rc->executableUid();
sp.serverAddress = activeDeployConf->deviceAddress();
sp.serverPort = activeDeployConf->devicePort().toInt();
sp.displayName = rc->displayName();
sp.qmlServerPort = rc->qmlDebugServerPort();
if (rc->useQmlDebugger()) {
QString qmlArgs = rc->qmlCommandLineArguments();
if (sp.processArgs.length())
sp.processArgs.prepend(" ");
sp.processArgs.prepend(qmlArgs);
}
sp.communicationChannel = activeDeployConf->communicationChannel() == S60DeployConfiguration::CommunicationCodaTcpConnection?
Debugger::DebuggerStartParameters::CommunicationChannelTcpIp:
Debugger::DebuggerStartParameters::CommunicationChannelUsb;
sp.debugClient = activeDeployConf->communicationChannel() == S60DeployConfiguration::CommunicationTrkSerialConnection?
Debugger::DebuggerStartParameters::SymbianDebugClientTrk:
Debugger::DebuggerStartParameters::SymbianDebugClientCoda;
if (const ProjectExplorer::Project *project = rc->target()->project()) {
sp.projectSourceDirectory = project->projectDirectory();
if (const ProjectExplorer::BuildConfiguration *buildConfig = rc->target()->activeBuildConfiguration()) {
sp.projectBuildDirectory = buildConfig->buildDirectory();
}
sp.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles);
}
QTC_ASSERT(sp.executableUid, return sp);
// Prefer the '*.sym' file over the '.exe', which should exist at the same
// location in debug builds. This can be 'foo.exe' (ABLD) or 'foo.exe.sym' (Raptor)
sp.symbolFileName = symbolFileFromExecutable(rc->localExecutableFileName());
return sp;
}
S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc,
const Debugger::DebuggerStartParameters &sp,
const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes) :
Debugger::DebuggerRunControl(rc, sp, masterSlaveEngineTypes),
m_codaRunControl(NULL),
m_codaState(ENotUsingCodaRunControl)
{
if (startParameters().symbolFileName.isEmpty()) {
const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.\n").
arg(rc->localExecutableFileName());
appendMessage(msg, Utils::ErrorMessageFormat);
}
if (masterSlaveEngineTypes.first == Debugger::QmlEngineType) {
connect(engine(), SIGNAL(requestRemoteSetup()), this, SLOT(remoteSetupRequested()));
connect(engine(), SIGNAL(stateChanged(Debugger::DebuggerState)), this, SLOT(qmlEngineStateChanged(Debugger::DebuggerState)));
}
}
void S60DeviceDebugRunControl::start()
{
appendMessage(tr("Launching debugger...\n"), Utils::NormalMessageFormat);
Debugger::DebuggerRunControl::start();
}
bool S60DeviceDebugRunControl::promptToStop(bool *) const
{
// We override the settings prompt
return Debugger::DebuggerRunControl::promptToStop(0);
}
void S60DeviceDebugRunControl::remoteSetupRequested()
{
// This is called from Engine->setupInferior(), ie InferiorSetupRequested state
QTC_ASSERT(runConfiguration()->useQmlDebugger() && !runConfiguration()->useCppDebugger(), return);
m_codaRunControl = new CodaRunControl(runConfiguration(), Debugger::Constants::DEBUGMODE);
connect(m_codaRunControl, SIGNAL(connected()), this, SLOT(codaConnected()));
connect(m_codaRunControl, SIGNAL(finished()), this, SLOT(codaFinished()));
connect(m_codaRunControl, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)), this, SLOT(handleMessageFromCoda(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)));
connect(this, SIGNAL(finished()), this, SLOT(handleDebuggingFinished()));
m_codaState = EWaitingForCodaConnection;
m_codaRunControl->connect();
}
void S60DeviceDebugRunControl::codaFinished()
{
if (m_codaRunControl) {
m_codaRunControl->deleteLater();
m_codaRunControl = NULL;
}
if (m_codaState == EWaitingForCodaConnection) {
engine()->handleRemoteSetupFailed(QLatin1String("CODA failed to initialise")); // TODO sort out this error string? Unlikely we'll ever hit this state anyway.
} else {
debuggingFinished();
}
m_codaState = ENotUsingCodaRunControl;
}
void S60DeviceDebugRunControl::codaConnected()
{
QTC_ASSERT(m_codaState == EWaitingForCodaConnection, return);
m_codaState = ECodaConnected;
engine()->handleRemoteSetupDone(-1, 0); // calls notifyInferiorSetupOk()
}
void S60DeviceDebugRunControl::qmlEngineStateChanged(const Debugger::DebuggerState &state)
{
if (state == Debugger::EngineRunRequested)
m_codaRunControl->run();
}
void S60DeviceDebugRunControl::handleDebuggingFinished()
{
if (m_codaRunControl) {
m_codaRunControl->stop(); // We'll get a callback to our codaFinished() slot when it's done
}
}
void S60DeviceDebugRunControl::handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, Utils::OutputFormat format)
{
// This only gets used when QmlEngine is the master debug engine. If GDB is running, messages are handled via the gdb adapter
Q_UNUSED(aCodaRunControl)
Q_UNUSED(format)
engine()->showMessage(msg, Debugger::AppOutput);
}
//
S60DeviceDebugRunControlFactory::S60DeviceDebugRunControlFactory(QObject *parent) :
IRunControlFactory(parent)
{
}
bool S60DeviceDebugRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const
{
return mode == QLatin1String(Debugger::Constants::DEBUGMODE)
&& qobject_cast<S60DeviceRunConfiguration *>(runConfiguration) != 0;
}
ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
{
S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(rc && mode == QLatin1String(Debugger::Constants::DEBUGMODE), return 0);
const Debugger::DebuggerStartParameters startParameters = s60DebuggerStartParams(rc);
const Debugger::ConfigurationCheck check = Debugger::checkDebugConfiguration(startParameters);
if (!check) {
Core::ICore::instance()->showWarningWithOptions(S60DeviceDebugRunControl::tr("Debugger for Symbian Platform"),
check.errorMessage, check.errorDetailsString(), check.settingsCategory, check.settingsPage);
return 0;
}
return new S60DeviceDebugRunControl(rc, startParameters, check.masterSlaveEngineTypes);
}
QString S60DeviceDebugRunControlFactory::displayName() const
{
return S60DeviceDebugRunControl::tr("Debug on Device");
}
ProjectExplorer::RunConfigWidget *S60DeviceDebugRunControlFactory::createConfigurationWidget(RunConfiguration* /*runConfiguration */)
{
return 0;
}

View File

@@ -33,30 +33,29 @@
#ifndef S60DEVICERUNCONFIGURATION_H #ifndef S60DEVICERUNCONFIGURATION_H
#define S60DEVICERUNCONFIGURATION_H #define S60DEVICERUNCONFIGURATION_H
#include <debugger/debuggerrunner.h>
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <qt4projectmanager/qt4projectmanager_global.h>
#include <QtCore/QFutureInterface> #include <QtCore/QFutureInterface>
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
#include <QtCore/QStringList> #include <QtCore/QStringList>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QMessageBox;
class QWidget; class QWidget;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
class Qt4BaseTarget; class Qt4BaseTarget;
class Qt4ProFileNode; class Qt4ProFileNode;
class CodaRunControl;
namespace Internal { namespace Internal {
class SymbianQtVersion; class SymbianQtVersion;
class Qt4SymbianTarget; class Qt4SymbianTarget;
}
class S60DeviceRunConfigurationFactory; class S60DeviceRunConfigurationFactory;
class S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration class QT4PROJECTMANAGER_EXPORT S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration {
{
Q_OBJECT Q_OBJECT
friend class S60DeviceRunConfigurationFactory; friend class S60DeviceRunConfigurationFactory;
@@ -64,9 +63,6 @@ public:
S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const QString &proFilePath); S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const QString &proFilePath);
virtual ~S60DeviceRunConfiguration(); virtual ~S60DeviceRunConfiguration();
Qt4SymbianTarget *qt4Target() const;
SymbianQtVersion *qtVersion() const;
bool isEnabled() const; bool isEnabled() const;
QString disabledReason() const; QString disabledReason() const;
QWidget *createConfigurationWidget(); QWidget *createConfigurationWidget();
@@ -96,6 +92,7 @@ protected:
S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, S60DeviceRunConfiguration *source); S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, S60DeviceRunConfiguration *source);
QString defaultDisplayName() const; QString defaultDisplayName() const;
virtual bool fromMap(const QVariantMap &map); virtual bool fromMap(const QVariantMap &map);
private slots: private slots:
void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro); void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro);
void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success); void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success);
@@ -103,6 +100,8 @@ private slots:
private: private:
void ctor(); void ctor();
void handleParserState(bool success); void handleParserState(bool success);
Internal::Qt4SymbianTarget *qt4Target() const;
Internal::SymbianQtVersion *qtVersion() const;
QString m_proFilePath; QString m_proFilePath;
QString m_commandLineArguments; QString m_commandLineArguments;
@@ -129,48 +128,6 @@ public:
QString displayNameForId(const QString &id) const; QString displayNameForId(const QString &id) const;
}; };
// S60DeviceDebugRunControl starts debugging
class S60DeviceDebugRunControl : public Debugger::DebuggerRunControl
{
Q_DISABLE_COPY(S60DeviceDebugRunControl)
Q_OBJECT
public:
explicit S60DeviceDebugRunControl(S60DeviceRunConfiguration *runConfiguration,
const Debugger::DebuggerStartParameters &sp,
const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes);
virtual void start();
virtual bool promptToStop(bool *optionalPrompt = 0) const;
private slots:
void remoteSetupRequested();
void codaConnected();
void qmlEngineStateChanged(const Debugger::DebuggerState &state);
void codaFinished();
void handleDebuggingFinished();
void handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, Utils::OutputFormat format);
private:
CodaRunControl *m_codaRunControl;
enum {
ENotUsingCodaRunControl = 0,
EWaitingForCodaConnection,
ECodaConnected
} m_codaState;
};
class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFactory
{
public:
explicit S60DeviceDebugRunControlFactory(QObject *parent = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const;
ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
QString displayName() const;
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration * /*runConfiguration */);
};
} // namespace Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager
#endif // S60DEVICERUNCONFIGURATION_H #endif // S60DEVICERUNCONFIGURATION_H

View File

@@ -45,10 +45,11 @@ namespace Utils {
} }
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal {
class S60DeviceRunConfiguration; class S60DeviceRunConfiguration;
namespace Internal {
class S60DeviceRunConfigurationWidget : public QWidget class S60DeviceRunConfigurationWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -40,6 +40,7 @@
#include "s60deployconfiguration.h" #include "s60deployconfiguration.h"
#include "s60deploystep.h" #include "s60deploystep.h"
#include "s60runcontrolfactory.h" #include "s60runcontrolfactory.h"
#include "s60devicedebugruncontrol.h"
#include "qt4symbiantargetfactory.h" #include "qt4symbiantargetfactory.h"
#include "s60publishingwizardfactories.h" #include "s60publishingwizardfactories.h"

View File

@@ -41,6 +41,8 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <debugger/debuggerconstants.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
@@ -79,9 +81,9 @@ S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration, const Q
const S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); const S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(s60runConfig, return); QTC_ASSERT(s60runConfig, return);
const Qt4BuildConfiguration *activeBuildConf = s60runConfig->qt4Target()->activeBuildConfiguration(); const Qt4BuildConfiguration *activeBuildConf = qobject_cast<Qt4BuildConfiguration *>(s60runConfig->target()->activeBuildConfiguration());
QTC_ASSERT(activeBuildConf, return); QTC_ASSERT(activeBuildConf, return);
const S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(s60runConfig->qt4Target()->activeDeployConfiguration()); const S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(s60runConfig->target()->activeDeployConfiguration());
QTC_ASSERT(activeDeployConf, return); QTC_ASSERT(activeDeployConf, return);
m_executableUid = s60runConfig->executableUid(); m_executableUid = s60runConfig->executableUid();

View File

@@ -58,7 +58,7 @@ bool S60RunControlFactory::canRun(RunConfiguration *runConfiguration, const QStr
S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
if (!rc) if (!rc)
return false; return false;
S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(rc->qt4Target()->activeDeployConfiguration()); S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(rc->target()->activeDeployConfiguration());
return activeDeployConf != 0; return activeDeployConf != 0;
} }
@@ -69,7 +69,7 @@ RunControl* S60RunControlFactory::create(RunConfiguration *runConfiguration, con
QTC_ASSERT(rc, return 0); QTC_ASSERT(rc, return 0);
QTC_ASSERT(mode == m_mode, return 0); QTC_ASSERT(mode == m_mode, return 0);
S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(rc->qt4Target()->activeDeployConfiguration()); S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(rc->target()->activeDeployConfiguration());
if (!activeDeployConf) if (!activeDeployConf)
return 0; return 0;

View File

@@ -64,7 +64,7 @@ TrkRunControl::TrkRunControl(RunConfiguration *runConfiguration, const QString &
{ {
const S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); const S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(s60runConfig, return); QTC_ASSERT(s60runConfig, return);
const S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(s60runConfig->qt4Target()->activeDeployConfiguration()); const S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(s60runConfig->target()->activeDeployConfiguration());
QTC_ASSERT(activeDeployConf, return); QTC_ASSERT(activeDeployConf, return);
m_serialPortName = activeDeployConf->serialPortName(); m_serialPortName = activeDeployConf->serialPortName();