VirtualBox

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

Last change on this file since 16174 was 15804, checked in by vboxsync, 16 years ago

FE/Qt4-OSX: new look of the dock preview icon

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