1 | /* $Id: UIDetailsGroup.h 74690 2018-10-08 16:30:31Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIDetailsGroup class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2018 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 ___UIDetailsGroup_h___
|
---|
19 | #define ___UIDetailsGroup_h___
|
---|
20 |
|
---|
21 | /* GUI includes: */
|
---|
22 | #include "UIDetailsItem.h"
|
---|
23 |
|
---|
24 | /* Forward declarations: */
|
---|
25 | class QGraphicsScene;
|
---|
26 | class UIVirtualMachineItem;
|
---|
27 |
|
---|
28 | /** UIDetailsItem extension implementing group item. */
|
---|
29 | class UIDetailsGroup : public UIDetailsItem
|
---|
30 | {
|
---|
31 | Q_OBJECT;
|
---|
32 |
|
---|
33 | signals:
|
---|
34 |
|
---|
35 | /** @name Layout stuff.
|
---|
36 | * @{ */
|
---|
37 | /** Notifies listeners about @a iMinimumWidthHint changed. */
|
---|
38 | void sigMinimumWidthHintChanged(int iMinimumWidthHint);
|
---|
39 | /** Notifies listeners about @a iMinimumHeightHint changed. */
|
---|
40 | void sigMinimumHeightHintChanged(int iMinimumHeightHint);
|
---|
41 | /** @} */
|
---|
42 |
|
---|
43 | public:
|
---|
44 |
|
---|
45 | /** RTTI item type. */
|
---|
46 | enum { Type = UIDetailsItemType_Group };
|
---|
47 |
|
---|
48 | /** Constructs group item, passing pScene to the base-class. */
|
---|
49 | UIDetailsGroup(QGraphicsScene *pScene);
|
---|
50 | /** Destructs group item. */
|
---|
51 | virtual ~UIDetailsGroup() /* override */;
|
---|
52 |
|
---|
53 | /** @name Item stuff.
|
---|
54 | * @{ */
|
---|
55 | /** Builds group based on passed @a machineItems. */
|
---|
56 | void buildGroup(const QList<UIVirtualMachineItem*> &machineItems);
|
---|
57 | /** Builds group based on cached machine items. */
|
---|
58 | void rebuildGroup();
|
---|
59 | /** Stops currently building group. */
|
---|
60 | void stopBuildingGroup();
|
---|
61 | /** @} */
|
---|
62 |
|
---|
63 | /** @name Children stuff.
|
---|
64 | * @{ */
|
---|
65 | /** Returns children items of certain @a enmType. */
|
---|
66 | virtual QList<UIDetailsItem*> items(UIDetailsItemType enmType = UIDetailsItemType_Set) const /* override */;
|
---|
67 | /** @} */
|
---|
68 |
|
---|
69 | /** @name Layout stuff.
|
---|
70 | * @{ */
|
---|
71 | /** Updates layout. */
|
---|
72 | virtual void updateLayout() /* override */;
|
---|
73 |
|
---|
74 | /** Returns minimum width-hint. */
|
---|
75 | virtual int minimumWidthHint() const /* override */;
|
---|
76 | /** Returns minimum height-hint. */
|
---|
77 | virtual int minimumHeightHint() const /* override */;
|
---|
78 | /** @} */
|
---|
79 |
|
---|
80 | protected slots:
|
---|
81 |
|
---|
82 | /** @name Item stuff.
|
---|
83 | * @{ */
|
---|
84 | /** Handles request about starting step build.
|
---|
85 | * @param strStepId Brings the step ID.
|
---|
86 | * @param iStepNumber Brings the step number. */
|
---|
87 | /** @} */
|
---|
88 | virtual void sltBuildStep(QString strStepId, int iStepNumber) /* override */;
|
---|
89 |
|
---|
90 | protected:
|
---|
91 |
|
---|
92 | /** @name Event-handling stuff.
|
---|
93 | * @{ */
|
---|
94 | /** Performs painting using passed @a pPainter, @a pOptions and optionally specified @a pWidget. */
|
---|
95 | virtual void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOptions, QWidget *pWidget = 0) /* override */;
|
---|
96 | /** @} */
|
---|
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 Painting stuff.
|
---|
135 | * @{ */
|
---|
136 | /** Paints background using specified @a pPainter and certain @a pOptions. */
|
---|
137 | void paintBackground(QPainter *pPainter, const QStyleOptionGraphicsItem *pOptions) const;
|
---|
138 | /** @} */
|
---|
139 |
|
---|
140 | /** @name Item stuff.
|
---|
141 | * @{ */
|
---|
142 | /** Holds the build step instance. */
|
---|
143 | UIPrepareStep *m_pBuildStep;
|
---|
144 | /** Holds the generated group ID. */
|
---|
145 | QString m_strGroupId;
|
---|
146 | /** @} */
|
---|
147 |
|
---|
148 | /** @name Children stuff.
|
---|
149 | * @{ */
|
---|
150 | /** Holds the cached machine item list. */
|
---|
151 | QList<UIVirtualMachineItem*> m_machineItems;
|
---|
152 |
|
---|
153 | /** Holds the child list (a list of sets). */
|
---|
154 | QList<UIDetailsItem*> m_items;
|
---|
155 | /** @} */
|
---|
156 |
|
---|
157 | /** @name Layout stuff.
|
---|
158 | * @{ */
|
---|
159 | int m_iPreviousMinimumWidthHint;
|
---|
160 | int m_iPreviousMinimumHeightHint;
|
---|
161 | /** @} */
|
---|
162 | };
|
---|
163 |
|
---|
164 | #endif /* !___UIDetailsGroup_h___ */
|
---|