1 | /* $Id: UIChooserNodeMachine.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIChooserNodeMachine 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_UIChooserNodeMachine_h
|
---|
29 | #define FEQT_INCLUDED_SRC_manager_chooser_UIChooserNodeMachine_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UIChooserNode.h"
|
---|
36 | #include "UIManagerDefs.h"
|
---|
37 |
|
---|
38 | /* Forward declarations: */
|
---|
39 | class UIVirtualMachineItem;
|
---|
40 | class CCloudMachine;
|
---|
41 | class CMachine;
|
---|
42 |
|
---|
43 |
|
---|
44 | /** UIChooserNode subclass used as interface for invisible tree-view machine nodes. */
|
---|
45 | class UIChooserNodeMachine : public UIChooserNode
|
---|
46 | {
|
---|
47 | Q_OBJECT;
|
---|
48 |
|
---|
49 | public:
|
---|
50 |
|
---|
51 | /** Constructs chooser node for local VM passing @a pParent to the base-class.
|
---|
52 | * @param iPosition Brings initial node position.
|
---|
53 | * @param comMachine Brings COM machine object. */
|
---|
54 | UIChooserNodeMachine(UIChooserNode *pParent,
|
---|
55 | int iPosition,
|
---|
56 | const CMachine &comMachine);
|
---|
57 | /** Constructs chooser node for real cloud VM passing @a pParent to the base-class.
|
---|
58 | * @param iPosition Brings initial node position.
|
---|
59 | * @param comCloudMachine Brings COM cloud machine object. */
|
---|
60 | UIChooserNodeMachine(UIChooserNode *pParent,
|
---|
61 | int iPosition,
|
---|
62 | const CCloudMachine &comCloudMachine);
|
---|
63 | /** Constructs chooser node for fake cloud VM passing @a pParent to the base-class.
|
---|
64 | * @param iPosition Brings the initial node position.
|
---|
65 | * @param enmState Brings fake item type. */
|
---|
66 | UIChooserNodeMachine(UIChooserNode *pParent,
|
---|
67 | int iPosition,
|
---|
68 | UIFakeCloudVirtualMachineItemState enmState);
|
---|
69 | /** Constructs chooser node passing @a pParent to the base-class.
|
---|
70 | * @param iPosition Brings the initial node position.
|
---|
71 | * @param pCopyFrom Brings the node to copy data from. */
|
---|
72 | UIChooserNodeMachine(UIChooserNode *pParent,
|
---|
73 | int iPosition,
|
---|
74 | UIChooserNodeMachine *pCopyFrom);
|
---|
75 | /** Destructs chooser node. */
|
---|
76 | virtual ~UIChooserNodeMachine() RT_OVERRIDE;
|
---|
77 |
|
---|
78 | /** Returns RTTI node type. */
|
---|
79 | virtual UIChooserNodeType type() const RT_OVERRIDE { return UIChooserNodeType_Machine; }
|
---|
80 |
|
---|
81 | /** Returns item name. */
|
---|
82 | virtual QString name() const RT_OVERRIDE;
|
---|
83 | /** Returns item full-name. */
|
---|
84 | virtual QString fullName() const RT_OVERRIDE;
|
---|
85 | /** Returns item description. */
|
---|
86 | virtual QString description() const RT_OVERRIDE;
|
---|
87 | /** Returns item definition.
|
---|
88 | * @param fFull Brings whether full definition is required
|
---|
89 | * which is used while saving group definitions,
|
---|
90 | * otherwise short definition will be returned,
|
---|
91 | * which is used while saving last chosen node. */
|
---|
92 | virtual QString definition(bool fFull = false) const RT_OVERRIDE;
|
---|
93 |
|
---|
94 | /** Returns whether there are children of certain @a enmType. */
|
---|
95 | virtual bool hasNodes(UIChooserNodeType enmType = UIChooserNodeType_Any) const RT_OVERRIDE;
|
---|
96 | /** Returns a list of nodes of certain @a enmType. */
|
---|
97 | virtual QList<UIChooserNode*> nodes(UIChooserNodeType enmType = UIChooserNodeType_Any) const RT_OVERRIDE;
|
---|
98 |
|
---|
99 | /** Adds passed @a pNode to specified @a iPosition. */
|
---|
100 | virtual void addNode(UIChooserNode *pNode, int iPosition) RT_OVERRIDE;
|
---|
101 | /** Removes passed @a pNode. */
|
---|
102 | virtual void removeNode(UIChooserNode *pNode) RT_OVERRIDE;
|
---|
103 |
|
---|
104 | /** Removes all children with specified @a uId recursively. */
|
---|
105 | virtual void removeAllNodes(const QUuid &uId) RT_OVERRIDE;
|
---|
106 | /** Updates all children with specified @a uId recursively. */
|
---|
107 | virtual void updateAllNodes(const QUuid &uId) RT_OVERRIDE;
|
---|
108 |
|
---|
109 | /** Returns position of specified node inside this one. */
|
---|
110 | virtual int positionOf(UIChooserNode *pNode) RT_OVERRIDE;
|
---|
111 |
|
---|
112 | /** Checks if this instance matches to search wrt. @a strSearchTerm and @a iSearchFlags and updates @a matchedItems. */
|
---|
113 | virtual void searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems) RT_OVERRIDE;
|
---|
114 |
|
---|
115 | /** Performs sorting of children nodes. */
|
---|
116 | virtual void sortNodes() RT_OVERRIDE;
|
---|
117 |
|
---|
118 | /** Returns virtual machine cache instance. */
|
---|
119 | UIVirtualMachineItem *cache() const;
|
---|
120 | /** Returns virtual machine cache instance. */
|
---|
121 | UIVirtualMachineItemType cacheType() const;
|
---|
122 |
|
---|
123 | /** Returns node machine id. */
|
---|
124 | QUuid id() const;
|
---|
125 | /** Returns whether node accessible. */
|
---|
126 | bool accessible() const;
|
---|
127 |
|
---|
128 | private slots:
|
---|
129 |
|
---|
130 | /** Handles translation event. */
|
---|
131 | void sltRetranslateUI();
|
---|
132 |
|
---|
133 | /** Handles machine state change. */
|
---|
134 | void sltHandleStateChange();
|
---|
135 |
|
---|
136 | private:
|
---|
137 |
|
---|
138 | /** Holds virtual machine cache instance. */
|
---|
139 | UIVirtualMachineItem *m_pCache;
|
---|
140 | };
|
---|
141 |
|
---|
142 |
|
---|
143 | #endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserNodeMachine_h */
|
---|