1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxGlobal class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung 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 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxGlobal_h__
|
---|
24 | #define __VBoxGlobal_h__
|
---|
25 |
|
---|
26 | #include "COMDefs.h"
|
---|
27 |
|
---|
28 | #include "VMGlobalSettings.h"
|
---|
29 |
|
---|
30 | #include <qapplication.h>
|
---|
31 | #include <qpixmap.h>
|
---|
32 | #include <qiconset.h>
|
---|
33 | #include <qcolor.h>
|
---|
34 | #include <quuid.h>
|
---|
35 | #include <qthread.h>
|
---|
36 | #include <qpopupmenu.h>
|
---|
37 | #include <qtooltip.h>
|
---|
38 |
|
---|
39 | #include <qptrvector.h>
|
---|
40 | #include <qvaluevector.h>
|
---|
41 | #include <qvaluelist.h>
|
---|
42 | #include <qdict.h>
|
---|
43 | #include <qintdict.h>
|
---|
44 |
|
---|
45 | class QAction;
|
---|
46 |
|
---|
47 | // Auxiliary types
|
---|
48 | ////////////////////////////////////////////////////////////////////////////////
|
---|
49 |
|
---|
50 | /** Simple media descriptor type. */
|
---|
51 | struct VBoxMedia
|
---|
52 | {
|
---|
53 | enum Status { Unknown, Ok, Error, Inaccessible };
|
---|
54 |
|
---|
55 | VBoxMedia() : type (VBoxDefs::InvalidType), status (Ok) {}
|
---|
56 |
|
---|
57 | VBoxMedia (const CUnknown &d, VBoxDefs::DiskType t, Status s)
|
---|
58 | : disk (d), type (t), status (s) {}
|
---|
59 |
|
---|
60 | CUnknown disk;
|
---|
61 | VBoxDefs::DiskType type;
|
---|
62 | Status status;
|
---|
63 | };
|
---|
64 |
|
---|
65 | typedef QValueList <VBoxMedia> VBoxMediaList;
|
---|
66 |
|
---|
67 | // VirtualBox callback events
|
---|
68 | ////////////////////////////////////////////////////////////////////////////////
|
---|
69 |
|
---|
70 | class VBoxMachineStateChangeEvent : public QEvent
|
---|
71 | {
|
---|
72 | public:
|
---|
73 | VBoxMachineStateChangeEvent (const QUuid &aId, CEnums::MachineState aState)
|
---|
74 | : QEvent ((QEvent::Type) VBoxDefs::MachineStateChangeEventType)
|
---|
75 | , id (aId), state (aState)
|
---|
76 | {}
|
---|
77 |
|
---|
78 | const QUuid id;
|
---|
79 | const CEnums::MachineState state;
|
---|
80 | };
|
---|
81 |
|
---|
82 | class VBoxMachineDataChangeEvent : public QEvent
|
---|
83 | {
|
---|
84 | public:
|
---|
85 | VBoxMachineDataChangeEvent (const QUuid &aId)
|
---|
86 | : QEvent ((QEvent::Type) VBoxDefs::MachineDataChangeEventType)
|
---|
87 | , id (aId)
|
---|
88 | {}
|
---|
89 |
|
---|
90 | const QUuid id;
|
---|
91 | };
|
---|
92 |
|
---|
93 | class VBoxMachineRegisteredEvent : public QEvent
|
---|
94 | {
|
---|
95 | public:
|
---|
96 | VBoxMachineRegisteredEvent (const QUuid &aId, bool aRegistered)
|
---|
97 | : QEvent ((QEvent::Type) VBoxDefs::MachineRegisteredEventType)
|
---|
98 | , id (aId), registered (aRegistered)
|
---|
99 | {}
|
---|
100 |
|
---|
101 | const QUuid id;
|
---|
102 | const bool registered;
|
---|
103 | };
|
---|
104 |
|
---|
105 | class VBoxSessionStateChangeEvent : public QEvent
|
---|
106 | {
|
---|
107 | public:
|
---|
108 | VBoxSessionStateChangeEvent (const QUuid &aId, CEnums::SessionState aState)
|
---|
109 | : QEvent ((QEvent::Type) VBoxDefs::SessionStateChangeEventType)
|
---|
110 | , id (aId), state (aState)
|
---|
111 | {}
|
---|
112 |
|
---|
113 | const QUuid id;
|
---|
114 | const CEnums::SessionState state;
|
---|
115 | };
|
---|
116 |
|
---|
117 | class VBoxSnapshotEvent : public QEvent
|
---|
118 | {
|
---|
119 | public:
|
---|
120 |
|
---|
121 | enum What { Taken, Discarded, Changed };
|
---|
122 |
|
---|
123 | VBoxSnapshotEvent (const QUuid &aMachineId, const QUuid &aSnapshotId,
|
---|
124 | What aWhat)
|
---|
125 | : QEvent ((QEvent::Type) VBoxDefs::SnapshotEventType)
|
---|
126 | , what (aWhat)
|
---|
127 | , machineId (aMachineId), snapshotId (aSnapshotId)
|
---|
128 | {}
|
---|
129 |
|
---|
130 | const What what;
|
---|
131 |
|
---|
132 | const QUuid machineId;
|
---|
133 | const QUuid snapshotId;
|
---|
134 | };
|
---|
135 |
|
---|
136 | class QIConstrainKeeper : public QObject
|
---|
137 | {
|
---|
138 | Q_OBJECT
|
---|
139 |
|
---|
140 | public:
|
---|
141 |
|
---|
142 | QIConstrainKeeper (QWidget*);
|
---|
143 |
|
---|
144 | private:
|
---|
145 |
|
---|
146 | bool eventFilter (QObject*, QEvent*);
|
---|
147 | };
|
---|
148 |
|
---|
149 | // VBoxGlobal
|
---|
150 | ////////////////////////////////////////////////////////////////////////////////
|
---|
151 |
|
---|
152 | class VBoxSelectorWnd;
|
---|
153 | class VBoxConsoleWnd;
|
---|
154 |
|
---|
155 | class VBoxGlobal : public QObject
|
---|
156 | {
|
---|
157 | Q_OBJECT
|
---|
158 |
|
---|
159 | public:
|
---|
160 |
|
---|
161 | static VBoxGlobal &instance();
|
---|
162 |
|
---|
163 | bool isValid() { return valid; }
|
---|
164 |
|
---|
165 | QString versionString() { return verString; }
|
---|
166 |
|
---|
167 | CVirtualBox virtualBox() const { return vbox; }
|
---|
168 |
|
---|
169 | const VMGlobalSettings &settings() const { return gset; }
|
---|
170 | bool setSettings (const VMGlobalSettings &gs);
|
---|
171 |
|
---|
172 | VBoxSelectorWnd &selectorWnd();
|
---|
173 | VBoxConsoleWnd &consoleWnd();
|
---|
174 |
|
---|
175 | bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
|
---|
176 | QUuid managedVMUuid() const { return vmUuid; }
|
---|
177 |
|
---|
178 | VBoxDefs::RenderMode vmRenderMode() const { return vm_render_mode; }
|
---|
179 | const char *vmRenderModeStr() const { return vm_render_mode_str; }
|
---|
180 |
|
---|
181 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
182 | bool isDebuggerEnabled() const { return dbg_enabled; }
|
---|
183 | bool isDebuggerVisibleAtStartup() const { return dbg_visible_at_startup; }
|
---|
184 | #endif
|
---|
185 |
|
---|
186 | /* VBox enum to/from string/icon/color convertors */
|
---|
187 |
|
---|
188 | QStringList vmGuestOSTypeDescriptions() const;
|
---|
189 | CGuestOSType vmGuestOSType (int index) const;
|
---|
190 | int vmGuestOSTypeIndex (const CGuestOSType &type) const;
|
---|
191 | QPixmap vmGuestOSTypeIcon (const QString &type) const;
|
---|
192 |
|
---|
193 | QPixmap toIcon (CEnums::MachineState s) const
|
---|
194 | {
|
---|
195 | QPixmap *pm = mStateIcons [s];
|
---|
196 | AssertMsg (pm, ("Icon for VM state %d must be defined", s));
|
---|
197 | return pm ? *pm : QPixmap();
|
---|
198 | }
|
---|
199 |
|
---|
200 | const QColor &toColor (CEnums::MachineState s) const
|
---|
201 | {
|
---|
202 | static const QColor none;
|
---|
203 | AssertMsg (vm_state_color [s], ("No color for %d", s));
|
---|
204 | return vm_state_color [s] ? *vm_state_color [s] : none;
|
---|
205 | }
|
---|
206 |
|
---|
207 | QString toString (CEnums::MachineState s) const
|
---|
208 | {
|
---|
209 | AssertMsg (!machineStates [s].isNull(), ("No text for %d", s));
|
---|
210 | return machineStates [s];
|
---|
211 | }
|
---|
212 |
|
---|
213 | QString toString (CEnums::SessionState s) const
|
---|
214 | {
|
---|
215 | AssertMsg (!sessionStates [s].isNull(), ("No text for %d", s));
|
---|
216 | return sessionStates [s];
|
---|
217 | }
|
---|
218 |
|
---|
219 | QString toString (CEnums::DiskControllerType t) const
|
---|
220 | {
|
---|
221 | AssertMsg (!diskControllerTypes [t].isNull(), ("No text for %d", t));
|
---|
222 | return diskControllerTypes [t];
|
---|
223 | }
|
---|
224 |
|
---|
225 | QString toString (CEnums::HardDiskType t) const
|
---|
226 | {
|
---|
227 | AssertMsg (!diskTypes [t].isNull(), ("No text for %d", t));
|
---|
228 | return diskTypes [t];
|
---|
229 | }
|
---|
230 |
|
---|
231 | QString toString (CEnums::HardDiskStorageType t) const
|
---|
232 | {
|
---|
233 | AssertMsg (!diskStorageTypes [t].isNull(), ("No text for %d", t));
|
---|
234 | return diskStorageTypes [t];
|
---|
235 | }
|
---|
236 |
|
---|
237 | QString toString (CEnums::VRDPAuthType t) const
|
---|
238 | {
|
---|
239 | AssertMsg (!vrdpAuthTypes [t].isNull(), ("No text for %d", t));
|
---|
240 | return vrdpAuthTypes [t];
|
---|
241 | }
|
---|
242 |
|
---|
243 | QString toString (CEnums::USBDeviceFilterAction t) const
|
---|
244 | {
|
---|
245 | AssertMsg (!usbFilterActionTypes [t].isNull(), ("No text for %d", t));
|
---|
246 | return usbFilterActionTypes [t];
|
---|
247 | }
|
---|
248 |
|
---|
249 | QString toString (CEnums::ClipboardMode t) const
|
---|
250 | {
|
---|
251 | AssertMsg (!clipboardTypes [t].isNull(), ("No text for %d", t));
|
---|
252 | return clipboardTypes [t];
|
---|
253 | }
|
---|
254 |
|
---|
255 | CEnums::ClipboardMode toClipboardModeType (const QString &s) const
|
---|
256 | {
|
---|
257 | QStringVector::const_iterator it =
|
---|
258 | qFind (clipboardTypes.begin(), clipboardTypes.end(), s);
|
---|
259 | AssertMsg (it != clipboardTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
260 | return CEnums::ClipboardMode (it - clipboardTypes.begin());
|
---|
261 | }
|
---|
262 |
|
---|
263 | CEnums::VRDPAuthType toVRDPAuthType (const QString &s) const
|
---|
264 | {
|
---|
265 | QStringVector::const_iterator it =
|
---|
266 | qFind (vrdpAuthTypes.begin(), vrdpAuthTypes.end(), s);
|
---|
267 | AssertMsg (it != vrdpAuthTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
268 | return CEnums::VRDPAuthType (it - vrdpAuthTypes.begin());
|
---|
269 | }
|
---|
270 |
|
---|
271 | CEnums::USBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
|
---|
272 | {
|
---|
273 | QStringVector::const_iterator it =
|
---|
274 | qFind (usbFilterActionTypes.begin(), usbFilterActionTypes.end(), s);
|
---|
275 | AssertMsg (it != usbFilterActionTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
276 | return CEnums::USBDeviceFilterAction (it - usbFilterActionTypes.begin());
|
---|
277 | }
|
---|
278 |
|
---|
279 | /**
|
---|
280 | * Similar to toString (CEnums::HardDiskType), but returns 'Differencing'
|
---|
281 | * for normal hard disks that have a parent hard disk.
|
---|
282 | */
|
---|
283 | QString hardDiskTypeString (const CHardDisk &aHD) const
|
---|
284 | {
|
---|
285 | if (!aHD.GetParent().isNull())
|
---|
286 | {
|
---|
287 | Assert (aHD.GetType() == CEnums::NormalHardDisk);
|
---|
288 | return tr ("Differencing", "hard disk");
|
---|
289 | }
|
---|
290 | return toString (aHD.GetType());
|
---|
291 | }
|
---|
292 |
|
---|
293 | QString toString (CEnums::DiskControllerType t, LONG d) const;
|
---|
294 |
|
---|
295 | QString toString (CEnums::DeviceType t) const
|
---|
296 | {
|
---|
297 | AssertMsg (!deviceTypes [t].isNull(), ("No text for %d", t));
|
---|
298 | return deviceTypes [t];
|
---|
299 | }
|
---|
300 |
|
---|
301 | CEnums::DeviceType toDeviceType (const QString &s) const
|
---|
302 | {
|
---|
303 | QStringVector::const_iterator it =
|
---|
304 | qFind (deviceTypes.begin(), deviceTypes.end(), s);
|
---|
305 | AssertMsg (it != deviceTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
306 | return CEnums::DeviceType (it - deviceTypes.begin());
|
---|
307 | }
|
---|
308 |
|
---|
309 | QStringList deviceTypeStrings() const;
|
---|
310 |
|
---|
311 | QString toString (CEnums::AudioDriverType t) const
|
---|
312 | {
|
---|
313 | AssertMsg (!audioDriverTypes [t].isNull(), ("No text for %d", t));
|
---|
314 | return audioDriverTypes [t];
|
---|
315 | }
|
---|
316 |
|
---|
317 | CEnums::AudioDriverType toAudioDriverType (const QString &s) const
|
---|
318 | {
|
---|
319 | QStringVector::const_iterator it =
|
---|
320 | qFind (audioDriverTypes.begin(), audioDriverTypes.end(), s);
|
---|
321 | AssertMsg (it != audioDriverTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
322 | return CEnums::AudioDriverType (it - audioDriverTypes.begin());
|
---|
323 | }
|
---|
324 |
|
---|
325 | QString toString (CEnums::NetworkAttachmentType t) const
|
---|
326 | {
|
---|
327 | AssertMsg (!networkAttachmentTypes [t].isNull(), ("No text for %d", t));
|
---|
328 | return networkAttachmentTypes [t];
|
---|
329 | }
|
---|
330 |
|
---|
331 | CEnums::NetworkAttachmentType toNetworkAttachmentType (const QString &s) const
|
---|
332 | {
|
---|
333 | QStringVector::const_iterator it =
|
---|
334 | qFind (networkAttachmentTypes.begin(), networkAttachmentTypes.end(), s);
|
---|
335 | AssertMsg (it != networkAttachmentTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
336 | return CEnums::NetworkAttachmentType (it - networkAttachmentTypes.begin());
|
---|
337 | }
|
---|
338 |
|
---|
339 | QString toString (CEnums::USBDeviceState aState) const
|
---|
340 | {
|
---|
341 | AssertMsg (!USBDeviceStates [aState].isNull(), ("No text for %d", aState));
|
---|
342 | return USBDeviceStates [aState];
|
---|
343 | }
|
---|
344 |
|
---|
345 | QPixmap snapshotIcon (bool online) const
|
---|
346 | {
|
---|
347 | return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
|
---|
348 | }
|
---|
349 |
|
---|
350 | /* details generators */
|
---|
351 |
|
---|
352 | QString details (const CHardDisk &aHD, bool aPredict = false);
|
---|
353 |
|
---|
354 | QString details (const CUSBDevice &aDevice) const;
|
---|
355 | QString toolTip (const CUSBDevice &aDevice) const;
|
---|
356 |
|
---|
357 | QString prepareFileNameForHTML (const QString &fn) const;
|
---|
358 |
|
---|
359 | QString detailsReport (const CMachine &m, bool isNewVM, bool withLinks);
|
---|
360 |
|
---|
361 | /* VirtualBox helpers */
|
---|
362 |
|
---|
363 | CSession openSession (const QUuid &id);
|
---|
364 |
|
---|
365 | bool startMachine (const QUuid &id);
|
---|
366 |
|
---|
367 | void startEnumeratingMedia();
|
---|
368 |
|
---|
369 | /**
|
---|
370 | * Returns a list of all currently registered media. This list is used
|
---|
371 | * to globally track the accessiblity state of all media on a dedicated
|
---|
372 | * thread. This the list is initially empty (before the first enumeration
|
---|
373 | * process is started using #startEnumeratingMedia()).
|
---|
374 | */
|
---|
375 | const VBoxMediaList ¤tMediaList() const { return media_list; }
|
---|
376 |
|
---|
377 | /** Returns true if the media enumeration is in progress. */
|
---|
378 | bool isMediaEnumerationStarted() const { return media_enum_thread != NULL; }
|
---|
379 |
|
---|
380 | void addMedia (const VBoxMedia &);
|
---|
381 | void updateMedia (const VBoxMedia &);
|
---|
382 | void removeMedia (VBoxDefs::DiskType, const QUuid &);
|
---|
383 |
|
---|
384 | bool findMedia (const CUnknown &, VBoxMedia &) const;
|
---|
385 |
|
---|
386 | /* various helpers */
|
---|
387 |
|
---|
388 | bool openURL (const QString &aURL);
|
---|
389 |
|
---|
390 | QString languageName() const;
|
---|
391 | QString languageCountry() const;
|
---|
392 | QString languageNameEnglish() const;
|
---|
393 | QString languageCountryEnglish() const;
|
---|
394 | QString languageTranslators() const;
|
---|
395 |
|
---|
396 | void languageChange();
|
---|
397 |
|
---|
398 | /** @internal made public for internal purposes */
|
---|
399 | void cleanup();
|
---|
400 |
|
---|
401 | /* public static stuff */
|
---|
402 |
|
---|
403 | static QString languageId();
|
---|
404 | static void loadLanguage (const QString &aLangId = QString::null);
|
---|
405 |
|
---|
406 | static QIconSet iconSet (const char *aNormal,
|
---|
407 | const char *aDisabled = 0,
|
---|
408 | const char *aActive = 0);
|
---|
409 | static QIconSet iconSetEx (const char *aNormal, const char *aSmallNormal,
|
---|
410 | const char *aDisabled = 0, const char *aSmallDisabled = 0,
|
---|
411 | const char *aActive = 0, const char *aSmallActive = 0);
|
---|
412 |
|
---|
413 | static QRect normalizeGeometry (const QRect &aRect, const QRect &aBoundRect,
|
---|
414 | bool aCanResize = true);
|
---|
415 |
|
---|
416 | static void centerWidget (QWidget *aWidget, QWidget *aRelative,
|
---|
417 | bool aCanResize = true);
|
---|
418 |
|
---|
419 | static QChar decimalSep();
|
---|
420 | static QString sizeRegexp();
|
---|
421 |
|
---|
422 | static Q_UINT64 parseSize (const QString &);
|
---|
423 | static QString formatSize (Q_UINT64, int aMode = 0);
|
---|
424 |
|
---|
425 | static QString highlight (const QString &aStr, bool aToolTip = false);
|
---|
426 |
|
---|
427 | static QString systemLanguageId();
|
---|
428 |
|
---|
429 | static QString getExistingDirectory (const QString &aDir, QWidget *aParent,
|
---|
430 | const char *aName = 0,
|
---|
431 | const QString &aCaption = QString::null,
|
---|
432 | bool aDirOnly = TRUE,
|
---|
433 | bool resolveSymlinks = TRUE);
|
---|
434 |
|
---|
435 | static QString getOpenFileName (const QString &, const QString &, QWidget*,
|
---|
436 | const char*, const QString &,
|
---|
437 | QString *defaultFilter = 0,
|
---|
438 | bool resolveSymLinks = true);
|
---|
439 |
|
---|
440 | static QString getFirstExistingDir (const QString &);
|
---|
441 |
|
---|
442 | signals:
|
---|
443 |
|
---|
444 | /**
|
---|
445 | * Emitted at the beginning of the enumeration process started
|
---|
446 | * by #startEnumeratingMedia().
|
---|
447 | */
|
---|
448 | void mediaEnumStarted();
|
---|
449 |
|
---|
450 | /**
|
---|
451 | * Emitted when a new media item from the list has updated
|
---|
452 | * its accessibility state.
|
---|
453 | */
|
---|
454 | void mediaEnumerated (const VBoxMedia &aMedia, int aIndex);
|
---|
455 |
|
---|
456 | /**
|
---|
457 | * Emitted at the end of the enumeration process started
|
---|
458 | * by #startEnumeratingMedia(). The @a aList argument is passed for
|
---|
459 | * convenience, it is exactly the same as returned by #currentMediaList().
|
---|
460 | */
|
---|
461 | void mediaEnumFinished (const VBoxMediaList &aList);
|
---|
462 |
|
---|
463 | /** Emitted when a new media is added using #addMedia(). */
|
---|
464 | void mediaAdded (const VBoxMedia &);
|
---|
465 |
|
---|
466 | /** Emitted when the media is updated using #updateMedia(). */
|
---|
467 | void mediaUpdated (const VBoxMedia &);
|
---|
468 |
|
---|
469 | /** Emitted when the media is removed using #removeMedia(). */
|
---|
470 | void mediaRemoved (VBoxDefs::DiskType, const QUuid &);
|
---|
471 |
|
---|
472 | /* signals emitted when the VirtualBox callback is called by the server
|
---|
473 | * (not that currently these signals are emitted only when the application
|
---|
474 | * is the in the VM selector mode) */
|
---|
475 |
|
---|
476 | void machineStateChanged (const VBoxMachineStateChangeEvent &e);
|
---|
477 | void machineDataChanged (const VBoxMachineDataChangeEvent &e);
|
---|
478 | void machineRegistered (const VBoxMachineRegisteredEvent &e);
|
---|
479 | void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
|
---|
480 | void snapshotChanged (const VBoxSnapshotEvent &e);
|
---|
481 |
|
---|
482 | protected:
|
---|
483 |
|
---|
484 | bool event (QEvent *e);
|
---|
485 |
|
---|
486 | private:
|
---|
487 |
|
---|
488 | VBoxGlobal();
|
---|
489 | ~VBoxGlobal() {}
|
---|
490 |
|
---|
491 | void init();
|
---|
492 |
|
---|
493 | bool valid;
|
---|
494 |
|
---|
495 | CVirtualBox vbox;
|
---|
496 |
|
---|
497 | VMGlobalSettings gset;
|
---|
498 |
|
---|
499 | VBoxSelectorWnd *selector_wnd;
|
---|
500 | VBoxConsoleWnd *console_wnd;
|
---|
501 |
|
---|
502 | QUuid vmUuid;
|
---|
503 |
|
---|
504 | QThread *media_enum_thread;
|
---|
505 | VBoxMediaList media_list;
|
---|
506 |
|
---|
507 | VBoxDefs::RenderMode vm_render_mode;
|
---|
508 | const char * vm_render_mode_str;
|
---|
509 |
|
---|
510 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
511 | bool dbg_enabled;
|
---|
512 | bool dbg_visible_at_startup;
|
---|
513 | #endif
|
---|
514 |
|
---|
515 | #if defined (Q_WS_WIN32)
|
---|
516 | DWORD dwHTMLHelpCookie;
|
---|
517 | #endif
|
---|
518 |
|
---|
519 | CVirtualBoxCallback callback;
|
---|
520 |
|
---|
521 | typedef QValueVector <QString> QStringVector;
|
---|
522 |
|
---|
523 | QString verString;
|
---|
524 |
|
---|
525 | QValueVector <CGuestOSType> vm_os_types;
|
---|
526 | QDict <QPixmap> vm_os_type_icons;
|
---|
527 | QPtrVector <QColor> vm_state_color;
|
---|
528 |
|
---|
529 | QIntDict <QPixmap> mStateIcons;
|
---|
530 | QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
|
---|
531 |
|
---|
532 | QStringVector machineStates;
|
---|
533 | QStringVector sessionStates;
|
---|
534 | QStringVector deviceTypes;
|
---|
535 | QStringVector diskControllerTypes;
|
---|
536 | QStringVector diskTypes;
|
---|
537 | QStringVector diskStorageTypes;
|
---|
538 | QStringVector vrdpAuthTypes;
|
---|
539 | QStringVector usbFilterActionTypes;
|
---|
540 | QStringVector diskControllerDevices;
|
---|
541 | QStringVector audioDriverTypes;
|
---|
542 | QStringVector networkAttachmentTypes;
|
---|
543 | QStringVector clipboardTypes;
|
---|
544 | QStringVector USBDeviceStates;
|
---|
545 |
|
---|
546 | mutable bool detailReportTemplatesReady;
|
---|
547 |
|
---|
548 | friend VBoxGlobal &vboxGlobal();
|
---|
549 | friend class VBoxCallback;
|
---|
550 | };
|
---|
551 |
|
---|
552 | inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); }
|
---|
553 |
|
---|
554 |
|
---|
555 | /**
|
---|
556 | * USB Popup Menu class.
|
---|
557 | * This class provides the list of USB devices attached to the host.
|
---|
558 | */
|
---|
559 | class VBoxUSBMenu : public QPopupMenu
|
---|
560 | {
|
---|
561 | Q_OBJECT
|
---|
562 |
|
---|
563 | public:
|
---|
564 |
|
---|
565 | enum { USBDevicesMenuNoDevicesId = 1 };
|
---|
566 |
|
---|
567 | VBoxUSBMenu (QWidget *);
|
---|
568 |
|
---|
569 | const CUSBDevice& getUSB (int);
|
---|
570 |
|
---|
571 | void setConsole (const CConsole &);
|
---|
572 |
|
---|
573 | private slots:
|
---|
574 |
|
---|
575 | void processAboutToShow();
|
---|
576 |
|
---|
577 | void processHighlighted (int);
|
---|
578 |
|
---|
579 | private:
|
---|
580 |
|
---|
581 | QMap <int, CUSBDevice> mUSBDevicesMap;
|
---|
582 | CConsole mConsole;
|
---|
583 | };
|
---|
584 |
|
---|
585 |
|
---|
586 | /**
|
---|
587 | * Enable/Disable Menu class.
|
---|
588 | * This class provides enable/disable menu items.
|
---|
589 | */
|
---|
590 | class VBoxSwitchMenu : public QPopupMenu
|
---|
591 | {
|
---|
592 | Q_OBJECT
|
---|
593 |
|
---|
594 | public:
|
---|
595 |
|
---|
596 | VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);
|
---|
597 |
|
---|
598 | void setToolTip (const QString &);
|
---|
599 |
|
---|
600 | private slots:
|
---|
601 |
|
---|
602 | void processAboutToShow();
|
---|
603 |
|
---|
604 | void processActivated (int);
|
---|
605 |
|
---|
606 | private:
|
---|
607 |
|
---|
608 | QAction *mAction;
|
---|
609 | QString mTip;
|
---|
610 | bool mInverted;
|
---|
611 | };
|
---|
612 |
|
---|
613 | #endif /* __VBoxGlobal_h__ */
|
---|