UIMediumManager.h revision cf7a2a65e777b164523f5a5a52a1ac64e4322760
/** @file
* VBox Qt GUI - UIMediumManager class declaration.
*/
/*
* Copyright (C) 2006-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___UIMediumManager_h___
#define ___UIMediumManager_h___
/* GUI includes: */
#include "UIMediumManager.gen.h"
#include "QIWithRetranslateUI.h"
#include "QIMainDialog.h"
#include "UIMediumDefs.h"
/* Forward declarations: */
/** Functor interface allowing to check if passed UIMediumItem is suitable. */
{
/** Determines whether passed @a pItem is suitable. */
};
/** Medium Manager dialog. */
{
/** Tab index enumerator. */
/** Item action enumerator. */
/** Constructor for UIMediumManager dialog. */
/** Destructor for UIMediumManager dialog. */
~UIMediumManager();
/** Returns UIMediumManager singleton instance. */
static UIMediumManager* instance();
/** Shows UIMediumManager singleton instance, creates new if necessary. */
/** Handles UIMediumManager::m_pActionRefresh action triggering. */
void sltRefreshAll();
/** Handles VBoxGlobal::sigMediumCreated signal. */
/** Handles VBoxGlobal::sigMediumDeleted signal. */
/** Handles VBoxGlobal::sigMediumEnumerationStarted signal. */
void sltHandleMediumEnumerationStart();
/** Handles VBoxGlobal::sigMediumEnumerated signal. */
/** Handles VBoxGlobal::sigMediumEnumerationFinished signal. */
void sltHandleMediumEnumerationFinish();
/** Handles UIMediumManager::m_pActionCopy action triggering. */
void sltCopyMedium();
/** Handles UIMediumManager::m_pActionModify action triggering. */
void sltModifyMedium();
/** Handles UIMediumManager::m_pActionRemove action triggering. */
void sltRemoveMedium();
/** Handles UIMediumManager::m_pActionRelease action triggering. */
void sltReleaseMedium();
/** Handles tab change case. */
void sltHandleCurrentTabChanged();
/** Handles item change case. */
void sltHandleCurrentItemChanged();
/** Handles item double-click case. */
void sltHandleDoubleClick();
/** Handles item context-menu-call case. */
/** Adjusts tree-widgets according content. */
void sltPerformTablesAdjustment();
/** General prepare wrapper. */
void prepare();
/** Prepare dialog. */
void prepareThis();
/** Prepare actions. */
void prepareActions();
/** Prepare menu-bar. */
void prepareMenuBar();
/** Prepare tool-bar. */
void prepareToolBar();
/** Prepare context-menu. */
void prepareContextMenu();
/** Prepare tab-widget. */
void prepareTabWidget();
/** Prepare tree-widgets. */
void prepareTreeWidgets();
/** Prepare hard-drive tree-widget. */
void prepareTreeWidgetHD();
/** Prepare optical-disk tree-widget. */
void prepareTreeWidgetCD();
/** Prepare floppy-disk tree-widget. */
void prepareTreeWidgetFD();
/** Prepare information-panes. */
void prepareInformationPanes();
/** Prepare button-box. */
void prepareButtonBox();
/** Prepare progress-bar. */
void prepareProgressBar();
#ifdef Q_WS_MAC
/** Mac OS X: Prepare <i>Window</i> menu. */
void prepareMacWindowMenu();
#endif /* Q_WS_MAC */
/** Repopulates tree-widgets content. */
void repopulateTreeWidgets();
/** Updates details according latest changes in current item of passed @a type. */
/** Updates details according latest changes in current item of chosen type. */
void refetchCurrentChosenMediumItem();
/** Updates details according latest changes in all current items. */
void refetchCurrentMediumItems();
/** Update actions according currently chosen item. */
void updateActions();
/** Update tab icons according last @a action happened with @a pItem. */
/** Update information pane of passed medium @a type. */
/** Update information pane for hard-drive tab. */
void updateInformationPanesHD();
/** Update information pane for optical-disk tab. */
void updateInformationPanesCD();
/** Update information pane for floppy-disk tab. */
void updateInformationPanesFD();
#ifdef Q_WS_MAC
/** Mac OS X: Cleanup <i>Window</i> menu. */
void cleanupMacWindowMenu();
#endif /* Q_WS_MAC */
/** General cleanup wrapper. */
void cleanup();
/** Translates dialog content. */
void retranslateUi();
/** Creates UIMediumItem for corresponding @a medium. */
/** Updates UIMediumItem for corresponding @a medium. */
/** Deletes UIMediumItem for corresponding @a strMediumID. */
/** Determines medium type for passed @a pTreeWidget. */
/** Returns current medium type. */
UIMediumType currentMediumType() const;
/** Returns tree-widget for passed medium @a type. */
/** Returns current tree-widget. */
QTreeWidget* currentTreeWidget() const;
/** Returns item for passed medium @a type. */
/** Returns current item. */
UIMediumItem* currentMediumItem() const;
/** Defines current item for passed @a pTreeWidget as @a pItem. */
/** Performs search for the @a pTree child which corresponds to the @a condition but not @a pException. */
static UIMediumItem* searchItem(QTreeWidget *pTree, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
/** Performs search for the @a pParentItem child which corresponds to the @a condition but not @a pException. */
static UIMediumItem* searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
/** Creates UIMediumItemHD for corresponding @a medium. */
/** Checks if @a action can be used for @a pItem. */
/** Casts passed QTreeWidgetItem @a pItem to UIMediumItem if possible. */
/** Format information-pane content. */
static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
/** Determines if passed @a medium attached to hidden machines only. */
/** UIMediumManager singleton instance. */
static UIMediumManager *m_spInstance;
/** @name General variables.
* @{ */
/** Widget to center UIMediumManager according. */
/** Holds whether UIMediumManager should be refreshed on invoke. */
bool m_fRefresh;
/** Holds whether UIMediumManager should preserve current item change. */
/** @} */
/** @name Tab-widget variables.
* @{ */
/** Holds whether hard-drive tab-widget have inaccessible item. */
bool m_fInaccessibleHD;
/** Holds whether optical-disk tab-widget have inaccessible item. */
bool m_fInaccessibleCD;
/** Holds whether floppy-disk tab-widget have inaccessible item. */
bool m_fInaccessibleFD;
/** Holds cached hard-drive tab-widget icon. */
/** Holds cached optical-disk tab-widget icon. */
/** Holds cached floppy-disk tab-widget icon. */
/** Holds current hard-drive tree-view item ID. */
/** Holds current optical-disk tree-view item ID. */
/** Holds current floppy-disk tree-view item ID. */
/** @} */
/** @name Tool-bar and menu variables.
* @{ */
/** Tool-bar widget. */
/** Context menu object. */
/** Menu-bar menu object. */
/** Action to <i>copy</i> current item. */
/** Action to <i>modify</i> current item. */
/** Action to <i>remove</i> current item. */
/** Action to <i>release</i> current item. */
/** Action to <i>refresh</i> current item. */
/** @} */
/** @name Progress-bar variables.
* @{ */
/** Progress-bar widget. */
/** @} */
};
#endif /* !___UIMediumManager_h___ */