VirtualBox

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

Last change on this file was 104251, checked in by vboxsync, 8 weeks ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in the manager UI classes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
RevLine 
[55401]1/* $Id: UIVirtualMachineItem.h 104251 2024-04-09 12:36:47Z vboxsync $ */
[382]2/** @file
[73424]3 * VBox Qt GUI - UIVirtualMachineItem class declarations.
[382]4 */
5
6/*
[98103]7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
[382]8 *
[96407]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
[382]26 */
27
[76581]28#ifndef FEQT_INCLUDED_SRC_manager_UIVirtualMachineItem_h
29#define FEQT_INCLUDED_SRC_manager_UIVirtualMachineItem_h
[76532]30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
[382]33
[41587]34/* Qt includes: */
[82931]35#include <QIcon>
[34064]36#include <QMimeData>
[66659]37#include <QPixmap>
[83290]38#include <QUuid>
[382]39
[50907]40/* GUI includes: */
[83921]41#include "UIManagerDefs.h"
[50907]42#include "UISettingsDefs.h"
43
[82944]44/* Forward declarations: */
[82960]45class UIVirtualMachineItemCloud;
[82944]46class UIVirtualMachineItemLocal;
47
[50907]48/* Using declarations: */
49using namespace UISettingsDefs;
50
[82931]51/** Virtual Machine item interface. A wrapper caching VM data. */
[104251]52class UIVirtualMachineItem : public QObject
[8159]53{
[82931]54 Q_OBJECT;
55
[8159]56public:
[13790]57
[82944]58 /** Constructs VM item on the basis of taken @a enmType. */
[83921]59 UIVirtualMachineItem(UIVirtualMachineItemType enmType);
[82944]60 /** Destructs VM item. */
[73424]61 virtual ~UIVirtualMachineItem();
[382]62
[82944]63 /** @name RTTI stuff.
[82878]64 * @{ */
[82944]65 /** Returns item type. */
[83921]66 UIVirtualMachineItemType itemType() const { return m_enmType; }
[82944]67 /** Returns item casted to local type. */
68 UIVirtualMachineItemLocal *toLocal();
[82960]69 /** Returns item casted to cloud type. */
70 UIVirtualMachineItemCloud *toCloud();
[82878]71 /** @} */
[382]72
[82878]73 /** @name VM access attributes.
74 * @{ */
75 /** Returns whether VM was accessible. */
76 bool accessible() const { return m_fAccessible; }
77 /** Returns the last cached access error. */
[83254]78 QString accessError() const { return m_strAccessError; }
[82878]79 /** @} */
[31240]80
[82931]81 /** @name Basic attributes.
[82878]82 * @{ */
[82931]83 /** Returns cached machine id. */
[83290]84 QUuid id() const { return m_uId; }
[82878]85 /** Returns cached machine name. */
86 QString name() const { return m_strName; }
87 /** Returns cached machine OS type id. */
88 QString osTypeId() const { return m_strOSTypeId; }
89 /** Returns cached machine OS type pixmap.
90 * @param pLogicalSize Argument to assign actual pixmap size to. */
91 QPixmap osPixmap(QSize *pLogicalSize = 0) const;
92 /** @} */
[8159]93
[82878]94 /** @name State attributes.
95 * @{ */
[82931]96 /** Returns cached machine state name. */
97 QString machineStateName() const { return m_strMachineStateName; }
98 /** Returns cached machine state icon. */
99 QIcon machineStateIcon() const { return m_machineStateIcon; }
100
[82878]101 /** Returns cached configuration access level. */
102 ConfigurationAccessLevel configurationAccessLevel() const { return m_enmConfigurationAccessLevel; }
103 /** @} */
[8159]104
[82878]105 /** @name Visual attributes.
106 * @{ */
107 /** Returns cached machine tool-tip. */
[82931]108 QString toolTipText() const { return m_strToolTipText; }
[82878]109 /** @} */
[8159]110
[82878]111 /** @name Extra-data options.
112 * @{ */
113 /** Returns whether we should show machine details. */
114 bool hasDetails() const { return m_fHasDetails; }
115 /** @} */
[14019]116
[82878]117 /** @name Update stuff.
118 * @{ */
119 /** Recaches machine data. */
[82944]120 virtual void recache() = 0;
[82878]121 /** Recaches machine item pixmap. */
[82944]122 virtual void recachePixmap() = 0;
[82878]123 /** @} */
[45050]124
[82878]125 /** @name Validation stuff.
126 * @{ */
[83755]127 /** Returns whether this item is editable. */
[82944]128 virtual bool isItemEditable() const = 0;
[84102]129 /** Returns whether this item is removable. */
130 virtual bool isItemRemovable() const = 0;
[83755]131 /** Returns whether this item is saved. */
[82944]132 virtual bool isItemSaved() const = 0;
[83755]133 /** Returns whether this item is powered off. */
[82944]134 virtual bool isItemPoweredOff() const = 0;
[83755]135 /** Returns whether this item is started. */
[82944]136 virtual bool isItemStarted() const = 0;
[83755]137 /** Returns whether this item is running. */
[82944]138 virtual bool isItemRunning() const = 0;
[83755]139 /** Returns whether this item is running headless. */
[82944]140 virtual bool isItemRunningHeadless() const = 0;
[83755]141 /** Returns whether this item is paused. */
[82944]142 virtual bool isItemPaused() const = 0;
[83755]143 /** Returns whether this item is stuck. */
[82944]144 virtual bool isItemStuck() const = 0;
[83755]145 /** Returns whether this item can be switched to. */
146 virtual bool isItemCanBeSwitchedTo() const = 0;
[82878]147 /** @} */
[50907]148
[82931]149protected:
150
[82944]151 /** @name RTTI stuff.
[82931]152 * @{ */
[82944]153 /** Holds item type. */
[83921]154 UIVirtualMachineItemType m_enmType;
[82931]155 /** @} */
156
[82878]157 /** @name VM access attributes.
158 * @{ */
159 /** Holds whether VM was accessible. */
[83254]160 bool m_fAccessible;
[82878]161 /** Holds the last cached access error. */
[83254]162 QString m_strAccessError;
[82878]163 /** @} */
[8159]164
[82931]165 /** @name Basic attributes.
[82878]166 * @{ */
[82931]167 /** Holds cached machine id. */
[83290]168 QUuid m_uId;
[82878]169 /** Holds cached machine name. */
[83255]170 QString m_strName;
[82878]171 /** Holds cached machine OS type id. */
[83255]172 QString m_strOSTypeId;
[82878]173 /** Holds cached machine OS type pixmap. */
[83255]174 QPixmap m_pixmap;
[82878]175 /** Holds cached machine OS type pixmap size. */
[83255]176 QSize m_logicalPixmapSize;
[82878]177 /** @} */
[8159]178
[82878]179 /** @name State attributes.
180 * @{ */
[82931]181 /** Holds cached machine state name. */
[83255]182 QString m_strMachineStateName;
[82931]183 /** Holds cached machine state name. */
[83255]184 QIcon m_machineStateIcon;
[82931]185
[82878]186 /** Holds configuration access level. */
187 ConfigurationAccessLevel m_enmConfigurationAccessLevel;
188 /** @} */
[50907]189
[82931]190 /** @name Visual attributes.
191 * @{ */
192 /** Holds cached machine tool-tip. */
193 QString m_strToolTipText;
194 /** @} */
195
[82878]196 /** @name Extra-data options.
197 * @{ */
198 /** Holds whether we should show machine details. */
199 bool m_fHasDetails;
200 /** @} */
[8159]201};
202
203/* Make the pointer of this class public to the QVariant framework */
[73424]204Q_DECLARE_METATYPE(UIVirtualMachineItem *);
[8159]205
[82878]206/** QMimeData subclass for handling UIVirtualMachineItem mime data. */
207class UIVirtualMachineItemMimeData : public QMimeData
[34064]208{
209 Q_OBJECT;
210
211public:
212
[82878]213 /** Constructs mime data for passed VM @a pItem. */
[73424]214 UIVirtualMachineItemMimeData(UIVirtualMachineItem *pItem);
[34064]215
[82878]216 /** Returns cached VM item. */
217 UIVirtualMachineItem *item() const { return m_pItem; }
[34064]218
[82878]219 /** Returns supported format list. */
[93990]220 virtual QStringList formats() const RT_OVERRIDE;
[34064]221
[82878]222 /** Returns UIVirtualMachineItem mime data type. */
223 static QString type() { return m_type; }
224
[34064]225private:
226
[82878]227 /** Holds cached VM item. */
[73424]228 UIVirtualMachineItem *m_pItem;
[34064]229
[82878]230 /** Holds UIVirtualMachineItem mime data type. */
231 static QString m_type;
[34064]232};
233
[76581]234#endif /* !FEQT_INCLUDED_SRC_manager_UIVirtualMachineItem_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use