1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxGlobal class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2009 Sun Microsystems, Inc.
|
---|
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 | * 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 __VBoxGlobal_h__
|
---|
24 | #define __VBoxGlobal_h__
|
---|
25 |
|
---|
26 | #include "COMDefs.h"
|
---|
27 |
|
---|
28 | #include "VBoxGlobalSettings.h"
|
---|
29 | #include "VBoxMedium.h"
|
---|
30 |
|
---|
31 | /* Qt includes */
|
---|
32 | #include <QApplication>
|
---|
33 | #include <QLayout>
|
---|
34 | #include <QMenu>
|
---|
35 | #include <QStyle>
|
---|
36 | #include <QProcess>
|
---|
37 | #include <QHash>
|
---|
38 | #include <QDesktopServices>
|
---|
39 | #include <QDir>
|
---|
40 |
|
---|
41 | class QAction;
|
---|
42 | class QLabel;
|
---|
43 | class QToolButton;
|
---|
44 |
|
---|
45 | // VirtualBox callback events
|
---|
46 | ////////////////////////////////////////////////////////////////////////////////
|
---|
47 |
|
---|
48 | class VBoxMachineStateChangeEvent : public QEvent
|
---|
49 | {
|
---|
50 | public:
|
---|
51 | VBoxMachineStateChangeEvent (const QUuid &aId, KMachineState aState)
|
---|
52 | : QEvent ((QEvent::Type) VBoxDefs::MachineStateChangeEventType)
|
---|
53 | , id (aId), state (aState)
|
---|
54 | {}
|
---|
55 |
|
---|
56 | const QUuid id;
|
---|
57 | const KMachineState state;
|
---|
58 | };
|
---|
59 |
|
---|
60 | class VBoxMachineDataChangeEvent : public QEvent
|
---|
61 | {
|
---|
62 | public:
|
---|
63 | VBoxMachineDataChangeEvent (const QUuid &aId)
|
---|
64 | : QEvent ((QEvent::Type) VBoxDefs::MachineDataChangeEventType)
|
---|
65 | , id (aId)
|
---|
66 | {}
|
---|
67 |
|
---|
68 | const QUuid id;
|
---|
69 | };
|
---|
70 |
|
---|
71 | class VBoxMachineRegisteredEvent : public QEvent
|
---|
72 | {
|
---|
73 | public:
|
---|
74 | VBoxMachineRegisteredEvent (const QUuid &aId, bool aRegistered)
|
---|
75 | : QEvent ((QEvent::Type) VBoxDefs::MachineRegisteredEventType)
|
---|
76 | , id (aId), registered (aRegistered)
|
---|
77 | {}
|
---|
78 |
|
---|
79 | const QUuid id;
|
---|
80 | const bool registered;
|
---|
81 | };
|
---|
82 |
|
---|
83 | class VBoxSessionStateChangeEvent : public QEvent
|
---|
84 | {
|
---|
85 | public:
|
---|
86 | VBoxSessionStateChangeEvent (const QUuid &aId, KSessionState aState)
|
---|
87 | : QEvent ((QEvent::Type) VBoxDefs::SessionStateChangeEventType)
|
---|
88 | , id (aId), state (aState)
|
---|
89 | {}
|
---|
90 |
|
---|
91 | const QUuid id;
|
---|
92 | const KSessionState state;
|
---|
93 | };
|
---|
94 |
|
---|
95 | class VBoxSnapshotEvent : public QEvent
|
---|
96 | {
|
---|
97 | public:
|
---|
98 |
|
---|
99 | enum What { Taken, Discarded, Changed };
|
---|
100 |
|
---|
101 | VBoxSnapshotEvent (const QUuid &aMachineId, const QUuid &aSnapshotId,
|
---|
102 | What aWhat)
|
---|
103 | : QEvent ((QEvent::Type) VBoxDefs::SnapshotEventType)
|
---|
104 | , what (aWhat)
|
---|
105 | , machineId (aMachineId), snapshotId (aSnapshotId)
|
---|
106 | {}
|
---|
107 |
|
---|
108 | const What what;
|
---|
109 |
|
---|
110 | const QUuid machineId;
|
---|
111 | const QUuid snapshotId;
|
---|
112 | };
|
---|
113 |
|
---|
114 | class VBoxCanShowRegDlgEvent : public QEvent
|
---|
115 | {
|
---|
116 | public:
|
---|
117 | VBoxCanShowRegDlgEvent (bool aCanShow)
|
---|
118 | : QEvent ((QEvent::Type) VBoxDefs::CanShowRegDlgEventType)
|
---|
119 | , mCanShow (aCanShow)
|
---|
120 | {}
|
---|
121 |
|
---|
122 | const bool mCanShow;
|
---|
123 | };
|
---|
124 |
|
---|
125 | class VBoxCanShowUpdDlgEvent : public QEvent
|
---|
126 | {
|
---|
127 | public:
|
---|
128 | VBoxCanShowUpdDlgEvent (bool aCanShow)
|
---|
129 | : QEvent ((QEvent::Type) VBoxDefs::CanShowUpdDlgEventType)
|
---|
130 | , mCanShow (aCanShow)
|
---|
131 | {}
|
---|
132 |
|
---|
133 | const bool mCanShow;
|
---|
134 | };
|
---|
135 |
|
---|
136 | class VBoxChangeGUILanguageEvent : public QEvent
|
---|
137 | {
|
---|
138 | public:
|
---|
139 | VBoxChangeGUILanguageEvent (QString aLangId)
|
---|
140 | : QEvent ((QEvent::Type) VBoxDefs::ChangeGUILanguageEventType)
|
---|
141 | , mLangId (aLangId)
|
---|
142 | {}
|
---|
143 |
|
---|
144 | const QString mLangId;
|
---|
145 | };
|
---|
146 |
|
---|
147 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
148 | class VBoxMainWindowCountChangeEvent : public QEvent
|
---|
149 | {
|
---|
150 | public:
|
---|
151 | VBoxMainWindowCountChangeEvent (int aCount)
|
---|
152 | : QEvent ((QEvent::Type) VBoxDefs::MainWindowCountChangeEventType)
|
---|
153 | , mCount (aCount)
|
---|
154 | {}
|
---|
155 |
|
---|
156 | const int mCount;
|
---|
157 | };
|
---|
158 |
|
---|
159 | class VBoxCanShowTrayIconEvent : public QEvent
|
---|
160 | {
|
---|
161 | public:
|
---|
162 | VBoxCanShowTrayIconEvent (bool aCanShow)
|
---|
163 | : QEvent ((QEvent::Type) VBoxDefs::CanShowTrayIconEventType)
|
---|
164 | , mCanShow (aCanShow)
|
---|
165 | {}
|
---|
166 |
|
---|
167 | const bool mCanShow;
|
---|
168 | };
|
---|
169 |
|
---|
170 | class VBoxShowTrayIconEvent : public QEvent
|
---|
171 | {
|
---|
172 | public:
|
---|
173 | VBoxShowTrayIconEvent (bool aShow)
|
---|
174 | : QEvent ((QEvent::Type) VBoxDefs::ShowTrayIconEventType)
|
---|
175 | , mShow (aShow)
|
---|
176 | {}
|
---|
177 |
|
---|
178 | const bool mShow;
|
---|
179 | };
|
---|
180 |
|
---|
181 | class VBoxChangeTrayIconEvent : public QEvent
|
---|
182 | {
|
---|
183 | public:
|
---|
184 | VBoxChangeTrayIconEvent (bool aChanged)
|
---|
185 | : QEvent ((QEvent::Type) VBoxDefs::TrayIconChangeEventType)
|
---|
186 | , mChanged (aChanged)
|
---|
187 | {}
|
---|
188 |
|
---|
189 | const bool mChanged;
|
---|
190 | };
|
---|
191 | #endif
|
---|
192 |
|
---|
193 | class VBoxChangeDockIconUpdateEvent : public QEvent
|
---|
194 | {
|
---|
195 | public:
|
---|
196 | VBoxChangeDockIconUpdateEvent (bool aChanged)
|
---|
197 | : QEvent ((QEvent::Type) VBoxDefs::ChangeDockIconUpdateEventType)
|
---|
198 | , mChanged (aChanged)
|
---|
199 | {}
|
---|
200 |
|
---|
201 | const bool mChanged;
|
---|
202 | };
|
---|
203 |
|
---|
204 | class Process : public QProcess
|
---|
205 | {
|
---|
206 | Q_OBJECT;
|
---|
207 |
|
---|
208 | public:
|
---|
209 |
|
---|
210 | static QByteArray singleShot (const QString &aProcessName,
|
---|
211 | int aTimeout = 5000
|
---|
212 | /* wait for data maximum 5 seconds */)
|
---|
213 | {
|
---|
214 | /* Why is it really needed is because of Qt4.3 bug with QProcess.
|
---|
215 | * This bug is about QProcess sometimes (~70%) do not receive
|
---|
216 | * notification about process was finished, so this makes
|
---|
217 | * 'bool QProcess::waitForFinished (int)' block the GUI thread and
|
---|
218 | * never dismissed with 'true' result even if process was really
|
---|
219 | * started&finished. So we just waiting for some information
|
---|
220 | * on process output and destroy the process with force. Due to
|
---|
221 | * QProcess::~QProcess() has the same 'waitForFinished (int)' blocker
|
---|
222 | * we have to change process state to QProcess::NotRunning. */
|
---|
223 |
|
---|
224 | QByteArray result;
|
---|
225 | Process process;
|
---|
226 | process.start (aProcessName);
|
---|
227 | bool firstShotReady = process.waitForReadyRead (aTimeout);
|
---|
228 | if (firstShotReady)
|
---|
229 | result = process.readAllStandardOutput();
|
---|
230 | process.setProcessState (QProcess::NotRunning);
|
---|
231 | return result;
|
---|
232 | }
|
---|
233 |
|
---|
234 | protected:
|
---|
235 |
|
---|
236 | Process (QWidget *aParent = 0) : QProcess (aParent) {}
|
---|
237 | };
|
---|
238 |
|
---|
239 | // VBoxGlobal class
|
---|
240 | ////////////////////////////////////////////////////////////////////////////////
|
---|
241 |
|
---|
242 | class VBoxSelectorWnd;
|
---|
243 | class VBoxConsoleWnd;
|
---|
244 | class VBoxRegistrationDlg;
|
---|
245 | class VBoxUpdateDlg;
|
---|
246 |
|
---|
247 | class VBoxGlobal : public QObject
|
---|
248 | {
|
---|
249 | Q_OBJECT
|
---|
250 |
|
---|
251 | public:
|
---|
252 |
|
---|
253 | typedef QHash <ulong, QString> QULongStringHash;
|
---|
254 | typedef QHash <long, QString> QLongStringHash;
|
---|
255 |
|
---|
256 | static VBoxGlobal &instance();
|
---|
257 |
|
---|
258 | bool isValid() { return mValid; }
|
---|
259 |
|
---|
260 | QString versionString() { return mVerString; }
|
---|
261 |
|
---|
262 | CVirtualBox virtualBox() const { return mVBox; }
|
---|
263 |
|
---|
264 | const VBoxGlobalSettings &settings() const { return gset; }
|
---|
265 | bool setSettings (const VBoxGlobalSettings &gs);
|
---|
266 |
|
---|
267 | VBoxSelectorWnd &selectorWnd();
|
---|
268 | VBoxConsoleWnd &consoleWnd();
|
---|
269 |
|
---|
270 | /* main window handle storage */
|
---|
271 | void setMainWindow (QWidget *aMainWindow) { mMainWindow = aMainWindow; }
|
---|
272 | QWidget *mainWindow() const { return mMainWindow; }
|
---|
273 |
|
---|
274 | bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
|
---|
275 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
276 | bool isTrayMenu() const;
|
---|
277 | void setTrayMenu(bool aIsTrayMenu);
|
---|
278 | void trayIconShowSelector();
|
---|
279 | bool trayIconInstall();
|
---|
280 | #endif
|
---|
281 | QUuid managedVMUuid() const { return vmUuid; }
|
---|
282 |
|
---|
283 | VBoxDefs::RenderMode vmRenderMode() const { return vm_render_mode; }
|
---|
284 | const char *vmRenderModeStr() const { return vm_render_mode_str; }
|
---|
285 |
|
---|
286 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
287 | bool isDebuggerEnabled() const { return mDbgEnabled; }
|
---|
288 | bool isDebuggerAutoShowEnabled() const { return mDbgAutoShow; }
|
---|
289 | RTLDRMOD getDebuggerModule() const { return mhVBoxDbg; }
|
---|
290 | #else
|
---|
291 | bool isDebuggerAutoShowEnabled() const { return false; }
|
---|
292 | #endif
|
---|
293 |
|
---|
294 | /* VBox enum to/from string/icon/color convertors */
|
---|
295 |
|
---|
296 | QList <CGuestOSType> vmGuestOSFamilyList() const;
|
---|
297 | QList <CGuestOSType> vmGuestOSTypeList (const QString &aFamilyId) const;
|
---|
298 | QPixmap vmGuestOSTypeIcon (const QString &aTypeId) const;
|
---|
299 | CGuestOSType vmGuestOSType (const QString &aTypeId,
|
---|
300 | const QString &aFamilyId = QString::null) const;
|
---|
301 | QString vmGuestOSTypeDescription (const QString &aTypeId) const;
|
---|
302 |
|
---|
303 | QPixmap toIcon (KMachineState s) const
|
---|
304 | {
|
---|
305 | QPixmap *pm = mVMStateIcons.value (s);
|
---|
306 | AssertMsg (pm, ("Icon for VM state %d must be defined", s));
|
---|
307 | return pm ? *pm : QPixmap();
|
---|
308 | }
|
---|
309 |
|
---|
310 | const QColor &toColor (KMachineState s) const
|
---|
311 | {
|
---|
312 | static const QColor none;
|
---|
313 | AssertMsg (mVMStateColors.value (s), ("No color for %d", s));
|
---|
314 | return mVMStateColors.value (s) ? *mVMStateColors.value (s) : none;
|
---|
315 | }
|
---|
316 |
|
---|
317 | QString toString (KMachineState s) const
|
---|
318 | {
|
---|
319 | AssertMsg (!mMachineStates.value (s).isNull(), ("No text for %d", s));
|
---|
320 | return mMachineStates.value (s);
|
---|
321 | }
|
---|
322 |
|
---|
323 | QString toString (KSessionState s) const
|
---|
324 | {
|
---|
325 | AssertMsg (!mSessionStates.value (s).isNull(), ("No text for %d", s));
|
---|
326 | return mSessionStates.value (s);
|
---|
327 | }
|
---|
328 |
|
---|
329 | /**
|
---|
330 | * Returns a string representation of the given KStorageBus enum value.
|
---|
331 | * Complementary to #toStorageBusType (const QString &) const.
|
---|
332 | */
|
---|
333 | QString toString (KStorageBus aBus) const
|
---|
334 | {
|
---|
335 | AssertMsg (!mStorageBuses.value (aBus).isNull(), ("No text for %d", aBus));
|
---|
336 | return mStorageBuses [aBus];
|
---|
337 | }
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * Returns a KStorageBus enum value corresponding to the given string
|
---|
341 | * representation. Complementary to #toString (KStorageBus) const.
|
---|
342 | */
|
---|
343 | KStorageBus toStorageBusType (const QString &aBus) const
|
---|
344 | {
|
---|
345 | QULongStringHash::const_iterator it =
|
---|
346 | qFind (mStorageBuses.begin(), mStorageBuses.end(), aBus);
|
---|
347 | AssertMsg (it != mStorageBuses.end(), ("No value for {%s}",
|
---|
348 | aBus.toLatin1().constData()));
|
---|
349 | return KStorageBus (it.key());
|
---|
350 | }
|
---|
351 |
|
---|
352 | QString toString (KStorageBus aBus, LONG aChannel) const;
|
---|
353 | LONG toStorageChannel (KStorageBus aBus, const QString &aChannel) const;
|
---|
354 |
|
---|
355 | QString toString (KStorageBus aBus, LONG aChannel, LONG aDevice) const;
|
---|
356 | LONG toStorageDevice (KStorageBus aBus, LONG aChannel, const QString &aDevice) const;
|
---|
357 |
|
---|
358 | QString toFullString (KStorageBus aBus, LONG aChannel, LONG aDevice) const;
|
---|
359 |
|
---|
360 | QString toString (KHardDiskType t) const
|
---|
361 | {
|
---|
362 | AssertMsg (!mDiskTypes.value (t).isNull(), ("No text for %d", t));
|
---|
363 | return mDiskTypes.value (t);
|
---|
364 | }
|
---|
365 |
|
---|
366 | /**
|
---|
367 | * Similar to toString (KHardDiskType), but returns 'Differencing' for
|
---|
368 | * normal hard disks that have a parent.
|
---|
369 | */
|
---|
370 | QString hardDiskTypeString (const CHardDisk &aHD) const
|
---|
371 | {
|
---|
372 | if (!aHD.GetParent().isNull())
|
---|
373 | {
|
---|
374 | Assert (aHD.GetType() == KHardDiskType_Normal);
|
---|
375 | return mDiskTypes_Differencing;
|
---|
376 | }
|
---|
377 | return toString (aHD.GetType());
|
---|
378 | }
|
---|
379 |
|
---|
380 | QString toString (KVRDPAuthType t) const
|
---|
381 | {
|
---|
382 | AssertMsg (!mVRDPAuthTypes.value (t).isNull(), ("No text for %d", t));
|
---|
383 | return mVRDPAuthTypes.value (t);
|
---|
384 | }
|
---|
385 |
|
---|
386 | QString toString (KPortMode t) const
|
---|
387 | {
|
---|
388 | AssertMsg (!mPortModeTypes.value (t).isNull(), ("No text for %d", t));
|
---|
389 | return mPortModeTypes.value (t);
|
---|
390 | }
|
---|
391 |
|
---|
392 | QString toString (KUSBDeviceFilterAction t) const
|
---|
393 | {
|
---|
394 | AssertMsg (!mUSBFilterActionTypes.value (t).isNull(), ("No text for %d", t));
|
---|
395 | return mUSBFilterActionTypes.value (t);
|
---|
396 | }
|
---|
397 |
|
---|
398 | QString toString (KClipboardMode t) const
|
---|
399 | {
|
---|
400 | AssertMsg (!mClipboardTypes.value (t).isNull(), ("No text for %d", t));
|
---|
401 | return mClipboardTypes.value (t);
|
---|
402 | }
|
---|
403 |
|
---|
404 | KClipboardMode toClipboardModeType (const QString &s) const
|
---|
405 | {
|
---|
406 | QULongStringHash::const_iterator it =
|
---|
407 | qFind (mClipboardTypes.begin(), mClipboardTypes.end(), s);
|
---|
408 | AssertMsg (it != mClipboardTypes.end(), ("No value for {%s}",
|
---|
409 | s.toLatin1().constData()));
|
---|
410 | return KClipboardMode (it.key());
|
---|
411 | }
|
---|
412 |
|
---|
413 | QString toString (KStorageControllerType t) const
|
---|
414 | {
|
---|
415 | AssertMsg (!mStorageControllerTypes.value (t).isNull(), ("No text for %d", t));
|
---|
416 | return mStorageControllerTypes.value (t);
|
---|
417 | }
|
---|
418 |
|
---|
419 | KStorageControllerType toIDEControllerType (const QString &s) const
|
---|
420 | {
|
---|
421 | QULongStringHash::const_iterator it =
|
---|
422 | qFind (mStorageControllerTypes.begin(), mStorageControllerTypes.end(), s);
|
---|
423 | AssertMsg (it != mStorageControllerTypes.end(), ("No value for {%s}",
|
---|
424 | s.toLatin1().constData()));
|
---|
425 | return KStorageControllerType (it.key());
|
---|
426 | }
|
---|
427 |
|
---|
428 | KVRDPAuthType toVRDPAuthType (const QString &s) const
|
---|
429 | {
|
---|
430 | QULongStringHash::const_iterator it =
|
---|
431 | qFind (mVRDPAuthTypes.begin(), mVRDPAuthTypes.end(), s);
|
---|
432 | AssertMsg (it != mVRDPAuthTypes.end(), ("No value for {%s}",
|
---|
433 | s.toLatin1().constData()));
|
---|
434 | return KVRDPAuthType (it.key());
|
---|
435 | }
|
---|
436 |
|
---|
437 | KPortMode toPortMode (const QString &s) const
|
---|
438 | {
|
---|
439 | QULongStringHash::const_iterator it =
|
---|
440 | qFind (mPortModeTypes.begin(), mPortModeTypes.end(), s);
|
---|
441 | AssertMsg (it != mPortModeTypes.end(), ("No value for {%s}",
|
---|
442 | s.toLatin1().constData()));
|
---|
443 | return KPortMode (it.key());
|
---|
444 | }
|
---|
445 |
|
---|
446 | KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
|
---|
447 | {
|
---|
448 | QULongStringHash::const_iterator it =
|
---|
449 | qFind (mUSBFilterActionTypes.begin(), mUSBFilterActionTypes.end(), s);
|
---|
450 | AssertMsg (it != mUSBFilterActionTypes.end(), ("No value for {%s}",
|
---|
451 | s.toLatin1().constData()));
|
---|
452 | return KUSBDeviceFilterAction (it.key());
|
---|
453 | }
|
---|
454 |
|
---|
455 | QString toString (KDeviceType t) const
|
---|
456 | {
|
---|
457 | AssertMsg (!mDeviceTypes.value (t).isNull(), ("No text for %d", t));
|
---|
458 | return mDeviceTypes.value (t);
|
---|
459 | }
|
---|
460 |
|
---|
461 | KDeviceType toDeviceType (const QString &s) const
|
---|
462 | {
|
---|
463 | QULongStringHash::const_iterator it =
|
---|
464 | qFind (mDeviceTypes.begin(), mDeviceTypes.end(), s);
|
---|
465 | AssertMsg (it != mDeviceTypes.end(), ("No value for {%s}",
|
---|
466 | s.toLatin1().constData()));
|
---|
467 | return KDeviceType (it.key());
|
---|
468 | }
|
---|
469 |
|
---|
470 | QStringList deviceTypeStrings() const;
|
---|
471 |
|
---|
472 | QString toString (KAudioDriverType t) const
|
---|
473 | {
|
---|
474 | AssertMsg (!mAudioDriverTypes.value (t).isNull(), ("No text for %d", t));
|
---|
475 | return mAudioDriverTypes.value (t);
|
---|
476 | }
|
---|
477 |
|
---|
478 | KAudioDriverType toAudioDriverType (const QString &s) const
|
---|
479 | {
|
---|
480 | QULongStringHash::const_iterator it =
|
---|
481 | qFind (mAudioDriverTypes.begin(), mAudioDriverTypes.end(), s);
|
---|
482 | AssertMsg (it != mAudioDriverTypes.end(), ("No value for {%s}",
|
---|
483 | s.toLatin1().constData()));
|
---|
484 | return KAudioDriverType (it.key());
|
---|
485 | }
|
---|
486 |
|
---|
487 | QString toString (KAudioControllerType t) const
|
---|
488 | {
|
---|
489 | AssertMsg (!mAudioControllerTypes.value (t).isNull(), ("No text for %d", t));
|
---|
490 | return mAudioControllerTypes.value (t);
|
---|
491 | }
|
---|
492 |
|
---|
493 | KAudioControllerType toAudioControllerType (const QString &s) const
|
---|
494 | {
|
---|
495 | QULongStringHash::const_iterator it =
|
---|
496 | qFind (mAudioControllerTypes.begin(), mAudioControllerTypes.end(), s);
|
---|
497 | AssertMsg (it != mAudioControllerTypes.end(), ("No value for {%s}",
|
---|
498 | s.toLatin1().constData()));
|
---|
499 | return KAudioControllerType (it.key());
|
---|
500 | }
|
---|
501 |
|
---|
502 | QString toString (KNetworkAdapterType t) const
|
---|
503 | {
|
---|
504 | AssertMsg (!mNetworkAdapterTypes.value (t).isNull(), ("No text for %d", t));
|
---|
505 | return mNetworkAdapterTypes.value (t);
|
---|
506 | }
|
---|
507 |
|
---|
508 | KNetworkAdapterType toNetworkAdapterType (const QString &s) const
|
---|
509 | {
|
---|
510 | QULongStringHash::const_iterator it =
|
---|
511 | qFind (mNetworkAdapterTypes.begin(), mNetworkAdapterTypes.end(), s);
|
---|
512 | AssertMsg (it != mNetworkAdapterTypes.end(), ("No value for {%s}",
|
---|
513 | s.toLatin1().constData()));
|
---|
514 | return KNetworkAdapterType (it.key());
|
---|
515 | }
|
---|
516 |
|
---|
517 | QString toString (KNetworkAttachmentType t) const
|
---|
518 | {
|
---|
519 | AssertMsg (!mNetworkAttachmentTypes.value (t).isNull(), ("No text for %d", t));
|
---|
520 | return mNetworkAttachmentTypes.value (t);
|
---|
521 | }
|
---|
522 |
|
---|
523 | KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
|
---|
524 | {
|
---|
525 | QULongStringHash::const_iterator it =
|
---|
526 | qFind (mNetworkAttachmentTypes.begin(), mNetworkAttachmentTypes.end(), s);
|
---|
527 | AssertMsg (it != mNetworkAttachmentTypes.end(), ("No value for {%s}",
|
---|
528 | s.toLatin1().constData()));
|
---|
529 | return KNetworkAttachmentType (it.key());
|
---|
530 | }
|
---|
531 |
|
---|
532 | QString toString (KUSBDeviceState aState) const
|
---|
533 | {
|
---|
534 | AssertMsg (!mUSBDeviceStates.value (aState).isNull(), ("No text for %d", aState));
|
---|
535 | return mUSBDeviceStates.value (aState);
|
---|
536 | }
|
---|
537 |
|
---|
538 | QStringList COMPortNames() const;
|
---|
539 | QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
540 | bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
541 |
|
---|
542 | QStringList LPTPortNames() const;
|
---|
543 | QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
544 | bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
545 |
|
---|
546 | QPixmap snapshotIcon (bool online) const
|
---|
547 | {
|
---|
548 | return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
|
---|
549 | }
|
---|
550 |
|
---|
551 | QPixmap warningIcon() const { return mWarningIcon; }
|
---|
552 | QPixmap errorIcon() const { return mErrorIcon; }
|
---|
553 |
|
---|
554 | /* details generators */
|
---|
555 |
|
---|
556 | QString details (const CHardDisk &aHD, bool aPredictDiff);
|
---|
557 |
|
---|
558 | QString details (const CUSBDevice &aDevice) const;
|
---|
559 | QString toolTip (const CUSBDevice &aDevice) const;
|
---|
560 | QString toolTip (const CUSBDeviceFilter &aFilter) const;
|
---|
561 |
|
---|
562 | QString detailsReport (const CMachine &aMachine, bool aIsNewVM,
|
---|
563 | bool aWithLinks);
|
---|
564 |
|
---|
565 | QString platformInfo();
|
---|
566 |
|
---|
567 | /* VirtualBox helpers */
|
---|
568 |
|
---|
569 | #if defined(Q_WS_X11) && !defined(VBOX_OSE)
|
---|
570 | double findLicenseFile (const QStringList &aFilesList, QRegExp aPattern, QString &aLicenseFile) const;
|
---|
571 | bool showVirtualBoxLicense();
|
---|
572 | #endif
|
---|
573 |
|
---|
574 | bool checkForAutoConvertedSettings (bool aAfterRefresh = false);
|
---|
575 |
|
---|
576 | void checkForAutoConvertedSettingsAfterRefresh()
|
---|
577 | { checkForAutoConvertedSettings (true); }
|
---|
578 |
|
---|
579 | CSession openSession (const QUuid &aId, bool aExisting = false);
|
---|
580 |
|
---|
581 | /** Shortcut to openSession (aId, true). */
|
---|
582 | CSession openExistingSession (const QUuid &aId) { return openSession (aId, true); }
|
---|
583 |
|
---|
584 | bool startMachine (const QUuid &id);
|
---|
585 |
|
---|
586 | void startEnumeratingMedia();
|
---|
587 |
|
---|
588 | /**
|
---|
589 | * Returns a list of all currently registered media. This list is used to
|
---|
590 | * globally track the accessiblity state of all media on a dedicated thread.
|
---|
591 | *
|
---|
592 | * Note that the media list is initially empty (i.e. before the enumeration
|
---|
593 | * process is started for the first time using #startEnumeratingMedia()).
|
---|
594 | * See #startEnumeratingMedia() for more information about how meida are
|
---|
595 | * sorted in the returned list.
|
---|
596 | */
|
---|
597 | const VBoxMediaList ¤tMediaList() const { return mMediaList; }
|
---|
598 |
|
---|
599 | /** Returns true if the media enumeration is in progress. */
|
---|
600 | bool isMediaEnumerationStarted() const { return mMediaEnumThread != NULL; }
|
---|
601 |
|
---|
602 | void addMedium (const VBoxMedium &);
|
---|
603 | void updateMedium (const VBoxMedium &);
|
---|
604 | void removeMedium (VBoxDefs::MediaType, const QUuid &);
|
---|
605 |
|
---|
606 | bool findMedium (const CMedium &, VBoxMedium &) const;
|
---|
607 |
|
---|
608 | /** Compact version of #findMediumTo(). Asserts if not found. */
|
---|
609 | VBoxMedium getMedium (const CMedium &aObj) const
|
---|
610 | {
|
---|
611 | VBoxMedium medium;
|
---|
612 | if (!findMedium (aObj, medium))
|
---|
613 | AssertFailed();
|
---|
614 | return medium;
|
---|
615 | }
|
---|
616 |
|
---|
617 | /* Returns the number of current running Fe/Qt4 main windows. */
|
---|
618 | int mainWindowCount();
|
---|
619 |
|
---|
620 | /* various helpers */
|
---|
621 |
|
---|
622 | QString languageName() const;
|
---|
623 | QString languageCountry() const;
|
---|
624 | QString languageNameEnglish() const;
|
---|
625 | QString languageCountryEnglish() const;
|
---|
626 | QString languageTranslators() const;
|
---|
627 |
|
---|
628 | void retranslateUi();
|
---|
629 |
|
---|
630 | /** @internal made public for internal purposes */
|
---|
631 | void cleanup();
|
---|
632 |
|
---|
633 | /* public static stuff */
|
---|
634 |
|
---|
635 | static bool isDOSType (const QString &aOSTypeId);
|
---|
636 |
|
---|
637 | static void adoptLabelPixmap (QLabel *);
|
---|
638 |
|
---|
639 | static QString languageId();
|
---|
640 | static void loadLanguage (const QString &aLangId = QString::null);
|
---|
641 | QString helpFile() const;
|
---|
642 |
|
---|
643 | static QIcon iconSet (const char *aNormal,
|
---|
644 | const char *aDisabled = NULL,
|
---|
645 | const char *aActive = NULL);
|
---|
646 | static QIcon iconSetOnOff (const char *aNormal, const char *aNormalOff,
|
---|
647 | const char *aDisabled = NULL,
|
---|
648 | const char *aDisabledOff = NULL,
|
---|
649 | const char *aActive = NULL,
|
---|
650 | const char *aActiveOff = NULL);
|
---|
651 | static QIcon iconSetFull (const QSize &aNormalSize, const QSize &aSmallSize,
|
---|
652 | const char *aNormal, const char *aSmallNormal,
|
---|
653 | const char *aDisabled = NULL,
|
---|
654 | const char *aSmallDisabled = NULL,
|
---|
655 | const char *aActive = NULL,
|
---|
656 | const char *aSmallActive = NULL);
|
---|
657 |
|
---|
658 | static QIcon standardIcon (QStyle::StandardPixmap aStandard, QWidget *aWidget = NULL);
|
---|
659 |
|
---|
660 | static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel);
|
---|
661 |
|
---|
662 | static QRect normalizeGeometry (const QRect &aRectangle, const QRegion &aBoundRegion,
|
---|
663 | bool aCanResize = true);
|
---|
664 | static QRect getNormalized (const QRect &aRectangle, const QRegion &aBoundRegion,
|
---|
665 | bool aCanResize = true);
|
---|
666 | static QRegion flip (const QRegion &aRegion);
|
---|
667 |
|
---|
668 | static void centerWidget (QWidget *aWidget, QWidget *aRelative,
|
---|
669 | bool aCanResize = true);
|
---|
670 |
|
---|
671 | static QChar decimalSep();
|
---|
672 | static QString sizeRegexp();
|
---|
673 |
|
---|
674 | static quint64 parseSize (const QString &);
|
---|
675 | static QString formatSize (quint64 aSize, uint aDecimal = 2,
|
---|
676 | VBoxDefs::FormatSize aMode = VBoxDefs::FormatSize_Round);
|
---|
677 |
|
---|
678 | static quint64 requiredVideoMemory (CMachine *aMachine = 0);
|
---|
679 |
|
---|
680 | static QString locationForHTML (const QString &aFileName);
|
---|
681 |
|
---|
682 | static QString highlight (const QString &aStr, bool aToolTip = false);
|
---|
683 |
|
---|
684 | static QString emphasize (const QString &aStr);
|
---|
685 |
|
---|
686 | static QString systemLanguageId();
|
---|
687 |
|
---|
688 | static QString getExistingDirectory (const QString &aDir, QWidget *aParent,
|
---|
689 | const QString &aCaption = QString::null,
|
---|
690 | bool aDirOnly = TRUE,
|
---|
691 | bool resolveSymlinks = TRUE);
|
---|
692 |
|
---|
693 | static QString getSaveFileName (const QString &aStartWith, const QString &aFilters, QWidget *aParent,
|
---|
694 | const QString &aCaption, QString *aSelectedFilter = NULL,
|
---|
695 | bool aResolveSymLinks = true);
|
---|
696 |
|
---|
697 | static QString getOpenFileName (const QString &aStartWith, const QString &aFilters, QWidget *aParent,
|
---|
698 | const QString &aCaption, QString *aSelectedFilter = NULL,
|
---|
699 | bool aResolveSymLinks = true);
|
---|
700 |
|
---|
701 | static QStringList getOpenFileNames (const QString &aStartWith, const QString &aFilters, QWidget *aParent,
|
---|
702 | const QString &aCaption, QString *aSelectedFilter = NULL,
|
---|
703 | bool aResolveSymLinks = true,
|
---|
704 | bool aSingleFile = false);
|
---|
705 |
|
---|
706 | static QString getFirstExistingDir (const QString &);
|
---|
707 |
|
---|
708 | static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
|
---|
709 |
|
---|
710 | static QString removeAccelMark (const QString &aText);
|
---|
711 |
|
---|
712 | static QString insertKeyToActionText (const QString &aText, const QString &aKey);
|
---|
713 | static QString extractKeyFromActionText (const QString &aText);
|
---|
714 |
|
---|
715 | static QPixmap joinPixmaps (const QPixmap &aPM1, const QPixmap &aPM2);
|
---|
716 |
|
---|
717 | static QWidget *findWidget (QWidget *aParent, const char *aName,
|
---|
718 | const char *aClassName = NULL,
|
---|
719 | bool aRecursive = false);
|
---|
720 |
|
---|
721 | static QList <QPair <QString, QString> > HDDBackends();
|
---|
722 |
|
---|
723 | /* Qt 4.2.0 support function */
|
---|
724 | static inline void setLayoutMargin (QLayout *aLayout, int aMargin)
|
---|
725 | {
|
---|
726 | #if QT_VERSION < 0x040300
|
---|
727 | /* Deprecated since > 4.2 */
|
---|
728 | aLayout->setMargin (aMargin);
|
---|
729 | #else
|
---|
730 | /* New since > 4.2 */
|
---|
731 | aLayout->setContentsMargins (aMargin, aMargin, aMargin, aMargin);
|
---|
732 | #endif
|
---|
733 | }
|
---|
734 |
|
---|
735 | static inline QString documentsPath()
|
---|
736 | {
|
---|
737 | QString path;
|
---|
738 | #if QT_VERSION < 0x040400
|
---|
739 | path = QDir::homePath();
|
---|
740 | #else
|
---|
741 | path = QDesktopServices::storageLocation (QDesktopServices::DocumentsLocation);
|
---|
742 | #endif
|
---|
743 | return QDir::cleanPath (path);
|
---|
744 | }
|
---|
745 |
|
---|
746 | signals:
|
---|
747 |
|
---|
748 | /**
|
---|
749 | * Emitted at the beginning of the enumeration process started by
|
---|
750 | * #startEnumeratingMedia().
|
---|
751 | */
|
---|
752 | void mediumEnumStarted();
|
---|
753 |
|
---|
754 | /**
|
---|
755 | * Emitted when a new medium item from the list has updated its
|
---|
756 | * accessibility state.
|
---|
757 | */
|
---|
758 | void mediumEnumerated (const VBoxMedium &aMedum);
|
---|
759 |
|
---|
760 | /**
|
---|
761 | * Emitted at the end of the enumeration process started by
|
---|
762 | * #startEnumeratingMedia(). The @a aList argument is passed for
|
---|
763 | * convenience, it is exactly the same as returned by #currentMediaList().
|
---|
764 | */
|
---|
765 | void mediumEnumFinished (const VBoxMediaList &aList);
|
---|
766 |
|
---|
767 | /** Emitted when a new media is added using #addMedia(). */
|
---|
768 | void mediumAdded (const VBoxMedium &);
|
---|
769 |
|
---|
770 | /** Emitted when the media is updated using #updateMedia(). */
|
---|
771 | void mediumUpdated (const VBoxMedium &);
|
---|
772 |
|
---|
773 | /** Emitted when the media is removed using #removeMedia(). */
|
---|
774 | void mediumRemoved (VBoxDefs::MediaType, const QUuid &);
|
---|
775 |
|
---|
776 | /* signals emitted when the VirtualBox callback is called by the server
|
---|
777 | * (note that currently these signals are emitted only when the application
|
---|
778 | * is the in the VM selector mode) */
|
---|
779 |
|
---|
780 | void machineStateChanged (const VBoxMachineStateChangeEvent &e);
|
---|
781 | void machineDataChanged (const VBoxMachineDataChangeEvent &e);
|
---|
782 | void machineRegistered (const VBoxMachineRegisteredEvent &e);
|
---|
783 | void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
|
---|
784 | void snapshotChanged (const VBoxSnapshotEvent &e);
|
---|
785 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
786 | void mainWindowCountChanged (const VBoxMainWindowCountChangeEvent &e);
|
---|
787 | void trayIconCanShow (const VBoxCanShowTrayIconEvent &e);
|
---|
788 | void trayIconShow (const VBoxShowTrayIconEvent &e);
|
---|
789 | void trayIconChanged (const VBoxChangeTrayIconEvent &e);
|
---|
790 | #endif
|
---|
791 | void dockIconUpdateChanged (const VBoxChangeDockIconUpdateEvent &e);
|
---|
792 |
|
---|
793 | void canShowRegDlg (bool aCanShow);
|
---|
794 | void canShowUpdDlg (bool aCanShow);
|
---|
795 |
|
---|
796 | public slots:
|
---|
797 |
|
---|
798 | bool openURL (const QString &aURL);
|
---|
799 |
|
---|
800 | void showRegistrationDialog (bool aForce = true);
|
---|
801 | void showUpdateDialog (bool aForce = true);
|
---|
802 | void perDayNewVersionNotifier();
|
---|
803 |
|
---|
804 | protected:
|
---|
805 |
|
---|
806 | bool event (QEvent *e);
|
---|
807 | bool eventFilter (QObject *, QEvent *);
|
---|
808 |
|
---|
809 | private:
|
---|
810 |
|
---|
811 | VBoxGlobal();
|
---|
812 | ~VBoxGlobal();
|
---|
813 |
|
---|
814 | void init();
|
---|
815 |
|
---|
816 | bool mValid;
|
---|
817 |
|
---|
818 | CVirtualBox mVBox;
|
---|
819 |
|
---|
820 | VBoxGlobalSettings gset;
|
---|
821 |
|
---|
822 | VBoxSelectorWnd *mSelectorWnd;
|
---|
823 | VBoxConsoleWnd *mConsoleWnd;
|
---|
824 | QWidget* mMainWindow;
|
---|
825 |
|
---|
826 | #ifdef VBOX_WITH_REGISTRATION
|
---|
827 | VBoxRegistrationDlg *mRegDlg;
|
---|
828 | #endif
|
---|
829 | VBoxUpdateDlg *mUpdDlg;
|
---|
830 |
|
---|
831 | QUuid vmUuid;
|
---|
832 |
|
---|
833 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
834 | bool mIsTrayMenu : 1; /*< Tray icon active/desired? */
|
---|
835 | bool mIncreasedWindowCounter : 1;
|
---|
836 | #endif
|
---|
837 |
|
---|
838 | QThread *mMediaEnumThread;
|
---|
839 | VBoxMediaList mMediaList;
|
---|
840 |
|
---|
841 | VBoxDefs::RenderMode vm_render_mode;
|
---|
842 | const char * vm_render_mode_str;
|
---|
843 |
|
---|
844 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
845 | /** Whether the debugger should be accessible or not.
|
---|
846 | * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED, --debug or the env.var.
|
---|
847 | * VBOX_GUI_DBG_AUTO_SHOW to enable. */
|
---|
848 | bool mDbgEnabled;
|
---|
849 | /** Whether to show the debugger automatically with the console.
|
---|
850 | * Use --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
|
---|
851 | bool mDbgAutoShow;
|
---|
852 | /** VBoxDbg module handle. */
|
---|
853 | RTLDRMOD mhVBoxDbg;
|
---|
854 | #endif
|
---|
855 |
|
---|
856 | #if defined (Q_WS_WIN32)
|
---|
857 | DWORD dwHTMLHelpCookie;
|
---|
858 | #endif
|
---|
859 |
|
---|
860 | CVirtualBoxCallback callback;
|
---|
861 |
|
---|
862 | QString mVerString;
|
---|
863 |
|
---|
864 | QList <QString> mFamilyIDs;
|
---|
865 | QList <QList <CGuestOSType> > mTypes;
|
---|
866 | QHash <QString, QPixmap *> mOsTypeIcons;
|
---|
867 |
|
---|
868 | QHash <ulong, QPixmap *> mVMStateIcons;
|
---|
869 | QHash <ulong, QColor *> mVMStateColors;
|
---|
870 |
|
---|
871 | QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
|
---|
872 |
|
---|
873 | QULongStringHash mMachineStates;
|
---|
874 | QULongStringHash mSessionStates;
|
---|
875 | QULongStringHash mDeviceTypes;
|
---|
876 |
|
---|
877 | QULongStringHash mStorageBuses;
|
---|
878 | QLongStringHash mStorageBusChannels;
|
---|
879 | QLongStringHash mStorageBusDevices;
|
---|
880 |
|
---|
881 | QULongStringHash mDiskTypes;
|
---|
882 | QString mDiskTypes_Differencing;
|
---|
883 |
|
---|
884 | QULongStringHash mVRDPAuthTypes;
|
---|
885 | QULongStringHash mPortModeTypes;
|
---|
886 | QULongStringHash mUSBFilterActionTypes;
|
---|
887 | QULongStringHash mAudioDriverTypes;
|
---|
888 | QULongStringHash mAudioControllerTypes;
|
---|
889 | QULongStringHash mNetworkAdapterTypes;
|
---|
890 | QULongStringHash mNetworkAttachmentTypes;
|
---|
891 | QULongStringHash mClipboardTypes;
|
---|
892 | QULongStringHash mStorageControllerTypes;
|
---|
893 | QULongStringHash mUSBDeviceStates;
|
---|
894 |
|
---|
895 | QString mUserDefinedPortName;
|
---|
896 |
|
---|
897 | QPixmap mWarningIcon, mErrorIcon;
|
---|
898 |
|
---|
899 | mutable bool mDetailReportTemplatesReady;
|
---|
900 |
|
---|
901 | friend VBoxGlobal &vboxGlobal();
|
---|
902 | friend class VBoxCallback;
|
---|
903 | };
|
---|
904 |
|
---|
905 | inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); }
|
---|
906 |
|
---|
907 | // Helper classes
|
---|
908 | ////////////////////////////////////////////////////////////////////////////////
|
---|
909 |
|
---|
910 | /**
|
---|
911 | * Generic asyncronous event.
|
---|
912 | *
|
---|
913 | * This abstract class is intended to provide a conveinent way to execute
|
---|
914 | * code on the main GUI thread asynchronously to the calling party. This is
|
---|
915 | * done by putting necessary actions to the #handle() function in a subclass
|
---|
916 | * and then posting an instance of the subclass using #post(). The instance
|
---|
917 | * must be allocated on the heap using the <tt>new</tt> operation and will be
|
---|
918 | * automatically deleted after processing. Note that if you don't call #post()
|
---|
919 | * on the created instance, you have to delete it yourself.
|
---|
920 | */
|
---|
921 | class VBoxAsyncEvent : public QEvent
|
---|
922 | {
|
---|
923 | public:
|
---|
924 |
|
---|
925 | VBoxAsyncEvent() : QEvent ((QEvent::Type) VBoxDefs::AsyncEventType) {}
|
---|
926 |
|
---|
927 | /**
|
---|
928 | * Worker function. Gets executed on the GUI thread when the posted event
|
---|
929 | * is processed by the main event loop.
|
---|
930 | */
|
---|
931 | virtual void handle() = 0;
|
---|
932 |
|
---|
933 | /**
|
---|
934 | * Posts this event to the main event loop.
|
---|
935 | * The caller loses ownership of this object after this method returns
|
---|
936 | * and must not delete the object.
|
---|
937 | */
|
---|
938 | void post()
|
---|
939 | {
|
---|
940 | QApplication::postEvent (&vboxGlobal(), this);
|
---|
941 | }
|
---|
942 | };
|
---|
943 |
|
---|
944 | /**
|
---|
945 | * USB Popup Menu class.
|
---|
946 | * This class provides the list of USB devices attached to the host.
|
---|
947 | */
|
---|
948 | class VBoxUSBMenu : public QMenu
|
---|
949 | {
|
---|
950 | Q_OBJECT
|
---|
951 |
|
---|
952 | public:
|
---|
953 |
|
---|
954 | VBoxUSBMenu (QWidget *);
|
---|
955 |
|
---|
956 | const CUSBDevice& getUSB (QAction *aAction);
|
---|
957 |
|
---|
958 | void setConsole (const CConsole &);
|
---|
959 |
|
---|
960 | private slots:
|
---|
961 |
|
---|
962 | void processAboutToShow();
|
---|
963 |
|
---|
964 | private:
|
---|
965 | bool event(QEvent *aEvent);
|
---|
966 |
|
---|
967 | QMap <QAction *, CUSBDevice> mUSBDevicesMap;
|
---|
968 | CConsole mConsole;
|
---|
969 | };
|
---|
970 |
|
---|
971 | /**
|
---|
972 | * Enable/Disable Menu class.
|
---|
973 | * This class provides enable/disable menu items.
|
---|
974 | */
|
---|
975 | class VBoxSwitchMenu : public QMenu
|
---|
976 | {
|
---|
977 | Q_OBJECT
|
---|
978 |
|
---|
979 | public:
|
---|
980 |
|
---|
981 | VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);
|
---|
982 |
|
---|
983 | void setToolTip (const QString &);
|
---|
984 |
|
---|
985 | private slots:
|
---|
986 |
|
---|
987 | void processAboutToShow();
|
---|
988 |
|
---|
989 | private:
|
---|
990 |
|
---|
991 | QAction *mAction;
|
---|
992 | bool mInverted;
|
---|
993 | };
|
---|
994 |
|
---|
995 | #endif /* __VBoxGlobal_h__ */
|
---|