VirtualBox

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

Last change on this file since 6659 was 6659, checked in by vboxsync, 17 years ago

Mac OS X: Added setBackgroundMode (Qt::PaletteBackground) after switching back from fullscreen to correctly restore the background pixmap on Mac OS X.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.7 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 (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will 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;
44class QSpacerItem;
45
46class VBoxConsoleView;
47class QIStateIndicator;
48
49class VBoxUSBMenu;
50class VBoxSwitchMenu;
51
52class VBoxConsoleWnd : public QMainWindow
53{
54 Q_OBJECT
55
56public:
57
58 VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
59 QWidget* aParent = 0, const char* aName = 0,
60 WFlags aFlags = WType_TopLevel);
61 virtual ~VBoxConsoleWnd();
62
63 bool openView (const CSession &session);
64 void closeView();
65
66 void refreshView();
67
68 bool isTrueFullscreen() const { return mIsFullscreen; }
69
70 bool isTrueSeamless() const { return mIsSeamless; }
71
72 void setMouseIntegrationLocked (bool aDisabled);
73
74 void popupMainMenu (bool aCenter);
75
76 void installGuestAdditionsFrom (const QString &aSource);
77
78 void setMask (const QRegion &aRegion);
79
80#ifdef Q_WS_MAC
81 CGImageRef dockImageState () const;
82#endif
83
84public slots:
85
86protected:
87
88 // events
89 bool event (QEvent *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 bool 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 vmShowInfoDialog();
144 void vmDisableMouseIntegr (bool);
145
146 void devicesMountFloppyImage();
147 void devicesUnmountFloppy();
148 void devicesMountDVDImage();
149 void devicesUnmountDVD();
150 void devicesSwitchVrdp (bool);
151 void devicesOpenSFDialog();
152 void devicesInstallGuestAdditions();
153
154 void prepareFloppyMenu();
155 void prepareDVDMenu();
156 void prepareNetworkMenu();
157
158 void setDynamicMenuItemStatusTip (int aId);
159
160 void captureFloppy (int aId);
161 void captureDVD (int aId);
162 void activateNetworkMenu (int aId);
163 void switchUSB (int aId);
164
165 void statusTipChanged (const QString &);
166 void clearStatusBar();
167
168 void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
169
170 void updateDeviceLights();
171 void updateMachineState (CEnums::MachineState state);
172 void updateMouseState (int state);
173 void updateAdditionsState (const QString&, bool, bool);
174 void updateNetworkAdarptersState();
175 void updateUsbState();
176 void updateMediaState (VBoxDefs::DiskType aType);
177 void updateSharedFoldersState();
178
179 void tryClose();
180
181 void processGlobalSettingChange (const char *publicName, const char *name);
182
183 void dbgShowStatistics();
184 void dbgShowCommandLine();
185
186 void onEnterFullscreen();
187 void onExitFullscreen();
188
189 void setViewInSeamlessMode (const QRect &aTargetRect);
190
191private:
192
193 /** Popup version of the main menu */
194 QPopupMenu *mMainMenu;
195
196 QActionGroup *mRunningActions;
197 QActionGroup *mRunningOrPausedActions;
198
199 // Machine actions
200 QAction *vmFullscreenAction;
201 QAction *vmSeamlessAction;
202 QAction *vmAutoresizeGuestAction;
203 QAction *vmAdjustWindowAction;
204 QAction *vmTypeCADAction;
205#if defined(Q_WS_X11)
206 QAction *vmTypeCABSAction;
207#endif
208 QAction *vmResetAction;
209 QAction *vmPauseAction;
210 QAction *vmACPIShutdownAction;
211 QAction *vmCloseAction;
212 QAction *vmTakeSnapshotAction;
213 QAction *vmDisableMouseIntegrAction;
214 QAction *vmShowInformationDlgAction;
215
216 // Devices actions
217 QAction *devicesMountFloppyImageAction;
218 QAction *devicesUnmountFloppyAction;
219 QAction *devicesMountDVDImageAction;
220 QAction *devicesUnmountDVDAction;
221 QAction *devicesSwitchVrdpAction;
222 QAction *devicesSFDialogAction;
223 QAction *devicesInstallGuestToolsAction;
224
225#ifdef VBOX_WITH_DEBUGGER_GUI
226 // Debugger actions
227 QAction *dbgStatisticsAction;
228 QAction *dbgCommandLineAction;
229#endif
230
231 // Help actions
232 QAction *helpContentsAction;
233 QAction *helpWebAction;
234 QAction *helpRegisterAction;
235 QAction *helpAboutAction;
236 QAction *helpResetMessagesAction;
237
238 // Machine popup menus
239 VBoxSwitchMenu *vmAutoresizeMenu;
240 VBoxSwitchMenu *vmDisMouseIntegrMenu;
241
242 // Devices popup menus
243 QPopupMenu *devicesMenu;
244 QPopupMenu *devicesMountFloppyMenu;
245 QPopupMenu *devicesMountDVDMenu;
246 QPopupMenu *devicesSFMenu;
247 QPopupMenu *devicesNetworkMenu;
248 VBoxUSBMenu *devicesUSBMenu;
249 VBoxSwitchMenu *devicesVRDPMenu;
250
251 int devicesUSBMenuSeparatorId;
252 int devicesVRDPMenuSeparatorId;
253 int devicesSFMenuSeparatorId;
254
255 bool waitForStatusBarChange;
256 bool statusBarChangedInside;
257
258 QSpacerItem *mShiftingSpacerLeft;
259 QSpacerItem *mShiftingSpacerTop;
260 QSpacerItem *mShiftingSpacerRight;
261 QSpacerItem *mShiftingSpacerBottom;
262 QSize mMaskShift;
263
264#ifdef VBOX_WITH_DEBUGGER_GUI
265 // Debugger popup menu
266 QPopupMenu *dbgMenu;
267#endif
268
269 // Menu identifiers
270 enum {
271 vmMenuId = 1,
272 devicesMenuId,
273 devicesMountFloppyMenuId,
274 devicesMountDVDMenuId,
275 devicesUSBMenuId,
276 devicesNetworkMenuId,
277#ifdef VBOX_WITH_DEBUGGER_GUI
278 dbgMenuId,
279#endif
280 helpMenuId,
281 };
282
283 CSession csession;
284
285 // widgets
286 VBoxConsoleView *console;
287 QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light, *sf_light;
288 QIStateIndicator *mouse_state, *hostkey_state;
289 QIStateIndicator *autoresize_state;
290 QIStateIndicator *vrdp_state;
291 QHBox *hostkey_hbox;
292 QLabel *hostkey_name;
293
294 QTimer *idle_timer;
295 CEnums::MachineState machine_state;
296 QString caption_prefix;
297
298 bool no_auto_close : 1;
299
300 QMap <int, CHostDVDDrive> hostDVDMap;
301 QMap <int, CHostFloppyDrive> hostFloppyMap;
302
303 QPoint normal_pos;
304 QSize normal_size;
305 QSize prev_min_size;
306
307#ifdef Q_WS_WIN32
308 QRegion mPrevRegion;
309#endif
310
311#ifdef Q_WS_MAC
312 QRegion mCurrRegion;
313 EventHandlerRef mDarwinRegionEventHandlerRef;
314#endif
315
316 // variables for dealing with true fullscreen
317 QRegion mStrictedRegion;
318 bool mIsFullscreen : 1;
319 bool mIsSeamless : 1;
320 bool mIsSeamlessSupported : 1;
321 int normal_wflags;
322 bool was_max : 1;
323 QObjectList hidden_children;
324 int console_style;
325 QColor mEraseColor;
326
327 bool mIsOpenViewFinished : 1;
328 bool mIsFirstTimeStarted : 1;
329 bool mIsAutoSaveMedia : 1;
330
331#ifdef VBOX_WITH_DEBUGGER_GUI
332 // Debugger GUI
333 PDBGGUI dbg_gui;
334#endif
335
336#ifdef Q_WS_MAC
337 // Dock images.
338 CGImageRef dockImgStateRunning;
339 CGImageRef dockImgStatePaused;
340 CGImageRef dockImgStateSaving;
341 CGImageRef dockImgStateRestoring;
342 CGImageRef dockImgBack75x75;
343 CGImageRef dockImgBack100x75;
344 CGImageRef dockImgOS;
345 /* For the fade effect if the the window goes fullscreen */
346 CGDisplayFadeReservationToken mFadeToken;
347#endif
348};
349
350
351class VBoxSharedFoldersSettings;
352class VBoxSFDialog : public QDialog
353{
354 Q_OBJECT
355
356public:
357
358 VBoxSFDialog (QWidget*, CSession&);
359
360protected slots:
361
362 virtual void accept();
363
364protected:
365
366 void showEvent (QShowEvent*);
367
368private:
369
370 VBoxSharedFoldersSettings *mSettings;
371 CSession &mSession;
372};
373
374
375#endif // __VBoxConsoleWnd_h__
Note: See TracBrowser for help on using the repository browser.

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