1 | /* $Id: UIGuestControlTreeItem.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIGuestControlTreeItem class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016-2023 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_guestctrl_UIGuestControlTreeItem_h
|
---|
29 | #define FEQT_INCLUDED_SRC_guestctrl_UIGuestControlTreeItem_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "QITreeWidget.h"
|
---|
36 | #include "UIMainEventListener.h"
|
---|
37 |
|
---|
38 | /* COM includes: */
|
---|
39 | #include "COMEnums.h"
|
---|
40 | #include "CEventListener.h"
|
---|
41 | #include "CGuestSession.h"
|
---|
42 |
|
---|
43 | /* Forward declarations: */
|
---|
44 | class CEventSource;
|
---|
45 | class CGuestProcessStateChangedEvent;
|
---|
46 | class CGuestSessionStateChangedEvent;
|
---|
47 |
|
---|
48 | /** QITreeWidgetItem extension serving as a base class
|
---|
49 | to UIGuestSessionTreeItem and UIGuestProcessTreeItem classes */
|
---|
50 | class UIGuestControlTreeItem : public QITreeWidgetItem
|
---|
51 | {
|
---|
52 |
|
---|
53 | Q_OBJECT;
|
---|
54 |
|
---|
55 | public:
|
---|
56 |
|
---|
57 | UIGuestControlTreeItem(QITreeWidget *pTreeWidget, const QStringList &strings = QStringList());
|
---|
58 | UIGuestControlTreeItem(UIGuestControlTreeItem *pTreeWidgetItem, const QStringList &strings = QStringList());
|
---|
59 | virtual ~UIGuestControlTreeItem();
|
---|
60 | virtual QString propertyString() const = 0;
|
---|
61 |
|
---|
62 | private slots:
|
---|
63 |
|
---|
64 | protected:
|
---|
65 |
|
---|
66 | void prepareListener(CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
|
---|
67 | void cleanupListener(CEventSource comEventSource);
|
---|
68 | void prepare();
|
---|
69 |
|
---|
70 | ComObjPtr<UIMainEventListenerImpl> m_pQtListener;
|
---|
71 |
|
---|
72 | private:
|
---|
73 |
|
---|
74 | virtual void prepareListener() = 0;
|
---|
75 | virtual void prepareConnections() = 0;
|
---|
76 | virtual void cleanupListener() = 0;
|
---|
77 | virtual void setColumnText() = 0;
|
---|
78 |
|
---|
79 | /** Holds the COM event listener instance. */
|
---|
80 | CEventListener m_comEventListener;
|
---|
81 |
|
---|
82 | };
|
---|
83 |
|
---|
84 | /** UIGuestControlTreeItem extension. Represents a instance of CGuestSession
|
---|
85 | and acts as an event listener for this com object. */
|
---|
86 | class UIGuestSessionTreeItem : public UIGuestControlTreeItem
|
---|
87 | {
|
---|
88 | Q_OBJECT;
|
---|
89 |
|
---|
90 | signals:
|
---|
91 |
|
---|
92 | void sigGuessSessionUpdated();
|
---|
93 | void sigGuestSessionErrorText(QString strError);
|
---|
94 |
|
---|
95 | public:
|
---|
96 |
|
---|
97 | UIGuestSessionTreeItem(QITreeWidget *pTreeWidget, CGuestSession& guestSession, const QStringList &strings = QStringList());
|
---|
98 | UIGuestSessionTreeItem(UIGuestControlTreeItem *pTreeWidgetItem, CGuestSession& guestSession, const QStringList &strings = QStringList());
|
---|
99 | virtual ~UIGuestSessionTreeItem();
|
---|
100 | const CGuestSession& guestSession() const;
|
---|
101 | void errorString(QString strError);
|
---|
102 | KGuestSessionStatus status() const;
|
---|
103 | virtual QString propertyString() const RT_OVERRIDE;
|
---|
104 |
|
---|
105 | protected:
|
---|
106 |
|
---|
107 | void prepareListener(CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
|
---|
108 | void cleanupListener(CEventSource comEventSource);
|
---|
109 |
|
---|
110 | private slots:
|
---|
111 |
|
---|
112 | void sltGuestSessionUpdated(const CGuestSessionStateChangedEvent& cEvent);
|
---|
113 | void sltGuestProcessRegistered(CGuestProcess guestProcess);
|
---|
114 | void sltGuestProcessUnregistered(CGuestProcess guestProcess);
|
---|
115 |
|
---|
116 |
|
---|
117 | private:
|
---|
118 |
|
---|
119 | virtual void prepareListener() RT_OVERRIDE;
|
---|
120 | virtual void prepareConnections() RT_OVERRIDE;
|
---|
121 | virtual void cleanupListener() RT_OVERRIDE;
|
---|
122 | virtual void setColumnText() RT_OVERRIDE;
|
---|
123 | void addGuestProcess(CGuestProcess guestProcess);
|
---|
124 | void initProcessSubTree();
|
---|
125 | CGuestSession m_comGuestSession;
|
---|
126 | };
|
---|
127 |
|
---|
128 | /** UIGuestControlTreeItem extension. Represents a instance of CGuestProcess
|
---|
129 | and acts as an event listener for this com object. */
|
---|
130 | class UIGuestProcessTreeItem : public UIGuestControlTreeItem
|
---|
131 | {
|
---|
132 | Q_OBJECT;
|
---|
133 |
|
---|
134 | signals:
|
---|
135 |
|
---|
136 | void sigGuestProcessErrorText(QString strError);
|
---|
137 |
|
---|
138 | public:
|
---|
139 |
|
---|
140 | UIGuestProcessTreeItem(QITreeWidget *pTreeWidget, CGuestProcess& guestProcess, const QStringList &strings = QStringList());
|
---|
141 | UIGuestProcessTreeItem(UIGuestControlTreeItem *pTreeWidgetItem, CGuestProcess& guestProcess, const QStringList &strings = QStringList());
|
---|
142 | const CGuestProcess& guestProcess() const;
|
---|
143 | virtual ~UIGuestProcessTreeItem();
|
---|
144 | KProcessStatus status() const;
|
---|
145 | virtual QString propertyString() const RT_OVERRIDE;
|
---|
146 |
|
---|
147 | protected:
|
---|
148 |
|
---|
149 | void prepareListener(CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
|
---|
150 | void cleanupListener(CEventSource comEventSource);
|
---|
151 |
|
---|
152 | private slots:
|
---|
153 |
|
---|
154 | void sltGuestProcessUpdated(const CGuestProcessStateChangedEvent &cEvent);
|
---|
155 |
|
---|
156 | private:
|
---|
157 |
|
---|
158 | virtual void prepareListener() RT_OVERRIDE;
|
---|
159 | virtual void prepareConnections() RT_OVERRIDE;
|
---|
160 | virtual void cleanupListener() RT_OVERRIDE;
|
---|
161 | virtual void setColumnText() RT_OVERRIDE;
|
---|
162 |
|
---|
163 | CGuestProcess m_comGuestProcess;
|
---|
164 | };
|
---|
165 |
|
---|
166 | #endif /* !FEQT_INCLUDED_SRC_guestctrl_UIGuestControlTreeItem_h */
|
---|