1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * UIMainEventListener class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2010 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __UIMainEventListener_h__
|
---|
20 | #define __UIMainEventListener_h__
|
---|
21 |
|
---|
22 | /* COM includes: */
|
---|
23 | #include "COMEnums.h"
|
---|
24 | #include "CVirtualBoxErrorInfo.h"
|
---|
25 | #include "CMediumAttachment.h"
|
---|
26 | #include "CNetworkAdapter.h"
|
---|
27 | #include "CUSBDevice.h"
|
---|
28 |
|
---|
29 | /* Other VBox includes: */
|
---|
30 | #include <VBox/com/listeners.h>
|
---|
31 |
|
---|
32 | /* Note: On a first look this may seems a little bit complicated.
|
---|
33 | * There are two reasons to use a separate class here which handles the events
|
---|
34 | * and forward them to the public class as signals. The first one is that on
|
---|
35 | * some platforms (e.g. Win32) this events not arrive in the main GUI thread.
|
---|
36 | * So there we have to make sure they are first delivered to the main GUI
|
---|
37 | * thread and later executed there. The second reason is, that the initiator
|
---|
38 | * method may hold a lock on a object which has to be manipulated in the event
|
---|
39 | * consumer. Doing this without being asynchronous would lead to a dead lock. To
|
---|
40 | * avoid both problems we send signals as a queued connection to the event
|
---|
41 | * consumer. Qt will create a event for us, place it in the main GUI event
|
---|
42 | * queue and deliver it later on. */
|
---|
43 |
|
---|
44 | class UIMainEventListener: public QObject
|
---|
45 | {
|
---|
46 | Q_OBJECT;
|
---|
47 |
|
---|
48 | public:
|
---|
49 | UIMainEventListener();
|
---|
50 |
|
---|
51 |
|
---|
52 | HRESULT init(QObject *pParent);
|
---|
53 | void uninit();
|
---|
54 |
|
---|
55 | STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *pEvent);
|
---|
56 |
|
---|
57 | signals:
|
---|
58 | /* All VirtualBox Signals */
|
---|
59 | void sigMachineStateChange(QString strId, KMachineState state);
|
---|
60 | void sigMachineDataChange(QString strId);
|
---|
61 | void sigExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason); /* use Qt::DirectConnection */
|
---|
62 | void sigExtraDataChange(QString strId, QString strKey, QString strValue);
|
---|
63 | void sigMachineRegistered(QString strId, bool fRegistered);
|
---|
64 | void sigSessionStateChange(QString strId, KSessionState state);
|
---|
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 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 sigUSBControllerChange();
|
---|
76 | void sigUSBDeviceStateChange(CUSBDevice device, bool fAttached, CVirtualBoxErrorInfo error);
|
---|
77 | void sigSharedFolderChange();
|
---|
78 | void sigRuntimeError(bool fFatal, QString strId, QString strMessage);
|
---|
79 | void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */
|
---|
80 | void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */
|
---|
81 | void sigCPUExecutionCapChange();
|
---|
82 | void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
|
---|
83 | };
|
---|
84 |
|
---|
85 | /* Wrap the IListener interface around our implementation class. */
|
---|
86 | typedef ListenerImpl<UIMainEventListener, QObject*> UIMainEventListenerImpl;
|
---|
87 |
|
---|
88 | #endif /* !__UIMainEventListener_h__ */
|
---|
89 |
|
---|