| 1 | /* |
| 2 | This file is part of the KDE Baloo Project |
| 3 | SPDX-FileCopyrightText: 2021 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #ifndef COMMANDPIPE_H |
| 9 | #define COMMANDPIPE_H |
| 10 | |
| 11 | #include <QDataStream> |
| 12 | #include <QObject> |
| 13 | |
| 14 | class QIODevice; |
| 15 | |
| 16 | namespace Baloo { |
| 17 | namespace Private { |
| 18 | |
| 19 | /** |
| 20 | * Bidirectional communication pipe |
| 21 | * |
| 22 | */ |
| 23 | class ControllerPipe : public QObject |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | |
| 27 | public: |
| 28 | ControllerPipe(QIODevice* commandPipe, QIODevice* statusPipe); |
| 29 | |
| 30 | void processIds(const QVector<quint64>& ids); |
| 31 | |
| 32 | Q_SIGNALS: |
| 33 | void urlStarted(const QString& url); |
| 34 | void urlFinished(const QString& url); |
| 35 | void urlFailed(const QString& url); |
| 36 | void batchFinished(); |
| 37 | |
| 38 | public Q_SLOTS: |
| 39 | void processStatusData(); |
| 40 | |
| 41 | private: |
| 42 | QDataStream m_commandStream; |
| 43 | QDataStream m_statusStream; |
| 44 | }; |
| 45 | |
| 46 | class WorkerPipe : public QObject |
| 47 | { |
| 48 | Q_OBJECT |
| 49 | |
| 50 | public: |
| 51 | WorkerPipe(QIODevice* commandPipe, QIODevice* statusPipe); |
| 52 | |
| 53 | void urlStarted(const QString& url); |
| 54 | void urlFinished(const QString& url); |
| 55 | void urlFailed(const QString& url); |
| 56 | void batchFinished(); |
| 57 | |
| 58 | public Q_SLOTS: |
| 59 | void processIdData(); |
| 60 | |
| 61 | Q_SIGNALS: |
| 62 | void newDocumentIds(const QVector<quint64>& ids); |
| 63 | void inputEnd(); |
| 64 | |
| 65 | private: |
| 66 | QDataStream m_commandStream; |
| 67 | QDataStream m_statusStream; |
| 68 | }; |
| 69 | |
| 70 | } // namespace Private |
| 71 | } // namespace Baloo |
| 72 | #endif |
| 73 | |