1 | /* $Id: UIVirtualBoxEventHandler.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVirtualBoxEventHandler class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_globals_UIVirtualBoxEventHandler_h
|
---|
29 | #define FEQT_INCLUDED_SRC_globals_UIVirtualBoxEventHandler_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QObject>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UILibraryDefs.h"
|
---|
39 |
|
---|
40 | /* COM includes: */
|
---|
41 | #include "CMedium.h"
|
---|
42 | #include "CMediumAttachment.h"
|
---|
43 | #include "KMachineState.h"
|
---|
44 | #include "KSessionState.h"
|
---|
45 |
|
---|
46 | /* Forward declarations: */
|
---|
47 | class UIVirtualBoxEventHandlerProxy;
|
---|
48 |
|
---|
49 | /** Singleton QObject extension providing GUI with CVirtualBox event-source. */
|
---|
50 | class SHARED_LIBRARY_STUFF UIVirtualBoxEventHandler : public QObject
|
---|
51 | {
|
---|
52 | Q_OBJECT;
|
---|
53 |
|
---|
54 | signals:
|
---|
55 |
|
---|
56 | /** Notifies about @a state change event for the machine with @a uId. */
|
---|
57 | void sigMachineStateChange(const QUuid &uId, const KMachineState state);
|
---|
58 | /** Notifies about data change event for the machine with @a uId. */
|
---|
59 | void sigMachineDataChange(const QUuid &uId);
|
---|
60 | /** Notifies about machine with @a uId was @a fRegistered. */
|
---|
61 | void sigMachineRegistered(const QUuid &uId, const bool fRegistered);
|
---|
62 | /** Notifies about machine with @a uId has groups changed. */
|
---|
63 | void sigMachineGroupsChange(const QUuid &uId);
|
---|
64 | /** Notifies about @a state change event for the session of the machine with @a uId. */
|
---|
65 | void sigSessionStateChange(const QUuid &uId, const KSessionState state);
|
---|
66 | /** Notifies about snapshot with @a uSnapshotId was taken for the machine with @a uId. */
|
---|
67 | void sigSnapshotTake(const QUuid &uId, const QUuid &uSnapshotId);
|
---|
68 | /** Notifies about snapshot with @a uSnapshotId was deleted for the machine with @a uId. */
|
---|
69 | void sigSnapshotDelete(const QUuid &uId, const QUuid &uSnapshotId);
|
---|
70 | /** Notifies about snapshot with @a uSnapshotId was changed for the machine with @a uId. */
|
---|
71 | void sigSnapshotChange(const QUuid &uId, const QUuid &uSnapshotId);
|
---|
72 | /** Notifies about snapshot with @a uSnapshotId was restored for the machine with @a uId. */
|
---|
73 | void sigSnapshotRestore(const QUuid &uId, const QUuid &uSnapshotId);
|
---|
74 | /** Notifies about request to uninstall cloud provider with @a uId. */
|
---|
75 | void sigCloudProviderUninstall(const QUuid &uId);
|
---|
76 | /** Notifies about cloud provider list changed. */
|
---|
77 | void sigCloudProviderListChanged();
|
---|
78 | /** Notifies about cloud profile with specified @a strName of provider with specified @a uProviderId is @a fRegistered. */
|
---|
79 | void sigCloudProfileRegistered(const QUuid &uProviderId, const QString &strName, bool fRegistered);
|
---|
80 | /** Notifies about cloud profile with specified @a strName of provider with specified @a uProviderId is changed. */
|
---|
81 | void sigCloudProfileChanged(const QUuid &uProviderId, const QString &strName);
|
---|
82 |
|
---|
83 | /** Notifies about storage controller change.
|
---|
84 | * @param uMachineId Brings the ID of machine corresponding controller belongs to.
|
---|
85 | * @param strControllerName Brings the name of controller this event is related to. */
|
---|
86 | void sigStorageControllerChange(const QUuid &uMachineId, const QString &strControllerName);
|
---|
87 | /** Notifies about storage device change.
|
---|
88 | * @param comAttachment Brings corresponding attachment.
|
---|
89 | * @param fRemoved Brings whether medium is removed or added.
|
---|
90 | * @param fSilent Brings whether this change has gone silent for guest. */
|
---|
91 | void sigStorageDeviceChange(CMediumAttachment comAttachment, bool fRemoved, bool fSilent);
|
---|
92 | /** Notifies about storage medium @a comAttachment state change. */
|
---|
93 | void sigMediumChange(CMediumAttachment comAttachment);
|
---|
94 | /** Notifies about storage @a comMedium config change. */
|
---|
95 | void sigMediumConfigChange(CMedium comMedium);
|
---|
96 | /** Notifies about storage medium is (un)registered.
|
---|
97 | * @param uMediumId Brings corresponding medium ID.
|
---|
98 | * @param enmMediumType Brings corresponding medium type.
|
---|
99 | * @param fRegistered Brings whether medium is registered or unregistered. */
|
---|
100 | void sigMediumRegistered(const QUuid &uMediumId, KDeviceType enmMediumType, bool fRegistered);
|
---|
101 | /** Notifies extension pack. install.
|
---|
102 | * @param strName Passes extension pack name. */
|
---|
103 | void sigExtensionPackInstalled(const QString &strName);
|
---|
104 | /** Notifies extension pack. uninstall.
|
---|
105 | * @param strName Passes extension pack name. */
|
---|
106 | void sigExtensionPackUninstalled(const QString &strName);
|
---|
107 |
|
---|
108 | public:
|
---|
109 |
|
---|
110 | /** Returns singleton instance. */
|
---|
111 | static UIVirtualBoxEventHandler *instance();
|
---|
112 | /** Destroys singleton instance. */
|
---|
113 | static void destroy();
|
---|
114 |
|
---|
115 | protected:
|
---|
116 |
|
---|
117 | /** Constructs VirtualBox event handler. */
|
---|
118 | UIVirtualBoxEventHandler();
|
---|
119 |
|
---|
120 | /** Prepares all. */
|
---|
121 | void prepare();
|
---|
122 | /** Prepares connections. */
|
---|
123 | void prepareConnections();
|
---|
124 |
|
---|
125 | private:
|
---|
126 |
|
---|
127 | /** Holds the singleton instance. */
|
---|
128 | static UIVirtualBoxEventHandler *s_pInstance;
|
---|
129 |
|
---|
130 | /** Holds the VirtualBox event proxy instance. */
|
---|
131 | UIVirtualBoxEventHandlerProxy *m_pProxy;
|
---|
132 | };
|
---|
133 |
|
---|
134 | /** Singleton VirtualBox Event Handler 'official' name. */
|
---|
135 | #define gVBoxEvents UIVirtualBoxEventHandler::instance()
|
---|
136 |
|
---|
137 | #endif /* !FEQT_INCLUDED_SRC_globals_UIVirtualBoxEventHandler_h */
|
---|