1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxConsoleWnd class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 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 full_screen; }
|
---|
74 |
|
---|
75 | public slots:
|
---|
76 |
|
---|
77 | protected:
|
---|
78 |
|
---|
79 | // events
|
---|
80 | bool event (QEvent *e);
|
---|
81 | void closeEvent (QCloseEvent *e);
|
---|
82 | #if defined(Q_WS_X11)
|
---|
83 | bool x11Event (XEvent *event);
|
---|
84 | #endif
|
---|
85 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
86 | bool dbgCreated();
|
---|
87 | void dbgDestroy();
|
---|
88 | void dbgAdjustRelativePos();
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | protected slots:
|
---|
92 |
|
---|
93 | private:
|
---|
94 |
|
---|
95 | enum /* Stuff */
|
---|
96 | {
|
---|
97 | FloppyStuff = 0x01,
|
---|
98 | DVDStuff = 0x02,
|
---|
99 | HardDiskStuff = 0x04,
|
---|
100 | PauseAction = 0x08,
|
---|
101 | NetworkStuff = 0x10,
|
---|
102 | DisableMouseIntegrAction = 0x20,
|
---|
103 | Caption = 0x40,
|
---|
104 | USBStuff = 0x80,
|
---|
105 | VRDPStuff = 0x100,
|
---|
106 | AllStuff = 0xFF,
|
---|
107 | };
|
---|
108 |
|
---|
109 | void languageChange();
|
---|
110 |
|
---|
111 | void updateAppearanceOf (int element);
|
---|
112 |
|
---|
113 | private slots:
|
---|
114 |
|
---|
115 | void finalizeOpenView();
|
---|
116 |
|
---|
117 | void loadGuiCustomizations();
|
---|
118 |
|
---|
119 | void vmFullscreen (bool on);
|
---|
120 | void vmAutoresizeGuest (bool on);
|
---|
121 | void vmAdjustWindow();
|
---|
122 |
|
---|
123 | void vmTypeCAD();
|
---|
124 | void vmTypeCABS();
|
---|
125 | void vmReset();
|
---|
126 | void vmPause(bool);
|
---|
127 | void vmACPIShutdown();
|
---|
128 | void vmClose();
|
---|
129 | void vmTakeSnapshot();
|
---|
130 | void vmDisableMouseIntegr (bool);
|
---|
131 |
|
---|
132 | void devicesMountFloppyImage();
|
---|
133 | void devicesUnmountFloppy();
|
---|
134 | void devicesMountDVDImage();
|
---|
135 | void devicesUnmountDVD();
|
---|
136 | void devicesSwitchVrdp (bool);
|
---|
137 | void devicesToggleSFDialog (bool);
|
---|
138 | void devicesInstallGuestAdditions();
|
---|
139 |
|
---|
140 | void prepareFloppyMenu();
|
---|
141 | void prepareDVDMenu();
|
---|
142 | void prepareNetworkMenu();
|
---|
143 |
|
---|
144 | void setDynamicMenuItemStatusTip (int aId);
|
---|
145 |
|
---|
146 | void captureFloppy (int aId);
|
---|
147 | void captureDVD (int aId);
|
---|
148 | void activateNetworkMenu (int aId);
|
---|
149 | void switchUSB (int aId);
|
---|
150 | void activateSFMenu();
|
---|
151 |
|
---|
152 | void statusTipChanged (const QString &);
|
---|
153 | void clearStatusBar();
|
---|
154 |
|
---|
155 | void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
|
---|
156 |
|
---|
157 | void updateDeviceLights();
|
---|
158 | void updateMachineState (CEnums::MachineState state);
|
---|
159 |
|
---|
160 | void updateMouseState (int state);
|
---|
161 |
|
---|
162 | void updateAdditionsState (const QString&, bool);
|
---|
163 |
|
---|
164 | void tryClose();
|
---|
165 |
|
---|
166 | void processGlobalSettingChange (const char *publicName, const char *name);
|
---|
167 |
|
---|
168 | void dbgShowStatistics();
|
---|
169 | void dbgShowCommandLine();
|
---|
170 |
|
---|
171 | private:
|
---|
172 |
|
---|
173 | QActionGroup *runningActions;
|
---|
174 |
|
---|
175 | // VM actions
|
---|
176 | QAction *vmFullscreenAction;
|
---|
177 | QAction *vmAutoresizeGuestAction;
|
---|
178 | QAction *vmAdjustWindowAction;
|
---|
179 | QAction *vmTypeCADAction;
|
---|
180 | #if defined(Q_WS_X11)
|
---|
181 | QAction *vmTypeCABSAction;
|
---|
182 | #endif
|
---|
183 | QAction *vmResetAction;
|
---|
184 | QAction *vmPauseAction;
|
---|
185 | QAction *vmACPIShutdownAction;
|
---|
186 | QAction *vmCloseAction;
|
---|
187 | QAction *vmTakeSnapshotAction;
|
---|
188 | QAction *vmDisableMouseIntegrAction;
|
---|
189 |
|
---|
190 | // VM popup menus
|
---|
191 | VBoxSwitchMenu *vmAutoresizeMenu;
|
---|
192 | VBoxSwitchMenu *vmDisMouseIntegrMenu;
|
---|
193 |
|
---|
194 | // Devices actions
|
---|
195 | QAction *devicesMountFloppyImageAction;
|
---|
196 | QAction *devicesUnmountFloppyAction;
|
---|
197 | QAction *devicesMountDVDImageAction;
|
---|
198 | QAction *devicesUnmountDVDAction;
|
---|
199 | QAction *devicesSwitchVrdpAction;
|
---|
200 | QAction *devicesSFDialogAction;
|
---|
201 | QAction *devicesInstallGuestToolsAction;
|
---|
202 |
|
---|
203 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
204 | // Debugger actions
|
---|
205 | QAction *dbgStatisticsAction;
|
---|
206 | QAction *dbgCommandLineAction;
|
---|
207 | #endif
|
---|
208 |
|
---|
209 | // Help actions
|
---|
210 | QAction *helpWebAction;
|
---|
211 | QAction *helpAboutAction;
|
---|
212 | QAction *helpResetMessagesAction;
|
---|
213 |
|
---|
214 | // Devices popup menus
|
---|
215 | QPopupMenu *devicesMenu;
|
---|
216 | QPopupMenu *devicesMountFloppyMenu;
|
---|
217 | QPopupMenu *devicesMountDVDMenu;
|
---|
218 | QPopupMenu *devicesSharedFolders;
|
---|
219 | QPopupMenu *devicesNetworkMenu;
|
---|
220 | VBoxUSBMenu *devicesUSBMenu;
|
---|
221 | VBoxSwitchMenu *devicesVRDPMenu;
|
---|
222 |
|
---|
223 | int devicesUSBMenuSeparatorId;
|
---|
224 | int devicesVRDPMenuSeparatorId;
|
---|
225 | int devicesSFMenuSeparatorId;
|
---|
226 |
|
---|
227 | bool waitForStatusBarChange;
|
---|
228 | bool statusBarChangedInside;
|
---|
229 |
|
---|
230 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
231 | // Debugger popup menu
|
---|
232 | QPopupMenu *dbgMenu;
|
---|
233 | #endif
|
---|
234 |
|
---|
235 | // Menu identifiers
|
---|
236 | enum {
|
---|
237 | vmMenuId = 1,
|
---|
238 | devicesMenuId,
|
---|
239 | devicesMountFloppyMenuId,
|
---|
240 | devicesMountDVDMenuId,
|
---|
241 | devicesUSBMenuId,
|
---|
242 | devicesNetworkMenuId,
|
---|
243 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
244 | dbgMenuId,
|
---|
245 | #endif
|
---|
246 | helpMenuId,
|
---|
247 | };
|
---|
248 |
|
---|
249 | CSession csession;
|
---|
250 |
|
---|
251 | bool mIsAutoresizeEnabled;
|
---|
252 |
|
---|
253 | // widgets
|
---|
254 | VBoxConsoleView *console;
|
---|
255 | QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light;
|
---|
256 | QIStateIndicator *mouse_state, *hostkey_state;
|
---|
257 | QIStateIndicator *autoresize_state;
|
---|
258 | QIStateIndicator *vrdp_state;
|
---|
259 | QIStateIndicator *sf_state;
|
---|
260 | QHBox *hostkey_hbox;
|
---|
261 | QLabel *hostkey_name;
|
---|
262 |
|
---|
263 | VBoxUSBLedTip *mUsbLedTip;
|
---|
264 | VBoxNetworkLedTip *mNetworkLedTip;
|
---|
265 |
|
---|
266 | QTimer *idle_timer;
|
---|
267 | CEnums::MachineState machine_state;
|
---|
268 | QString caption_prefix;
|
---|
269 |
|
---|
270 | bool no_auto_close : 1;
|
---|
271 |
|
---|
272 | QMap <int, CHostDVDDrive> hostDVDMap;
|
---|
273 | QMap <int, CHostFloppyDrive> hostFloppyMap;
|
---|
274 |
|
---|
275 | QPoint normal_pos;
|
---|
276 | QSize normal_size;
|
---|
277 |
|
---|
278 | // variables for dealing with true fullscreen
|
---|
279 | bool full_screen : 1;
|
---|
280 | int normal_wflags;
|
---|
281 | bool was_max : 1;
|
---|
282 | QObjectList hidden_children;
|
---|
283 | int console_style;
|
---|
284 | QColor erase_color;
|
---|
285 |
|
---|
286 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
287 | // Debugger GUI
|
---|
288 | PDBGGUI dbg_gui;
|
---|
289 | #endif
|
---|
290 |
|
---|
291 | #ifdef Q_WS_MAC
|
---|
292 | // Dock images.
|
---|
293 | CGImageRef dockImgStateRunning;
|
---|
294 | CGImageRef dockImgStatePaused;
|
---|
295 | CGImageRef dockImgStateSaving;
|
---|
296 | CGImageRef dockImgStateRestoring;
|
---|
297 | CGImageRef dockImgBack75x75;
|
---|
298 | CGImageRef dockImgBack100x75;
|
---|
299 | CGImageRef dockImgOS;
|
---|
300 | #endif
|
---|
301 | };
|
---|
302 |
|
---|
303 |
|
---|
304 | class VBoxSharedFoldersSettings;
|
---|
305 | class VBoxSFDialog : public QDialog
|
---|
306 | {
|
---|
307 | Q_OBJECT
|
---|
308 |
|
---|
309 | public:
|
---|
310 |
|
---|
311 | VBoxSFDialog (QWidget*, CSession&, QAction*);
|
---|
312 | ~VBoxSFDialog();
|
---|
313 |
|
---|
314 | protected slots:
|
---|
315 |
|
---|
316 | virtual void accept();
|
---|
317 | virtual void suicide (bool);
|
---|
318 |
|
---|
319 | protected:
|
---|
320 |
|
---|
321 | void showEvent (QShowEvent*);
|
---|
322 |
|
---|
323 | private:
|
---|
324 |
|
---|
325 | VBoxSharedFoldersSettings *mSettings;
|
---|
326 | CSession &mSession;
|
---|
327 | QAction *mAction;
|
---|
328 | };
|
---|
329 |
|
---|
330 |
|
---|
331 | #endif // __VBoxConsoleWnd_h__
|
---|