Changeset 34527 in vbox for trunk/src/VBox
- Timestamp:
- Nov 30, 2010 4:25:01 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.cpp
r30871 r34527 252 252 // RTPrintf("Self add: %RTthrd\n", RTThreadSelf()); 253 253 const CVirtualBox &vbox = vboxGlobal().virtualBox(); 254 UIMainEventListener *pListener = new UIMainEventListener(this);254 UIMainEventListenerImpl *pListener = new UIMainEventListenerImpl(this); 255 255 m_mainEventListener = CEventListener(pListener); 256 256 QVector<KVBoxEventType> events; … … 264 264 /* This is a vetoable event, so we have to respond to the event and have to 265 265 * use a direct connection therefor. */ 266 connect(pListener , SIGNAL(sigExtraDataCanChange(QString, QString, QString, bool&, QString&)),266 connect(pListener->getWrapped(), SIGNAL(sigExtraDataCanChange(QString, QString, QString, bool&, QString&)), 267 267 m_pHandler, SLOT(sltExtraDataCanChange(QString, QString, QString, bool&, QString&)), 268 268 Qt::DirectConnection); 269 269 270 270 /* Use a direct connection to the helper class. */ 271 connect(pListener , SIGNAL(sigExtraDataChange(QString, QString, QString)),271 connect(pListener->getWrapped(), SIGNAL(sigExtraDataChange(QString, QString, QString)), 272 272 m_pHandler, SLOT(sltExtraDataChange(QString, QString, QString)), 273 273 Qt::DirectConnection); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
r33386 r34527 25 25 //#include <iprt/stream.h> 26 26 27 #ifndef Q_WS_WIN28 NS_DECL_CLASSINFO(UIMainEventListener)29 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(UIMainEventListener, IEventListener)30 #endif31 32 27 UIMainEventListener::UIMainEventListener(QObject * /* pParent */) 33 28 // : QObject(pParent) /* Todo: Not sure if pParent should delete this. Especially on Win there is ref counting implemented. */ 34 29 : QObject() 35 #ifdef Q_WS_WIN36 , m_refcnt(0)37 #endif /* Q_WS_WIN */38 30 { 39 31 /* For queued events we have to extra register our enums/interface classes … … 55 47 * make sense to use passive listeners, and peek up events in main thread. 56 48 */ 57 STDMETHODIMP UIMainEventListener::HandleEvent( IEvent *pEvent)49 STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent *pEvent) 58 50 { 59 51 CEvent event(pEvent); … … 222 214 return S_OK; 223 215 } 216 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
r33540 r34527 23 23 #include "COMDefs.h" 24 24 25 /* VBox includes */ 26 #include <VBox/com/listeners.h> 27 25 28 /* Note: On a first look this may seems a little bit complicated. 26 29 * There are two reasons to use a separate class here which handles the events … … 35 38 * queue and deliver it later on. */ 36 39 37 class UIMainEventListener: public QObject , VBOX_SCRIPTABLE_IMPL(IEventListener)40 class UIMainEventListener: public QObject 38 41 { 39 42 Q_OBJECT; 40 43 41 44 public: 42 NS_DECL_ISUPPORTS43 VBOX_SCRIPTABLE_DISPATCH_IMPL(IEventListener)44 45 45 UIMainEventListener(QObject *pParent); 46 46 47 #ifdef Q_WS_WIN 48 STDMETHOD_(ULONG, AddRef)() 49 { 50 return ::InterlockedIncrement(&m_refcnt); 51 } 52 STDMETHOD_(ULONG, Release)() 53 { 54 long cnt = ::InterlockedDecrement(&m_refcnt); 55 if (cnt == 0) 56 delete this; 57 return cnt; 58 } 59 #endif /* Q_WS_WIN */ 60 61 STDMETHOD(HandleEvent)(IEvent *pEvent); 47 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *pEvent); 62 48 63 49 signals: … … 84 70 void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */ 85 71 void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */ 72 }; 86 73 87 #ifdef Q_WS_WIN 88 private: 89 /* Private member vars */ 90 long m_refcnt; 91 #endif /* Q_WS_WIN */ 92 }; 74 /* Wrap the IListener interface around our implementation class. */ 75 typedef ListenerImpl<UIMainEventListener, QObject*> UIMainEventListenerImpl; 93 76 94 77 #endif /* !__UIMainEventListener_h__ */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
r31816 r34527 59 59 60 60 // RTPrintf("Self add: %RTthrd\n", RTThreadSelf()); 61 UIMainEventListener *pListener = new UIMainEventListener(this);61 UIMainEventListenerImpl *pListener = new UIMainEventListenerImpl(this); 62 62 m_mainEventListener = CEventListener(pListener); 63 63 QVector<KVBoxEventType> events; … … 81 81 AssertWrapperOk(console); 82 82 83 connect(pListener , SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)),83 connect(pListener->getWrapped(), SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)), 84 84 this, SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)), 85 85 Qt::QueuedConnection); 86 86 87 connect(pListener , SIGNAL(sigMouseCapabilityChange(bool, bool, bool)),87 connect(pListener->getWrapped(), SIGNAL(sigMouseCapabilityChange(bool, bool, bool)), 88 88 this, SIGNAL(sigMouseCapabilityChange(bool, bool, bool)), 89 89 Qt::QueuedConnection); 90 90 91 connect(pListener , SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)),91 connect(pListener->getWrapped(), SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)), 92 92 this, SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)), 93 93 Qt::QueuedConnection); 94 94 95 connect(pListener , SIGNAL(sigStateChange(KMachineState)),95 connect(pListener->getWrapped(), SIGNAL(sigStateChange(KMachineState)), 96 96 this, SIGNAL(sigStateChange(KMachineState)), 97 97 Qt::QueuedConnection); 98 98 99 connect(pListener , SIGNAL(sigAdditionsChange()),99 connect(pListener->getWrapped(), SIGNAL(sigAdditionsChange()), 100 100 this, SIGNAL(sigAdditionsChange()), 101 101 Qt::QueuedConnection); 102 102 103 connect(pListener , SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)),103 connect(pListener->getWrapped(), SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)), 104 104 this, SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)), 105 105 Qt::QueuedConnection); 106 106 107 connect(pListener , SIGNAL(sigMediumChange(CMediumAttachment)),107 connect(pListener->getWrapped(), SIGNAL(sigMediumChange(CMediumAttachment)), 108 108 this, SIGNAL(sigMediumChange(CMediumAttachment)), 109 109 Qt::QueuedConnection); 110 110 111 connect(pListener , SIGNAL(sigUSBControllerChange()),111 connect(pListener->getWrapped(), SIGNAL(sigUSBControllerChange()), 112 112 this, SIGNAL(sigUSBControllerChange()), 113 113 Qt::QueuedConnection); 114 114 115 connect(pListener , SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)),115 connect(pListener->getWrapped(), SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)), 116 116 this, SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)), 117 117 Qt::QueuedConnection); 118 118 119 connect(pListener , SIGNAL(sigSharedFolderChange()),119 connect(pListener->getWrapped(), SIGNAL(sigSharedFolderChange()), 120 120 this, SIGNAL(sigSharedFolderChange()), 121 121 Qt::QueuedConnection); 122 122 123 connect(pListener , SIGNAL(sigRuntimeError(bool, QString, QString)),123 connect(pListener->getWrapped(), SIGNAL(sigRuntimeError(bool, QString, QString)), 124 124 this, SIGNAL(sigRuntimeError(bool, QString, QString)), 125 125 Qt::QueuedConnection); … … 127 127 /* This is a vetoable event, so we have to respond to the event and have to 128 128 * use a direct connection therefor. */ 129 connect(pListener , SIGNAL(sigCanShowWindow(bool&, QString&)),129 connect(pListener->getWrapped(), SIGNAL(sigCanShowWindow(bool&, QString&)), 130 130 this, SLOT(sltCanShowWindow(bool&, QString&)), 131 131 Qt::DirectConnection); … … 133 133 /* This returns a winId, so we have to respond to the event and have to use 134 134 * a direct connection therefor. */ 135 connect(pListener , SIGNAL(sigShowWindow(LONG64&)),135 connect(pListener->getWrapped(), SIGNAL(sigShowWindow(LONG64&)), 136 136 this, SLOT(sltShowWindow(LONG64&)), 137 137 Qt::DirectConnection); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp
r30879 r34527 52 52 // RTPrintf("Self add: %RTthrd\n", RTThreadSelf()); 53 53 const CVirtualBox &vbox = vboxGlobal().virtualBox(); 54 UIMainEventListener *pListener = new UIMainEventListener(this);54 UIMainEventListenerImpl *pListener = new UIMainEventListenerImpl(this); 55 55 m_mainEventListener = CEventListener(pListener); 56 56 QVector<KVBoxEventType> events; … … 65 65 AssertWrapperOk(vbox); 66 66 67 connect(pListener , SIGNAL(sigMachineStateChange(QString, KMachineState)),67 connect(pListener->getWrapped(), SIGNAL(sigMachineStateChange(QString, KMachineState)), 68 68 this, SIGNAL(sigMachineStateChange(QString, KMachineState)), 69 69 Qt::QueuedConnection); 70 70 71 connect(pListener , SIGNAL(sigMachineDataChange(QString)),71 connect(pListener->getWrapped(), SIGNAL(sigMachineDataChange(QString)), 72 72 this, SIGNAL(sigMachineDataChange(QString)), 73 73 Qt::QueuedConnection); 74 74 75 connect(pListener , SIGNAL(sigMachineRegistered(QString, bool)),75 connect(pListener->getWrapped(), SIGNAL(sigMachineRegistered(QString, bool)), 76 76 this, SIGNAL(sigMachineRegistered(QString, bool)), 77 77 Qt::QueuedConnection); 78 78 79 connect(pListener , SIGNAL(sigSessionStateChange(QString, KSessionState)),79 connect(pListener->getWrapped(), SIGNAL(sigSessionStateChange(QString, KSessionState)), 80 80 this, SIGNAL(sigSessionStateChange(QString, KSessionState)), 81 81 Qt::QueuedConnection); 82 82 83 connect(pListener , SIGNAL(sigSnapshotChange(QString, QString)),83 connect(pListener->getWrapped(), SIGNAL(sigSnapshotChange(QString, QString)), 84 84 this, SIGNAL(sigSnapshotChange(QString, QString)), 85 85 Qt::QueuedConnection);
Note:
See TracChangeset
for help on using the changeset viewer.