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