blob: 7c24f8800d02f4ff5d59999ee979980391eaf371 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/* $Id$ */
/** @file
* VBox Qt GUI - UIVirtualMachineItemCloud class declaration.
*/
/*
* Copyright (C) 2006-2020 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_h
#define FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif
/* GUI includes: */
#include "UICloudMachine.h"
#include "UIVirtualMachineItem.h"
/* Forward declarations: */
class UITask;
/** UIVirtualMachineItem sub-class used as cloud Virtual Machine item interface. */
class UIVirtualMachineItemCloud : public UIVirtualMachineItem
{
Q_OBJECT;
signals:
/** Notifies listeners about state change. */
void sigStateChange();
public:
/** Fake cloud item states. */
enum FakeCloudItemState
{
FakeCloudItemState_NotApplicable,
FakeCloudItemState_Loading,
FakeCloudItemState_Done
};
/** Constructs fake cloud VM item. */
UIVirtualMachineItemCloud();
/** Constructs real cloud VM item on the basis of taken @a guiCloudMachine. */
UIVirtualMachineItemCloud(const UICloudMachine &guiCloudMachine);
/** Destructs cloud VM item. */
virtual ~UIVirtualMachineItemCloud();
/** @name Arguments.
* @{ */
/** Returns cached cloud VM object. */
UICloudMachine machine() const { return m_guiCloudMachine; }
/** @} */
/** @name Data attributes.
* @{ */
/** Defines fake cloud item @a enmState. */
void setFakeCloudItemState(FakeCloudItemState enmState) { m_enmFakeCloudItemState = enmState; }
/** Returns fake cloud item state. */
FakeCloudItemState fakeCloudItemState() const { return m_enmFakeCloudItemState; }
/** Updates cloud VM info.
* @param pWidget Brings parent widget to show messages according to. */
void updateInfo(QWidget *pParent);
/** Updates cloud VM info async way, @a fDelayed if requested or instant otherwise. */
void updateInfoAsync(bool fDelayed);
/** Puts cloud VM on pause.
* @param pWidget Brings parent widget to show messages according to. */
void pause(QWidget *pParent);
/** Resumes cloud VM execution.
* @param pWidget Brings parent widget to show messages according to. */
void resume(QWidget *pParent);
/** Wrapper to handle two tasks above.
* @param fPause Brings whether cloud VM should be paused or resumed otherwise.
* @param pWidget Brings parent widget to show messages according to. */
void pauseOrResume(bool fPause, QWidget *pParent);
/** @} */
/** @name Update stuff.
* @{ */
/** Recaches machine data. */
virtual void recache() /* override */;
/** Recaches machine item pixmap. */
virtual void recachePixmap() /* override */;
/** @} */
/** @name Validation stuff.
* @{ */
/** Returns whether passed machine @a pItem is editable. */
virtual bool isItemEditable() const /* override */;
/** Returns whether passed machine @a pItem is saved. */
virtual bool isItemSaved() const /* override */;
/** Returns whether passed machine @a pItem is powered off. */
virtual bool isItemPoweredOff() const /* override */;
/** Returns whether passed machine @a pItem is started. */
virtual bool isItemStarted() const /* override */;
/** Returns whether passed machine @a pItem is running. */
virtual bool isItemRunning() const /* override */;
/** Returns whether passed machine @a pItem is running headless. */
virtual bool isItemRunningHeadless() const /* override */;
/** Returns whether passed machine @a pItem is paused. */
virtual bool isItemPaused() const /* override */;
/** Returns whether passed machine @a pItem is stuck. */
virtual bool isItemStuck() const /* override */;
/** @} */
protected:
/** @name Event handling.
* @{ */
/** Handles translation event. */
virtual void retranslateUi() /* override */;
/** @} */
private slots:
/** Create cloud VM info acquire task. */
void sltCreateGetCloudInstanceInfoTask();
/** Handles signal about cloud VM info acquire task is done. */
void sltHandleGetCloudInstanceInfoDone(UITask *pTask);
private:
/** @name Data attributes.
* @{ */
/** Updates cloud VM info on the basis of @a infoMap value. */
void updateInfo(const QMap<KVirtualSystemDescriptionType, QString> &infoMap);
/** @} */
/** @name Arguments.
* @{ */
/** Holds cached cloud VM object reference. */
UICloudMachine m_guiCloudMachine;
/** @} */
/** @name Data attributes.
* @{ */
/** Holds fake cloud item state. */
FakeCloudItemState m_enmFakeCloudItemState;
/** Holds the info acquire task instance. */
UITask *m_pTask;
/** @} */
};
#endif /* !FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_h */
|