VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h@ 103977

Last change on this file since 103977 was 103023, checked in by vboxsync, 11 months ago

FE/Qt: bugref:10501: On cloud profile state changes we should notify Global Activity Overview tool about cloud machine list changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.8 KB
Line 
1/* $Id: UIVirtualBoxManagerWidget.h 103023 2024-01-24 13:28:00Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIVirtualBoxManagerWidget class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-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_manager_UIVirtualBoxManagerWidget_h
29#define FEQT_INCLUDED_SRC_manager_UIVirtualBoxManagerWidget_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QUuid>
36#include <QWidget>
37
38/* GUI includes: */
39#include "QIWithRetranslateUI.h"
40#include "UISlidingAnimation.h"
41#include "UIToolPaneGlobal.h"
42#include "UIToolPaneMachine.h"
43
44/* Forward declarations: */
45class QStackedWidget;
46class QTimer;
47class QISplitter;
48class QIToolBar;
49class UIActionPool;
50class UIChooser;
51class UITabBar;
52class UITools;
53class UIVirtualBoxManager;
54class UIVirtualMachineItem;
55
56/** QWidget extension used as VirtualBox Manager Widget instance. */
57class UIVirtualBoxManagerWidget : public QIWithRetranslateUI<QWidget>
58{
59 Q_OBJECT;
60
61 /** Possible selection types. */
62 enum SelectionType
63 {
64 SelectionType_Invalid,
65 SelectionType_SingleLocalGroupItem,
66 SelectionType_SingleCloudGroupItem,
67 SelectionType_FirstIsGlobalItem,
68 SelectionType_FirstIsLocalMachineItem,
69 SelectionType_FirstIsCloudMachineItem
70 };
71
72signals:
73
74 /** @name Tool-bar stuff.
75 * @{ */
76 /* Notifies listeners about tool-bar height change. */
77 void sigToolBarHeightChange(int iHeight);
78 /** @} */
79
80 /** @name Chooser pane stuff.
81 * @{ */
82 /** Notifies about Chooser-pane index change. */
83 void sigChooserPaneIndexChange();
84 /** Notifies about Chooser-pane group saving change. */
85 void sigGroupSavingStateChanged();
86 /** Notifies about Chooser-pane cloud update change. */
87 void sigCloudUpdateStateChanged();
88
89 /** Notifies about state change for cloud machine with certain @a uId. */
90 void sigCloudMachineStateChange(const QUuid &uId);
91
92 /** Notify listeners about start or show request. */
93 void sigStartOrShowRequest();
94 /** Notifies listeners about machine search widget visibility changed to @a fVisible. */
95 void sigMachineSearchWidgetVisibilityChanged(bool fVisible);
96 /** @} */
97
98 /** @name Tools pane stuff.
99 * @{ */
100 /** Notifies about Global Tool type change. */
101 void sigToolTypeChangeGlobal();
102 /** Notifies about Machine Tool type change. */
103 void sigToolTypeChangeMachine();
104 /** @} */
105
106 /** @name Tools / Media pane stuff.
107 * @{ */
108 /** Notifies listeners about creation procedure was requested. */
109 void sigCreateMedium();
110 /** Notifies listeners about copy procedure was requested for medium with specified @a uMediumId. */
111 void sigCopyMedium(const QUuid &uMediumId);
112 /** @} */
113
114 /** @name Tools / Details pane stuff.
115 * @{ */
116 /** Notifies aboud Details-pane link clicked. */
117 void sigMachineSettingsLinkClicked(const QString &strCategory, const QString &strControl, const QUuid &uId);
118 /** @} */
119
120 /** @name Tools / Snapshots pane stuff.
121 * @{ */
122 /** Notifies listeners about current Snapshots pane item change. */
123 void sigCurrentSnapshotItemChange();
124 /** @} */
125
126 /** @name Tools / Generic pane stuff.
127 * @{ */
128 /** Notifies listeners about request to detach pane with tool type @p enmToolType. */
129 void sigDetachToolPane(UIToolType enmToolType);
130 /** @} */
131
132public:
133
134 /** Constructs VirtualBox Manager widget. */
135 UIVirtualBoxManagerWidget(UIVirtualBoxManager *pParent);
136 /** Destructs VirtualBox Manager widget. */
137 virtual ~UIVirtualBoxManagerWidget() RT_OVERRIDE;
138
139 /** @name Common stuff.
140 * @{ */
141 /** Returns the action-pool instance. */
142 UIActionPool *actionPool() const { return m_pActionPool; }
143 /** @} */
144
145 /** @name Chooser pane stuff.
146 * @{ */
147 /** Returns current-item. */
148 UIVirtualMachineItem *currentItem() const;
149 /** Returns a list of current-items. */
150 QList<UIVirtualMachineItem*> currentItems() const;
151
152 /** Returns whether group item is selected. */
153 bool isGroupItemSelected() const;
154 /** Returns whether global item is selected. */
155 bool isGlobalItemSelected() const;
156 /** Returns whether machine item is selected. */
157 bool isMachineItemSelected() const;
158 /** Returns whether local machine item is selected. */
159 bool isLocalMachineItemSelected() const;
160 /** Returns whether cloud machine item is selected. */
161 bool isCloudMachineItemSelected() const;
162
163 /** Returns whether single group is selected. */
164 bool isSingleGroupSelected() const;
165 /** Returns whether single local group is selected. */
166 bool isSingleLocalGroupSelected() const;
167 /** Returns whether single cloud provider group is selected. */
168 bool isSingleCloudProviderGroupSelected() const;
169 /** Returns whether single cloud profile group is selected. */
170 bool isSingleCloudProfileGroupSelected() const;
171 /** Returns whether all items of one group are selected. */
172 bool isAllItemsOfOneGroupSelected() const;
173
174 /** Returns full name of currently selected group. */
175 QString fullGroupName() const;
176
177 /** Returns whether group saving is in progress. */
178 bool isGroupSavingInProgress() const;
179 /** Returns whether at least one cloud profile currently being updated. */
180 bool isCloudProfileUpdateInProgress() const;
181
182 /** Switches to global item. */
183 void switchToGlobalItem();
184 /** Opens group name editor. */
185 void openGroupNameEditor();
186 /** Disbands group. */
187 void disbandGroup();
188 /** Removes machine. */
189 void removeMachine();
190 /** Moves machine to a group with certain @a strName. */
191 void moveMachineToGroup(const QString &strName = QString());
192 /** Returns possible groups for machine with passed @a uId to move to. */
193 QStringList possibleGroupsForMachineToMove(const QUuid &uId);
194 /** Returns possible groups for group with passed @a strFullName to move to. */
195 QStringList possibleGroupsForGroupToMove(const QString &strFullName);
196 /** Refreshes machine. */
197 void refreshMachine();
198 /** Sorts group. */
199 void sortGroup();
200 /** Toggle machine search widget to be @a fVisible. */
201 void setMachineSearchWidgetVisibility(bool fVisible);
202 /** @} */
203
204 /** @name Tools pane stuff.
205 * @{ */
206 /** Defines Global tools @a enmType. */
207 void setToolsTypeGlobal(UIToolType enmType);
208 /** Returns Global tools type. */
209 UIToolType toolsTypeGlobal() const;
210
211 /** Defines Machine tools @a enmType. */
212 void setToolsTypeMachine(UIToolType enmType);
213 /** Returns Machine tools type. */
214 UIToolType toolsTypeMachine() const;
215
216 /** Returns a type of curent Global tool. */
217 UIToolType currentGlobalTool() const;
218 /** Returns a type of curent Machine tool. */
219 UIToolType currentMachineTool() const;
220 /** Returns whether Global tool of passed @a enmType is opened. */
221 bool isGlobalToolOpened(UIToolType enmType) const;
222 /** Returns whether Machine tool of passed @a enmType is opened. */
223 bool isMachineToolOpened(UIToolType enmType) const;
224 /** Switches Global tool to passed @a enmType. */
225 void switchGlobalToolTo(UIToolType enmType);
226 /** Switches Machine tool to passed @a enmType. */
227 void switchMachineToolTo(UIToolType enmType);
228 /** Closes Global tool of passed @a enmType. */
229 void closeGlobalTool(UIToolType enmType);
230 /** Closes Machine tool of passed @a enmType. */
231 void closeMachineTool(UIToolType enmType);
232 /** @} */
233
234 /** @name Tools / Snapshot pane stuff.
235 * @{ */
236 /** Returns whether current-state item of Snapshot pane is selected. */
237 bool isCurrentStateItemSelected() const;
238
239 /** Returns currently selected snapshot ID if any. */
240 QUuid currentSnapshotId();
241 /** @} */
242
243 /** @name Tool-bar stuff.
244 * @{ */
245 /** Updates tool-bar menu buttons. */
246 void updateToolBarMenuButtons(bool fSeparateMenuSection);
247 /** @} */
248
249 /** @name Help browser stuff.
250 * @{ */
251 /** Returns the current help key word. */
252 QString currentHelpKeyword() const;
253 /** @} */
254
255public slots:
256
257 /** @name Tool-bar stuff.
258 * @{ */
259 /** Handles tool-bar context-menu request for passed @a position. */
260 void sltHandleToolBarContextMenuRequest(const QPoint &position);
261 /** @} */
262
263protected:
264
265 /** @name Event handling stuff.
266 * @{ */
267 /** Handles translation event. */
268 virtual void retranslateUi() RT_OVERRIDE;
269 /** @} */
270
271private slots:
272
273 /** @name General stuff.
274 * @{ */
275 /** Handles request to commit data. */
276 void sltHandleCommitData();
277 /** @} */
278
279 /** @name CVirtualBox event handling stuff.
280 * @{ */
281 /** Handles CVirtualBox event about state change for machine with @a uId. */
282 void sltHandleStateChange(const QUuid &uId);
283 /** @} */
284
285 /** @name CVirtualBox extra-data event handling stuff.
286 * @{ */
287 /** Handles signal about settings expert mode change. */
288 void sltHandleSettingsExpertModeChange();
289 /** @} */
290
291 /** @name Splitter stuff.
292 * @{ */
293 /** Handles signal about splitter move. */
294 void sltHandleSplitterMove();
295 /** Handles request to save splitter settings. */
296 void sltSaveSplitterSettings();
297 /** @} */
298
299 /** @name Tool-bar stuff.
300 * @{ */
301 /** Handles signal about tool-bar resize to @a newSize. */
302 void sltHandleToolBarResize(const QSize &newSize);
303 /** @} */
304
305 /** @name Chooser pane stuff.
306 * @{ */
307 /** Handles signal about Chooser-pane index change. */
308 void sltHandleChooserPaneIndexChange();
309
310 /** Handles signal about Chooser-pane selection invalidated. */
311 void sltHandleChooserPaneSelectionInvalidated() { recacheCurrentMachineItemInformation(true /* fDontRaiseErrorPane */); }
312
313 /** Handles sliding animation complete signal.
314 * @param enmDirection Brings which direction was animation finished for. */
315 void sltHandleSlidingAnimationComplete(SlidingDirection enmDirection);
316
317 /** Handles state change for cloud profile with certain @a strProviderShortName and @a strProfileName. */
318 void sltHandleCloudProfileStateChange(const QString &strProviderShortName,
319 const QString &strProfileName);
320 /** Handles state change for cloud machine with certain @a uId. */
321 void sltHandleCloudMachineStateChange(const QUuid &uId);
322 /** @} */
323
324 /** @name Tools pane stuff.
325 * @{ */
326 /** Handles tool popup-menu request. */
327 void sltHandleToolMenuRequested(const QPoint &position, UIVirtualMachineItem *pItem);
328
329 /** Handles signal about global Tools-menu index change.
330 * @param enmType Brings current tool type. */
331 void sltHandleGlobalToolsMenuIndexChange(UIToolType enmType) { switchGlobalToolTo(enmType); }
332 /** Handles signal about machine Tools-menu index change.
333 * @param enmType Brings current tool type. */
334 void sltHandleMachineToolsMenuIndexChange(UIToolType enmType) { switchMachineToolTo(enmType); }
335
336 /** Handles signal requesting switch to Activity pane of machine with @a uMachineId. */
337 void sltSwitchToMachineActivityPane(const QUuid &uMachineId);
338 /** Handles signal requesting switch to Resources pane. */
339 void sltSwitchToActivityOverviewPane();
340 /** @} */
341
342private:
343
344 /** @name Prepare/Cleanup cascade.
345 * @{ */
346 /** Prepares all. */
347 void prepare();
348 /** Prepares widgets. */
349 void prepareWidgets();
350 /** Prepares connections. */
351 void prepareConnections();
352 /** Loads settings. */
353 void loadSettings();
354
355 /** Updates toolbar. */
356 void updateToolbar();
357
358 /** Cleanups connections. */
359 void cleanupConnections();
360 /** Cleanups widgets. */
361 void cleanupWidgets();
362 /** Cleanups all. */
363 void cleanup();
364 /** @} */
365
366 /** @name Common stuff.
367 * @{ */
368 /** Recaches current machine item information.
369 * @param fDontRaiseErrorPane Brings whether we should not raise error-pane. */
370 void recacheCurrentMachineItemInformation(bool fDontRaiseErrorPane = false);
371 /** @} */
372
373 /** @name Tools stuff.
374 * @{ */
375 /** Updates Global tools menu. */
376 void updateToolsMenuGlobal();
377 /** Updates Machine tools menu for @a pItem specified. */
378 void updateToolsMenuMachine(UIVirtualMachineItem *pItem);
379
380 /** Handles current tool @a enmType change. */
381 void handleCurrentToolTypeChange(UIToolType enmType);
382 /** @} */
383
384 /** Holds the action-pool instance. */
385 UIActionPool *m_pActionPool;
386
387 /** Holds the central splitter instance. */
388 QISplitter *m_pSplitter;
389
390 /** Holds the main toolbar instance. */
391 QIToolBar *m_pToolBar;
392
393 /** Holds the Chooser-pane instance. */
394 UIChooser *m_pPaneChooser;
395 /** Holds the stacked-widget. */
396 QStackedWidget *m_pStackedWidget;
397 /** Holds the Global Tools-pane instance. */
398 UIToolPaneGlobal *m_pPaneToolsGlobal;
399 /** Holds the Machine Tools-pane instance. */
400 UIToolPaneMachine *m_pPaneToolsMachine;
401 /** Holds the sliding-animation widget instance. */
402 UISlidingAnimation *m_pSlidingAnimation;
403 /** Holds the Global Tools-menu instance. */
404 UITools *m_pMenuToolsGlobal;
405 /** Holds the Machine Tools-menu instance. */
406 UITools *m_pMenuToolsMachine;
407
408 /** Holds the last selection type. */
409 SelectionType m_enmSelectionType;
410 /** Holds whether the last selected item was accessible. */
411 bool m_fSelectedMachineItemAccessible;
412
413 /** Holds the splitter settings save timer. */
414 QTimer *m_pSplitterSettingsSaveTimer;
415};
416
417#endif /* !FEQT_INCLUDED_SRC_manager_UIVirtualBoxManagerWidget_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette