1 | /* $Id: UIVirtualBoxManagerWidget.h 77315 2019-02-14 15:53:43Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVirtualBoxManagerWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef FEQT_INCLUDED_SRC_manager_UIVirtualBoxManagerWidget_h
|
---|
19 | #define FEQT_INCLUDED_SRC_manager_UIVirtualBoxManagerWidget_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QWidget>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "QIWithRetranslateUI.h"
|
---|
29 | #include "UISlidingAnimation.h"
|
---|
30 | #include "UIToolPaneGlobal.h"
|
---|
31 | #include "UIToolPaneMachine.h"
|
---|
32 |
|
---|
33 | /* Forward declarations: */
|
---|
34 | class QStackedWidget;
|
---|
35 | class QISplitter;
|
---|
36 | class UIActionPool;
|
---|
37 | class UIChooser;
|
---|
38 | class UITabBar;
|
---|
39 | class UIToolBar;
|
---|
40 | class UITools;
|
---|
41 | class UIVirtualBoxManager;
|
---|
42 | class UIVirtualMachineItem;
|
---|
43 |
|
---|
44 | /** QWidget extension used as VirtualBox Manager Widget instance. */
|
---|
45 | class UIVirtualBoxManagerWidget : public QIWithRetranslateUI<QWidget>
|
---|
46 | {
|
---|
47 | Q_OBJECT;
|
---|
48 |
|
---|
49 | signals:
|
---|
50 |
|
---|
51 | /** Notifies about Chooser-pane index change. */
|
---|
52 | void sigChooserPaneIndexChange();
|
---|
53 | /** Notifies about Chooser-pane group saving change. */
|
---|
54 | void sigGroupSavingStateChanged();
|
---|
55 |
|
---|
56 | /** Notifies aboud Details-pane link clicked. */
|
---|
57 | void sigMachineSettingsLinkClicked(const QString &strCategory, const QString &strControl, const QUuid &uId);
|
---|
58 |
|
---|
59 | /** Notifies about Tool type change. */
|
---|
60 | void sigToolTypeChange();
|
---|
61 |
|
---|
62 | /** Notifies listeners about Cloud Profile Manager change. */
|
---|
63 | void sigCloudProfileManagerChange();
|
---|
64 |
|
---|
65 | /** Notifies listeners about current Snapshots pane item change. */
|
---|
66 | void sigCurrentSnapshotItemChange();
|
---|
67 |
|
---|
68 | public:
|
---|
69 |
|
---|
70 | /** Constructs VirtualBox Manager widget. */
|
---|
71 | UIVirtualBoxManagerWidget(UIVirtualBoxManager *pParent);
|
---|
72 | /** Destructs VirtualBox Manager widget. */
|
---|
73 | virtual ~UIVirtualBoxManagerWidget() /* override */;
|
---|
74 |
|
---|
75 | /** @name Common stuff.
|
---|
76 | * @{ */
|
---|
77 | /** Returns the action-pool instance. */
|
---|
78 | UIActionPool *actionPool() const { return m_pActionPool; }
|
---|
79 |
|
---|
80 | /** Returns whether group current-item is selected. */
|
---|
81 | bool isGroupItemSelected() const;
|
---|
82 | /** Returns whether global current-item is selected. */
|
---|
83 | bool isGlobalItemSelected() const;
|
---|
84 | /** Returns whether machine current-item is selected. */
|
---|
85 | bool isMachineItemSelected() const;
|
---|
86 | /** Returns current-item. */
|
---|
87 | UIVirtualMachineItem *currentItem() const;
|
---|
88 | /** Returns a list of current-items. */
|
---|
89 | QList<UIVirtualMachineItem*> currentItems() const;
|
---|
90 |
|
---|
91 | /** Returns whether group saving is in progress. */
|
---|
92 | bool isGroupSavingInProgress() const;
|
---|
93 | /** Returns whether all items of one group is selected. */
|
---|
94 | bool isAllItemsOfOneGroupSelected() const;
|
---|
95 | /** Returns whether single group is selected. */
|
---|
96 | bool isSingleGroupSelected() const;
|
---|
97 |
|
---|
98 | /** Defines tools @a enmType. */
|
---|
99 | void setToolsType(UIToolType enmType);
|
---|
100 | /** Returns tools type. */
|
---|
101 | UIToolType toolsType() const;
|
---|
102 |
|
---|
103 | /** Returns a type of curent Global tool. */
|
---|
104 | UIToolType currentGlobalTool() const;
|
---|
105 | /** Returns a type of curent Machine tool. */
|
---|
106 | UIToolType currentMachineTool() const;
|
---|
107 | /** Returns whether Global tool of passed @a enmType is opened. */
|
---|
108 | bool isGlobalToolOpened(UIToolType enmType) const;
|
---|
109 | /** Returns whether Machine tool of passed @a enmType is opened. */
|
---|
110 | bool isMachineToolOpened(UIToolType enmType) const;
|
---|
111 | /** Switches to Global tool of passed @a enmType. */
|
---|
112 | void switchToGlobalTool(UIToolType enmType);
|
---|
113 | /** Switches to Machine tool of passed @a enmType. */
|
---|
114 | void switchToMachineTool(UIToolType enmType);
|
---|
115 | /** Closes Global tool of passed @a enmType. */
|
---|
116 | void closeGlobalTool(UIToolType enmType);
|
---|
117 | /** Closes Machine tool of passed @a enmType. */
|
---|
118 | void closeMachineTool(UIToolType enmType);
|
---|
119 | /** @} */
|
---|
120 |
|
---|
121 | /** @name Snapshot pane stuff.
|
---|
122 | * @{ */
|
---|
123 | /** Returns whether current-state item of Snapshot pane is selected. */
|
---|
124 | bool isCurrentStateItemSelected() const;
|
---|
125 | /** @} */
|
---|
126 |
|
---|
127 | public slots:
|
---|
128 |
|
---|
129 | /** @name Common stuff.
|
---|
130 | * @{ */
|
---|
131 | /** Handles context-menu request for passed @a position. */
|
---|
132 | void sltHandleContextMenuRequest(const QPoint &position);
|
---|
133 | /** @} */
|
---|
134 |
|
---|
135 | protected:
|
---|
136 |
|
---|
137 | /** @name Event handling stuff.
|
---|
138 | * @{ */
|
---|
139 | /** Handles translation event. */
|
---|
140 | virtual void retranslateUi() /* override */;
|
---|
141 | /** @} */
|
---|
142 |
|
---|
143 | private slots:
|
---|
144 |
|
---|
145 | /** @name Common stuff.
|
---|
146 | * @{ */
|
---|
147 | /** Handles signal about Chooser-pane index change. */
|
---|
148 | void sltHandleChooserPaneIndexChange();
|
---|
149 |
|
---|
150 | /** Handles signal about Chooser-pane selection invalidated. */
|
---|
151 | void sltHandleChooserPaneSelectionInvalidated() { recacheCurrentItemInformation(true /* fDontRaiseErrorPane */); }
|
---|
152 |
|
---|
153 | /** Handles sliding animation complete signal.
|
---|
154 | * @param enmDirection Brings which direction was animation finished for. */
|
---|
155 | void sltHandleSlidingAnimationComplete(SlidingDirection enmDirection);
|
---|
156 | /** @} */
|
---|
157 |
|
---|
158 | /** @name Tools stuff.
|
---|
159 | * @{ */
|
---|
160 | /** Handles tool menu request. */
|
---|
161 | void sltHandleToolMenuRequested(UIToolClass enmClass, const QPoint &position);
|
---|
162 |
|
---|
163 | /** Handles signal abour Tools-pane index change. */
|
---|
164 | void sltHandleToolsPaneIndexChange();
|
---|
165 | /** @} */
|
---|
166 |
|
---|
167 | private:
|
---|
168 |
|
---|
169 | /** @name Prepare/Cleanup cascade.
|
---|
170 | * @{ */
|
---|
171 | /** Prepares window. */
|
---|
172 | void prepare();
|
---|
173 | /** Prepares widgets. */
|
---|
174 | void prepareWidgets();
|
---|
175 | /** Prepares connections. */
|
---|
176 | void prepareConnections();
|
---|
177 | /** Loads settings. */
|
---|
178 | void loadSettings();
|
---|
179 |
|
---|
180 | /** Update toolbar. */
|
---|
181 | void updateToolbar();
|
---|
182 |
|
---|
183 | /** Saves settings. */
|
---|
184 | void saveSettings();
|
---|
185 | /** Cleanups window. */
|
---|
186 | void cleanup();
|
---|
187 | /** @} */
|
---|
188 |
|
---|
189 | /** @name Common stuff.
|
---|
190 | * @{ */
|
---|
191 | /** Recaches current item information.
|
---|
192 | * @param fDontRaiseErrorPane Brings whether we should not raise error-pane. */
|
---|
193 | void recacheCurrentItemInformation(bool fDontRaiseErrorPane = false);
|
---|
194 | /** @} */
|
---|
195 |
|
---|
196 | /** Holds the action-pool instance. */
|
---|
197 | UIActionPool *m_pActionPool;
|
---|
198 |
|
---|
199 | /** Holds the central splitter instance. */
|
---|
200 | QISplitter *m_pSplitter;
|
---|
201 |
|
---|
202 | /** Holds the main toolbar instance. */
|
---|
203 | UIToolBar *m_pToolBar;
|
---|
204 |
|
---|
205 | /** Holds the Chooser-pane instance. */
|
---|
206 | UIChooser *m_pPaneChooser;
|
---|
207 | /** Holds the stacked-widget. */
|
---|
208 | QStackedWidget *m_pStackedWidget;
|
---|
209 | /** Holds the Global Tools-pane instance. */
|
---|
210 | UIToolPaneGlobal *m_pPaneToolsGlobal;
|
---|
211 | /** Holds the Machine Tools-pane instance. */
|
---|
212 | UIToolPaneMachine *m_pPaneToolsMachine;
|
---|
213 | /** Holds the sliding-animation widget instance. */
|
---|
214 | UISlidingAnimation *m_pSlidingAnimation;
|
---|
215 | /** Holds the Tools-pane instance. */
|
---|
216 | UITools *m_pPaneTools;
|
---|
217 | };
|
---|
218 |
|
---|
219 | #endif /* !FEQT_INCLUDED_SRC_manager_UIVirtualBoxManagerWidget_h */
|
---|