1 | /* $Id: VBoxGlobal.h 57805 2015-09-17 15:01:21Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - VBoxGlobal class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2014 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___VBoxGlobal_h___
|
---|
19 | #define ___VBoxGlobal_h___
|
---|
20 |
|
---|
21 | /* Qt includes: */
|
---|
22 | #include <QApplication>
|
---|
23 | #include <QLayout>
|
---|
24 | #include <QMenu>
|
---|
25 | #include <QStyle>
|
---|
26 | #include <QHash>
|
---|
27 | #include <QFileIconProvider>
|
---|
28 | #include <QReadWriteLock>
|
---|
29 | #ifdef Q_WS_MAC
|
---|
30 | # include <QSet>
|
---|
31 | #endif /* Q_WS_MAC */
|
---|
32 |
|
---|
33 | /* GUI includes: */
|
---|
34 | #include "UIDefs.h"
|
---|
35 | #include "UIMediumDefs.h"
|
---|
36 | #include "VBoxGlobalSettings.h"
|
---|
37 | #ifdef Q_WS_X11
|
---|
38 | # include "VBoxX11Helper.h"
|
---|
39 | #endif /* Q_WS_X11 */
|
---|
40 |
|
---|
41 | /* COM includes: */
|
---|
42 | #include "VBox/com/Guid.h"
|
---|
43 | #include "CHost.h"
|
---|
44 | #include "CVirtualBoxClient.h"
|
---|
45 | #include "CVirtualBox.h"
|
---|
46 | #include "CSession.h"
|
---|
47 | #include "CGuestOSType.h"
|
---|
48 |
|
---|
49 | /* Other includes: */
|
---|
50 | #ifdef Q_WS_X11
|
---|
51 | # include <X11/Xdefs.h>
|
---|
52 | #endif /* Q_WS_X11 */
|
---|
53 |
|
---|
54 | /* Forward declarations: */
|
---|
55 | class QAction;
|
---|
56 | class QLabel;
|
---|
57 | class QToolButton;
|
---|
58 | class UIMachine;
|
---|
59 | class CMachine;
|
---|
60 | class CMedium;
|
---|
61 | class CUSBDevice;
|
---|
62 | class CHostVideoInputDevice;
|
---|
63 | class QSpinBox;
|
---|
64 | class UIMediumEnumerator;
|
---|
65 | class UIMedium;
|
---|
66 | class UIIconPoolGeneral;
|
---|
67 | class UIThreadPool;
|
---|
68 | #ifdef Q_WS_X11
|
---|
69 | class UIDesktopWidgetWatchdog;
|
---|
70 | #endif /* Q_WS_X11 */
|
---|
71 |
|
---|
72 | // VBoxGlobal class
|
---|
73 | ////////////////////////////////////////////////////////////////////////////////
|
---|
74 |
|
---|
75 | class UISelectorWindow;
|
---|
76 | class VBoxUpdateDlg;
|
---|
77 |
|
---|
78 | class VBoxGlobal : public QObject
|
---|
79 | {
|
---|
80 | Q_OBJECT
|
---|
81 |
|
---|
82 | public:
|
---|
83 |
|
---|
84 | /** VM launch modes. */
|
---|
85 | enum LaunchMode
|
---|
86 | {
|
---|
87 | LaunchMode_Default,
|
---|
88 | LaunchMode_Headless,
|
---|
89 | LaunchMode_Separate
|
---|
90 | };
|
---|
91 |
|
---|
92 | /** Whether to start the VM running. */
|
---|
93 | enum StartRunning
|
---|
94 | {
|
---|
95 | StartRunning_Default, /**< Default (depends on debug settings). */
|
---|
96 | StartRunning_No, /**< Start the VM paused. */
|
---|
97 | StartRunning_Yes /**< Start the VM running. */
|
---|
98 | };
|
---|
99 |
|
---|
100 | /* Static API: Create/destroy stuff: */
|
---|
101 | static VBoxGlobal* instance();
|
---|
102 | static void create();
|
---|
103 | static void destroy();
|
---|
104 |
|
---|
105 | bool isValid() { return mValid; }
|
---|
106 | bool isCleaningUp() { return m_sfCleanupInProgress; }
|
---|
107 |
|
---|
108 | static QString qtRTVersionString();
|
---|
109 | static uint qtRTVersion();
|
---|
110 | static QString qtCTVersionString();
|
---|
111 | static uint qtCTVersion();
|
---|
112 |
|
---|
113 | QString vboxVersionString() const;
|
---|
114 | QString vboxVersionStringNormalized() const;
|
---|
115 |
|
---|
116 | QString versionString() const { return mVerString; }
|
---|
117 | bool isBeta() const;
|
---|
118 |
|
---|
119 | /** Returns whether GUI is separate (from VM) process. */
|
---|
120 | bool isSeparateProcess() const { return m_fSeparateProcess; }
|
---|
121 |
|
---|
122 | #ifdef Q_WS_MAC
|
---|
123 | static MacOSXRelease osRelease();
|
---|
124 | #endif /* Q_WS_MAC */
|
---|
125 |
|
---|
126 | /** Try to acquire COM cleanup protection token for reading. */
|
---|
127 | bool comTokenTryLockForRead() { return m_comCleanupProtectionToken.tryLockForRead(); }
|
---|
128 | /** Unlock previously acquired COM cleanup protection token. */
|
---|
129 | void comTokenUnlock() { return m_comCleanupProtectionToken.unlock(); }
|
---|
130 |
|
---|
131 | /** Returns the copy of VirtualBox client wrapper. */
|
---|
132 | CVirtualBoxClient virtualBoxClient() const { return m_client; }
|
---|
133 | /** Returns the copy of VirtualBox object wrapper. */
|
---|
134 | CVirtualBox virtualBox() const { return m_vbox; }
|
---|
135 | /** Returns the copy of VirtualBox host-object wrapper. */
|
---|
136 | CHost host() const { return m_host; }
|
---|
137 | /** Returns the symbolic VirtualBox home-folder representation. */
|
---|
138 | QString homeFolder() const { return m_strHomeFolder; }
|
---|
139 |
|
---|
140 | /** Returns the VBoxSVC availability value. */
|
---|
141 | bool isVBoxSVCAvailable() const { return m_fVBoxSVCAvailable; }
|
---|
142 |
|
---|
143 | /** Returns the thread-pool instance. */
|
---|
144 | UIThreadPool* threadPool() const { return m_pThreadPool; }
|
---|
145 |
|
---|
146 | /** @name Host-screen geometry stuff
|
---|
147 | * @{ */
|
---|
148 | /** Returns the number of host-screens currently available on the system. */
|
---|
149 | int screenCount() const;
|
---|
150 |
|
---|
151 | /** Returns the index of the screen which contains contains @a pWidget. */
|
---|
152 | int screenNumber(const QWidget *pWidget) const;
|
---|
153 | /** Returns the index of the screen which contains contains @a point. */
|
---|
154 | int screenNumber(const QPoint &point) const;
|
---|
155 |
|
---|
156 | /** Returns the geometry of the host-screen with @a iHostScreenIndex.
|
---|
157 | * @note The default screen is used if @a iHostScreenIndex is -1. */
|
---|
158 | const QRect screenGeometry(int iHostScreenIndex = -1) const;
|
---|
159 | /** Returns the available-geometry of the host-screen with @a iHostScreenIndex.
|
---|
160 | * @note The default screen is used if @a iHostScreenIndex is -1. */
|
---|
161 | const QRect availableGeometry(int iHostScreenIndex = -1) const;
|
---|
162 |
|
---|
163 | /** Returns the geometry of the host-screen which contains @a pWidget. */
|
---|
164 | const QRect screenGeometry(const QWidget *pWidget) const;
|
---|
165 | /** Returns the available-geometry of the host-screen which contains @a pWidget. */
|
---|
166 | const QRect availableGeometry(const QWidget *pWidget) const;
|
---|
167 |
|
---|
168 | /** Returns the geometry of the host-screen which contains @a point. */
|
---|
169 | const QRect screenGeometry(const QPoint &point) const;
|
---|
170 | /** Returns the available-geometry of the host-screen which contains @a point. */
|
---|
171 | const QRect availableGeometry(const QPoint &point) const;
|
---|
172 | /** @} */
|
---|
173 |
|
---|
174 | VBoxGlobalSettings &settings() { return gset; }
|
---|
175 | bool setSettings (VBoxGlobalSettings &gs);
|
---|
176 |
|
---|
177 | UISelectorWindow &selectorWnd();
|
---|
178 |
|
---|
179 | /** Returns currently active virtual machine window. */
|
---|
180 | QWidget* activeMachineWindow() const;
|
---|
181 |
|
---|
182 | bool is3DAvailableWorker() const;
|
---|
183 | bool is3DAvailable() const { if (m3DAvailable < 0) return is3DAvailableWorker(); return m3DAvailable != 0; }
|
---|
184 |
|
---|
185 | #ifdef VBOX_GUI_WITH_PIDFILE
|
---|
186 | void createPidfile();
|
---|
187 | void deletePidfile();
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | /* branding */
|
---|
191 | bool brandingIsActive (bool aForce = false);
|
---|
192 | QString brandingGetKey (QString aKey);
|
---|
193 |
|
---|
194 | bool processArgs();
|
---|
195 |
|
---|
196 | bool switchToMachine(CMachine &machine);
|
---|
197 |
|
---|
198 | bool launchMachine(CMachine &machine, LaunchMode enmLaunchMode = LaunchMode_Default);
|
---|
199 |
|
---|
200 | bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
|
---|
201 | bool showStartVMErrors() const { return mShowStartVMErrors; }
|
---|
202 | QString managedVMUuid() const { return vmUuid; }
|
---|
203 | QList<QUrl> &argUrlList() { return m_ArgUrlList; }
|
---|
204 |
|
---|
205 | #ifdef Q_WS_X11
|
---|
206 | /** X11: Returns the type of the Window Manager we are running under. */
|
---|
207 | X11WMType typeOfWindowManager() const { return m_enmWindowManagerType; }
|
---|
208 | #endif /* Q_WS_X11 */
|
---|
209 |
|
---|
210 | /** Returns whether we should restore current snapshot before VM started. */
|
---|
211 | bool shouldRestoreCurrentSnapshot() const { return mRestoreCurrentSnapshot; }
|
---|
212 | /** Defines whether we should fRestore current snapshot before VM started. */
|
---|
213 | void setShouldRestoreCurrentSnapshot(bool fRestore) { mRestoreCurrentSnapshot = fRestore; }
|
---|
214 |
|
---|
215 | bool hasFloppyImageToMount() const { return !m_strFloppyImage.isEmpty(); }
|
---|
216 | bool hasDvdImageToMount() const { return !m_strDvdImage.isEmpty(); }
|
---|
217 | QString const &getFloppyImage() const { return m_strFloppyImage; }
|
---|
218 | QString const &getDvdImage() const { return m_strDvdImage; }
|
---|
219 |
|
---|
220 | bool isPatmDisabled() const { return mDisablePatm; }
|
---|
221 | bool isCsamDisabled() const { return mDisableCsam; }
|
---|
222 | bool isSupervisorCodeExecedRecompiled() const { return mRecompileSupervisor; }
|
---|
223 | bool isUserCodeExecedRecompiled() const { return mRecompileUser; }
|
---|
224 | bool areWeToExecuteAllInIem() const { return mExecuteAllInIem; }
|
---|
225 | bool isDefaultWarpPct() const { return mWarpPct == 100; }
|
---|
226 | uint32_t getWarpPct() const { return mWarpPct; }
|
---|
227 |
|
---|
228 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
229 | bool isDebuggerEnabled() const;
|
---|
230 | bool isDebuggerAutoShowEnabled() const;
|
---|
231 | bool isDebuggerAutoShowCommandLineEnabled() const;
|
---|
232 | bool isDebuggerAutoShowStatisticsEnabled() const;
|
---|
233 |
|
---|
234 | RTLDRMOD getDebuggerModule() const { return m_hVBoxDbg; }
|
---|
235 | #endif /* VBOX_WITH_DEBUGGER_GUI */
|
---|
236 |
|
---|
237 | bool shouldStartPaused() const
|
---|
238 | {
|
---|
239 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
240 | return m_enmStartRunning == StartRunning_Default ? isDebuggerAutoShowEnabled() : m_enmStartRunning == StartRunning_No;
|
---|
241 | #else
|
---|
242 | return false;
|
---|
243 | #endif
|
---|
244 | }
|
---|
245 |
|
---|
246 | /* VBox enum to/from string/icon/color convertors */
|
---|
247 |
|
---|
248 | QList <CGuestOSType> vmGuestOSFamilyList() const;
|
---|
249 | QList <CGuestOSType> vmGuestOSTypeList (const QString &aFamilyId) const;
|
---|
250 |
|
---|
251 | /** Returns pixmap corresponding to passed @a strOSTypeID.
|
---|
252 | * In case if non-null @a pLogicalSize pointer provided, it will be updated properly. */
|
---|
253 | QPixmap vmGuestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize = 0) const;
|
---|
254 |
|
---|
255 | CGuestOSType vmGuestOSType (const QString &aTypeId,
|
---|
256 | const QString &aFamilyId = QString::null) const;
|
---|
257 | QString vmGuestOSTypeDescription (const QString &aTypeId) const;
|
---|
258 |
|
---|
259 | static inline QString yearsToString (uint32_t cVal)
|
---|
260 | {
|
---|
261 | return tr("%n year(s)", "", cVal);
|
---|
262 | }
|
---|
263 |
|
---|
264 | static inline QString monthsToString (uint32_t cVal)
|
---|
265 | {
|
---|
266 | return tr("%n month(s)", "", cVal);
|
---|
267 | }
|
---|
268 |
|
---|
269 | static inline QString daysToString (uint32_t cVal)
|
---|
270 | {
|
---|
271 | return tr("%n day(s)", "", cVal);
|
---|
272 | }
|
---|
273 |
|
---|
274 | static inline QString hoursToString (uint32_t cVal)
|
---|
275 | {
|
---|
276 | return tr("%n hour(s)", "", cVal);
|
---|
277 | }
|
---|
278 |
|
---|
279 | static inline QString minutesToString (uint32_t cVal)
|
---|
280 | {
|
---|
281 | return tr("%n minute(s)", "", cVal);
|
---|
282 | }
|
---|
283 |
|
---|
284 | static inline QString secondsToString (uint32_t cVal)
|
---|
285 | {
|
---|
286 | return tr("%n second(s)", "", cVal);
|
---|
287 | }
|
---|
288 |
|
---|
289 | QString differencingMediumTypeName() const { return mDiskTypes_Differencing; }
|
---|
290 |
|
---|
291 | /**
|
---|
292 | * Similar to toString (KMediumType), but returns 'Differencing' for
|
---|
293 | * normal hard disks that have a parent.
|
---|
294 | */
|
---|
295 | QString mediumTypeString(const CMedium &medium) const;
|
---|
296 |
|
---|
297 | QStringList COMPortNames() const;
|
---|
298 | QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
299 | bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
300 |
|
---|
301 | QStringList LPTPortNames() const;
|
---|
302 | QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
|
---|
303 | bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
|
---|
304 |
|
---|
305 | static bool hasAllowedExtension(const QString &strExt, const QStringList &extList)
|
---|
306 | {
|
---|
307 | for (int i = 0; i < extList.size(); ++i)
|
---|
308 | if (strExt.endsWith(extList.at(i), Qt::CaseInsensitive))
|
---|
309 | return true;
|
---|
310 | return false;
|
---|
311 | }
|
---|
312 |
|
---|
313 | QIcon icon(QFileIconProvider::IconType type) { return m_globalIconProvider.icon(type); }
|
---|
314 | QIcon icon(const QFileInfo &info) { return m_globalIconProvider.icon(info); }
|
---|
315 |
|
---|
316 | QPixmap warningIcon() const { return mWarningIcon; }
|
---|
317 | QPixmap errorIcon() const { return mErrorIcon; }
|
---|
318 |
|
---|
319 | /* details generators */
|
---|
320 |
|
---|
321 | QString details(const CMedium &medium, bool fPredictDiff, bool fUseHtml = true);
|
---|
322 |
|
---|
323 | QString details (const CUSBDevice &aDevice) const;
|
---|
324 | QString toolTip (const CUSBDevice &aDevice) const;
|
---|
325 | QString toolTip (const CUSBDeviceFilter &aFilter) const;
|
---|
326 | QString toolTip(const CHostVideoInputDevice &webcam) const;
|
---|
327 |
|
---|
328 | QString detailsReport (const CMachine &aMachine, bool aWithLinks);
|
---|
329 |
|
---|
330 | /* VirtualBox helpers */
|
---|
331 |
|
---|
332 | CSession openSession(const QString &aId, KLockType aLockType = KLockType_Write);
|
---|
333 |
|
---|
334 | /** Shortcut to openSession (aId, true). */
|
---|
335 | CSession openExistingSession(const QString &aId) { return openSession(aId, KLockType_Shared); }
|
---|
336 |
|
---|
337 | #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
|
---|
338 | void reloadProxySettings();
|
---|
339 | #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
|
---|
340 |
|
---|
341 | /* API: Medium-processing stuff: */
|
---|
342 | void createMedium(const UIMedium &medium);
|
---|
343 | void deleteMedium(const QString &strMediumID);
|
---|
344 | QString openMediumWithFileOpenDialog(UIMediumType mediumType, QWidget *pParent = 0,
|
---|
345 | const QString &strDefaultFolder = QString(), bool fUseLastFolder = true);
|
---|
346 | QString openMedium(UIMediumType mediumType, QString strMediumLocation, QWidget *pParent = 0);
|
---|
347 |
|
---|
348 | /* API: Medium-enumeration stuff: */
|
---|
349 | void startMediumEnumeration(bool fForceStart = true);
|
---|
350 | bool agressiveCaching() const { return mAgressiveCaching; }
|
---|
351 | bool isMediumEnumerationInProgress() const;
|
---|
352 | UIMedium medium(const QString &strMediumID) const;
|
---|
353 | QList<QString> mediumIDs() const;
|
---|
354 |
|
---|
355 | /** Prepares storage menu according passed parameters.
|
---|
356 | * @param menu QMenu being prepared.
|
---|
357 | * @param pListener Listener QObject, this menu being prepared for.
|
---|
358 | * @param pszSlotName SLOT in the @a pListener above, this menu will be handled with.
|
---|
359 | * @param machine CMachine object, this menu being prepared for.
|
---|
360 | * @param strControllerName The name of the CStorageController in the @a machine above.
|
---|
361 | * @param storageSlot The StorageSlot of the CStorageController called @a strControllerName above. */
|
---|
362 | void prepareStorageMenu(QMenu &menu,
|
---|
363 | QObject *pListener, const char *pszSlotName,
|
---|
364 | const CMachine &machine, const QString &strControllerName, const StorageSlot &storageSlot);
|
---|
365 | /** Updates @a constMachine storage with data described by @a target. */
|
---|
366 | void updateMachineStorage(const CMachine &constMachine, const UIMediumTarget &target);
|
---|
367 |
|
---|
368 | /* various helpers */
|
---|
369 |
|
---|
370 | QString languageName() const;
|
---|
371 | QString languageCountry() const;
|
---|
372 | QString languageNameEnglish() const;
|
---|
373 | QString languageCountryEnglish() const;
|
---|
374 | QString languageTranslators() const;
|
---|
375 |
|
---|
376 | void retranslateUi();
|
---|
377 |
|
---|
378 | /* public static stuff */
|
---|
379 |
|
---|
380 | static bool isDOSType (const QString &aOSTypeId);
|
---|
381 |
|
---|
382 | static QString languageId();
|
---|
383 | static void loadLanguage (const QString &aLangId = QString::null);
|
---|
384 | QString helpFile() const;
|
---|
385 |
|
---|
386 | static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel);
|
---|
387 |
|
---|
388 | static QRect normalizeGeometry (const QRect &aRectangle, const QRegion &aBoundRegion,
|
---|
389 | bool aCanResize = true);
|
---|
390 | static QRect getNormalized (const QRect &aRectangle, const QRegion &aBoundRegion,
|
---|
391 | bool aCanResize = true);
|
---|
392 | static QRegion flip (const QRegion &aRegion);
|
---|
393 |
|
---|
394 | static void centerWidget (QWidget *aWidget, QWidget *aRelative,
|
---|
395 | bool aCanResize = true);
|
---|
396 |
|
---|
397 | static QChar decimalSep();
|
---|
398 | static QString sizeRegexp();
|
---|
399 |
|
---|
400 | static quint64 parseSize (const QString &);
|
---|
401 | static QString formatSize (quint64 aSize, uint aDecimal = 2, FormatSize aMode = FormatSize_Round);
|
---|
402 |
|
---|
403 | static quint64 requiredVideoMemory(const QString &strGuestOSTypeId, int cMonitors = 1);
|
---|
404 |
|
---|
405 | static QString locationForHTML (const QString &aFileName);
|
---|
406 |
|
---|
407 | static QString highlight (const QString &aStr, bool aToolTip = false);
|
---|
408 |
|
---|
409 | static QString replaceHtmlEntities(QString strText);
|
---|
410 | static QString emphasize (const QString &aStr);
|
---|
411 |
|
---|
412 | static QString systemLanguageId();
|
---|
413 |
|
---|
414 | static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
|
---|
415 |
|
---|
416 | #ifdef Q_WS_X11
|
---|
417 | /** X11: Test whether the current window manager supports full screen mode. */
|
---|
418 | static bool supportsFullScreenMonitorsProtocolX11();
|
---|
419 | /** X11: Performs mapping of the passed @a pWidget to host-screen with passed @a uScreenId. */
|
---|
420 | static bool setFullScreenMonitorX11(QWidget *pWidget, ulong uScreenId);
|
---|
421 |
|
---|
422 | /** X11: Returns a list of current _NET_WM_STATE flags for passed @a pWidget. */
|
---|
423 | static QVector<Atom> flagsNetWmState(QWidget *pWidget);
|
---|
424 | /** X11: Check whether _NET_WM_STATE_FULLSCREEN flag is set for passed @a pWidget. */
|
---|
425 | static bool isFullScreenFlagSet(QWidget *pWidget);
|
---|
426 | /** X11: Sets _NET_WM_STATE_FULLSCREEN flag for passed @a pWidget. */
|
---|
427 | static void setFullScreenFlag(QWidget *pWidget);
|
---|
428 | #endif /* Q_WS_X11 */
|
---|
429 |
|
---|
430 | static QString removeAccelMark (const QString &aText);
|
---|
431 |
|
---|
432 | static QString insertKeyToActionText (const QString &aText, const QString &aKey);
|
---|
433 |
|
---|
434 | static QPixmap joinPixmaps (const QPixmap &aPM1, const QPixmap &aPM2);
|
---|
435 |
|
---|
436 | static QWidget *findWidget (QWidget *aParent, const char *aName,
|
---|
437 | const char *aClassName = NULL,
|
---|
438 | bool aRecursive = false);
|
---|
439 |
|
---|
440 | static QList <QPair <QString, QString> > MediumBackends(KDeviceType enmDeviceType);
|
---|
441 | static QList <QPair <QString, QString> > HDDBackends();
|
---|
442 | static QList <QPair <QString, QString> > DVDBackends();
|
---|
443 | static QList <QPair <QString, QString> > FloppyBackends();
|
---|
444 |
|
---|
445 | static QString documentsPath();
|
---|
446 |
|
---|
447 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
448 | static bool isAcceleration2DVideoAvailable();
|
---|
449 |
|
---|
450 | /** additional video memory required for the best 2D support performance
|
---|
451 | * total amount of VRAM required is thus calculated as requiredVideoMemory + required2DOffscreenVideoMemory */
|
---|
452 | static quint64 required2DOffscreenVideoMemory();
|
---|
453 | #endif
|
---|
454 |
|
---|
455 | #ifdef VBOX_WITH_CRHGSMI
|
---|
456 | static bool isWddmCompatibleOsType(const QString &strGuestOSTypeId);
|
---|
457 | static quint64 required3DWddmOffscreenVideoMemory(const QString &strGuestOSTypeId, int cMonitors = 1);
|
---|
458 | #endif /* VBOX_WITH_CRHGSMI */
|
---|
459 |
|
---|
460 | /* Returns full medium-format name for the given base medium-format name: */
|
---|
461 | static QString fullMediumFormatName(const QString &strBaseMediumFormatName);
|
---|
462 |
|
---|
463 |
|
---|
464 | #ifdef RT_OS_LINUX
|
---|
465 | static void checkForWrongUSBMounted();
|
---|
466 | #endif /* RT_OS_LINUX */
|
---|
467 |
|
---|
468 | /* Shame on Qt it hasn't stuff for tuning
|
---|
469 | * widget size suitable for reflecting content of desired size.
|
---|
470 | * For example QLineEdit, QSpinBox and similar widgets should have a methods
|
---|
471 | * to strict the minimum width to reflect at least [n] symbols. */
|
---|
472 | static void setMinimumWidthAccordingSymbolCount(QSpinBox *pSpinBox, int cCount);
|
---|
473 |
|
---|
474 | signals:
|
---|
475 |
|
---|
476 | /** Notifies listeners about the VBoxSVC availability change. */
|
---|
477 | void sigVBoxSVCAvailabilityChange();
|
---|
478 |
|
---|
479 | /* Notifiers: Medium-processing stuff: */
|
---|
480 | void sigMediumCreated(const QString &strMediumID);
|
---|
481 | void sigMediumDeleted(const QString &strMediumID);
|
---|
482 |
|
---|
483 | /* Notifiers: Medium-enumeration stuff: */
|
---|
484 | void sigMediumEnumerationStarted();
|
---|
485 | void sigMediumEnumerated(const QString &strMediumID);
|
---|
486 | void sigMediumEnumerationFinished();
|
---|
487 |
|
---|
488 | public slots:
|
---|
489 |
|
---|
490 | bool openURL (const QString &aURL);
|
---|
491 |
|
---|
492 | void sltGUILanguageChange(QString strLang);
|
---|
493 | void sltProcessGlobalSettingChange();
|
---|
494 |
|
---|
495 | protected slots:
|
---|
496 |
|
---|
497 | /* Handlers: Prepare/cleanup stuff: */
|
---|
498 | void prepare();
|
---|
499 | void cleanup();
|
---|
500 |
|
---|
501 | /** Handles the VBoxSVC availability change. */
|
---|
502 | void sltHandleVBoxSVCAvailabilityChange(bool fAvailable);
|
---|
503 |
|
---|
504 | protected:
|
---|
505 |
|
---|
506 | bool eventFilter (QObject *, QEvent *);
|
---|
507 |
|
---|
508 | private:
|
---|
509 |
|
---|
510 | /* Constructor/destructor: */
|
---|
511 | VBoxGlobal();
|
---|
512 | ~VBoxGlobal();
|
---|
513 |
|
---|
514 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
515 | void initDebuggerVar(int *piDbgCfgVar, const char *pszEnvVar, const char *pszExtraDataName, bool fDefault = false);
|
---|
516 | void setDebuggerVar(int *piDbgCfgVar, bool fState);
|
---|
517 | bool isDebuggerWorker(int *piDbgCfgVar, const char *pszExtraDataName) const;
|
---|
518 | #endif
|
---|
519 |
|
---|
520 | bool mValid;
|
---|
521 |
|
---|
522 | /** COM cleanup protection token. */
|
---|
523 | QReadWriteLock m_comCleanupProtectionToken;
|
---|
524 |
|
---|
525 | /** Holds the instance of VirtualBox client wrapper. */
|
---|
526 | CVirtualBoxClient m_client;
|
---|
527 | /** Holds the copy of VirtualBox object wrapper. */
|
---|
528 | CVirtualBox m_vbox;
|
---|
529 | /** Holds the copy of VirtualBox host-object wrapper. */
|
---|
530 | CHost m_host;
|
---|
531 | /** Holds the symbolic VirtualBox home-folder representation. */
|
---|
532 | QString m_strHomeFolder;
|
---|
533 |
|
---|
534 | /** Holds the VBoxSVC availability value. */
|
---|
535 | bool m_fVBoxSVCAvailable;
|
---|
536 |
|
---|
537 | VBoxGlobalSettings gset;
|
---|
538 |
|
---|
539 | UISelectorWindow *mSelectorWnd;
|
---|
540 |
|
---|
541 | /** Holds whether GUI is separate (from VM) process. */
|
---|
542 | bool m_fSeparateProcess;
|
---|
543 |
|
---|
544 | QString vmUuid;
|
---|
545 | QList<QUrl> m_ArgUrlList;
|
---|
546 |
|
---|
547 | /** Whether to show error message boxes for VM start errors. */
|
---|
548 | bool mShowStartVMErrors;
|
---|
549 |
|
---|
550 | /* Variable: Medium-enumeration stuff: */
|
---|
551 | UIMediumEnumerator *m_pMediumEnumerator;
|
---|
552 | mutable QReadWriteLock m_mediumEnumeratorDtorRwLock;
|
---|
553 |
|
---|
554 | #ifdef Q_WS_X11
|
---|
555 | /** X11: Holds the type of the Window Manager we are running under. */
|
---|
556 | X11WMType m_enmWindowManagerType;
|
---|
557 |
|
---|
558 | /** @name Host-screen geometry stuff
|
---|
559 | * @{ */
|
---|
560 | /** X11: Holds the desktop-widget watchdog instance aware of host-screen geometry changes. */
|
---|
561 | UIDesktopWidgetWatchdog *m_pDesktopWidgetWatchdog;
|
---|
562 | /** @} */
|
---|
563 | #endif /* Q_WS_X11 */
|
---|
564 |
|
---|
565 | /** The --aggressive-caching / --no-aggressive-caching option. */
|
---|
566 | bool mAgressiveCaching;
|
---|
567 | /** The --restore-current option. */
|
---|
568 | bool mRestoreCurrentSnapshot;
|
---|
569 |
|
---|
570 | /** @name Ad-hoc VM reconfiguration.
|
---|
571 | * @{ */
|
---|
572 | /** Floppy image. */
|
---|
573 | QString m_strFloppyImage;
|
---|
574 | /** DVD image. */
|
---|
575 | QString m_strDvdImage;
|
---|
576 | /** @} */
|
---|
577 |
|
---|
578 | /** @name VMM options
|
---|
579 | * @{ */
|
---|
580 | /** The --disable-patm option. */
|
---|
581 | bool mDisablePatm;
|
---|
582 | /** The --disable-csam option. */
|
---|
583 | bool mDisableCsam;
|
---|
584 | /** The --recompile-supervisor option. */
|
---|
585 | bool mRecompileSupervisor;
|
---|
586 | /** The --recompile-user option. */
|
---|
587 | bool mRecompileUser;
|
---|
588 | /** The --execute-all-in-iem option. */
|
---|
589 | bool mExecuteAllInIem;
|
---|
590 | /** The --warp-factor option value. */
|
---|
591 | uint32_t mWarpPct;
|
---|
592 | /** @} */
|
---|
593 |
|
---|
594 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
595 | /** Whether the debugger should be accessible or not.
|
---|
596 | * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED,
|
---|
597 | * --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
|
---|
598 | mutable int m_fDbgEnabled;
|
---|
599 | /** Whether to show the debugger automatically with the console.
|
---|
600 | * Use --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
|
---|
601 | mutable int m_fDbgAutoShow;
|
---|
602 | /** Whether to show the command line window when m_fDbgAutoShow is set. */
|
---|
603 | mutable int m_fDbgAutoShowCommandLine;
|
---|
604 | /** Whether to show the statistics window when m_fDbgAutoShow is set. */
|
---|
605 | mutable int m_fDbgAutoShowStatistics;
|
---|
606 | /** VBoxDbg module handle. */
|
---|
607 | RTLDRMOD m_hVBoxDbg;
|
---|
608 |
|
---|
609 | /** Whether --start-running, --start-paused or nothing was given. */
|
---|
610 | enum StartRunning m_enmStartRunning;
|
---|
611 | #endif
|
---|
612 |
|
---|
613 | #if defined (Q_WS_WIN32)
|
---|
614 | DWORD dwHTMLHelpCookie;
|
---|
615 | #endif
|
---|
616 |
|
---|
617 | QString mVerString;
|
---|
618 | QString mBrandingConfig;
|
---|
619 |
|
---|
620 | int m3DAvailable;
|
---|
621 |
|
---|
622 | QList <QString> mFamilyIDs;
|
---|
623 | QList <QList <CGuestOSType> > mTypes;
|
---|
624 |
|
---|
625 | QString mDiskTypes_Differencing;
|
---|
626 |
|
---|
627 | QString mUserDefinedPortName;
|
---|
628 |
|
---|
629 | QPixmap mWarningIcon, mErrorIcon;
|
---|
630 |
|
---|
631 | QFileIconProvider m_globalIconProvider;
|
---|
632 |
|
---|
633 | #ifdef VBOX_GUI_WITH_PIDFILE
|
---|
634 | QString m_strPidfile;
|
---|
635 | #endif
|
---|
636 |
|
---|
637 | char mSettingsPw[256];
|
---|
638 | bool mSettingsPwSet;
|
---|
639 |
|
---|
640 | /** General icon-pool. */
|
---|
641 | UIIconPoolGeneral *m_pIconPool;
|
---|
642 | /** Holds the thread-pool instance. */
|
---|
643 | UIThreadPool *m_pThreadPool;
|
---|
644 |
|
---|
645 | /* API: Instance stuff: */
|
---|
646 | static bool m_sfCleanupInProgress;
|
---|
647 | static VBoxGlobal* m_spInstance;
|
---|
648 | friend VBoxGlobal& vboxGlobal();
|
---|
649 | };
|
---|
650 |
|
---|
651 | /* Shortcut to the static VBoxGlobal::instance() method: */
|
---|
652 | inline VBoxGlobal& vboxGlobal() { return *VBoxGlobal::instance(); }
|
---|
653 |
|
---|
654 | #endif /* !___VBoxGlobal_h___ */
|
---|
655 |
|
---|