1 | /* $Id: UIDetailsGroup.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIDetailsGroup class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-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_manager_details_UIDetailsGroup_h
|
---|
29 | #define FEQT_INCLUDED_SRC_manager_details_UIDetailsGroup_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UIDetailsItem.h"
|
---|
36 |
|
---|
37 | /* Forward declarations: */
|
---|
38 | class QGraphicsLinearLayout;
|
---|
39 | class QGraphicsScene;
|
---|
40 | class UIGraphicsScrollArea;
|
---|
41 | class UIVirtualMachineItem;
|
---|
42 |
|
---|
43 | /** UIDetailsItem extension implementing group item. */
|
---|
44 | class UIDetailsGroup : public UIDetailsItem
|
---|
45 | {
|
---|
46 | Q_OBJECT;
|
---|
47 |
|
---|
48 | signals:
|
---|
49 |
|
---|
50 | /** @name Layout stuff.
|
---|
51 | * @{ */
|
---|
52 | /** Notifies listeners about @a iMinimumWidthHint changed. */
|
---|
53 | void sigMinimumWidthHintChanged(int iMinimumWidthHint);
|
---|
54 | /** @} */
|
---|
55 |
|
---|
56 | public:
|
---|
57 |
|
---|
58 | /** RTTI item type. */
|
---|
59 | enum { Type = UIDetailsItemType_Group };
|
---|
60 |
|
---|
61 | /** Constructs group item, passing pScene to the base-class. */
|
---|
62 | UIDetailsGroup(QGraphicsScene *pScene);
|
---|
63 | /** Destructs group item. */
|
---|
64 | virtual ~UIDetailsGroup() RT_OVERRIDE;
|
---|
65 |
|
---|
66 | /** @name Item stuff.
|
---|
67 | * @{ */
|
---|
68 | /** Builds group based on passed @a machineItems. */
|
---|
69 | void buildGroup(const QList<UIVirtualMachineItem*> &machineItems);
|
---|
70 | /** Builds group based on cached machine items. */
|
---|
71 | void rebuildGroup();
|
---|
72 | /** Stops currently building group. */
|
---|
73 | void stopBuildingGroup();
|
---|
74 |
|
---|
75 | /** Installs event-filter for @a pSource object. */
|
---|
76 | virtual void installEventFilterHelper(QObject *pSource) RT_OVERRIDE;
|
---|
77 | /** @} */
|
---|
78 |
|
---|
79 | /** @name Children stuff.
|
---|
80 | * @{ */
|
---|
81 | /** Returns children items of certain @a enmType. */
|
---|
82 | virtual QList<UIDetailsItem*> items(UIDetailsItemType enmType = UIDetailsItemType_Set) const RT_OVERRIDE;
|
---|
83 | /** @} */
|
---|
84 |
|
---|
85 | /** @name Layout stuff.
|
---|
86 | * @{ */
|
---|
87 | /** Updates layout. */
|
---|
88 | virtual void updateLayout() RT_OVERRIDE;
|
---|
89 |
|
---|
90 | /** Returns minimum width-hint. */
|
---|
91 | virtual int minimumWidthHint() const RT_OVERRIDE;
|
---|
92 | /** Returns minimum height-hint. */
|
---|
93 | virtual int minimumHeightHint() const RT_OVERRIDE;
|
---|
94 | /** @} */
|
---|
95 |
|
---|
96 | protected slots:
|
---|
97 |
|
---|
98 | /** @name Item stuff.
|
---|
99 | * @{ */
|
---|
100 | /** Handles request about starting step build.
|
---|
101 | * @param uStepId Brings the step ID.
|
---|
102 | * @param iStepNumber Brings the step number. */
|
---|
103 | /** @} */
|
---|
104 | virtual void sltBuildStep(const QUuid &uStepId, int iStepNumber) RT_OVERRIDE;
|
---|
105 |
|
---|
106 | protected:
|
---|
107 |
|
---|
108 | /** @name Item stuff.
|
---|
109 | * @{ */
|
---|
110 | /** Returns RTTI item type. */
|
---|
111 | virtual int type() const RT_OVERRIDE { return Type; }
|
---|
112 |
|
---|
113 | /** Returns the description of the item. */
|
---|
114 | virtual QString description() const RT_OVERRIDE { return QString(); }
|
---|
115 | /** @} */
|
---|
116 |
|
---|
117 | /** @name Children stuff.
|
---|
118 | * @{ */
|
---|
119 | /** Adds child @a pItem. */
|
---|
120 | virtual void addItem(UIDetailsItem *pItem) RT_OVERRIDE;
|
---|
121 | /** Removes child @a pItem. */
|
---|
122 | virtual void removeItem(UIDetailsItem *pItem) RT_OVERRIDE;
|
---|
123 |
|
---|
124 | /** Returns whether there are children items of certain @a enmType. */
|
---|
125 | virtual bool hasItems(UIDetailsItemType enmType = UIDetailsItemType_Set) const RT_OVERRIDE;
|
---|
126 | /** Clears children items of certain @a enmType. */
|
---|
127 | virtual void clearItems(UIDetailsItemType enmType = UIDetailsItemType_Set) RT_OVERRIDE;
|
---|
128 | /** @} */
|
---|
129 |
|
---|
130 | /** @name Layout stuff.
|
---|
131 | * @{ */
|
---|
132 | /** Updates geometry. */
|
---|
133 | virtual void updateGeometry() RT_OVERRIDE;
|
---|
134 | /** @} */
|
---|
135 |
|
---|
136 | private:
|
---|
137 |
|
---|
138 | /** @name Prepare/cleanup cascade.
|
---|
139 | * @{ */
|
---|
140 | /** Prepares connections. */
|
---|
141 | void prepareConnections();
|
---|
142 | /** @} */
|
---|
143 |
|
---|
144 | /** @name Item stuff.
|
---|
145 | * @{ */
|
---|
146 | /** Holds the build step instance. */
|
---|
147 | UIPrepareStep *m_pBuildStep;
|
---|
148 | /** Holds the generated group ID. */
|
---|
149 | QUuid m_uGroupId;
|
---|
150 | /** @} */
|
---|
151 |
|
---|
152 | /** @name Children stuff.
|
---|
153 | * @{ */
|
---|
154 | /** Holds the children scroll-area instance. */
|
---|
155 | UIGraphicsScrollArea *m_pScrollArea;
|
---|
156 | /** Holds the children container instance. */
|
---|
157 | QIGraphicsWidget *m_pContainer;
|
---|
158 | /** Holds the children layout instance. */
|
---|
159 | QGraphicsLinearLayout *m_pLayout;
|
---|
160 |
|
---|
161 | /** Holds the cached machine item list. */
|
---|
162 | QList<UIVirtualMachineItem*> m_machineItems;
|
---|
163 |
|
---|
164 | /** Holds the child list (a list of sets). */
|
---|
165 | QList<UIDetailsItem*> m_items;
|
---|
166 | /** @} */
|
---|
167 |
|
---|
168 | /** @name Layout stuff.
|
---|
169 | * @{ */
|
---|
170 | /** Holds previous minimum width hint. */
|
---|
171 | int m_iPreviousMinimumWidthHint;
|
---|
172 | /** @} */
|
---|
173 | };
|
---|
174 |
|
---|
175 | #endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsGroup_h */
|
---|