VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h@ 35740

Last change on this file since 35740 was 35722, checked in by vboxsync, 13 years ago

Main: reworked listener objects creation, fixes Win problems with events, few cleanups

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
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/* Local includes */
23#include "COMDefs.h"
24
25/* VBox includes */
26#include <VBox/com/listeners.h>
27
28/* Note: On a first look this may seems a little bit complicated.
29 * There are two reasons to use a separate class here which handles the events
30 * and forward them to the public class as signals. The first one is that on
31 * some platforms (e.g. Win32) this events not arrive in the main GUI thread.
32 * So there we have to make sure they are first delivered to the main GUI
33 * thread and later executed there. The second reason is, that the initiator
34 * method may hold a lock on a object which has to be manipulated in the event
35 * consumer. Doing this without being asynchronous would lead to a dead lock. To
36 * avoid both problems we send signals as a queued connection to the event
37 * consumer. Qt will create a event for us, place it in the main GUI event
38 * queue and deliver it later on. */
39
40class UIMainEventListener: public QObject
41{
42 Q_OBJECT;
43
44public:
45 UIMainEventListener();
46
47
48 HRESULT init(QObject *pParent);
49 void uninit();
50
51 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *pEvent);
52
53signals:
54 /* All VirtualBox Signals */
55 void sigMachineStateChange(QString strId, KMachineState state);
56 void sigMachineDataChange(QString strId);
57 void sigExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason); /* use Qt::DirectConnection */
58 void sigExtraDataChange(QString strId, QString strKey, QString strValue);
59 void sigMachineRegistered(QString strId, bool fRegistered);
60 void sigSessionStateChange(QString strId, KSessionState state);
61 void sigSnapshotChange(QString strId, QString strSnapshotId);
62 /* All Console Signals */
63 void sigMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape);
64 void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fNeedsHostCursor);
65 void sigKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock);
66 void sigStateChange(KMachineState state);
67 void sigAdditionsChange();
68 void sigNetworkAdapterChange(CNetworkAdapter adapter);
69 void sigMediumChange(CMediumAttachment attachment);
70 void sigUSBControllerChange();
71 void sigUSBDeviceStateChange(CUSBDevice device, bool fAttached, CVirtualBoxErrorInfo error);
72 void sigSharedFolderChange();
73 void sigRuntimeError(bool fFatal, QString strId, QString strMessage);
74 void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */
75 void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */
76};
77
78/* Wrap the IListener interface around our implementation class. */
79typedef ListenerImpl<UIMainEventListener, QObject*> UIMainEventListenerImpl;
80
81#endif /* !__UIMainEventListener_h__ */
82
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use