VirtualBox

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

Last change on this file since 10631 was 10439, checked in by vboxsync, 16 years ago

Fe/Qt4: VirtualBox New Version Notifier dialog implemented.

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