VirtualBox

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

Last change on this file since 35740 was 32760, checked in by vboxsync, 14 years ago

FE/Qt4: coding style; renaming; adding extra cpp file

  • 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_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 doRemoveMedium();
88 void doReleaseMedium();
89
90 bool releaseMediumFrom (const VBoxMedium &aMedium, const QString &aMachineId);
91
92 void processCurrentChanged (int index = -1);
93 void processCurrentChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem = 0);
94 void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
95 void showContextMenu (const QPoint &aPos);
96
97 void machineStateChanged(QString strId, KMachineState state);
98
99 void makeRequestForAdjustTable();
100 void performTablesAdjustment();
101
102private:
103
104 QTreeWidget* treeWidget (VBoxDefs::MediumType aType) const;
105 VBoxDefs::MediumType currentTreeWidgetType() const;
106 QTreeWidget* currentTreeWidget() const;
107
108 QTreeWidgetItem* selectedItem (const QTreeWidget *aTree) const;
109 MediaItem* toMediaItem (QTreeWidgetItem *aItem) const;
110
111 void setCurrentItem (QTreeWidget *aTree, QTreeWidgetItem *aItem);
112
113 void addMediumToList (const QString &aLocation, VBoxDefs::MediumType aType);
114
115 MediaItem* createHardDiskItem (QTreeWidget *aTree, const VBoxMedium &aMedium) const;
116
117 void updateTabIcons (MediaItem *aItem, ItemAction aAction);
118
119 MediaItem* searchItem (QTreeWidget *aTree, const QString &aId) const;
120
121 bool checkMediumFor (MediaItem *aItem, Action aAction);
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
129 QString formatPaneText (const QString &aText, bool aCompact = true, const QString &aElipsis = "middle");
130
131 /* Private member vars */
132 /* Window status */
133 bool mDoSelect;
134 static VBoxMediaManagerDlg *mModelessDialog;
135 VBoxProgressBar *mProgressBar;
136
137 /* The global VirtualBox instance */
138 CVirtualBox mVBox;
139
140 /* Type if we are in the select modus */
141 int mType;
142
143 bool mShowDiffs : 1;
144 bool mSetupMode : 1;
145
146 /* Icon definitions */
147 QIcon mHardDiskIcon;
148 QIcon mDVDImageIcon;
149 QIcon mFloppyImageIcon;
150
151 /* Menu & Toolbar */
152 QMenu *mActionsContextMenu;
153 QMenu *mActionsMenu;
154 UIToolBar *mToolBar;
155 QAction *mNewAction;
156 QAction *mAddAction;
157 QAction *mRemoveAction;
158 QAction *mReleaseAction;
159 QAction *mRefreshAction;
160
161 /* Machine */
162 CMachine mSessionMachine;
163 QString mSessionMachineId;
164 bool mHardDisksInaccessible;
165 bool mDVDImagesInaccessible;
166 bool mFloppyImagesInaccessible;
167 QString mHDSelectedId;
168 QString mCDSelectedId;
169 QString mFDSelectedId;
170 QStringList mUsedMediaIds;
171};
172
173#endif /* __VBoxMediaManagerDlg_h__ */
174
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use