UIMediumManager.h revision daa8487f5bc0d5c44dc3be2cbe3d34cc211a845f
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * VBox Qt GUI - UIMediumManager class declaration.
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * Copyright (C) 2006-2014 Oracle Corporation
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * available from http://www.virtualbox.org. This file is free software;
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * you can redistribute it and/or modify it under the terms of the GNU
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * General Public License (GPL) as published by the Free Software
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync/* GUI includes: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync/* Forward declarations: */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync/** Functor interface allowing to check if passed UIMediumItem is suitable. */
65ba0abe3ecfd47b318d49a3c37a9b48d1f6904evboxsync /** Determines whether passed @a pItem is suitable. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync virtual bool isItSuitable(UIMediumItem *pItem) const = 0;
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync/** Medium Manager dialog. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsyncclass UIMediumManager : public QIWithRetranslateUI2<QIMainDialog>, public Ui::UIMediumManager
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Tab index enumerator. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync enum TabIndex { TabIndex_HD = 0, TabIndex_CD, TabIndex_FD };
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Item action enumerator. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync enum Action { Action_Add, Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Constructor for UIMediumManager dialog. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync UIMediumManager(QWidget *pCenterWidget, bool fRefresh = true);
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Destructor for UIMediumManager dialog. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Returns UIMediumManager singleton instance. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Shows UIMediumManager singleton instance, creates new if necessary. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync static void showModeless(QWidget *pCenterWidget, bool fRefresh = true);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles VBoxGlobal::sigMediumCreated signal. */
b4e89d495c2988c10068923397d31fd27112b9ebvboxsync void sltHandleMediumCreated(const QString &strMediumID);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles VBoxGlobal::sigMediumDeleted signal. */
b4e89d495c2988c10068923397d31fd27112b9ebvboxsync void sltHandleMediumDeleted(const QString &strMediumID);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles VBoxGlobal::sigMediumEnumerationStarted signal. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles VBoxGlobal::sigMediumEnumerated signal. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync void sltHandleMediumEnumerated(const QString &strMediumID);
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Handles VBoxGlobal::sigMediumEnumerationFinished signal. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles UIMediumManager::m_pActionCopy action triggering. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles UIMediumManager::m_pActionModify action triggering. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles UIMediumManager::m_pActionRemove action triggering. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles UIMediumManager::m_pActionRelease action triggering. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles UIMediumManager::m_pActionRefresh action triggering. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles tab change case. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles item change case. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Handles item double-click case. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Handles item context-menu-call case. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync void sltHandleContextMenuCall(const QPoint &position);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Adjusts tree-widgets according content. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** General prepare wrapper. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare dialog. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare actions. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare menu-bar. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare tool-bar. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare context-menu. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare tab-widget. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare tree-widgets. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare hard-drive tree-widget. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare optical-disk tree-widget. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare floppy-disk tree-widget. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare information-panes. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Prepare button-box. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Prepare progress-bar. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Mac OS X: Prepare <i>Window</i> menu. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync#endif /* Q_WS_MAC */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Repopulates tree-widgets content. */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /** Updates details according latest changes in current item of passed @a type. */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /** Updates details according latest changes in current item of chosen type. */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /** Updates details according latest changes in all current items. */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /** Update actions according currently chosen item. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Update action icons according currently chosen tab. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Update tab icons according last @a action happened with @a pItem. */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync void updateTabIcons(UIMediumItem *pItem, Action action);
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /** Update information pane of passed medium @a type. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync void updateInformationPanes(UIMediumType type = UIMediumType_Invalid);
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /** Update information pane for hard-drive tab. */
cf575292da27c79a7de59f7ced500686a0838b38vboxsync /** Update information pane for optical-disk tab. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Update information pane for floppy-disk tab. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Mac OS X: Cleanup <i>Window</i> menu. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync#endif /* Q_WS_MAC */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** General cleanup wrapper. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Translates dialog content. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Creates UIMediumItem for corresponding @a medium. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync UIMediumItem* createMediumItem(const UIMedium &medium);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Creates UIMediumItemHD for corresponding @a medium. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync UIMediumItem* createHardDiskItem(const UIMedium &medium);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Updates UIMediumItem for corresponding @a medium. */
65ba0abe3ecfd47b318d49a3c37a9b48d1f6904evboxsync /** Deletes UIMediumItem for corresponding @a strMediumID. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Determines medium type for passed @a pTreeWidget. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync UIMediumType mediumType(QTreeWidget *pTreeWidget) const;
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Returns current medium type. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /** Returns tree-widget for passed medium @a type. */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync /** Returns current tree-widget. */
/** 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);
static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
bool m_fRefresh;
bool m_fInaccessibleHD;
bool m_fInaccessibleCD;
bool m_fInaccessibleFD;