UIMediumManager.h revision a1d5123f3ab0fbe5f030c0fc55a812e0807a566e
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * VBox frontends: Qt4 GUI ("VirtualBox"):
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * UIMediumManager class declaration
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync * Copyright (C) 2006-2013 Oracle Corporation
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync * 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.
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync/* GUI includes: */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync/* COM includes: */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync/* Forward declarations: */
5a062c1c10e75283bed9bd16145610874ec5bacdvboxsync/** Functor interface allowing to check if passed UIMediumItem is suitable. */
5a062c1c10e75283bed9bd16145610874ec5bacdvboxsync /** Determines whether passed UIMediumItem is suitable. */
5a062c1c10e75283bed9bd16145610874ec5bacdvboxsync virtual bool isItSuitable(UIMediumItem *pItem) const = 0;
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync/* Medium Manager Dialog: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsyncclass UIMediumManager : public QIWithRetranslateUI2<QIMainDialog>, public Ui::UIMediumManager
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Enumerators: */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync enum ItemAction { ItemAction_Added, ItemAction_Updated, ItemAction_Removed };
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync enum Action { Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync UIMediumManager(QWidget *pCenterWidget, bool fRefresh = true);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Static API: Singleton stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync static void showModeless(QWidget *pCenterWidget, bool fRefresh = true);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handler: Refresh stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handlers: Medium-processing stuff: */
026a45b961439e27215ecef27f81bc115857609evboxsync void sltHandleMediumCreated(const QString &strMediumID);
b4e89d495c2988c10068923397d31fd27112b9ebvboxsync void sltHandleMediumDeleted(const QString &strMediumID);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handlers: Medium-enumeration stuff: */
026a45b961439e27215ecef27f81bc115857609evboxsync void sltHandleMediumEnumerated(const QString &strMediumID);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handlers: Medium-modification stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handlers: Navigation stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync void sltHandleCurrentItemChanged(QTreeWidgetItem *pItem, QTreeWidgetItem *pPrevItem = 0);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync void sltHandleContextMenuCall(const QPoint &position);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handlers: Geometry stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Helpers: Prepare stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync#endif /* Q_WS_MAC */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Helper: Populate stuff: */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Update actions according currently chosen medium-item. */
e352a9803c8b6a6ffba3440c75acadabf47c8e0evboxsync /** Update tab icons according last @a action happened with @a pItem. */
e352a9803c8b6a6ffba3440c75acadabf47c8e0evboxsync void updateTabIcons(UIMediumItem *pItem, ItemAction action);
a1d5123f3ab0fbe5f030c0fc55a812e0807a566evboxsync /** Update information pane of passed medium @a type. */
a1d5123f3ab0fbe5f030c0fc55a812e0807a566evboxsync void updateInformationPanes(UIMediumType type = UIMediumType_Invalid);
a1d5123f3ab0fbe5f030c0fc55a812e0807a566evboxsync /** Update information pane for hard-drive tab. */
a1d5123f3ab0fbe5f030c0fc55a812e0807a566evboxsync /** Update information pane for optical-disk tab. */
a1d5123f3ab0fbe5f030c0fc55a812e0807a566evboxsync /** Update information pane for floppy-disk tab. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Helpers: Cleanup stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync#endif /* Q_WS_MAC */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handler: Translation stuff: */
2a3ea815abf6290c6e17e81eb350e5c19a090c64vboxsync /** Creates UIMediumItem for corresponding UIMedium. */
2a3ea815abf6290c6e17e81eb350e5c19a090c64vboxsync /** Updates UIMediumItem for corresponding UIMedium. */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /* Helpers: Medium-modification stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync bool releaseMediumFrom(const UIMedium &medium, const QString &strMachineId);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync bool releaseHardDiskFrom(const UIMedium &medium, CMachine &machine);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync bool releaseOpticalDiskFrom(const UIMedium &medium, CMachine &machine);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync bool releaseFloppyDiskFrom(const UIMedium &medium, CMachine &machine);
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Returns current medium type. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Returns tree-widget for passed medium @a type. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Returns current tree-widget. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Returns medium-item for passed medium @a type. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Returns current medium-item. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Defines <i>current-item</i> for passed @a pTree as @a pItem. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync void setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem);
5a062c1c10e75283bed9bd16145610874ec5bacdvboxsync UIMediumItem* searchItem(QTreeWidget *pTree, const CheckIfSuitableBy &functor) const;
5a062c1c10e75283bed9bd16145610874ec5bacdvboxsync UIMediumItem* searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &functor) const;
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync UIMediumItem* createHardDiskItem(QTreeWidget *pTree, const UIMedium &medium) const;
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /* Helpers: Other stuff: */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync bool checkMediumFor(UIMediumItem *pItem, Action action);
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Casts passed QTreeWidgetItem @a pItem to UIMediumItem if possible. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync static UIMediumItem* toMediumItem(QTreeWidgetItem *pItem);
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /* Static helper: Formatting stuff: */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync /* Static helper: Enumeration stuff: */
79a32911c902685a8fafa06c4b9fd7f277994d93vboxsync static bool isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Variable: Singleton instance: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Variables: General stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Variables: Tab-widget stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Variables: Menu & Toolbar stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Variable: Progress-bar stuff: */
8230e6f6671b538d39c7ef6d8484cf516a983ef4vboxsync#endif /* __UIMediumManager_h__ */