1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * UIVMItem class declarations
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __UIVMItem_h__
|
---|
20 | #define __UIVMItem_h__
|
---|
21 |
|
---|
22 | /* Local includes */
|
---|
23 | #include "VBoxGlobal.h"
|
---|
24 |
|
---|
25 | /* Global includes */
|
---|
26 | #include <QDateTime>
|
---|
27 | #include <QMimeData>
|
---|
28 |
|
---|
29 | class UIVMItem
|
---|
30 | {
|
---|
31 | public:
|
---|
32 |
|
---|
33 | UIVMItem(const CMachine &aMachine);
|
---|
34 | virtual ~UIVMItem();
|
---|
35 |
|
---|
36 | CMachine machine() const { return m_machine; }
|
---|
37 |
|
---|
38 | QString name() const { return m_strName; }
|
---|
39 | QIcon osIcon() const { return m_fAccessible ? vboxGlobal().vmGuestOSTypeIcon(m_strOSTypeId) : QPixmap(":/os_other.png"); }
|
---|
40 | QString osTypeId() const { return m_strOSTypeId; }
|
---|
41 | QString id() const { return m_strId; }
|
---|
42 |
|
---|
43 | QString machineStateName() const;
|
---|
44 | QIcon machineStateIcon() const { return m_fAccessible ? vboxGlobal().toIcon(m_machineState) : QPixmap(":/state_aborted_16px.png"); }
|
---|
45 |
|
---|
46 | QString sessionStateName() const;
|
---|
47 |
|
---|
48 | QString snapshotName() const { return m_strSnapshotName; }
|
---|
49 | ULONG snapshotCount() const { return m_cSnaphot; }
|
---|
50 |
|
---|
51 | QString toolTipText() const;
|
---|
52 |
|
---|
53 | bool accessible() const { return m_fAccessible; }
|
---|
54 | const CVirtualBoxErrorInfo &accessError() const { return m_accessError; }
|
---|
55 | KMachineState machineState() const { return m_machineState; }
|
---|
56 | KSessionState sessionState() const { return m_sessionState; }
|
---|
57 |
|
---|
58 | QString settingsFile() const { return m_strSettingsFile; }
|
---|
59 |
|
---|
60 | bool recache();
|
---|
61 |
|
---|
62 | bool canSwitchTo() const;
|
---|
63 | bool switchTo();
|
---|
64 |
|
---|
65 | private:
|
---|
66 |
|
---|
67 | /* Private member vars */
|
---|
68 | CMachine m_machine;
|
---|
69 |
|
---|
70 | /* Cached machine data (to minimize server requests) */
|
---|
71 | QString m_strId;
|
---|
72 | QString m_strSettingsFile;
|
---|
73 |
|
---|
74 | bool m_fAccessible;
|
---|
75 | CVirtualBoxErrorInfo m_accessError;
|
---|
76 |
|
---|
77 | QString m_strName;
|
---|
78 | QString m_strSnapshotName;
|
---|
79 | QDateTime m_lastStateChange;
|
---|
80 | KMachineState m_machineState;
|
---|
81 | KSessionState m_sessionState;
|
---|
82 | QString m_strOSTypeId;
|
---|
83 | ULONG m_cSnaphot;
|
---|
84 |
|
---|
85 | ULONG m_pid;
|
---|
86 | };
|
---|
87 |
|
---|
88 | /* Make the pointer of this class public to the QVariant framework */
|
---|
89 | Q_DECLARE_METATYPE(UIVMItem *);
|
---|
90 |
|
---|
91 | class UIVMItemMimeData: public QMimeData
|
---|
92 | {
|
---|
93 | Q_OBJECT;
|
---|
94 |
|
---|
95 | public:
|
---|
96 |
|
---|
97 | UIVMItemMimeData(UIVMItem *pItem);
|
---|
98 |
|
---|
99 | UIVMItem *item() const;
|
---|
100 | QStringList formats() const;
|
---|
101 |
|
---|
102 | static QString type();
|
---|
103 |
|
---|
104 | private:
|
---|
105 |
|
---|
106 | /* Private member vars */
|
---|
107 | UIVMItem *m_pItem;
|
---|
108 |
|
---|
109 | static QString m_type;
|
---|
110 | };
|
---|
111 |
|
---|
112 | #endif /* __UIVMItem_h__ */
|
---|
113 |
|
---|