1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef GENERATOR_H |
6 | #define GENERATOR_H |
7 | |
8 | #include <QObject> |
9 | #include <QVariant> |
10 | |
11 | class Generator : public QObject |
12 | { |
13 | Q_OBJECT |
14 | public: |
15 | struct Procedure |
16 | { |
17 | const QString &message; |
18 | const int current; |
19 | int max = 100; |
20 | }; |
21 | explicit Generator(QObject *parent = nullptr); |
22 | QString errorString(); |
23 | |
24 | signals: |
25 | void message(const Procedure &procedure); |
26 | void started(); |
27 | void finished(bool isNormal = true); |
28 | |
29 | protected: |
30 | bool setErrorString(const QString &error); //子類調用 |
31 | bool setProperty(const QString &name, const QVariant &value); //子類調用 |
32 | QVariant property(const QString &name) const; //子類調用 |
33 | }; |
34 | |
35 | #endif // GENERATOR_H |
36 | |