VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

Last change on this file was 103982, checked in by vboxsync, 2 months ago

FE/Qt: bugref:10624. Replacing override and final keywords with RT_OVERRIDE and RT_FINAL defines.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 29.7 KB
Line 
1/* $Id: UICommon.h 103982 2024-03-21 11:43:53Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UICommon class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_globals_UICommon_h
29#define FEQT_INCLUDED_SRC_globals_UICommon_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QObject>
36#include <QReadWriteLock>
37
38/* GUI includes: */
39#include "UIDefs.h"
40#include "UILibraryDefs.h"
41#include "UIMediumDefs.h"
42#ifdef VBOX_WS_NIX
43# include "VBoxUtils-nix.h"
44#endif
45
46/* COM includes: */
47#include "CMedium.h"
48#include "CSession.h"
49#include "KGraphicsControllerType.h"
50#include "KLockType.h"
51
52/* Forward declarations: */
53class QMenu;
54class QSessionManager;
55class QSpinBox;
56class CCloudMachine;
57class CHostVideoInputDevice;
58class CMachine;
59class CUSBDevice;
60class UIActionPool;
61class UIMedium;
62class UIMediumEnumerator;
63class UIThreadPool;
64class UITranslationEventListener;
65
66/** QObject subclass containing common GUI functionality. */
67class SHARED_LIBRARY_STUFF UICommon : public QObject
68{
69 Q_OBJECT;
70
71signals:
72
73 /** @name Common stuff.
74 * @{ */
75 /** Asks #UIStarter listener to restart UI. */
76 void sigAskToRestartUI();
77 /** Asks #UIStarter listener to close UI. */
78 void sigAskToCloseUI();
79
80 /** Asks listeners to commit data. */
81 void sigAskToCommitData();
82 /** Asks listeners to detach COM. */
83 void sigAskToDetachCOM();
84 /** @} */
85
86 /** @name Theme stuff.
87 * @{ */
88 /** Notifies listeners about theme change. */
89 void sigThemeChange();
90 /** @} */
91
92 /** @name Cloud Virtual Machine stuff.
93 * @{ */
94 /** Notifies listeners about cloud VM was unregistered.
95 * @param strProviderShortName Brings provider short name.
96 * @param strProfileName Brings profile name.
97 * @param uId Brings cloud VM id. */
98 void sigCloudMachineUnregistered(const QString &strProviderShortName,
99 const QString &strProfileName,
100 const QUuid &uId);
101 /** Notifies listeners about cloud VM was registered.
102 * @param strProviderShortName Brings provider short name.
103 * @param strProfileName Brings profile name.
104 * @param comMachine Brings cloud VM. */
105 void sigCloudMachineRegistered(const QString &strProviderShortName,
106 const QString &strProfileName,
107 const CCloudMachine &comMachine);
108 /** @} */
109
110 /** @name COM: Virtual Media stuff.
111 * @{ */
112 /** Notifies listeners about medium with certain @a uMediumID created. */
113 void sigMediumCreated(const QUuid &uMediumID);
114 /** Notifies listeners about medium with certain @a uMediumID deleted. */
115 void sigMediumDeleted(const QUuid &uMediumID);
116
117 /** Notifies listeners about medium-enumeration started. */
118 void sigMediumEnumerationStarted();
119 /** Notifies listeners about medium with certain @a uMediumID enumerated. */
120 void sigMediumEnumerated(const QUuid &uMediumID);
121 /** Notifies listeners about medium-enumeration finished. */
122 void sigMediumEnumerationFinished();
123 /** Notifies listeners about update of recently media list. */
124 void sigRecentMediaListUpdated(UIMediumDeviceType enmMediumType);
125 /** @} */
126
127public:
128
129 /** VM launch running options. */
130 enum LaunchRunning
131 {
132 LaunchRunning_Default, /**< Default (depends on debug settings). */
133 LaunchRunning_No, /**< Start the VM paused. */
134 LaunchRunning_Yes /**< Start the VM running. */
135 };
136
137 /** Returns UICommon instance. */
138 static UICommon *instance() { return s_pInstance; }
139 /** Creates UICommon instance of passed @a enmType. */
140 static void create(UIType enmType);
141 /** Destroys UICommon instance. */
142 static void destroy();
143
144 /** @name General stuff.
145 * @{ */
146 /** Returns the UI type. */
147 UIType uiType() const { return m_enmType; }
148
149 /** Returns whether UICommon instance is properly initialized. */
150 bool isValid() const { return m_fValid; }
151 /** Returns whether UICommon instance cleanup is in progress. */
152 bool isCleaningUp() const { return m_fCleaningUp; }
153 /** @} */
154
155 /** @name Host OS stuff.
156 * @{ */
157#ifdef VBOX_WS_MAC
158 /** macOS: Returns #MacOSXRelease determined by <i>uname</i> call. */
159 static MacOSXRelease determineOsRelease();
160 /** macOS: Returns #MacOSXRelease determined during UICommon prepare routine. */
161 MacOSXRelease osRelease() const { return m_enmMacOSVersion; }
162#endif
163
164#ifdef VBOX_WS_NIX
165 /** X11: Returns the type of the Window Manager we are running under. */
166 X11WMType typeOfWindowManager() const { return m_enmWindowManagerType; }
167 /** X11: Returns whether the Window Manager we are running under is composition one. */
168 bool isCompositingManagerRunning() const { return m_fCompositingManagerRunning; }
169 /** Returns true if the detected display server type is either xorg or xwayland. */
170 bool X11ServerAvailable() const;
171 /** Returns display server type. */
172 VBGHDISPLAYSERVERTYPE displayServerType() const;
173#endif
174 /** Returns the name of the host OS by using IHost::getOperatingSystem. */
175 QString hostOperatingSystem() const;
176
177#if defined(VBOX_WS_MAC)
178 // Provided by UICocoaApplication ..
179#elif defined(VBOX_WS_WIN)
180 /** Returns whether Windows host is in Dark mode. */
181 bool isWindowsInDarkMode() const;
182#else /* Linux, BSD, Solaris */
183 /** Returns whether palette is in Dark mode. */
184 bool isPaletteInDarkMode() const;
185#endif /* Linux, BSD, Solaris */
186
187 /** Returns whether host OS is in Dark mode. */
188 bool isInDarkMode() const { return m_fDarkMode; }
189
190 /** Loads the color theme. */
191 void loadColorTheme();
192 /** @} */
193
194 /** @name Process arguments stuff.
195 * @{ */
196 /** Process application args. */
197 bool processArgs();
198
199 /** Returns whether there are unhandled URL arguments present. */
200 bool argumentUrlsPresent() const;
201 /** Takes and returns the URL argument list while clearing the source. */
202 QList<QUrl> takeArgumentUrls();
203
204 /** Returns the --startvm option value (managed VM id). */
205 QUuid managedVMUuid() const { return m_uManagedVMId; }
206 /** Returns the --separate option value (whether GUI process is separate from VM process). */
207 bool isSeparateProcess() const { return m_fSeparateProcess; }
208 /** Returns the --no-startvm-errormsgbox option value (whether startup VM errors are disabled). */
209 bool showStartVMErrors() const { return m_fShowStartVMErrors; }
210
211 /** Returns the --aggressive-caching / --no-aggressive-caching option value (whether medium-enumeration is required). */
212 bool agressiveCaching() const { return m_fAgressiveCaching; }
213
214 /** Returns the --restore-current option value (whether we should restore current snapshot before VM started). */
215 bool shouldRestoreCurrentSnapshot() const { return m_fRestoreCurrentSnapshot; }
216 /** Defines whether we should fRestore current snapshot before VM started. */
217 void setShouldRestoreCurrentSnapshot(bool fRestore) { m_fRestoreCurrentSnapshot = fRestore; }
218
219 /** Returns the --no-keyboard-grabbing option value (whether we should restore
220 * grab the keyboard or not - for debugging). */
221 bool shouldNotGrabKeyboard() const { return m_fNoKeyboardGrabbing; }
222
223 /** Returns the --fda option value (whether we have floppy image). */
224 bool hasFloppyImageToMount() const { return !m_uFloppyImage.isNull(); }
225 /** Returns the --dvd | --cdrom option value (whether we have DVD image). */
226 bool hasDvdImageToMount() const { return !m_uDvdImage.isNull(); }
227 /** Returns floppy image name. */
228 QUuid getFloppyImage() const { return m_uFloppyImage; }
229 /** Returns DVD image name. */
230 QUuid getDvdImage() const { return m_uDvdImage; }
231
232 /** Returns the --execute-all-in-iem option value. */
233 bool areWeToExecuteAllInIem() const { return m_fExecuteAllInIem; }
234 /** Returns whether --warp-factor option value is equal to 100. */
235 bool isDefaultWarpPct() const { return m_uWarpPct == 100; }
236 /** Returns the --warp-factor option value. */
237 uint32_t getWarpPct() const { return m_uWarpPct; }
238
239#ifdef VBOX_WITH_DEBUGGER_GUI
240 /** Holds whether the debugger should be accessible. */
241 bool isDebuggerEnabled() const;
242 /** Holds whether to show the debugger automatically with the console. */
243 bool isDebuggerAutoShowEnabled() const;
244 /** Holds whether to show the command line window when m_fDbgAutoShow is set. */
245 bool isDebuggerAutoShowCommandLineEnabled() const;
246 /** Holds whether to show the statistics window when m_fDbgAutoShow is set. */
247 bool isDebuggerAutoShowStatisticsEnabled() const;
248 /** Returns the combined --statistics-expand values. */
249 QString const getDebuggerStatisticsExpand() const { return m_strDbgStatisticsExpand; }
250 /** Returns the --statistics-filter value. */
251 QString const getDebuggerStatisticsFilter() const { return m_strDbgStatisticsFilter; }
252 /** Returns the --statistics-config value. */
253 QString const getDebuggerStatisticsConfig() const { return m_strDbgStatisticsConfig; }
254
255 /** VBoxDbg module handle. */
256 RTLDRMOD getDebuggerModule() const { return m_hVBoxDbg; }
257#endif
258
259 /** Returns whether VM should start paused. */
260 bool shouldStartPaused() const;
261
262#ifdef VBOX_GUI_WITH_PIDFILE
263 /** Creates PID file. */
264 void createPidfile();
265 /** Deletes PID file. */
266 void deletePidfile();
267#endif
268 /** @} */
269
270 /** @name COM: Virtual Machine stuff.
271 * @{ */
272 /** Switches to certain @a comMachine. */
273 static bool switchToMachine(CMachine &comMachine);
274 /** Launches certain @a comMachine in specified @a enmLaunchMode. */
275 static bool launchMachine(CMachine &comMachine, UILaunchMode enmLaunchMode = UILaunchMode_Default);
276
277 /** Opens session of certain @a enmLockType for VM with certain @a uId. */
278 CSession openSession(QUuid uId, KLockType enmLockType = KLockType_Write);
279 /** Opens session of certain @a enmLockType for currently chosen VM. */
280 CSession openSession(KLockType enmLockType = KLockType_Write);
281 /** Opens session of KLockType_Shared type for VM with certain @a uId. */
282 CSession openExistingSession(const QUuid &uId) { return openSession(uId, KLockType_Shared); }
283 /** Tries to guess if new @a comSession needs to be opened for certain @a comMachine,
284 * if yes, new session of required type will be opened and machine will be updated,
285 * otherwise, no session will be created and machine will be left unchanged. */
286 CSession tryToOpenSessionFor(CMachine &comMachine);
287 /** @} */
288
289 /** @name COM: Cloud Virtual Machine stuff.
290 * @{ */
291 /** Notifies listeners about cloud VM was unregistered.
292 * @param strProviderShortName Brings provider short name.
293 * @param strProfileName Brings profile name.
294 * @param uId Brings cloud VM id. */
295 void notifyCloudMachineUnregistered(const QString &strProviderShortName,
296 const QString &strProfileName,
297 const QUuid &uId);
298 /** Notifies listeners about cloud VM was registered.
299 * @param strProviderShortName Brings provider short name.
300 * @param strProfileName Brings profile name.
301 * @param comMachine Brings cloud VM. */
302 void notifyCloudMachineRegistered(const QString &strProviderShortName,
303 const QString &strProfileName,
304 const CCloudMachine &comMachine);
305 /** @} */
306
307 /** @name COM: Virtual Media stuff.
308 * @{ */
309 /** Enumerates passed @a comMedia. */
310 void enumerateMedia(const CMediumVector &comMedia = CMediumVector());
311 /** Calls refresh for each medium which has been already enumerated. */
312 void refreshMedia();
313 /** Returns whether full medium-enumeration is requested. */
314 bool isFullMediumEnumerationRequested() const;
315 /** Returns whether any medium-enumeration is in progress. */
316 bool isMediumEnumerationInProgress() const;
317 /** Returns enumerated medium with certain @a uMediumID. */
318 UIMedium medium(const QUuid &uMediumID) const;
319 /** Returns enumerated medium IDs. */
320 QList<QUuid> mediumIDs() const;
321 /** Creates medium on the basis of passed @a guiMedium description. */
322 void createMedium(const UIMedium &guiMedium);
323
324 /** Opens external medium by passed @a strMediumLocation.
325 * @param enmMediumType Brings the medium type.
326 * @param pParent Brings the dialog parent.
327 * @param strMediumLocation Brings the file path to load medium from.
328 * @param pParent Brings the dialog parent. */
329 QUuid openMedium(UIMediumDeviceType enmMediumType, QString strMediumLocation, QWidget *pParent = 0);
330
331 /** Opens external medium using file-open dialog.
332 * @param enmMediumType Brings the medium type.
333 * @param pParent Brings the dialog parent.
334 * @param strDefaultFolder Brings the folder to browse for medium.
335 * @param fUseLastFolder Brings whether we should propose to use last used folder. */
336 QUuid openMediumWithFileOpenDialog(UIMediumDeviceType enmMediumType, QWidget *pParent = 0,
337 const QString &strDefaultFolder = QString(), bool fUseLastFolder = false);
338
339 /** Creates and shows a dialog (wizard) to create a medium of type @a enmMediumType.
340 * @param pParent Passes the parent of the dialog,
341 * @param enmMediumType Passes the medium type,
342 * @param strMachineName Passes the name of the machine,
343 * @param strMachineFolder Passes the machine folder,
344 * @param strMachineGuestOSTypeId Passes the type ID of machine's guest os,
345 * @param fEnableCreate Passes whether to show/enable create action in the medium selector dialog,
346 * returns QUuid of the new medium */
347 QUuid openMediumCreatorDialog(UIActionPool *pActionPool, QWidget *pParent, UIMediumDeviceType enmMediumType,
348 const QString &strMachineFolder = QString(), const QString &strMachineName = QString(),
349 const QString &strMachineGuestOSTypeId = QString());
350
351 /** Prepares storage menu according passed parameters.
352 * @param menu Brings the #QMenu to be prepared.
353 * @param pListener Brings the listener #QObject, this @a menu being prepared for.
354 * @param pszSlotName Brings the name of the SLOT in the @a pListener above, this menu will be handled with.
355 * @param comMachine Brings the #CMachine object, this @a menu being prepared for.
356 * @param strControllerName Brings the name of the #CStorageController in the @a machine above.
357 * @param storageSlot Brings the #StorageSlot of the storage controller with @a strControllerName above. */
358 void prepareStorageMenu(QMenu *pMenu,
359 QObject *pListener, const char *pszSlotName,
360 const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot);
361 /** Updates @a comConstMachine storage with data described by @a target. */
362 void updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target, UIActionPool *pActionPool);
363
364 /** Generates details for passed @a comMedium.
365 * @param fPredictDiff Brings whether medium will be marked differencing on attaching.
366 * @param fUseHtml Brings whether HTML subsets should be used in the generated output. */
367 QString storageDetails(const CMedium &comMedium, bool fPredictDiff, bool fUseHtml = true);
368
369 /** Update extra data related to recently used/referred media.
370 * @param enmMediumType Passes the medium type.
371 * @param strMediumLocation Passes the medium location. */
372 void updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType enmMediumType, QString strMediumLocation);
373
374 /** Searches extra data for the recently used folder path which corresponds to @a enmMediumType. When that search fails
375 it looks for recent folder extra data for other medium types. As the last resort returns default vm folder path.
376 * @param enmMediumType Passes the medium type. */
377 QString defaultFolderPathForType(UIMediumDeviceType enmMediumType);
378
379 /** Calculates @a cAmount of immutable images used by @a comMachine specified. */
380 static bool acquireAmountOfImmutableImages(const CMachine &comMachine, ulong &cAmount);
381 /** @} */
382
383 /** @name COM: USB stuff.
384 * @{ */
385#ifdef RT_OS_LINUX
386 /** Verifies that USB drivers are properly configured on Linux. */
387 static void checkForWrongUSBMounted();
388#endif
389
390 /** Generates details for passed USB @a comDevice. */
391 static QString usbDetails(const CUSBDevice &comDevice);
392 /** Generates tool-tip for passed USB @a comDevice. */
393 static QString usbToolTip(const CUSBDevice &comDevice);
394 /** Generates tool-tip for passed USB @a comFilter. */
395 static QString usbToolTip(const CUSBDeviceFilter &comFilter);
396 /** Generates tool-tip for passed USB @a comWebcam. */
397 static QString usbToolTip(const CHostVideoInputDevice &comWebcam);
398 /** @} */
399
400 /** @name COM: Recording stuff.
401 * @{ */
402 /** Returns supported recording features flag. */
403 int supportedRecordingFeatures() const;
404 /** @} */
405
406 /** @name File-system stuff.
407 * @{ */
408 /** Returns full help file name. */
409 static QString helpFile();
410
411 /** Returns documents path. */
412 static QString documentsPath();
413
414 /** Returns whether passed @a strFileName ends with one of allowed extension in the @a extensions list. */
415 static bool hasAllowedExtension(const QString &strFileName, const QStringList &extensions);
416
417 /** Returns a file name (unique up to extension) wrt. @a strFullFolderPath folder content. Starts
418 * searching strBaseFileName and adds suffixes until a unique file name is found. */
419 static QString findUniqueFileName(const QString &strFullFolderPath, const QString &strBaseFileName);
420 /** @} */
421
422 /** @name Widget stuff.
423 * @{ */
424 /** Assigns minimum @a pSpinBox to correspond to @a cCount digits. */
425 static void setMinimumWidthAccordingSymbolCount(QSpinBox *pSpinBox, int cCount);
426 /** @} */
427
428 /** @name Display stuff.
429 * @{ */
430#ifdef VBOX_WITH_3D_ACCELERATION
431 /** Returns whether guest OS type with passed @a strGuestOSTypeId is WDDM compatible. */
432 static bool isWddmCompatibleOsType(const QString &strGuestOSTypeId);
433#endif
434 /** Returns the required video memory in bytes for the current desktop
435 * resolution at maximum possible screen depth in bpp. */
436 static quint64 requiredVideoMemory(const QString &strGuestOSTypeId, int cMonitors = 1);
437 KGraphicsControllerType getRecommendedGraphicsController(const QString &strGuestOSTypeId) const;
438 /** @} */
439
440 /** @name Thread stuff.
441 * @{ */
442 /** Returns the thread-pool instance. */
443 UIThreadPool *threadPool() const { return m_pThreadPool; }
444 /** Returns the thread-pool instance for cloud needs. */
445 UIThreadPool *threadPoolCloud() const { return m_pThreadPoolCloud; }
446 /** @} */
447
448 /** @name Context sensitive help related functionality
449 * @{ */
450 /** Sets the property for help keyword on a QObject
451 * @param pObject The object to set the help keyword property on
452 * @param strKeyword The values of the key word property. */
453 static void setHelpKeyword(QObject *pObject, const QString &strHelpKeyword);
454 /** Returns the property for help keyword of a QObject. If no such property exists returns an empty QString.
455 * @param pWidget The object to get the help keyword property from. */
456 static QString helpKeyword(const QObject *pWidget);
457 /** @} */
458
459public slots:
460
461 /** @name Process arguments stuff.
462 * @{ */
463 /** Opens the specified URL using OS/Desktop capabilities. */
464 bool openURL(const QString &strURL) const;
465 /** @} */
466
467 /** @name Localization stuff.
468 * @{ */
469 /** Handles language change to new @a strLanguage. */
470 void sltGUILanguageChange(QString strLanguage);
471 /** @} */
472
473 /** @name Media related stuff.
474 * @{ */
475 /** Handles signal about medium was created. */
476 void sltHandleMediumCreated(const CMedium &comMedium);
477 /** @} */
478
479 /** @name Machine related stuff.
480 * @{ */
481 /** Handles signal about machine was created. */
482 void sltHandleMachineCreated(const CMachine &comMachine);
483 /** @} */
484
485 /** @name Cloud Machine related stuff.
486 * @{ */
487 /** Handles signal about cloud machine was added. */
488 void sltHandleCloudMachineAdded(const QString &strProviderShortName,
489 const QString &strProfileName,
490 const CCloudMachine &comMachine);
491 /** @} */
492
493protected:
494
495 /** Preprocesses any Qt @a pEvent for passed @a pObject. */
496 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
497
498 /** Handles translation event. */
499 virtual void retranslateUi();
500
501protected slots:
502
503 /** Calls for cleanup() functionality. */
504 void sltCleanup() { cleanup(); }
505
506#ifndef VBOX_GUI_WITH_CUSTOMIZATIONS1
507 /** @name Common stuff.
508 * @{ */
509 /** Handles @a manager request for emergency session shutdown. */
510 void sltHandleCommitDataRequest(QSessionManager &manager);
511 /** @} */
512#endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
513
514 /** @name COM stuff.
515 * @{ */
516 /** Handles the VBoxSVC availability change. */
517 void sltHandleVBoxSVCAvailabilityChange(bool fAvailable);
518 /** @} */
519
520 /* Handle font scale factor change. */
521 void sltHandleFontScaleFactorChanged(int iFontScaleFactor);
522
523private:
524
525 /** Construcs global VirtualBox object of passed @a enmType. */
526 UICommon(UIType enmType);
527 /** Destrucs global VirtualBox object. */
528 virtual ~UICommon() RT_OVERRIDE RT_FINAL;
529
530 /** Prepares all. */
531 void prepare();
532 /** Cleanups all. */
533 void cleanup();
534
535 /** @name Process arguments stuff.
536 * @{ */
537#ifdef VBOX_WITH_DEBUGGER_GUI
538 /** Initializes a debugger config variable.
539 * @param piDbgCfgVar Brings the debugger config variable to init.
540 * @param pszEnvVar Brings the environment variable name relating to this variable.
541 * @param pszExtraDataName Brings the extra data name relating to this variable.
542 * @param fDefault Brings the default value. */
543 void initDebuggerVar(int *piDbgCfgVar, const char *pszEnvVar, const char *pszExtraDataName, bool fDefault = false);
544 /** Set a debugger config variable according according to start up argument.
545 * @param piDbgCfgVar Brings the debugger config variable to set.
546 * @param fState Brings the value from the command line. */
547 void setDebuggerVar(int *piDbgCfgVar, bool fState);
548 /** Checks the state of a debugger config variable, updating it with the machine settings on the first invocation.
549 * @param piDbgCfgVar Brings the debugger config variable to consult.
550 * @param pszExtraDataName Brings the extra data name relating to this variable. */
551 bool isDebuggerWorker(int *piDbgCfgVar, const char *pszExtraDataName) const;
552#endif
553 /** @} */
554
555 /** Holds the singleton UICommon instance. */
556 static UICommon *s_pInstance;
557
558 /** @name General stuff.
559 * @{ */
560 /** Holds the UI type. */
561 UIType m_enmType;
562
563 /** Holds whether UICommon instance is properly initialized. */
564 bool m_fValid;
565 /** Holds whether UICommon instance cleanup is in progress. */
566 bool m_fCleaningUp;
567#ifdef VBOX_WS_WIN
568 /** Holds whether overall GUI data is committed. */
569 bool m_fDataCommitted;
570#endif
571 /** @} */
572
573 /** @name Host OS stuff.
574 * @{ */
575#ifdef VBOX_WS_MAC
576 /** macOS: Holds the #MacOSXRelease determined using <i>uname</i> call. */
577 MacOSXRelease m_enmMacOSVersion;
578#endif
579
580#ifdef VBOX_WS_NIX
581 /** X11: Holds the #X11WMType of the Window Manager we are running under. */
582 X11WMType m_enmWindowManagerType;
583 /** X11: Holds whether the Window Manager we are running at is composition one. */
584 bool m_fCompositingManagerRunning;
585 /** Unixes: Holds the display server type. */
586 VBGHDISPLAYSERVERTYPE m_enmDisplayServerType;
587#endif
588
589 /** Holds whether host OS is in Dark mode. */
590 bool m_fDarkMode;
591 /** @} */
592
593 /** @name Process arguments stuff.
594 * @{ */
595 /** Holds the URL arguments list. */
596 QList<QUrl> m_listArgUrls;
597
598 /** Holds the --startvm option value (managed VM id). */
599 QUuid m_uManagedVMId;
600 /** Holds the --separate option value (whether GUI process is separate from VM process). */
601 bool m_fSeparateProcess;
602 /** Holds the --no-startvm-errormsgbox option value (whether startup VM errors are disabled). */
603 bool m_fShowStartVMErrors;
604
605 /** Holds the --aggressive-caching / --no-aggressive-caching option value (whether medium-enumeration is required). */
606 bool m_fAgressiveCaching;
607
608 /** Holds the --restore-current option value. */
609 bool m_fRestoreCurrentSnapshot;
610
611 /** Holds the --no-keyboard-grabbing option value. */
612 bool m_fNoKeyboardGrabbing;
613
614 /** Holds the --fda option value (floppy image). */
615 QUuid m_uFloppyImage;
616 /** Holds the --dvd | --cdrom option value (DVD image). */
617 QUuid m_uDvdImage;
618
619 /** Holds the --execute-all-in-iem option value. */
620 bool m_fExecuteAllInIem;
621 /** Holds the --warp-factor option value. */
622 uint32_t m_uWarpPct;
623
624#ifdef VBOX_WITH_DEBUGGER_GUI
625 /** Holds whether the debugger should be accessible. */
626 mutable int m_fDbgEnabled;
627 /** Holds whether to show the debugger automatically with the console. */
628 mutable int m_fDbgAutoShow;
629 /** Holds whether to show the command line window when m_fDbgAutoShow is set. */
630 mutable int m_fDbgAutoShowCommandLine;
631 /** Holds whether to show the statistics window when m_fDbgAutoShow is set. */
632 mutable int m_fDbgAutoShowStatistics;
633 /** Pattern of statistics to expand when opening the viewer. */
634 QString m_strDbgStatisticsExpand;
635 /** The statistics viewer main filter pattern. */
636 QString m_strDbgStatisticsFilter;
637 /** The statistics viewer advanced filter configuration and possibly more. */
638 QString m_strDbgStatisticsConfig;
639
640 /** VBoxDbg module handle. */
641 RTLDRMOD m_hVBoxDbg;
642
643 /** Holds whether --start-running, --start-paused or nothing was given. */
644 LaunchRunning m_enmLaunchRunning;
645#endif
646
647 /** Holds the --settingspw option value or the content of --settingspwfile. */
648 char m_astrSettingsPw[256];
649 /** Holds the --settingspwfile option value. */
650 bool m_fSettingsPwSet;
651
652#ifdef VBOX_GUI_WITH_PIDFILE
653 /** Holds the --pidfile option value (application PID file path). */
654 QString m_strPidFile;
655#endif
656 /** @} */
657
658 /** @name Thread stuff.
659 * @{ */
660 /** Holds the thread-pool instance. */
661 UIThreadPool *m_pThreadPool;
662 /** Holds the thread-pool instance for cloud needs. */
663 UIThreadPool *m_pThreadPoolCloud;
664 /** @} */
665
666 /** @name Media related stuff.
667 * @{ */
668 /** Holds the medium enumerator cleanup protection token. */
669 mutable QReadWriteLock m_meCleanupProtectionToken;
670
671 /** Holds the medium enumerator. */
672 UIMediumEnumerator *m_pMediumEnumerator;
673 /** List of medium names that should not appears in the recently used media extra data. */
674 QStringList m_recentMediaExcludeList;
675 /** @} */
676
677 /** @name Font scaling related variables.
678 * @{ */
679 int iOriginalFontPixelSize;
680 int iOriginalFontPointSize;
681 /** @} */
682
683 UITranslationEventListener *m_pTranlationEventListener;
684 /** Allows for shortcut access. */
685 friend UICommon &uiCommon();
686};
687
688/** Singleton UICommon 'official' name. */
689inline UICommon &uiCommon() { return *UICommon::instance(); }
690
691#endif /* !FEQT_INCLUDED_SRC_globals_UICommon_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use