VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlTreeItem.h@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 21 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
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: */
44class CEventSource;
45class CGuestProcessStateChangedEvent;
46class CGuestSessionStateChangedEvent;
47
48/** QITreeWidgetItem extension serving as a base class
49 to UIGuestSessionTreeItem and UIGuestProcessTreeItem classes */
50class UIGuestControlTreeItem : public QITreeWidgetItem
51{
52
53 Q_OBJECT;
54
55public:
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
62private slots:
63
64protected:
65
66 void prepareListener(CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
67 void cleanupListener(CEventSource comEventSource);
68 void prepare();
69
70 ComObjPtr<UIMainEventListenerImpl> m_pQtListener;
71
72private:
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. */
86class UIGuestSessionTreeItem : public UIGuestControlTreeItem
87{
88 Q_OBJECT;
89
90signals:
91
92 void sigGuessSessionUpdated();
93 void sigGuestSessionErrorText(QString strError);
94
95public:
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
105protected:
106
107 void prepareListener(CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
108 void cleanupListener(CEventSource comEventSource);
109
110private slots:
111
112 void sltGuestSessionUpdated(const CGuestSessionStateChangedEvent& cEvent);
113 void sltGuestProcessRegistered(CGuestProcess guestProcess);
114 void sltGuestProcessUnregistered(CGuestProcess guestProcess);
115
116
117private:
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. */
130class UIGuestProcessTreeItem : public UIGuestControlTreeItem
131{
132 Q_OBJECT;
133
134signals:
135
136 void sigGuestProcessErrorText(QString strError);
137
138public:
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
147protected:
148
149 void prepareListener(CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
150 void cleanupListener(CEventSource comEventSource);
151
152private slots:
153
154 void sltGuestProcessUpdated(const CGuestProcessStateChangedEvent &cEvent);
155
156private:
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 */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette