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 |
|
---|
34 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
35 | #include <VBox/dbggui.h>
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | class QAction;
|
---|
39 | class QActionGroup;
|
---|
40 | class QHBox;
|
---|
41 | class QLabel;
|
---|
42 |
|
---|
43 | class VBoxConsoleView;
|
---|
44 | class QIStateIndicator;
|
---|
45 |
|
---|
46 | class VBoxUSBMenu;
|
---|
47 | class VBoxSwitchMenu;
|
---|
48 | class VBoxUSBLedTip;
|
---|
49 |
|
---|
50 | class VBoxConsoleWnd : public QMainWindow
|
---|
51 | {
|
---|
52 | Q_OBJECT
|
---|
53 |
|
---|
54 | public:
|
---|
55 |
|
---|
56 | VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
|
---|
57 | QWidget* aParent = 0, const char* aName = 0,
|
---|
58 | WFlags aFlags = WType_TopLevel);
|
---|
59 | virtual ~VBoxConsoleWnd();
|
---|
60 |
|
---|
61 | bool openView (const CSession &session);
|
---|
62 | void closeView();
|
---|
63 |
|
---|
64 | void refreshView();
|
---|
65 |
|
---|
66 | bool isTrueFullscreen() const { return full_screen; }
|
---|
67 |
|
---|
68 | public slots:
|
---|
69 |
|
---|
70 | protected:
|
---|
71 |
|
---|
72 | // events
|
---|
73 | bool event (QEvent *e);
|
---|
74 | void closeEvent (QCloseEvent *e);
|
---|
75 | #if defined(Q_WS_X11)
|
---|
76 | bool x11Event (XEvent *event);
|
---|
77 | #endif
|
---|
78 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
79 | bool dbgCreated();
|
---|
80 | void dbgDestroy();
|
---|
81 | void dbgAdjustRelativePos();
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | protected slots:
|
---|
85 |
|
---|
86 | private:
|
---|
87 |
|
---|
88 | enum /* Stuff */
|
---|
89 | {
|
---|
90 | FloppyStuff = 0x01,
|
---|
91 | DVDStuff = 0x02,
|
---|
92 | HardDiskStuff = 0x04,
|
---|
93 | PauseAction = 0x08,
|
---|
94 | NetworkStuff = 0x10,
|
---|
95 | DisableMouseIntegrAction = 0x20,
|
---|
96 | Caption = 0x40,
|
---|
97 | USBStuff = 0x80,
|
---|
98 | VRDPStuff = 0x100,
|
---|
99 | AllStuff = 0xFF,
|
---|
100 | };
|
---|
101 |
|
---|
102 | void languageChange();
|
---|
103 |
|
---|
104 | void updateAppearanceOf (int element);
|
---|
105 |
|
---|
106 | private slots:
|
---|
107 |
|
---|
108 | void finalizeOpenView();
|
---|
109 |
|
---|
110 | void vmFullscreen (bool on);
|
---|
111 | void vmAutoresizeGuest (bool on);
|
---|
112 | void vmAdjustWindow();
|
---|
113 |
|
---|
114 | void vmTypeCAD();
|
---|
115 | void vmTypeCABS();
|
---|
116 | void vmReset();
|
---|
117 | void vmPause(bool);
|
---|
118 | void vmACPIShutdown();
|
---|
119 | void vmClose();
|
---|
120 | void vmTakeSnapshot();
|
---|
121 | void vmDisableMouseIntegr (bool);
|
---|
122 |
|
---|
123 | void devicesMountFloppyImage();
|
---|
124 | void devicesUnmountFloppy();
|
---|
125 | void devicesMountDVDImage();
|
---|
126 | void devicesUnmountDVD();
|
---|
127 | void devicesSwitchVrdp (bool);
|
---|
128 | void devicesInstallGuestAdditions();
|
---|
129 |
|
---|
130 | void prepareFloppyMenu();
|
---|
131 | void prepareDVDMenu();
|
---|
132 |
|
---|
133 | void captureFloppy (int id);
|
---|
134 | void captureDVD (int id);
|
---|
135 | void switchUSB (int id);
|
---|
136 |
|
---|
137 | void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
|
---|
138 |
|
---|
139 | void updateDeviceLights();
|
---|
140 | void updateMachineState (CEnums::MachineState state);
|
---|
141 |
|
---|
142 | void updateMouseState (int state);
|
---|
143 |
|
---|
144 | void tryClose();
|
---|
145 |
|
---|
146 | void processGlobalSettingChange (const char *publicName, const char *name);
|
---|
147 |
|
---|
148 | void dbgShowStatistics();
|
---|
149 | void dbgShowCommandLine();
|
---|
150 |
|
---|
151 | private:
|
---|
152 |
|
---|
153 | QActionGroup *runningActions;
|
---|
154 |
|
---|
155 | // VM actions
|
---|
156 | QAction *vmFullscreenAction;
|
---|
157 | QAction *vmAutoresizeGuestAction;
|
---|
158 | QAction *vmAdjustWindowAction;
|
---|
159 | QAction *vmTypeCADAction;
|
---|
160 | #if defined(Q_WS_X11)
|
---|
161 | QAction *vmTypeCABSAction;
|
---|
162 | #endif
|
---|
163 | QAction *vmResetAction;
|
---|
164 | QAction *vmPauseAction;
|
---|
165 | QAction *vmACPIShutdownAction;
|
---|
166 | QAction *vmCloseAction;
|
---|
167 | QAction *vmTakeSnapshotAction;
|
---|
168 | QAction *vmDisableMouseIntegrAction;
|
---|
169 |
|
---|
170 | // VM popup menus
|
---|
171 | VBoxSwitchMenu *vmAutoresizeMenu;
|
---|
172 | VBoxSwitchMenu *vmDisMouseIntegrMenu;
|
---|
173 |
|
---|
174 | // Devices actions
|
---|
175 | QAction *devicesMountFloppyImageAction;
|
---|
176 | QAction *devicesUnmountFloppyAction;
|
---|
177 | QAction *devicesMountDVDImageAction;
|
---|
178 | QAction *devicesUnmountDVDAction;
|
---|
179 | QAction *devicesSwitchVrdpAction;
|
---|
180 | QAction *devicesInstallGuestToolsAction;
|
---|
181 |
|
---|
182 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
183 | // Debugger actions
|
---|
184 | QAction *dbgStatisticsAction;
|
---|
185 | QAction *dbgCommandLineAction;
|
---|
186 | #endif
|
---|
187 |
|
---|
188 | // Help actions
|
---|
189 | QAction *helpWebAction;
|
---|
190 | QAction *helpAboutAction;
|
---|
191 | QAction *helpResetMessagesAction;
|
---|
192 |
|
---|
193 | // Devices popup menus
|
---|
194 | QPopupMenu *devicesMenu;
|
---|
195 | QPopupMenu *devicesMountFloppyMenu;
|
---|
196 | QPopupMenu *devicesMountDVDMenu;
|
---|
197 | VBoxUSBMenu *devicesUSBMenu;
|
---|
198 | VBoxSwitchMenu *devicesVRDPMenu;
|
---|
199 |
|
---|
200 | int devicesUSBMenuSeparatorId;
|
---|
201 | int devicesVRDPMenuSeparatorId;
|
---|
202 |
|
---|
203 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
204 | // Debugger popup menu
|
---|
205 | QPopupMenu *dbgMenu;
|
---|
206 | #endif
|
---|
207 |
|
---|
208 | // Menu identifiers
|
---|
209 | enum {
|
---|
210 | vmMenuId = 1,
|
---|
211 | devicesMenuId,
|
---|
212 | devicesMountFloppyMenuId,
|
---|
213 | devicesMountDVDMenuId,
|
---|
214 | devicesUSBMenuId,
|
---|
215 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
216 | dbgMenuId,
|
---|
217 | #endif
|
---|
218 | helpMenuId,
|
---|
219 | };
|
---|
220 |
|
---|
221 | CSession csession;
|
---|
222 |
|
---|
223 | // widgets
|
---|
224 | VBoxConsoleView *console;
|
---|
225 | QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light;
|
---|
226 | QIStateIndicator *mouse_state, *hostkey_state;
|
---|
227 | QIStateIndicator *autoresize_state;
|
---|
228 | QIStateIndicator *vrdp_state;
|
---|
229 | QHBox *hostkey_hbox;
|
---|
230 | QLabel *hostkey_name;
|
---|
231 |
|
---|
232 | VBoxUSBLedTip *mUsbLedTip;
|
---|
233 |
|
---|
234 | QTimer *idle_timer;
|
---|
235 | CEnums::MachineState machine_state;
|
---|
236 | QString caption_prefix;
|
---|
237 |
|
---|
238 | bool no_auto_close : 1;
|
---|
239 |
|
---|
240 | QMap <int, CHostDVDDrive> hostDVDMap;
|
---|
241 | QMap <int, CHostFloppyDrive> hostFloppyMap;
|
---|
242 |
|
---|
243 | QPoint normal_pos;
|
---|
244 | QSize normal_size;
|
---|
245 |
|
---|
246 | // variables for dealing with true fullscreen
|
---|
247 | bool full_screen : 1;
|
---|
248 | int normal_wflags;
|
---|
249 | bool was_max : 1;
|
---|
250 | QObjectList hidden_children;
|
---|
251 | int console_style;
|
---|
252 | QColor erase_color;
|
---|
253 |
|
---|
254 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
255 | // Debugger GUI
|
---|
256 | PDBGGUI dbg_gui;
|
---|
257 | #endif
|
---|
258 | };
|
---|
259 |
|
---|
260 | #endif // __VBoxConsoleWnd_h__
|
---|