VirtualBox

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

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

FE/Qt4: Use QIWithRetranslateUI as base for all classes that need translation (Still not all classes transfered). Language could be switched online with VBoxManage.

  • 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.215389.xyz. 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::WFlags aFlags = Qt::WType_TopLevel);
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 onEnterFullscreen();
193 void onExitFullscreen();
194 void exitFullscreen();
195 void exitSeamless();
196
197 void switchToFullscreen (bool aOn, bool aSeamless);
198 void setViewInSeamlessMode (const QRect &aTargetRect);
199
200private:
201
202 /** Popup version of the main menu */
203 QMenu *mMainMenu;
204
205 QActionGroup *mRunningActions;
206 QActionGroup *mRunningOrPausedActions;
207
208 // Machine actions
209 QAction *vmFullscreenAction;
210 QAction *vmSeamlessAction;
211 QAction *vmAutoresizeGuestAction;
212 QAction *vmAdjustWindowAction;
213 QAction *vmTypeCADAction;
214#if defined(Q_WS_X11)
215 QAction *vmTypeCABSAction;
216#endif
217 QAction *vmResetAction;
218 QAction *vmPauseAction;
219 QAction *vmACPIShutdownAction;
220 QAction *vmCloseAction;
221 QAction *vmTakeSnapshotAction;
222 QAction *vmDisableMouseIntegrAction;
223 QAction *vmShowInformationDlgAction;
224
225 // Devices actions
226 QAction *devicesMountFloppyImageAction;
227 QAction *devicesUnmountFloppyAction;
228 QAction *devicesMountDVDImageAction;
229 QAction *devicesUnmountDVDAction;
230 QAction *devicesSwitchVrdpAction;
231 QAction *devicesSFDialogAction;
232 QAction *devicesInstallGuestToolsAction;
233
234#ifdef VBOX_WITH_DEBUGGER_GUI
235 // Debugger actions
236 QAction *dbgStatisticsAction;
237 QAction *dbgCommandLineAction;
238#endif
239
240 // Help actions
241 QAction *helpContentsAction;
242 QAction *helpWebAction;
243 QAction *helpRegisterAction;
244 QAction *helpAboutAction;
245 QAction *helpResetMessagesAction;
246
247 // Machine popup menus
248 VBoxSwitchMenu *vmAutoresizeMenu;
249 VBoxSwitchMenu *vmDisMouseIntegrMenu;
250
251 // Devices popup menus
252 bool waitForStatusBarChange;
253 bool statusBarChangedInside;
254
255 QAction *mDevicesUSBMenuSeparator;
256 QAction *mDevicesVRDPMenuSeparator;
257 QAction *mDevicesSFMenuSeparator;
258
259 QMenu *mVMMenu;
260 QMenu *mDevicesMenu;
261 QMenu *mDevicesMountFloppyMenu;
262 QMenu *mDevicesMountDVDMenu;
263 /* see showIndicatorContextMenu for a description of mDevicesSFMenu */
264 /* QMenu *mDevicesSFMenu; */
265 QMenu *mDevicesNetworkMenu;
266 VBoxUSBMenu *mDevicesUSBMenu;
267 /* VBoxSwitchMenu *mDevicesVRDPMenu; */
268#ifdef VBOX_WITH_DEBUGGER_GUI
269 // Debugger popup menu
270 QMenu *mDbgMenu;
271#endif
272 QMenu *mHelpMenu;
273
274 QSpacerItem *mShiftingSpacerLeft;
275 QSpacerItem *mShiftingSpacerTop;
276 QSpacerItem *mShiftingSpacerRight;
277 QSpacerItem *mShiftingSpacerBottom;
278 QSize mMaskShift;
279
280 CSession csession;
281
282 // widgets
283 VBoxConsoleView *console;
284 QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light, *sf_light;
285 QIStateIndicator *mouse_state, *hostkey_state;
286 QIStateIndicator *autoresize_state;
287 QIStateIndicator *vrdp_state;
288 QWidget *hostkey_hbox;
289 QLabel *hostkey_name;
290
291 QTimer *idle_timer;
292 KMachineState machine_state;
293 QString caption_prefix;
294
295 bool no_auto_close : 1;
296
297 QMap <QAction *, CHostDVDDrive> hostDVDMap;
298 QMap <QAction *, CHostFloppyDrive> hostFloppyMap;
299
300 QPoint normal_pos;
301 QSize normal_size;
302 QSize prev_min_size;
303
304#ifdef Q_WS_WIN32
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 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 VBoxSharedFoldersSettings;
350class VBoxSFDialog : public QDialog
351{
352 Q_OBJECT
353
354public:
355
356 VBoxSFDialog (QWidget*, CSession&);
357
358protected slots:
359
360 virtual void accept();
361
362protected:
363
364 void showEvent (QShowEvent*);
365
366private:
367
368 VBoxSharedFoldersSettings *mSettings;
369 CSession &mSession;
370};
371
372
373#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