[30022] | 1 | /* $Id: UIVirtualMachineItem.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
[382] | 2 | /** @file
|
---|
[73424] | 3 | * VBox Qt GUI - UIVirtualMachineItem class implementation.
|
---|
[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 |
|
---|
[41587] | 28 | /* GUI includes: */
|
---|
[82960] | 29 | #include "UIVirtualMachineItemCloud.h"
|
---|
[82944] | 30 | #include "UIVirtualMachineItemLocal.h"
|
---|
[30691] | 31 |
|
---|
[41587] | 32 |
|
---|
[82878] | 33 | /*********************************************************************************************************************************
|
---|
| 34 | * Class UIVirtualMachineItem implementation. *
|
---|
| 35 | *********************************************************************************************************************************/
|
---|
| 36 |
|
---|
[83921] | 37 | UIVirtualMachineItem::UIVirtualMachineItem(UIVirtualMachineItemType enmType)
|
---|
[82944] | 38 | : m_enmType(enmType)
|
---|
[82878] | 39 | , m_fAccessible(false)
|
---|
| 40 | , m_enmConfigurationAccessLevel(ConfigurationAccessLevel_Null)
|
---|
[82879] | 41 | , m_fHasDetails(false)
|
---|
[382] | 42 | {
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[73424] | 45 | UIVirtualMachineItem::~UIVirtualMachineItem()
|
---|
[382] | 46 | {
|
---|
| 47 | }
|
---|
| 48 |
|
---|
[82944] | 49 | UIVirtualMachineItemLocal *UIVirtualMachineItem::toLocal()
|
---|
| 50 | {
|
---|
[83921] | 51 | return itemType() == UIVirtualMachineItemType_Local
|
---|
[82944] | 52 | ? static_cast<UIVirtualMachineItemLocal*>(this)
|
---|
| 53 | : 0;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
[82960] | 56 | UIVirtualMachineItemCloud *UIVirtualMachineItem::toCloud()
|
---|
| 57 | {
|
---|
[83921] | 58 | return ( itemType() == UIVirtualMachineItemType_CloudFake
|
---|
| 59 | || itemType() == UIVirtualMachineItemType_CloudReal)
|
---|
[82960] | 60 | ? static_cast<UIVirtualMachineItemCloud*>(this)
|
---|
| 61 | : 0;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
[73424] | 64 | QPixmap UIVirtualMachineItem::osPixmap(QSize *pLogicalSize /* = 0 */) const
|
---|
[41608] | 65 | {
|
---|
[66659] | 66 | if (pLogicalSize)
|
---|
| 67 | *pLogicalSize = m_logicalPixmapSize;
|
---|
| 68 | return m_pixmap;
|
---|
[41608] | 69 | }
|
---|
| 70 |
|
---|
[72215] | 71 |
|
---|
[82878] | 72 | /*********************************************************************************************************************************
|
---|
| 73 | * Class UIVirtualMachineItemMimeData implementation. *
|
---|
| 74 | *********************************************************************************************************************************/
|
---|
| 75 |
|
---|
[73424] | 76 | QString UIVirtualMachineItemMimeData::m_type = "application/org.virtualbox.gui.vmselector.UIVirtualMachineItem";
|
---|
[34064] | 77 |
|
---|
[73424] | 78 | UIVirtualMachineItemMimeData::UIVirtualMachineItemMimeData(UIVirtualMachineItem *pItem)
|
---|
[82878] | 79 | : m_pItem(pItem)
|
---|
[34064] | 80 | {
|
---|
| 81 | }
|
---|
| 82 |
|
---|
[73424] | 83 | QStringList UIVirtualMachineItemMimeData::formats() const
|
---|
[34064] | 84 | {
|
---|
| 85 | QStringList types;
|
---|
| 86 | types << type();
|
---|
| 87 | return types;
|
---|
| 88 | }
|
---|