VirtualBox

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

Last change on this file since 14680 was 14478, checked in by vboxsync, 16 years ago

FE/Qt4: SysTray: Reuse action data (icons, text) from the Selector. Also converted lots of member names to mMember format.

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