Ios: Convert to RunWorkers

This moves all of the RunControl implementation into a single
RunWorker, not yet splitting it up into separate RunWorkers
which is the final goal of this series.

Done-with: Vikas Pachdha
Change-Id: I9deaef48735c1c63c41dfae39d67f59387295273
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-05-19 16:59:02 +02:00
parent a3735eada4
commit 4c29a31930
12 changed files with 413 additions and 708 deletions

View File

@@ -30,31 +30,27 @@
#include "iossimulator.h"
#include <debugger/debuggerconstants.h>
#include <debugger/debuggerruncontrol.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/runconfiguration.h>
#include <qmldebug/qmldebugcommandlinearguments.h>
#include <QTimer>
#include <QThread>
#include <QProcess>
#include <QMutex>
#include <qmldebug/qmloutputparser.h>
namespace Ios {
namespace Internal {
class IosRunner : public QObject
class IosRunner : public ProjectExplorer::RunWorker
{
Q_OBJECT
public:
IosRunner(QObject *parent, ProjectExplorer::RunControl *runControl,
bool cppDebug,
QmlDebug::QmlDebugServicesPreset qmlDebugServices);
IosRunner(ProjectExplorer::RunControl *runControl);
~IosRunner();
QString displayName() const;
void setCppDebugging(bool cppDebug);
void setQmlDebugging(QmlDebug::QmlDebugServicesPreset qmlDebugServices);
QString bundlePath();
QStringList extraArgs();
@@ -63,16 +59,16 @@ public:
bool cppDebug() const;
QmlDebug::QmlDebugServicesPreset qmlDebugServices() const;
void start();
void stop();
void start() override;
void stop() override;
signals:
void didStartApp(Ios::IosToolHandler::OpStatus status);
void gotServerPorts(Utils::Port gdbPort, Utils::Port qmlPort);
void gotInferiorPid(qint64 pid, Utils::Port qmlPort);
void appOutput(const QString &output);
void errorMsg(const QString &msg);
void finished(bool cleanExit);
virtual void appOutput(const QString &/*output*/) {}
virtual void errorMsg(const QString &/*msg*/) {}
Utils::Port qmlServerPort() const;
Utils::Port gdbServerPort() const;
qint64 pid() const;
bool isAppRunning() const;
private:
void handleDidStartApp(Ios::IosToolHandler *handler, const QString &bundlePath,
@@ -91,13 +87,64 @@ private:
QStringList m_arguments;
ProjectExplorer::IDevice::ConstPtr m_device;
IosDeviceType m_deviceType;
bool m_cppDebug;
QmlDebug::QmlDebugServicesPreset m_qmlDebugServices;
bool m_cppDebug = false;
QmlDebug::QmlDebugServicesPreset m_qmlDebugServices = QmlDebug::NoQmlDebugServices;
bool m_cleanExit = false;
Utils::Port m_qmlPort;
Utils::Port m_qmlServerPort;
Utils::Port m_gdbServerPort;
qint64 m_pid = 0;
};
class IosRunSupport : public IosRunner
{
Q_OBJECT
public:
explicit IosRunSupport(ProjectExplorer::RunControl *runControl);
~IosRunSupport() override;
void didStartApp(IosToolHandler::OpStatus status);
private:
void start() override;
void stop() override;
};
class IosAnalyzeSupport : public IosRunner
{
Q_OBJECT
public:
IosAnalyzeSupport(ProjectExplorer::RunControl *runControl);
private:
void start() override;
void qmlServerReady();
void appOutput(const QString &output) override;
void errorMsg(const QString &output) override;
QmlDebug::QmlOutputParser m_outputParser;
IosRunner *m_runner;
};
class IosDebugSupport : public Debugger::DebuggerRunTool
{
Q_OBJECT
public:
IosDebugSupport(ProjectExplorer::RunControl *runControl);
private:
void start() override;
void onFinished() override;
const QString m_dumperLib;
IosRunner *m_runner;
};
} // namespace Internal
} // namespace Ios