VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h@ 15022

Last change on this file since 15022 was 14977, checked in by vboxsync, 16 years ago

FE/Qt4-OSX: update OpenGL windows on the dock icon

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.3 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 "QIWithRetranslateUI.h"
29
30#include "VBoxProblemReporter.h"
31
32/* Qt includes */
33#include <QMainWindow>
34#include <QMap>
35#include <QColor>
36#include <QDialog>
37
38#ifdef VBOX_WITH_DEBUGGER_GUI
39# include <VBox/dbggui.h>
40#endif
41#ifdef Q_WS_MAC
42# undef PAGE_SIZE
43# undef PAGE_SHIFT
44# include <Carbon/Carbon.h>
45#endif
46
47class QAction;
48class QActionGroup;
49class QLabel;
50class QSpacerItem;
51class QMenu;
52
53class VBoxConsoleView;
54class QIStateIndicator;
55
56class VBoxUSBMenu;
57class VBoxSwitchMenu;
58
59class VBoxChangeDockIconUpdateEvent;
60
61class VBoxConsoleWnd : public QIWithRetranslateUI2<QMainWindow>
62{
63 Q_OBJECT;
64
65public:
66
67 VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
68 QWidget* aParent = 0,
69 Qt::WindowFlags aFlags = Qt::Window);
70 virtual ~VBoxConsoleWnd();
71
72 bool openView (const CSession &session);
73
74 void refreshView();
75
76 bool isTrueFullscreen() const { return mIsFullscreen; }
77
78 bool isTrueSeamless() const { return mIsSeamless; }
79
80 void setMouseIntegrationLocked (bool aDisabled);
81
82 void popupMainMenu (bool aCenter);
83
84 void installGuestAdditionsFrom (const QString &aSource);
85
86 void setMask (const QRegion &aRegion);
87
88 void clearMask();
89
90#if defined (Q_WS_MAC)
91 CGImageRef dockImageState () const;
92#endif
93
94public slots:
95 void changeDockIconUpdate (const VBoxChangeDockIconUpdateEvent &e);
96
97protected:
98
99 // events
100 bool event (QEvent *e);
101 void closeEvent (QCloseEvent *e);
102#if defined(Q_WS_X11)
103 bool x11Event (XEvent *event);
104#endif
105
106 void retranslateUi();
107
108#ifdef VBOX_WITH_DEBUGGER_GUI
109 bool dbgCreated();
110 void dbgDestroy();
111 void dbgAdjustRelativePos();
112#endif
113
114protected slots:
115
116 void closeView();
117
118private:
119
120 enum /* Stuff */
121 {
122 FloppyStuff = 0x01,
123 DVDStuff = 0x02,
124 HardDiskStuff = 0x04,
125 PauseAction = 0x08,
126 NetworkStuff = 0x10,
127 DisableMouseIntegrAction = 0x20,
128 Caption = 0x40,
129 USBStuff = 0x80,
130 VRDPStuff = 0x100,
131 SharedFolderStuff = 0x200,
132 AllStuff = 0xFFFF,
133 };
134
135 void updateAppearanceOf (int element);
136
137 bool toggleFullscreenMode (bool, bool);
138
139private slots:
140
141 void finalizeOpenView();
142
143 void activateUICustomizations();
144
145 void vmFullscreen (bool on);
146 void vmSeamless (bool on);
147 void vmAutoresizeGuest (bool on);
148 void vmAdjustWindow();
149
150 void vmTypeCAD();
151 void vmTypeCABS();
152 void vmReset();
153 void vmPause(bool);
154 void vmACPIShutdown();
155 void vmClose();
156 void vmTakeSnapshot();
157 void vmShowInfoDialog();
158 void vmDisableMouseIntegr (bool);
159
160 void devicesMountFloppyImage();
161 void devicesUnmountFloppy();
162 void devicesMountDVDImage();
163 void devicesUnmountDVD();
164 void devicesSwitchVrdp (bool);
165 void devicesOpenSFDialog();
166 void devicesInstallGuestAdditions();
167
168 void prepareFloppyMenu();
169 void prepareDVDMenu();
170 void prepareNetworkMenu();
171
172 void setDynamicMenuItemStatusTip (QAction *aAction);
173
174 void captureFloppy (QAction *aAction);
175 void captureDVD (QAction *aAction);
176 void activateNetworkMenu (QAction *aAction);
177 void switchUSB (QAction *aAction);
178
179 void statusTipChanged (const QString &);
180 void clearStatusBar();
181
182 void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
183
184 void updateDeviceLights();
185 void updateMachineState (KMachineState state);
186 void updateMouseState (int state);
187 void updateAdditionsState (const QString&, bool, bool, bool);
188 void updateNetworkAdarptersState();
189 void updateUsbState();
190 void updateMediaDriveState (VBoxDefs::MediaType aType);
191 void updateSharedFoldersState();
192
193 void tryClose();
194
195 void processGlobalSettingChange (const char *publicName, const char *name);
196
197 void dbgPrepareDebugMenu();
198 void dbgShowStatistics();
199 void dbgShowCommandLine();
200 void dbgLoggingToggled(bool aBool);
201
202 void onExitFullscreen();
203 void unlockActionsSwitch();
204
205 void switchToFullscreen (bool aOn, bool aSeamless);
206 void setViewInSeamlessMode (const QRect &aTargetRect);
207
208private:
209
210 /** Popup version of the main menu */
211 QMenu *mMainMenu;
212
213 QActionGroup *mRunningActions;
214 QActionGroup *mRunningOrPausedActions;
215
216 /* Machine actions */
217 QAction *mVmFullscreenAction;
218 QAction *mVmSeamlessAction;
219 QAction *mVmAutoresizeGuestAction;
220 QAction *mVmAdjustWindowAction;
221 QAction *mVmTypeCADAction;
222#if defined(Q_WS_X11)
223 QAction *mVmTypeCABSAction;
224#endif
225 QAction *mVmResetAction;
226 QAction *mVmPauseAction;
227 QAction *mVmACPIShutdownAction;
228 QAction *mVmCloseAction;
229 QAction *mVmTakeSnapshotAction;
230 QAction *mVmDisableMouseIntegrAction;
231 QAction *mVmShowInformationDlgAction;
232
233 /* Devices actions */
234 QAction *mDevicesMountFloppyImageAction;
235 QAction *mDevicesUnmountFloppyAction;
236 QAction *mDevicesMountDVDImageAction;
237 QAction *mDevicesUnmountDVDAction;
238 QAction *mDevicesSwitchVrdpAction;
239 QAction *mDevicesSFDialogAction;
240 QAction *mDevicesInstallGuestToolsAction;
241
242#ifdef VBOX_WITH_DEBUGGER_GUI
243 /* Debugger actions */
244 QAction *mDbgStatisticsAction;
245 QAction *mDbgCommandLineAction;
246 QAction *mDbgLoggingAction;
247#endif
248
249 /* Help actions */
250 VBoxHelpActions mHelpActions;
251
252 /* Machine popup menus */
253 VBoxSwitchMenu *mVmAutoresizeMenu;
254 VBoxSwitchMenu *mVmDisMouseIntegrMenu;
255
256 /* Devices popup menus */
257 bool mWaitForStatusBarChange : 1;
258 bool mStatusBarChangedInside : 1;
259
260 QAction *mDevicesUSBMenuSeparator;
261 QAction *mDevicesVRDPMenuSeparator;
262 QAction *mDevicesSFMenuSeparator;
263
264 QMenu *mVMMenu;
265 QMenu *mDevicesMenu;
266 QMenu *mDevicesMountFloppyMenu;
267 QMenu *mDevicesMountDVDMenu;
268 /* see showIndicatorContextMenu for a description of mDevicesSFMenu */
269 /* QMenu *mDevicesSFMenu; */
270 QMenu *mDevicesNetworkMenu;
271 VBoxUSBMenu *mDevicesUSBMenu;
272 /* VBoxSwitchMenu *mDevicesVRDPMenu; */
273#ifdef VBOX_WITH_DEBUGGER_GUI
274 // Debugger popup menu
275 QMenu *mDbgMenu;
276#endif
277 QMenu *mHelpMenu;
278
279 QSpacerItem *mShiftingSpacerLeft;
280 QSpacerItem *mShiftingSpacerTop;
281 QSpacerItem *mShiftingSpacerRight;
282 QSpacerItem *mShiftingSpacerBottom;
283 QSize mMaskShift;
284
285 CSession csession;
286
287 // widgets
288 VBoxConsoleView *console;
289 QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light, *sf_light;
290 QIStateIndicator *mouse_state, *hostkey_state;
291 QIStateIndicator *autoresize_state;
292 QIStateIndicator *vrdp_state;
293 QWidget *hostkey_hbox;
294 QLabel *hostkey_name;
295
296 QTimer *idle_timer;
297 KMachineState machine_state;
298 QString caption_prefix;
299
300 bool no_auto_close : 1;
301
302 QMap <QAction *, CHostDVDDrive> hostDVDMap;
303 QMap <QAction *, CHostFloppyDrive> hostFloppyMap;
304
305 QRect mNormalGeo;
306 QSize prev_min_size;
307
308#ifdef Q_WS_WIN
309 QRegion mPrevRegion;
310#endif
311
312#ifdef Q_WS_MAC
313 QRegion mCurrRegion;
314 EventHandlerRef mDarwinRegionEventHandlerRef;
315#endif
316
317 // variables for dealing with true fullscreen
318 QRegion mStrictedRegion;
319 bool mIsFullscreen : 1;
320 bool mIsSeamless : 1;
321 bool mIsSeamlessSupported : 1;
322 bool mIsGraphicsSupported : 1;
323 bool mIsWaitingModeResize : 1;
324 bool was_max : 1;
325 QObjectList hidden_children;
326 int console_style;
327 QPalette mErasePalette;
328
329 bool mIsOpenViewFinished : 1;
330 bool mIsFirstTimeStarted : 1;
331 bool mIsAutoSaveMedia : 1;
332
333#ifdef VBOX_WITH_DEBUGGER_GUI
334 /** The handle to the debugger gui. */
335 PDBGGUI mDbgGui;
336 /** The virtual method table for the debugger GUI. */
337 PCDBGGUIVT mDbgGuiVT;
338#endif
339
340#ifdef Q_WS_MAC
341 /* For seamless maximizing */
342 QRect mNormalGeometry;
343 Qt::WindowFlags mSavedFlags;
344 /* Dock images */
345 CGImageRef dockImgStatePaused;
346 CGImageRef dockImgStateSaving;
347 CGImageRef dockImgStateRestoring;
348 CGImageRef dockImgBack100x75;
349 CGImageRef dockImgOS;
350 /* For the fade effect if the the window goes fullscreen */
351 CGDisplayFadeReservationToken mFadeToken;
352#endif
353};
354
355
356class VBoxVMSettingsSF;
357class VBoxSFDialog : public QIWithRetranslateUI<QDialog>
358{
359 Q_OBJECT;
360
361public:
362
363 VBoxSFDialog (QWidget*, CSession&);
364
365protected:
366
367 void retranslateUi();
368
369protected slots:
370
371 virtual void accept();
372
373protected:
374
375 void showEvent (QShowEvent*);
376
377private:
378
379 VBoxVMSettingsSF *mSettings;
380 CSession &mSession;
381};
382
383
384#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