Changeset 49581 in vbox
- Timestamp:
- Nov 20, 2013 12:20:31 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r49553 r49581 60 60 61 61 /* Medium-item type: */ 62 enum { MediaItemType = QTreeWidgetItem::UserType + 1 };62 enum { Type = QTreeWidgetItem::UserType + 1 }; 63 63 64 64 /* Constructor: Top-level item: */ 65 65 UIMediumItem(const UIMedium &medium, QTreeWidget *pParent) 66 : QTreeWidgetItem(pParent, MediaItemType)66 : QTreeWidgetItem(pParent, Type) 67 67 , m_medium(medium) 68 68 { refresh(); } … … 70 70 /* Constructor: Child item: */ 71 71 UIMediumItem(const UIMedium &medium, UIMediumItem *pParent) 72 : QTreeWidgetItem(pParent, MediaItemType)72 : QTreeWidgetItem(pParent, Type) 73 73 , m_medium(medium) 74 74 { refresh(); } … … 89 89 } 90 90 91 /* API: Type stuff: */92 UIMediumType type() const { return m_medium.type(); }91 /* API: Medium-type stuff: */ 92 UIMediumType mediumType() const { return m_medium.type(); } 93 93 94 94 /* API: State stuff: */ … … 146 146 147 147 148 /* Medium-item : */148 /* Medium-item iterator: */ 149 149 class UIMediumItemIterator : public QTreeWidgetItemIterator 150 150 { … … 157 157 { 158 158 QTreeWidgetItem *pItem = QTreeWidgetItemIterator::operator*(); 159 return pItem && pItem->type() == UIMediumItem:: MediaItemType ?159 return pItem && pItem->type() == UIMediumItem::Type ? 160 160 static_cast<UIMediumItem*>(pItem) : 0; 161 161 } … … 264 264 void UIMediumManager::refreshAll() 265 265 { 266 // TODO (Planned to 4.3.release by Dsen)267 // Currently we just restarting medium-enumeration which is *very* expensive.268 // To make it proper way, we have to invalidate mediums which were known as *related*269 // to machine who's event called for *full-refresh* and start medium-enumeration.270 // But medium-enumeration itself should update *only* invalidated mediums.271 266 vboxGlobal().startMediumEnumeration(); 272 267 } … … 522 517 QString strMediumID = pMediumItem->id(); 523 518 AssertReturnVoid(!strMediumID.isNull()); 524 UIMediumType type = pMediumItem-> type();519 UIMediumType type = pMediumItem->mediumType(); 525 520 526 521 /* Confirm medium removal: */ … … 752 747 /* Show context menu: */ 753 748 m_pContextMenu->exec(pTree->viewport()->mapToGlobal(position)); 754 }755 }756 757 void UIMediumManager::sltHandleMachineStateChanged(QString, KMachineState state)758 {759 switch (state)760 {761 case KMachineState_PoweredOff:762 case KMachineState_Aborted:763 case KMachineState_Saved:764 case KMachineState_Teleported:765 case KMachineState_Starting:766 case KMachineState_Restoring:767 case KMachineState_TeleportingIn:768 {769 refreshAll();770 break;771 }772 default:773 break;774 749 } 775 750 } … … 1487 1462 { 1488 1463 /* Return UIMediumItem based on QTreeWidgetItem if it is valid: */ 1489 if (pItem && pItem->type() == UIMediumItem:: MediaItemType)1464 if (pItem && pItem->type() == UIMediumItem::Type) 1490 1465 return static_cast<UIMediumItem*>(pItem); 1491 1466 /* Null by default: */ … … 1519 1494 /* Prepare medium-item: */ 1520 1495 UIMediumItem *pMediumItem = 0; 1521 CMedium parent = medium.medium().GetParent();1522 1496 1523 1497 /* First try to create item under corresponding parent: */ 1524 if ( !parent.isNull())1525 if (UIMediumItem *pRoot = searchItem(pTree, parent.GetId()))1498 if (medium.parentID() != UIMedium::nullID()) 1499 if (UIMediumItem *pRoot = searchItem(pTree, medium.parentID())) 1526 1500 pMediumItem = new UIMediumItem(medium, pRoot); 1527 1501 /* Else just create item as top-level one: */ … … 1542 1516 const QIcon *pIcon = 0; 1543 1517 bool *pfInaccessible = 0; 1544 switch (pMediumItem-> type())1518 switch (pMediumItem->mediumType()) 1545 1519 { 1546 1520 case UIMediumType_HardDisk: -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r49553 r49581 84 84 void sltHandleDoubleClick(); 85 85 void sltHandleContextMenuCall(const QPoint &position); 86 87 /* Handler: Machine stuff: */88 void sltHandleMachineStateChanged(QString strId, KMachineState state);89 86 90 87 /* Handlers: Geometry stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.