儲存庫 vbox 的更動 67509
- 時間撮記:
- 2017-6-20 下午02:10:06 (7 年 以前)
- 位置:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
r67489 r67509 729 729 strMachineId.toUtf8().constData(), strSnapshotId.toUtf8().constData())); 730 730 731 // TODO: Refresh only necessary bits. 732 /* Refresh everything: */ 733 refreshAll(); 731 /* Prepare result: */ 732 bool fSuccess = false; 733 { 734 /* Prevent snapshot editing in the meantime: */ 735 QWriteLocker locker(m_pLockReadWrite); 736 737 /* Search for an existing item with such id: */ 738 UISnapshotItem *pItem = findItem(strSnapshotId); 739 fSuccess = pItem; 740 741 /* Make sure item has no more than one child: */ 742 if (fSuccess) 743 fSuccess = pItem->childCount() <= 1; 744 745 /* Detach child before deleting item: */ 746 QTreeWidgetItem *pChild = 0; 747 if (fSuccess && pItem->childCount() == 1) 748 pChild = pItem->takeChild(0); 749 750 /* Check whether item has parent: */ 751 QTreeWidgetItem *pParent = 0; 752 if (fSuccess) 753 pParent = pItem->QTreeWidgetItem::parent(); 754 755 /* If item has child: */ 756 if (pChild) 757 { 758 /* Determine where the item located: */ 759 int iIndexOfChild = -1; 760 if (fSuccess) 761 { 762 if (pParent) 763 iIndexOfChild = pParent->indexOfChild(pItem); 764 else 765 iIndexOfChild = m_pSnapshotTree->indexOfTopLevelItem(pItem); 766 fSuccess = iIndexOfChild != -1; 767 } 768 769 /* And move child into this place: */ 770 if (fSuccess) 771 { 772 if (pParent) 773 pParent->insertChild(iIndexOfChild, pChild); 774 else 775 m_pSnapshotTree->insertTopLevelItem(iIndexOfChild, pChild); 776 expandItemChildren(pChild); 777 } 778 } 779 780 /* Delete item finally: */ 781 if (fSuccess) 782 { 783 delete pItem; 784 pItem = 0; 785 786 LogRel(("GUI: Snapshot tree update successful!\n")); 787 } 788 } 789 790 /* Just refresh everything as fallback: */ 791 if (!fSuccess) 792 { 793 LogRel(("GUI: Snapshot tree update failed! Rebuilding from scratch...\n")); 794 refreshAll(); 795 } 734 796 } 735 797 … … 1748 1810 } 1749 1811 1812 void UISnapshotPane::expandItemChildren(QTreeWidgetItem *pItem) 1813 { 1814 pItem ->setExpanded(true); 1815 for (int i = 0; i < pItem->childCount(); ++i) 1816 expandItemChildren(pItem->child(i)); 1817 } 1818 1750 1819 #include "UISnapshotPane.moc" 1751 1820 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h
r67470 r67509 186 186 /** Searches for smallest snapshot age starting with @a pItem as parent. */ 187 187 SnapshotAgeFormat traverseSnapshotAge(QTreeWidgetItem *pItem) const; 188 189 /** Expand all the children starting with @a pItem. */ 190 void expandItemChildren(QTreeWidgetItem *pItem); 188 191 /** @} */ 189 192
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器