VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h@ 7442

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

Main: Applied SATA changes from #2406. Increased XML settings version format from 1.2 to 1.3.pre.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.2 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxGlobal 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 (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
19#ifndef __VBoxGlobal_h__
20#define __VBoxGlobal_h__
21
22#include "COMDefs.h"
23
24#include "VBoxGlobalSettings.h"
25
26#include <qapplication.h>
27#include <qpixmap.h>
28#include <qicon.h>
29#include <qcolor.h>
30#include <quuid.h>
31#include <qthread.h>
32#include <q3popupmenu.h>
33#include <qtooltip.h>
34
35#include <q3ptrvector.h>
36#include <q3valuevector.h>
37#include <q3valuelist.h>
38#include <q3dict.h>
39#include <q3intdict.h>
40//Added by qt3to4:
41#include <QLabel>
42#include <QEvent>
43
44class QAction;
45class QLabel;
46class QToolButton;
47
48// Auxiliary types
49////////////////////////////////////////////////////////////////////////////////
50
51/** Simple media descriptor type. */
52struct VBoxMedia
53{
54 enum Status { Unknown, Ok, Error, Inaccessible };
55
56 VBoxMedia() : type (VBoxDefs::InvalidType), status (Ok) {}
57
58 VBoxMedia (const CUnknown &d, VBoxDefs::DiskType t, Status s)
59 : disk (d), type (t), status (s) {}
60
61 CUnknown disk;
62 VBoxDefs::DiskType type;
63 Status status;
64};
65
66typedef Q3ValueList <VBoxMedia> VBoxMediaList;
67
68// VirtualBox callback events
69////////////////////////////////////////////////////////////////////////////////
70
71class VBoxMachineStateChangeEvent : public QEvent
72{
73public:
74 VBoxMachineStateChangeEvent (const QUuid &aId, KMachineState aState)
75 : QEvent ((QEvent::Type) VBoxDefs::MachineStateChangeEventType)
76 , id (aId), state (aState)
77 {}
78
79 const QUuid id;
80 const KMachineState state;
81};
82
83class VBoxMachineDataChangeEvent : public QEvent
84{
85public:
86 VBoxMachineDataChangeEvent (const QUuid &aId)
87 : QEvent ((QEvent::Type) VBoxDefs::MachineDataChangeEventType)
88 , id (aId)
89 {}
90
91 const QUuid id;
92};
93
94class VBoxMachineRegisteredEvent : public QEvent
95{
96public:
97 VBoxMachineRegisteredEvent (const QUuid &aId, bool aRegistered)
98 : QEvent ((QEvent::Type) VBoxDefs::MachineRegisteredEventType)
99 , id (aId), registered (aRegistered)
100 {}
101
102 const QUuid id;
103 const bool registered;
104};
105
106class VBoxSessionStateChangeEvent : public QEvent
107{
108public:
109 VBoxSessionStateChangeEvent (const QUuid &aId, KSessionState aState)
110 : QEvent ((QEvent::Type) VBoxDefs::SessionStateChangeEventType)
111 , id (aId), state (aState)
112 {}
113
114 const QUuid id;
115 const KSessionState state;
116};
117
118class VBoxSnapshotEvent : public QEvent
119{
120public:
121
122 enum What { Taken, Discarded, Changed };
123
124 VBoxSnapshotEvent (const QUuid &aMachineId, const QUuid &aSnapshotId,
125 What aWhat)
126 : QEvent ((QEvent::Type) VBoxDefs::SnapshotEventType)
127 , what (aWhat)
128 , machineId (aMachineId), snapshotId (aSnapshotId)
129 {}
130
131 const What what;
132
133 const QUuid machineId;
134 const QUuid snapshotId;
135};
136
137class VBoxCanShowRegDlgEvent : public QEvent
138{
139public:
140 VBoxCanShowRegDlgEvent (bool aCanShow)
141 : QEvent ((QEvent::Type) VBoxDefs::CanShowRegDlgEventType)
142 , mCanShow (aCanShow)
143 {}
144
145 const bool mCanShow;
146};
147
148// VBoxGlobal
149////////////////////////////////////////////////////////////////////////////////
150
151class VBoxSelectorWnd;
152class VBoxConsoleWnd;
153class VBoxRegistrationDlg;
154
155class VBoxGlobal : public QObject
156{
157 Q_OBJECT
158
159public:
160
161 static VBoxGlobal &instance();
162
163 bool isValid() { return mValid; }
164
165 QString versionString() { return verString; }
166
167 CVirtualBox virtualBox() const { return mVBox; }
168
169 const VBoxGlobalSettings &settings() const { return gset; }
170 bool setSettings (const VBoxGlobalSettings &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 aIndex) const;
190 int vmGuestOSTypeIndex (const QString &aId) const;
191 QPixmap vmGuestOSTypeIcon (const QString &aId) const;
192 QString vmGuestOSTypeDescription (const QString &aId) const;
193
194 QPixmap toIcon (KMachineState s) const
195 {
196 QPixmap *pm = mStateIcons [s];
197 AssertMsg (pm, ("Icon for VM state %d must be defined", s));
198 return pm ? *pm : QPixmap();
199 }
200
201 const QColor &toColor (KMachineState s) const
202 {
203 static const QColor none;
204 AssertMsg (vm_state_color [s], ("No color for %d", s));
205 return vm_state_color [s] ? *vm_state_color [s] : none;
206 }
207
208 QString toString (KMachineState s) const
209 {
210 AssertMsg (!machineStates [s].isNull(), ("No text for %d", s));
211 return machineStates [s];
212 }
213
214 QString toString (KSessionState s) const
215 {
216 AssertMsg (!sessionStates [s].isNull(), ("No text for %d", s));
217 return sessionStates [s];
218 }
219
220 QString toString (KStorageBus t) const
221 {
222 AssertMsg (!storageBuses [t].isNull(), ("No text for %d", t));
223 return storageBuses [t];
224 }
225
226 QString toString (KStorageBus t, LONG c) const;
227 QString toString (KStorageBus t, LONG c, LONG d) const;
228
229 QString toString (KHardDiskType t) const
230 {
231 AssertMsg (!diskTypes [t].isNull(), ("No text for %d", t));
232 return diskTypes [t];
233 }
234
235 QString toString (KHardDiskStorageType t) const
236 {
237 AssertMsg (!diskStorageTypes [t].isNull(), ("No text for %d", t));
238 return diskStorageTypes [t];
239 }
240
241 QString toString (KVRDPAuthType t) const
242 {
243 AssertMsg (!vrdpAuthTypes [t].isNull(), ("No text for %d", t));
244 return vrdpAuthTypes [t];
245 }
246
247 QString toString (KPortMode t) const
248 {
249 AssertMsg (!portModeTypes [t].isNull(), ("No text for %d", t));
250 return portModeTypes [t];
251 }
252
253 QString toString (KUSBDeviceFilterAction t) const
254 {
255 AssertMsg (!usbFilterActionTypes [t].isNull(), ("No text for %d", t));
256 return usbFilterActionTypes [t];
257 }
258
259 QString toString (KClipboardMode t) const
260 {
261 AssertMsg (!clipboardTypes [t].isNull(), ("No text for %d", t));
262 return clipboardTypes [t];
263 }
264
265 KClipboardMode toClipboardModeType (const QString &s) const
266 {
267 QStringVector::const_iterator it =
268 qFind (clipboardTypes.begin(), clipboardTypes.end(), s);
269 AssertMsg (it != clipboardTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
270 return KClipboardMode (it - clipboardTypes.begin());
271 }
272
273 QString toString (KIDEControllerType t) const
274 {
275 AssertMsg (!ideControllerTypes [t].isNull(), ("No text for %d", t));
276 return ideControllerTypes [t];
277 }
278
279 KIDEControllerType toIDEControllerType (const QString &s) const
280 {
281 QStringVector::const_iterator it =
282 qFind (ideControllerTypes.begin(), ideControllerTypes.end(), s);
283 AssertMsg (it != ideControllerTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
284 return KIDEControllerType (it - ideControllerTypes.begin());
285 }
286
287 KVRDPAuthType toVRDPAuthType (const QString &s) const
288 {
289 QStringVector::const_iterator it =
290 qFind (vrdpAuthTypes.begin(), vrdpAuthTypes.end(), s);
291 AssertMsg (it != vrdpAuthTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
292 return KVRDPAuthType (it - vrdpAuthTypes.begin());
293 }
294
295 KPortMode toPortMode (const QString &s) const
296 {
297 QStringVector::const_iterator it =
298 qFind (portModeTypes.begin(), portModeTypes.end(), s);
299 AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
300 return KPortMode (it - portModeTypes.begin());
301 }
302
303 KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
304 {
305 QStringVector::const_iterator it =
306 qFind (usbFilterActionTypes.begin(), usbFilterActionTypes.end(), s);
307 AssertMsg (it != usbFilterActionTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
308 return KUSBDeviceFilterAction (it - usbFilterActionTypes.begin());
309 }
310
311 /**
312 * Similar to toString (KHardDiskType), but returns 'Differencing'
313 * for normal hard disks that have a parent hard disk.
314 */
315 QString hardDiskTypeString (const CHardDisk &aHD) const
316 {
317 if (!aHD.GetParent().isNull())
318 {
319 Assert (aHD.GetType() == KHardDiskType_Normal);
320 return tr ("Differencing", "hard disk");
321 }
322 return toString (aHD.GetType());
323 }
324
325 QString toString (KDeviceType t) const
326 {
327 AssertMsg (!deviceTypes [t].isNull(), ("No text for %d", t));
328 return deviceTypes [t];
329 }
330
331 KDeviceType toDeviceType (const QString &s) const
332 {
333 QStringVector::const_iterator it =
334 qFind (deviceTypes.begin(), deviceTypes.end(), s);
335 AssertMsg (it != deviceTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
336 return KDeviceType (it - deviceTypes.begin());
337 }
338
339 QStringList deviceTypeStrings() const;
340
341 QString toString (KAudioDriverType t) const
342 {
343 AssertMsg (!audioDriverTypes [t].isNull(), ("No text for %d", t));
344 return audioDriverTypes [t];
345 }
346
347 KAudioDriverType toAudioDriverType (const QString &s) const
348 {
349 QStringVector::const_iterator it =
350 qFind (audioDriverTypes.begin(), audioDriverTypes.end(), s);
351 AssertMsg (it != audioDriverTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
352 return KAudioDriverType (it - audioDriverTypes.begin());
353 }
354
355 QString toString (KAudioControllerType t) const
356 {
357 AssertMsg (!audioControllerTypes [t].isNull(), ("No text for %d", t));
358 return audioControllerTypes [t];
359 }
360
361 KAudioControllerType toAudioControllerType (const QString &s) const
362 {
363 QStringVector::const_iterator it =
364 qFind (audioControllerTypes.begin(), audioControllerTypes.end(), s);
365 AssertMsg (it != audioControllerTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
366 return KAudioControllerType (it - audioControllerTypes.begin());
367 }
368
369 QString toString (KNetworkAdapterType t) const
370 {
371 AssertMsg (!networkAdapterTypes [t].isNull(), ("No text for %d", t));
372 return networkAdapterTypes [t];
373 }
374
375 KNetworkAdapterType toNetworkAdapterType (const QString &s) const
376 {
377 QStringVector::const_iterator it =
378 qFind (networkAdapterTypes.begin(), networkAdapterTypes.end(), s);
379 AssertMsg (it != networkAdapterTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
380 return KNetworkAdapterType (it - networkAdapterTypes.begin());
381 }
382
383 QString toString (KNetworkAttachmentType t) const
384 {
385 AssertMsg (!networkAttachmentTypes [t].isNull(), ("No text for %d", t));
386 return networkAttachmentTypes [t];
387 }
388
389 KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
390 {
391 QStringVector::const_iterator it =
392 qFind (networkAttachmentTypes.begin(), networkAttachmentTypes.end(), s);
393 AssertMsg (it != networkAttachmentTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
394 return KNetworkAttachmentType (it - networkAttachmentTypes.begin());
395 }
396
397 QString toString (KUSBDeviceState aState) const
398 {
399 AssertMsg (!USBDeviceStates [aState].isNull(), ("No text for %d", aState));
400 return USBDeviceStates [aState];
401 }
402
403 QStringList COMPortNames() const;
404 QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;
405 bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
406
407 QStringList LPTPortNames() const;
408 QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
409 bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
410
411 QPixmap snapshotIcon (bool online) const
412 {
413 return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
414 }
415
416 /* details generators */
417
418 QString details (const CHardDisk &aHD, bool aPredict = false,
419 bool aDoRefresh = true);
420
421 QString details (const CUSBDevice &aDevice) const;
422 QString toolTip (const CUSBDevice &aDevice) const;
423
424 QString prepareFileNameForHTML (const QString &fn) const;
425
426 QString detailsReport (const CMachine &m, bool isNewVM, bool withLinks,
427 bool aDoRefresh = true);
428
429 /* VirtualBox helpers */
430
431#ifdef Q_WS_X11
432 bool showVirtualBoxLicense();
433#endif
434
435 void checkForAutoConvertedSettings();
436
437 CSession openSession (const QUuid &aId, bool aExisting = false);
438
439 /** Shortcut to openSession (aId, true). */
440 CSession openExistingSession (const QUuid &aId) { return openSession (aId, true); }
441
442 bool startMachine (const QUuid &id);
443
444 void startEnumeratingMedia();
445
446 /**
447 * Returns a list of all currently registered media. This list is used
448 * to globally track the accessiblity state of all media on a dedicated
449 * thread. This the list is initially empty (before the first enumeration
450 * process is started using #startEnumeratingMedia()).
451 */
452 const VBoxMediaList &currentMediaList() const { return media_list; }
453
454 /** Returns true if the media enumeration is in progress. */
455 bool isMediaEnumerationStarted() const { return media_enum_thread != NULL; }
456
457 void addMedia (const VBoxMedia &);
458 void updateMedia (const VBoxMedia &);
459 void removeMedia (VBoxDefs::DiskType, const QUuid &);
460
461 bool findMedia (const CUnknown &, VBoxMedia &) const;
462
463 /* various helpers */
464
465 QString languageName() const;
466 QString languageCountry() const;
467 QString languageNameEnglish() const;
468 QString languageCountryEnglish() const;
469 QString languageTranslators() const;
470
471 void languageChange();
472
473 /** @internal made public for internal purposes */
474 void cleanup();
475
476 /* public static stuff */
477
478 static bool isDOSType (const QString &aOSTypeId);
479
480 static void adoptLabelPixmap (QLabel *);
481
482 static QString languageId();
483 static void loadLanguage (const QString &aLangId = QString::null);
484
485 static QIcon iconSet (const char *aNormal,
486 const char *aDisabled = NULL,
487 const char *aActive = NULL);
488 static QIcon iconSetEx (const char *aNormal, const char *aSmallNormal,
489 const char *aDisabled = NULL,
490 const char *aSmallDisabled = NULL,
491 const char *aActive = NULL,
492 const char *aSmallActive = NULL);
493
494 static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel);
495
496 static QRect normalizeGeometry (const QRect &aRect, const QRect &aBoundRect,
497 bool aCanResize = true);
498
499 static void centerWidget (QWidget *aWidget, QWidget *aRelative,
500 bool aCanResize = true);
501
502 static QChar decimalSep();
503 static QString sizeRegexp();
504
505 static Q_UINT64 parseSize (const QString &);
506 static QString formatSize (Q_UINT64, int aMode = 0);
507
508 static QString highlight (const QString &aStr, bool aToolTip = false);
509
510 static QString systemLanguageId();
511
512 static QString getExistingDirectory (const QString &aDir, QWidget *aParent,
513 const char *aName = 0,
514 const QString &aCaption = QString::null,
515 bool aDirOnly = TRUE,
516 bool resolveSymlinks = TRUE);
517
518 static QString getOpenFileName (const QString &, const QString &, QWidget*,
519 const char*, const QString &,
520 QString *defaultFilter = 0,
521 bool resolveSymLinks = true);
522
523 static QString getFirstExistingDir (const QString &);
524
525 static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
526
527 static QString removeAccelMark (const QString &aText);
528
529 static QWidget *findWidget (QWidget *aParent, const char *aName,
530 const char *aClassName = NULL,
531 bool aRecursive = false);
532
533signals:
534
535 /**
536 * Emitted at the beginning of the enumeration process started
537 * by #startEnumeratingMedia().
538 */
539 void mediaEnumStarted();
540
541 /**
542 * Emitted when a new media item from the list has updated
543 * its accessibility state.
544 */
545 void mediaEnumerated (const VBoxMedia &aMedia, int aIndex);
546
547 /**
548 * Emitted at the end of the enumeration process started
549 * by #startEnumeratingMedia(). The @a aList argument is passed for
550 * convenience, it is exactly the same as returned by #currentMediaList().
551 */
552 void mediaEnumFinished (const VBoxMediaList &aList);
553
554 /** Emitted when a new media is added using #addMedia(). */
555 void mediaAdded (const VBoxMedia &);
556
557 /** Emitted when the media is updated using #updateMedia(). */
558 void mediaUpdated (const VBoxMedia &);
559
560 /** Emitted when the media is removed using #removeMedia(). */
561 void mediaRemoved (VBoxDefs::DiskType, const QUuid &);
562
563 /* signals emitted when the VirtualBox callback is called by the server
564 * (not that currently these signals are emitted only when the application
565 * is the in the VM selector mode) */
566
567 void machineStateChanged (const VBoxMachineStateChangeEvent &e);
568 void machineDataChanged (const VBoxMachineDataChangeEvent &e);
569 void machineRegistered (const VBoxMachineRegisteredEvent &e);
570 void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
571 void snapshotChanged (const VBoxSnapshotEvent &e);
572
573 void canShowRegDlg (bool aCanShow);
574
575public slots:
576
577 bool openURL (const QString &aURL);
578
579 void showRegistrationDialog (bool aForce = true);
580
581protected:
582
583 bool event (QEvent *e);
584 bool eventFilter (QObject *, QEvent *);
585
586private:
587
588 VBoxGlobal();
589 ~VBoxGlobal() {}
590
591 void init();
592
593 bool mValid;
594
595 CVirtualBox mVBox;
596
597 VBoxGlobalSettings gset;
598
599 VBoxSelectorWnd *mSelectorWnd;
600 VBoxConsoleWnd *mConsoleWnd;
601
602#ifdef VBOX_WITH_REGISTRATION
603 VBoxRegistrationDlg *mRegDlg;
604#endif
605
606 QUuid vmUuid;
607
608 QThread *media_enum_thread;
609 VBoxMediaList media_list;
610
611 VBoxDefs::RenderMode vm_render_mode;
612 const char * vm_render_mode_str;
613
614#ifdef VBOX_WITH_DEBUGGER_GUI
615 bool dbg_enabled;
616 bool dbg_visible_at_startup;
617#endif
618
619#if defined (Q_WS_WIN32)
620 DWORD dwHTMLHelpCookie;
621#endif
622
623 CVirtualBoxCallback callback;
624
625 typedef Q3ValueVector <QString> QStringVector;
626
627 QString verString;
628
629 Q3ValueVector <CGuestOSType> vm_os_types;
630 Q3Dict <QPixmap> vm_os_type_icons;
631 Q3PtrVector <QColor> vm_state_color;
632
633 Q3IntDict <QPixmap> mStateIcons;
634 QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
635
636 QStringVector machineStates;
637 QStringVector sessionStates;
638 QStringVector deviceTypes;
639 QStringVector storageBuses;
640 QStringVector storageBusDevices;
641 QStringVector storageBusChannels;
642 QStringVector diskTypes;
643 QStringVector diskStorageTypes;
644 QStringVector vrdpAuthTypes;
645 QStringVector portModeTypes;
646 QStringVector usbFilterActionTypes;
647 QStringVector audioDriverTypes;
648 QStringVector audioControllerTypes;
649 QStringVector networkAdapterTypes;
650 QStringVector networkAttachmentTypes;
651 QStringVector clipboardTypes;
652 QStringVector ideControllerTypes;
653 QStringVector USBDeviceStates;
654
655 QString mUserDefinedPortName;
656
657 mutable bool detailReportTemplatesReady;
658
659 friend VBoxGlobal &vboxGlobal();
660 friend class VBoxCallback;
661};
662
663inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); }
664
665// Helper classes
666////////////////////////////////////////////////////////////////////////////////
667
668/**
669 * Generic asyncronous event.
670 *
671 * This abstract class is intended to provide a conveinent way to execute
672 * code on the main GUI thread asynchronously to the calling party. This is
673 * done by putting necessary actions to the #handle() function in a subclass
674 * and then posting an instance of the subclass using #post(). The instance
675 * must be allocated on the heap using the <tt>new</tt> operation and will be
676 * automatically deleted after processing. Note that if you don't call #post()
677 * on the created instance, you have to delete it yourself.
678 */
679class VBoxAsyncEvent : public QEvent
680{
681public:
682
683 VBoxAsyncEvent() : QEvent ((QEvent::Type) VBoxDefs::AsyncEventType) {}
684
685 /**
686 * Worker function. Gets executed on the GUI thread when the posted event
687 * is processed by the main event loop.
688 */
689 virtual void handle() = 0;
690
691 /**
692 * Posts this event to the main event loop.
693 * The caller loses ownership of this object after this method returns
694 * and must not delete the object.
695 */
696 void post()
697 {
698 QApplication::postEvent (&vboxGlobal(), this);
699 }
700};
701
702/**
703 * USB Popup Menu class.
704 * This class provides the list of USB devices attached to the host.
705 */
706class VBoxUSBMenu : public Q3PopupMenu
707{
708 Q_OBJECT
709
710public:
711
712 enum { USBDevicesMenuNoDevicesId = 1 };
713
714 VBoxUSBMenu (QWidget *);
715
716 const CUSBDevice& getUSB (int);
717
718 void setConsole (const CConsole &);
719
720private slots:
721
722 void processAboutToShow();
723
724 void processHighlighted (int);
725
726private:
727
728 QMap <int, CUSBDevice> mUSBDevicesMap;
729 CConsole mConsole;
730};
731
732
733/**
734 * Enable/Disable Menu class.
735 * This class provides enable/disable menu items.
736 */
737class VBoxSwitchMenu : public QMenu
738{
739 Q_OBJECT
740
741public:
742
743 VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);
744
745 void setToolTip (const QString &);
746
747private slots:
748
749 void processAboutToShow();
750
751private:
752
753 QAction *mAction;
754 bool mInverted;
755};
756
757#endif /* __VBoxGlobal_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