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