3
* VBox frontends: Qt4 GUI ("VirtualBox"):
4
* VBoxMediaManagerDlg class declaration
8
* Copyright (C) 2006-2009 Oracle Corporation
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.
19
#ifndef __VBoxMediaManagerDlg_h__
20
#define __VBoxMediaManagerDlg_h__
23
#include "VBoxMediaManagerDlg.gen.h"
25
#include "QIMainDialog.h"
26
#include "QIWithRetranslateUI.h"
28
#include "VBoxMediaComboBox.h"
32
class VBoxProgressBar;
35
class VBoxMediaManagerDlg : public QIWithRetranslateUI2<QIMainDialog>,
36
public Ui::VBoxMediaManagerDlg
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_Modify, Action_Remove, Action_Release };
46
VBoxMediaManagerDlg (QWidget *aParent = NULL,
47
Qt::WindowFlags aFlags = Qt::Dialog);
48
~VBoxMediaManagerDlg();
50
void setup (VBoxDefs::MediumType aType, bool aDoSelect,
52
const CMachine &aSessionMachine = CMachine(),
53
const QString &aSelectId = QString::null,
54
bool aShowDiffs = true,
55
const QStringList &aUsedMediaIds = QStringList());
57
static void showModeless (QWidget *aParent = NULL, bool aRefresh = true);
59
QString selectedId() const;
60
QString selectedLocation() const;
62
bool showDiffs() const { return mShowDiffs; };
63
bool inAttachMode() const { return !mSessionMachine.isNull(); };
72
virtual void closeEvent (QCloseEvent *aEvent);
73
virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
77
void mediumAdded (const VBoxMedium &aMedium);
78
void mediumUpdated (const VBoxMedium &aMedium);
79
void mediumRemoved (VBoxDefs::MediumType aType, const QString &aId);
81
void mediumEnumStarted();
82
void mediumEnumerated (const VBoxMedium &aMedium);
83
void mediumEnumFinished (const VBoxMediaList &aList);
88
void doModifyMedium();
89
void doRemoveMedium();
90
void doReleaseMedium();
92
bool releaseMediumFrom (const VBoxMedium &aMedium, const QString &aMachineId);
94
void processCurrentChanged (int index = -1);
95
void processCurrentChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem = 0);
96
void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
97
void showContextMenu (const QPoint &aPos);
99
void machineStateChanged(QString strId, KMachineState state);
101
void makeRequestForAdjustTable();
102
void performTablesAdjustment();
106
QTreeWidget* treeWidget (VBoxDefs::MediumType aType) const;
107
VBoxDefs::MediumType currentTreeWidgetType() const;
108
QTreeWidget* currentTreeWidget() const;
110
QTreeWidgetItem* selectedItem (const QTreeWidget *aTree) const;
111
MediaItem* toMediaItem (QTreeWidgetItem *aItem) const;
113
void setCurrentItem (QTreeWidget *aTree, QTreeWidgetItem *aItem);
115
void addMediumToList (const QString &aLocation, VBoxDefs::MediumType aType);
117
MediaItem* createHardDiskItem (QTreeWidget *aTree, const VBoxMedium &aMedium) const;
119
void updateTabIcons (MediaItem *aItem, ItemAction aAction);
121
MediaItem* searchItem (QTreeWidget *aTree, const QString &aId) const;
123
bool checkMediumFor (MediaItem *aItem, Action aAction);
125
bool checkDndUrls (const QList<QUrl> &aUrls) const;
126
void addDndUrls (const QList<QUrl> &aUrls);
128
void clearInfoPanes();
129
void prepareToRefresh (int aTotal = 0);
131
QString formatPaneText (const QString &aText, bool aCompact = true, const QString &aElipsis = "middle");
133
/* Private member vars */
136
static VBoxMediaManagerDlg *mModelessDialog;
137
VBoxProgressBar *mProgressBar;
139
/* The global VirtualBox instance */
142
/* Type if we are in the select modus */
148
/* Icon definitions */
151
QIcon mFloppyImageIcon;
154
QMenu *mActionsContextMenu;
159
QAction *mCopyAction;
160
QAction *mModifyAction;
161
QAction *mRemoveAction;
162
QAction *mReleaseAction;
163
QAction *mRefreshAction;
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;
177
#endif /* __VBoxMediaManagerDlg_h__ */