1 | /* $Id: UIDetailsGroup.h 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIDetailsGroup class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef FEQT_INCLUDED_SRC_manager_details_UIDetailsGroup_h
|
---|
19 | #define FEQT_INCLUDED_SRC_manager_details_UIDetailsGroup_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* GUI includes: */
|
---|
25 | #include "UIDetailsItem.h"
|
---|
26 |
|
---|
27 | /* Forward declarations: */
|
---|
28 | class QGraphicsLinearLayout;
|
---|
29 | class QGraphicsScene;
|
---|
30 | class UIGraphicsScrollArea;
|
---|
31 | class UIVirtualMachineItem;
|
---|
32 |
|
---|
33 | /** UIDetailsItem extension implementing group item. */
|
---|
34 | class UIDetailsGroup : public UIDetailsItem
|
---|
35 | {
|
---|
36 | Q_OBJECT;
|
---|
37 |
|
---|
38 | signals:
|
---|
39 |
|
---|
40 | /** @name Layout stuff.
|
---|
41 | * @{ */
|
---|
42 | /** Notifies listeners about @a iMinimumWidthHint changed. */
|
---|
43 | void sigMinimumWidthHintChanged(int iMinimumWidthHint);
|
---|
44 | /** @} */
|
---|
45 |
|
---|
46 | public:
|
---|
47 |
|
---|
48 | /** RTTI item type. */
|
---|
49 | enum { Type = UIDetailsItemType_Group };
|
---|
50 |
|
---|
51 | /** Constructs group item, passing pScene to the base-class. */
|
---|
52 | UIDetailsGroup(QGraphicsScene *pScene);
|
---|
53 | /** Destructs group item. */
|
---|
54 | virtual ~UIDetailsGroup() /* override */;
|
---|
55 |
|
---|
56 | /** @name Item stuff.
|
---|
57 | * @{ */
|
---|
58 | /** Builds group based on passed @a machineItems. */
|
---|
59 | void buildGroup(const QList<UIVirtualMachineItem*> &machineItems);
|
---|
60 | /** Builds group based on cached machine items. */
|
---|
61 | void rebuildGroup();
|
---|
62 | /** Stops currently building group. */
|
---|
63 | void stopBuildingGroup();
|
---|
64 |
|
---|
65 | /** Installs event-filter for @a pSource object. */
|
---|
66 | virtual void installEventFilterHelper(QObject *pSource) /* override */;
|
---|
67 | /** @} */
|
---|
68 |
|
---|
69 | /** @name Children stuff.
|
---|
70 | * @{ */
|
---|
71 | /** Returns children items of certain @a enmType. */
|
---|
72 | virtual QList<UIDetailsItem*> items(UIDetailsItemType enmType = UIDetailsItemType_Set) const /* override */;
|
---|
73 | /** @} */
|
---|
74 |
|
---|
75 | /** @name Layout stuff.
|
---|
76 | * @{ */
|
---|
77 | /** Updates layout. */
|
---|
78 | virtual void updateLayout() /* override */;
|
---|
79 |
|
---|
80 | /** Returns minimum width-hint. */
|
---|
81 | virtual int minimumWidthHint() const /* override */;
|
---|
82 | /** Returns minimum height-hint. */
|
---|
83 | virtual int minimumHeightHint() const /* override */;
|
---|
84 | /** @} */
|
---|
85 |
|
---|
86 | protected slots:
|
---|
87 |
|
---|
88 | /** @name Item stuff.
|
---|
89 | * @{ */
|
---|
90 | /** Handles request about starting step build.
|
---|
91 | * @param uStepId Brings the step ID.
|
---|
92 | * @param iStepNumber Brings the step number. */
|
---|
93 | /** @} */
|
---|
94 | virtual void sltBuildStep(const QUuid &uStepId, int iStepNumber) /* override */;
|
---|
95 |
|
---|
96 | protected:
|
---|
97 |
|
---|
98 | /** @name Item stuff.
|
---|
99 | * @{ */
|
---|
100 | /** Returns RTTI item type. */
|
---|
101 | virtual int type() const /* override */ { return Type; }
|
---|
102 |
|
---|
103 | /** Returns the description of the item. */
|
---|
104 | virtual QString description() const /* override */ { return QString(); }
|
---|
105 | /** @} */
|
---|
106 |
|
---|
107 | /** @name Children stuff.
|
---|
108 | * @{ */
|
---|
109 | /** Adds child @a pItem. */
|
---|
110 | virtual void addItem(UIDetailsItem *pItem) /* override */;
|
---|
111 | /** Removes child @a pItem. */
|
---|
112 | virtual void removeItem(UIDetailsItem *pItem) /* override */;
|
---|
113 |
|
---|
114 | /** Returns whether there are children items of certain @a enmType. */
|
---|
115 | virtual bool hasItems(UIDetailsItemType enmType = UIDetailsItemType_Set) const /* override */;
|
---|
116 | /** Clears children items of certain @a enmType. */
|
---|
117 | virtual void clearItems(UIDetailsItemType enmType = UIDetailsItemType_Set) /* override */;
|
---|
118 | /** @} */
|
---|
119 |
|
---|
120 | /** @name Layout stuff.
|
---|
121 | * @{ */
|
---|
122 | /** Updates geometry. */
|
---|
123 | virtual void updateGeometry() /* override */;
|
---|
124 | /** @} */
|
---|
125 |
|
---|
126 | private:
|
---|
127 |
|
---|
128 | /** @name Prepare/cleanup cascade.
|
---|
129 | * @{ */
|
---|
130 | /** Prepares connections. */
|
---|
131 | void prepareConnections();
|
---|
132 | /** @} */
|
---|
133 |
|
---|
134 | /** @name Item stuff.
|
---|
135 | * @{ */
|
---|
136 | /** Holds the build step instance. */
|
---|
137 | UIPrepareStep *m_pBuildStep;
|
---|
138 | /** Holds the generated group ID. */
|
---|
139 | QUuid m_uGroupId;
|
---|
140 | /** @} */
|
---|
141 |
|
---|
142 | /** @name Children stuff.
|
---|
143 | * @{ */
|
---|
144 | /** Holds the children scroll-area instance. */
|
---|
145 | UIGraphicsScrollArea *m_pScrollArea;
|
---|
146 | /** Holds the children container instance. */
|
---|
147 | QIGraphicsWidget *m_pContainer;
|
---|
148 | /** Holds the children layout instance. */
|
---|
149 | QGraphicsLinearLayout *m_pLayout;
|
---|
150 |
|
---|
151 | /** Holds the cached machine item list. */
|
---|
152 | QList<UIVirtualMachineItem*> m_machineItems;
|
---|
153 |
|
---|
154 | /** Holds the child list (a list of sets). */
|
---|
155 | QList<UIDetailsItem*> m_items;
|
---|
156 | /** @} */
|
---|
157 |
|
---|
158 | /** @name Layout stuff.
|
---|
159 | * @{ */
|
---|
160 | /** Holds previous minimum width hint. */
|
---|
161 | int m_iPreviousMinimumWidthHint;
|
---|
162 | /** @} */
|
---|
163 | };
|
---|
164 |
|
---|
165 | #endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsGroup_h */
|
---|