VirtualBox

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

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

FE/Qt: Added support for user notification about settings file auto-conversion (#2705).

  • 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 (KDiskControllerType t) const
221 {
222 AssertMsg (!diskControllerTypes [t].isNull(), ("No text for %d", t));
223 return diskControllerTypes [t];
224 }
225
226 QString toString (KHardDiskType t) const
227 {
228 AssertMsg (!diskTypes [t].isNull(), ("No text for %d", t));
229 return diskTypes [t];
230 }
231
232 QString toString (KHardDiskStorageType t) const
233 {
234 AssertMsg (!diskStorageTypes [t].isNull(), ("No text for %d", t));
235 return diskStorageTypes [t];
236 }
237
238 QString toString (KVRDPAuthType t) const
239 {
240 AssertMsg (!vrdpAuthTypes [t].isNull(), ("No text for %d", t));
241 return vrdpAuthTypes [t];
242 }
243
244 QString toString (KPortMode t) const
245 {
246 AssertMsg (!portModeTypes [t].isNull(), ("No text for %d", t));
247 return portModeTypes [t];
248 }
249
250 QString toString (KUSBDeviceFilterAction t) const
251 {
252 AssertMsg (!usbFilterActionTypes [t].isNull(), ("No text for %d", t));
253 return usbFilterActionTypes [t];
254 }
255
256 QString toString (KClipboardMode t) const
257 {
258 AssertMsg (!clipboardTypes [t].isNull(), ("No text for %d", t));
259 return clipboardTypes [t];
260 }
261
262 KClipboardMode toClipboardModeType (const QString &s) const
263 {
264 QStringVector::const_iterator it =
265 qFind (clipboardTypes.begin(), clipboardTypes.end(), s);
266 AssertMsg (it != clipboardTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
267 return KClipboardMode (it - clipboardTypes.begin());
268 }
269
270 QString toString (KIDEControllerType t) const
271 {
272 AssertMsg (!ideControllerTypes [t].isNull(), ("No text for %d", t));
273 return ideControllerTypes [t];
274 }
275
276 KIDEControllerType toIDEControllerType (const QString &s) const
277 {
278 QStringVector::const_iterator it =
279 qFind (ideControllerTypes.begin(), ideControllerTypes.end(), s);
280 AssertMsg (it != ideControllerTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
281 return KIDEControllerType (it - ideControllerTypes.begin());
282 }
283
284 KVRDPAuthType toVRDPAuthType (const QString &s) const
285 {
286 QStringVector::const_iterator it =
287 qFind (vrdpAuthTypes.begin(), vrdpAuthTypes.end(), s);
288 AssertMsg (it != vrdpAuthTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
289 return KVRDPAuthType (it - vrdpAuthTypes.begin());
290 }
291
292 KPortMode toPortMode (const QString &s) const
293 {
294 QStringVector::const_iterator it =
295 qFind (portModeTypes.begin(), portModeTypes.end(), s);
296 AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
297 return KPortMode (it - portModeTypes.begin());
298 }
299
300 KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
301 {
302 QStringVector::const_iterator it =
303 qFind (usbFilterActionTypes.begin(), usbFilterActionTypes.end(), s);
304 AssertMsg (it != usbFilterActionTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
305 return KUSBDeviceFilterAction (it - usbFilterActionTypes.begin());
306 }
307
308 /**
309 * Similar to toString (KHardDiskType), but returns 'Differencing'
310 * for normal hard disks that have a parent hard disk.
311 */
312 QString hardDiskTypeString (const CHardDisk &aHD) const
313 {
314 if (!aHD.GetParent().isNull())
315 {
316 Assert (aHD.GetType() == KHardDiskType_Normal);
317 return tr ("Differencing", "hard disk");
318 }
319 return toString (aHD.GetType());
320 }
321
322 QString toString (KDiskControllerType t, LONG d) const;
323
324 QString toString (KDeviceType t) const
325 {
326 AssertMsg (!deviceTypes [t].isNull(), ("No text for %d", t));
327 return deviceTypes [t];
328 }
329
330 KDeviceType toDeviceType (const QString &s) const
331 {
332 QStringVector::const_iterator it =
333 qFind (deviceTypes.begin(), deviceTypes.end(), s);
334 AssertMsg (it != deviceTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
335 return KDeviceType (it - deviceTypes.begin());
336 }
337
338 QStringList deviceTypeStrings() const;
339
340 QString toString (KAudioDriverType t) const
341 {
342 AssertMsg (!audioDriverTypes [t].isNull(), ("No text for %d", t));
343 return audioDriverTypes [t];
344 }
345
346 KAudioDriverType toAudioDriverType (const QString &s) const
347 {
348 QStringVector::const_iterator it =
349 qFind (audioDriverTypes.begin(), audioDriverTypes.end(), s);
350 AssertMsg (it != audioDriverTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
351 return KAudioDriverType (it - audioDriverTypes.begin());
352 }
353
354 QString toString (KAudioControllerType t) const
355 {
356 AssertMsg (!audioControllerTypes [t].isNull(), ("No text for %d", t));
357 return audioControllerTypes [t];
358 }
359
360 KAudioControllerType toAudioControllerType (const QString &s) const
361 {
362 QStringVector::const_iterator it =
363 qFind (audioControllerTypes.begin(), audioControllerTypes.end(), s);
364 AssertMsg (it != audioControllerTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
365 return KAudioControllerType (it - audioControllerTypes.begin());
366 }
367
368 QString toString (KNetworkAdapterType t) const
369 {
370 AssertMsg (!networkAdapterTypes [t].isNull(), ("No text for %d", t));
371 return networkAdapterTypes [t];
372 }
373
374 KNetworkAdapterType toNetworkAdapterType (const QString &s) const
375 {
376 QStringVector::const_iterator it =
377 qFind (networkAdapterTypes.begin(), networkAdapterTypes.end(), s);
378 AssertMsg (it != networkAdapterTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
379 return KNetworkAdapterType (it - networkAdapterTypes.begin());
380 }
381
382 QString toString (KNetworkAttachmentType t) const
383 {
384 AssertMsg (!networkAttachmentTypes [t].isNull(), ("No text for %d", t));
385 return networkAttachmentTypes [t];
386 }
387
388 KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
389 {
390 QStringVector::const_iterator it =
391 qFind (networkAttachmentTypes.begin(), networkAttachmentTypes.end(), s);
392 AssertMsg (it != networkAttachmentTypes.end(), ("No value for {%s}", s.toLatin1().constData()));
393 return KNetworkAttachmentType (it - networkAttachmentTypes.begin());
394 }
395
396 QString toString (KUSBDeviceState aState) const
397 {
398 AssertMsg (!USBDeviceStates [aState].isNull(), ("No text for %d", aState));
399 return USBDeviceStates [aState];
400 }
401
402 QStringList COMPortNames() const;
403 QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;
404 bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
405
406 QStringList LPTPortNames() const;
407 QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
408 bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
409
410 QPixmap snapshotIcon (bool online) const
411 {
412 return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
413 }
414
415 /* details generators */
416
417 QString details (const CHardDisk &aHD, bool aPredict = false,
418 bool aDoRefresh = true);
419
420 QString details (const CUSBDevice &aDevice) const;
421 QString toolTip (const CUSBDevice &aDevice) const;
422
423 QString prepareFileNameForHTML (const QString &fn) const;
424
425 QString detailsReport (const CMachine &m, bool isNewVM, bool withLinks,
426 bool aDoRefresh = true);
427
428 /* VirtualBox helpers */
429
430#ifdef Q_WS_X11
431 bool showVirtualBoxLicense();
432#endif
433
434 void checkForAutoConvertedSettings();
435
436 CSession openSession (const QUuid &aId, bool aExisting = false);
437
438 /** Shortcut to openSession (aId, true). */
439 CSession openExistingSession (const QUuid &aId) { return openSession (aId, true); }
440
441 bool startMachine (const QUuid &id);
442
443 void startEnumeratingMedia();
444
445 /**
446 * Returns a list of all currently registered media. This list is used
447 * to globally track the accessiblity state of all media on a dedicated
448 * thread. This the list is initially empty (before the first enumeration
449 * process is started using #startEnumeratingMedia()).
450 */
451 const VBoxMediaList &currentMediaList() const { return media_list; }
452
453 /** Returns true if the media enumeration is in progress. */
454 bool isMediaEnumerationStarted() const { return media_enum_thread != NULL; }
455
456 void addMedia (const VBoxMedia &);
457 void updateMedia (const VBoxMedia &);
458 void removeMedia (VBoxDefs::DiskType, const QUuid &);
459
460 bool findMedia (const CUnknown &, VBoxMedia &) const;
461
462 /* various helpers */
463
464 QString languageName() const;
465 QString languageCountry() const;
466 QString languageNameEnglish() const;
467 QString languageCountryEnglish() const;
468 QString languageTranslators() const;
469
470 void languageChange();
471
472 /** @internal made public for internal purposes */
473 void cleanup();
474
475 /* public static stuff */
476
477 static bool isDOSType (const QString &aOSTypeId);
478
479 static void adoptLabelPixmap (QLabel *);
480
481 static QString languageId();
482 static void loadLanguage (const QString &aLangId = QString::null);
483
484 static QIcon iconSet (const char *aNormal,
485 const char *aDisabled = NULL,
486 const char *aActive = NULL);
487 static QIcon iconSetEx (const char *aNormal, const char *aSmallNormal,
488 const char *aDisabled = NULL,
489 const char *aSmallDisabled = NULL,
490 const char *aActive = NULL,
491 const char *aSmallActive = NULL);
492
493 static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel);
494
495 static QRect normalizeGeometry (const QRect &aRect, const QRect &aBoundRect,
496 bool aCanResize = true);
497
498 static void centerWidget (QWidget *aWidget, QWidget *aRelative,
499 bool aCanResize = true);
500
501 static QChar decimalSep();
502 static QString sizeRegexp();
503
504 static Q_UINT64 parseSize (const QString &);
505 static QString formatSize (Q_UINT64, int aMode = 0);
506
507 static QString highlight (const QString &aStr, bool aToolTip = false);
508
509 static QString systemLanguageId();
510
511 static QString getExistingDirectory (const QString &aDir, QWidget *aParent,
512 const char *aName = 0,
513 const QString &aCaption = QString::null,
514 bool aDirOnly = TRUE,
515 bool resolveSymlinks = TRUE);
516
517 static QString getOpenFileName (const QString &, const QString &, QWidget*,
518 const char*, const QString &,
519 QString *defaultFilter = 0,
520 bool resolveSymLinks = true);
521
522 static QString getFirstExistingDir (const QString &);
523
524 static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
525
526 static QString removeAccelMark (const QString &aText);
527
528 static QWidget *findWidget (QWidget *aParent, const char *aName,
529 const char *aClassName = NULL,
530 bool aRecursive = false);
531
532signals:
533
534 /**
535 * Emitted at the beginning of the enumeration process started
536 * by #startEnumeratingMedia().
537 */
538 void mediaEnumStarted();
539
540 /**
541 * Emitted when a new media item from the list has updated
542 * its accessibility state.
543 */
544 void mediaEnumerated (const VBoxMedia &aMedia, int aIndex);
545
546 /**
547 * Emitted at the end of the enumeration process started
548 * by #startEnumeratingMedia(). The @a aList argument is passed for
549 * convenience, it is exactly the same as returned by #currentMediaList().
550 */
551 void mediaEnumFinished (const VBoxMediaList &aList);
552
553 /** Emitted when a new media is added using #addMedia(). */
554 void mediaAdded (const VBoxMedia &);
555
556 /** Emitted when the media is updated using #updateMedia(). */
557 void mediaUpdated (const VBoxMedia &);
558
559 /** Emitted when the media is removed using #removeMedia(). */
560 void mediaRemoved (VBoxDefs::DiskType, const QUuid &);
561
562 /* signals emitted when the VirtualBox callback is called by the server
563 * (not that currently these signals are emitted only when the application
564 * is the in the VM selector mode) */
565
566 void machineStateChanged (const VBoxMachineStateChangeEvent &e);
567 void machineDataChanged (const VBoxMachineDataChangeEvent &e);
568 void machineRegistered (const VBoxMachineRegisteredEvent &e);
569 void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
570 void snapshotChanged (const VBoxSnapshotEvent &e);
571
572 void canShowRegDlg (bool aCanShow);
573
574public slots:
575
576 bool openURL (const QString &aURL);
577
578 void showRegistrationDialog (bool aForce = true);
579
580protected:
581
582 bool event (QEvent *e);
583 bool eventFilter (QObject *, QEvent *);
584
585private:
586
587 VBoxGlobal();
588 ~VBoxGlobal() {}
589
590 void init();
591
592 bool mValid;
593
594 CVirtualBox mVBox;
595
596 VBoxGlobalSettings gset;
597
598 VBoxSelectorWnd *mSelectorWnd;
599 VBoxConsoleWnd *mConsoleWnd;
600
601#ifdef VBOX_WITH_REGISTRATION
602 VBoxRegistrationDlg *mRegDlg;
603#endif
604
605 QUuid vmUuid;
606
607 QThread *media_enum_thread;
608 VBoxMediaList media_list;
609
610 VBoxDefs::RenderMode vm_render_mode;
611 const char * vm_render_mode_str;
612
613#ifdef VBOX_WITH_DEBUGGER_GUI
614 bool dbg_enabled;
615 bool dbg_visible_at_startup;
616#endif
617
618#if defined (Q_WS_WIN32)
619 DWORD dwHTMLHelpCookie;
620#endif
621
622 CVirtualBoxCallback callback;
623
624 typedef Q3ValueVector <QString> QStringVector;
625
626 QString verString;
627
628 Q3ValueVector <CGuestOSType> vm_os_types;
629 Q3Dict <QPixmap> vm_os_type_icons;
630 Q3PtrVector <QColor> vm_state_color;
631
632 Q3IntDict <QPixmap> mStateIcons;
633 QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
634
635 QStringVector machineStates;
636 QStringVector sessionStates;
637 QStringVector deviceTypes;
638 QStringVector diskControllerTypes;
639 QStringVector diskTypes;
640 QStringVector diskStorageTypes;
641 QStringVector vrdpAuthTypes;
642 QStringVector portModeTypes;
643 QStringVector usbFilterActionTypes;
644 QStringVector diskControllerDevices;
645 QStringVector audioDriverTypes;
646 QStringVector audioControllerTypes;
647 QStringVector networkAdapterTypes;
648 QStringVector networkAttachmentTypes;
649 QStringVector clipboardTypes;
650 QStringVector ideControllerTypes;
651 QStringVector USBDeviceStates;
652
653 QString mUserDefinedPortName;
654
655 mutable bool detailReportTemplatesReady;
656
657 friend VBoxGlobal &vboxGlobal();
658 friend class VBoxCallback;
659};
660
661inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); }
662
663// Helper classes
664////////////////////////////////////////////////////////////////////////////////
665
666/**
667 * Generic asyncronous event.
668 *
669 * This abstract class is intended to provide a conveinent way to execute
670 * code on the main GUI thread asynchronously to the calling party. This is
671 * done by putting necessary actions to the #handle() function in a subclass
672 * and then posting an instance of the subclass using #post(). The instance
673 * must be allocated on the heap using the <tt>new</tt> operation and will be
674 * automatically deleted after processing. Note that if you don't call #post()
675 * on the created instance, you have to delete it yourself.
676 */
677class VBoxAsyncEvent : public QEvent
678{
679public:
680
681 VBoxAsyncEvent() : QEvent ((QEvent::Type) VBoxDefs::AsyncEventType) {}
682
683 /**
684 * Worker function. Gets executed on the GUI thread when the posted event
685 * is processed by the main event loop.
686 */
687 virtual void handle() = 0;
688
689 /**
690 * Posts this event to the main event loop.
691 * The caller loses ownership of this object after this method returns
692 * and must not delete the object.
693 */
694 void post()
695 {
696 QApplication::postEvent (&vboxGlobal(), this);
697 }
698};
699
700/**
701 * USB Popup Menu class.
702 * This class provides the list of USB devices attached to the host.
703 */
704class VBoxUSBMenu : public Q3PopupMenu
705{
706 Q_OBJECT
707
708public:
709
710 enum { USBDevicesMenuNoDevicesId = 1 };
711
712 VBoxUSBMenu (QWidget *);
713
714 const CUSBDevice& getUSB (int);
715
716 void setConsole (const CConsole &);
717
718private slots:
719
720 void processAboutToShow();
721
722 void processHighlighted (int);
723
724private:
725
726 QMap <int, CUSBDevice> mUSBDevicesMap;
727 CConsole mConsole;
728};
729
730
731/**
732 * Enable/Disable Menu class.
733 * This class provides enable/disable menu items.
734 */
735class VBoxSwitchMenu : public Q3PopupMenu
736{
737 Q_OBJECT
738
739public:
740
741 VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);
742
743 void setToolTip (const QString &);
744
745private slots:
746
747 void processAboutToShow();
748
749 void processActivated (int);
750
751private:
752
753 QAction *mAction;
754 QString mTip;
755 bool mInverted;
756};
757
758#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