VirtualBox

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

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

API: big medium handling change and lots of assorted other cleanups and fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 5.3 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt4 GUI ("VirtualBox"):
4 * VBoxMediaManagerDlg 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 __VBoxMediaManagerDlg_h__
24#define __VBoxMediaManagerDlg_h__
25
26#include "VBoxMediaManagerDlg.gen.h"
27#include "QIMainDialog.h"
28#include "QIWithRetranslateUI.h"
29#include "COMDefs.h"
30#include "VBoxDefs.h"
31#include "VBoxMediaComboBox.h"
32
33class MediaItem;
34class VBoxToolBar;
35class VBoxProgressBar;
36
37class VBoxMediaManagerDlg : public QIWithRetranslateUI2<QIMainDialog>,
38 public Ui::VBoxMediaManagerDlg
39{
40 Q_OBJECT;
41
42 enum TabIndex { HDTab = 0, CDTab, FDTab };
43 enum ItemAction { ItemAction_Added, ItemAction_Updated, ItemAction_Removed };
44 enum Action { Action_Select, Action_Edit, Action_Remove, Action_Release };
45
46public:
47
48 VBoxMediaManagerDlg (QWidget *aParent = NULL,
49 Qt::WindowFlags aFlags = Qt::Dialog);
50 ~VBoxMediaManagerDlg();
51
52 void setup (VBoxDefs::MediumType aType, bool aDoSelect,
53 bool aRefresh = true,
54 const CMachine &aSessionMachine = CMachine(),
55 const QString &aSelectId = QString::null,
56 bool aShowDiffs = true);
57
58 static void showModeless (QWidget *aParent = NULL, bool aRefresh = true);
59
60 QString selectedId() const;
61 QString selectedLocation() const;
62
63 bool showDiffs() const { return mShowDiffs; };
64 bool inAttachMode() const { return !mSessionMachine.isNull(); };
65
66public slots:
67
68 void refreshAll();
69
70protected:
71
72 void retranslateUi();
73 virtual void closeEvent (QCloseEvent *aEvent);
74 virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
75
76private slots:
77
78 void mediumAdded (const VBoxMedium &aMedium);
79 void mediumUpdated (const VBoxMedium &aMedium);
80 void mediumRemoved (VBoxDefs::MediumType aType, const QString &aId);
81
82 void mediumEnumStarted();
83 void mediumEnumerated (const VBoxMedium &aMedium);
84 void mediumEnumFinished (const VBoxMediaList &aList);
85
86 void doNewMedium();
87 void doAddMedium();
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 (const VBoxMachineStateChangeEvent &aEvent);
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 VBoxToolBar *mActionsToolBar;
156 QAction *mNewAction;
157 QAction *mAddAction;
158 QAction *mEditAction;
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 mDVDSelectedId;
171 QString mFloppySelectedId;
172};
173
174#endif /* __VBoxMediaManagerDlg_h__ */
175
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