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
13class Task
14{
15public:
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
48signals:
49
50public slots:
51
52private:
53 static unsigned int s_nextId;
54};
55
56bool operator==(const Task &t1, const Task &t2);
57
58Q_DECLARE_METATYPE(Task)
59
60#endif // TASK_H
61