1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef CONVERTERTHREAD_H |
5 | #define CONVERTERTHREAD_H |
6 | |
7 | #include <QMutex> |
8 | #include <QThread> |
9 | #include <QWaitCondition> |
10 | #include <QDir> |
11 | #include <QStringList> |
12 | #include <QtCore/qjsonobject.h> |
13 | |
14 | class ConverterThread : public QThread |
15 | { |
16 | Q_OBJECT |
17 | |
18 | public: |
19 | ConverterThread(QObject *parent = nullptr); |
20 | ~ConverterThread(); |
21 | |
22 | void convert(QStringList filenames, QDir outputPath, QJsonObject options); |
23 | |
24 | protected: |
25 | void run() override; |
26 | |
27 | signals: |
28 | void convertStart(const QString &text); |
29 | void convertUpdate(const QString &text); |
30 | void convertDone(const QString &text); |
31 | |
32 | private: |
33 | QMutex mutex; |
34 | QWaitCondition condition; |
35 | |
36 | bool abort = false; |
37 | |
38 | QStringList m_filenames; |
39 | QDir m_outputPath; |
40 | QJsonObject m_options; |
41 | }; |
42 | |
43 | #endif |
44 | |