Changeset 563 in vbox for trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h
- Timestamp:
- Feb 2, 2007 4:44:41 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h
r548 r563 146 146 147 147 148 void VBoxDiskImageManagerDlg::showModeless ( const VBoxMediaList *list /* = NULL*/)148 void VBoxDiskImageManagerDlg::showModeless (bool aRefresh /* = true */) 149 149 { 150 150 if (!mModelessDialog) … … 155 155 WType_TopLevel | WDestructiveClose); 156 156 mModelessDialog->setup (VBoxDefs::HD | VBoxDefs::CD | VBoxDefs::FD, 157 false, NULL, list);157 false, NULL, aRefresh); 158 158 159 159 /* listen to events that may change the media status and refresh … … 1211 1211 1212 1212 void VBoxDiskImageManagerDlg::setup (int aType, bool aDoSelect, 1213 const QUuid *aTargetVMId ,1214 const VBoxMediaList *mediaList,1215 CMachine machine )1213 const QUuid *aTargetVMId /* = NULL */, 1214 bool aRefresh /* = true */, 1215 CMachine machine /* = NULL */) 1216 1216 { 1217 1217 cmachine = machine; … … 1251 1251 this, SLOT (mediaRemoved (VBoxDefs::DiskType, const QUuid &))); 1252 1252 1253 /* insert already enumerated media */ 1254 VBoxMediaList list = mediaList ? 1255 *mediaList : vboxGlobal().currentMediaList(); 1253 if (aRefresh && !vboxGlobal().isMediaEnumerationStarted()) 1254 { 1255 vboxGlobal().startEnumeratingMedia(); 1256 } 1257 else 1258 { 1259 /* insert already enumerated media */ 1260 const VBoxMediaList &list = vboxGlobal().currentMediaList(); 1261 prepareToRefresh (list.size()); 1262 VBoxMediaList::const_iterator it; 1263 int index = 0; 1264 for (it = list.begin(); it != list.end(); ++ it) 1265 { 1266 mediaAdded (*it); 1267 if ((*it).status != VBoxMedia::Unknown) 1268 mProgressBar->setProgress (++ index); 1269 } 1270 1271 /* select first child */ 1272 setCurrentItem (hdsView, hdsView->firstChild()); 1273 setCurrentItem (cdsView, cdsView->firstChild()); 1274 setCurrentItem (fdsView, fdsView->firstChild()); 1275 1276 /* emulate the finished signal to reuse the code */ 1277 if (!vboxGlobal().isMediaEnumerationStarted()) 1278 mediaEnumFinished (list); 1279 } 1280 } 1281 1282 1283 void VBoxDiskImageManagerDlg::mediaEnumStarted() 1284 { 1285 /* load current media list */ 1286 const VBoxMediaList &list = vboxGlobal().currentMediaList(); 1256 1287 prepareToRefresh (list.size()); 1257 VBoxMediaList::const_iterator it;1258 int index = 0;1259 for (it = list.begin(); it != list.end(); ++ it)1260 {1261 mediaAdded (*it);1262 if ((*it).status != VBoxMedia::Unknown)1263 mProgressBar->setProgress (index ++);1264 }1265 /* select first child */1266 setCurrentItem (hdsView, hdsView->firstChild());1267 setCurrentItem (cdsView, cdsView->firstChild());1268 setCurrentItem (fdsView, fdsView->firstChild());1269 1270 if (mediaList)1271 {1272 mediaEnumFinished (list);1273 }1274 else1275 {1276 /* only start enumerating media if we haven't been supplied a list1277 * (it's ok if the enumeration has been already started, nothing will1278 * happen) */1279 vboxGlobal().startEnumeratingMedia();1280 }1281 }1282 1283 1284 void VBoxDiskImageManagerDlg::mediaEnumStarted()1285 {1286 VBoxMediaList list = vboxGlobal().currentMediaList();1287 prepareToRefresh (list.size());1288 /* clearing lists */1289 hdsView->clear(), cdsView->clear(), fdsView->clear();1290 /* load current media list */1291 1288 VBoxMediaList::const_iterator it; 1292 1289 for (it = list.begin(); it != list.end(); ++ it) 1293 1290 mediaAdded (*it); 1294 1291 /* select first child */ 1295 if (!hdsView-> isSelected (hdsView->currentItem()))1292 if (!hdsView->currentItem()) 1296 1293 setCurrentItem (hdsView, hdsView->firstChild()); 1297 if (!cdsView-> isSelected (cdsView->currentItem()))1294 if (!cdsView->currentItem()) 1298 1295 setCurrentItem (cdsView, cdsView->firstChild()); 1299 if (!fdsView-> isSelected (fdsView->currentItem()))1296 if (!fdsView->currentItem()) 1300 1297 setCurrentItem (fdsView, fdsView->firstChild()); 1301 1298 … … 1307 1304 { 1308 1305 mediaUpdated (aMedia); 1306 Assert (aMedia.status != VBoxMedia::Unknown); 1309 1307 if (aMedia.status != VBoxMedia::Unknown) 1310 mProgressBar->setProgress (aIndex );1308 mProgressBar->setProgress (aIndex + 1); 1311 1309 } 1312 1310 … … 1318 1316 imRefreshAction->setEnabled (true); 1319 1317 unsetCursor(); 1318 1319 /* adjust columns (it is strange to repeat but it works) */ 1320 1321 hdsView->adjustColumn (1); 1322 hdsView->adjustColumn (2); 1323 hdsView->adjustColumn (1); 1324 1325 cdsView->adjustColumn (1); 1326 cdsView->adjustColumn (2); 1327 cdsView->adjustColumn (1); 1328 1329 fdsView->adjustColumn (1); 1330 fdsView->adjustColumn (2); 1331 fdsView->adjustColumn (1); 1320 1332 1321 1333 processCurrentChanged(); … … 1450 1462 imRefreshAction->setEnabled (false); 1451 1463 setCursor (QCursor (BusyCursor)); 1464 1465 /* store the current list selections */ 1466 1467 QListViewItem *item; 1468 DiskImageItem *di; 1469 1470 item = hdsView->currentItem(); 1471 di = (item && item->rtti() == 1001) ? static_cast <DiskImageItem *> (item) : 0; 1472 hdSelectedId = di ? di->getUuid() : QUuid(); 1473 1474 item = cdsView->currentItem(); 1475 di = (item && item->rtti() == 1001) ? static_cast <DiskImageItem *> (item) : 0; 1476 cdSelectedId = di ? di->getUuid() : QUuid(); 1477 1478 item = fdsView->currentItem(); 1479 di = (item && item->rtti() == 1001) ? static_cast <DiskImageItem *> (item) : 0; 1480 fdSelectedId = di ? di->getUuid() : QUuid(); 1481 1482 /* finally, clear all lists */ 1483 hdsView->clear(); 1484 cdsView->clear(); 1485 fdsView->clear(); 1452 1486 } 1453 1487 … … 1528 1562 aListView->setCurrentItem (aItem); 1529 1563 aListView->setSelected (aListView->currentItem(), true); 1530 /* it is strange repeat but it works */1531 aListView->adjustColumn (1);1532 aListView->adjustColumn (2);1533 aListView->adjustColumn (1);1534 1564 } 1535 1565 … … 1608 1638 hdsPane4->setText (item->getInformation (item->getUsage())); 1609 1639 hdsPane5->setText (item->getInformation (item->getSnapshotName())); 1610 hdSelectedId = item->getUuid();1611 1640 } 1612 1641 else if (item->listView() == cdsView) … … 1614 1643 cdsPane1->setText (item->getInformation (item->getPath(), true, "end")); 1615 1644 cdsPane2->setText (item->getInformation (item->getUsage())); 1616 cdSelectedId = item->getUuid();1617 1645 } 1618 1646 else if (item->listView() == fdsView) … … 1620 1648 fdsPane1->setText (item->getInformation (item->getPath(), true, "end")); 1621 1649 fdsPane2->setText (item->getInformation (item->getUsage())); 1622 fdSelectedId = item->getUuid();1623 1650 } 1624 1651 }
Note:
See TracChangeset
for help on using the changeset viewer.