~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/plugins/remotelinux/remotelinuxanalyzesupport.cpp

  • Committer: Timo Jyrinki
  • Date: 2013-11-15 12:25:23 UTC
  • mfrom: (1.1.28)
  • Revision ID: timo.jyrinki@canonical.com-20131115122523-i2kyamsu4gs2mu1m
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
#include "remotelinuxrunconfiguration.h"
33
33
 
34
 
#include <analyzerbase/ianalyzerengine.h>
 
34
#include <analyzerbase/analyzerruncontrol.h>
35
35
 
36
36
#include <projectexplorer/buildconfiguration.h>
37
37
#include <projectexplorer/project.h>
55
55
class RemoteLinuxAnalyzeSupportPrivate
56
56
{
57
57
public:
58
 
    RemoteLinuxAnalyzeSupportPrivate(IAnalyzerEngine *engine, RunMode runMode)
59
 
        : engine(engine),
 
58
    RemoteLinuxAnalyzeSupportPrivate(AnalyzerRunControl *rc, RunMode runMode)
 
59
        : runControl(rc),
60
60
          qmlProfiling(runMode == QmlProfilerRunMode),
61
61
          qmlPort(-1)
62
62
    {
63
63
    }
64
64
 
65
 
    const QPointer<IAnalyzerEngine> engine;
 
65
    const QPointer<AnalyzerRunControl> runControl;
66
66
    bool qmlProfiling;
67
67
    int qmlPort;
68
68
 
78
78
{
79
79
    AnalyzerStartParameters params;
80
80
    if (runMode == QmlProfilerRunMode)
81
 
        params.startMode = StartQmlRemote;
 
81
        params.startMode = StartLocal;
 
82
    params.runMode = runMode;
82
83
    params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
83
 
    params.analyzerCmdPrefix = runConfig->commandPrefix();
84
84
    params.displayName = runConfig->displayName();
85
85
    params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
86
86
    params.analyzerHost = params.connParams.host;
89
89
}
90
90
 
91
91
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig,
92
 
                                                     IAnalyzerEngine *engine, RunMode runMode)
 
92
                                                     AnalyzerRunControl *engine, RunMode runMode)
93
93
    : AbstractRemoteLinuxRunSupport(runConfig, engine),
94
94
      d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
95
95
{
96
 
    connect(d->engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
 
96
    connect(d->runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
97
97
            SLOT(handleRemoteSetupRequested()));
98
98
    connect(&d->outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
99
99
            SLOT(remoteIsRunning()));
106
106
 
107
107
void RemoteLinuxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format)
108
108
{
109
 
    if (state() != Inactive && d->engine)
110
 
        d->engine->logApplicationMessage(msg, format);
 
109
    if (state() != Inactive && d->runControl)
 
110
        d->runControl->logApplicationMessage(msg, format);
111
111
    d->outputParser.processOutput(msg);
112
112
}
113
113
 
114
114
void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested()
115
115
{
116
 
    if (d->engine->mode() != Analyzer::StartQmlRemote)
117
 
        return;
118
 
 
119
116
    QTC_ASSERT(state() == Inactive, return);
120
117
 
121
 
    showMessage(tr("Checking available ports...\n"), Utils::NormalMessageFormat);
 
118
    showMessage(tr("Checking available ports...") + QLatin1Char('\n'), Utils::NormalMessageFormat);
122
119
    AbstractRemoteLinuxRunSupport::handleRemoteSetupRequested();
123
120
}
124
121
 
142
139
    connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString)));
143
140
    connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString)));
144
141
 
145
 
    const QString args = arguments()
146
 
            + QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort);
147
 
    const QString remoteCommandLine =
148
 
            QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args);
149
 
    runner->start(device(), remoteCommandLine.toUtf8());
 
142
    const QStringList args = arguments()
 
143
            << QString::fromLocal8Bit("-qmljsdebugger=port:%1,block").arg(d->qmlPort);
 
144
    runner->setWorkingDirectory(workingDirectory());
 
145
    runner->setEnvironment(environment());
 
146
    runner->start(device(), remoteFilePath(), args);
150
147
}
151
148
 
152
149
void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error)
163
160
    reset();
164
161
    if (!success)
165
162
        showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat);
166
 
    d->engine->notifyRemoteFinished(success);
 
163
    d->runControl->notifyRemoteFinished(success);
167
164
}
168
165
 
169
166
void RemoteLinuxAnalyzeSupport::handleProfilingFinished()
170
167
{
171
 
    if (d->engine->mode() != Analyzer::StartQmlRemote)
172
 
        return;
173
168
    setFinished();
174
169
}
175
170
 
176
171
void RemoteLinuxAnalyzeSupport::remoteIsRunning()
177
172
{
178
 
    d->engine->notifyRemoteSetupDone(d->qmlPort);
 
173
    d->runControl->notifyRemoteSetupDone(d->qmlPort);
179
174
}
180
175
 
181
176
void RemoteLinuxAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
189
184
{
190
185
    QTC_ASSERT(state() != GatheringPorts, return);
191
186
 
192
 
    if (!d->engine)
 
187
    if (!d->runControl)
193
188
        return;
194
189
 
195
190
    showMessage(QString::fromUtf8(output), Utils::StdErrFormat);