1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxGlobal class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 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 |
|
---|
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 | class QLabel;
|
---|
47 | class QToolButton;
|
---|
48 |
|
---|
49 | // Auxiliary types
|
---|
50 | ////////////////////////////////////////////////////////////////////////////////
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Media descriptor for the GUI.
|
---|
54 | *
|
---|
55 | * Maintains the results of the last state (accessibility) check and precomposes
|
---|
56 | * string parameters such as location, size which can be used in various GUI
|
---|
57 | * controls.
|
---|
58 | *
|
---|
59 | * Many getter methods take the boolean @a aNoDiffs argument. Unless explicitly
|
---|
60 | * stated otherwise, this argument, when set to @c true, will cause the
|
---|
61 | * corresponding property of this object's root medium to be returned instead of
|
---|
62 | * its own one. This is useful when hard disk media is represented in the
|
---|
63 | * user-friendly "don't show diffs" mode. For non-hard disk media, the value of
|
---|
64 | * this argument is irrelevant because the root object for such medium is
|
---|
65 | * the medium itself.
|
---|
66 | *
|
---|
67 | * Note that this class "abuses" the KMediaState_NotCreated state value to
|
---|
68 | * indicate that the accessibility check of the given medium (see
|
---|
69 | * #blockAndQueryState()) has not been done yet and therefore some parameters
|
---|
70 | * such as #size() are meaningless because they can be read only from the
|
---|
71 | * accessible medium. The real KMediaState_NotCreated state is not necessary
|
---|
72 | * because this class is only used with created (existing) media.
|
---|
73 | */
|
---|
74 | class VBoxMedium
|
---|
75 | {
|
---|
76 | public:
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Creates a null medium descriptor which is not associated with any medium.
|
---|
80 | * The state field is set to KMediaState_NotCreated.
|
---|
81 | */
|
---|
82 | VBoxMedium()
|
---|
83 | : mType (VBoxDefs::MediaType_Invalid)
|
---|
84 | , mState (KMediaState_NotCreated)
|
---|
85 | , mIsReadOnly (false), mIsUsedInSnapshots (false)
|
---|
86 | , mParent (NULL) {}
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Creates a media descriptor associated with the given medium.
|
---|
90 | *
|
---|
91 | * The state field remain KMediaState_NotCreated until #blockAndQueryState()
|
---|
92 | * is called. All precomposed strings are filled up by implicitly calling
|
---|
93 | * #refresh(), see the #refresh() details for more info.
|
---|
94 | *
|
---|
95 | * One of the hardDisk, dvdImage, or floppyImage members is assigned from
|
---|
96 | * aMedium according to aType. @a aParent must be always NULL for non-hard
|
---|
97 | * disk media.
|
---|
98 | */
|
---|
99 | VBoxMedium (const CMedium &aMedium, VBoxDefs::MediaType aType,
|
---|
100 | VBoxMedium *aParent = NULL)
|
---|
101 | : mMedium (aMedium), mType (aType)
|
---|
102 | , mState (KMediaState_NotCreated)
|
---|
103 | , mIsReadOnly (false), mIsUsedInSnapshots (false)
|
---|
104 | , mParent (aParent) { init(); }
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Similar to the other non-null constructor but sets the media state to
|
---|
108 | * @a aState. Suitable when the media state is known such as right after
|
---|
109 | * creation.
|
---|
110 | */
|
---|
111 | VBoxMedium (const CMedium &aMedium, VBoxDefs::MediaType aType,
|
---|
112 | KMediaState aState)
|
---|
113 | : mMedium (aMedium), mType (aType)
|
---|
114 | , mState (aState)
|
---|
115 | , mIsReadOnly (false), mIsUsedInSnapshots (false)
|
---|
116 | , mParent (NULL) { init(); }
|
---|
117 |
|
---|
118 | void blockAndQueryState();
|
---|
119 | void refresh();
|
---|
120 |
|
---|
121 | const CMedium &medium() const { return mMedium; };
|
---|
122 |
|
---|
123 | VBoxDefs::MediaType type() const { return mType; }
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * Media state. In "don't show diffs" mode, this is the worst state (in
|
---|
127 | * terms of inaccessibility) detected on the given hard disk chain.
|
---|
128 | *
|
---|
129 | * @param aNoDiffs @c true to enable user-friendly "don't show diffs" mode.
|
---|
130 | */
|
---|
131 | KMediaState state (bool aNoDiffs = false) const
|
---|
132 | {
|
---|
133 | unconst (this)->checkNoDiffs (aNoDiffs);
|
---|
134 | return aNoDiffs ? mNoDiffs.state : mState;
|
---|
135 | }
|
---|
136 |
|
---|
137 | QString lastAccessError() const { return mLastAccessError; }
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * Result of the last blockAndQueryState() call. Will indicate an error and
|
---|
141 | * contain a proper error info if the last state check fails. In "don't show
|
---|
142 | * diffs" mode, this is the worst result (in terms of inaccessibility)
|
---|
143 | * detected on the given hard disk chain.
|
---|
144 | *
|
---|
145 | * @param aNoDiffs @c true to enable user-friendly "don't show diffs" mode.
|
---|
146 | */
|
---|
147 | const COMResult &result (bool aNoDiffs = false) const
|
---|
148 | {
|
---|
149 | unconst (this)->checkNoDiffs (aNoDiffs);
|
---|
150 | return aNoDiffs ? mNoDiffs.result : mResult;
|
---|
151 | }
|
---|
152 |
|
---|
153 | const CHardDisk2 &hardDisk() const { return mHardDisk; }
|
---|
154 | const CDVDImage2 &dvdImage() const { return mDVDImage; }
|
---|
155 | const CFloppyImage2 &floppyImage() const { return mFloppyImage; }
|
---|
156 |
|
---|
157 | QUuid id() const { return mId; }
|
---|
158 |
|
---|
159 | QString location (bool aNoDiffs = false) const
|
---|
160 | { return aNoDiffs ? root().mLocation : mLocation; }
|
---|
161 | QString name (bool aNoDiffs = false) const
|
---|
162 | { return aNoDiffs ? root().mName : mName; }
|
---|
163 |
|
---|
164 | QString size (bool aNoDiffs = false) const
|
---|
165 | { return aNoDiffs ? root().mSize : mSize; }
|
---|
166 |
|
---|
167 | QString hardDiskFormat (bool aNoDiffs = false) const
|
---|
168 | { return aNoDiffs ? root().mHardDiskFormat : mHardDiskFormat; }
|
---|
169 | QString hardDiskType (bool aNoDiffs = false) const
|
---|
170 | { return aNoDiffs ? root().mHardDiskType : mHardDiskType; }
|
---|
171 | QString logicalSize (bool aNoDiffs = false) const
|
---|
172 | { return aNoDiffs ? root().mLogicalSize : mLogicalSize; }
|
---|
173 |
|
---|
174 | QString usage (bool aNoDiffs = false) const
|
---|
175 | { return aNoDiffs ? root().mUsage : mUsage; }
|
---|
176 |
|
---|
177 | /**
|
---|
178 | * Returns @c true if this medium is read-only (either because it is
|
---|
179 | * Immutable or because it has child hard disks). Read-only media can only
|
---|
180 | * be attached indirectly.
|
---|
181 | */
|
---|
182 | bool isReadOnly() const { return mIsReadOnly; }
|
---|
183 |
|
---|
184 | /**
|
---|
185 | * Returns @c true if this medium is attached to any VM (in the current
|
---|
186 | * state or in a snapshot) in which case #usage() will contain a string with
|
---|
187 | * comma-sparated VM names (with snapshot names, if any, in parenthesis).
|
---|
188 | */
|
---|
189 | bool isUsed() const { return !mUsage.isNull(); }
|
---|
190 |
|
---|
191 | /**
|
---|
192 | * Returns @c true if this medium is attached to any VM in any snapshot.
|
---|
193 | * which case #usage() will contain a string with comma-sparated VM names.
|
---|
194 | */
|
---|
195 | bool isUsedInSnapshots() const { return mIsUsedInSnapshots; }
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * Returns @c true if this medium is attached to the given machine in the
|
---|
199 | * current state.
|
---|
200 | */
|
---|
201 | bool isAttachedInCurStateTo (const QUuid &aMachineId) const
|
---|
202 | { return mCurStateMachineIds.findIndex (aMachineId) >= 0; }
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * Returns a vector of IDs of all machines this medium is attached
|
---|
206 | * to in their current state (i.e. excluding snapshots).
|
---|
207 | */
|
---|
208 | const QValueList <QUuid> &curStateMachineIds() const
|
---|
209 | { return mCurStateMachineIds; }
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * Returns a parent medium. For non-hard disk media, this is always NULL.
|
---|
213 | */
|
---|
214 | VBoxMedium *parent() const { return mParent; }
|
---|
215 |
|
---|
216 | VBoxMedium &root() const;
|
---|
217 |
|
---|
218 | QString toolTip(bool aNoDiffs = false, bool aCheckRO = false) const;
|
---|
219 | QPixmap icon (bool aNoDiffs = false, bool aCheckRO = false) const;
|
---|
220 |
|
---|
221 | /** Shortcut to <tt>#toolTip (aNoDiffs, true)</tt>. */
|
---|
222 | QString toolTipCheckRO (bool aNoDiffs = false) const
|
---|
223 | { return toolTip (aNoDiffs, true); }
|
---|
224 |
|
---|
225 | /** Shortcut to <tt>#icon (aNoDiffs, true)</tt>. */
|
---|
226 | QPixmap iconCheckRO (bool aNoDiffs = false) const
|
---|
227 | { return icon (aNoDiffs, true); }
|
---|
228 |
|
---|
229 | QString details (bool aNoDiffs = false, bool aPredictDiff = false,
|
---|
230 | bool aUseHTML = false) const;
|
---|
231 |
|
---|
232 | /** Shortcut to <tt>#details (aNoDiffs, aPredictDiff, true)</tt>. */
|
---|
233 | QString detailsHTML (bool aNoDiffs = false, bool aPredictDiff = false) const
|
---|
234 | { return details (aNoDiffs, aPredictDiff, true); }
|
---|
235 |
|
---|
236 | /** Returns @c true if this media descriptor is a null object. */
|
---|
237 | bool isNull() const { return mMedium.isNull(); }
|
---|
238 |
|
---|
239 | private:
|
---|
240 |
|
---|
241 | void init();
|
---|
242 |
|
---|
243 | void checkNoDiffs (bool aNoDiffs);
|
---|
244 |
|
---|
245 | CMedium mMedium;
|
---|
246 |
|
---|
247 | VBoxDefs::MediaType mType;
|
---|
248 |
|
---|
249 | KMediaState mState;
|
---|
250 | QString mLastAccessError;
|
---|
251 | COMResult mResult;
|
---|
252 |
|
---|
253 | CHardDisk2 mHardDisk;
|
---|
254 | CDVDImage2 mDVDImage;
|
---|
255 | CFloppyImage2 mFloppyImage;
|
---|
256 |
|
---|
257 | QUuid mId;
|
---|
258 | QString mLocation;
|
---|
259 | QString mName;
|
---|
260 | QString mSize;
|
---|
261 |
|
---|
262 | QString mHardDiskFormat;
|
---|
263 | QString mHardDiskType;
|
---|
264 | QString mLogicalSize;
|
---|
265 |
|
---|
266 | QString mUsage;
|
---|
267 | QString mToolTip;
|
---|
268 |
|
---|
269 | bool mIsReadOnly : 1;
|
---|
270 | bool mIsUsedInSnapshots : 1;
|
---|
271 |
|
---|
272 | QValueList <QUuid> mCurStateMachineIds;
|
---|
273 |
|
---|
274 | VBoxMedium *mParent;
|
---|
275 |
|
---|
276 | /**
|
---|
277 | * Used to override some attributes in the user-friendly "don't show diffs"
|
---|
278 | * mode.
|
---|
279 | */
|
---|
280 | struct NoDiffs
|
---|
281 | {
|
---|
282 | NoDiffs() : isSet (false), state (KMediaState_NotCreated) {}
|
---|
283 |
|
---|
284 | bool isSet : 1;
|
---|
285 |
|
---|
286 | KMediaState state;
|
---|
287 | COMResult result;
|
---|
288 | QString toolTip;
|
---|
289 | }
|
---|
290 | mNoDiffs;
|
---|
291 | };
|
---|
292 |
|
---|
293 | typedef QValueList <VBoxMedium> VBoxMediaList;
|
---|
294 |
|
---|
295 | // VirtualBox callback events
|
---|
296 | ////////////////////////////////////////////////////////////////////////////////
|
---|
297 |
|
---|
298 | class VBoxMachineStateChangeEvent : public QEvent
|
---|
299 | {
|
---|
300 | public:
|
---|
301 | VBoxMachineStateChangeEvent (const QUuid &aId, KMachineState aState)
|
---|
302 | : QEvent ((QEvent::Type) VBoxDefs::MachineStateChangeEventType)
|
---|
303 | , id (aId), state (aState)
|
---|
304 | {}
|
---|
305 |
|
---|
306 | const QUuid id;
|
---|
307 | const KMachineState state;
|
---|
308 | };
|
---|
309 |
|
---|
310 | class VBoxMachineDataChangeEvent : public QEvent
|
---|
311 | {
|
---|
312 | public:
|
---|
313 | VBoxMachineDataChangeEvent (const QUuid &aId)
|
---|
314 | : QEvent ((QEvent::Type) VBoxDefs::MachineDataChangeEventType)
|
---|
315 | , id (aId)
|
---|
316 | {}
|
---|
317 |
|
---|
318 | const QUuid id;
|
---|
319 | };
|
---|
320 |
|
---|
321 | class VBoxMachineRegisteredEvent : public QEvent
|
---|
322 | {
|
---|
323 | public:
|
---|
324 | VBoxMachineRegisteredEvent (const QUuid &aId, bool aRegistered)
|
---|
325 | : QEvent ((QEvent::Type) VBoxDefs::MachineRegisteredEventType)
|
---|
326 | , id (aId), registered (aRegistered)
|
---|
327 | {}
|
---|
328 |
|
---|
329 | const QUuid id;
|
---|
330 | const bool registered;
|
---|
331 | };
|
---|
332 |
|
---|
333 | class VBoxSessionStateChangeEvent : public QEvent
|
---|
334 | {
|
---|
335 | public:
|
---|
336 | VBoxSessionStateChangeEvent (const QUuid &aId, KSessionState aState)
|
---|
337 | : QEvent ((QEvent::Type) VBoxDefs::SessionStateChangeEventType)
|
---|
338 | , id (aId), state (aState)
|
---|
339 | {}
|
---|
340 |
|
---|
341 | const QUuid id;
|
---|
342 | const KSessionState state;
|
---|
343 | };
|
---|
344 |
|
---|
345 | class VBoxSnapshotEvent : public QEvent
|
---|
346 | {
|
---|
347 | public:
|
---|
348 |
|
---|
349 | enum What { Taken, Discarded, Changed };
|
---|
350 |
|
---|
351 | VBoxSnapshotEvent (const QUuid &aMachineId, const QUuid &aSnapshotId,
|
---|
352 | What aWhat)
|
---|
353 | : QEvent ((QEvent::Type) VBoxDefs::SnapshotEventType)
|
---|
354 | , what (aWhat)
|
---|
355 | , machineId (aMachineId), snapshotId (aSnapshotId)
|
---|
356 | {}
|
---|
357 |
|
---|
358 | const What what;
|
---|
359 |
|
---|
360 | const QUuid machineId;
|
---|
361 | const QUuid snapshotId;
|
---|
362 | };
|
---|
363 |
|
---|
364 | class VBoxCanShowRegDlgEvent : public QEvent
|
---|
365 | {
|
---|
366 | public:
|
---|
367 | VBoxCanShowRegDlgEvent (bool aCanShow)
|
---|
368 | : QEvent ((QEvent::Type) VBoxDefs::CanShowRegDlgEventType)
|
---|
369 | , mCanShow (aCanShow)
|
---|
370 | {}
|
---|
371 |
|
---|
372 | const bool mCanShow;
|
---|
373 | };
|
---|
374 |
|
---|
375 | // VBoxGlobal
|
---|
376 | ////////////////////////////////////////////////////////////////////////////////
|
---|
377 |
|
---|
378 | class VBoxSelectorWnd;
|
---|
379 | class VBoxConsoleWnd;
|
---|
380 | class VBoxRegistrationDlg;
|
---|
381 |
|
---|
382 | class VBoxGlobal : public QObject
|
---|
383 | {
|
---|
384 | Q_OBJECT
|
---|
385 |
|
---|
386 | public:
|
---|
387 |
|
---|
388 | typedef QMap <ulong, QString> QULongStringMap;
|
---|
389 | typedef QMap <long, QString> QLongStringMap;
|
---|
390 |
|
---|
391 | static VBoxGlobal &instance();
|
---|
392 |
|
---|
393 | bool isValid() { return mValid; }
|
---|
394 |
|
---|
395 | QString versionString() { return verString; }
|
---|
396 |
|
---|
397 | CVirtualBox virtualBox() const { return mVBox; }
|
---|
398 |
|
---|
399 | const VBoxGlobalSettings &settings() const { return gset; }
|
---|
400 | bool setSettings (const VBoxGlobalSettings &gs);
|
---|
401 |
|
---|
402 | VBoxSelectorWnd &selectorWnd();
|
---|
403 | VBoxConsoleWnd &consoleWnd();
|
---|
404 |
|
---|
405 | bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
|
---|
406 | QUuid managedVMUuid() const { return vmUuid; }
|
---|
407 |
|
---|
408 | VBoxDefs::RenderMode vmRenderMode() const { return vm_render_mode; }
|
---|
409 | const char *vmRenderModeStr() const { return vm_render_mode_str; }
|
---|
410 |
|
---|
411 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
412 | bool isDebuggerEnabled() const { return dbg_enabled; }
|
---|
413 | bool isDebuggerVisibleAtStartup() const { return dbg_visible_at_startup; }
|
---|
414 | #endif
|
---|
415 |
|
---|
416 | /* VBox enum to/from string/icon/color convertors */
|
---|
417 |
|
---|
418 | QStringList vmGuestOSTypeDescriptions() const;
|
---|
419 | CGuestOSType vmGuestOSType (int aIndex) const;
|
---|
420 | int vmGuestOSTypeIndex (const QString &aId) const;
|
---|
421 | QPixmap vmGuestOSTypeIcon (const QString &aId) const;
|
---|
422 | QString vmGuestOSTypeDescription (const QString &aId) const;
|
---|
423 |
|
---|
424 | QPixmap toIcon (KMachineState s) const
|
---|
425 | {
|
---|
426 | QPixmap *pm = mStateIcons [s];
|
---|
427 | AssertMsg (pm, ("Icon for VM state %d must be defined", s));
|
---|
428 | return pm ? *pm : QPixmap();
|
---|
429 | }
|
---|
430 |
|
---|
431 | const QColor &toColor (KMachineState s) const
|
---|
432 | {
|
---|
433 | static const QColor none;
|
---|
434 | AssertMsg (vm_state_color.find (s), ("No color for %d", s));
|
---|
435 | return vm_state_color.find (s) ? *vm_state_color [s] : none;
|
---|
436 | }
|
---|
437 |
|
---|
438 | QString toString (KMachineState s) const
|
---|
439 | {
|
---|
440 | AssertMsg (!machineStates [s].isNull(), ("No text for %d", s));
|
---|
441 | return machineStates [s];
|
---|
442 | }
|
---|
443 |
|
---|
444 | QString toString (KSessionState s) const
|
---|
445 | {
|
---|
446 | AssertMsg (!sessionStates [s].isNull(), ("No text for %d", s));
|
---|
447 | return sessionStates [s];
|
---|
448 | }
|
---|
449 |
|
---|
450 | /**
|
---|
451 | * Returns a string representation of the given KStorageBus enum value.
|
---|
452 | * Complementary to #toStorageBusType (const QString &) const.
|
---|
453 | */
|
---|
454 | QString toString (KStorageBus aBus) const
|
---|
455 | {
|
---|
456 | AssertMsg (!storageBuses [aBus].isNull(), ("No text for %d", aBus));
|
---|
457 | return storageBuses [aBus];
|
---|
458 | }
|
---|
459 |
|
---|
460 | /**
|
---|
461 | * Returns a KStorageBus enum value corresponding to the given string
|
---|
462 | * representation. Complementary to #toString (KStorageBus) const.
|
---|
463 | */
|
---|
464 | KStorageBus toStorageBusType (const QString &aBus) const
|
---|
465 | {
|
---|
466 | QULongStringMap::const_iterator it =
|
---|
467 | qFind (storageBuses.begin(), storageBuses.end(), aBus);
|
---|
468 | AssertMsg (it != storageBuses.end(), ("No value for {%s}", aBus.latin1()));
|
---|
469 | return KStorageBus (it.key());
|
---|
470 | }
|
---|
471 |
|
---|
472 | QString toString (KStorageBus aBus, LONG aChannel) const;
|
---|
473 | LONG toStorageChannel (KStorageBus aBus, const QString &aChannel) const;
|
---|
474 |
|
---|
475 | QString toString (KStorageBus aBus, LONG aChannel, LONG aDevice) const;
|
---|
476 | LONG toStorageDevice (KStorageBus aBus, LONG aChannel, const QString &aDevice) const;
|
---|
477 |
|
---|
478 | QString toFullString (KStorageBus aBus, LONG aChannel, LONG aDevice) const;
|
---|
479 |
|
---|
480 | QString toString (KHardDiskType t) const
|
---|
481 | {
|
---|
482 | AssertMsg (!diskTypes [t].isNull(), ("No text for %d", t));
|
---|
483 | return diskTypes [t];
|
---|
484 | }
|
---|
485 |
|
---|
486 | /**
|
---|
487 | * Similar to toString (KHardDiskType), but returns 'Differencing' for
|
---|
488 | * normal hard disks that have a parent.
|
---|
489 | */
|
---|
490 | QString hardDiskTypeString (const CHardDisk2 &aHD) const
|
---|
491 | {
|
---|
492 | if (!aHD.GetParent().isNull())
|
---|
493 | {
|
---|
494 | Assert (aHD.GetType() == KHardDiskType_Normal);
|
---|
495 | return diskTypes_Differencing;
|
---|
496 | }
|
---|
497 | return toString (aHD.GetType());
|
---|
498 | }
|
---|
499 |
|
---|
500 | QString toString (KVRDPAuthType t) const
|
---|
501 | {
|
---|
502 | AssertMsg (!vrdpAuthTypes [t].isNull(), ("No text for %d", t));
|
---|
503 | return vrdpAuthTypes [t];
|
---|
504 | }
|
---|
505 |
|
---|
506 | QString toString (KPortMode t) const
|
---|
507 | {
|
---|
508 | AssertMsg (!portModeTypes [t].isNull(), ("No text for %d", t));
|
---|
509 | return portModeTypes [t];
|
---|
510 | }
|
---|
511 |
|
---|
512 | QString toString (KUSBDeviceFilterAction t) const
|
---|
513 | {
|
---|
514 | AssertMsg (!usbFilterActionTypes [t].isNull(), ("No text for %d", t));
|
---|
515 | return usbFilterActionTypes [t];
|
---|
516 | }
|
---|
517 |
|
---|
518 | QString toString (KClipboardMode t) const
|
---|
519 | {
|
---|
520 | AssertMsg (!clipboardTypes [t].isNull(), ("No text for %d", t));
|
---|
521 | return clipboardTypes [t];
|
---|
522 | }
|
---|
523 |
|
---|
524 | KClipboardMode toClipboardModeType (const QString &s) const
|
---|
525 | {
|
---|
526 | QULongStringMap::const_iterator it =
|
---|
527 | qFind (clipboardTypes.begin(), clipboardTypes.end(), s);
|
---|
528 | AssertMsg (it != clipboardTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
529 | return KClipboardMode (it.key());
|
---|
530 | }
|
---|
531 |
|
---|
532 | QString toString (KIDEControllerType t) const
|
---|
533 | {
|
---|
534 | AssertMsg (!ideControllerTypes [t].isNull(), ("No text for %d", t));
|
---|
535 | return ideControllerTypes [t];
|
---|
536 | }
|
---|
537 |
|
---|
538 | KIDEControllerType toIDEControllerType (const QString &s) const
|
---|
539 | {
|
---|
540 | QULongStringMap::const_iterator it =
|
---|
541 | qFind (ideControllerTypes.begin(), ideControllerTypes.end(), s);
|
---|
542 | AssertMsg (it != ideControllerTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
543 | return KIDEControllerType (it.key());
|
---|
544 | }
|
---|
545 |
|
---|
546 | KVRDPAuthType toVRDPAuthType (const QString &s) const
|
---|
547 | {
|
---|
548 | QULongStringMap::const_iterator it =
|
---|
549 | qFind (vrdpAuthTypes.begin(), vrdpAuthTypes.end(), s);
|
---|
550 | AssertMsg (it != vrdpAuthTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
551 | return KVRDPAuthType (it.key());
|
---|
552 | }
|
---|
553 |
|
---|
554 | KPortMode toPortMode (const QString &s) const
|
---|
555 | {
|
---|
556 | QULongStringMap::const_iterator it =
|
---|
557 | qFind (portModeTypes.begin(), portModeTypes.end(), s);
|
---|
558 | AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
559 | return KPortMode (it.key());
|
---|
560 | }
|
---|
561 |
|
---|
562 | KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
|
---|
563 | {
|
---|
564 | QULongStringMap::const_iterator it =
|
---|
565 | qFind (usbFilterActionTypes.begin(), usbFilterActionTypes.end(), s);
|
---|
566 | AssertMsg (it != usbFilterActionTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
567 | return KUSBDeviceFilterAction (it.key());
|
---|
568 | }
|
---|
569 |
|
---|
570 | QString toString (KDeviceType t) const
|
---|
571 | {
|
---|
572 | AssertMsg (!deviceTypes [t].isNull(), ("No text for %d", t));
|
---|
573 | return deviceTypes [t];
|
---|
574 | }
|
---|
575 |
|
---|
576 | KDeviceType toDeviceType (const QString &s) const
|
---|
577 | {
|
---|
578 | QULongStringMap::const_iterator it =
|
---|
579 | qFind (deviceTypes.begin(), deviceTypes.end(), s);
|
---|
580 | AssertMsg (it != deviceTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
581 | return KDeviceType (it.key());
|
---|
582 | }
|
---|
583 |
|
---|
584 | QStringList deviceTypeStrings() const;
|
---|
585 |
|
---|
586 | QString toString (KAudioDriverType t) const
|
---|
587 | {
|
---|
588 | AssertMsg (!audioDriverTypes [t].isNull(), ("No text for %d", t));
|
---|
589 | return audioDriverTypes [t];
|
---|
590 | }
|
---|
591 |
|
---|
592 | KAudioDriverType toAudioDriverType (const QString &s) const
|
---|
593 | {
|
---|
594 | QULongStringMap::const_iterator it =
|
---|
595 | qFind (audioDriverTypes.begin(), audioDriverTypes.end(), s);
|
---|
596 | AssertMsg (it != audioDriverTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
597 | return KAudioDriverType (it.key());
|
---|
598 | }
|
---|
599 |
|
---|
600 | QString toString (KAudioControllerType t) const
|
---|
601 | {
|
---|
602 | AssertMsg (!audioControllerTypes [t].isNull(), ("No text for %d", t));
|
---|
603 | return audioControllerTypes [t];
|
---|
604 | }
|
---|
605 |
|
---|
606 | KAudioControllerType toAudioControllerType (const QString &s) const
|
---|
607 | {
|
---|
608 | QULongStringMap::const_iterator it =
|
---|
609 | qFind (audioControllerTypes.begin(), audioControllerTypes.end(), s);
|
---|
610 | AssertMsg (it != audioControllerTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
611 | return KAudioControllerType (it.key());
|
---|
612 | }
|
---|
613 |
|
---|
614 | QString toString (KNetworkAdapterType t) const
|
---|
615 | {
|
---|
616 | AssertMsg (!networkAdapterTypes [t].isNull(), ("No text for %d", t));
|
---|
617 | return networkAdapterTypes [t];
|
---|
618 | }
|
---|
619 |
|
---|
620 | KNetworkAdapterType toNetworkAdapterType (const QString &s) const
|
---|
621 | {
|
---|
622 | QULongStringMap::const_iterator it =
|
---|
623 | qFind (networkAdapterTypes.begin(), networkAdapterTypes.end(), s);
|
---|
624 | AssertMsg (it != networkAdapterTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
625 | return KNetworkAdapterType (it.key());
|
---|
626 | }
|
---|
627 |
|
---|
628 | QString toString (KNetworkAttachmentType t) const
|
---|
629 | {
|
---|
630 | AssertMsg (!networkAttachmentTypes [t].isNull(), ("No text for %d", t));
|
---|
631 | return networkAttachmentTypes [t];
|
---|
632 | }
|
---|
633 |
|
---|
634 | KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
|
---|
635 | {
|
---|
636 | QULongStringMap::const_iterator it =
|
---|
637 | qFind (networkAttachmentTypes.begin(), networkAttachmentTypes.end(), s);
|
---|
638 | AssertMsg (it != networkAttachmentTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
639 | return KNetworkAttachmentType (it.key());
|
---|
640 | }
|
---|
641 |
|
---|
642 | QString toString (KUSBDeviceState aState) const
|
---|
643 | {
|
---|
644 | AssertMsg (!USBDeviceStates [aState].isNull(), ("No text for %d", aState));
|
---|
645 | return USBDeviceStates [aState];
|
---|
646 | }
|
---|
647 |
|
---|
648 | QStringList COMPortNames() const;
|
---|
649 | QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
650 | bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
651 |
|
---|
652 | QStringList LPTPortNames() const;
|
---|
653 | QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
654 | bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
655 |
|
---|
656 | QPixmap snapshotIcon (bool online) const
|
---|
657 | {
|
---|
658 | return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
|
---|
659 | }
|
---|
660 |
|
---|
661 | QPixmap warningIcon() const { return mWarningIcon; }
|
---|
662 | QPixmap errorIcon() const { return mErrorIcon; }
|
---|
663 |
|
---|
664 | /* details generators */
|
---|
665 |
|
---|
666 | QString details (const CHardDisk2 &aHD, bool aPredictDiff);
|
---|
667 |
|
---|
668 | QString details (const CUSBDevice &aDevice) const;
|
---|
669 | QString toolTip (const CUSBDevice &aDevice) const;
|
---|
670 |
|
---|
671 | QString detailsReport (const CMachine &aMachine, bool aIsNewVM,
|
---|
672 | bool aWithLinks);
|
---|
673 |
|
---|
674 | /* VirtualBox helpers */
|
---|
675 |
|
---|
676 | #ifdef Q_WS_X11
|
---|
677 | bool showVirtualBoxLicense();
|
---|
678 | #endif
|
---|
679 |
|
---|
680 | bool checkForAutoConvertedSettings();
|
---|
681 |
|
---|
682 | CSession openSession (const QUuid &aId, bool aExisting = false);
|
---|
683 |
|
---|
684 | /** Shortcut to openSession (aId, true). */
|
---|
685 | CSession openExistingSession (const QUuid &aId) { return openSession (aId, true); }
|
---|
686 |
|
---|
687 | bool startMachine (const QUuid &id);
|
---|
688 |
|
---|
689 | void startEnumeratingMedia();
|
---|
690 |
|
---|
691 | /**
|
---|
692 | * Returns a list of all currently registered media. This list is used to
|
---|
693 | * globally track the accessiblity state of all media on a dedicated thread.
|
---|
694 | *
|
---|
695 | * Note that the media list is initially empty (i.e. before the enumeration
|
---|
696 | * process is started for the first time using #startEnumeratingMedia()).
|
---|
697 | * See #startEnumeratingMedia() for more information about how meida are
|
---|
698 | * sorted in the returned list.
|
---|
699 | */
|
---|
700 | const VBoxMediaList ¤tMediaList() const { return mMediaList; }
|
---|
701 |
|
---|
702 | /** Returns true if the media enumeration is in progress. */
|
---|
703 | bool isMediaEnumerationStarted() const { return mMediaEnumThread != NULL; }
|
---|
704 |
|
---|
705 | void addMedium (const VBoxMedium &);
|
---|
706 | void updateMedium (const VBoxMedium &);
|
---|
707 | void removeMedium (VBoxDefs::MediaType, const QUuid &);
|
---|
708 |
|
---|
709 | bool findMedium (const CMedium &, VBoxMedium &) const;
|
---|
710 |
|
---|
711 | /** Compact version of #findMediumTo(). Asserts if not found. */
|
---|
712 | VBoxMedium getMedium (const CMedium &aObj) const
|
---|
713 | {
|
---|
714 | VBoxMedium medium;
|
---|
715 | if (!findMedium (aObj, medium))
|
---|
716 | AssertFailed();
|
---|
717 | return medium;
|
---|
718 | }
|
---|
719 |
|
---|
720 | /* various helpers */
|
---|
721 |
|
---|
722 | QString languageName() const;
|
---|
723 | QString languageCountry() const;
|
---|
724 | QString languageNameEnglish() const;
|
---|
725 | QString languageCountryEnglish() const;
|
---|
726 | QString languageTranslators() const;
|
---|
727 |
|
---|
728 | void languageChange();
|
---|
729 |
|
---|
730 | /** @internal made public for internal purposes */
|
---|
731 | void cleanup();
|
---|
732 |
|
---|
733 | /* public static stuff */
|
---|
734 |
|
---|
735 | static bool isDOSType (const QString &aOSTypeId);
|
---|
736 |
|
---|
737 | static void adoptLabelPixmap (QLabel *);
|
---|
738 |
|
---|
739 | static QString languageId();
|
---|
740 | static void loadLanguage (const QString &aLangId = QString::null);
|
---|
741 |
|
---|
742 | static QIconSet iconSet (const char *aNormal,
|
---|
743 | const char *aDisabled = 0,
|
---|
744 | const char *aActive = 0);
|
---|
745 | static QIconSet iconSetEx (const char *aNormal, const char *aSmallNormal,
|
---|
746 | const char *aDisabled = 0, const char *aSmallDisabled = 0,
|
---|
747 | const char *aActive = 0, const char *aSmallActive = 0);
|
---|
748 |
|
---|
749 | static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel);
|
---|
750 |
|
---|
751 | static QRect normalizeGeometry (const QRect &aRect, const QRect &aBoundRect,
|
---|
752 | bool aCanResize = true);
|
---|
753 |
|
---|
754 | static void centerWidget (QWidget *aWidget, QWidget *aRelative,
|
---|
755 | bool aCanResize = true);
|
---|
756 |
|
---|
757 | static QChar decimalSep();
|
---|
758 | static QString sizeRegexp();
|
---|
759 |
|
---|
760 | static Q_UINT64 parseSize (const QString &);
|
---|
761 | static QString formatSize (Q_UINT64, int aMode = 0);
|
---|
762 |
|
---|
763 | static QString locationForHTML (const QString &aFileName);
|
---|
764 |
|
---|
765 | static QString highlight (const QString &aStr, bool aToolTip = false);
|
---|
766 |
|
---|
767 | static QString systemLanguageId();
|
---|
768 |
|
---|
769 | static QString getExistingDirectory (const QString &aDir, QWidget *aParent,
|
---|
770 | const char *aName = 0,
|
---|
771 | const QString &aCaption = QString::null,
|
---|
772 | bool aDirOnly = TRUE,
|
---|
773 | bool resolveSymlinks = TRUE);
|
---|
774 |
|
---|
775 | static QString getOpenFileName (const QString &, const QString &, QWidget*,
|
---|
776 | const char*, const QString &,
|
---|
777 | QString *defaultFilter = 0,
|
---|
778 | bool resolveSymLinks = true);
|
---|
779 |
|
---|
780 | static QString getFirstExistingDir (const QString &);
|
---|
781 |
|
---|
782 | static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
|
---|
783 |
|
---|
784 | static QString removeAccelMark (const QString &aText);
|
---|
785 |
|
---|
786 | static QPixmap joinPixmaps (const QPixmap &aPM1, const QPixmap &aPM2);
|
---|
787 |
|
---|
788 | static QWidget *findWidget (QWidget *aParent, const char *aName,
|
---|
789 | const char *aClassName = NULL,
|
---|
790 | bool aRecursive = false);
|
---|
791 |
|
---|
792 | signals:
|
---|
793 |
|
---|
794 | /**
|
---|
795 | * Emitted at the beginning of the enumeration process started by
|
---|
796 | * #startEnumeratingMedia().
|
---|
797 | */
|
---|
798 | void mediaEnumStarted();
|
---|
799 |
|
---|
800 | /**
|
---|
801 | * Emitted when a new medium item from the list has updated its
|
---|
802 | * accessibility state.
|
---|
803 | */
|
---|
804 | void mediumEnumerated (const VBoxMedium &aMedum, int aIndex);
|
---|
805 |
|
---|
806 | /**
|
---|
807 | * Emitted at the end of the enumeration process started by
|
---|
808 | * #startEnumeratingMedia(). The @a aList argument is passed for
|
---|
809 | * convenience, it is exactly the same as returned by #currentMediaList().
|
---|
810 | */
|
---|
811 | void mediaEnumFinished (const VBoxMediaList &aList);
|
---|
812 |
|
---|
813 | /** Emitted when a new media is added using #addMedia(). */
|
---|
814 | void mediumAdded (const VBoxMedium &);
|
---|
815 |
|
---|
816 | /** Emitted when the media is updated using #updateMedia(). */
|
---|
817 | void mediumUpdated (const VBoxMedium &);
|
---|
818 |
|
---|
819 | /** Emitted when the media is removed using #removeMedia(). */
|
---|
820 | void mediumRemoved (VBoxDefs::MediaType, const QUuid &);
|
---|
821 |
|
---|
822 | /* signals emitted when the VirtualBox callback is called by the server
|
---|
823 | * (not that currently these signals are emitted only when the application
|
---|
824 | * is the in the VM selector mode) */
|
---|
825 |
|
---|
826 | void machineStateChanged (const VBoxMachineStateChangeEvent &e);
|
---|
827 | void machineDataChanged (const VBoxMachineDataChangeEvent &e);
|
---|
828 | void machineRegistered (const VBoxMachineRegisteredEvent &e);
|
---|
829 | void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
|
---|
830 | void snapshotChanged (const VBoxSnapshotEvent &e);
|
---|
831 |
|
---|
832 | void canShowRegDlg (bool aCanShow);
|
---|
833 |
|
---|
834 | public slots:
|
---|
835 |
|
---|
836 | bool openURL (const QString &aURL);
|
---|
837 |
|
---|
838 | void showRegistrationDialog (bool aForce = true);
|
---|
839 |
|
---|
840 | protected:
|
---|
841 |
|
---|
842 | bool event (QEvent *e);
|
---|
843 | bool eventFilter (QObject *, QEvent *);
|
---|
844 |
|
---|
845 | private:
|
---|
846 |
|
---|
847 | VBoxGlobal();
|
---|
848 | ~VBoxGlobal() {}
|
---|
849 |
|
---|
850 | void init();
|
---|
851 |
|
---|
852 | bool mValid;
|
---|
853 |
|
---|
854 | CVirtualBox mVBox;
|
---|
855 |
|
---|
856 | VBoxGlobalSettings gset;
|
---|
857 |
|
---|
858 | VBoxSelectorWnd *mSelectorWnd;
|
---|
859 | VBoxConsoleWnd *mConsoleWnd;
|
---|
860 |
|
---|
861 | #ifdef VBOX_WITH_REGISTRATION
|
---|
862 | VBoxRegistrationDlg *mRegDlg;
|
---|
863 | #endif
|
---|
864 |
|
---|
865 | QUuid vmUuid;
|
---|
866 |
|
---|
867 | QThread *mMediaEnumThread;
|
---|
868 | VBoxMediaList mMediaList;
|
---|
869 |
|
---|
870 | VBoxDefs::RenderMode vm_render_mode;
|
---|
871 | const char * vm_render_mode_str;
|
---|
872 |
|
---|
873 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
874 | bool dbg_enabled;
|
---|
875 | bool dbg_visible_at_startup;
|
---|
876 | #endif
|
---|
877 |
|
---|
878 | #if defined (Q_WS_WIN32)
|
---|
879 | DWORD dwHTMLHelpCookie;
|
---|
880 | #endif
|
---|
881 |
|
---|
882 | CVirtualBoxCallback callback;
|
---|
883 |
|
---|
884 | QString verString;
|
---|
885 |
|
---|
886 | QValueVector <CGuestOSType> vm_os_types;
|
---|
887 | QDict <QPixmap> vm_os_type_icons;
|
---|
888 | QIntDict <QColor> vm_state_color;
|
---|
889 |
|
---|
890 | QIntDict <QPixmap> mStateIcons;
|
---|
891 | QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
|
---|
892 |
|
---|
893 | QULongStringMap machineStates;
|
---|
894 | QULongStringMap sessionStates;
|
---|
895 | QULongStringMap deviceTypes;
|
---|
896 |
|
---|
897 | QULongStringMap storageBuses;
|
---|
898 | QLongStringMap storageBusDevices;
|
---|
899 | QLongStringMap storageBusChannels;
|
---|
900 |
|
---|
901 | QULongStringMap diskTypes;
|
---|
902 | QString diskTypes_Differencing;
|
---|
903 |
|
---|
904 | QULongStringMap vrdpAuthTypes;
|
---|
905 | QULongStringMap portModeTypes;
|
---|
906 | QULongStringMap usbFilterActionTypes;
|
---|
907 | QULongStringMap audioDriverTypes;
|
---|
908 | QULongStringMap audioControllerTypes;
|
---|
909 | QULongStringMap networkAdapterTypes;
|
---|
910 | QULongStringMap networkAttachmentTypes;
|
---|
911 | QULongStringMap clipboardTypes;
|
---|
912 | QULongStringMap ideControllerTypes;
|
---|
913 | QULongStringMap USBDeviceStates;
|
---|
914 |
|
---|
915 | QString mUserDefinedPortName;
|
---|
916 |
|
---|
917 | QPixmap mWarningIcon, mErrorIcon;
|
---|
918 |
|
---|
919 | mutable bool detailReportTemplatesReady;
|
---|
920 |
|
---|
921 | friend VBoxGlobal &vboxGlobal();
|
---|
922 | friend class VBoxCallback;
|
---|
923 | };
|
---|
924 |
|
---|
925 | inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); }
|
---|
926 |
|
---|
927 | // Helper classes
|
---|
928 | ////////////////////////////////////////////////////////////////////////////////
|
---|
929 |
|
---|
930 | /**
|
---|
931 | * Generic asyncronous event.
|
---|
932 | *
|
---|
933 | * This abstract class is intended to provide a conveinent way to execute
|
---|
934 | * code on the main GUI thread asynchronously to the calling party. This is
|
---|
935 | * done by putting necessary actions to the #handle() function in a subclass
|
---|
936 | * and then posting an instance of the subclass using #post(). The instance
|
---|
937 | * must be allocated on the heap using the <tt>new</tt> operation and will be
|
---|
938 | * automatically deleted after processing. Note that if you don't call #post()
|
---|
939 | * on the created instance, you have to delete it yourself.
|
---|
940 | */
|
---|
941 | class VBoxAsyncEvent : public QEvent
|
---|
942 | {
|
---|
943 | public:
|
---|
944 |
|
---|
945 | VBoxAsyncEvent() : QEvent ((QEvent::Type) VBoxDefs::AsyncEventType) {}
|
---|
946 |
|
---|
947 | /**
|
---|
948 | * Worker function. Gets executed on the GUI thread when the posted event
|
---|
949 | * is processed by the main event loop.
|
---|
950 | */
|
---|
951 | virtual void handle() = 0;
|
---|
952 |
|
---|
953 | /**
|
---|
954 | * Posts this event to the main event loop.
|
---|
955 | * The caller loses ownership of this object after this method returns
|
---|
956 | * and must not delete the object.
|
---|
957 | */
|
---|
958 | void post()
|
---|
959 | {
|
---|
960 | QApplication::postEvent (&vboxGlobal(), this);
|
---|
961 | }
|
---|
962 | };
|
---|
963 |
|
---|
964 | /**
|
---|
965 | * USB Popup Menu class.
|
---|
966 | * This class provides the list of USB devices attached to the host.
|
---|
967 | */
|
---|
968 | class VBoxUSBMenu : public QPopupMenu
|
---|
969 | {
|
---|
970 | Q_OBJECT
|
---|
971 |
|
---|
972 | public:
|
---|
973 |
|
---|
974 | enum { USBDevicesMenuNoDevicesId = 1 };
|
---|
975 |
|
---|
976 | VBoxUSBMenu (QWidget *);
|
---|
977 |
|
---|
978 | const CUSBDevice& getUSB (int);
|
---|
979 |
|
---|
980 | void setConsole (const CConsole &);
|
---|
981 |
|
---|
982 | private slots:
|
---|
983 |
|
---|
984 | void processAboutToShow();
|
---|
985 |
|
---|
986 | void processHighlighted (int);
|
---|
987 |
|
---|
988 | private:
|
---|
989 |
|
---|
990 | QMap <int, CUSBDevice> mUSBDevicesMap;
|
---|
991 | CConsole mConsole;
|
---|
992 | };
|
---|
993 |
|
---|
994 |
|
---|
995 | /**
|
---|
996 | * Enable/Disable Menu class.
|
---|
997 | * This class provides enable/disable menu items.
|
---|
998 | */
|
---|
999 | class VBoxSwitchMenu : public QPopupMenu
|
---|
1000 | {
|
---|
1001 | Q_OBJECT
|
---|
1002 |
|
---|
1003 | public:
|
---|
1004 |
|
---|
1005 | VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);
|
---|
1006 |
|
---|
1007 | void setToolTip (const QString &);
|
---|
1008 |
|
---|
1009 | private slots:
|
---|
1010 |
|
---|
1011 | void processAboutToShow();
|
---|
1012 |
|
---|
1013 | void processActivated (int);
|
---|
1014 |
|
---|
1015 | private:
|
---|
1016 |
|
---|
1017 | QAction *mAction;
|
---|
1018 | QString mTip;
|
---|
1019 | bool mInverted;
|
---|
1020 | };
|
---|
1021 |
|
---|
1022 | #endif /* __VBoxGlobal_h__ */
|
---|