VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h@ 43138

Last change on this file since 43138 was 42853, checked in by vboxsync, 12 years ago

FE/Qt: 6234: Support for VM groups: Show Log action will now only be available for single selected VM.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.1 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * UISelectorWindow class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2012 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __UISelectorWindow_h__
20#define __UISelectorWindow_h__
21
22/* Qt includes: */
23#include <QMainWindow>
24#include <QUrl>
25
26/* GUI includes: */
27#include "QIWithRetranslateUI.h"
28#include "UIMedium.h"
29#include "UINetworkDefs.h"
30
31/* Forward declarations: */
32class QISplitter;
33class QMenu;
34class UIAction;
35class UIMainBar;
36class UIToolBar;
37class UIVMDesktop;
38class UIVMItem;
39class UIVMItemModel;
40class UIVMListView;
41class UIGChooser;
42class UIGDetails;
43class QStackedWidget;
44
45/* VM selector window class: */
46class UISelectorWindow : public QIWithRetranslateUI2<QMainWindow>
47{
48 Q_OBJECT;
49
50signals:
51
52 /* Obsolete: Signal to notify listeners about this dialog closed: */
53 void closing();
54
55public:
56
57 /* Constructor/destructor: */
58 UISelectorWindow(UISelectorWindow **ppSelf,
59 QWidget* pParent = 0,
60 Qt::WindowFlags flags = Qt::Window);
61 ~UISelectorWindow();
62
63private slots:
64
65 /* Handlers: Global-event stuff: */
66 void sltStateChanged(QString strId);
67 void sltSnapshotChanged(QString strId);
68
69 /* Handler: Details-view stuff: */
70 void sltDetailsViewIndexChanged(int iWidgetIndex);
71
72 /* Handler: Medium enumeration stuff: */
73 void sltMediumEnumFinished(const VBoxMediaList &mediumList);
74
75 /* Handler: Menubar/status stuff: */
76 void sltShowSelectorContextMenu(const QPoint &pos);
77
78 /* Handlers: File-menu stuff: */
79 void sltShowMediumManager();
80 void sltShowImportApplianceWizard(const QString &strFileName = QString());
81 void sltShowExportApplianceWizard();
82 void sltShowPreferencesDialog();
83 void sltPerformExit();
84
85 /* Handlers: Machine-menu slots: */
86 void sltShowAddMachineDialog(const QString &strFileName = QString());
87 void sltShowMachineSettingsDialog(const QString &strCategory = QString(),
88 const QString &strControl = QString(),
89 const QString &strId = QString());
90 void sltShowCloneMachineWizard();
91 void sltPerformStartOrShowAction();
92 void sltPerformDiscardAction();
93 void sltPerformPauseResumeAction(bool fPause);
94 void sltPerformResetAction();
95 void sltPerformSaveAction();
96 void sltPerformACPIShutdownAction();
97 void sltPerformPowerOffAction();
98 void sltPerformRefreshAction();
99 void sltShowLogDialog();
100 void sltShowMachineInFileManager();
101 void sltPerformCreateShortcutAction();
102 void sltGroupCloseMenuAboutToShow();
103 void sltMachineCloseMenuAboutToShow();
104
105 /* VM list slots: */
106 void sltCurrentVMItemChanged(bool fRefreshDetails = true, bool fRefreshSnapshots = true, bool fRefreshDescription = true);
107 void sltOpenUrls(QList<QUrl> list = QList<QUrl>());
108
109 /* Handlers: Group saving stuff: */
110 void sltGroupSavingUpdate();
111
112private:
113
114 /* Translation stuff: */
115 void retranslateUi();
116
117 /* Event handlers: */
118 bool event(QEvent *pEvent);
119 void closeEvent(QCloseEvent *pEvent);
120#ifdef Q_WS_MAC
121 bool eventFilter(QObject *pObject, QEvent *pEvent);
122#endif /* Q_WS_MAC */
123
124 /* Helpers: Prepare stuff: */
125 void prepareIcon();
126 void prepareMenuBar();
127 void prepareMenuFile(QMenu *pMenu);
128 void prepareCommonActions();
129 void prepareGroupActions();
130 void prepareMachineActions();
131 void prepareMenuGroup(QMenu *pMenu);
132 void prepareMenuMachine(QMenu *pMenu);
133 void prepareMenuGroupClose(QMenu *pMenu);
134 void prepareMenuMachineClose(QMenu *pMenu);
135 void prepareMenuHelp(QMenu *pMenu);
136 void prepareStatusBar();
137 void prepareWidgets();
138 void prepareConnections();
139 void loadSettings();
140 void saveSettings();
141
142 /* Helpers: Current item stuff: */
143 UIVMItem* currentItem() const;
144 QList<UIVMItem*> currentItems() const;
145
146 /* Helper: Action update stuff: */
147 void updateActionsAppearance();
148
149 /* Helpers: Action stuff: */
150 bool isActionEnabled(int iActionIndex, const QList<UIVMItem*> &items);
151 static bool isItemsPoweredOff(const QList<UIVMItem*> &items);
152 static bool isAtLeastOneItemAbleToShutdown(const QList<UIVMItem*> &items);
153 static bool isAtLeastOneItemSupportsShortcuts(const QList<UIVMItem*> &items);
154 static bool isAtLeastOneItemAccessible(const QList<UIVMItem*> &items);
155 static bool isAtLeastOneItemInaccessible(const QList<UIVMItem*> &items);
156 static bool isAtLeastOneItemRemovable(const QList<UIVMItem*> &items);
157 static bool isAtLeastOneItemCanBeStartedOrShowed(const QList<UIVMItem*> &items);
158 static bool isAtLeastOneItemDiscardable(const QList<UIVMItem*> &items);
159 static bool isAtLeastOneItemStarted(const QList<UIVMItem*> &items);
160 static bool isAtLeastOneItemRunning(const QList<UIVMItem*> &items);
161 static bool isItemEditable(UIVMItem *pItem);
162 static bool isItemSaved(UIVMItem *pItem);
163 static bool isItemPoweredOff(UIVMItem *pItem);
164 static bool isItemStarted(UIVMItem *pItem);
165 static bool isItemRunning(UIVMItem *pItem);
166 static bool isItemPaused(UIVMItem *pItem);
167 static bool isItemStuck(UIVMItem *pItem);
168
169 /* Central splitter window: */
170 QISplitter *m_pSplitter;
171
172 /* Main toolbar: */
173#ifndef Q_WS_MAC
174 UIMainBar *m_pBar;
175#endif /* !Q_WS_MAC */
176 UIToolBar *mVMToolBar;
177
178 /* Details widgets container: */
179 QStackedWidget *m_pContainer;
180
181 /* Graphics chooser/details: */
182 UIGChooser *m_pChooser;
183 UIGDetails *m_pDetails;
184
185 /* VM details widget: */
186 UIVMDesktop *m_pVMDesktop;
187
188 /* 'File' menu action pointers: */
189 QMenu *m_pFileMenu;
190 UIAction *m_pMediumManagerDialogAction;
191 UIAction *m_pImportApplianceWizardAction;
192 UIAction *m_pExportApplianceWizardAction;
193 UIAction *m_pPreferencesDialogAction;
194 UIAction *m_pExitAction;
195
196 /* Common Group/Machine actions: */
197 UIAction *m_pAction_Common_StartOrShow;
198 UIAction *m_pAction_Common_PauseAndResume;
199 UIAction *m_pAction_Common_Reset;
200 UIAction *m_pAction_Common_Discard;
201 UIAction *m_pAction_Common_Refresh;
202 UIAction *m_pAction_Common_ShowInFileManager;
203 UIAction *m_pAction_Common_CreateShortcut;
204
205 /* 'Group' menu action pointers: */
206 QList<UIAction*> m_groupActions;
207 QAction *m_pGroupMenuAction;
208 QMenu *m_pGroupMenu;
209 UIAction *m_pAction_Group_New;
210 UIAction *m_pAction_Group_Add;
211 UIAction *m_pAction_Group_Rename;
212 UIAction *m_pAction_Group_Remove;
213 UIAction *m_pAction_Group_Sort;
214 /* 'Group / Close' menu action pointers: */
215 UIAction *m_pGroupCloseMenuAction;
216 QMenu *m_pGroupCloseMenu;
217 UIAction *m_pGroupSaveAction;
218 UIAction *m_pGroupACPIShutdownAction;
219 UIAction *m_pGroupPowerOffAction;
220
221 /* 'Machine' menu action pointers: */
222 QList<UIAction*> m_machineActions;
223 QAction *m_pMachineMenuAction;
224 QMenu *m_pMachineMenu;
225 UIAction *m_pAction_Machine_New;
226 UIAction *m_pAction_Machine_Add;
227 UIAction *m_pAction_Machine_Settings;
228 UIAction *m_pAction_Machine_Clone;
229 UIAction *m_pAction_Machine_Remove;
230 UIAction *m_pAction_Machine_AddGroup;
231 UIAction *m_pAction_Machine_LogDialog;
232 UIAction *m_pAction_Machine_SortParent;
233 /* 'Machine / Close' menu action pointers: */
234 UIAction *m_pMachineCloseMenuAction;
235 QMenu *m_pMachineCloseMenu;
236 UIAction *m_pMachineSaveAction;
237 UIAction *m_pMachineACPIShutdownAction;
238 UIAction *m_pMachinePowerOffAction;
239
240 /* 'Help' menu action pointers: */
241 QMenu *m_pHelpMenu;
242 UIAction *m_pHelpAction;
243 UIAction *m_pWebAction;
244 UIAction *m_pResetWarningsAction;
245 UIAction *m_pNetworkAccessManager;
246 UIAction *m_pUpdateAction;
247 UIAction *m_pAboutAction;
248
249 /* Other variables: */
250 QRect m_normalGeo;
251 bool m_fDoneInaccessibleWarningOnce : 1;
252};
253
254#endif // __UISelectorWindow_h__
255
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use