Changeset 48090 in vbox for trunk/src/VBox
- Timestamp:
- Aug 27, 2013 4:10:14 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
r48088 r48090 1445 1445 } 1446 1446 1447 void UIMediumManager::setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem) 1448 { 1449 if (pTree && pItem) 1450 { 1451 pItem->setSelected(true); 1452 pTree->setCurrentItem(pItem); 1453 pTree->scrollToItem(pItem, QAbstractItemView::EnsureVisible); 1454 sltHandleCurrentItemChanged(pItem); 1455 } 1456 else 1457 sltHandleCurrentTabChanged(); 1458 } 1459 1447 1460 UIMediumItem* UIMediumManager::toMediumItem(QTreeWidgetItem *pItem) const 1448 1461 { … … 1454 1467 } 1455 1468 1456 void UIMediumManager::setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem) 1457 { 1458 if (pTree && pItem) 1459 { 1460 pItem->setSelected(true); 1461 pTree->setCurrentItem(pItem); 1462 pTree->scrollToItem(pItem, QAbstractItemView::EnsureVisible); 1463 sltHandleCurrentItemChanged(pItem); 1464 } 1465 else 1466 sltHandleCurrentTabChanged(); 1469 UIMediumItem* UIMediumManager::searchItem(QTreeWidget *pTree, const QString &strId) const 1470 { 1471 /* Make sure passed ID is valid: */ 1472 if (strId.isNull()) 1473 return 0; 1474 1475 /* Iterate other all the mediums of passed tree: */ 1476 UIMediumItemIterator iterator(pTree); 1477 while (*iterator) 1478 { 1479 if ((*iterator)->id() == strId) 1480 return *iterator; 1481 ++iterator; 1482 } 1483 1484 /* Null by default: */ 1485 return 0; 1467 1486 } 1468 1487 … … 1582 1601 } 1583 1602 1584 UIMediumItem* UIMediumManager::searchItem(QTreeWidget *pTree, const QString &strId) const1585 {1586 /* Make sure passed ID is valid: */1587 if (strId.isNull())1588 return 0;1589 1590 /* Iterate other all the mediums of passed tree: */1591 UIMediumItemIterator iterator(pTree);1592 while (*iterator)1593 {1594 if ((*iterator)->id() == strId)1595 return *iterator;1596 ++iterator;1597 }1598 1599 /* Null by default: */1600 return 0;1601 }1602 1603 1603 bool UIMediumManager::checkMediumFor(UIMediumItem *pItem, Action action) 1604 1604 { … … 1702 1702 } 1703 1703 1704 /* static */ 1704 1705 QString UIMediumManager::formatPaneText(const QString &strText, bool fCompact /* = true */, 1705 1706 const QString &strElipsis /* = "middle" */) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r48088 r48090 6 6 7 7 /* 8 * Copyright (C) 2006-201 2Oracle Corporation8 * Copyright (C) 2006-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 125 125 void retranslateUi(); 126 126 127 /* Helper : Medium-modification stuff: */127 /* Helpers: Medium-modification stuff: */ 128 128 bool releaseMediumFrom(const UIMedium &medium, const QString &strMachineId); 129 129 bool releaseHardDiskFrom(const UIMedium &medium, CMachine &machine); … … 135 135 UIMediumType currentTreeWidgetType() const; 136 136 QTreeWidget* currentTreeWidget() const; 137 UIMediumItem* toMediumItem(QTreeWidgetItem *aItem) const;138 137 void setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem); 138 UIMediumItem* toMediumItem(QTreeWidgetItem *pItem) const; 139 UIMediumItem* searchItem(QTreeWidget *pTree, const QString &strId) const; 140 UIMediumItem* createHardDiskItem(QTreeWidget *pTree, const UIMedium &medium) const; 139 141 140 UIMediumItem* createHardDiskItem (QTreeWidget *aTree, const UIMedium &aMedium) const; 142 /* Internal API: Tab-widget access stuff: */ 143 void updateTabIcons(UIMediumItem *pItem, ItemAction action); 141 144 142 void updateTabIcons (UIMediumItem *aItem, ItemAction aAction); 145 /* Helpers: Other stuff: */ 146 bool checkMediumFor(UIMediumItem *pItem, Action action); 147 void clearInfoPanes(); 148 void prepareToRefresh(int iTotal = 0); 143 149 144 UIMediumItem* searchItem (QTreeWidget *aTree, const QString &aId) const; 150 /* Static helper: Formatting stuff: */ 151 static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle"); 145 152 146 bool checkMediumFor (UIMediumItem *aItem, Action aAction); 147 148 void clearInfoPanes(); 149 void prepareToRefresh (int aTotal = 0); 150 151 QString formatPaneText (const QString &aText, bool aCompact = true, const QString &aElipsis = "middle"); 152 153 /* Helper: Enumeration stuff: */ 153 /* Static helper: Enumeration stuff: */ 154 154 static bool isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium); 155 155 … … 188 188 189 189 #endif /* __UIMediumManager_h__ */ 190
Note:
See TracChangeset
for help on using the changeset viewer.