1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef WINDOWSERVICE_H |
6 | #define WINDOWSERVICE_H |
7 | |
8 | #include "windowelement.h" |
9 | |
10 | #include <framework/framework.h> |
11 | |
12 | #include <QMap> |
13 | |
14 | class Core; |
15 | class AbstractAction; |
16 | class ; |
17 | class AbstractCentral; |
18 | class AbstractWidget; |
19 | class AbstractConsole; |
20 | |
21 | namespace dpfservice { |
22 | // service interface |
23 | class WindowService final : public dpf::PluginService, dpf::AutoServiceRegister<WindowService> |
24 | { |
25 | Q_OBJECT |
26 | Q_DISABLE_COPY(WindowService) |
27 | public: |
28 | static QString name() |
29 | { |
30 | return "org.deepin.service.WindowService" ; |
31 | } |
32 | |
33 | explicit WindowService(QObject *parent = nullptr) |
34 | : dpf::PluginService (parent) |
35 | { |
36 | |
37 | } |
38 | |
39 | /*! |
40 | * \brief addActionNavigation 添加导航栏action |
41 | * \param action 实例对象 |
42 | */ |
43 | DPF_INTERFACE(void, addActionNavigation, const QString &id, AbstractAction *action); |
44 | |
45 | /*! |
46 | * \brief addMenu 添加菜单项 |
47 | * \param menu 实例对象 |
48 | */ |
49 | DPF_INTERFACE(void, , AbstractMenu *); |
50 | |
51 | /*! |
52 | * \brief addAction 添加Action到其他由框架发布的可扩展menu |
53 | * \param menuName 框架扩展menu发布名称 |
54 | * \param action 实例对象 |
55 | */ |
56 | DPF_INTERFACE(void, addAction, const QString &, AbstractAction *action); |
57 | |
58 | /*! |
59 | * \brief removeActions |
60 | * \param menuName 框架扩展menu发布名称 |
61 | */ |
62 | DPF_INTERFACE(void, removeActions, const QString &); |
63 | |
64 | /*! |
65 | * \brief insertAction 添加Action到其他由框架发布的可扩展menu |
66 | * \param menuName 框架扩展menu发布名称 |
67 | * \param beforActionName 之后的Action名称 |
68 | * \param action 实例对象 |
69 | */ |
70 | DPF_INTERFACE(void, insertAction, const QString &, |
71 | const QString &beforActionName, |
72 | AbstractAction *action); |
73 | /*! |
74 | * \brief addCentralNavigation 添加中心显示组件 |
75 | * \param name 导航栏名称,从AbstractAction获取 |
76 | * \param central 添加的居中组件实例对象 |
77 | */ |
78 | DPF_INTERFACE(void, addCentralNavigation, const QString &name, AbstractCentral *central); |
79 | |
80 | /*! |
81 | * \brief addWidgetWorkspace 左侧工作空间组件,可以是文件树,工程管理等 |
82 | * \param title 设置 |
83 | * \param widget 设置的编辑器文件树实例对象 |
84 | */ |
85 | DPF_INTERFACE(void, addWidgetWorkspace, const QString &title, AbstractWidget *widget); |
86 | |
87 | /*! |
88 | * \brief setWidgetConsole 设置默认终端 |
89 | * \param console 实例对象 |
90 | */ |
91 | DPF_INTERFACE(void, setWidgetConsole, AbstractConsole *console); |
92 | |
93 | /** |
94 | * @brief DPF_INTERFACE |
95 | * @param widget |
96 | */ |
97 | DPF_INTERFACE(QWidget*, setWidgetEdit, AbstractCentral *widget); |
98 | |
99 | /*! |
100 | * \brief addContextWidget 添加交互组件 |
101 | * \param contextTab Tab名称 |
102 | * \param contextWidget 实例对象 |
103 | */ |
104 | DPF_INTERFACE(void, addContextWidget, const QString &contextTab, AbstractWidget *contextWidget, const QString &group); |
105 | |
106 | /** |
107 | * @brief DPF_INTERFACE |
108 | * @param contextWidget |
109 | */ |
110 | DPF_INTERFACE(void, removeContextWidget, AbstractWidget *contextWidget); |
111 | |
112 | /*! |
113 | * \brief setStatusBar |
114 | * \param message |
115 | */ |
116 | DPF_INTERFACE(void, setStatusBar, AbstractWidget *statusBar); |
117 | |
118 | /*! |
119 | * \brief addWidgetToStatusBar |
120 | * \param widget |
121 | * \param stretch |
122 | */ |
123 | DPF_INTERFACE(void, addWidgetToStatusBar, QWidget *widget); |
124 | |
125 | /*! |
126 | * \brief insertWidgetToStatusBar |
127 | * \param index |
128 | * \param widget |
129 | */ |
130 | DPF_INTERFACE(int, insertWidgetToStatusBar, int index, QWidget *widget); |
131 | |
132 | /*! |
133 | * \brief setWidgetWatch 添加监视器组件 |
134 | * \param widget 抽象接口 |
135 | */ |
136 | DPF_INTERFACE(QWidget*, setWidgetWatch, AbstractWidget *widget); |
137 | |
138 | /*! |
139 | * \brief addOpenProjectAction 添加打開工程的Action |
140 | * \param name 语言分类名称 MWMFA_CXX|MWMFA_Java|MWMFA_Python |
141 | * \param action 實例對象 |
142 | */ |
143 | DPF_INTERFACE(void, addOpenProjectAction, const QString &name, AbstractAction *action); |
144 | |
145 | /*! |
146 | * \brief addFindToolBar |
147 | * \param widget FindToolBar Widget |
148 | */ |
149 | |
150 | DPF_INTERFACE(void, addFindToolBar, AbstractWidget *widget); |
151 | |
152 | /*! |
153 | * \brief showFindToolBar |
154 | */ |
155 | DPF_INTERFACE(void, showFindToolBar); |
156 | |
157 | /*! |
158 | * \brief addToolBarActionItem |
159 | */ |
160 | DPF_INTERFACE(bool, addToolBarActionItem, const QString &id, QAction *action, const QString &group); |
161 | |
162 | /*! |
163 | * \brief addToolBarWidgetItem |
164 | */ |
165 | DPF_INTERFACE(bool, addToolBarWidgetItem, const QString &id, AbstractWidget *widget, const QString &group); |
166 | |
167 | /*! |
168 | * \brief addToolBarSeparator |
169 | */ |
170 | DPF_INTERFACE(void, addToolBarSeparator, const QString &group); |
171 | |
172 | /*! |
173 | * \brief removeToolBarItem |
174 | */ |
175 | DPF_INTERFACE(void, removeToolBarItem, const QString &id); |
176 | |
177 | /*! |
178 | * \brief setToolBarItemDisable |
179 | */ |
180 | DPF_INTERFACE(void, setToolBarItemDisable, const QString &id, bool disable); |
181 | |
182 | |
183 | signals: |
184 | |
185 | /*! |
186 | * \brief showMessageDisplay 展示处理消息提示框 |
187 | */ |
188 | void showMessageDisplay(); |
189 | |
190 | /*! |
191 | * \brief appendProcessMessage 添加处理消息 |
192 | * \param mess 消息 |
193 | * \param currentPercent 当前百分比 |
194 | * \param maxPercent 最大的百分比 |
195 | */ |
196 | void appendProcessMessage(const QString &mess, int currentPercent, int maxPrecent = 100); |
197 | |
198 | /*! |
199 | * \brief hideMessageDisplay 隐藏处理消息提示框 |
200 | */ |
201 | void hideMessageDisplay(); |
202 | }; |
203 | |
204 | } // namespace dpfservice |
205 | |
206 | #endif // WINDOWSERVICE_H |
207 | |