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>
|
---|
29 | #include <QPixmap>
|
---|
30 |
|
---|
31 | class VBoxMediaComboBox : public QComboBox
|
---|
32 | {
|
---|
33 | Q_OBJECT
|
---|
34 |
|
---|
35 | public:
|
---|
36 |
|
---|
37 | typedef QMap <QString, QString> BaseToDiffMap;
|
---|
38 |
|
---|
39 | VBoxMediaComboBox (QWidget *aParent);
|
---|
40 |
|
---|
41 | void refresh();
|
---|
42 | void repopulate();
|
---|
43 |
|
---|
44 | QString id (int = -1) const;
|
---|
45 | QString location (int = -1) const;
|
---|
46 |
|
---|
47 | void setCurrentItem (const QString &aItemId);
|
---|
48 | void setType (VBoxDefs::MediumType aMediumType);
|
---|
49 | void setMachineId (const QString &aMachineId = QString::null);
|
---|
50 | void setNullItemPresent (bool aNullItemPresent);
|
---|
51 |
|
---|
52 | void setShowDiffs (bool aShowDiffs);
|
---|
53 | bool showDiffs() const { return mShowDiffs; }
|
---|
54 |
|
---|
55 | protected slots:
|
---|
56 |
|
---|
57 | void mediumEnumStarted();
|
---|
58 | void mediumEnumerated (const VBoxMedium &);
|
---|
59 |
|
---|
60 | void mediumAdded (const VBoxMedium &);
|
---|
61 | void mediumUpdated (const VBoxMedium &);
|
---|
62 | void mediumRemoved (VBoxDefs::MediumType, const QString &);
|
---|
63 |
|
---|
64 | void processActivated (int aIndex);
|
---|
65 | // void processIndexChanged (int aIndex);
|
---|
66 |
|
---|
67 | void processOnItem (const QModelIndex &aIndex);
|
---|
68 |
|
---|
69 | protected:
|
---|
70 |
|
---|
71 | void updateToolTip (int);
|
---|
72 |
|
---|
73 | void appendItem (const VBoxMedium &);
|
---|
74 | void replaceItem (int, const VBoxMedium &);
|
---|
75 |
|
---|
76 | bool findMediaIndex (const QString &aId, int &aIndex);
|
---|
77 |
|
---|
78 | VBoxDefs::MediumType mType;
|
---|
79 |
|
---|
80 | /** Obtruncated VBoxMedium structure. */
|
---|
81 | struct Medium
|
---|
82 | {
|
---|
83 | Medium() {}
|
---|
84 | Medium (const QString &aId, const QString &aLocation,
|
---|
85 | const QString aToolTip)
|
---|
86 | : id (aId), location (aLocation), toolTip (aToolTip) {}
|
---|
87 |
|
---|
88 | QString id;
|
---|
89 | QString location;
|
---|
90 | QString toolTip;
|
---|
91 | };
|
---|
92 |
|
---|
93 | typedef QVector <Medium> Media;
|
---|
94 | Media mMedia;
|
---|
95 |
|
---|
96 | QString mLastId;
|
---|
97 |
|
---|
98 | bool mShowDiffs : 1;
|
---|
99 | bool mShowNullItem : 1;
|
---|
100 |
|
---|
101 | QString mMachineId;
|
---|
102 | };
|
---|
103 |
|
---|
104 | #endif /* __VBoxMediaComboBox_h__ */
|
---|