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