| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef TASK_H |
| 6 | #define TASK_H |
| 7 | |
| 8 | #include "fileutils.h" |
| 9 | |
| 10 | #include <QObject> |
| 11 | #include <QIcon> |
| 12 | |
| 13 | class Task |
| 14 | { |
| 15 | public: |
| 16 | enum TaskType : char { |
| 17 | Unknown, |
| 18 | Error, |
| 19 | Warning |
| 20 | }; |
| 21 | |
| 22 | enum Option : char { |
| 23 | NoOptions = 0, |
| 24 | AddTextMark = 1 << 0, |
| 25 | FlashWorthy = 1 << 1, |
| 26 | }; |
| 27 | using Options = char; |
| 28 | |
| 29 | Task() = default; |
| 30 | Task(TaskType type, const QString &description, |
| 31 | const Utils::FileName &file, int line, QString category, |
| 32 | const QIcon &icon = QIcon(), |
| 33 | Options options = AddTextMark | FlashWorthy); |
| 34 | |
| 35 | bool isNull() const; |
| 36 | void clear(); |
| 37 | |
| 38 | unsigned int taskId = 0; |
| 39 | TaskType type = Unknown; |
| 40 | Options options = AddTextMark | FlashWorthy; |
| 41 | QString description; |
| 42 | Utils::FileName file; |
| 43 | int line = -1; |
| 44 | int movedLine = -1; // contains a line number if the line was moved in the editor |
| 45 | QString category; |
| 46 | QIcon icon; |
| 47 | |
| 48 | signals: |
| 49 | |
| 50 | public slots: |
| 51 | |
| 52 | private: |
| 53 | static unsigned int s_nextId; |
| 54 | }; |
| 55 | |
| 56 | bool operator==(const Task &t1, const Task &t2); |
| 57 | |
| 58 | Q_DECLARE_METATYPE(Task) |
| 59 | |
| 60 | #endif // TASK_H |
| 61 | |