1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxConsoleWnd class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.215389.xyz. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxConsoleWnd_h__
|
---|
24 | #define __VBoxConsoleWnd_h__
|
---|
25 |
|
---|
26 | #include "COMDefs.h"
|
---|
27 |
|
---|
28 | #include <qmainwindow.h>
|
---|
29 |
|
---|
30 | #include <qmap.h>
|
---|
31 | #include <qobjectlist.h>
|
---|
32 | #include <qcolor.h>
|
---|
33 | #include <qdialog.h>
|
---|
34 |
|
---|
35 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
36 | # include <VBox/dbggui.h>
|
---|
37 | #endif
|
---|
38 | #ifdef Q_WS_MAC
|
---|
39 | # undef PAGE_SIZE
|
---|
40 | # undef PAGE_SHIFT
|
---|
41 | # include <Carbon/Carbon.h>
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | class QAction;
|
---|
45 | class QActionGroup;
|
---|
46 | class QHBox;
|
---|
47 | class QLabel;
|
---|
48 |
|
---|
49 | class VBoxConsoleView;
|
---|
50 | class QIStateIndicator;
|
---|
51 |
|
---|
52 | class VBoxUSBMenu;
|
---|
53 | class VBoxSwitchMenu;
|
---|
54 | class VBoxUSBLedTip;
|
---|
55 | class VBoxNetworkLedTip;
|
---|
56 |
|
---|
57 | class VBoxConsoleWnd : public QMainWindow
|
---|
58 | {
|
---|
59 | Q_OBJECT
|
---|
60 |
|
---|
61 | public:
|
---|
62 |
|
---|
63 | VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
|
---|
64 | QWidget* aParent = 0, const char* aName = 0,
|
---|
65 | WFlags aFlags = WType_TopLevel);
|
---|
66 | virtual ~VBoxConsoleWnd();
|
---|
67 |
|
---|
68 | bool openView (const CSession &session);
|
---|
69 | void closeView();
|
---|
70 |
|
---|
71 | void refreshView();
|
---|
72 |
|
---|
73 | bool isTrueFullscreen() const { return mIsFullscreen; }
|
---|
74 |
|
---|
75 | bool isTrueSeamless() const { return mIsSeamless; }
|
---|
76 |
|
---|
77 | void setMouseIntegrationLocked (bool aDisabled);
|
---|
78 |
|
---|
79 | void popupMainMenu (bool aCenter);
|
---|
80 |
|
---|
81 | void installGuestAdditionsFrom (const QString &aSource);
|
---|
82 |
|
---|
83 | public slots:
|
---|
84 |
|
---|
85 | protected:
|
---|
86 |
|
---|
87 | // events
|
---|
88 | bool event (QEvent *e);
|
---|
89 | void closeEvent (QCloseEvent *e);
|
---|
90 | #if defined(Q_WS_X11)
|
---|
91 | bool x11Event (XEvent *event);
|
---|
92 | #endif
|
---|
93 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
94 | bool dbgCreated();
|
---|
95 | void dbgDestroy();
|
---|
96 | void dbgAdjustRelativePos();
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | protected slots:
|
---|
100 |
|
---|
101 | private:
|
---|
102 |
|
---|
103 | enum /* Stuff */
|
---|
104 | {
|
---|
105 | FloppyStuff = 0x01,
|
---|
106 | DVDStuff = 0x02,
|
---|
107 | HardDiskStuff = 0x04,
|
---|
108 | PauseAction = 0x08,
|
---|
109 | NetworkStuff = 0x10,
|
---|
110 | DisableMouseIntegrAction = 0x20,
|
---|
111 | Caption = 0x40,
|
---|
112 | USBStuff = 0x80,
|
---|
113 | VRDPStuff = 0x100,
|
---|
114 | AllStuff = 0xFF,
|
---|
115 | };
|
---|
116 |
|
---|
117 | void languageChange();
|
---|
118 |
|
---|
119 | void updateAppearanceOf (int element);
|
---|
120 |
|
---|
121 | void toggleFullscreenMode (bool, bool);
|
---|
122 |
|
---|
123 | private slots:
|
---|
124 |
|
---|
125 | void finalizeOpenView();
|
---|
126 |
|
---|
127 | void activateUICustomizations();
|
---|
128 |
|
---|
129 | void vmFullscreen (bool on);
|
---|
130 | void vmSeamless (bool on);
|
---|
131 | void vmAutoresizeGuest (bool on);
|
---|
132 | void vmAdjustWindow();
|
---|
133 |
|
---|
134 | void vmTypeCAD();
|
---|
135 | void vmTypeCABS();
|
---|
136 | void vmReset();
|
---|
137 | void vmPause(bool);
|
---|
138 | void vmACPIShutdown();
|
---|
139 | void vmClose();
|
---|
140 | void vmTakeSnapshot();
|
---|
141 | void vmDisableMouseIntegr (bool);
|
---|
142 |
|
---|
143 | void devicesMountFloppyImage();
|
---|
144 | void devicesUnmountFloppy();
|
---|
145 | void devicesMountDVDImage();
|
---|
146 | void devicesUnmountDVD();
|
---|
147 | void devicesSwitchVrdp (bool);
|
---|
148 | void devicesOpenSFDialog();
|
---|
149 | void devicesInstallGuestAdditions();
|
---|
150 |
|
---|
151 | void prepareFloppyMenu();
|
---|
152 | void prepareDVDMenu();
|
---|
153 | void prepareNetworkMenu();
|
---|
154 |
|
---|
155 | void setDynamicMenuItemStatusTip (int aId);
|
---|
156 |
|
---|
157 | void captureFloppy (int aId);
|
---|
158 | void captureDVD (int aId);
|
---|
159 | void activateNetworkMenu (int aId);
|
---|
160 | void switchUSB (int aId);
|
---|
161 |
|
---|
162 | void statusTipChanged (const QString &);
|
---|
163 | void clearStatusBar();
|
---|
164 |
|
---|
165 | void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
|
---|
166 |
|
---|
167 | void updateDeviceLights();
|
---|
168 | void updateMachineState (CEnums::MachineState state);
|
---|
169 |
|
---|
170 | void updateMouseState (int state);
|
---|
171 |
|
---|
172 | void updateAdditionsState (const QString&, bool, bool);
|
---|
173 |
|
---|
174 | void tryClose();
|
---|
175 |
|
---|
176 | void processGlobalSettingChange (const char *publicName, const char *name);
|
---|
177 |
|
---|
178 | void dbgShowStatistics();
|
---|
179 | void dbgShowCommandLine();
|
---|
180 |
|
---|
181 | private:
|
---|
182 |
|
---|
183 | /** Popup version of the main menu */
|
---|
184 | QPopupMenu *mMainMenu;
|
---|
185 |
|
---|
186 | QActionGroup *runningActions;
|
---|
187 |
|
---|
188 | // Machine actions
|
---|
189 | QAction *vmFullscreenAction;
|
---|
190 | QAction *vmSeamlessAction;
|
---|
191 | QAction *vmAutoresizeGuestAction;
|
---|
192 | QAction *vmAdjustWindowAction;
|
---|
193 | QAction *vmTypeCADAction;
|
---|
194 | #if defined(Q_WS_X11)
|
---|
195 | QAction *vmTypeCABSAction;
|
---|
196 | #endif
|
---|
197 | QAction *vmResetAction;
|
---|
198 | QAction *vmPauseAction;
|
---|
199 | QAction *vmACPIShutdownAction;
|
---|
200 | QAction *vmCloseAction;
|
---|
201 | QAction *vmTakeSnapshotAction;
|
---|
202 | QAction *vmDisableMouseIntegrAction;
|
---|
203 |
|
---|
204 | // Devices actions
|
---|
205 | QAction *devicesMountFloppyImageAction;
|
---|
206 | QAction *devicesUnmountFloppyAction;
|
---|
207 | QAction *devicesMountDVDImageAction;
|
---|
208 | QAction *devicesUnmountDVDAction;
|
---|
209 | QAction *devicesSwitchVrdpAction;
|
---|
210 | QAction *devicesSFDialogAction;
|
---|
211 | QAction *devicesInstallGuestToolsAction;
|
---|
212 |
|
---|
213 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
214 | // Debugger actions
|
---|
215 | QAction *dbgStatisticsAction;
|
---|
216 | QAction *dbgCommandLineAction;
|
---|
217 | #endif
|
---|
218 |
|
---|
219 | // Help actions
|
---|
220 | QAction *helpWebAction;
|
---|
221 | QAction *helpAboutAction;
|
---|
222 | QAction *helpResetMessagesAction;
|
---|
223 |
|
---|
224 | // Machine popup menus
|
---|
225 | VBoxSwitchMenu *vmAutoresizeMenu;
|
---|
226 | VBoxSwitchMenu *vmDisMouseIntegrMenu;
|
---|
227 |
|
---|
228 | // Devices popup menus
|
---|
229 | QPopupMenu *devicesMenu;
|
---|
230 | QPopupMenu *devicesMountFloppyMenu;
|
---|
231 | QPopupMenu *devicesMountDVDMenu;
|
---|
232 | QPopupMenu *devicesSharedFolders;
|
---|
233 | QPopupMenu *devicesNetworkMenu;
|
---|
234 | VBoxUSBMenu *devicesUSBMenu;
|
---|
235 | VBoxSwitchMenu *devicesVRDPMenu;
|
---|
236 |
|
---|
237 | int devicesUSBMenuSeparatorId;
|
---|
238 | int devicesVRDPMenuSeparatorId;
|
---|
239 | int devicesSFMenuSeparatorId;
|
---|
240 |
|
---|
241 | bool waitForStatusBarChange;
|
---|
242 | bool statusBarChangedInside;
|
---|
243 |
|
---|
244 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
245 | // Debugger popup menu
|
---|
246 | QPopupMenu *dbgMenu;
|
---|
247 | #endif
|
---|
248 |
|
---|
249 | // Menu identifiers
|
---|
250 | enum {
|
---|
251 | vmMenuId = 1,
|
---|
252 | devicesMenuId,
|
---|
253 | devicesMountFloppyMenuId,
|
---|
254 | devicesMountDVDMenuId,
|
---|
255 | devicesUSBMenuId,
|
---|
256 | devicesNetworkMenuId,
|
---|
257 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
258 | dbgMenuId,
|
---|
259 | #endif
|
---|
260 | helpMenuId,
|
---|
261 | };
|
---|
262 |
|
---|
263 | CSession csession;
|
---|
264 |
|
---|
265 | // widgets
|
---|
266 | VBoxConsoleView *console;
|
---|
267 | QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light, *sf_light;
|
---|
268 | QIStateIndicator *mouse_state, *hostkey_state;
|
---|
269 | QIStateIndicator *autoresize_state;
|
---|
270 | QIStateIndicator *vrdp_state;
|
---|
271 | QHBox *hostkey_hbox;
|
---|
272 | QLabel *hostkey_name;
|
---|
273 |
|
---|
274 | VBoxUSBLedTip *mUsbLedTip;
|
---|
275 | VBoxNetworkLedTip *mNetworkLedTip;
|
---|
276 |
|
---|
277 | QTimer *idle_timer;
|
---|
278 | CEnums::MachineState machine_state;
|
---|
279 | QString caption_prefix;
|
---|
280 |
|
---|
281 | bool no_auto_close : 1;
|
---|
282 |
|
---|
283 | QMap <int, CHostDVDDrive> hostDVDMap;
|
---|
284 | QMap <int, CHostFloppyDrive> hostFloppyMap;
|
---|
285 |
|
---|
286 | QPoint normal_pos;
|
---|
287 | QSize normal_size;
|
---|
288 | QSize prev_min_size;
|
---|
289 |
|
---|
290 | // variables for dealing with true fullscreen
|
---|
291 | bool mIsFullscreen : 1;
|
---|
292 | bool mIsSeamless : 1;
|
---|
293 | bool mIsSeamlessSupported : 1;
|
---|
294 | int normal_wflags;
|
---|
295 | bool was_max : 1;
|
---|
296 | QObjectList hidden_children;
|
---|
297 | int console_style;
|
---|
298 | QColor erase_color;
|
---|
299 |
|
---|
300 | bool mIsFirstTimeStarted : 1;
|
---|
301 | bool mIsAutoSaveMedia : 1;
|
---|
302 |
|
---|
303 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
304 | // Debugger GUI
|
---|
305 | PDBGGUI dbg_gui;
|
---|
306 | #endif
|
---|
307 |
|
---|
308 | #ifdef Q_WS_MAC
|
---|
309 | // Dock images.
|
---|
310 | CGImageRef dockImgStateRunning;
|
---|
311 | CGImageRef dockImgStatePaused;
|
---|
312 | CGImageRef dockImgStateSaving;
|
---|
313 | CGImageRef dockImgStateRestoring;
|
---|
314 | CGImageRef dockImgBack75x75;
|
---|
315 | CGImageRef dockImgBack100x75;
|
---|
316 | CGImageRef dockImgOS;
|
---|
317 | #endif
|
---|
318 | };
|
---|
319 |
|
---|
320 |
|
---|
321 | class VBoxSharedFoldersSettings;
|
---|
322 | class VBoxSFDialog : public QDialog
|
---|
323 | {
|
---|
324 | Q_OBJECT
|
---|
325 |
|
---|
326 | public:
|
---|
327 |
|
---|
328 | VBoxSFDialog (QWidget*, CSession&);
|
---|
329 |
|
---|
330 | protected slots:
|
---|
331 |
|
---|
332 | virtual void accept();
|
---|
333 |
|
---|
334 | protected:
|
---|
335 |
|
---|
336 | void showEvent (QShowEvent*);
|
---|
337 |
|
---|
338 | private:
|
---|
339 |
|
---|
340 | VBoxSharedFoldersSettings *mSettings;
|
---|
341 | CSession &mSession;
|
---|
342 | };
|
---|
343 |
|
---|
344 |
|
---|
345 | #endif // __VBoxConsoleWnd_h__
|
---|