VirtualBox

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

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

2800: "FE/Qt: Switch to fullscreen does not work reliably":
Latest fullscreen/seamless fix.

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