VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDiskImageManagerDlg.h@ 13224

Last change on this file since 13224 was 11666, checked in by vboxsync, 16 years ago

FE/Qt4: Fix crash if vdm is started from the menu. Make the vdm initial centered to the parent.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 6.1 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt4 GUI ("VirtualBox"):
4 * VBoxDiskImageManagerDlg class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2008 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 __VBoxDiskImageManagerDlg_h__
24#define __VBoxDiskImageManagerDlg_h__
25
26#include "VBoxDiskImageManagerDlg.gen.h"
27#include "QIMainDialog.h"
28#include "QIWithRetranslateUI.h"
29#include "COMDefs.h"
30#include "VBoxDefs.h"
31#include "VBoxMediaComboBox.h"
32
33class DiskImageItem;
34class VBoxToolBar;
35class VBoxProgressBar;
36
37class VBoxDiskImageManagerDlg : public QIWithRetranslateUI2<QIMainDialog>,
38 public Ui::VBoxDiskImageManagerDlg
39{
40 Q_OBJECT;
41
42 enum TabIndex { HDTab = 0, CDTab, FDTab };
43
44public:
45
46 VBoxDiskImageManagerDlg (QWidget *aParent = 0,
47 Qt::WindowFlags aFlags = Qt::Dialog);
48
49 void setup (int aType, bool aDoSelect, const QUuid &aTargetVMId = QUuid(),
50 bool aRefresh = true, CMachine aMachine = CMachine(),
51 const QUuid &aHdId = QUuid(),
52 const QUuid &aCdId = QUuid(),
53 const QUuid &aFdId = QUuid());
54
55 static void showModeless (QWidget *aParent = NULL, bool aRefresh = true);
56
57 QUuid selectedUuid() const;
58 QString selectedPath() const;
59
60 static QString composeHdToolTip (CHardDisk &aHd, VBoxMedia::Status aStatus,
61 DiskImageItem *aItem = 0);
62 static QString composeCdToolTip (CDVDImage &aCd, VBoxMedia::Status aStatus,
63 DiskImageItem *aItem = 0);
64 static QString composeFdToolTip (CFloppyImage &aFd, VBoxMedia::Status aStatus,
65 DiskImageItem *aItem = 0);
66
67public slots:
68
69 void refreshAll();
70
71protected:
72
73 void retranslateUi();
74 virtual void closeEvent (QCloseEvent *aEvent);
75 virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
76
77private slots:
78
79 void mediaAdded (const VBoxMedia &aMedia);
80 void mediaUpdated (const VBoxMedia &aMedia);
81 void mediaRemoved (VBoxDefs::DiskType aType, const QUuid &aId);
82
83 void mediaEnumStarted();
84 void mediaEnumerated (const VBoxMedia &aMedia, int aIndex);
85 void mediaEnumFinished (const VBoxMediaList &aList);
86
87 void newImage();
88 void addImage();
89 void removeImage();
90 void releaseImage();
91
92 void releaseDisk (const QUuid &aMachineId, const QUuid &aItemId,
93 VBoxDefs::DiskType aDiskType);
94
95 void processCurrentChanged (int index = -1);
96 void processCurrentChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem = 0);
97 void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
98 void showContextMenu (const QPoint &aPos);
99
100private:
101
102 QTreeWidget* treeWidget (VBoxDefs::DiskType aType) const;
103 VBoxDefs::DiskType currentTreeWidgetType() const;
104 QTreeWidget* currentTreeWidget() const;
105
106 QTreeWidgetItem* selectedItem (const QTreeWidget *aTree) const;
107 DiskImageItem* toDiskImageItem (QTreeWidgetItem *aItem) const;
108
109 void setCurrentItem (QTreeWidget *aTree, QTreeWidgetItem *aItem);
110
111 void addImageToList (const QString &aSource, VBoxDefs::DiskType aDiskType);
112 DiskImageItem* createImageNode (QTreeWidget *aTree, DiskImageItem *aRoot,
113 const VBoxMedia &aMedia) const;
114
115 DiskImageItem* createHdItem (QTreeWidget *aTree, const VBoxMedia &aMedia) const;
116 DiskImageItem* createCdItem (QTreeWidget *aTree, const VBoxMedia &aMedia) const;
117 DiskImageItem* createFdItem (QTreeWidget *aTree, const VBoxMedia &aMedia) const;
118
119 void updateHdItem (DiskImageItem *aItem, const VBoxMedia &aMedia) const;
120 void updateCdItem (DiskImageItem *aItem, const VBoxMedia &aMedia) const;
121 void updateFdItem (DiskImageItem *aItem, const VBoxMedia &aMedia) const;
122
123 DiskImageItem* searchItem (QTreeWidget *aTree, const QUuid &aId) const;
124 DiskImageItem* searchItem (QTreeWidget *aTree, VBoxMedia::Status aStatus) const;
125
126 bool checkImage (DiskImageItem *aItem);
127
128 bool checkDndUrls (const QList<QUrl> &aUrls) const;
129 void addDndUrls (const QList<QUrl> &aUrls);
130
131 void clearInfoPanes();
132 void prepareToRefresh (int aTotal = 0);
133
134 void makeWarningMark (DiskImageItem *aItem, VBoxMedia::Status aStatus,
135 VBoxDefs::DiskType aType) const;
136
137 static QString DVDImageUsage (const QUuid &aId, QString &aSnapshotUsage);
138 static QString FloppyImageUsage (const QUuid &aId, QString &aSnapshotUsage);
139 static void DVDImageSnapshotUsage (const QUuid &aId, const CSnapshot &aSnapshot, QString &aUsage);
140 static void FloppyImageSnapshotUsage (const QUuid &aId, const CSnapshot &aSnapshot, QString &aUsage);
141
142 /* Private member vars */
143 /* Window status */
144 bool mDoSelect;
145 static VBoxDiskImageManagerDlg *mModelessDialog;
146 VBoxProgressBar *mProgressBar;
147
148 /* The global VirtualBox instance */
149 CVirtualBox mVBox;
150
151 /* Type if we are in the select modus */
152 int mType;
153
154 /* Icon definitions */
155 QIcon mIconInaccessible;
156 QIcon mIconErroneous;
157 QIcon mIconHD;
158 QIcon mIconCD;
159 QIcon mIconFD;
160
161 /* Menu & Toolbar */
162 QMenu *mActionsContextMenu;
163 QMenu *mActionsMenu;
164 VBoxToolBar *mActionsToolBar;
165 QAction *mNewAction;
166 QAction *mAddAction;
167 QAction *mEditAction;
168 QAction *mRemoveAction;
169 QAction *mReleaseAction;
170 QAction *mRefreshAction;
171
172 /* Machine */
173 CMachine mMachine;
174 QUuid mTargetVMId;
175 QUuid mHdSelectedId;
176 QUuid mCdSelectedId;
177 QUuid mFdSelectedId;
178};
179
180#endif /* __VBoxDiskImageManagerDlg_h__ */
181
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