1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef NINJAASYNPARSE_H |
6 | #define NINJAASYNPARSE_H |
7 | |
8 | #include "services/project/projectinfo.h" |
9 | |
10 | #include "common/common.h" |
11 | |
12 | #include <QFileSystemWatcher> |
13 | #include <QObject> |
14 | #include <QtXml> |
15 | |
16 | class QStandardItem; |
17 | class QAction; |
18 | class NinjaAsynParsePrivate; |
19 | class NinjaAsynParse : public QFileSystemWatcher |
20 | { |
21 | Q_OBJECT |
22 | NinjaAsynParsePrivate *const d; |
23 | public: |
24 | template<class T> |
25 | struct ParseInfo{ |
26 | T result; |
27 | bool isNormal = true; |
28 | }; |
29 | |
30 | NinjaAsynParse(); |
31 | virtual ~NinjaAsynParse(); |
32 | |
33 | signals: |
34 | void itemsModified(const QList<QStandardItem*> &info); |
35 | void parsedError(const ParseInfo<QString> &info); |
36 | |
37 | public slots: |
38 | void parseProject(const dpfservice::ProjectInfo &info); |
39 | |
40 | private slots: |
41 | void doDirectoryChanged(const QString &path); |
42 | |
43 | private: |
44 | void createRows(const QString &path); |
45 | QList<QStandardItem *> rows(const QStandardItem *item) const; |
46 | QString itemDisplayName(const QStandardItem *item) const; |
47 | QStandardItem *findItem(const QString &path, QStandardItem *parent = nullptr) const; |
48 | int separatorSize() const; |
49 | }; |
50 | |
51 | #endif // NINJAASYNPARSE_H |
52 |