Changeset 54657 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 5, 2015 4:11:35 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
r54150 r54657 5 5 6 6 /* 7 * Copyright (C) 2010-201 3Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 /* COM includes: */ 26 26 # include "COMEnums.h" 27 # include "CEvent.h" 28 # include "CVBoxSVCAvailabilityChangedEvent.h" 27 29 # include "CVirtualBoxErrorInfo.h" 30 # include "CMachineStateChangedEvent.h" 31 # include "CMachineDataChangedEvent.h" 32 # include "CMachineRegisteredEvent.h" 33 # include "CSessionStateChangedEvent.h" 34 # include "CSnapshotTakenEvent.h" 35 # include "CSnapshotDeletedEvent.h" 36 # include "CSnapshotChangedEvent.h" 37 # include "CExtraDataCanChangeEvent.h" 38 # include "CExtraDataChangedEvent.h" 39 # include "CMousePointerShapeChangedEvent.h" 40 # include "CMouseCapabilityChangedEvent.h" 41 # include "CKeyboardLedsChangedEvent.h" 42 # include "CStateChangedEvent.h" 43 # include "CNetworkAdapterChangedEvent.h" 44 # include "CMediumChangedEvent.h" 28 45 # include "CUSBDevice.h" 46 # include "CUSBDeviceStateChangedEvent.h" 47 # include "CGuestMonitorChangedEvent.h" 48 # include "CRuntimeErrorEvent.h" 49 # include "CCanShowWindowEvent.h" 50 # include "CShowWindowEvent.h" 29 51 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 30 52 31 #include "CEvent.h"32 #include "CMachineStateChangedEvent.h"33 #include "CMachineDataChangedEvent.h"34 #include "CExtraDataCanChangeEvent.h"35 #include "CExtraDataChangedEvent.h"36 #include "CMachineRegisteredEvent.h"37 #include "CSessionStateChangedEvent.h"38 #include "CSnapshotTakenEvent.h"39 #include "CSnapshotDeletedEvent.h"40 #include "CSnapshotChangedEvent.h"41 #include "CMousePointerShapeChangedEvent.h"42 #include "CMouseCapabilityChangedEvent.h"43 #include "CKeyboardLedsChangedEvent.h"44 #include "CStateChangedEvent.h"45 #include "CNetworkAdapterChangedEvent.h"46 #include "CMediumChangedEvent.h"47 #include "CUSBDeviceStateChangedEvent.h"48 #include "CRuntimeErrorEvent.h"49 #include "CCanShowWindowEvent.h"50 #include "CShowWindowEvent.h"51 #include "CVBoxSVCAvailabilityChangedEvent.h"52 #include "CGuestMonitorChangedEvent.h"53 54 55 53 UIMainEventListener::UIMainEventListener() 56 : QObject()57 54 { 58 /* For queued events we have to extra register our enums/interface classes 59 * (Q_DECLARE_METATYPE isn't sufficient). 60 * Todo: Try to move this to a global function, which is auto generated 61 * from xslt. */ 55 /* Register meta-types for required enums. */ 62 56 qRegisterMetaType<KMachineState>("KMachineState"); 63 57 qRegisterMetaType<KSessionState>("KSessionState"); … … 70 64 } 71 65 72 HRESULT UIMainEventListener::init(QObject * /* pParent */)73 {74 return S_OK;75 }76 77 void UIMainEventListener::uninit()78 {79 }80 81 /**82 * @todo: instead of double wrapping of events into signals maybe it83 * make sense to use passive listeners, and peek up events in main thread.84 */85 66 STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent *pEvent) 86 67 { 87 68 CEvent event(pEvent); 88 69 // printf("Event received: %d\n", event.GetType()); 89 switch (event.GetType())70 switch (event.GetType()) 90 71 { 91 /* 92 * All VirtualBox Events 93 */ 72 case KVBoxEventType_OnVBoxSVCAvailabilityChanged: 73 { 74 CVBoxSVCAvailabilityChangedEvent es(pEvent); 75 emit sigVBoxSVCAvailabilityChange(es.GetAvailable()); 76 break; 77 } 78 94 79 case KVBoxEventType_OnMachineStateChanged: 95 80 { … … 104 89 break; 105 90 } 91 case KVBoxEventType_OnMachineRegistered: 92 { 93 CMachineRegisteredEvent es(pEvent); 94 emit sigMachineRegistered(es.GetMachineId(), es.GetRegistered()); 95 break; 96 } 97 case KVBoxEventType_OnSessionStateChanged: 98 { 99 CSessionStateChangedEvent es(pEvent); 100 emit sigSessionStateChange(es.GetMachineId(), es.GetState()); 101 break; 102 } 103 case KVBoxEventType_OnSnapshotTaken: 104 { 105 CSnapshotTakenEvent es(pEvent); 106 emit sigSnapshotTake(es.GetMachineId(), es.GetSnapshotId()); 107 break; 108 } 109 case KVBoxEventType_OnSnapshotDeleted: 110 { 111 CSnapshotDeletedEvent es(pEvent); 112 emit sigSnapshotDelete(es.GetMachineId(), es.GetSnapshotId()); 113 break; 114 } 115 case KVBoxEventType_OnSnapshotChanged: 116 { 117 CSnapshotChangedEvent es(pEvent); 118 emit sigSnapshotChange(es.GetMachineId(), es.GetSnapshotId()); 119 break; 120 } 121 // case KVBoxEventType_OnMediumRegistered: 122 // case KVBoxEventType_OnGuestPropertyChange: 123 106 124 case KVBoxEventType_OnExtraDataCanChange: 107 125 { 108 126 CExtraDataCanChangeEvent es(pEvent); 109 /* Has to be done in place to give an answer */127 /* Has to be done in place to give an answer: */ 110 128 bool fVeto = false; 111 129 QString strReason; … … 121 139 break; 122 140 } 123 /* Not used: 124 case KVBoxEventType_OnMediumRegistered: 125 */ 126 case KVBoxEventType_OnMachineRegistered: 127 { 128 CMachineRegisteredEvent es(pEvent); 129 emit sigMachineRegistered(es.GetMachineId(), es.GetRegistered()); 130 break; 131 } 132 case KVBoxEventType_OnSessionStateChanged: 133 { 134 CSessionStateChangedEvent es(pEvent); 135 emit sigSessionStateChange(es.GetMachineId(), es.GetState()); 136 break; 137 } 138 case KVBoxEventType_OnSnapshotTaken: 139 { 140 CSnapshotTakenEvent es(pEvent); 141 emit sigSnapshotTake(es.GetMachineId(), es.GetSnapshotId()); 142 break; 143 } 144 case KVBoxEventType_OnSnapshotDeleted: 145 { 146 CSnapshotDeletedEvent es(pEvent); 147 emit sigSnapshotDelete(es.GetMachineId(), es.GetSnapshotId()); 148 break; 149 } 150 case KVBoxEventType_OnSnapshotChanged: 151 { 152 CSnapshotChangedEvent es(pEvent); 153 emit sigSnapshotChange(es.GetMachineId(), es.GetSnapshotId()); 154 break; 155 } 156 /* Not used: 157 case KVBoxEventType_OnGuestPropertyChange: 158 */ 159 /* 160 * All Console Events 161 */ 141 162 142 case KVBoxEventType_OnMousePointerShapeChanged: 163 143 { … … 195 175 break; 196 176 } 197 /* Not used *198 case KVBoxEventType_OnSerialPortChanged:199 case KVBoxEventType_OnParallelPortChanged:200 case KVBoxEventType_OnStorageControllerChanged:201 */202 177 case KVBoxEventType_OnMediumChanged: 203 178 { … … 206 181 break; 207 182 } 208 /* Not used *209 case KVBoxEventType_OnCPUChange:210 */211 183 case KVBoxEventType_OnVRDEServerChanged: 212 184 case KVBoxEventType_OnVRDEServerInfoChanged: … … 236 208 break; 237 209 } 210 case KVBoxEventType_OnCPUExecutionCapChanged: 211 { 212 emit sigCPUExecutionCapChange(); 213 break; 214 } 215 case KVBoxEventType_OnGuestMonitorChanged: 216 { 217 CGuestMonitorChangedEvent es(pEvent); 218 emit sigGuestMonitorChange(es.GetChangeType(), es.GetScreenId(), 219 QRect(es.GetOriginX(), es.GetOriginY(), es.GetWidth(), es.GetHeight())); 220 break; 221 } 238 222 case KVBoxEventType_OnRuntimeError: 239 223 { … … 245 229 { 246 230 CCanShowWindowEvent es(pEvent); 247 /* Has to be done in place to give an answer */231 /* Has to be done in place to give an answer: */ 248 232 bool fVeto = false; 249 233 QString strReason; … … 256 240 { 257 241 CShowWindowEvent es(pEvent); 258 /* Has to be done in place to give an answer */242 /* Has to be done in place to give an answer: */ 259 243 LONG64 winId; 260 244 emit sigShowWindow(winId); … … 262 246 break; 263 247 } 264 case KVBoxEventType_OnCPUExecutionCapChanged: 265 { 266 emit sigCPUExecutionCapChange(); 267 break; 268 } 269 case KVBoxEventType_OnVBoxSVCAvailabilityChanged: 270 { 271 CVBoxSVCAvailabilityChangedEvent es(pEvent); 272 emit sigVBoxSVCAvailabilityChange(es.GetAvailable()); 273 break; 274 } 275 case KVBoxEventType_OnGuestMonitorChanged: 276 { 277 CGuestMonitorChangedEvent es(pEvent); 278 emit sigGuestMonitorChange(es.GetChangeType(), es.GetScreenId(), 279 QRect(es.GetOriginX(), es.GetOriginY(), es.GetWidth(), es.GetHeight())); 280 break; 281 } 248 // case KVBoxEventType_OnSerialPortChanged: 249 // case KVBoxEventType_OnParallelPortChanged: 250 // case KVBoxEventType_OnStorageControllerChanged: 251 // case KVBoxEventType_OnCPUChange: 252 282 253 default: break; 283 254 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
r54150 r54657 4 4 5 5 /* 6 * Copyright (C) 2010-201 3Oracle Corporation6 * Copyright (C) 2010-2015 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 15 15 */ 16 16 17 #ifndef __ UIMainEventListener_h__18 #define __ UIMainEventListener_h__17 #ifndef ___UIMainEventListener_h___ 18 #define ___UIMainEventListener_h___ 19 19 20 20 /* COM includes: */ … … 40 40 * queue and deliver it later on. */ 41 41 42 /** Main event listener. */ 42 43 class UIMainEventListener: public QObject 43 44 { 44 45 Q_OBJECT; 45 46 47 signals: 48 49 /** Notifies about the VBoxSVC become @a fAvailable. */ 50 void sigVBoxSVCAvailabilityChange(bool fAvailable); 51 52 /** Notifies about @a state change event for the machine with @a strId. */ 53 void sigMachineStateChange(QString strId, KMachineState state); 54 /** Notifies about data change event for the machine with @a strId. */ 55 void sigMachineDataChange(QString strId); 56 /** Notifies about machine with @a strId was @a fRegistered. */ 57 void sigMachineRegistered(QString strId, bool fRegistered); 58 /** Notifies about @a state change event for the session of the machine with @a strId. */ 59 void sigSessionStateChange(QString strId, KSessionState state); 60 /** Notifies about snapshot with @a strSnapshotId was taken for the machine with @a strId. */ 61 void sigSnapshotTake(QString strId, QString strSnapshotId); 62 /** Notifies about snapshot with @a strSnapshotId was deleted for the machine with @a strId. */ 63 void sigSnapshotDelete(QString strId, QString strSnapshotId); 64 /** Notifies about snapshot with @a strSnapshotId was changed for the machine with @a strId. */ 65 void sigSnapshotChange(QString strId, QString strSnapshotId); 66 67 /** Notifies about extra-data of the machine with @a strId can be changed for the key @a strKey to value @a strValue. */ 68 void sigExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason); /* use Qt::DirectConnection */ 69 /** Notifies about extra-data of the machine with @a strId changed for the key @a strKey to value @a strValue. */ 70 void sigExtraDataChange(QString strId, QString strKey, QString strValue); 71 72 /** Notifies about mouse pointer become @a fVisible and his shape changed to @a fAlpha, @a hotCorner, @a size and @a shape. */ 73 void sigMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape); 74 /** Notifies about mouse capability change to @a fSupportsAbsolute, @a fSupportsRelative, @a fSupportsMultiTouch and @a fNeedsHostCursor. */ 75 void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor); 76 /** Notifies about keyboard LEDs change for @a fNumLock, @a fCapsLock and @a fScrollLock. */ 77 void sigKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock); 78 /** Notifies about machine @a state change. */ 79 void sigStateChange(KMachineState state); 80 /** Notifies about guest additions state change. */ 81 void sigAdditionsChange(); 82 /** Notifies about network @a adapter state change. */ 83 void sigNetworkAdapterChange(CNetworkAdapter adapter); 84 /** Notifies about storage medium @a attachment state change. */ 85 void sigMediumChange(CMediumAttachment attachment); 86 /** Notifies about VRDE device state change. */ 87 void sigVRDEChange(); 88 /** Notifies about Video Capture device state change. */ 89 void sigVideoCaptureChange(); 90 /** Notifies about USB controller state change. */ 91 void sigUSBControllerChange(); 92 /** Notifies about USB @a device state change to @a fAttached, holding additional @a error information. */ 93 void sigUSBDeviceStateChange(CUSBDevice device, bool fAttached, CVirtualBoxErrorInfo error); 94 /** Notifies about shared folder state change. */ 95 void sigSharedFolderChange(); 96 /** Notifies about CPU execution-cap change. */ 97 void sigCPUExecutionCapChange(); 98 /** Notifies about guest-screen configuration change of @a type for @a uScreenId with @a screenGeo. */ 99 void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo); 100 /** Notifies about Runtime error with @a strErrorId which is @a fFatal and have @a strMessage. */ 101 void sigRuntimeError(bool fFatal, QString strErrorId, QString strMessage); 102 /** Notifies about VM window can be shown, allowing to prevent it by @a fVeto with @a strReason. */ 103 void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */ 104 /** Notifies about VM window with specified @a winId should be shown. */ 105 void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */ 106 46 107 public: 108 109 /** Constructor. */ 47 110 UIMainEventListener(); 48 111 112 /** Initialization routine. */ 113 HRESULT init(QObject *pParent) { Q_UNUSED(pParent); return S_OK; } 114 /** Deinitialization routine. */ 115 void uninit() {} 49 116 50 HRESULT init(QObject *pParent); 51 void uninit(); 52 53 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *pEvent); 54 55 signals: 56 /* All VirtualBox Signals */ 57 void sigMachineStateChange(QString strId, KMachineState state); 58 void sigMachineDataChange(QString strId); 59 void sigExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason); /* use Qt::DirectConnection */ 60 void sigExtraDataChange(QString strId, QString strKey, QString strValue); 61 void sigMachineRegistered(QString strId, bool fRegistered); 62 void sigSessionStateChange(QString strId, KSessionState state); 63 void sigSnapshotTake(QString strId, QString strSnapshotId); 64 void sigSnapshotDelete(QString strId, QString strSnapshotId); 65 void sigSnapshotChange(QString strId, QString strSnapshotId); 66 /* All Console Signals */ 67 void sigMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape); 68 void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor); 69 void sigKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock); 70 void sigStateChange(KMachineState state); 71 void sigAdditionsChange(); 72 void sigNetworkAdapterChange(CNetworkAdapter adapter); 73 void sigMediumChange(CMediumAttachment attachment); 74 void sigVRDEChange(); 75 void sigVideoCaptureChange(); 76 void sigUSBControllerChange(); 77 void sigUSBDeviceStateChange(CUSBDevice device, bool fAttached, CVirtualBoxErrorInfo error); 78 void sigSharedFolderChange(); 79 void sigRuntimeError(bool fFatal, QString strId, QString strMessage); 80 void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */ 81 void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */ 82 void sigCPUExecutionCapChange(); 83 void sigVBoxSVCAvailabilityChange(bool fAvailable); 84 void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo); 117 /** Main event handler routine. */ 118 STDMETHOD(HandleEvent)(VBoxEventType_T enmType, IEvent *pEvent); 85 119 }; 86 120 … … 88 122 typedef ListenerImpl<UIMainEventListener, QObject*> UIMainEventListenerImpl; 89 123 90 #endif /* !__UIMainEventListener_h__ */ 91 124 #endif /* !___UIMainEventListener_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
r52998 r54657 29 29 class UISession; 30 30 31 /** Console event handler. */31 /** Active event handler singleton for the CConsole event-source. */ 32 32 class UIConsoleEventHandler: public QObject 33 33 { … … 36 36 signals: 37 37 38 /** Notifies about mouse pointer shape change. */38 /** Notifies about mouse pointer become @a fVisible and his shape changed to @a fAlpha, @a hotCorner, @a size and @a shape. */ 39 39 void sigMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape); 40 /** Notifies about mouse capability change . */40 /** Notifies about mouse capability change to @a fSupportsAbsolute, @a fSupportsRelative, @a fSupportsMultiTouch and @a fNeedsHostCursor. */ 41 41 void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor); 42 /** Notifies about keyboard LEDs change . */42 /** Notifies about keyboard LEDs change for @a fNumLock, @a fCapsLock and @a fScrollLock. */ 43 43 void sigKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock); 44 /** Notifies about machine state change. */44 /** Notifies about machine @a state change. */ 45 45 void sigStateChange(KMachineState state); 46 46 /** Notifies about guest additions state change. */ 47 47 void sigAdditionsChange(); 48 /** Notifies about network adapter state change. */48 /** Notifies about network @a adapter state change. */ 49 49 void sigNetworkAdapterChange(CNetworkAdapter adapter); 50 /** Notifies about storage medium state change. */50 /** Notifies about storage medium @a attachment state change. */ 51 51 void sigMediumChange(CMediumAttachment attachment); 52 52 /** Notifies about VRDE device state change. */ … … 56 56 /** Notifies about USB controller state change. */ 57 57 void sigUSBControllerChange(); 58 /** Notifies about USB device state change. */58 /** Notifies about USB @a device state change to @a fAttached, holding additional @a error information. */ 59 59 void sigUSBDeviceStateChange(CUSBDevice device, bool fAttached, CVirtualBoxErrorInfo error); 60 60 /** Notifies about shared folder state change. */ … … 62 62 /** Notifies about CPU execution-cap change. */ 63 63 void sigCPUExecutionCapChange(); 64 /** Notifies about guest-screen configuration change . */65 void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);66 /** Notifies about Runtime error . */67 void sigRuntimeError(bool fFatal, QString str Id, QString strMessage);64 /** Notifies about guest-screen configuration change of @a type for @a uScreenId with @a screenGeo. */ 65 void sigGuestMonitorChange(KGuestMonitorChangedEventType type, ulong uScreenId, QRect screenGeo); 66 /** Notifies about Runtime error with @a strErrorId which is @a fFatal and have @a strMessage. */ 67 void sigRuntimeError(bool fFatal, QString strErrorId, QString strMessage); 68 68 #ifdef RT_OS_DARWIN 69 69 /** Notifies about VM window should be shown. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h
r54150 r54657 22 22 #include "CEventListener.h" 23 23 24 /** Active event handler singleton for the CVirtualBox event-source. */24 /** Active event handler singleton for the CVirtualBoxClient and CVirtualBox event-sources. */ 25 25 class UIVirtualBoxEventHandler : public QObject 26 26 { … … 29 29 signals: 30 30 31 /** Notifies listenersabout the VBoxSVC become @a fAvailable. */31 /** Notifies about the VBoxSVC become @a fAvailable. */ 32 32 void sigVBoxSVCAvailabilityChange(bool fAvailable); 33 /** Notifies listeners about @a state change event for the machine with @a strId. */ 33 34 /** Notifies about @a state change event for the machine with @a strId. */ 34 35 void sigMachineStateChange(QString strId, KMachineState state); 35 /** Notifies listenersabout data change event for the machine with @a strId. */36 /** Notifies about data change event for the machine with @a strId. */ 36 37 void sigMachineDataChange(QString strId); 37 /** Notifies listenersabout machine with @a strId was @a fRegistered. */38 /** Notifies about machine with @a strId was @a fRegistered. */ 38 39 void sigMachineRegistered(QString strId, bool fRegistered); 39 /** Notifies listenersabout @a state change event for the session of the machine with @a strId. */40 /** Notifies about @a state change event for the session of the machine with @a strId. */ 40 41 void sigSessionStateChange(QString strId, KSessionState state); 41 /** Notifies listenersabout snapshot with @a strSnapshotId was taken for the machine with @a strId. */42 /** Notifies about snapshot with @a strSnapshotId was taken for the machine with @a strId. */ 42 43 void sigSnapshotTake(QString strId, QString strSnapshotId); 43 /** Notifies listenersabout snapshot with @a strSnapshotId was deleted for the machine with @a strId. */44 /** Notifies about snapshot with @a strSnapshotId was deleted for the machine with @a strId. */ 44 45 void sigSnapshotDelete(QString strId, QString strSnapshotId); 45 /** Notifies listenersabout snapshot with @a strSnapshotId was changed for the machine with @a strId. */46 /** Notifies about snapshot with @a strSnapshotId was changed for the machine with @a strId. */ 46 47 void sigSnapshotChange(QString strId, QString strSnapshotId); 47 48
Note:
See TracChangeset
for help on using the changeset viewer.