VirtualBox

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

Last change on this file since 24147 was 24147, checked in by vboxsync, 15 years ago

FE/Qt4: VBoxConsoleWND: Device dropdown & popup menus for CD & FD reworked using nested menus.

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