Changeset 64494 in vbox
- Timestamp:
- Oct 31, 2016 3:25:16 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
r64493 r64494 62 62 public: 63 63 64 /** Casts QTreeWidgetItem* to UISnapshotItem* if possible. */ 65 static UISnapshotItem *toSnapshotItem(QTreeWidgetItem *pItem); 66 /** Casts const QTreeWidgetItem* to const UISnapshotItem* if possible. */ 67 static const UISnapshotItem *toSnapshotItem(const QTreeWidgetItem *pItem); 68 64 69 /** Item type for UISnapshotItem. */ 65 70 enum { ItemType = QTreeWidgetItem::UserType + 1 }; … … 182 187 *********************************************************************************************************************************/ 183 188 189 /* static */ 190 UISnapshotItem *UISnapshotItem::toSnapshotItem(QTreeWidgetItem *pItem) 191 { 192 /* Make sure alive UISnapshotItem passed: */ 193 if (!pItem || pItem->type() != UISnapshotItem::ItemType) 194 return 0; 195 196 /* Return casted UISnapshotItem then: */ 197 return static_cast<UISnapshotItem*>(pItem); 198 } 199 200 /* static */ 201 const UISnapshotItem *UISnapshotItem::toSnapshotItem(const QTreeWidgetItem *pItem) 202 { 203 /* Make sure alive UISnapshotItem passed: */ 204 if (!pItem || pItem->type() != UISnapshotItem::ItemType) 205 return 0; 206 207 /* Return casted UISnapshotItem then: */ 208 return static_cast<const UISnapshotItem*>(pItem); 209 } 210 184 211 UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CSnapshot &comSnapshot) 185 212 : QTreeWidgetItem(pTreeWidget, ItemType) … … 227 254 { 228 255 /* Return the parent snapshot item if any: */ 229 return QTreeWidgetItem::parent() ? UISnapshotPane::toSnapshotItem(QTreeWidgetItem::parent()) : 0;256 return QTreeWidgetItem::parent() ? toSnapshotItem(QTreeWidgetItem::parent()) : 0; 230 257 } 231 258 … … 233 260 { 234 261 /* Return the child snapshot item with iIndex if any: */ 235 return QTreeWidgetItem::child(iIndex) ? UISnapshotPane::toSnapshotItem(QTreeWidgetItem::child(iIndex)) : 0;262 return QTreeWidgetItem::child(iIndex) ? toSnapshotItem(QTreeWidgetItem::child(iIndex)) : 0; 236 263 } 237 264 … … 539 566 { 540 567 /* Return the child snapshot item with iIndex if any: */ 541 return invisibleRootItem()->child(iIndex) ? UISnapshot Pane::toSnapshotItem(invisibleRootItem()->child(iIndex)) : 0;568 return invisibleRootItem()->child(iIndex) ? UISnapshotItem::toSnapshotItem(invisibleRootItem()->child(iIndex)) : 0; 542 569 } 543 570 … … 546 573 * Class UISnapshotPane implementation. * 547 574 *********************************************************************************************************************************/ 548 549 /* static */550 UISnapshotItem *UISnapshotPane::toSnapshotItem(QTreeWidgetItem *pItem)551 {552 /* Make sure alive UISnapshotItem passed: */553 if (!pItem || pItem->type() != UISnapshotItem::ItemType)554 return 0;555 556 /* Return casted UISnapshotItem then: */557 return static_cast<UISnapshotItem*>(pItem);558 }559 560 /* static */561 const UISnapshotItem *UISnapshotPane::toSnapshotItem(const QTreeWidgetItem *pItem)562 {563 /* Make sure alive UISnapshotItem passed: */564 if (!pItem || pItem->type() != UISnapshotItem::ItemType)565 return 0;566 567 /* Return casted UISnapshotItem then: */568 return static_cast<const UISnapshotItem*>(pItem);569 }570 575 571 576 UISnapshotPane::UISnapshotPane(QWidget *pParent) … … 723 728 { 724 729 /* Acquire corresponding snapshot item: */ 725 const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);730 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem); 726 731 727 732 /* Make the selected item visible: */ … … 791 796 792 797 /* Acquire corresponding snapshot item: */ 793 const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);798 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem); 794 799 AssertReturnVoid(pSnapshotItem); 795 800 … … 824 829 825 830 /* Acquire corresponding snapshot item: */ 826 const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);831 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem); 827 832 AssertReturnVoid(pSnapshotItem); 828 833 … … 839 844 { 840 845 /* Acquire corresponding snapshot item: */ 841 const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);846 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem); 842 847 AssertReturnVoid(pSnapshotItem); 843 848 … … 1012 1017 { 1013 1018 /* Acquire currently chosen snapshot item: */ 1014 const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());1019 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1015 1020 AssertPtr(pSnapshotItem); 1016 1021 if (!pSnapshotItem) … … 1087 1092 { 1088 1093 /* Acquire currently chosen snapshot item: */ 1089 const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());1094 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1090 1095 AssertPtr(pSnapshotItem); 1091 1096 if (!pSnapshotItem) … … 1157 1162 { 1158 1163 /* Acquire currently chosen snapshot item: */ 1159 const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());1164 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1160 1165 AssertReturnVoid(pSnapshotItem); 1161 1166 … … 1176 1181 { 1177 1182 /* Acquire currently chosen snapshot item: */ 1178 const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());1183 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1179 1184 AssertReturnVoid(pSnapshotItem); 1180 1185 … … 1214 1219 /* Remember the selected item and it's first child: */ 1215 1220 QString strSelectedItem, strFirstChildOfSelectedItem; 1216 const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());1221 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1217 1222 if (pSnapshotItem) 1218 1223 { 1219 1224 strSelectedItem = pSnapshotItem->snapshotID(); 1220 1225 if (pSnapshotItem->child(0)) 1221 strFirstChildOfSelectedItem = toSnapshotItem(pSnapshotItem->child(0))->snapshotID();1226 strFirstChildOfSelectedItem = UISnapshotItem::toSnapshotItem(pSnapshotItem->child(0))->snapshotID(); 1222 1227 } 1223 1228 … … 1308 1313 while (*it) 1309 1314 { 1310 UISnapshotItem *pSnapshotItem = toSnapshotItem(*it);1315 UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(*it); 1311 1316 if (pSnapshotItem->snapshotID() == strSnapshotID) 1312 1317 return pSnapshotItem; … … 1330 1335 { 1331 1336 /* Acquire corresponding snapshot item: */ 1332 UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);1337 UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem); 1333 1338 1334 1339 /* Fetch the snapshot age of the root if it's valid: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h
r63893 r64494 54 54 55 55 public: 56 57 /** Casts QTreeWidgetItem to UISnapshotItem if possible. */58 static UISnapshotItem *toSnapshotItem(QTreeWidgetItem *pItem);59 /** Casts const QTreeWidgetItem to const UISnapshotItem if possible. */60 static const UISnapshotItem *toSnapshotItem(const QTreeWidgetItem *pItem);61 56 62 57 /** Constructs snapshot pane passing @a pParent to the base-class. */
Note:
See TracChangeset
for help on using the changeset viewer.