summaryrefslogtreecommitdiff
path: root/src/libs/utils/launcherinterface.h
blob: 71d6c7977acd0dc1d49115f652ef8e2968c99560 (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) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "utils_global.h"

#include "processreaper.h"
#include "singleton.h"

#include <QThread>

namespace Utils {
namespace Internal {
class CallerHandle;
class LauncherHandle;
class LauncherInterfacePrivate;
class ProcessLauncherImpl;
}

class QTCREATOR_UTILS_EXPORT LauncherInterface final
        : public SingletonWithOptionalDependencies<LauncherInterface, ProcessReaper>
{
public:
    static void setPathToLauncher(const QString &pathToLauncher);

private:
    friend class Internal::CallerHandle;
    friend class Internal::LauncherHandle;
    friend class Internal::ProcessLauncherImpl;

    static bool isStarted();
    static void sendData(const QByteArray &data);
    static Internal::CallerHandle *registerHandle(QObject *parent, quintptr token);
    static void unregisterHandle(quintptr token);

    LauncherInterface();
    ~LauncherInterface();

    QThread m_thread;
    Internal::LauncherInterfacePrivate *m_private;
    friend class SingletonWithOptionalDependencies<LauncherInterface, ProcessReaper>;
};

} // namespace Utils