- Timestamp:
- Oct 26, 2016 2:05:53 PM (8 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
r63567 r64430 57 57 58 58 /** QTreeWidgetItem extension representing Medium Manager item. */ 59 class UIMediumItem : public Q TreeWidgetItem59 class UIMediumItem : public QITreeWidgetItem 60 60 { 61 61 public: 62 62 63 /** UIMediumItem type for rtti needs. */64 enum { Type = QTreeWidgetItem::UserType + 1 };65 66 63 /** Constructor for top-level item. */ 67 UIMediumItem(const UIMedium &medium, Q TreeWidget *pParent)68 : Q TreeWidgetItem(pParent, Type)64 UIMediumItem(const UIMedium &medium, QITreeWidget *pParent) 65 : QITreeWidgetItem(pParent) 69 66 , m_medium(medium) 70 67 { refresh(); } … … 72 69 /** Constructor for child item. */ 73 70 UIMediumItem(const UIMedium &medium, UIMediumItem *pParent) 74 : Q TreeWidgetItem(pParent, Type)71 : QITreeWidgetItem(pParent) 75 72 , m_medium(medium) 76 73 { refresh(); } … … 226 223 227 224 /** Constructor for top-level item. */ 228 UIMediumItemHD(const UIMedium &medium, Q TreeWidget *pParent)225 UIMediumItemHD(const UIMedium &medium, QITreeWidget *pParent) 229 226 : UIMediumItem(medium, pParent) 230 227 {} … … 401 398 402 399 /** Constructor for top-level item. */ 403 UIMediumItemCD(const UIMedium &medium, Q TreeWidget *pParent)400 UIMediumItemCD(const UIMedium &medium, QITreeWidget *pParent) 404 401 : UIMediumItem(medium, pParent) 405 402 {} … … 484 481 485 482 /** Constructor for top-level item. */ 486 UIMediumItemFD(const UIMedium &medium, Q TreeWidget *pParent)483 UIMediumItemFD(const UIMedium &medium, QITreeWidget *pParent) 487 484 : UIMediumItem(medium, pParent) 488 485 {} … … 868 865 { 869 866 /* Get current tree-widget: */ 870 Q TreeWidget *pTreeWidget = currentTreeWidget();867 QITreeWidget *pTreeWidget = currentTreeWidget(); 871 868 if (pTreeWidget) 872 869 { 873 870 /* If another tree-widget was focused before, 874 871 * move focus to current tree-widget: */ 875 if (qobject_cast<Q TreeWidget*>(focusWidget()))872 if (qobject_cast<QITreeWidget*>(focusWidget())) 876 873 pTreeWidget->setFocus(); 877 874 } … … 887 884 { 888 885 /* Get sender() tree-widget: */ 889 Q TreeWidget *pTreeWidget = qobject_cast<QTreeWidget*>(sender());886 QITreeWidget *pTreeWidget = qobject_cast<QITreeWidget*>(sender()); 890 887 AssertMsgReturnVoid(pTreeWidget, ("This slot should be called by tree-widget only!\n")); 891 888 … … 907 904 { 908 905 /* Get current tree-widget: */ 909 Q TreeWidget *pTreeWidget = currentTreeWidget();906 QITreeWidget *pTreeWidget = currentTreeWidget(); 910 907 AssertPtrReturnVoid(pTreeWidget); 911 908 … … 926 923 { 927 924 /* Get all the tree-widgets: */ 928 const QList<Q TreeWidget*> trees = m_trees.values();925 const QList<QITreeWidget*> trees = m_trees.values(); 929 926 930 927 /* Calculate deduction for every header: */ 931 928 QList<int> deductions; 932 foreach (Q TreeWidget *pTreeWidget, trees)929 foreach (QITreeWidget *pTreeWidget, trees) 933 930 { 934 931 int iDeduction = 0; … … 941 938 for (int iTreeIndex = 0; iTreeIndex < trees.size(); ++iTreeIndex) 942 939 { 943 Q TreeWidget *pTreeWidget = trees[iTreeIndex];940 QITreeWidget *pTreeWidget = trees[iTreeIndex]; 944 941 int iSize0 = pTreeWidget->viewport()->width() - deductions[iTreeIndex]; 945 942 if (pTreeWidget->header()->sectionSize(0) != iSize0) … … 1219 1216 /* Create tree-widget: */ 1220 1217 m_trees.insert(tabIndex(type), new QITreeWidget); 1221 Q TreeWidget *pTreeWidget = treeWidget(type);1218 QITreeWidget *pTreeWidget = treeWidget(type); 1222 1219 AssertPtrReturnVoid(pTreeWidget); 1223 1220 { … … 1353 1350 1354 1351 /* Clear tree-widgets: */ 1355 Q TreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);1352 QITreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk); 1356 1353 if (pTreeWidgetHD) 1357 1354 { … … 1359 1356 pTreeWidgetHD->clear(); 1360 1357 } 1361 Q TreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);1358 QITreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD); 1362 1359 if (pTreeWidgetCD) 1363 1360 { … … 1365 1362 pTreeWidgetCD->clear(); 1366 1363 } 1367 Q TreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);1364 QITreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy); 1368 1365 if (pTreeWidgetFD) 1369 1366 { … … 1564 1561 CheckIfSuitableByState lookForState(KMediumState_Inaccessible); 1565 1562 CheckIfSuitableByID ignoreID(pMediumItem->id()); 1566 UIMediumItem *pInaccessibleMediumItem = searchItem(pMediumItem-> treeWidget(), lookForState, &ignoreID);1563 UIMediumItem *pInaccessibleMediumItem = searchItem(pMediumItem->parentTree(), lookForState, &ignoreID); 1567 1564 *pfInaccessible = !!pInaccessibleMediumItem; 1568 1565 } … … 1795 1792 1796 1793 /* Translate HD tree-widget: */ 1797 Q TreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);1794 QITreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk); 1798 1795 if (pTreeWidgetHD) 1799 1796 { … … 1820 1817 1821 1818 /* Translate CD tree-widget: */ 1822 Q TreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);1819 QITreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD); 1823 1820 if (pTreeWidgetCD) 1824 1821 { … … 1836 1833 1837 1834 /* Translate FD tree-widget: */ 1838 Q TreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);1835 QITreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy); 1839 1836 if (pTreeWidgetFD) 1840 1837 { … … 1885 1882 { 1886 1883 /* Make sure corresponding tree-widget exists: */ 1887 Q TreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);1884 QITreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk); 1888 1885 if (pTreeWidget) 1889 1886 { … … 1905 1902 { 1906 1903 /* Make sure corresponding tree-widget exists: */ 1907 Q TreeWidget *pTreeWidget = treeWidget(UIMediumType_DVD);1904 QITreeWidget *pTreeWidget = treeWidget(UIMediumType_DVD); 1908 1905 if (pTreeWidget) 1909 1906 { … … 1926 1923 { 1927 1924 /* Make sure corresponding tree-widget exists: */ 1928 Q TreeWidget *pTreeWidget = treeWidget(UIMediumType_Floppy);1925 QITreeWidget *pTreeWidget = treeWidget(UIMediumType_Floppy); 1929 1926 if (pTreeWidget) 1930 1927 { … … 1967 1964 1968 1965 /* Make sure corresponding tree-widget exists: */ 1969 Q TreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);1966 QITreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk); 1970 1967 if (pTreeWidget) 1971 1968 { … … 2048 2045 QList<UIMediumType> types; 2049 2046 types << UIMediumType_HardDisk << UIMediumType_DVD << UIMediumType_Floppy; 2050 Q TreeWidget *pTreeWidget = 0;2047 QITreeWidget *pTreeWidget = 0; 2051 2048 UIMediumItem *pMediumItem = 0; 2052 2049 foreach (UIMediumType type, types) … … 2090 2087 } 2091 2088 2092 Q TreeWidget* UIMediumManager::treeWidget(UIMediumType type) const2089 QITreeWidget* UIMediumManager::treeWidget(UIMediumType type) const 2093 2090 { 2094 2091 /* Determine tab index for passed medium type: */ … … 2106 2103 { 2107 2104 /* Get corresponding tree-widget: */ 2108 Q TreeWidget *pTreeWidget = treeWidget(type);2105 QITreeWidget *pTreeWidget = treeWidget(type); 2109 2106 /* Return corresponding medium-item: */ 2110 2107 return pTreeWidget ? toMediumItem(pTreeWidget->currentItem()) : 0; … … 2160 2157 } 2161 2158 2162 UIMediumType UIMediumManager::mediumType(Q TreeWidget *pTreeWidget) const2159 UIMediumType UIMediumManager::mediumType(QITreeWidget *pTreeWidget) const 2163 2160 { 2164 2161 /* Determine tab index of passed tree-widget: */ … … 2183 2180 } 2184 2181 2185 Q TreeWidget* UIMediumManager::currentTreeWidget() const2182 QITreeWidget* UIMediumManager::currentTreeWidget() const 2186 2183 { 2187 2184 /* Return current tree-widget: */ … … 2195 2192 } 2196 2193 2197 void UIMediumManager::setCurrentItem(Q TreeWidget *pTreeWidget, QTreeWidgetItem *pItem)2194 void UIMediumManager::setCurrentItem(QITreeWidget *pTreeWidget, QTreeWidgetItem *pItem) 2198 2195 { 2199 2196 /* Make sure passed tree-widget is valid: */ … … 2248 2245 2249 2246 /* static */ 2250 UIMediumItem* UIMediumManager::searchItem(Q TreeWidget *pTreeWidget, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException)2247 UIMediumItem* UIMediumManager::searchItem(QITreeWidget *pTreeWidget, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException) 2251 2248 { 2252 2249 /* Make sure argument is valid: */ … … 2336 2333 { 2337 2334 /* Cast passed QTreeWidgetItem to UIMediumItem if possible: */ 2338 return pItem && pItem->type() == UIMediumItem::Type ? static_cast<UIMediumItem*>(pItem) : 0;2335 return pItem && pItem->type() == QITreeWidgetItem::ItemType ? static_cast<UIMediumItem*>(pItem) : 0; 2339 2336 } 2340 2337 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r63315 r64430 32 32 class UIEnumerationProgressBar; 33 33 class QTabWidget; 34 class Q TreeWidget;34 class QITreeWidget; 35 35 class QTreeWidgetItem; 36 36 class QFrame; … … 182 182 QWidget* tab(UIMediumType type) const; 183 183 /** Returns tree-widget for passed medium @a type. */ 184 Q TreeWidget* treeWidget(UIMediumType type) const;184 QITreeWidget* treeWidget(UIMediumType type) const; 185 185 /** Returns item for passed medium @a type. */ 186 186 UIMediumItem* mediumItem(UIMediumType type) const; … … 193 193 194 194 /** Returns medium type for passed @a pTreeWidget. */ 195 UIMediumType mediumType(Q TreeWidget *pTreeWidget) const;195 UIMediumType mediumType(QITreeWidget *pTreeWidget) const; 196 196 197 197 /** Returns current medium type. */ 198 198 UIMediumType currentMediumType() const; 199 199 /** Returns current tree-widget. */ 200 Q TreeWidget* currentTreeWidget() const;200 QITreeWidget* currentTreeWidget() const; 201 201 /** Returns current item. */ 202 202 UIMediumItem* currentMediumItem() const; 203 203 204 204 /** Defines current item for passed @a pTreeWidget as @a pItem. */ 205 void setCurrentItem(Q TreeWidget *pTreeWidget, QTreeWidgetItem *pItem);205 void setCurrentItem(QITreeWidget *pTreeWidget, QTreeWidgetItem *pItem); 206 206 207 207 /** Returns tab index for passed UIMediumType. */ … … 211 211 212 212 /** Performs search for the @a pTree child which corresponds to the @a condition but not @a pException. */ 213 static UIMediumItem* searchItem(Q TreeWidget *pTree, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);213 static UIMediumItem* searchItem(QITreeWidget *pTree, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0); 214 214 /** Performs search for the @a pParentItem child which corresponds to the @a condition but not @a pException. */ 215 215 static UIMediumItem* searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0); … … 244 244 const int m_iTabCount; 245 245 /** Tree-widgets. */ 246 QMap<int, Q TreeWidget*> m_trees;246 QMap<int, QITreeWidget*> m_trees; 247 247 /** Information-containers. */ 248 248 QMap<int, QFrame*> m_containers;
Note:
See TracChangeset
for help on using the changeset viewer.