VirtualBox

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

Last change on this file since 10796 was 9867, checked in by vboxsync, 17 years ago

Fe/Qt4: Make the context menu trigger for QITreeWidget more correct.

  • 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 showContextMenu (const QPoint &aPos);
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 /* The global VirtualBox instance */
144 CVirtualBox mVBox;
145
146 /* Type if we are in the select modus */
147 int mType;
148
149 /* Icon definitions */
150 QIcon mIconInaccessible;
151 QIcon mIconErroneous;
152 QIcon mIconHD;
153 QIcon mIconCD;
154 QIcon mIconFD;
155
156 /* Menu & Toolbar */
157 QMenu *mActionsContextMenu;
158 QMenu *mActionsMenu;
159 VBoxToolBar *mActionsToolBar;
160 QAction *mNewAction;
161 QAction *mAddAction;
162 QAction *mEditAction;
163 QAction *mRemoveAction;
164 QAction *mReleaseAction;
165 QAction *mRefreshAction;
166
167 /* The grid entries in the various information panels */
168 InfoPaneLabel *mHdsPane1;
169 InfoPaneLabel *mHdsPane2;
170 InfoPaneLabel *mHdsPane3;
171 InfoPaneLabel *mHdsPane4;
172 InfoPaneLabel *mHdsPane5;
173 InfoPaneLabel *mHdsPane6;
174 InfoPaneLabel *mHdsPane7;
175 InfoPaneLabel *mCdsPane1;
176 InfoPaneLabel *mCdsPane2;
177 InfoPaneLabel *mFdsPane1;
178 InfoPaneLabel *mFdsPane2;
179
180 /* Machine */
181 CMachine mMachine;
182 QUuid mTargetVMId;
183 QUuid mHdSelectedId;
184 QUuid mCdSelectedId;
185 QUuid mFdSelectedId;
186};
187
188#endif /* __VBoxDiskImageManagerDlg_h__ */
189
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