summaryrefslogtreecommitdiffstats
path: root/tools/qmldebugger/creatorplugin/runcontrol.h
blob: b2976f68c4c5291b46a471e74653270eb1b4e8f5 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef QMLINSPECTORRUNCONTROL_H
#define QMLINSPECTORRUNCONTROL_H

#include <QtCore/qobject.h>

#include <projectexplorer/runconfiguration.h>

#include "qmlinspector.h"

namespace ProjectExplorer {
    class ApplicationLauncher;
}

class QmlInspectorRunControlFactory : public ProjectExplorer::IRunControlFactory
{
    Q_OBJECT

public:
    explicit QmlInspectorRunControlFactory(QObject *parent);

    virtual bool canRun(
                const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
                const QString &mode) const;

    virtual ProjectExplorer::RunControl *create(
                const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
                const QString &mode);

    ProjectExplorer::RunControl *create(
                const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
                const QString &mode,
                const QmlInspector::StartParameters &sp);
                
    virtual QString displayName() const;

    virtual QWidget *configurationWidget(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration);
};

class QmlInspectorRunControl : public ProjectExplorer::RunControl
{
    Q_OBJECT

public:
    explicit QmlInspectorRunControl(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
                                    const QmlInspector::StartParameters &sp = QmlInspector::StartParameters());
    ~QmlInspectorRunControl();
    
    virtual void start();
    virtual void stop();
    virtual bool isRunning() const;

private slots:
    void appendOutput(const QString &s);
    void appStarted();
    void delayedStart();
    void viewerExited();
    void applicationError(const QString &error);

private:
    bool m_running;
    ProjectExplorer::ApplicationLauncher *m_viewerLauncher;
    QmlInspector::StartParameters m_startParams;
};

#endif