VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMListBox.h@ 2764

Last change on this file since 2764 was 2567, checked in by vboxsync, 18 years ago

Main & All Frontends: replaced the IGuestOSType IMachine::OSType property with the wstring IMachine::OSTypeId property (+ converted IGuest and IGuestOSType to VirtualBoxBaseNEXT semantics).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxVMListBox, VBoxVMListBoxItem class declarations
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23#ifndef __VBoxVMListBox_h__
24#define __VBoxVMListBox_h__
25
26#include "COMDefs.h"
27
28#include "VBoxSelectorWnd.h"
29#include "VBoxGlobal.h"
30
31#include <qlistbox.h>
32#include <qfont.h>
33#include <qdatetime.h>
34
35struct QUuid;
36class QColorGroup;
37
38class VBoxVMListBoxTip;
39class VBoxVMListBoxItem;
40
41/**
42 *
43 * The VBoxVMListBox class is a visual representation of the list of
44 * existing VMs in the VBox GUI.
45 *
46 * Every item in the list box is an instance of the VBoxVMListBoxItem
47 * class.
48 */
49class VBoxVMListBox : public QListBox
50{
51 Q_OBJECT
52
53public:
54
55 VBoxVMListBox (QWidget *aParent = 0, const char *aName = NULL,
56 WFlags aFlags = 0);
57
58 virtual ~VBoxVMListBox();
59
60 QFont nameFont() const { return mNameFont; }
61
62 QFont shotFont() const { return mShotFont; }
63
64 QFont stateFont (CEnums::SessionState aS) const
65 {
66 return aS == CEnums::SessionClosed ? font() : mStateBusyFont;
67 }
68
69 int margin() const { return mMargin; }
70
71 void refresh();
72 void refresh (const QUuid &aID);
73
74 VBoxVMListBoxItem *item (const QUuid &aID);
75
76 const QColorGroup &activeColorGroup() const;
77
78protected:
79
80 virtual void focusInEvent (QFocusEvent *aE);
81 virtual void focusOutEvent (QFocusEvent *aE);
82
83private:
84
85 CVirtualBox mVBox;
86 QFont mNameFont;
87 QFont mShotFont;
88 QFont mStateBusyFont;
89 int mMargin;
90
91 VBoxVMListBoxTip *mToolTip;
92 bool mGaveFocusToPopup;
93};
94
95/**
96 *
97 * The VBoxVMListBoxItem class is a visual representation of the virtual
98 * machine in the VBoxVMListBox widget.
99 *
100 * It holds a CMachine instance (passed to the constructor) to
101 * get an access to various VM data.
102 */
103class VBoxVMListBoxItem : public QListBoxItem
104{
105public:
106
107 VBoxVMListBoxItem (VBoxVMListBox *aLB, const CMachine &aM);
108 virtual ~VBoxVMListBoxItem();
109
110 QString text() const { return mName; }
111
112 VBoxVMListBox *vmListBox() const
113 {
114 return static_cast <VBoxVMListBox *> (listBox());
115 }
116
117 CMachine machine() const { return mMachine; }
118 void setMachine (const CMachine &aM);
119
120 void recache();
121
122 QString toolTipText() const;
123
124 int height (const QListBox *) const;
125 int width (const QListBox *) const;
126
127 QUuid id() const { return mId; }
128 bool accessible() const { return mAccessible; }
129 const CVirtualBoxErrorInfo &accessError() const { return mAccessError; }
130 QString name() const { return mName; }
131 CEnums::MachineState state() const { return mState; }
132 CEnums::SessionState sessionState() const { return mSessionState; }
133 ULONG snapshotCount() const { return mSnapshotCount; }
134
135 /// @todo see comments in #switchTo() in VBoxVMListBox.cpp
136#if 0
137 bool canSwitchTo() const { return mWinId != (WId) ~0; }
138#endif
139 bool canSwitchTo() const;
140 bool switchTo();
141
142protected:
143
144 void paint (QPainter *aP);
145
146private:
147
148 CMachine mMachine;
149
150 /* cached machine data (to minimize server requests) */
151
152 QUuid mId;
153 QString mSettingsFile;
154
155 bool mAccessible;
156 CVirtualBoxErrorInfo mAccessError;
157
158 QString mName;
159 QString mSnapshotName;
160 CEnums::MachineState mState;
161 QDateTime mLastStateChange;
162 CEnums::SessionState mSessionState;
163 QString mOSTypeId;
164 ULONG mSnapshotCount;
165
166 ULONG mPid;
167 /// @todo see comments in #switchTo() in VBoxVMListBox.cpp
168#if 0
169 WId mWinId;
170#endif
171};
172
173#endif // __VBoxVMListItem_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