1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef CMAKEPROJECTGENERATOR_H
6#define CMAKEPROJECTGENERATOR_H
7
8#include "services/project/projectservice.h"
9#include "services/builder/builderservice.h"
10
11#include <QObject>
12#include <QDomDocument>
13
14class CmakeProjectGeneratorPrivate;
15class CmakeProjectGenerator : public dpfservice::ProjectGenerator
16{
17 Q_OBJECT
18 CmakeProjectGeneratorPrivate *const d;
19public:
20 explicit CmakeProjectGenerator();
21 ~CmakeProjectGenerator() override;
22 static QString toolKitName() { return "cmake"; }
23 virtual QStringList supportLanguages() override;
24 virtual QStringList supportFileNames() override;
25 virtual QDialog* configureWidget(const QString &language,
26 const QString &projectPath) override;
27 virtual bool configure(const dpfservice::ProjectInfo &info = {}) override;
28 virtual QStandardItem *createRootItem(const dpfservice::ProjectInfo &info) override;
29 virtual void removeRootItem(QStandardItem* root) override;
30 virtual QMenu* createItemMenu(const QStandardItem *item) override;
31
32private slots:
33 void actionTriggered();
34 void setRootItemToView(QStandardItem *root);
35 void doBuildCmdExecuteEnd(const BuildCommandInfo &info, int status);
36 void doCmakeFileNodeChanged(QStandardItem *root, const QPair<QString, QStringList> &files);
37 void actionProperties(const dpfservice::ProjectInfo &info, QStandardItem *item);
38 void recursionRemoveItem(QStandardItem *item);
39
40private:
41 QMutex mutex;
42 QStandardItem *rootItem = nullptr;
43};
44
45#endif // CMAKEPROJECTGENERATOR_H
46