VirtualBox

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

Last change on this file since 1804 was 1718, checked in by vboxsync, 18 years ago

FE/Qt: NLS: Fixed: header files were not processed by the language update tool; Added the translation template.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 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 bool canSwitchTo() const { return mWinId != (WId) ~0; }
136 bool switchTo();
137
138protected:
139
140 void paint (QPainter *aP);
141
142private:
143
144 CMachine mMachine;
145
146 /* cached machine data (to minimize server requests) */
147
148 QUuid mId;
149 QString mSettingsFile;
150
151 bool mAccessible;
152 CVirtualBoxErrorInfo mAccessError;
153
154 QString mName;
155 QString mSnapshotName;
156 CEnums::MachineState mState;
157 QDateTime mLastStateChange;
158 CEnums::SessionState mSessionState;
159 QString mOSType;
160 ULONG mSnapshotCount;
161
162 ULONG mPid;
163 WId mWinId;
164};
165
166#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