1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef BUILDMANAGER_H |
6 | #define BUILDMANAGER_H |
7 | |
8 | #include "services/builder/builderglobals.h" |
9 | #include "services/builder/task.h" |
10 | #include "services/project/projectinfo.h" |
11 | #include "common/widget/outputpane.h" |
12 | |
13 | #include <QObject> |
14 | #include <QSharedPointer> |
15 | #include <QMutex> |
16 | |
17 | namespace dpfservice { |
18 | class WindowService; |
19 | } |
20 | |
21 | class CompileOutputPane; |
22 | class ProblemOutputPane; |
23 | class BuildManagerPrivate; |
24 | class BuildManager : public QObject |
25 | { |
26 | Q_OBJECT |
27 | public: |
28 | static BuildManager *instance(); |
29 | |
30 | CompileOutputPane *getCompileOutputPane() const; |
31 | ProblemOutputPane *getProblemOutputPane() const; |
32 | |
33 | void setActivedProjectInfo(const QString &kitName, const QString &workingDir); |
34 | void clearActivedProjectInfo(); |
35 | |
36 | bool handleCommand(const QList<BuildCommandInfo> &info, bool isSynchronous); |
37 | |
38 | signals: |
39 | void sigOutputCompileInfo(const QString &content, const OutputPane::OutputFormat format); |
40 | void sigOutputProblemInfo(const QString &content); |
41 | void sigBuildState(const BuildState &buildstate); |
42 | void sigOutputNotify(const BuildState &state, const BuildCommandInfo &commandInfo); |
43 | void sigResetBuildUI(); |
44 | |
45 | public slots: |
46 | void slotOutputCompileInfo(const QString &content, const OutputPane::OutputFormat format); |
47 | void slotOutputProblemInfo(const QString &content); |
48 | void addOutput(const QString &content, const OutputPane::OutputFormat format); |
49 | void buildProject(); |
50 | void rebuildProject(); |
51 | void cleanProject(); |
52 | void cancelBuild(); |
53 | void slotBuildState(const BuildState &buildstate); |
54 | void slotOutputNotify(const BuildState &state, const BuildCommandInfo &commandInfo); |
55 | void slotResetBuildUI(); |
56 | |
57 | private: |
58 | explicit BuildManager(QObject *parent = nullptr); |
59 | virtual ~BuildManager(); |
60 | |
61 | void (); |
62 | |
63 | void outputLog(const QString &content, const OutputPane::OutputFormat format); |
64 | void outputError(const QString &content); |
65 | void outputNotify(const BuildState &state, const BuildCommandInfo &commandInfo); |
66 | |
67 | bool execCommands(const QList<BuildCommandInfo> &commandList, bool isSynchronous); |
68 | bool execCommand(const BuildCommandInfo &info); |
69 | |
70 | void (QList<BuildMenuType> ); |
71 | void outBuildState(const BuildState &buildState); |
72 | bool canStartBuild(); |
73 | void disconnectSignals(); |
74 | |
75 | QMutex releaseMutex; |
76 | |
77 | BuildManagerPrivate *const d; |
78 | }; |
79 | |
80 | #endif // BUILDMANAGER_H |
81 | |
82 | |