VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.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: 6.4 KB
Line 
1/* $Id: UIVirtualMachineItemCloud.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIVirtualMachineItemCloud class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-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_UIVirtualMachineItemCloud_h
29#define FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "UIVirtualMachineItem.h"
36
37/* COM includes: */
38#include "CCloudMachine.h"
39
40/* Forward declarations: */
41class UIProgressTask;
42
43/** UIVirtualMachineItem sub-class used as cloud Virtual Machine item interface. */
44class UIVirtualMachineItemCloud : public UIVirtualMachineItem
45{
46 Q_OBJECT;
47
48signals:
49
50 /** Notifies listeners about refresh started. */
51 void sigRefreshStarted();
52 /** Notifies listeners about refresh finished. */
53 void sigRefreshFinished();
54
55public:
56
57 /** Constructs fake cloud VM item of certain @a enmState. */
58 UIVirtualMachineItemCloud(UIFakeCloudVirtualMachineItemState enmState);
59 /** Constructs real cloud VM item on the basis of taken @a comCloudMachine. */
60 UIVirtualMachineItemCloud(const CCloudMachine &comCloudMachine);
61 /** Destructs cloud VM item. */
62 virtual ~UIVirtualMachineItemCloud() RT_OVERRIDE;
63
64 /** @name Arguments.
65 * @{ */
66 /** Returns cached cloud machine object. */
67 CCloudMachine machine() const { return m_comCloudMachine; }
68 /** @} */
69
70 /** @name Data attributes.
71 * @{ */
72 /** Returns cached machine state. */
73 KCloudMachineState machineState() const { return m_enmMachineState; }
74 QUuid machineId() const { return m_comCloudMachine.isOk() ? m_comCloudMachine.GetId() : QUuid(); }
75
76 /** Defines fake cloud item @a enmState. */
77 void setFakeCloudItemState(UIFakeCloudVirtualMachineItemState enmState);
78 /** Returns fake cloud item state. */
79 UIFakeCloudVirtualMachineItemState fakeCloudItemState() const { return m_enmFakeCloudItemState; }
80
81 /** Defines fake cloud item @a strErrorMessage. */
82 void setFakeCloudItemErrorMessage(const QString &strErrorMessage);
83 /** Returns fake cloud item error message. */
84 QString fakeCloudItemErrorMessage() const { return m_strFakeCloudItemErrorMessage; }
85
86 /** Defines whether update is @a fRequired by global reason. */
87 void setUpdateRequiredByGlobalReason(bool fRequired);
88 /** Defines whether update is @a fRequired by local reason. */
89 void setUpdateRequiredByLocalReason(bool fRequired);
90 /** Updates cloud VM info async way, @a fDelayed if requested or instantly otherwise. */
91 void updateInfoAsync(bool fDelayed);
92 /** Makes sure async info update is finished.
93 * @note This method creates own event-loop to avoid blocking calling thread event processing,
94 * so it's safe to call it from the GUI thread, ofc the method itself will be blocked. */
95 void waitForAsyncInfoUpdateFinished();
96 /** @} */
97
98 /** @name Update stuff.
99 * @{ */
100 /** Recaches machine data. */
101 virtual void recache() RT_OVERRIDE;
102 /** Recaches machine item pixmap. */
103 virtual void recachePixmap() RT_OVERRIDE;
104 /** @} */
105
106 /** @name Validation stuff.
107 * @{ */
108 /** Returns whether this item is editable. */
109 virtual bool isItemEditable() const RT_OVERRIDE;
110 /** Returns whether this item is removable. */
111 virtual bool isItemRemovable() const RT_OVERRIDE;
112 /** Returns whether this item is saved. */
113 virtual bool isItemSaved() const RT_OVERRIDE;
114 /** Returns whether this item is powered off. */
115 virtual bool isItemPoweredOff() const RT_OVERRIDE;
116 /** Returns whether this item is started. */
117 virtual bool isItemStarted() const RT_OVERRIDE;
118 /** Returns whether this item is running. */
119 virtual bool isItemRunning() const RT_OVERRIDE;
120 /** Returns whether this item is running headless. */
121 virtual bool isItemRunningHeadless() const RT_OVERRIDE;
122 /** Returns whether this item is paused. */
123 virtual bool isItemPaused() const RT_OVERRIDE;
124 /** Returns whether this item is stuck. */
125 virtual bool isItemStuck() const RT_OVERRIDE;
126 /** Returns whether this item can be switched to. */
127 virtual bool isItemCanBeSwitchedTo() const RT_OVERRIDE;
128 /** @} */
129
130private slots:
131
132 /** @name Event handling.
133 * @{ */
134 /** Handles translation event. */
135 void sltRetranslateUI();
136 /** @} */
137
138 /** Handles signal about cloud VM info refresh progress is done. */
139 void sltHandleRefreshCloudMachineInfoDone();
140
141private:
142
143 /** @name Prepare/Cleanup cascade.
144 * @{ */
145 /** Prepares all. */
146 void prepare();
147 /** Cleanups all. */
148 void cleanup();
149 /** @} */
150
151 /** @name Arguments.
152 * @{ */
153 /** Holds cached cloud machine object. */
154 CCloudMachine m_comCloudMachine;
155 /** @} */
156
157 /** @name Data attributes.
158 * @{ */
159 /** Holds cached machine state. */
160 KCloudMachineState m_enmMachineState;
161
162 /** Holds fake cloud item state. */
163 UIFakeCloudVirtualMachineItemState m_enmFakeCloudItemState;
164 /** Holds fake cloud item error message. */
165 QString m_strFakeCloudItemErrorMessage;
166
167 /** Holds whether update is required by global reason. */
168 bool m_fUpdateRequiredByGlobalReason;
169 /** Holds whether update is required by local reason. */
170 bool m_fUpdateRequiredByLocalReason;
171 /** Holds the refresh progress-task instance. */
172 UIProgressTask *m_pProgressTaskRefresh;
173 /** @} */
174};
175
176#endif /* !FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_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