1 | /* $Id: UICloudConsoleManager.h 104273 2024-04-10 12:24:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UICloudConsoleManager class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_cloud_consolemanager_UICloudConsoleManager_h
|
---|
29 | #define FEQT_INCLUDED_SRC_cloud_consolemanager_UICloudConsoleManager_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "QIManagerDialog.h"
|
---|
36 |
|
---|
37 | /* Forward declarations: */
|
---|
38 | class QAbstractButton;
|
---|
39 | class QTreeWidgetItem;
|
---|
40 | class QITreeWidget;
|
---|
41 | class QITreeWidgetItem;
|
---|
42 | class UIActionPool;
|
---|
43 | class UICloudConsoleDetailsWidget;
|
---|
44 | class UIItemCloudConsoleApplication;
|
---|
45 | class UIItemCloudConsoleProfile;
|
---|
46 | class QIToolBar;
|
---|
47 | struct UIDataCloudConsoleApplication;
|
---|
48 | struct UIDataCloudConsoleProfile;
|
---|
49 |
|
---|
50 |
|
---|
51 | /** QWidget extension providing GUI with the pane to control cloud console related functionality. */
|
---|
52 | class UICloudConsoleManagerWidget : public QWidget
|
---|
53 | {
|
---|
54 | Q_OBJECT;
|
---|
55 |
|
---|
56 | signals:
|
---|
57 |
|
---|
58 | /** Notifies listeners about cloud console details-widget @a fVisible. */
|
---|
59 | void sigCloudConsoleDetailsVisibilityChanged(bool fVisible);
|
---|
60 | /** Notifies listeners about cloud console details data @a fDiffers. */
|
---|
61 | void sigCloudConsoleDetailsDataChanged(bool fDiffers);
|
---|
62 |
|
---|
63 | public:
|
---|
64 |
|
---|
65 | /** Constructs Cloud Console Manager widget.
|
---|
66 | * @param enmEmbedding Brings the type of widget embedding.
|
---|
67 | * @param pActionPool Brings the action-pool reference.
|
---|
68 | * @param fShowToolbar Brings whether we should create/show toolbar. */
|
---|
69 | UICloudConsoleManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
|
---|
70 | bool fShowToolbar = true, QWidget *pParent = 0);
|
---|
71 |
|
---|
72 | /** Returns the menu. */
|
---|
73 | QMenu *menu() const;
|
---|
74 |
|
---|
75 | #ifdef VBOX_WS_MAC
|
---|
76 | /** Returns the toolbar. */
|
---|
77 | QIToolBar *toolbar() const { return m_pToolBar; }
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | public slots:
|
---|
81 |
|
---|
82 | /** @name Details-widget stuff.
|
---|
83 | * @{ */
|
---|
84 | /** Handles command to reset cloud console details changes. */
|
---|
85 | void sltResetCloudConsoleDetailsChanges();
|
---|
86 | /** Handles command to apply cloud console details changes. */
|
---|
87 | void sltApplyCloudConsoleDetailsChanges();
|
---|
88 | /** @} */
|
---|
89 |
|
---|
90 | private slots:
|
---|
91 |
|
---|
92 | /** @name Menu/action stuff.
|
---|
93 | * @{ */
|
---|
94 | /** Handles command to add cloud console application. */
|
---|
95 | void sltAddCloudConsoleApplication();
|
---|
96 | /** Handles command to remove cloud console application. */
|
---|
97 | void sltRemoveCloudConsoleApplication();
|
---|
98 | /** Handles command to add cloud console profile. */
|
---|
99 | void sltAddCloudConsoleProfile();
|
---|
100 | /** Handles command to remove cloud console profile. */
|
---|
101 | void sltRemoveCloudConsoleProfile();
|
---|
102 | /** Handles command to make cloud console details @a fVisible. */
|
---|
103 | void sltToggleCloudConsoleDetailsVisibility(bool fVisible);
|
---|
104 | /** @} */
|
---|
105 |
|
---|
106 | /** @name Tree-widget stuff.
|
---|
107 | * @{ */
|
---|
108 | /** Handles request to load cloud console stuff. */
|
---|
109 | void sltLoadCloudConsoleStuff() { loadCloudConsoleStuff(); }
|
---|
110 | /** Adjusts tree-widget according content. */
|
---|
111 | void sltPerformTableAdjustment();
|
---|
112 | /** Handles tree-widget current item change. */
|
---|
113 | void sltHandleCurrentItemChange();
|
---|
114 | /** Handles context-menu request for tree-widget @a position. */
|
---|
115 | void sltHandleContextMenuRequest(const QPoint &position);
|
---|
116 | /** Handles tree-widget @a pItem change. */
|
---|
117 | void sltHandleItemChange(QTreeWidgetItem *pItem);
|
---|
118 | /** @} */
|
---|
119 |
|
---|
120 | /** @name Event-handling stuff.
|
---|
121 | * @{ */
|
---|
122 | /** Handles translation event. */
|
---|
123 | void sltRetranslateUI();
|
---|
124 | /** @} */
|
---|
125 |
|
---|
126 | private:
|
---|
127 |
|
---|
128 | /** @name Prepare/cleanup cascade.
|
---|
129 | * @{ */
|
---|
130 | /** Prepares all. */
|
---|
131 | void prepare();
|
---|
132 | /** Prepares actions. */
|
---|
133 | void prepareActions();
|
---|
134 | /** Prepares widgets. */
|
---|
135 | void prepareWidgets();
|
---|
136 | /** Prepares toolbar. */
|
---|
137 | void prepareToolBar();
|
---|
138 | /** Prepares tree-widget. */
|
---|
139 | void prepareTreeWidget();
|
---|
140 | /** Prepares details-widget. */
|
---|
141 | void prepareDetailsWidget();
|
---|
142 | /** Prepares connections. */
|
---|
143 | void prepareConnections();
|
---|
144 | /** Load settings: */
|
---|
145 | void loadSettings();
|
---|
146 | /** @} */
|
---|
147 |
|
---|
148 | /** @name Loading stuff.
|
---|
149 | * @{ */
|
---|
150 | /** Loads cloud console stuff. */
|
---|
151 | void loadCloudConsoleStuff();
|
---|
152 | /** Loads cloud console @a strSuperset data to passed @a applicationData container. */
|
---|
153 | void loadCloudConsoleApplication(const QString &strSuperset,
|
---|
154 | UIDataCloudConsoleApplication &applicationData);
|
---|
155 | /** Loads cloud console @a strSuperset data to passed @a profileData container, using @a applicationData as hint. */
|
---|
156 | void loadCloudConsoleProfile(const QString &strSuperset,
|
---|
157 | const UIDataCloudConsoleApplication &applicationData,
|
---|
158 | UIDataCloudConsoleProfile &profileData);
|
---|
159 | /** @} */
|
---|
160 |
|
---|
161 | /** @name Tree-widget stuff.
|
---|
162 | * @{ */
|
---|
163 | /** Searches an application item with specified @a strApplicationId. */
|
---|
164 | UIItemCloudConsoleApplication *searchApplicationItem(const QString &strApplicationId) const;
|
---|
165 | /** Searches a profile child of application item with specified @a strApplicationId and @a strProfileId. */
|
---|
166 | UIItemCloudConsoleProfile *searchProfileItem(const QString &strApplicationId,
|
---|
167 | const QString &strProfileId) const;
|
---|
168 | /** Searches an item with specified @a strDefinition. */
|
---|
169 | QITreeWidgetItem *searchItemByDefinition(const QString &strDefinition) const;
|
---|
170 |
|
---|
171 | /** Creates a new tree-widget item
|
---|
172 | * on the basis of passed @a applicationData, @a fChooseItem if requested. */
|
---|
173 | void createItemForCloudConsoleApplication(const UIDataCloudConsoleApplication &applicationData,
|
---|
174 | bool fChooseItem);
|
---|
175 |
|
---|
176 | /** Creates a new tree-widget item as a child of certain @a pParent,
|
---|
177 | * on the basis of passed @a profileData, @a fChooseItem if requested. */
|
---|
178 | void createItemForCloudConsoleProfile(QTreeWidgetItem *pParent,
|
---|
179 | const UIDataCloudConsoleProfile &profileData,
|
---|
180 | bool fChooseItem);
|
---|
181 |
|
---|
182 | /* Gathers a list of Cloud Console Manager restrictions starting from @a pParentItem. */
|
---|
183 | QStringList gatherCloudConsoleManagerRestrictions(QTreeWidgetItem *pParentItem);
|
---|
184 | /** @} */
|
---|
185 |
|
---|
186 | /** @name General variables.
|
---|
187 | * @{ */
|
---|
188 | /** Holds the widget embedding type. */
|
---|
189 | const EmbedTo m_enmEmbedding;
|
---|
190 | /** Holds the action-pool reference. */
|
---|
191 | UIActionPool *m_pActionPool;
|
---|
192 | /** Holds whether we should create/show toolbar. */
|
---|
193 | const bool m_fShowToolbar;
|
---|
194 | /** Holds current item definition. */
|
---|
195 | QString m_strDefinition;
|
---|
196 | /** @} */
|
---|
197 |
|
---|
198 | /** @name Toolbar and menu variables.
|
---|
199 | * @{ */
|
---|
200 | /** Holds the toolbar instance. */
|
---|
201 | QIToolBar *m_pToolBar;
|
---|
202 | /** @} */
|
---|
203 |
|
---|
204 | /** @name Splitter variables.
|
---|
205 | * @{ */
|
---|
206 | /** Holds the tree-widget instance. */
|
---|
207 | QITreeWidget *m_pTreeWidget;
|
---|
208 | /** Holds the details-widget instance. */
|
---|
209 | UICloudConsoleDetailsWidget *m_pDetailsWidget;
|
---|
210 | /** @} */
|
---|
211 | };
|
---|
212 |
|
---|
213 |
|
---|
214 | /** QIManagerDialogFactory extension used as a factory for Cloud Console Manager dialog. */
|
---|
215 | class UICloudConsoleManagerFactory : public QIManagerDialogFactory
|
---|
216 | {
|
---|
217 | public:
|
---|
218 |
|
---|
219 | /** Constructs Cloud Console Manager actory acquiring additional arguments.
|
---|
220 | * @param pActionPool Brings the action-pool reference. */
|
---|
221 | UICloudConsoleManagerFactory(UIActionPool *pActionPool = 0);
|
---|
222 |
|
---|
223 | protected:
|
---|
224 |
|
---|
225 | /** Creates derived @a pDialog instance.
|
---|
226 | * @param pCenterWidget Brings the widget reference to center according to. */
|
---|
227 | virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) RT_OVERRIDE;
|
---|
228 |
|
---|
229 | /** Holds the action-pool reference. */
|
---|
230 | UIActionPool *m_pActionPool;
|
---|
231 | };
|
---|
232 |
|
---|
233 |
|
---|
234 | /** QIManagerDialog extension providing GUI with the dialog to control cloud console related functionality. */
|
---|
235 | class UICloudConsoleManager : public QIManagerDialog
|
---|
236 | {
|
---|
237 | Q_OBJECT;
|
---|
238 |
|
---|
239 | signals:
|
---|
240 |
|
---|
241 | /** Notifies listeners about data change rejected and should be reseted. */
|
---|
242 | void sigDataChangeRejected();
|
---|
243 | /** Notifies listeners about data change accepted and should be applied. */
|
---|
244 | void sigDataChangeAccepted();
|
---|
245 |
|
---|
246 | private slots:
|
---|
247 |
|
---|
248 | /** @name Button-box stuff.
|
---|
249 | * @{ */
|
---|
250 | /** Handles button-box button click. */
|
---|
251 | void sltHandleButtonBoxClick(QAbstractButton *pButton);
|
---|
252 | /** @} */
|
---|
253 |
|
---|
254 | /** @name Event-handling stuff.
|
---|
255 | * @{ */
|
---|
256 | /** Handles translation event. */
|
---|
257 | void sltRetranslateUI();
|
---|
258 | /** @} */
|
---|
259 |
|
---|
260 | private:
|
---|
261 |
|
---|
262 | /** Constructs Cloud Console Manager dialog.
|
---|
263 | * @param pCenterWidget Brings the widget reference to center according to.
|
---|
264 | * @param pActionPool Brings the action-pool reference. */
|
---|
265 | UICloudConsoleManager(QWidget *pCenterWidget, UIActionPool *pActionPool);
|
---|
266 |
|
---|
267 | /** @name Prepare/cleanup cascade.
|
---|
268 | * @{ */
|
---|
269 | /** Configures all. */
|
---|
270 | virtual void configure() RT_OVERRIDE;
|
---|
271 | /** Configures central-widget. */
|
---|
272 | virtual void configureCentralWidget() RT_OVERRIDE;
|
---|
273 | /** Configures button-box. */
|
---|
274 | virtual void configureButtonBox() RT_OVERRIDE;
|
---|
275 | /** Perform final preparations. */
|
---|
276 | virtual void finalize() RT_OVERRIDE;
|
---|
277 | /** @} */
|
---|
278 |
|
---|
279 | /** @name Widget stuff.
|
---|
280 | * @{ */
|
---|
281 | /** Returns the widget. */
|
---|
282 | virtual UICloudConsoleManagerWidget *widget() RT_OVERRIDE;
|
---|
283 | /** @} */
|
---|
284 |
|
---|
285 | /** @name Action related variables.
|
---|
286 | * @{ */
|
---|
287 | /** Holds the action-pool reference. */
|
---|
288 | UIActionPool *m_pActionPool;
|
---|
289 | /** @} */
|
---|
290 |
|
---|
291 | /** Allow factory access to private/protected members: */
|
---|
292 | friend class UICloudConsoleManagerFactory;
|
---|
293 | };
|
---|
294 |
|
---|
295 | #endif /* !FEQT_INCLUDED_SRC_cloud_consolemanager_UICloudConsoleManager_h */
|
---|