UIMediumManager.h revision 0dce7c2dd6b0e84af789fe319304c7305f1ac960
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;
58668e366c315f45ea3be7b3a43f79224858173avboxsync/** Medium Manager dialog. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsyncclass UIMediumManager : public QIWithRetranslateUI2<QIMainDialog>, public Ui::UIMediumManager
03aac79017ed994516d9547741b0e7aa9224c24cvboxsync /** Tab index enumerator. */
03aac79017ed994516d9547741b0e7aa9224c24cvboxsync enum TabIndex { TabIndex_HD = 0, TabIndex_CD, TabIndex_FD };
03aac79017ed994516d9547741b0e7aa9224c24cvboxsync /** Item action enumerator. */
03aac79017ed994516d9547741b0e7aa9224c24cvboxsync enum Action { Action_Add, Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Constructor for Medium Manager dialog. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync UIMediumManager(QWidget *pCenterWidget, bool fRefresh = true);
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Destructor for Medium Manager dialog. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Returns Medium Manager singleton instance. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Shows Medium Manager singleton instance, creates new if necessary. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync static void showModeless(QWidget *pCenterWidget, bool fRefresh = true);
c43988473d501fd034309ca103548285bd9fa3b2vboxsync /** Fully refreshes medium manager contents. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Handles VBoxGlobal::sigMediumCreated signal. */
026a45b961439e27215ecef27f81bc115857609evboxsync void sltHandleMediumCreated(const QString &strMediumID);
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Handles VBoxGlobal::sigMediumDeleted signal. */
b4e89d495c2988c10068923397d31fd27112b9ebvboxsync void sltHandleMediumDeleted(const QString &strMediumID);
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Handles VBoxGlobal::sigMediumEnumerationStarted signal. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Handles VBoxGlobal::sigMediumEnumerated signal. */
026a45b961439e27215ecef27f81bc115857609evboxsync void sltHandleMediumEnumerated(const QString &strMediumID);
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Handles VBoxGlobal::sigMediumEnumerationFinished signal. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Calls for clone VD wizard to copy chosen medium. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Calls for medium-type change dialog for chosen medium. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Calls for remove medium dialog for chosen medium. */
58668e366c315f45ea3be7b3a43f79224858173avboxsync /** Calls for medium release dialog for chosen medium. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handlers: Navigation stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync void sltHandleContextMenuCall(const QPoint &position);
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Handlers: Geometry stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync /* Helpers: Prepare stuff: */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync#endif /* Q_WS_MAC */
19e4b59d75d82092624cb5440dd5dbe724b61d77vboxsync /** Repopulates tree-widgets content. */
5d55446560201599879edf9a7133c74d0a5218bbvboxsync /** Updates details according latest changes in current medium-item of predefined @a type. */
5d55446560201599879edf9a7133c74d0a5218bbvboxsync /** Updates details according latest changes in current medium-item of chosen type. */
5d55446560201599879edf9a7133c74d0a5218bbvboxsync /** Updates details according latest changes in all current medium-items. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Update actions according currently chosen medium-item. */
e352a9803c8b6a6ffba3440c75acadabf47c8e0evboxsync /** Update tab icons according last @a action happened with @a pItem. */
03aac79017ed994516d9547741b0e7aa9224c24cvboxsync void updateTabIcons(UIMediumItem *pItem, Action 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: */
c43988473d501fd034309ca103548285bd9fa3b2vboxsync /** Creates UIMediumItem for corresponding @a medium. */
0dce7c2dd6b0e84af789fe319304c7305f1ac960vboxsync UIMediumItem* createMediumItem(const UIMedium &medium);
c43988473d501fd034309ca103548285bd9fa3b2vboxsync /** Updates UIMediumItem for corresponding @a medium. */
c43988473d501fd034309ca103548285bd9fa3b2vboxsync /** Deletes UIMediumItem for corresponding @a strMediumID. */
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);
5d55446560201599879edf9a7133c74d0a5218bbvboxsync /** Determines medium type for passed @a pTreeWidget. */
5d55446560201599879edf9a7133c74d0a5218bbvboxsync UIMediumType mediumType(QTreeWidget *pTreeWidget) const;
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. */
4cac31995acb30108f8070f160cd9a820b8f50acvboxsync /** Defines <i>current-item</i> for passed @a pTreeWidget as @a pItem. */
4cac31995acb30108f8070f160cd9a820b8f50acvboxsync void setCurrentItem(QTreeWidget *pTreeWidget, 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;
19e4b59d75d82092624cb5440dd5dbe724b61d77vboxsync /* Helper: 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__ */