Changeset 50330 in vbox
- Timestamp:
- Feb 5, 2014 2:29: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
r50329 r50330 607 607 updateActions(); 608 608 609 /* Update information-panes: */ 610 if (pMediumItem) 611 { 612 QString strDetails = pMediumItem->details(); 613 QString strUsage = pMediumItem->usage().isNull() ? 614 formatPaneText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) : 615 formatPaneText(pMediumItem->usage()); 616 if (pMediumItem->treeWidget() == mTwHD) 617 { 618 m_pTypePane->setText(pMediumItem->hardDiskType()); 619 m_pLocationPane->setText(formatPaneText(pMediumItem->location(), true, "end")); 620 m_pFormatPane->setText(pMediumItem->hardDiskFormat()); 621 m_pDetailsPane->setText(strDetails); 622 m_pUsagePane->setText(strUsage); 623 } 624 else if (pMediumItem->treeWidget() == mTwCD) 625 { 626 mIpCD1->setText(formatPaneText(pMediumItem->location(), true, "end")); 627 mIpCD2->setText(strUsage); 628 } 629 else if (pMediumItem->treeWidget() == mTwFD) 630 { 631 mIpFD1->setText(formatPaneText(pMediumItem->location(), true, "end")); 632 mIpFD2->setText(strUsage); 633 } 634 } 635 else 636 clearInfoPanes(); 637 638 /* Enable/disable information-pane containers: */ 639 mHDContainer->setEnabled(pMediumItem); 640 mCDContainer->setEnabled(pMediumItem); 641 mFDContainer->setEnabled(pMediumItem); 609 /* Update current information-panes: */ 610 updateInformationPanes(currentMediumType()); 642 611 } 643 612 … … 735 704 /* Populate content for tree-widgets: */ 736 705 populateTreeWidgets(); 706 707 /* Update all information-panes: */ 708 updateInformationPanes(UIMediumType_All); 737 709 } 738 710 … … 1182 1154 } 1183 1155 1156 void UIMediumManager::updateInformationPanes(UIMediumType type /* = UIMediumType_Invalid */) 1157 { 1158 /* Make sure type is valid: */ 1159 if (type == UIMediumType_Invalid) 1160 type = currentMediumType(); 1161 1162 /* Depending on required type: */ 1163 switch (type) 1164 { 1165 case UIMediumType_HardDisk: updateInformationPanesHD(); break; 1166 case UIMediumType_DVD: updateInformationPanesCD(); break; 1167 case UIMediumType_Floppy: updateInformationPanesFD(); break; 1168 case UIMediumType_All: 1169 updateInformationPanesHD(); 1170 updateInformationPanesCD(); 1171 updateInformationPanesFD(); 1172 break; 1173 default: break; 1174 } 1175 } 1176 1177 void UIMediumManager::updateInformationPanesHD() 1178 { 1179 /* Get current HD item: */ 1180 UIMediumItem *pCurrentItem = mediumItem(UIMediumType_HardDisk); 1181 1182 /* If current item is not set: */ 1183 if (!pCurrentItem) 1184 { 1185 /* Just clear information panes: */ 1186 m_pTypePane->clear(); 1187 m_pLocationPane->clear(); 1188 m_pFormatPane->clear(); 1189 m_pDetailsPane->clear(); 1190 m_pUsagePane->clear(); 1191 } 1192 /* If current item is set: */ 1193 else 1194 { 1195 /* Acquire required details: */ 1196 QString strDetails = pCurrentItem->details(); 1197 QString strUsage = pCurrentItem->usage().isNull() ? 1198 formatPaneText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) : 1199 formatPaneText(pCurrentItem->usage()); 1200 m_pTypePane->setText(pCurrentItem->hardDiskType()); 1201 m_pLocationPane->setText(formatPaneText(pCurrentItem->location(), true, "end")); 1202 m_pFormatPane->setText(pCurrentItem->hardDiskFormat()); 1203 m_pDetailsPane->setText(strDetails); 1204 m_pUsagePane->setText(strUsage); 1205 } 1206 1207 /* Enable/disable information-panes container: */ 1208 mHDContainer->setEnabled(pCurrentItem); 1209 } 1210 1211 void UIMediumManager::updateInformationPanesCD() 1212 { 1213 /* Get current optical medium-item: */ 1214 UIMediumItem *pCurrentItem = mediumItem(UIMediumType_DVD); 1215 1216 /* If current item is not set: */ 1217 if (!pCurrentItem) 1218 { 1219 /* Just clear information panes: */ 1220 mIpCD1->clear(); 1221 mIpCD2->clear(); 1222 } 1223 /* If current item is set: */ 1224 else 1225 { 1226 /* Update required details: */ 1227 QString strUsage = pCurrentItem->usage().isNull() ? 1228 formatPaneText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) : 1229 formatPaneText(pCurrentItem->usage()); 1230 mIpCD1->setText(formatPaneText(pCurrentItem->location(), true, "end")); 1231 mIpCD2->setText(strUsage); 1232 } 1233 1234 /* Enable/disable information-panes container: */ 1235 mCDContainer->setEnabled(pCurrentItem); 1236 } 1237 1238 void UIMediumManager::updateInformationPanesFD() 1239 { 1240 /* Get current floppy medium-item: */ 1241 UIMediumItem *pCurrentItem = mediumItem(UIMediumType_Floppy); 1242 1243 /* If current item is not set: */ 1244 if (!pCurrentItem) 1245 { 1246 /* Just clear information panes: */ 1247 mIpFD1->clear(); 1248 mIpFD2->clear(); 1249 } 1250 /* If current item is set: */ 1251 else 1252 { 1253 /* Update required details: */ 1254 QString strUsage = pCurrentItem->usage().isNull() ? 1255 formatPaneText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) : 1256 formatPaneText(pCurrentItem->usage()); 1257 mIpFD1->setText(formatPaneText(pCurrentItem->location(), true, "end")); 1258 mIpFD2->setText(strUsage); 1259 } 1260 1261 /* Enable/disable information-panes container: */ 1262 mFDContainer->setEnabled(pCurrentItem); 1263 } 1264 1184 1265 #ifdef Q_WS_MAC 1185 1266 void UIMediumManager::cleanupMacWindowMenu() … … 1687 1768 } 1688 1769 1689 void UIMediumManager::clearInfoPanes() 1690 { 1770 void UIMediumManager::prepareToRefresh(int iTotal) 1771 { 1772 /* Clear information panes: */ 1691 1773 m_pTypePane->clear(); m_pLocationPane->clear(); m_pFormatPane->clear(); m_pDetailsPane->clear(); m_pUsagePane->clear(); 1692 1774 mIpCD1->clear(); mIpCD2->clear(); 1693 1775 mIpFD1->clear(); mIpFD2->clear(); 1694 }1695 1696 void UIMediumManager::prepareToRefresh(int iTotal)1697 {1698 /* Info panel clearing: */1699 clearInfoPanes();1700 1776 1701 1777 /* Prepare progressbar: */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r50329 r50330 125 125 /** Update tab icons according last @a action happened with @a pItem. */ 126 126 void updateTabIcons(UIMediumItem *pItem, ItemAction action); 127 /** Update information pane of passed medium @a type. */ 128 void updateInformationPanes(UIMediumType type = UIMediumType_Invalid); 129 /** Update information pane for hard-drive tab. */ 130 void updateInformationPanesHD(); 131 /** Update information pane for optical-disk tab. */ 132 void updateInformationPanesCD(); 133 /** Update information pane for floppy-disk tab. */ 134 void updateInformationPanesFD(); 127 135 128 136 /* Helpers: Cleanup stuff: */ … … 168 176 /* Helpers: Other stuff: */ 169 177 bool checkMediumFor(UIMediumItem *pItem, Action action); 170 void clearInfoPanes();171 178 void prepareToRefresh(int iTotal = 0); 172 179
Note:
See TracChangeset
for help on using the changeset viewer.