1/*
2 SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef PURPOSE_PROCESSJOB_H
8#define PURPOSE_PROCESSJOB_H
9
10#include "job.h"
11#include <QJsonObject>
12#include <QLocalServer>
13#include <QLocalSocket>
14#include <QPointer>
15#include <QProcess>
16
17namespace Purpose
18{
19/*!
20 * \class Purpose::ProcessJob
21 * \internal
22 *
23 * Purpose jobs can optionally run on an external process. This class interfaces
24 * with the external process.
25 */
26class ProcessJob : public Job
27{
28 Q_OBJECT
29public:
30 ProcessJob(const QString &pluginPath, const QString &pluginType, const QJsonObject &data, QObject *parent);
31 ~ProcessJob() override;
32
33 void start() override;
34
35private:
36 void writeSocket();
37 void readSocket();
38 void processStateChanged(QProcess::ProcessState state);
39
40 QPointer<QProcess> m_process;
41
42 QString m_pluginPath;
43 QString m_pluginType;
44 QJsonObject m_data;
45 QLocalServer m_socket;
46 QPointer<QLocalSocket> m_localSocket;
47};
48
49}
50
51#endif
52

source code of purpose/src/externalprocess/processjob.h