1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxMediaComboBox class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxMediaComboBox_h__
|
---|
24 | #define __VBoxMediaComboBox_h__
|
---|
25 |
|
---|
26 | #include "VBoxGlobal.h"
|
---|
27 |
|
---|
28 | #include <qcombobox.h>
|
---|
29 | #include <qvaluelist.h>
|
---|
30 |
|
---|
31 | class QListBoxItem;
|
---|
32 |
|
---|
33 | class VBoxMediaComboBox : public QComboBox
|
---|
34 | {
|
---|
35 | Q_OBJECT
|
---|
36 |
|
---|
37 | public:
|
---|
38 |
|
---|
39 | typedef QMap <QUuid, QUuid> BaseToDiffMap;
|
---|
40 |
|
---|
41 | VBoxMediaComboBox (QWidget *aParent, const char *aName,
|
---|
42 | VBoxDefs::MediaType aType, QUuid aMachineId = QUuid());
|
---|
43 | ~VBoxMediaComboBox() {}
|
---|
44 |
|
---|
45 | void refresh();
|
---|
46 | void repopulate();
|
---|
47 |
|
---|
48 | QUuid id (int = -1);
|
---|
49 | QString location (int = -1);
|
---|
50 |
|
---|
51 | void setCurrentItem (const QUuid &);
|
---|
52 | void setType (VBoxDefs::MediaType);
|
---|
53 |
|
---|
54 | void setShowDiffs (bool aShowDiffs);
|
---|
55 | bool showDiffs() const { return mShowDiffs; }
|
---|
56 |
|
---|
57 | protected slots:
|
---|
58 |
|
---|
59 | void mediaEnumStarted();
|
---|
60 | void mediumEnumerated (const VBoxMedium &, int);
|
---|
61 | void mediumAdded (const VBoxMedium &);
|
---|
62 | void mediumUpdated (const VBoxMedium &);
|
---|
63 | void mediumRemoved (VBoxDefs::MediaType, const QUuid &);
|
---|
64 | void processOnItem (QListBoxItem *);
|
---|
65 | void processActivated (int);
|
---|
66 |
|
---|
67 | protected:
|
---|
68 |
|
---|
69 | void addNoMediaItem();
|
---|
70 |
|
---|
71 | void updateToolTip (int);
|
---|
72 |
|
---|
73 | void appendItem (const VBoxMedium &);
|
---|
74 | void replaceItem (int, const VBoxMedium &);
|
---|
75 |
|
---|
76 | bool findMediaIndex (const QUuid &aId, size_t &aIndex);
|
---|
77 |
|
---|
78 | VBoxDefs::MediaType mType;
|
---|
79 |
|
---|
80 | /** Obtruncated VBoxMedium structure. */
|
---|
81 | struct Medium
|
---|
82 | {
|
---|
83 | Medium() {}
|
---|
84 | Medium (const QUuid &aId, const QString &aLocation,
|
---|
85 | const QString aToolTip)
|
---|
86 | : id (aId), location (aLocation), toolTip (aToolTip) {}
|
---|
87 |
|
---|
88 | QUuid id;
|
---|
89 | QString location;
|
---|
90 | QString toolTip;
|
---|
91 | };
|
---|
92 |
|
---|
93 | typedef QValueVector <Medium> Media;
|
---|
94 | Media mMedia;
|
---|
95 |
|
---|
96 | QUuid mLastId;
|
---|
97 |
|
---|
98 | bool mShowDiffs : 1;
|
---|
99 |
|
---|
100 | QUuid mMachineId;
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif /* __VBoxMediaComboBox_h__ */
|
---|