summaryrefslogtreecommitdiff
path: root/src/plugins/android/androidqmltoolingsupport.cpp
blob: fd1996fd0a37f7851c56d9c754833c0c63728981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "androidqmltoolingsupport.h"

#include "androidconstants.h"
#include "androidrunner.h"

using namespace ProjectExplorer;

namespace Android::Internal {

class AndroidQmlToolingSupport final : public RunWorker
{
public:
    explicit AndroidQmlToolingSupport(RunControl *runControl) : RunWorker(runControl)
    {
        setId("AndroidQmlToolingSupport");

        auto runner = new AndroidRunner(runControl, {});
        addStartDependency(runner);

        auto worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
        worker->addStartDependency(this);

        connect(runner, &AndroidRunner::qmlServerReady, this, [this, worker](const QUrl &server) {
            worker->recordData("QmlServerUrl", server);
            reportStarted();
        });
    }

private:
    void start() override {}
    void stop() override { reportStopped(); }
};


AndroidQmlToolingSupportFactory::AndroidQmlToolingSupportFactory()
{
    setProduct<AndroidQmlToolingSupport>();
    addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
    addSupportedRunConfig(Constants::ANDROID_RUNCONFIG_ID);
}

} // Android::Internal