- Timestamp:
- Jun 11, 2008 1:40:32 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDiskImageManagerDlg.h
r9449 r9612 141 141 VBoxProgressBar *mProgressBar; 142 142 143 /* The global VirtualBox instance */ 144 CVirtualBox mVBox; 145 143 146 /* Type if we are in the select modus */ 144 147 int mType; -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDiskImageManagerDlg.cpp
r9569 r9612 251 251 Ui::VBoxDiskImageManagerDlg::setupUi (this); 252 252 253 // defaultButton = searchDefaultButton(); 253 mVBox = vboxGlobal().virtualBox(); 254 Assert (!mVBox.isNull()); 254 255 255 256 mType = VBoxDefs::InvalidType; … … 585 586 { 586 587 CVirtualBox vbox = vboxGlobal().virtualBox(); 588 587 589 QUuid machineId = aItem ? aItem->machineId() : aHd.GetMachineId(); 588 590 … … 871 873 if (deEvent->mimeData()->hasUrls()) 872 874 { 873 if (checkDndUrls (deEvent->mimeData()->urls())) 875 QList<QUrl> urls = deEvent->mimeData()->urls(); 876 /* Sometimes urls has an empty Url entry. Filter them out. */ 877 urls.removeAll (QUrl()); 878 if (checkDndUrls (urls)) 874 879 { 875 880 deEvent->setDropAction (Qt::LinkAction); … … 885 890 if (dEvent->mimeData()->hasUrls()) 886 891 { 887 AddVDMUrlsEvent *event = new AddVDMUrlsEvent (dEvent->mimeData()->urls()); 892 QList<QUrl> urls = dEvent->mimeData()->urls(); 893 /* Sometimes urls has an empty Url entry. Filter them out. */ 894 urls.removeAll (QUrl()); 895 AddVDMUrlsEvent *event = new AddVDMUrlsEvent (urls); 888 896 QApplication::postEvent (currentTreeWidget(), event); 889 897 dEvent->acceptProposedAction(); … … 1116 1124 DiskImageItem *item = toDiskImageItem (tree->currentItem()); 1117 1125 1118 CVirtualBox vbox = vboxGlobal().virtualBox();1126 mVBox = vboxGlobal().virtualBox(); 1119 1127 1120 1128 QString title; … … 1128 1136 if (dir.isEmpty()) 1129 1137 if (type == VBoxDefs::HD) 1130 dir = vbox.GetSystemProperties().GetDefaultVDIFolder();1138 dir = mVBox.GetSystemProperties().GetDefaultVDIFolder(); 1131 1139 1132 1140 if (dir.isEmpty() || !QFileInfo (dir).exists()) 1133 dir = vbox.GetHomeFolder();1141 dir = mVBox.GetHomeFolder(); 1134 1142 1135 1143 switch (type) … … 1167 1175 1168 1176 addImageToList (src, type); 1169 if (! vbox.isOk())1170 vboxProblem().cannotRegisterMedia (this, vbox, type, src);1177 if (!mVBox.isOk()) 1178 vboxProblem().cannotRegisterMedia (this, mVBox, type, src); 1171 1179 } 1172 1180 … … 1176 1184 DiskImageItem *item = toDiskImageItem (tree->currentItem()); 1177 1185 AssertMsg (item, ("Current item must not be null\n")); 1178 1179 CVirtualBox vbox = vboxGlobal().virtualBox();1180 1186 1181 1187 QUuid uuid = item->uuid(); … … 1215 1221 } 1216 1222 1217 CHardDisk hd = vbox.UnregisterHardDisk (uuid);1218 if (! vbox.isOk())1219 vboxProblem().cannotUnregisterMedia (this, vbox, type, src);1223 CHardDisk hd = mVBox.UnregisterHardDisk (uuid); 1224 if (!mVBox.isOk()) 1225 vboxProblem().cannotUnregisterMedia (this, mVBox, type, src); 1220 1226 else if (deleteImage) 1221 1227 { … … 1232 1238 } 1233 1239 case VBoxDefs::CD: 1234 vbox.UnregisterDVDImage (uuid);1240 mVBox.UnregisterDVDImage (uuid); 1235 1241 break; 1236 1242 case VBoxDefs::FD: 1237 vbox.UnregisterFloppyImage (uuid);1243 mVBox.UnregisterFloppyImage (uuid); 1238 1244 break; 1239 1245 default: … … 1242 1248 } 1243 1249 1244 if ( vbox.isOk())1250 if (mVBox.isOk()) 1245 1251 vboxGlobal().removeMedia (type, uuid); 1246 1252 else 1247 vboxProblem().cannotUnregisterMedia (this, vbox, type, src);1253 vboxProblem().cannotUnregisterMedia (this, mVBox, type, src); 1248 1254 } 1249 1255 … … 1253 1259 DiskImageItem *item = toDiskImageItem (tree->currentItem()); 1254 1260 AssertMsg (item, ("Current item must not be null\n")); 1255 1256 CVirtualBox vbox = vboxGlobal().virtualBox();1257 1261 1258 1262 QUuid itemId = item->uuid(); … … 1267 1271 QUuid machineId = hd.GetMachineId(); 1268 1272 if (vboxProblem().confirmReleaseImage (this, 1269 vbox.GetMachine (machineId).GetName()))1273 mVBox.GetMachine (machineId).GetName())) 1270 1274 { 1271 1275 releaseDisk (machineId, itemId, VBoxDefs::HD); … … 1285 1289 { 1286 1290 QStringList permMachines = 1287 vbox.GetDVDImageUsage (itemId,1291 mVBox.GetDVDImageUsage (itemId, 1288 1292 KResourceUsage_Permanent).split (' ', QString::SkipEmptyParts); 1289 1293 for (QStringList::Iterator it = permMachines.begin(); … … 1291 1295 releaseDisk (QUuid (*it), itemId, VBoxDefs::CD); 1292 1296 1293 CDVDImage cd = vbox.GetDVDImage (itemId);1297 CDVDImage cd = mVBox.GetDVDImage (itemId); 1294 1298 VBoxMedia media (item->media()); 1295 1299 media.status = cd.GetAccessible() ? VBoxMedia::Ok : … … 1306 1310 { 1307 1311 QStringList permMachines = 1308 vbox.GetFloppyImageUsage (itemId,1312 mVBox.GetFloppyImageUsage (itemId, 1309 1313 KResourceUsage_Permanent).split (' ', QString::SkipEmptyParts); 1310 1314 for (QStringList::Iterator it = permMachines.begin(); … … 1312 1316 releaseDisk (QUuid (*it), itemId, VBoxDefs::FD); 1313 1317 1314 CFloppyImage fd = vbox.GetFloppyImage (itemId);1318 CFloppyImage fd = mVBox.GetFloppyImage (itemId); 1315 1319 VBoxMedia media (item->media()); 1316 1320 media.status = fd.GetAccessible() ? VBoxMedia::Ok : … … 1590 1594 return; 1591 1595 1592 CVirtualBox vbox = vboxGlobal().virtualBox();1593 1594 1596 QUuid uuid; 1595 1597 VBoxMedia media; … … 1598 1600 case VBoxDefs::HD: 1599 1601 { 1600 CHardDisk hd = vbox.OpenHardDisk (aSource);1601 if ( vbox.isOk())1602 CHardDisk hd = mVBox.OpenHardDisk (aSource); 1603 if (mVBox.isOk()) 1602 1604 { 1603 vbox.RegisterHardDisk (hd);1604 if ( vbox.isOk())1605 mVBox.RegisterHardDisk (hd); 1606 if (mVBox.isOk()) 1605 1607 { 1606 1608 VBoxMedia::Status status = … … 1615 1617 case VBoxDefs::CD: 1616 1618 { 1617 CDVDImage cd = vbox.OpenDVDImage (aSource, uuid);1618 if ( vbox.isOk())1619 CDVDImage cd = mVBox.OpenDVDImage (aSource, uuid); 1620 if (mVBox.isOk()) 1619 1621 { 1620 vbox.RegisterDVDImage (cd);1621 if ( vbox.isOk())1622 mVBox.RegisterDVDImage (cd); 1623 if (mVBox.isOk()) 1622 1624 { 1623 1625 VBoxMedia::Status status = … … 1632 1634 case VBoxDefs::FD: 1633 1635 { 1634 CFloppyImage fd = vbox.OpenFloppyImage (aSource, uuid);1635 if ( vbox.isOk())1636 CFloppyImage fd = mVBox.OpenFloppyImage (aSource, uuid); 1637 if (mVBox.isOk()) 1636 1638 { 1637 vbox.RegisterFloppyImage (fd);1638 if ( vbox.isOk())1639 mVBox.RegisterFloppyImage (fd); 1640 if (mVBox.isOk()) 1639 1641 { 1640 1642 VBoxMedia::Status status = … … 1848 1850 return false; 1849 1851 1850 CVirtualBox vbox = vboxGlobal().virtualBox();1851 1852 1852 switch (currentTreeWidgetType()) 1853 1853 { … … 1857 1857 QUuid machineId = hd.GetMachineId(); 1858 1858 if (machineId.isNull() || 1859 ( vbox.GetMachine (machineId).GetState() != KMachineState_PoweredOff &&1860 vbox.GetMachine (machineId).GetState() != KMachineState_Aborted))1859 (mVBox.GetMachine (machineId).GetState() != KMachineState_PoweredOff && 1860 mVBox.GetMachine (machineId).GetState() != KMachineState_Aborted)) 1861 1861 return false; 1862 1862 break; … … 1866 1866 /* Check if there is temporary usage: */ 1867 1867 QStringList tempMachines = 1868 vbox.GetDVDImageUsage (itemId,1868 mVBox.GetDVDImageUsage (itemId, 1869 1869 KResourceUsage_Temporary).split (' ', QString::SkipEmptyParts); 1870 1870 if (!tempMachines.isEmpty()) … … 1872 1872 /* Only permanently mounted .iso could be released */ 1873 1873 QStringList permMachines = 1874 vbox.GetDVDImageUsage (itemId,1874 mVBox.GetDVDImageUsage (itemId, 1875 1875 KResourceUsage_Permanent).split (' ', QString::SkipEmptyParts); 1876 1876 for (QStringList::Iterator it = permMachines.begin(); 1877 1877 it != permMachines.end(); ++it) 1878 if ( vbox.GetMachine(QUuid (*it)).GetState() != KMachineState_PoweredOff &&1879 vbox.GetMachine(QUuid (*it)).GetState() != KMachineState_Aborted)1878 if (mVBox.GetMachine(QUuid (*it)).GetState() != KMachineState_PoweredOff && 1879 mVBox.GetMachine(QUuid (*it)).GetState() != KMachineState_Aborted) 1880 1880 return false; 1881 1881 break; … … 1885 1885 /* Check if there is temporary usage: */ 1886 1886 QStringList tempMachines = 1887 vbox.GetFloppyImageUsage (itemId,1887 mVBox.GetFloppyImageUsage (itemId, 1888 1888 KResourceUsage_Temporary).split (' ', QString::SkipEmptyParts); 1889 1889 if (!tempMachines.isEmpty()) … … 1891 1891 /* Only permanently mounted floppies could be released */ 1892 1892 QStringList permMachines = 1893 vbox.GetFloppyImageUsage (itemId,1893 mVBox.GetFloppyImageUsage (itemId, 1894 1894 KResourceUsage_Permanent).split (' ', QString::SkipEmptyParts); 1895 1895 for (QStringList::Iterator it = permMachines.begin(); 1896 1896 it != permMachines.end(); ++it) 1897 if ( vbox.GetMachine(QUuid (*it)).GetState() != KMachineState_PoweredOff &&1898 vbox.GetMachine(QUuid (*it)).GetState() != KMachineState_Aborted)1897 if (mVBox.GetMachine(QUuid (*it)).GetState() != KMachineState_PoweredOff && 1898 mVBox.GetMachine(QUuid (*it)).GetState() != KMachineState_Aborted) 1899 1899 return false; 1900 1900 break; … … 1942 1942 void VBoxDiskImageManagerDlg::addDndUrls (const QList<QUrl> &aUrls) 1943 1943 { 1944 CVirtualBox vbox = vboxGlobal().virtualBox();1945 1944 foreach (QUrl u, aUrls) 1946 1945 { … … 1948 1947 VBoxDefs::DiskType type = currentTreeWidgetType(); 1949 1948 addImageToList (file, type); 1950 if (! vbox.isOk())1951 vboxProblem().cannotRegisterMedia (this, vbox, type, file);1949 if (!mVBox.isOk()) 1950 vboxProblem().cannotRegisterMedia (this, mVBox, type, file); 1952 1951 } 1953 1952 }
Note:
See TracChangeset
for help on using the changeset viewer.