1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef EVENTDEFINITIONS_H
6#define EVENTDEFINITIONS_H
7
8#include "common/lsp/protocol/newprotocol.h"
9#include "framework.h"
10
11#include <QString>
12
13OPI_OBJECT(recent,
14 OPI_INTERFACE(saveOpenedProject, "kitName", "language", "workspace")
15 OPI_INTERFACE(saveOpenedFile, "filePath")
16 )
17
18OPI_OBJECT(project,
19 // in
20 OPI_INTERFACE(openProject, "kitName", "language", "workspace")
21 OPI_INTERFACE(activeProject, "kitName", "language", "workspace")
22 // out
23 OPI_INTERFACE(activedProject, "projectInfo")
24 OPI_INTERFACE(deletedProject, "projectInfo")
25 OPI_INTERFACE(createdProject, "projectInfo")
26 )
27
28OPI_OBJECT(debugger,
29 OPI_INTERFACE(prepareDebugProgress, "message")
30 OPI_INTERFACE(prepareDebugDone, "succeed", "message")
31 OPI_INTERFACE(executeStart)
32 )
33
34OPI_OBJECT(editor,
35 // in
36 OPI_INTERFACE(openFile, "filePath")
37 OPI_INTERFACE(jumpToLine, "filePath", "line")
38 OPI_INTERFACE(openFileWithKey, "workspace", "language", "filePath")
39 OPI_INTERFACE(jumpToLineWithKey, "workspace", "language", "filePath", "line")
40 // (AnnotationInfo)annInfo
41 OPI_INTERFACE(setAnnotation, "filePath", "line", "title", "annInfo")
42 OPI_INTERFACE(cleanAnnotation, "filePath", "title")
43 OPI_INTERFACE(runningToLine, "filePath", "line")
44 OPI_INTERFACE(cleanRunning)
45 OPI_INTERFACE(setLineBackground, "filePath", "line", "color")
46 OPI_INTERFACE(delLineBackground, "filePath", "line")
47 OPI_INTERFACE(cleanLineBackground, "filePath")
48 OPI_INTERFACE(setModifiedAutoReload, "filePath", "flag")
49 OPI_INTERFACE(addDebugPoint, "filePath", "line")
50 OPI_INTERFACE(removeDebugPoint, "filePath", "line")
51 // out
52 OPI_INTERFACE(openedFile, "filePath")
53 OPI_INTERFACE(closedFile, "filePath")
54 OPI_INTERFACE(switchedFile, "filePath")
55 OPI_INTERFACE(addadDebugPoint, "filePath", "line")
56 OPI_INTERFACE(removedDebugPoint, "filePath", "line")
57 // (FindType)findType
58 OPI_INTERFACE(searchText, "text", "findType")
59 // (FindType)repalceType
60 OPI_INTERFACE(replaceText, "text", "target", "repalceType")
61 OPI_INTERFACE(switchContext, "name")
62 OPI_INTERFACE(switchWorkspace, "name")
63 )
64
65OPI_OBJECT(symbol,
66 OPI_INTERFACE(parse, "workspace", "language", "storage")
67 OPI_INTERFACE(parseDone, "workspace", "language", "storage", "success")
68 )
69
70OPI_OBJECT(navigation,
71 OPI_INTERFACE(doSwitch, "actionText")
72 )
73
74OPI_OBJECT(actionanalyse,
75 // in
76 OPI_INTERFACE(analyse, "workspace", "language", "storage")
77 // analysedData value custom struct from AnalysedData
78 OPI_INTERFACE(analyseDone, "workspace", "language", "storage", "analysedData")
79 // out
80 OPI_INTERFACE(enabled, "flag")
81 )
82
83OPI_OBJECT(commandLine,
84 OPI_INTERFACE(build)
85 )
86
87struct AnnotationInfo
88{
89 struct RoleElem
90 {
91 QString display;
92 int code;
93 bool operator == (const RoleElem &elem)
94 {
95 return display == elem.display
96 && code == elem.code;
97 }
98 };
99 enum_def(Role, RoleElem)
100 {
101 enum_exp Note = {"Note", 767};
102 enum_exp Warning = {"Warning", 766};
103 enum_exp Error = {"Error", 765};
104 enum_exp Fatal = {"Fatal", 764};
105 };
106 Role::type_value role;
107 QString text;
108 AnnotationInfo(const QString &text)
109 : text(text) { role = Role::get()->Note;}
110 AnnotationInfo(Role::type_value role, const QString &text)
111 : role(role), text(text){}
112 AnnotationInfo() :role(Role::get()->Note), text(""){}
113 AnnotationInfo(const AnnotationInfo &info)
114 : role(info.role), text(info.text){}
115 bool operator == (const AnnotationInfo &info) {
116 return role == info.role
117 && text == info.text;
118 }
119};
120Q_DECLARE_METATYPE(AnnotationInfo);
121
122struct AnalysedData
123{
124 struct TokenMap
125 {
126 newlsp::Enum::SemanticTokenTypes::type_value semanticTokenType;
127 newlsp::Enum::SemanticTokenModifiers::type_value semanticTokenModifier;
128 std::vector<float> result;
129 };
130 std::vector<std::string> rules;
131 std::vector<TokenMap> tokenMaps;
132};
133Q_DECLARE_METATYPE(AnalysedData);
134
135enum FindType{
136 Previous = 0,
137 Next
138};
139Q_DECLARE_METATYPE(FindType);
140
141enum RepalceType{
142 Repalce = 0,
143 FindAndReplace,
144 RepalceAll
145};
146Q_DECLARE_METATYPE(RepalceType);
147
148extern const QString T_MENU;
149extern const QString T_FILEBROWSER;
150extern const QString T_DEBUGGER;
151extern const QString T_BUILDER;
152extern const QString T_WORKSPACE;
153extern const QString T_RECENT;
154extern const QString T_SYMBOL;
155extern const QString T_PROCESSMESSAGE;
156extern const QString T_FIND;
157extern const QString T_COLLABORATORS;
158
159extern const QString D_BUILD_STATE;
160extern const QString D_ITEM_MENU_BUILD;
161extern const QString D_BUILD_TARGET;
162extern const QString D_SHOW;
163extern const QString D_HIDE;
164extern const QString D_ADDTEXT;
165extern const QString D_BUILD_COMMAND;
166extern const QString D_MENU_BUILD;
167extern const QString D_MENU_REBUILD;
168extern const QString D_MENU_CLEAN;
169extern const QString D_OPEN_REPOS;
170
171extern const QString D_SEARCH;
172extern const QString D_REPLACE;
173extern const QString D_OPENFILE;
174
175extern const QString P_ACTION_TEXT; // value QString
176extern const QString P_FILELINE; // value int
177extern const QString P_PROJECTPATH; // value QString
178extern const QString P_TARGETPATH; // value QString
179extern const QString P_WORKSPACEFOLDER;// value QString
180extern const QString P_COMPILEFOLDER; // value QString
181extern const QString P_BUILDSYSTEM; // value QString
182extern const QString P_BUILDDIRECTORY; // value QString
183extern const QString P_BUILDFILEPATH; // value QString
184extern const QString P_BUILDARGUMENTS; // value QStringList
185extern const QString P_TEXT; // value QString
186extern const QString P_ORIGINCMD; // value QString, event sender id.
187extern const QString P_PERCENT; // value int
188extern const QString P_MAX_PERCENT; // value int
189extern const QString P_STATE; // value int
190extern const QString P_KITNAME; // value QString
191extern const QString P_LANGUAGE; // value QString
192extern const QString P_PROJECT_INFO; // value dpfService::ProjectInfo
193extern const QString P_ANNOTATION_ROLE; // only with 0:Note 1:Warning 2:Error 3:Fatal
194extern const QString P_COLOR; // value QColor
195
196extern const QString P_OPRATETYPE;
197extern const QString P_SRCTEXT;
198extern const QString P_DESTTEXT;
199
200extern const QString P_BUILDPROGRAM;
201extern const QString P_BUILDWORKINGDIR;
202
203#endif // EVENTDEFINITIONS_H
204