- Timestamp:
- Mar 28, 2016 3:58:32 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
r60224 r60225 22 22 /* GUI includes: */ 23 23 # include "UIConsoleEventHandler.h" 24 # include "UIMainEventListener.h"25 24 # include "VBoxGlobal.h" 26 25 # include "UISession.h" … … 71 70 void UIConsoleEventHandler::prepare() 72 71 { 72 /* Prepare: */ 73 prepareListener(); 74 prepareConnections(); 75 } 76 77 void UIConsoleEventHandler::prepareListener() 78 { 73 79 /* Make sure session is passed: */ 74 80 AssertPtrReturnVoid(m_pSession); 75 81 76 82 /* Create Main event listener instance: */ 77 ComObjPtr<UIMainEventListenerImpl> pListener; 78 pListener.createObject(); 79 pListener->init(new UIMainEventListener, this); 80 m_mainEventListener = CEventListener(pListener); 83 m_pQtListener.createObject(); 84 m_pQtListener->init(new UIMainEventListener, this); 85 m_comEventListener = CEventListener(m_pQtListener); 81 86 82 87 /* Get console: */ … … 108 113 << KVBoxEventType_OnCanShowWindow 109 114 << KVBoxEventType_OnShowWindow; 110 eventSource.RegisterListener(m_mainEventListener, events, TRUE); 111 112 115 eventSource.RegisterListener(m_comEventListener, events, TRUE); 116 } 117 118 void UIConsoleEventHandler::prepareConnections() 119 { 113 120 /* Create queued (async) connections for non-waitable signals: */ 114 connect( pListener->getWrapped(), SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)),121 connect(m_pQtListener->getWrapped(), SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)), 115 122 this, SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)), 116 123 Qt::QueuedConnection); 117 connect( pListener->getWrapped(), SIGNAL(sigMouseCapabilityChange(bool, bool, bool, bool)),124 connect(m_pQtListener->getWrapped(), SIGNAL(sigMouseCapabilityChange(bool, bool, bool, bool)), 118 125 this, SIGNAL(sigMouseCapabilityChange(bool, bool, bool, bool)), 119 126 Qt::QueuedConnection); 120 connect( pListener->getWrapped(), SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)),127 connect(m_pQtListener->getWrapped(), SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)), 121 128 this, SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)), 122 129 Qt::QueuedConnection); 123 connect( pListener->getWrapped(), SIGNAL(sigStateChange(KMachineState)),130 connect(m_pQtListener->getWrapped(), SIGNAL(sigStateChange(KMachineState)), 124 131 this, SIGNAL(sigStateChange(KMachineState)), 125 132 Qt::QueuedConnection); 126 connect( pListener->getWrapped(), SIGNAL(sigAdditionsChange()),133 connect(m_pQtListener->getWrapped(), SIGNAL(sigAdditionsChange()), 127 134 this, SIGNAL(sigAdditionsChange()), 128 135 Qt::QueuedConnection); 129 connect( pListener->getWrapped(), SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)),136 connect(m_pQtListener->getWrapped(), SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)), 130 137 this, SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)), 131 138 Qt::QueuedConnection); 132 connect( pListener->getWrapped(), SIGNAL(sigStorageDeviceChange(CMediumAttachment, bool, bool)),139 connect(m_pQtListener->getWrapped(), SIGNAL(sigStorageDeviceChange(CMediumAttachment, bool, bool)), 133 140 this, SIGNAL(sigStorageDeviceChange(CMediumAttachment, bool, bool)), 134 141 Qt::QueuedConnection); 135 connect( pListener->getWrapped(), SIGNAL(sigMediumChange(CMediumAttachment)),142 connect(m_pQtListener->getWrapped(), SIGNAL(sigMediumChange(CMediumAttachment)), 136 143 this, SIGNAL(sigMediumChange(CMediumAttachment)), 137 144 Qt::QueuedConnection); 138 connect( pListener->getWrapped(), SIGNAL(sigVRDEChange()),145 connect(m_pQtListener->getWrapped(), SIGNAL(sigVRDEChange()), 139 146 this, SIGNAL(sigVRDEChange()), 140 147 Qt::QueuedConnection); 141 connect( pListener->getWrapped(), SIGNAL(sigVideoCaptureChange()),148 connect(m_pQtListener->getWrapped(), SIGNAL(sigVideoCaptureChange()), 142 149 this, SIGNAL(sigVideoCaptureChange()), 143 150 Qt::QueuedConnection); 144 connect( pListener->getWrapped(), SIGNAL(sigUSBControllerChange()),151 connect(m_pQtListener->getWrapped(), SIGNAL(sigUSBControllerChange()), 145 152 this, SIGNAL(sigUSBControllerChange()), 146 153 Qt::QueuedConnection); 147 connect( pListener->getWrapped(), SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)),154 connect(m_pQtListener->getWrapped(), SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)), 148 155 this, SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)), 149 156 Qt::QueuedConnection); 150 connect( pListener->getWrapped(), SIGNAL(sigSharedFolderChange()),157 connect(m_pQtListener->getWrapped(), SIGNAL(sigSharedFolderChange()), 151 158 this, SIGNAL(sigSharedFolderChange()), 152 159 Qt::QueuedConnection); 153 connect( pListener->getWrapped(), SIGNAL(sigCPUExecutionCapChange()),160 connect(m_pQtListener->getWrapped(), SIGNAL(sigCPUExecutionCapChange()), 154 161 this, SIGNAL(sigCPUExecutionCapChange()), 155 162 Qt::QueuedConnection); 156 connect( pListener->getWrapped(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),163 connect(m_pQtListener->getWrapped(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)), 157 164 this, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)), 158 165 Qt::QueuedConnection); 159 connect( pListener->getWrapped(), SIGNAL(sigRuntimeError(bool, QString, QString)),166 connect(m_pQtListener->getWrapped(), SIGNAL(sigRuntimeError(bool, QString, QString)), 160 167 this, SIGNAL(sigRuntimeError(bool, QString, QString)), 161 168 Qt::QueuedConnection); 162 169 163 170 /* Create direct (sync) connections for waitable signals: */ 164 connect( pListener->getWrapped(), SIGNAL(sigCanShowWindow(bool &, QString &)),171 connect(m_pQtListener->getWrapped(), SIGNAL(sigCanShowWindow(bool &, QString &)), 165 172 this, SLOT(sltCanShowWindow(bool &, QString &)), 166 173 Qt::DirectConnection); 167 connect( pListener->getWrapped(), SIGNAL(sigShowWindow(qint64 &)),174 connect(m_pQtListener->getWrapped(), SIGNAL(sigShowWindow(qint64 &)), 168 175 this, SLOT(sltShowWindow(qint64 &)), 169 176 Qt::DirectConnection); 170 177 } 171 178 172 void UIConsoleEventHandler::cleanup() 179 void UIConsoleEventHandler::cleanupConnections() 180 { 181 /* Nothing for now. */ 182 } 183 184 void UIConsoleEventHandler::cleanupListener() 173 185 { 174 186 /* Make sure session is passed: */ … … 183 195 AssertWrapperOk(eventSource); 184 196 /* Unregister listener: */ 185 eventSource.UnregisterListener(m_mainEventListener); 197 eventSource.UnregisterListener(m_comEventListener); 198 } 199 200 void UIConsoleEventHandler::cleanup() 201 { 202 /* Cleanup: */ 203 cleanupConnections(); 204 cleanupListener(); 186 205 } 187 206 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
r60224 r60225 21 21 /* Qt includes: */ 22 22 #include <QObject> 23 24 /* GUI includes: */ 25 #include "UIMainEventListener.h" 23 26 24 27 /* COM includes: */ … … 95 98 ~UIConsoleEventHandler(); 96 99 97 /** Prepares all. */ 98 void prepare(); 99 /** Cleanups all. */ 100 void cleanup(); 100 /** @name Prepare/Cleanup cascade. 101 * @{ */ 102 /** Prepares all. */ 103 void prepare(); 104 /** Prepares listener. */ 105 void prepareListener(); 106 /** Prepares connections. */ 107 void prepareConnections(); 108 109 /** Cleanups connections. */ 110 void cleanupConnections(); 111 /** Cleanups listener. */ 112 void cleanupListener(); 113 /** Cleanups all. */ 114 void cleanup(); 115 /** @} */ 101 116 102 117 private slots: … … 112 127 static UIConsoleEventHandler *m_spInstance; 113 128 129 /** Holds the Qt event listener instance. */ 130 ComObjPtr<UIMainEventListenerImpl> m_pQtListener; 114 131 /** Holds the COM event listener instance. */ 115 CEventListener m_ mainEventListener;132 CEventListener m_comEventListener; 116 133 117 134 /** Holds the UI session reference. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp
r60223 r60225 22 22 /* GUI includes: */ 23 23 # include "UIVirtualBoxEventHandler.h" 24 # include "UIMainEventListener.h"25 24 # include "VBoxGlobal.h" 26 25 … … 66 65 void UIVirtualBoxEventHandler::prepare() 67 66 { 67 /* Prepare: */ 68 prepareListener(); 69 prepareConnections(); 70 } 71 72 void UIVirtualBoxEventHandler::prepareListener() 73 { 68 74 /* Create Main event listener instance: */ 69 ComObjPtr<UIMainEventListenerImpl> pListener; 70 pListener.createObject(); 71 pListener->init(new UIMainEventListener, this); 72 m_mainEventListener = CEventListener(pListener); 75 m_pQtListener.createObject(); 76 m_pQtListener->init(new UIMainEventListener, this); 77 m_comEventListener = CEventListener(m_pQtListener); 73 78 74 79 /* Get VirtualBoxClient: */ … … 82 87 vboxClientEvents 83 88 << KVBoxEventType_OnVBoxSVCAvailabilityChanged; 84 eventSourceVirtualBoxClient.RegisterListener(m_ mainEventListener, vboxClientEvents, TRUE);89 eventSourceVirtualBoxClient.RegisterListener(m_comEventListener, vboxClientEvents, TRUE); 85 90 AssertWrapperOk(eventSourceVirtualBoxClient); 86 91 … … 102 107 << KVBoxEventType_OnSnapshotChanged 103 108 << KVBoxEventType_OnSnapshotRestored; 104 eventSourceVirtualBox.RegisterListener(m_ mainEventListener, vboxEvents, TRUE);109 eventSourceVirtualBox.RegisterListener(m_comEventListener, vboxEvents, TRUE); 105 110 AssertWrapperOk(eventSourceVirtualBox); 111 } 106 112 107 113 void UIVirtualBoxEventHandler::prepareConnections() 114 { 108 115 /* Create queued (async) connections for non-waitable signals: */ 109 connect( pListener->getWrapped(), SIGNAL(sigVBoxSVCAvailabilityChange(bool)),116 connect(m_pQtListener->getWrapped(), SIGNAL(sigVBoxSVCAvailabilityChange(bool)), 110 117 this, SIGNAL(sigVBoxSVCAvailabilityChange(bool)), 111 118 Qt::QueuedConnection); 112 connect( pListener->getWrapped(), SIGNAL(sigMachineStateChange(QString, KMachineState)),119 connect(m_pQtListener->getWrapped(), SIGNAL(sigMachineStateChange(QString, KMachineState)), 113 120 this, SIGNAL(sigMachineStateChange(QString, KMachineState)), 114 121 Qt::QueuedConnection); 115 connect( pListener->getWrapped(), SIGNAL(sigMachineDataChange(QString)),122 connect(m_pQtListener->getWrapped(), SIGNAL(sigMachineDataChange(QString)), 116 123 this, SIGNAL(sigMachineDataChange(QString)), 117 124 Qt::QueuedConnection); 118 connect( pListener->getWrapped(), SIGNAL(sigMachineRegistered(QString, bool)),125 connect(m_pQtListener->getWrapped(), SIGNAL(sigMachineRegistered(QString, bool)), 119 126 this, SIGNAL(sigMachineRegistered(QString, bool)), 120 127 Qt::QueuedConnection); 121 connect( pListener->getWrapped(), SIGNAL(sigSessionStateChange(QString, KSessionState)),128 connect(m_pQtListener->getWrapped(), SIGNAL(sigSessionStateChange(QString, KSessionState)), 122 129 this, SIGNAL(sigSessionStateChange(QString, KSessionState)), 123 130 Qt::QueuedConnection); 124 connect( pListener->getWrapped(), SIGNAL(sigSnapshotTake(QString, QString)),131 connect(m_pQtListener->getWrapped(), SIGNAL(sigSnapshotTake(QString, QString)), 125 132 this, SIGNAL(sigSnapshotTake(QString, QString)), 126 133 Qt::QueuedConnection); 127 connect( pListener->getWrapped(), SIGNAL(sigSnapshotDelete(QString, QString)),134 connect(m_pQtListener->getWrapped(), SIGNAL(sigSnapshotDelete(QString, QString)), 128 135 this, SIGNAL(sigSnapshotDelete(QString, QString)), 129 136 Qt::QueuedConnection); 130 connect( pListener->getWrapped(), SIGNAL(sigSnapshotChange(QString, QString)),137 connect(m_pQtListener->getWrapped(), SIGNAL(sigSnapshotChange(QString, QString)), 131 138 this, SIGNAL(sigSnapshotChange(QString, QString)), 132 139 Qt::QueuedConnection); 133 connect( pListener->getWrapped(), SIGNAL(sigSnapshotRestore(QString, QString)),140 connect(m_pQtListener->getWrapped(), SIGNAL(sigSnapshotRestore(QString, QString)), 134 141 this, SIGNAL(sigSnapshotRestore(QString, QString)), 135 142 Qt::QueuedConnection); 136 143 } 137 144 138 void UIVirtualBoxEventHandler::cleanup() 145 void UIVirtualBoxEventHandler::cleanupConnections() 146 { 147 /* Nothing for now. */ 148 } 149 150 void UIVirtualBoxEventHandler::cleanupListener() 139 151 { 140 152 /* Get VirtualBox: */ … … 145 157 AssertWrapperOk(eventSourceVirtualBox); 146 158 /* Unregister listener: */ 147 eventSourceVirtualBox.UnregisterListener(m_ mainEventListener);159 eventSourceVirtualBox.UnregisterListener(m_comEventListener); 148 160 149 161 /* Get VirtualBoxClient: */ … … 154 166 AssertWrapperOk(eventSourceVirtualBoxClient); 155 167 /* Unregister listener: */ 156 eventSourceVirtualBoxClient.UnregisterListener(m_ mainEventListener);168 eventSourceVirtualBoxClient.UnregisterListener(m_comEventListener); 157 169 } 158 170 171 void UIVirtualBoxEventHandler::cleanup() 172 { 173 /* Cleanup: */ 174 cleanupConnections(); 175 cleanupListener(); 176 } 177 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h
r60224 r60225 21 21 /* Qt includes: */ 22 22 #include <QObject> 23 24 /* GUI includes: */ 25 #include "UIMainEventListener.h" 23 26 24 27 /* COM includes: */ … … 69 72 ~UIVirtualBoxEventHandler(); 70 73 71 /** Prepares all. */ 72 void prepare(); 73 /** Cleanups all. */ 74 void cleanup(); 74 /** @name Prepare/Cleanup cascade. 75 * @{ */ 76 /** Prepares all. */ 77 void prepare(); 78 /** Prepares listener. */ 79 void prepareListener(); 80 /** Prepares connections. */ 81 void prepareConnections(); 82 83 /** Cleanups connections. */ 84 void cleanupConnections(); 85 /** Cleanups listener. */ 86 void cleanupListener(); 87 /** Cleanups all. */ 88 void cleanup(); 89 /** @} */ 75 90 76 91 private: … … 79 94 static UIVirtualBoxEventHandler *m_spInstance; 80 95 96 /** Holds the Qt event listener instance. */ 97 ComObjPtr<UIMainEventListenerImpl> m_pQtListener; 81 98 /** Holds the COM event listener instance. */ 82 CEventListener m_ mainEventListener;99 CEventListener m_comEventListener; 83 100 }; 84 101
Note:
See TracChangeset
for help on using the changeset viewer.