VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.h@ 37406

Last change on this file since 37406 was 37406, checked in by vboxsync, 13 years ago

FE/Qt: 4908: Create New Virtual Disk wizard: support for copying virtual disks implemented; copying wizard Integrated into Virtual Medium Manager.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 5.2 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt4 GUI ("VirtualBox"):
4 * VBoxMediaManagerDlg class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2009 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 __VBoxMediaManagerDlg_h__
20#define __VBoxMediaManagerDlg_h__
21
22/* Local includes */
23#include "VBoxMediaManagerDlg.gen.h"
24#include "COMDefs.h"
25#include "QIMainDialog.h"
26#include "QIWithRetranslateUI.h"
27#include "VBoxDefs.h"
28#include "VBoxMediaComboBox.h"
29
30/* Local forwards */
31class MediaItem;
32class VBoxProgressBar;
33class UIToolBar;
34
35class VBoxMediaManagerDlg : public QIWithRetranslateUI2<QIMainDialog>,
36 public Ui::VBoxMediaManagerDlg
37{
38 Q_OBJECT;
39
40 enum TabIndex { HDTab = 0, CDTab, FDTab };
41 enum ItemAction { ItemAction_Added, ItemAction_Updated, ItemAction_Removed };
42 enum Action { Action_Select, Action_Edit, Action_Copy, Action_Remove, Action_Release };
43
44public:
45
46 VBoxMediaManagerDlg (QWidget *aParent = NULL,
47 Qt::WindowFlags aFlags = Qt::Dialog);
48 ~VBoxMediaManagerDlg();
49
50 void setup (VBoxDefs::MediumType aType, bool aDoSelect,
51 bool aRefresh = true,
52 const CMachine &aSessionMachine = CMachine(),
53 const QString &aSelectId = QString::null,
54 bool aShowDiffs = true,
55 const QStringList &aUsedMediaIds = QStringList());
56
57 static void showModeless (QWidget *aParent = NULL, bool aRefresh = true);
58
59 QString selectedId() const;
60 QString selectedLocation() const;
61
62 bool showDiffs() const { return mShowDiffs; };
63 bool inAttachMode() const { return !mSessionMachine.isNull(); };
64
65public slots:
66
67 void refreshAll();
68
69protected:
70
71 void retranslateUi();
72 virtual void closeEvent (QCloseEvent *aEvent);
73 virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
74
75private slots:
76
77 void mediumAdded (const VBoxMedium &aMedium);
78 void mediumUpdated (const VBoxMedium &aMedium);
79 void mediumRemoved (VBoxDefs::MediumType aType, const QString &aId);
80
81 void mediumEnumStarted();
82 void mediumEnumerated (const VBoxMedium &aMedium);
83 void mediumEnumFinished (const VBoxMediaList &aList);
84
85 void doNewMedium();
86 void doAddMedium();
87 void doCopyMedium();
88 void doRemoveMedium();
89 void doReleaseMedium();
90
91 bool releaseMediumFrom (const VBoxMedium &aMedium, const QString &aMachineId);
92
93 void processCurrentChanged (int index = -1);
94 void processCurrentChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem = 0);
95 void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
96 void showContextMenu (const QPoint &aPos);
97
98 void machineStateChanged(QString strId, KMachineState state);
99
100 void makeRequestForAdjustTable();
101 void performTablesAdjustment();
102
103private:
104
105 QTreeWidget* treeWidget (VBoxDefs::MediumType aType) const;
106 VBoxDefs::MediumType currentTreeWidgetType() const;
107 QTreeWidget* currentTreeWidget() const;
108
109 QTreeWidgetItem* selectedItem (const QTreeWidget *aTree) const;
110 MediaItem* toMediaItem (QTreeWidgetItem *aItem) const;
111
112 void setCurrentItem (QTreeWidget *aTree, QTreeWidgetItem *aItem);
113
114 void addMediumToList (const QString &aLocation, VBoxDefs::MediumType aType);
115
116 MediaItem* createHardDiskItem (QTreeWidget *aTree, const VBoxMedium &aMedium) const;
117
118 void updateTabIcons (MediaItem *aItem, ItemAction aAction);
119
120 MediaItem* searchItem (QTreeWidget *aTree, const QString &aId) const;
121
122 bool checkMediumFor (MediaItem *aItem, Action aAction);
123
124 bool checkDndUrls (const QList<QUrl> &aUrls) const;
125 void addDndUrls (const QList<QUrl> &aUrls);
126
127 void clearInfoPanes();
128 void prepareToRefresh (int aTotal = 0);
129
130 QString formatPaneText (const QString &aText, bool aCompact = true, const QString &aElipsis = "middle");
131
132 /* Private member vars */
133 /* Window status */
134 bool mDoSelect;
135 static VBoxMediaManagerDlg *mModelessDialog;
136 VBoxProgressBar *mProgressBar;
137
138 /* The global VirtualBox instance */
139 CVirtualBox mVBox;
140
141 /* Type if we are in the select modus */
142 int mType;
143
144 bool mShowDiffs : 1;
145 bool mSetupMode : 1;
146
147 /* Icon definitions */
148 QIcon mHardDiskIcon;
149 QIcon mDVDImageIcon;
150 QIcon mFloppyImageIcon;
151
152 /* Menu & Toolbar */
153 QMenu *mActionsContextMenu;
154 QMenu *mActionsMenu;
155 UIToolBar *mToolBar;
156 QAction *mNewAction;
157 QAction *mAddAction;
158 QAction *mCopyAction;
159 QAction *mRemoveAction;
160 QAction *mReleaseAction;
161 QAction *mRefreshAction;
162
163 /* Machine */
164 CMachine mSessionMachine;
165 QString mSessionMachineId;
166 bool mHardDisksInaccessible;
167 bool mDVDImagesInaccessible;
168 bool mFloppyImagesInaccessible;
169 QString mHDSelectedId;
170 QString mCDSelectedId;
171 QString mFDSelectedId;
172 QStringList mUsedMediaIds;
173};
174
175#endif /* __VBoxMediaManagerDlg_h__ */
176
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use