VirtualBox

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

Last change on this file since 103982 was 103803, checked in by vboxsync, 9 months ago

FE/Qt. bugref:10618. Splitting COMEnums.h file into individual enum header files.

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