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