diff --git a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp index c99316c3ca0..323afcd66b0 100644 --- a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp @@ -74,7 +74,7 @@ CodaRunControl::CodaRunControl(RunConfiguration *runConfiguration, const QString { const S60DeviceRunConfiguration *s60runConfig = qobject_cast(runConfiguration); QTC_ASSERT(s60runConfig, return); - const S60DeployConfiguration *activeDeployConf = qobject_cast(s60runConfig->qt4Target()->activeDeployConfiguration()); + const S60DeployConfiguration *activeDeployConf = qobject_cast(s60runConfig->target()->activeDeployConfiguration()); QTC_ASSERT(activeDeployConf, return); S60DeployConfiguration::CommunicationChannel channel = activeDeployConf->communicationChannel(); diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri index ab1c6c6e3c3..1d159e38cd2 100644 --- a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri +++ b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri @@ -33,7 +33,8 @@ SOURCES += $$PWD/s60manager.cpp \ $$PWD/s60publishingbuildsettingspageovi.cpp \ $$PWD/s60publishingresultspageovi.cpp \ $$PWD/symbianqtversionfactory.cpp \ - $$PWD/symbianqtversion.cpp + $$PWD/symbianqtversion.cpp \ + $$PWD/s60devicedebugruncontrol.cpp HEADERS += $$PWD/s60manager.h \ $$PWD/sbsv2parser.h \ @@ -70,7 +71,8 @@ HEADERS += $$PWD/s60manager.h \ $$PWD/s60publishingbuildsettingspageovi.h \ $$PWD/s60publishingresultspageovi.h \ $$PWD/symbianqtversionfactory.h \ - $$PWD/symbianqtversion.h + $$PWD/symbianqtversion.h \ + $$PWD/s60devicedebugruncontrol.h FORMS += $$PWD/s60createpackagestep.ui \ $$PWD/s60certificatedetailsdialog.ui \ diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h index 20d9facc7f1..d8caddd2915 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h @@ -47,11 +47,11 @@ class BaseQtVersion; namespace Qt4ProjectManager { class Qt4ProFileNode; +class S60DeviceRunConfiguration; namespace Internal { class Qt4SymbianTarget; class S60DeployConfigurationFactory; -class S60DeviceRunConfiguration; class S60DeployConfiguration : public ProjectExplorer::DeployConfiguration { diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h index af8c8645070..5c59fbd2053 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h @@ -59,10 +59,12 @@ class IOutputParser; } namespace Qt4ProjectManager { + +class S60DeviceRunConfiguration; + namespace Internal { class BuildConfiguration; -class S60DeviceRunConfiguration; struct CommunicationChannel; class S60DeployStepFactory : public ProjectExplorer::IBuildStepFactory diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp new file mode 100644 index 00000000000..8844e9dc031 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp @@ -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 +#include +#include +#include +#include + +#include + +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(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 &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(runConfiguration) != 0; +} + +ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) +{ + S60DeviceRunConfiguration *rc = qobject_cast(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; +} diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h new file mode 100644 index 00000000000..d316bf77937 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h @@ -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 + +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 &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 diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index 0f36a536632..742fa97171c 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -31,34 +31,18 @@ **************************************************************************/ #include "s60devicerunconfiguration.h" -#include "s60devicerunconfigurationwidget.h" -#include "s60deployconfiguration.h" + #include "qt4project.h" -#include "qt4target.h" -#include "s60manager.h" -#include "s60runconfigbluetoothstarter.h" #include "qt4projectmanagerconstants.h" #include "qt4symbiantarget.h" -#include "codaruncontrol.h" +#include "qt4target.h" +#include "s60deployconfiguration.h" +#include "s60devicerunconfigurationwidget.h" +#include "s60manager.h" #include "symbianqtversion.h" #include - -#include -#include - -#include -#include #include -#include - -#include -#include -#include -#include -#include - -#include using namespace ProjectExplorer; using namespace Qt4ProjectManager; @@ -406,204 +390,3 @@ RunConfiguration *S60DeviceRunConfigurationFactory::clone(Target *parent, RunCon S60DeviceRunConfiguration *old = static_cast(source); 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(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 &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(runConfiguration) != 0; -} - -ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) -{ - S60DeviceRunConfiguration *rc = qobject_cast(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; -} diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index 6ceef271840..88e8f037a2d 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -33,30 +33,29 @@ #ifndef S60DEVICERUNCONFIGURATION_H #define S60DEVICERUNCONFIGURATION_H -#include #include +#include #include #include #include QT_BEGIN_NAMESPACE -class QMessageBox; class QWidget; QT_END_NAMESPACE namespace Qt4ProjectManager { class Qt4BaseTarget; class Qt4ProFileNode; -class CodaRunControl; namespace Internal { class SymbianQtVersion; class Qt4SymbianTarget; +} + class S60DeviceRunConfigurationFactory; -class S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration -{ +class QT4PROJECTMANAGER_EXPORT S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration { Q_OBJECT friend class S60DeviceRunConfigurationFactory; @@ -64,9 +63,6 @@ public: S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const QString &proFilePath); virtual ~S60DeviceRunConfiguration(); - Qt4SymbianTarget *qt4Target() const; - SymbianQtVersion *qtVersion() const; - bool isEnabled() const; QString disabledReason() const; QWidget *createConfigurationWidget(); @@ -96,6 +92,7 @@ protected: S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, S60DeviceRunConfiguration *source); QString defaultDisplayName() const; virtual bool fromMap(const QVariantMap &map); + private slots: void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro); void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success); @@ -103,6 +100,8 @@ private slots: private: void ctor(); void handleParserState(bool success); + Internal::Qt4SymbianTarget *qt4Target() const; + Internal::SymbianQtVersion *qtVersion() const; QString m_proFilePath; QString m_commandLineArguments; @@ -129,48 +128,6 @@ public: 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 &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 // S60DEVICERUNCONFIGURATION_H diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h index bed4f288904..b48b5865843 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h @@ -45,10 +45,11 @@ namespace Utils { } namespace Qt4ProjectManager { -namespace Internal { class S60DeviceRunConfiguration; +namespace Internal { + class S60DeviceRunConfigurationWidget : public QWidget { Q_OBJECT diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp index 870c1f87a90..9cd9c4013c6 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp @@ -40,6 +40,7 @@ #include "s60deployconfiguration.h" #include "s60deploystep.h" #include "s60runcontrolfactory.h" +#include "s60devicedebugruncontrol.h" #include "qt4symbiantargetfactory.h" #include "s60publishingwizardfactories.h" diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp index e97b8884929..e88223d0a77 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp @@ -41,6 +41,8 @@ #include +#include + #include #include @@ -79,9 +81,9 @@ S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration, const Q const S60DeviceRunConfiguration *s60runConfig = qobject_cast(runConfiguration); QTC_ASSERT(s60runConfig, return); - const Qt4BuildConfiguration *activeBuildConf = s60runConfig->qt4Target()->activeBuildConfiguration(); + const Qt4BuildConfiguration *activeBuildConf = qobject_cast(s60runConfig->target()->activeBuildConfiguration()); QTC_ASSERT(activeBuildConf, return); - const S60DeployConfiguration *activeDeployConf = qobject_cast(s60runConfig->qt4Target()->activeDeployConfiguration()); + const S60DeployConfiguration *activeDeployConf = qobject_cast(s60runConfig->target()->activeDeployConfiguration()); QTC_ASSERT(activeDeployConf, return); m_executableUid = s60runConfig->executableUid(); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp index ce17aeaffd3..25602e296e2 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp @@ -58,7 +58,7 @@ bool S60RunControlFactory::canRun(RunConfiguration *runConfiguration, const QStr S60DeviceRunConfiguration *rc = qobject_cast(runConfiguration); if (!rc) return false; - S60DeployConfiguration *activeDeployConf = qobject_cast(rc->qt4Target()->activeDeployConfiguration()); + S60DeployConfiguration *activeDeployConf = qobject_cast(rc->target()->activeDeployConfiguration()); return activeDeployConf != 0; } @@ -69,7 +69,7 @@ RunControl* S60RunControlFactory::create(RunConfiguration *runConfiguration, con QTC_ASSERT(rc, return 0); QTC_ASSERT(mode == m_mode, return 0); - S60DeployConfiguration *activeDeployConf = qobject_cast(rc->qt4Target()->activeDeployConfiguration()); + S60DeployConfiguration *activeDeployConf = qobject_cast(rc->target()->activeDeployConfiguration()); if (!activeDeployConf) return 0; diff --git a/src/plugins/qt4projectmanager/qt-s60/trkruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/trkruncontrol.cpp index 8e3d3c4296b..99503617cd3 100644 --- a/src/plugins/qt4projectmanager/qt-s60/trkruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/trkruncontrol.cpp @@ -64,7 +64,7 @@ TrkRunControl::TrkRunControl(RunConfiguration *runConfiguration, const QString & { const S60DeviceRunConfiguration *s60runConfig = qobject_cast(runConfiguration); QTC_ASSERT(s60runConfig, return); - const S60DeployConfiguration *activeDeployConf = qobject_cast(s60runConfig->qt4Target()->activeDeployConfiguration()); + const S60DeployConfiguration *activeDeployConf = qobject_cast(s60runConfig->target()->activeDeployConfiguration()); QTC_ASSERT(activeDeployConf, return); m_serialPortName = activeDeployConf->serialPortName();