VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h@ 5327

Last change on this file since 5327 was 5260, checked in by vboxsync, 18 years ago

Enable own VBoxConsoleWnd::setMask() function for all win platforms and not only for Win32.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
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.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
19#ifndef __VBoxConsoleWnd_h__
20#define __VBoxConsoleWnd_h__
21
22#include "COMDefs.h"
23
24#include <qmainwindow.h>
25
26#include <qmap.h>
27#include <qobjectlist.h>
28#include <qcolor.h>
29#include <qdialog.h>
30
31#ifdef VBOX_WITH_DEBUGGER_GUI
32# include <VBox/dbggui.h>
33#endif
34#ifdef Q_WS_MAC
35# undef PAGE_SIZE
36# undef PAGE_SHIFT
37# include <Carbon/Carbon.h>
38#endif
39
40class QAction;
41class QActionGroup;
42class QHBox;
43class QLabel;
44
45class VBoxConsoleView;
46class QIStateIndicator;
47
48class VBoxUSBMenu;
49class VBoxSwitchMenu;
50
51class VBoxConsoleWnd : public QMainWindow
52{
53 Q_OBJECT
54
55public:
56
57 VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
58 QWidget* aParent = 0, const char* aName = 0,
59 WFlags aFlags = WType_TopLevel);
60 virtual ~VBoxConsoleWnd();
61
62 bool openView (const CSession &session);
63 void closeView();
64
65 void refreshView();
66
67 bool isTrueFullscreen() const { return mIsFullscreen; }
68
69 bool isTrueSeamless() const { return mIsSeamless; }
70
71 bool isManualResize() const { return mManualResize; }
72
73 void setMouseIntegrationLocked (bool aDisabled);
74
75 void popupMainMenu (bool aCenter);
76
77 void installGuestAdditionsFrom (const QString &aSource);
78
79#ifdef Q_WS_WIN
80 void setMask (const QRegion &aRegion);
81#endif
82
83public slots:
84
85protected:
86
87 // events
88 bool event (QEvent *e);
89 void resizeEvent (QResizeEvent *e);
90 void closeEvent (QCloseEvent *e);
91#if defined(Q_WS_X11)
92 bool x11Event (XEvent *event);
93#endif
94#ifdef VBOX_WITH_DEBUGGER_GUI
95 bool dbgCreated();
96 void dbgDestroy();
97 void dbgAdjustRelativePos();
98#endif
99
100protected slots:
101
102private:
103
104 enum /* Stuff */
105 {
106 FloppyStuff = 0x01,
107 DVDStuff = 0x02,
108 HardDiskStuff = 0x04,
109 PauseAction = 0x08,
110 NetworkStuff = 0x10,
111 DisableMouseIntegrAction = 0x20,
112 Caption = 0x40,
113 USBStuff = 0x80,
114 VRDPStuff = 0x100,
115 SharedFolderStuff = 0x200,
116 AllStuff = 0xFFFF,
117 };
118
119 void languageChange();
120
121 void updateAppearanceOf (int element);
122
123 void toggleFullscreenMode (bool, bool);
124
125private slots:
126
127 void finalizeOpenView();
128
129 void activateUICustomizations();
130
131 void vmFullscreen (bool on);
132 void vmSeamless (bool on);
133 void vmAutoresizeGuest (bool on);
134 void vmAdjustWindow();
135
136 void vmTypeCAD();
137 void vmTypeCABS();
138 void vmReset();
139 void vmPause(bool);
140 void vmACPIShutdown();
141 void vmClose();
142 void vmTakeSnapshot();
143 void vmDisableMouseIntegr (bool);
144
145 void devicesMountFloppyImage();
146 void devicesUnmountFloppy();
147 void devicesMountDVDImage();
148 void devicesUnmountDVD();
149 void devicesSwitchVrdp (bool);
150 void devicesOpenSFDialog();
151 void devicesInstallGuestAdditions();
152
153 void prepareFloppyMenu();
154 void prepareDVDMenu();
155 void prepareNetworkMenu();
156
157 void setDynamicMenuItemStatusTip (int aId);
158
159 void captureFloppy (int aId);
160 void captureDVD (int aId);
161 void activateNetworkMenu (int aId);
162 void switchUSB (int aId);
163
164 void statusTipChanged (const QString &);
165 void clearStatusBar();
166
167 void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
168
169 void updateDeviceLights();
170 void updateMachineState (CEnums::MachineState state);
171 void updateMouseState (int state);
172 void updateAdditionsState (const QString&, bool, bool);
173 void updateNetworkAdarptersState();
174 void updateUsbState();
175 void updateMediaState (VBoxDefs::DiskType aType);
176 void updateSharedFoldersState();
177
178 void tryClose();
179
180 void processGlobalSettingChange (const char *publicName, const char *name);
181
182 void dbgShowStatistics();
183 void dbgShowCommandLine();
184
185 void onEnterFullscreen();
186 void onExitFullscreen();
187
188private:
189
190 /** Popup version of the main menu */
191 QPopupMenu *mMainMenu;
192
193 QActionGroup *mRunningActions;
194 QActionGroup *mRunningOrPausedActions;
195
196 // Machine actions
197 QAction *vmFullscreenAction;
198 QAction *vmSeamlessAction;
199 QAction *vmAutoresizeGuestAction;
200 QAction *vmAdjustWindowAction;
201 QAction *vmTypeCADAction;
202#if defined(Q_WS_X11)
203 QAction *vmTypeCABSAction;
204#endif
205 QAction *vmResetAction;
206 QAction *vmPauseAction;
207 QAction *vmACPIShutdownAction;
208 QAction *vmCloseAction;
209 QAction *vmTakeSnapshotAction;
210 QAction *vmDisableMouseIntegrAction;
211
212 // Devices actions
213 QAction *devicesMountFloppyImageAction;
214 QAction *devicesUnmountFloppyAction;
215 QAction *devicesMountDVDImageAction;
216 QAction *devicesUnmountDVDAction;
217 QAction *devicesSwitchVrdpAction;
218 QAction *devicesSFDialogAction;
219 QAction *devicesInstallGuestToolsAction;
220
221#ifdef VBOX_WITH_DEBUGGER_GUI
222 // Debugger actions
223 QAction *dbgStatisticsAction;
224 QAction *dbgCommandLineAction;
225#endif
226
227 // Help actions
228 QAction *helpContentsAction;
229 QAction *helpWebAction;
230 QAction *helpRegisterAction;
231 QAction *helpAboutAction;
232 QAction *helpResetMessagesAction;
233
234 // Machine popup menus
235 VBoxSwitchMenu *vmAutoresizeMenu;
236 VBoxSwitchMenu *vmDisMouseIntegrMenu;
237
238 // Devices popup menus
239 QPopupMenu *devicesMenu;
240 QPopupMenu *devicesMountFloppyMenu;
241 QPopupMenu *devicesMountDVDMenu;
242 QPopupMenu *devicesSFMenu;
243 QPopupMenu *devicesNetworkMenu;
244 VBoxUSBMenu *devicesUSBMenu;
245 VBoxSwitchMenu *devicesVRDPMenu;
246
247 int devicesUSBMenuSeparatorId;
248 int devicesVRDPMenuSeparatorId;
249 int devicesSFMenuSeparatorId;
250
251 bool waitForStatusBarChange;
252 bool statusBarChangedInside;
253
254#ifdef VBOX_WITH_DEBUGGER_GUI
255 // Debugger popup menu
256 QPopupMenu *dbgMenu;
257#endif
258
259 // Menu identifiers
260 enum {
261 vmMenuId = 1,
262 devicesMenuId,
263 devicesMountFloppyMenuId,
264 devicesMountDVDMenuId,
265 devicesUSBMenuId,
266 devicesNetworkMenuId,
267#ifdef VBOX_WITH_DEBUGGER_GUI
268 dbgMenuId,
269#endif
270 helpMenuId,
271 };
272
273 CSession csession;
274
275 // widgets
276 VBoxConsoleView *console;
277 QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light, *sf_light;
278 QIStateIndicator *mouse_state, *hostkey_state;
279 QIStateIndicator *autoresize_state;
280 QIStateIndicator *vrdp_state;
281 QHBox *hostkey_hbox;
282 QLabel *hostkey_name;
283
284 QTimer *idle_timer;
285 CEnums::MachineState machine_state;
286 QString caption_prefix;
287
288 bool no_auto_close : 1;
289
290 QMap <int, CHostDVDDrive> hostDVDMap;
291 QMap <int, CHostFloppyDrive> hostFloppyMap;
292
293 QPoint normal_pos;
294 QSize normal_size;
295 QSize prev_min_size;
296 QSize mPrevSize;
297 QSize mAwaitingSize;
298
299#ifdef Q_WS_WIN32
300 QRegion mPrevRegion;
301#endif
302
303 // variables for dealing with true fullscreen
304 bool mDoMaximize : 1;
305 bool mManualResize : 1;
306 bool mAllowOneResize : 1;
307 bool mIsFullscreen : 1;
308 bool mIsSeamless : 1;
309 bool mIsSeamlessSupported : 1;
310 int normal_wflags;
311 bool was_max : 1;
312 QObjectList hidden_children;
313 int console_style;
314 QColor erase_color;
315
316 bool mIsOpenViewFinished : 1;
317 bool mIsFirstTimeStarted : 1;
318 bool mIsAutoSaveMedia : 1;
319
320#ifdef VBOX_WITH_DEBUGGER_GUI
321 // Debugger GUI
322 PDBGGUI dbg_gui;
323#endif
324
325#ifdef Q_WS_MAC
326 // Dock images.
327 CGImageRef dockImgStateRunning;
328 CGImageRef dockImgStatePaused;
329 CGImageRef dockImgStateSaving;
330 CGImageRef dockImgStateRestoring;
331 CGImageRef dockImgBack75x75;
332 CGImageRef dockImgBack100x75;
333 CGImageRef dockImgOS;
334#endif
335};
336
337
338class VBoxSharedFoldersSettings;
339class VBoxSFDialog : public QDialog
340{
341 Q_OBJECT
342
343public:
344
345 VBoxSFDialog (QWidget*, CSession&);
346
347protected slots:
348
349 virtual void accept();
350
351protected:
352
353 void showEvent (QShowEvent*);
354
355private:
356
357 VBoxSharedFoldersSettings *mSettings;
358 CSession &mSession;
359};
360
361
362#endif // __VBoxConsoleWnd_h__
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette