- Timestamp:
- Aug 5, 2016 1:27:06 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp
r63041 r63044 107 107 *********************************************************************************************************************************/ 108 108 109 UIDesktopWidgetWatchdog::UIDesktopWidgetWatchdog(QObject *pParent) 110 : QObject(pParent) 111 { 112 /* Prepare: */ 113 prepare(); 109 /* static */ 110 UIDesktopWidgetWatchdog *UIDesktopWidgetWatchdog::m_spInstance = 0; 111 112 /* static */ 113 void UIDesktopWidgetWatchdog::create() 114 { 115 /* Make sure instance isn't created: */ 116 AssertReturnVoid(!m_spInstance); 117 118 /* Create/prepare instance: */ 119 new UIDesktopWidgetWatchdog; 120 AssertReturnVoid(m_spInstance); 121 m_spInstance->prepare(); 122 } 123 124 /* static */ 125 void UIDesktopWidgetWatchdog::destroy() 126 { 127 /* Make sure instance is created: */ 128 AssertReturnVoid(m_spInstance); 129 130 /* Cleanup/destroy instance: */ 131 m_spInstance->cleanup(); 132 delete m_spInstance; 133 AssertReturnVoid(!m_spInstance); 134 } 135 136 UIDesktopWidgetWatchdog::UIDesktopWidgetWatchdog() 137 { 138 /* Initialize instance: */ 139 m_spInstance = this; 114 140 } 115 141 116 142 UIDesktopWidgetWatchdog::~UIDesktopWidgetWatchdog() 117 143 { 118 /* Cleanup: */119 cleanup();144 /* Deinitialize instance: */ 145 m_spInstance = 0; 120 146 } 121 147 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h
r63041 r63044 31 31 #endif /* QT_VERSION >= 0x050000 */ 32 32 33 /** QObject extension used as33 /** Singleton QObject extension used as 34 34 * a desktop-widget watchdog aware 35 35 * of the host-screen geometry changes. */ … … 37 37 { 38 38 Q_OBJECT; 39 40 /** Constructs desktop-widget watchdog. */ 41 UIDesktopWidgetWatchdog(); 42 /** Destructs desktop-widget watchdog. */ 43 ~UIDesktopWidgetWatchdog(); 39 44 40 45 signals: … … 51 56 public: 52 57 53 /** Constructs watchdog for the @a pParent being passed into the base-class. */ 54 UIDesktopWidgetWatchdog(QObject *pParent); 55 /** Destructs watchdog. */ 56 ~UIDesktopWidgetWatchdog(); 58 /** Returns the static instance of the desktop-widget watchdog. */ 59 static UIDesktopWidgetWatchdog *instance() { return m_spInstance; } 60 61 /** Creates the static instance of the desktop-widget watchdog. */ 62 static void create(); 63 /** Destroys the static instance of the desktop-widget watchdog. */ 64 static void destroy(); 57 65 58 66 /** Returns the number of host-screens currently available on the system. */ … … 112 120 void cleanup(); 113 121 122 /** Holds the static instance of the desktop-widget watchdog. */ 123 static UIDesktopWidgetWatchdog *m_spInstance; 124 114 125 #ifdef VBOX_WS_X11 115 126 /** Updates host-screen configuration according to new @a cHostScreenCount. … … 130 141 }; 131 142 143 /** 'Official' name for the desktop-widget watchdog singleton. */ 144 #define gpDesktop UIDesktopWidgetWatchdog::instance() 145 132 146 #endif /* !___UIDesktopWidgetWatchdog_h___ */ 133 147 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r62917 r63044 77 77 # include "UIIconPool.h" 78 78 # include "UIVirtualBoxEventHandler.h" 79 # include "UIDesktopWidgetWatchdog.h" 79 80 # ifdef VBOX_WS_X11 80 81 # include "UIHostComboEditor.h" 81 # include "UIDesktopWidgetWatchdog.h"82 82 # ifndef VBOX_OSE 83 83 # include "VBoxLicenseViewer.h" … … 237 237 , m_fCompositingManagerRunning(false) 238 238 , m_enmWindowManagerType(X11WMType_Unknown) 239 , m_pDesktopWidgetWatchdog(0)240 239 #endif /* VBOX_WS_X11 */ 241 240 #if defined(DEBUG_bird) … … 362 361 #ifdef VBOX_WS_X11 363 362 /* Make sure desktop-widget watchdog already created: */ 364 AssertPtrReturn( m_pDesktopWidgetWatchdog, QApplication::desktop()->screenGeometry(iHostScreenIndex));363 AssertPtrReturn(gpDesktop, QApplication::desktop()->screenGeometry(iHostScreenIndex)); 365 364 /* Redirect call to UIDesktopWidgetWatchdog: */ 366 return m_pDesktopWidgetWatchdog->screenGeometry(iHostScreenIndex);365 return gpDesktop->screenGeometry(iHostScreenIndex); 367 366 #endif /* VBOX_WS_X11 */ 368 367 … … 375 374 #ifdef VBOX_WS_X11 376 375 /* Make sure desktop-widget watchdog already created: */ 377 AssertPtrReturn( m_pDesktopWidgetWatchdog, QApplication::desktop()->availableGeometry(iHostScreenIndex));376 AssertPtrReturn(gpDesktop, QApplication::desktop()->availableGeometry(iHostScreenIndex)); 378 377 /* Redirect call to UIDesktopWidgetWatchdog: */ 379 return m_pDesktopWidgetWatchdog->availableGeometry(iHostScreenIndex);378 return gpDesktop->availableGeometry(iHostScreenIndex); 380 379 #endif /* VBOX_WS_X11 */ 381 380 … … 3989 3988 #endif /* VBOX_WS_MAC */ 3990 3989 3991 #ifdef VBOX_WS_X11 3992 /* Create desktop-widget watchdog instance: */ 3993 m_pDesktopWidgetWatchdog = new UIDesktopWidgetWatchdog(this); 3994 #endif /* VBOX_WS_X11 */ 3990 /* Create desktop-widget watchdog: */ 3991 UIDesktopWidgetWatchdog::create(); 3995 3992 3996 3993 /* Create message-center: */ … … 4491 4488 UIMessageCenter::destroy(); 4492 4489 4490 /* Destroy desktop-widget watchdog: */ 4491 UIDesktopWidgetWatchdog::destroy(); 4492 4493 4493 mValid = false; 4494 4494 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r62917 r63044 66 66 class UIIconPoolGeneral; 67 67 class UIThreadPool; 68 #ifdef VBOX_WS_X1169 class UIDesktopWidgetWatchdog;70 #endif /* VBOX_WS_X11 */71 68 72 69 // VBoxGlobal class … … 578 575 /** X11: Holds the type of the Window Manager we are running under. */ 579 576 X11WMType m_enmWindowManagerType; 580 581 /** @name Host-screen geometry stuff582 * @{ */583 /** X11: Holds the desktop-widget watchdog instance aware of host-screen geometry changes. */584 UIDesktopWidgetWatchdog *m_pDesktopWidgetWatchdog;585 /** @} */586 577 #endif /* VBOX_WS_X11 */ 587 578
Note:
See TracChangeset
for help on using the changeset viewer.