VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGroup.h

Last change on this file was 106061, checked in by vboxsync, 3 weeks ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 KB
Line 
1/* $Id: UIChooserNodeGroup.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIChooserNodeGroup class declaration.
4 */
5
6/*
7 * Copyright (C) 2012-2024 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_chooser_UIChooserNodeGroup_h
29#define FEQT_INCLUDED_SRC_manager_chooser_UIChooserNodeGroup_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "UIChooserNode.h"
36
37
38/** UIChooserNode subclass used as interface for invisible tree-view group nodes. */
39class UIChooserNodeGroup : public UIChooserNode
40{
41 Q_OBJECT;
42
43public:
44
45 /** Constructs chooser node passing @a pParent to the base-class.
46 * @param iPosition Brings the initial node position.
47 * @param uId Brings current node id.
48 * @param strName Brings current node name.
49 * @param enmGroupType Brings group node type.
50 * @param fOpened Brings whether this group node is opened. */
51 UIChooserNodeGroup(UIChooserNode *pParent,
52 int iPosition,
53 const QUuid &uId,
54 const QString &strName,
55 UIChooserNodeGroupType enmGroupType,
56 bool fOpened);
57 /** Constructs chooser node passing @a pParent to the base-class.
58 * @param iPosition Brings the initial node position.
59 * @param pCopyFrom Brings the node to copy data from. */
60 UIChooserNodeGroup(UIChooserNode *pParent,
61 int iPosition,
62 UIChooserNodeGroup *pCopyFrom);
63 /** Destructs chooser node removing it's children. */
64 virtual ~UIChooserNodeGroup() RT_OVERRIDE;
65
66 /** Returns RTTI node type. */
67 virtual UIChooserNodeType type() const RT_OVERRIDE { return UIChooserNodeType_Group; }
68
69 /** Returns item name. */
70 virtual QString name() const RT_OVERRIDE;
71 /** Returns item full-name. */
72 virtual QString fullName() const RT_OVERRIDE;
73 /** Returns item description. */
74 virtual QString description() const RT_OVERRIDE;
75 /** Returns item definition.
76 * @param fFull Brings whether full definition is required
77 * which is used while saving group definitions,
78 * otherwise short definition will be returned,
79 * which is used while saving last chosen node. */
80 virtual QString definition(bool fFull = false) const RT_OVERRIDE;
81
82 /** Returns whether there are children of certain @a enmType. */
83 virtual bool hasNodes(UIChooserNodeType enmType = UIChooserNodeType_Any) const RT_OVERRIDE;
84 /** Returns a list of nodes of certain @a enmType. */
85 virtual QList<UIChooserNode*> nodes(UIChooserNodeType enmType = UIChooserNodeType_Any) const RT_OVERRIDE;
86
87 /** Adds passed @a pNode to specified @a iPosition. */
88 virtual void addNode(UIChooserNode *pNode, int iPosition) RT_OVERRIDE;
89 /** Removes passed @a pNode. */
90 virtual void removeNode(UIChooserNode *pNode) RT_OVERRIDE;
91
92 /** Removes all children with specified @a uId recursively. */
93 virtual void removeAllNodes(const QUuid &uId) RT_OVERRIDE;
94 /** Updates all children with specified @a uId recursively. */
95 virtual void updateAllNodes(const QUuid &uId) RT_OVERRIDE;
96
97 /** Returns position of specified node inside this one. */
98 virtual int positionOf(UIChooserNode *pNode) RT_OVERRIDE;
99
100 /** Defines node @a strName. */
101 void setName(const QString &strName);
102
103 /** Returns group node type. */
104 UIChooserNodeGroupType groupType() const { return m_enmGroupType; }
105
106 /** Returns whether this group node is opened. */
107 bool isOpened() const { return m_fOpened; }
108 /** Returns whether this group node is closed. */
109 bool isClosed() const { return !m_fOpened; }
110
111 /** Opens this group node. */
112 void open() { m_fOpened = true; }
113 /** Closes this group node. */
114 void close() { m_fOpened = false; }
115
116 /** Recursively searches for a children wrt. @a strSearchTerm and @a iSearchFlags and updates the @a matchedItems. */
117 virtual void searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems) RT_OVERRIDE;
118
119 /** Performs sorting of children nodes. */
120 virtual void sortNodes() RT_OVERRIDE;
121
122 /** Returns node group id. */
123 QUuid id() const;
124
125private slots:
126
127 /** Handles translation event. */
128 void sltRetranslateUI();
129
130private:
131
132 /** Copies children contents from @a pCopyFrom item. */
133 void copyContents(UIChooserNodeGroup *pCopyFrom);
134
135 /** Holds the node id. */
136 QUuid m_uId;
137 /** Holds the node name. */
138 QString m_strName;
139 /** Holds the group node type. */
140 UIChooserNodeGroupType m_enmGroupType;
141 /** Holds whether node is opened. */
142 bool m_fOpened;
143
144 /** Holds group children. */
145 QList<UIChooserNode*> m_nodesGroup;
146 /** Holds global children. */
147 QList<UIChooserNode*> m_nodesGlobal;
148 /** Holds machine children. */
149 QList<UIChooserNode*> m_nodesMachine;
150};
151
152
153#endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserNodeGroup_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