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 | static VBoxGlobal &instance();
|
---|
389 |
|
---|
390 | bool isValid() { return mValid; }
|
---|
391 |
|
---|
392 | QString versionString() { return verString; }
|
---|
393 |
|
---|
394 | CVirtualBox virtualBox() const { return mVBox; }
|
---|
395 |
|
---|
396 | const VBoxGlobalSettings &settings() const { return gset; }
|
---|
397 | bool setSettings (const VBoxGlobalSettings &gs);
|
---|
398 |
|
---|
399 | VBoxSelectorWnd &selectorWnd();
|
---|
400 | VBoxConsoleWnd &consoleWnd();
|
---|
401 |
|
---|
402 | bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
|
---|
403 | QUuid managedVMUuid() const { return vmUuid; }
|
---|
404 |
|
---|
405 | VBoxDefs::RenderMode vmRenderMode() const { return vm_render_mode; }
|
---|
406 | const char *vmRenderModeStr() const { return vm_render_mode_str; }
|
---|
407 |
|
---|
408 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
409 | bool isDebuggerEnabled() const { return dbg_enabled; }
|
---|
410 | bool isDebuggerVisibleAtStartup() const { return dbg_visible_at_startup; }
|
---|
411 | #endif
|
---|
412 |
|
---|
413 | /* VBox enum to/from string/icon/color convertors */
|
---|
414 |
|
---|
415 | QStringList vmGuestOSTypeDescriptions() const;
|
---|
416 | CGuestOSType vmGuestOSType (int aIndex) const;
|
---|
417 | int vmGuestOSTypeIndex (const QString &aId) const;
|
---|
418 | QPixmap vmGuestOSTypeIcon (const QString &aId) const;
|
---|
419 | QString vmGuestOSTypeDescription (const QString &aId) const;
|
---|
420 |
|
---|
421 | QPixmap toIcon (KMachineState s) const
|
---|
422 | {
|
---|
423 | QPixmap *pm = mStateIcons [s];
|
---|
424 | AssertMsg (pm, ("Icon for VM state %d must be defined", s));
|
---|
425 | return pm ? *pm : QPixmap();
|
---|
426 | }
|
---|
427 |
|
---|
428 | const QColor &toColor (KMachineState s) const
|
---|
429 | {
|
---|
430 | static const QColor none;
|
---|
431 | AssertMsg (vm_state_color [s], ("No color for %d", s));
|
---|
432 | return vm_state_color [s] ? *vm_state_color [s] : none;
|
---|
433 | }
|
---|
434 |
|
---|
435 | QString toString (KMachineState s) const
|
---|
436 | {
|
---|
437 | AssertMsg (!machineStates [s].isNull(), ("No text for %d", s));
|
---|
438 | return machineStates [s];
|
---|
439 | }
|
---|
440 |
|
---|
441 | QString toString (KSessionState s) const
|
---|
442 | {
|
---|
443 | AssertMsg (!sessionStates [s].isNull(), ("No text for %d", s));
|
---|
444 | return sessionStates [s];
|
---|
445 | }
|
---|
446 |
|
---|
447 | /**
|
---|
448 | * Returns a string representation of the given KStorageBus enum value.
|
---|
449 | * Complementary to #toStorageBusType (const QString &) const.
|
---|
450 | */
|
---|
451 | QString toString (KStorageBus aBus) const
|
---|
452 | {
|
---|
453 | AssertMsg (!storageBuses [aBus].isNull(), ("No text for %d", aBus));
|
---|
454 | return storageBuses [aBus];
|
---|
455 | }
|
---|
456 |
|
---|
457 | /**
|
---|
458 | * Returns a KStorageBus enum value corresponding to the given string
|
---|
459 | * representation. Complementary to #toString (KStorageBus) const.
|
---|
460 | */
|
---|
461 | KStorageBus toStorageBusType (const QString &aBus) const
|
---|
462 | {
|
---|
463 | QStringVector::const_iterator it =
|
---|
464 | qFind (storageBuses.begin(), storageBuses.end(), aBus);
|
---|
465 | AssertMsg (it != storageBuses.end(), ("No value for {%s}", aBus.latin1()));
|
---|
466 | return KStorageBus (it - storageBuses.begin());
|
---|
467 | }
|
---|
468 |
|
---|
469 | QString toString (KStorageBus aBus, LONG aChannel) const;
|
---|
470 | LONG toStorageChannel (KStorageBus aBus, const QString &aChannel) const;
|
---|
471 |
|
---|
472 | QString toString (KStorageBus aBus, LONG aChannel, LONG aDevice) const;
|
---|
473 | LONG toStorageDevice (KStorageBus aBus, LONG aChannel, const QString &aDevice) const;
|
---|
474 |
|
---|
475 | QString toFullString (KStorageBus aBus, LONG aChannel, LONG aDevice) const;
|
---|
476 |
|
---|
477 | QString toString (KHardDiskType t) const
|
---|
478 | {
|
---|
479 | AssertMsg (!diskTypes [t].isNull(), ("No text for %d", t));
|
---|
480 | return diskTypes [t];
|
---|
481 | }
|
---|
482 |
|
---|
483 | /**
|
---|
484 | * Similar to toString (KHardDiskType), but returns 'Differencing' for
|
---|
485 | * normal hard disks that have a parent.
|
---|
486 | */
|
---|
487 | QString hardDiskTypeString (const CHardDisk2 &aHD) const
|
---|
488 | {
|
---|
489 | if (!aHD.GetParent().isNull())
|
---|
490 | {
|
---|
491 | Assert (aHD.GetType() == KHardDiskType_Normal);
|
---|
492 | return diskTypes_Differencing;
|
---|
493 | }
|
---|
494 | return toString (aHD.GetType());
|
---|
495 | }
|
---|
496 |
|
---|
497 | QString toString (KVRDPAuthType t) const
|
---|
498 | {
|
---|
499 | AssertMsg (!vrdpAuthTypes [t].isNull(), ("No text for %d", t));
|
---|
500 | return vrdpAuthTypes [t];
|
---|
501 | }
|
---|
502 |
|
---|
503 | QString toString (KPortMode t) const
|
---|
504 | {
|
---|
505 | AssertMsg (!portModeTypes [t].isNull(), ("No text for %d", t));
|
---|
506 | return portModeTypes [t];
|
---|
507 | }
|
---|
508 |
|
---|
509 | QString toString (KUSBDeviceFilterAction t) const
|
---|
510 | {
|
---|
511 | AssertMsg (!usbFilterActionTypes [t].isNull(), ("No text for %d", t));
|
---|
512 | return usbFilterActionTypes [t];
|
---|
513 | }
|
---|
514 |
|
---|
515 | QString toString (KClipboardMode t) const
|
---|
516 | {
|
---|
517 | AssertMsg (!clipboardTypes [t].isNull(), ("No text for %d", t));
|
---|
518 | return clipboardTypes [t];
|
---|
519 | }
|
---|
520 |
|
---|
521 | KClipboardMode toClipboardModeType (const QString &s) const
|
---|
522 | {
|
---|
523 | QStringVector::const_iterator it =
|
---|
524 | qFind (clipboardTypes.begin(), clipboardTypes.end(), s);
|
---|
525 | AssertMsg (it != clipboardTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
526 | return KClipboardMode (it - clipboardTypes.begin());
|
---|
527 | }
|
---|
528 |
|
---|
529 | QString toString (KIDEControllerType t) const
|
---|
530 | {
|
---|
531 | AssertMsg (!ideControllerTypes [t].isNull(), ("No text for %d", t));
|
---|
532 | return ideControllerTypes [t];
|
---|
533 | }
|
---|
534 |
|
---|
535 | KIDEControllerType toIDEControllerType (const QString &s) const
|
---|
536 | {
|
---|
537 | QStringVector::const_iterator it =
|
---|
538 | qFind (ideControllerTypes.begin(), ideControllerTypes.end(), s);
|
---|
539 | AssertMsg (it != ideControllerTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
540 | return KIDEControllerType (it - ideControllerTypes.begin());
|
---|
541 | }
|
---|
542 |
|
---|
543 | KVRDPAuthType toVRDPAuthType (const QString &s) const
|
---|
544 | {
|
---|
545 | QStringVector::const_iterator it =
|
---|
546 | qFind (vrdpAuthTypes.begin(), vrdpAuthTypes.end(), s);
|
---|
547 | AssertMsg (it != vrdpAuthTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
548 | return KVRDPAuthType (it - vrdpAuthTypes.begin());
|
---|
549 | }
|
---|
550 |
|
---|
551 | KPortMode toPortMode (const QString &s) const
|
---|
552 | {
|
---|
553 | QStringVector::const_iterator it =
|
---|
554 | qFind (portModeTypes.begin(), portModeTypes.end(), s);
|
---|
555 | AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
556 | return KPortMode (it - portModeTypes.begin());
|
---|
557 | }
|
---|
558 |
|
---|
559 | KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
|
---|
560 | {
|
---|
561 | QStringVector::const_iterator it =
|
---|
562 | qFind (usbFilterActionTypes.begin(), usbFilterActionTypes.end(), s);
|
---|
563 | AssertMsg (it != usbFilterActionTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
564 | return KUSBDeviceFilterAction (it - usbFilterActionTypes.begin());
|
---|
565 | }
|
---|
566 |
|
---|
567 | QString toString (KDeviceType t) const
|
---|
568 | {
|
---|
569 | AssertMsg (!deviceTypes [t].isNull(), ("No text for %d", t));
|
---|
570 | return deviceTypes [t];
|
---|
571 | }
|
---|
572 |
|
---|
573 | KDeviceType toDeviceType (const QString &s) const
|
---|
574 | {
|
---|
575 | QStringVector::const_iterator it =
|
---|
576 | qFind (deviceTypes.begin(), deviceTypes.end(), s);
|
---|
577 | AssertMsg (it != deviceTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
578 | return KDeviceType (it - deviceTypes.begin());
|
---|
579 | }
|
---|
580 |
|
---|
581 | QStringList deviceTypeStrings() const;
|
---|
582 |
|
---|
583 | QString toString (KAudioDriverType t) const
|
---|
584 | {
|
---|
585 | AssertMsg (!audioDriverTypes [t].isNull(), ("No text for %d", t));
|
---|
586 | return audioDriverTypes [t];
|
---|
587 | }
|
---|
588 |
|
---|
589 | KAudioDriverType toAudioDriverType (const QString &s) const
|
---|
590 | {
|
---|
591 | QStringVector::const_iterator it =
|
---|
592 | qFind (audioDriverTypes.begin(), audioDriverTypes.end(), s);
|
---|
593 | AssertMsg (it != audioDriverTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
594 | return KAudioDriverType (it - audioDriverTypes.begin());
|
---|
595 | }
|
---|
596 |
|
---|
597 | QString toString (KAudioControllerType t) const
|
---|
598 | {
|
---|
599 | AssertMsg (!audioControllerTypes [t].isNull(), ("No text for %d", t));
|
---|
600 | return audioControllerTypes [t];
|
---|
601 | }
|
---|
602 |
|
---|
603 | KAudioControllerType toAudioControllerType (const QString &s) const
|
---|
604 | {
|
---|
605 | QStringVector::const_iterator it =
|
---|
606 | qFind (audioControllerTypes.begin(), audioControllerTypes.end(), s);
|
---|
607 | AssertMsg (it != audioControllerTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
608 | return KAudioControllerType (it - audioControllerTypes.begin());
|
---|
609 | }
|
---|
610 |
|
---|
611 | QString toString (KNetworkAdapterType t) const
|
---|
612 | {
|
---|
613 | AssertMsg (!networkAdapterTypes [t].isNull(), ("No text for %d", t));
|
---|
614 | return networkAdapterTypes [t];
|
---|
615 | }
|
---|
616 |
|
---|
617 | KNetworkAdapterType toNetworkAdapterType (const QString &s) const
|
---|
618 | {
|
---|
619 | QStringVector::const_iterator it =
|
---|
620 | qFind (networkAdapterTypes.begin(), networkAdapterTypes.end(), s);
|
---|
621 | AssertMsg (it != networkAdapterTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
622 | return KNetworkAdapterType (it - networkAdapterTypes.begin());
|
---|
623 | }
|
---|
624 |
|
---|
625 | QString toString (KNetworkAttachmentType t) const
|
---|
626 | {
|
---|
627 | AssertMsg (!networkAttachmentTypes [t].isNull(), ("No text for %d", t));
|
---|
628 | return networkAttachmentTypes [t];
|
---|
629 | }
|
---|
630 |
|
---|
631 | KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
|
---|
632 | {
|
---|
633 | QStringVector::const_iterator it =
|
---|
634 | qFind (networkAttachmentTypes.begin(), networkAttachmentTypes.end(), s);
|
---|
635 | AssertMsg (it != networkAttachmentTypes.end(), ("No value for {%s}", s.latin1()));
|
---|
636 | return KNetworkAttachmentType (it - networkAttachmentTypes.begin());
|
---|
637 | }
|
---|
638 |
|
---|
639 | QString toString (KUSBDeviceState aState) const
|
---|
640 | {
|
---|
641 | AssertMsg (!USBDeviceStates [aState].isNull(), ("No text for %d", aState));
|
---|
642 | return USBDeviceStates [aState];
|
---|
643 | }
|
---|
644 |
|
---|
645 | QStringList COMPortNames() const;
|
---|
646 | QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
647 | bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
648 |
|
---|
649 | QStringList LPTPortNames() const;
|
---|
650 | QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
651 | bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
652 |
|
---|
653 | QPixmap snapshotIcon (bool online) const
|
---|
654 | {
|
---|
655 | return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
|
---|
656 | }
|
---|
657 |
|
---|
658 | QPixmap warningIcon() const { return mWarningIcon; }
|
---|
659 | QPixmap errorIcon() const { return mErrorIcon; }
|
---|
660 |
|
---|
661 | /* details generators */
|
---|
662 |
|
---|
663 | QString details (const CHardDisk2 &aHD, bool aPredictDiff);
|
---|
664 |
|
---|
665 | QString details (const CUSBDevice &aDevice) const;
|
---|
666 | QString toolTip (const CUSBDevice &aDevice) const;
|
---|
667 |
|
---|
668 | QString detailsReport (const CMachine &aMachine, bool aIsNewVM,
|
---|
669 | bool aWithLinks);
|
---|
670 |
|
---|
671 | /* VirtualBox helpers */
|
---|
672 |
|
---|
673 | #ifdef Q_WS_X11
|
---|
674 | bool showVirtualBoxLicense();
|
---|
675 | #endif
|
---|
676 |
|
---|
677 | bool checkForAutoConvertedSettings();
|
---|
678 |
|
---|
679 | CSession openSession (const QUuid &aId, bool aExisting = false);
|
---|
680 |
|
---|
681 | /** Shortcut to openSession (aId, true). */
|
---|
682 | CSession openExistingSession (const QUuid &aId) { return openSession (aId, true); }
|
---|
683 |
|
---|
684 | bool startMachine (const QUuid &id);
|
---|
685 |
|
---|
686 | void startEnumeratingMedia();
|
---|
687 |
|
---|
688 | /**
|
---|
689 | * Returns a list of all currently registered media. This list is used to
|
---|
690 | * globally track the accessiblity state of all media on a dedicated thread.
|
---|
691 | *
|
---|
692 | * Note that the media list is initially empty (i.e. before the enumeration
|
---|
693 | * process is started for the first time using #startEnumeratingMedia()).
|
---|
694 | * See #startEnumeratingMedia() for more information about how meida are
|
---|
695 | * sorted in the returned list.
|
---|
696 | */
|
---|
697 | const VBoxMediaList ¤tMediaList() const { return mMediaList; }
|
---|
698 |
|
---|
699 | /** Returns true if the media enumeration is in progress. */
|
---|
700 | bool isMediaEnumerationStarted() const { return mMediaEnumThread != NULL; }
|
---|
701 |
|
---|
702 | void addMedium (const VBoxMedium &);
|
---|
703 | void updateMedium (const VBoxMedium &);
|
---|
704 | void removeMedium (VBoxDefs::MediaType, const QUuid &);
|
---|
705 |
|
---|
706 | bool findMedium (const CMedium &, VBoxMedium &) const;
|
---|
707 |
|
---|
708 | /** Compact version of #findMediumTo(). Asserts if not found. */
|
---|
709 | VBoxMedium getMedium (const CMedium &aObj) const
|
---|
710 | {
|
---|
711 | VBoxMedium medium;
|
---|
712 | if (!findMedium (aObj, medium))
|
---|
713 | AssertFailed();
|
---|
714 | return medium;
|
---|
715 | }
|
---|
716 |
|
---|
717 | /* various helpers */
|
---|
718 |
|
---|
719 | QString languageName() const;
|
---|
720 | QString languageCountry() const;
|
---|
721 | QString languageNameEnglish() const;
|
---|
722 | QString languageCountryEnglish() const;
|
---|
723 | QString languageTranslators() const;
|
---|
724 |
|
---|
725 | void languageChange();
|
---|
726 |
|
---|
727 | /** @internal made public for internal purposes */
|
---|
728 | void cleanup();
|
---|
729 |
|
---|
730 | /* public static stuff */
|
---|
731 |
|
---|
732 | static bool isDOSType (const QString &aOSTypeId);
|
---|
733 |
|
---|
734 | static void adoptLabelPixmap (QLabel *);
|
---|
735 |
|
---|
736 | static QString languageId();
|
---|
737 | static void loadLanguage (const QString &aLangId = QString::null);
|
---|
738 |
|
---|
739 | static QIconSet iconSet (const char *aNormal,
|
---|
740 | const char *aDisabled = 0,
|
---|
741 | const char *aActive = 0);
|
---|
742 | static QIconSet iconSetEx (const char *aNormal, const char *aSmallNormal,
|
---|
743 | const char *aDisabled = 0, const char *aSmallDisabled = 0,
|
---|
744 | const char *aActive = 0, const char *aSmallActive = 0);
|
---|
745 |
|
---|
746 | static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel);
|
---|
747 |
|
---|
748 | static QRect normalizeGeometry (const QRect &aRect, const QRect &aBoundRect,
|
---|
749 | bool aCanResize = true);
|
---|
750 |
|
---|
751 | static void centerWidget (QWidget *aWidget, QWidget *aRelative,
|
---|
752 | bool aCanResize = true);
|
---|
753 |
|
---|
754 | static QChar decimalSep();
|
---|
755 | static QString sizeRegexp();
|
---|
756 |
|
---|
757 | static Q_UINT64 parseSize (const QString &);
|
---|
758 | static QString formatSize (Q_UINT64, int aMode = 0);
|
---|
759 |
|
---|
760 | static QString locationForHTML (const QString &aFileName);
|
---|
761 |
|
---|
762 | static QString highlight (const QString &aStr, bool aToolTip = false);
|
---|
763 |
|
---|
764 | static QString systemLanguageId();
|
---|
765 |
|
---|
766 | static QString getExistingDirectory (const QString &aDir, QWidget *aParent,
|
---|
767 | const char *aName = 0,
|
---|
768 | const QString &aCaption = QString::null,
|
---|
769 | bool aDirOnly = TRUE,
|
---|
770 | bool resolveSymlinks = TRUE);
|
---|
771 |
|
---|
772 | static QString getOpenFileName (const QString &, const QString &, QWidget*,
|
---|
773 | const char*, const QString &,
|
---|
774 | QString *defaultFilter = 0,
|
---|
775 | bool resolveSymLinks = true);
|
---|
776 |
|
---|
777 | static QString getFirstExistingDir (const QString &);
|
---|
778 |
|
---|
779 | static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
|
---|
780 |
|
---|
781 | static QString removeAccelMark (const QString &aText);
|
---|
782 |
|
---|
783 | static QPixmap joinPixmaps (const QPixmap &aPM1, const QPixmap &aPM2);
|
---|
784 |
|
---|
785 | static QWidget *findWidget (QWidget *aParent, const char *aName,
|
---|
786 | const char *aClassName = NULL,
|
---|
787 | bool aRecursive = false);
|
---|
788 |
|
---|
789 | signals:
|
---|
790 |
|
---|
791 | /**
|
---|
792 | * Emitted at the beginning of the enumeration process started by
|
---|
793 | * #startEnumeratingMedia().
|
---|
794 | */
|
---|
795 | void mediaEnumStarted();
|
---|
796 |
|
---|
797 | /**
|
---|
798 | * Emitted when a new medium item from the list has updated its
|
---|
799 | * accessibility state.
|
---|
800 | */
|
---|
801 | void mediumEnumerated (const VBoxMedium &aMedum, int aIndex);
|
---|
802 |
|
---|
803 | /**
|
---|
804 | * Emitted at the end of the enumeration process started by
|
---|
805 | * #startEnumeratingMedia(). The @a aList argument is passed for
|
---|
806 | * convenience, it is exactly the same as returned by #currentMediaList().
|
---|
807 | */
|
---|
808 | void mediaEnumFinished (const VBoxMediaList &aList);
|
---|
809 |
|
---|
810 | /** Emitted when a new media is added using #addMedia(). */
|
---|
811 | void mediumAdded (const VBoxMedium &);
|
---|
812 |
|
---|
813 | /** Emitted when the media is updated using #updateMedia(). */
|
---|
814 | void mediumUpdated (const VBoxMedium &);
|
---|
815 |
|
---|
816 | /** Emitted when the media is removed using #removeMedia(). */
|
---|
817 | void mediumRemoved (VBoxDefs::MediaType, const QUuid &);
|
---|
818 |
|
---|
819 | /* signals emitted when the VirtualBox callback is called by the server
|
---|
820 | * (not that currently these signals are emitted only when the application
|
---|
821 | * is the in the VM selector mode) */
|
---|
822 |
|
---|
823 | void machineStateChanged (const VBoxMachineStateChangeEvent &e);
|
---|
824 | void machineDataChanged (const VBoxMachineDataChangeEvent &e);
|
---|
825 | void machineRegistered (const VBoxMachineRegisteredEvent &e);
|
---|
826 | void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
|
---|
827 | void snapshotChanged (const VBoxSnapshotEvent &e);
|
---|
828 |
|
---|
829 | void canShowRegDlg (bool aCanShow);
|
---|
830 |
|
---|
831 | public slots:
|
---|
832 |
|
---|
833 | bool openURL (const QString &aURL);
|
---|
834 |
|
---|
835 | void showRegistrationDialog (bool aForce = true);
|
---|
836 |
|
---|
837 | protected:
|
---|
838 |
|
---|
839 | bool event (QEvent *e);
|
---|
840 | bool eventFilter (QObject *, QEvent *);
|
---|
841 |
|
---|
842 | private:
|
---|
843 |
|
---|
844 | VBoxGlobal();
|
---|
845 | ~VBoxGlobal() {}
|
---|
846 |
|
---|
847 | void init();
|
---|
848 |
|
---|
849 | bool mValid;
|
---|
850 |
|
---|
851 | CVirtualBox mVBox;
|
---|
852 |
|
---|
853 | VBoxGlobalSettings gset;
|
---|
854 |
|
---|
855 | VBoxSelectorWnd *mSelectorWnd;
|
---|
856 | VBoxConsoleWnd *mConsoleWnd;
|
---|
857 |
|
---|
858 | #ifdef VBOX_WITH_REGISTRATION
|
---|
859 | VBoxRegistrationDlg *mRegDlg;
|
---|
860 | #endif
|
---|
861 |
|
---|
862 | QUuid vmUuid;
|
---|
863 |
|
---|
864 | QThread *mMediaEnumThread;
|
---|
865 | VBoxMediaList mMediaList;
|
---|
866 |
|
---|
867 | VBoxDefs::RenderMode vm_render_mode;
|
---|
868 | const char * vm_render_mode_str;
|
---|
869 |
|
---|
870 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
871 | bool dbg_enabled;
|
---|
872 | bool dbg_visible_at_startup;
|
---|
873 | #endif
|
---|
874 |
|
---|
875 | #if defined (Q_WS_WIN32)
|
---|
876 | DWORD dwHTMLHelpCookie;
|
---|
877 | #endif
|
---|
878 |
|
---|
879 | CVirtualBoxCallback callback;
|
---|
880 |
|
---|
881 | typedef QValueVector <QString> QStringVector;
|
---|
882 |
|
---|
883 | QString verString;
|
---|
884 |
|
---|
885 | QValueVector <CGuestOSType> vm_os_types;
|
---|
886 | QDict <QPixmap> vm_os_type_icons;
|
---|
887 | QPtrVector <QColor> vm_state_color;
|
---|
888 |
|
---|
889 | QIntDict <QPixmap> mStateIcons;
|
---|
890 | QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
|
---|
891 |
|
---|
892 | QStringVector machineStates;
|
---|
893 | QStringVector sessionStates;
|
---|
894 | QStringVector deviceTypes;
|
---|
895 |
|
---|
896 | QStringVector storageBuses;
|
---|
897 | QStringVector storageBusDevices;
|
---|
898 | QStringVector storageBusChannels;
|
---|
899 |
|
---|
900 | QStringVector diskTypes;
|
---|
901 | QString diskTypes_Differencing;
|
---|
902 |
|
---|
903 | QStringVector vrdpAuthTypes;
|
---|
904 | QStringVector portModeTypes;
|
---|
905 | QStringVector usbFilterActionTypes;
|
---|
906 | QStringVector audioDriverTypes;
|
---|
907 | QStringVector audioControllerTypes;
|
---|
908 | QStringVector networkAdapterTypes;
|
---|
909 | QStringVector networkAttachmentTypes;
|
---|
910 | QStringVector clipboardTypes;
|
---|
911 | QStringVector ideControllerTypes;
|
---|
912 | QStringVector USBDeviceStates;
|
---|
913 |
|
---|
914 | QString mUserDefinedPortName;
|
---|
915 |
|
---|
916 | QPixmap mWarningIcon, mErrorIcon;
|
---|
917 |
|
---|
918 | mutable bool detailReportTemplatesReady;
|
---|
919 |
|
---|
920 | friend VBoxGlobal &vboxGlobal();
|
---|
921 | friend class VBoxCallback;
|
---|
922 | };
|
---|
923 |
|
---|
924 | inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); }
|
---|
925 |
|
---|
926 | // Helper classes
|
---|
927 | ////////////////////////////////////////////////////////////////////////////////
|
---|
928 |
|
---|
929 | /**
|
---|
930 | * Generic asyncronous event.
|
---|
931 | *
|
---|
932 | * This abstract class is intended to provide a conveinent way to execute
|
---|
933 | * code on the main GUI thread asynchronously to the calling party. This is
|
---|
934 | * done by putting necessary actions to the #handle() function in a subclass
|
---|
935 | * and then posting an instance of the subclass using #post(). The instance
|
---|
936 | * must be allocated on the heap using the <tt>new</tt> operation and will be
|
---|
937 | * automatically deleted after processing. Note that if you don't call #post()
|
---|
938 | * on the created instance, you have to delete it yourself.
|
---|
939 | */
|
---|
940 | class VBoxAsyncEvent : public QEvent
|
---|
941 | {
|
---|
942 | public:
|
---|
943 |
|
---|
944 | VBoxAsyncEvent() : QEvent ((QEvent::Type) VBoxDefs::AsyncEventType) {}
|
---|
945 |
|
---|
946 | /**
|
---|
947 | * Worker function. Gets executed on the GUI thread when the posted event
|
---|
948 | * is processed by the main event loop.
|
---|
949 | */
|
---|
950 | virtual void handle() = 0;
|
---|
951 |
|
---|
952 | /**
|
---|
953 | * Posts this event to the main event loop.
|
---|
954 | * The caller loses ownership of this object after this method returns
|
---|
955 | * and must not delete the object.
|
---|
956 | */
|
---|
957 | void post()
|
---|
958 | {
|
---|
959 | QApplication::postEvent (&vboxGlobal(), this);
|
---|
960 | }
|
---|
961 | };
|
---|
962 |
|
---|
963 | /**
|
---|
964 | * USB Popup Menu class.
|
---|
965 | * This class provides the list of USB devices attached to the host.
|
---|
966 | */
|
---|
967 | class VBoxUSBMenu : public QPopupMenu
|
---|
968 | {
|
---|
969 | Q_OBJECT
|
---|
970 |
|
---|
971 | public:
|
---|
972 |
|
---|
973 | enum { USBDevicesMenuNoDevicesId = 1 };
|
---|
974 |
|
---|
975 | VBoxUSBMenu (QWidget *);
|
---|
976 |
|
---|
977 | const CUSBDevice& getUSB (int);
|
---|
978 |
|
---|
979 | void setConsole (const CConsole &);
|
---|
980 |
|
---|
981 | private slots:
|
---|
982 |
|
---|
983 | void processAboutToShow();
|
---|
984 |
|
---|
985 | void processHighlighted (int);
|
---|
986 |
|
---|
987 | private:
|
---|
988 |
|
---|
989 | QMap <int, CUSBDevice> mUSBDevicesMap;
|
---|
990 | CConsole mConsole;
|
---|
991 | };
|
---|
992 |
|
---|
993 |
|
---|
994 | /**
|
---|
995 | * Enable/Disable Menu class.
|
---|
996 | * This class provides enable/disable menu items.
|
---|
997 | */
|
---|
998 | class VBoxSwitchMenu : public QPopupMenu
|
---|
999 | {
|
---|
1000 | Q_OBJECT
|
---|
1001 |
|
---|
1002 | public:
|
---|
1003 |
|
---|
1004 | VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);
|
---|
1005 |
|
---|
1006 | void setToolTip (const QString &);
|
---|
1007 |
|
---|
1008 | private slots:
|
---|
1009 |
|
---|
1010 | void processAboutToShow();
|
---|
1011 |
|
---|
1012 | void processActivated (int);
|
---|
1013 |
|
---|
1014 | private:
|
---|
1015 |
|
---|
1016 | QAction *mAction;
|
---|
1017 | QString mTip;
|
---|
1018 | bool mInverted;
|
---|
1019 | };
|
---|
1020 |
|
---|
1021 | #endif /* __VBoxGlobal_h__ */
|
---|