UIMediumManager.h revision 85e53e311e4a1f30cc4bb620495389d43755a33b
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync * VBox Qt GUI - UIMediumManager class declaration.
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync * Copyright (C) 2006-2014 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/* Forward declarations: */
5a062c1c10e75283bed9bd16145610874ec5bacdvboxsync/** Functor interface allowing to check if passed UIMediumItem is suitable. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Determines whether passed @a pItem is suitable. */
5a062c1c10e75283bed9bd16145610874ec5bacdvboxsync virtual bool isItSuitable(UIMediumItem *pItem) const = 0;
58668e366c315f45ea3be7b3a43f79224858173avboxsync/** Medium Manager dialog. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsyncclass UIMediumManager : public QIWithRetranslateUI2<QIMainDialog>, public Ui::UIMediumManager
03aac79017ed994516d9547741b0e7aa9224c24cvboxsync /** Item action enumerator. */
03aac79017ed994516d9547741b0e7aa9224c24cvboxsync enum Action { Action_Add, Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Constructor for UIMediumManager dialog. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync UIMediumManager(QWidget *pCenterWidget, bool fRefresh = true);
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Destructor for UIMediumManager dialog. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Returns UIMediumManager singleton instance. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Shows UIMediumManager singleton instance, creates new if necessary. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync static void showModeless(QWidget *pCenterWidget, bool fRefresh = true);
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. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles UIMediumManager::m_pActionCopy action triggering. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles UIMediumManager::m_pActionModify action triggering. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles UIMediumManager::m_pActionRemove action triggering. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles UIMediumManager::m_pActionRelease action triggering. */
31745ebb293d58e9140fe2573cc1bd4f34bd1aa8vboxsync /** Handles UIMediumManager::m_pActionRefresh action triggering. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles tab change case. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles item change case. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles item double-click case. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Handles item context-menu-call case. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync void sltHandleContextMenuCall(const QPoint &position);
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Adjusts tree-widgets according content. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** General prepare wrapper. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Prepare dialog. */
3a6db00712f591d771f60db469fd8ea0e7b0ce69vboxsync /** Prepare connections. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Prepare actions. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Prepare menu-bar. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Prepare context-menu. */
3a6db00712f591d771f60db469fd8ea0e7b0ce69vboxsync /** Prepare central-widget. */
3a6db00712f591d771f60db469fd8ea0e7b0ce69vboxsync /** Prepare tool-bar. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Prepare tab-widget. */
2cfbc16182293ab6af5fcceabe24b53f7b2b822bvboxsync /** Prepare tab-widget's tab. */
2cfbc16182293ab6af5fcceabe24b53f7b2b822bvboxsync /** Prepare tab-widget's tree-widget. */
2cfbc16182293ab6af5fcceabe24b53f7b2b822bvboxsync void prepareTreeWidget(UIMediumType type, int iColumns);
2cfbc16182293ab6af5fcceabe24b53f7b2b822bvboxsync /** Prepare tab-widget's information-container. */
2cfbc16182293ab6af5fcceabe24b53f7b2b822bvboxsync void prepareInformationContainer(UIMediumType type, int iFields);
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Prepare button-box. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Prepare progress-bar. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Mac OS X: Prepare <i>Window</i> menu. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync#endif /* Q_WS_MAC */
19e4b59d75d82092624cb5440dd5dbe724b61d77vboxsync /** Repopulates tree-widgets content. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Updates details according latest changes in current item of passed @a type. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Updates details according latest changes in current item of chosen type. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Updates details according latest changes in all current items. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Update actions according currently chosen item. */
daa8487f5bc0d5c44dc3be2cbe3d34cc211a845fvboxsync /** Update action icons according currently chosen tab. */
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. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Mac OS X: Cleanup <i>Window</i> menu. */
26ab5559e05ae622734a4047cee975670da3b0e8vboxsync#endif /* Q_WS_MAC */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** General cleanup wrapper. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Translates dialog content. */
c43988473d501fd034309ca103548285bd9fa3b2vboxsync /** Creates UIMediumItem for corresponding @a medium. */
0dce7c2dd6b0e84af789fe319304c7305f1ac960vboxsync UIMediumItem* createMediumItem(const UIMedium &medium);
31745ebb293d58e9140fe2573cc1bd4f34bd1aa8vboxsync /** Creates UIMediumItemHD for corresponding @a medium. */
31745ebb293d58e9140fe2573cc1bd4f34bd1aa8vboxsync UIMediumItem* createHardDiskItem(const UIMedium &medium);
c43988473d501fd034309ca103548285bd9fa3b2vboxsync /** Updates UIMediumItem for corresponding @a medium. */
c43988473d501fd034309ca103548285bd9fa3b2vboxsync /** Deletes UIMediumItem for corresponding @a strMediumID. */
3a6db00712f591d771f60db469fd8ea0e7b0ce69vboxsync /** Returns tree-widget for passed medium @a type. */
3a6db00712f591d771f60db469fd8ea0e7b0ce69vboxsync /** Returns item for passed medium @a type. */
85e53e311e4a1f30cc4bb620495389d43755a33bvboxsync /** Returns information-container for passed medium @a type. */
85e53e311e4a1f30cc4bb620495389d43755a33bvboxsync /** Returns information-label for passed medium @a type and @a iLabelIndex. */
85e53e311e4a1f30cc4bb620495389d43755a33bvboxsync QLabel* infoLabel(UIMediumType type, int iLabelIndex) const;
85e53e311e4a1f30cc4bb620495389d43755a33bvboxsync /** Returns information-field for passed medium @a type and @a iFieldIndex. */
85e53e311e4a1f30cc4bb620495389d43755a33bvboxsync QILabel* infoField(UIMediumType type, int iFieldIndex) const;
2cfbc16182293ab6af5fcceabe24b53f7b2b822bvboxsync /** Returns medium type for passed @a pTreeWidget. */
2cfbc16182293ab6af5fcceabe24b53f7b2b822bvboxsync UIMediumType mediumType(QTreeWidget *pTreeWidget) const;
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Returns current medium type. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Returns current tree-widget. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Returns current item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Defines current item for passed @a pTreeWidget as @a pItem. */
4cac31995acb30108f8070f160cd9a820b8f50acvboxsync void setCurrentItem(QTreeWidget *pTreeWidget, QTreeWidgetItem *pItem);
6dcd0dbfdc6ef7c8b5b00526020236e4542bb77avboxsync /** Returns tab index for passed UIMediumType. */
6dcd0dbfdc6ef7c8b5b00526020236e4542bb77avboxsync /** Returns UIMediumType for passed tab index. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Performs search for the @a pTree child which corresponds to the @a condition but not @a pException. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync static UIMediumItem* searchItem(QTreeWidget *pTree, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Performs search for the @a pParentItem child which corresponds to the @a condition but not @a pException. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync static UIMediumItem* searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Checks if @a action can be used for @a pItem. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync static bool checkMediumFor(UIMediumItem *pItem, Action action);
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync /** Casts passed QTreeWidgetItem @a pItem to UIMediumItem if possible. */
07a690d662bd122b5e07b2c996990b4ef97f14f2vboxsync static UIMediumItem* toMediumItem(QTreeWidgetItem *pItem);
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Format information-pane content. */
cfeb51c88f60cb31c8862f0fa325d7d1c4d22f8avboxsync static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Determines if passed @a medium attached to hidden machines only. */
79a32911c902685a8fafa06c4b9fd7f277994d93vboxsync static bool isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium);
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** UIMediumManager singleton instance. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** @name General variables.
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Widget to center UIMediumManager according. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds whether UIMediumManager should be refreshed on invoke. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds whether UIMediumManager should preserve current item change. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** @name Tab-widget variables.
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds whether hard-drive tab-widget have inaccessible item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds whether optical-disk tab-widget have inaccessible item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds whether floppy-disk tab-widget have inaccessible item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds cached hard-drive tab-widget icon. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds cached optical-disk tab-widget icon. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds cached floppy-disk tab-widget icon. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds current hard-drive tree-view item ID. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds current optical-disk tree-view item ID. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Holds current floppy-disk tree-view item ID. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** @name Tool-bar and menu variables.
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Tool-bar widget. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Context menu object. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Menu-bar menu object. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Action to <i>copy</i> current item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Action to <i>modify</i> current item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Action to <i>remove</i> current item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Action to <i>release</i> current item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Action to <i>refresh</i> current item. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** @name Progress-bar variables.
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync /** Progress-bar widget. */
cf7a2a65e777b164523f5a5a52a1ac64e4322760vboxsync#endif /* !___UIMediumManager_h___ */