VirtualBox

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

Last change on this file since 9600 was 9449, checked in by vboxsync, 17 years ago

FE/Qt4: typo & some comments

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