VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

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