VirtualBox

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

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

FE/Qt: Refined indicator tooltips in the console window (+ more useful info for the shared folders indicator).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.0 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxConsoleWnd class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __VBoxConsoleWnd_h__
20#define __VBoxConsoleWnd_h__
21
22#include "COMDefs.h"
23
24#include <qmainwindow.h>
25
26#include <qmap.h>
27#include <qobjectlist.h>
28#include <qcolor.h>
29#include <qdialog.h>
30
31#ifdef VBOX_WITH_DEBUGGER_GUI
32# include <VBox/dbggui.h>
33#endif
34#ifdef Q_WS_MAC
35# undef PAGE_SIZE
36# undef PAGE_SHIFT
37# include <Carbon/Carbon.h>
38#endif
39
40class QAction;
41class QActionGroup;
42class QHBox;
43class QLabel;
44
45class VBoxConsoleView;
46class QIStateIndicator;
47
48class VBoxUSBMenu;
49class VBoxSwitchMenu;
50class VBoxUSBLedTip;
51class VBoxNetworkLedTip;
52
53class VBoxConsoleWnd : public QMainWindow
54{
55 Q_OBJECT
56
57public:
58
59 VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
60 QWidget* aParent = 0, const char* aName = 0,
61 WFlags aFlags = WType_TopLevel);
62 virtual ~VBoxConsoleWnd();
63
64 bool openView (const CSession &session);
65 void closeView();
66
67 void refreshView();
68
69 bool isTrueFullscreen() const { return mIsFullscreen; }
70
71 bool isTrueSeamless() const { return mIsSeamless; }
72
73 void setMouseIntegrationLocked (bool aDisabled);
74
75 void popupMainMenu (bool aCenter);
76
77 void installGuestAdditionsFrom (const QString &aSource);
78
79#ifdef Q_WS_WIN32
80 void setMask (const QRegion &aRegion);
81#endif
82
83public slots:
84
85protected:
86
87 // events
88 bool event (QEvent *e);
89 void closeEvent (QCloseEvent *e);
90#if defined(Q_WS_X11)
91 bool x11Event (XEvent *event);
92#endif
93#ifdef VBOX_WITH_DEBUGGER_GUI
94 bool dbgCreated();
95 void dbgDestroy();
96 void dbgAdjustRelativePos();
97#endif
98
99protected slots:
100
101private:
102
103 enum /* Stuff */
104 {
105 FloppyStuff = 0x01,
106 DVDStuff = 0x02,
107 HardDiskStuff = 0x04,
108 PauseAction = 0x08,
109 NetworkStuff = 0x10,
110 DisableMouseIntegrAction = 0x20,
111 Caption = 0x40,
112 USBStuff = 0x80,
113 VRDPStuff = 0x100,
114 SharedFolderStuff = 0x200,
115 AllStuff = 0xFFFF,
116 };
117
118 void languageChange();
119
120 void updateAppearanceOf (int element);
121
122 void toggleFullscreenMode (bool, bool);
123
124private slots:
125
126 void finalizeOpenView();
127
128 void activateUICustomizations();
129
130 void vmFullscreen (bool on);
131 void vmSeamless (bool on);
132 void vmAutoresizeGuest (bool on);
133 void vmAdjustWindow();
134
135 void vmTypeCAD();
136 void vmTypeCABS();
137 void vmReset();
138 void vmPause(bool);
139 void vmACPIShutdown();
140 void vmClose();
141 void vmTakeSnapshot();
142 void vmDisableMouseIntegr (bool);
143
144 void devicesMountFloppyImage();
145 void devicesUnmountFloppy();
146 void devicesMountDVDImage();
147 void devicesUnmountDVD();
148 void devicesSwitchVrdp (bool);
149 void devicesOpenSFDialog();
150 void devicesInstallGuestAdditions();
151
152 void prepareFloppyMenu();
153 void prepareDVDMenu();
154 void prepareNetworkMenu();
155
156 void setDynamicMenuItemStatusTip (int aId);
157
158 void captureFloppy (int aId);
159 void captureDVD (int aId);
160 void activateNetworkMenu (int aId);
161 void switchUSB (int aId);
162
163 void statusTipChanged (const QString &);
164 void clearStatusBar();
165
166 void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
167
168 void updateDeviceLights();
169 void updateMachineState (CEnums::MachineState state);
170 void updateMouseState (int state);
171 void updateAdditionsState (const QString&, bool, bool);
172 void updateMediaState (VBoxDefs::DiskType aType);
173 void updateSharedFoldersState();
174
175 void tryClose();
176
177 void processGlobalSettingChange (const char *publicName, const char *name);
178
179 void dbgShowStatistics();
180 void dbgShowCommandLine();
181
182private:
183
184 /** Popup version of the main menu */
185 QPopupMenu *mMainMenu;
186
187 QActionGroup *runningActions;
188
189 // Machine actions
190 QAction *vmFullscreenAction;
191 QAction *vmSeamlessAction;
192 QAction *vmAutoresizeGuestAction;
193 QAction *vmAdjustWindowAction;
194 QAction *vmTypeCADAction;
195#if defined(Q_WS_X11)
196 QAction *vmTypeCABSAction;
197#endif
198 QAction *vmResetAction;
199 QAction *vmPauseAction;
200 QAction *vmACPIShutdownAction;
201 QAction *vmCloseAction;
202 QAction *vmTakeSnapshotAction;
203 QAction *vmDisableMouseIntegrAction;
204
205 // Devices actions
206 QAction *devicesMountFloppyImageAction;
207 QAction *devicesUnmountFloppyAction;
208 QAction *devicesMountDVDImageAction;
209 QAction *devicesUnmountDVDAction;
210 QAction *devicesSwitchVrdpAction;
211 QAction *devicesSFDialogAction;
212 QAction *devicesInstallGuestToolsAction;
213
214#ifdef VBOX_WITH_DEBUGGER_GUI
215 // Debugger actions
216 QAction *dbgStatisticsAction;
217 QAction *dbgCommandLineAction;
218#endif
219
220 // Help actions
221 QAction *helpWebAction;
222 QAction *helpAboutAction;
223 QAction *helpResetMessagesAction;
224
225 // Machine popup menus
226 VBoxSwitchMenu *vmAutoresizeMenu;
227 VBoxSwitchMenu *vmDisMouseIntegrMenu;
228
229 // Devices popup menus
230 QPopupMenu *devicesMenu;
231 QPopupMenu *devicesMountFloppyMenu;
232 QPopupMenu *devicesMountDVDMenu;
233 QPopupMenu *devicesSharedFolders;
234 QPopupMenu *devicesNetworkMenu;
235 VBoxUSBMenu *devicesUSBMenu;
236 VBoxSwitchMenu *devicesVRDPMenu;
237
238 int devicesUSBMenuSeparatorId;
239 int devicesVRDPMenuSeparatorId;
240 int devicesSFMenuSeparatorId;
241
242 bool waitForStatusBarChange;
243 bool statusBarChangedInside;
244
245#ifdef VBOX_WITH_DEBUGGER_GUI
246 // Debugger popup menu
247 QPopupMenu *dbgMenu;
248#endif
249
250 // Menu identifiers
251 enum {
252 vmMenuId = 1,
253 devicesMenuId,
254 devicesMountFloppyMenuId,
255 devicesMountDVDMenuId,
256 devicesUSBMenuId,
257 devicesNetworkMenuId,
258#ifdef VBOX_WITH_DEBUGGER_GUI
259 dbgMenuId,
260#endif
261 helpMenuId,
262 };
263
264 CSession csession;
265
266 // widgets
267 VBoxConsoleView *console;
268 QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light, *sf_light;
269 QIStateIndicator *mouse_state, *hostkey_state;
270 QIStateIndicator *autoresize_state;
271 QIStateIndicator *vrdp_state;
272 QHBox *hostkey_hbox;
273 QLabel *hostkey_name;
274
275 VBoxUSBLedTip *mUsbLedTip;
276 VBoxNetworkLedTip *mNetworkLedTip;
277
278 QTimer *idle_timer;
279 CEnums::MachineState machine_state;
280 QString caption_prefix;
281
282 bool no_auto_close : 1;
283
284 QMap <int, CHostDVDDrive> hostDVDMap;
285 QMap <int, CHostFloppyDrive> hostFloppyMap;
286
287 QPoint normal_pos;
288 QSize normal_size;
289 QSize prev_min_size;
290
291#ifdef Q_WS_WIN32
292 QRegion mPrevRegion;
293#endif
294
295 // variables for dealing with true fullscreen
296 bool mIsFullscreen : 1;
297 bool mIsSeamless : 1;
298 bool mIsSeamlessSupported : 1;
299 int normal_wflags;
300 bool was_max : 1;
301 QObjectList hidden_children;
302 int console_style;
303 QColor erase_color;
304
305 bool mIsOpenViewFinished : 1;
306 bool mIsFirstTimeStarted : 1;
307 bool mIsAutoSaveMedia : 1;
308
309#ifdef VBOX_WITH_DEBUGGER_GUI
310 // Debugger GUI
311 PDBGGUI dbg_gui;
312#endif
313
314#ifdef Q_WS_MAC
315 // Dock images.
316 CGImageRef dockImgStateRunning;
317 CGImageRef dockImgStatePaused;
318 CGImageRef dockImgStateSaving;
319 CGImageRef dockImgStateRestoring;
320 CGImageRef dockImgBack75x75;
321 CGImageRef dockImgBack100x75;
322 CGImageRef dockImgOS;
323#endif
324};
325
326
327class VBoxSharedFoldersSettings;
328class VBoxSFDialog : public QDialog
329{
330 Q_OBJECT
331
332public:
333
334 VBoxSFDialog (QWidget*, CSession&);
335
336protected slots:
337
338 virtual void accept();
339
340protected:
341
342 void showEvent (QShowEvent*);
343
344private:
345
346 VBoxSharedFoldersSettings *mSettings;
347 CSession &mSession;
348};
349
350
351#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