Changeset 9217 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 29, 2008 11:36:05 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDiskImageManagerDlg.cpp
r9214 r9217 65 65 66 66 void setMedia (const VBoxMedia &aMedia) { mMedia = aMedia; } 67 const VBoxMedia & getMedia() const { return mMedia; }67 const VBoxMedia &media() const { return mMedia; } 68 68 69 69 void setPath (const QString &aPath) { mPath = aPath; } 70 const QString & getPath() const { return mPath; }70 const QString &path() const { return mPath; } 71 71 72 72 void setUsage (const QString &aUsage) { mUsage = aUsage; } 73 const QString & getUsage() const { return mUsage; }73 const QString &usage() const { return mUsage; } 74 74 75 75 void setSnapshotUsage (const QString &aSnapshotUsage) { mSnapshotUsage = aSnapshotUsage; } 76 const QString & getSnapshotUsage() const { return mSnapshotUsage; }77 78 QString getTotalUsage() const79 { 80 /* should correlate with VBoxDiskImageManagerDlg::compose[Cd/Fd]Tooltip */76 const QString &snapshotUsage() const { return mSnapshotUsage; } 77 78 QString totalUsage() const 79 { 80 /* Should correlate with VBoxDiskImageManagerDlg::compose[Cd/Fd]Tooltip */ 81 81 return mSnapshotUsage.isNull() ? mUsage : 82 82 QString ("%1 (%2)").arg (mUsage, mSnapshotUsage); … … 84 84 85 85 void setSnapshotName (const QString &aSnapshotName) { mSnapshotName = aSnapshotName; } 86 const QString & getSnapshotName() const { return mSnapshotName; }86 const QString &snapshotName() const { return mSnapshotName; } 87 87 88 88 void setDiskType (const QString &aDiskType) { mDiskType = aDiskType; } 89 const QString & getDiskType() const { return mDiskType; }89 const QString &diskType() const { return mDiskType; } 90 90 91 91 void setStorageType (const QString &aStorageType) { mStorageType = aStorageType; } 92 const QString & getStorageType() const { return mStorageType; }92 const QString &storageType() const { return mStorageType; } 93 93 94 94 void setVirtualSize (const QString &aVirtualSize) { mVirtualSize = aVirtualSize; } 95 const QString & getVirtualSize() const { return mVirtualSize; }95 const QString &virtualSize() const { return mVirtualSize; } 96 96 97 97 void setActualSize (const QString &aActualSize) { mActualSize = aActualSize; } 98 const QString & getActualSize() const { return mActualSize; }98 const QString &ActualSize() const { return mActualSize; } 99 99 100 100 void setUuid (const QUuid &aUuid) { mUuid = aUuid; } 101 const QUuid & getUuid() const { return mUuid; }101 const QUuid &uuid() const { return mUuid; } 102 102 103 103 void setMachineId (const QUuid &aMachineId) { mMachineId = aMachineId; } 104 const QUuid & getMachineId() const { return mMachineId; }104 const QUuid &machineId() const { return mMachineId; } 105 105 106 106 void setStatus (VBoxMedia::Status aStatus) { mStatus = aStatus; } 107 VBoxMedia::Status getStatus() const { return mStatus; }107 VBoxMedia::Status status() const { return mStatus; } 108 108 109 109 void setToolTip (const QString& aToolTip) … … 113 113 QTreeWidgetItem::setToolTip (i, mToolTip); 114 114 } 115 const QString & getToolTip() const { return mToolTip; }116 117 QString getInformation (const QString &aInfo, bool aCompact = true,118 115 const QString &toolTip() const { return mToolTip; } 116 117 QString information (const QString &aInfo, bool aCompact = true, 118 const QString &aElipsis = "middle") 119 119 { 120 120 QString compactString = QString ("<compact elipsis=\"%1\">").arg (aElipsis); … … 150 150 protected: 151 151 152 /* Protected member vars */ 152 153 VBoxMedia mMedia; 153 154 … … 186 187 DiskImageItemIterator& operator++() 187 188 { 188 return (DiskImageItemIterator&) QTreeWidgetItemIterator::operator++();189 return static_cast<DiskImageItemIterator&> (QTreeWidgetItemIterator::operator++()); 189 190 } 190 191 }; … … 197 198 : QIRichLabel (aParent), mLabel (aLabel) {} 198 199 199 QLabel* label() { return mLabel; }200 QLabel* label() const { return mLabel; } 200 201 201 202 private: 202 203 204 /* Private member vars */ 203 205 QLabel *mLabel; 204 206 }; … … 409 411 &vboxProblem(), SLOT (showHelpHelpDialog())); 410 412 411 412 413 /* Applying language settings */ 413 414 retranslateUi(); 414 415 } 415 416 416 417 417 void VBoxDiskImageManagerDlg::setup (int aType, bool aDoSelect, … … 525 525 int VBoxDiskImageManagerDlg::exec() 526 526 { 527 AssertMsg (!mEventLoop, ("exec is called recursively "));527 AssertMsg (!mEventLoop, ("exec is called recursively!\n")); 528 528 529 529 /* Reset the result code */ … … 558 558 DiskImageItem *item = toDiskImageItem (selectedItem (tree)); 559 559 if (item) 560 uuid = item-> getUuid();560 uuid = item->uuid(); 561 561 562 562 return uuid; … … 570 570 DiskImageItem *item = toDiskImageItem (selectedItem (tree)); 571 571 if (item) 572 path = item-> getPath().trimmed();572 path = item->path().trimmed(); 573 573 574 574 return path; … … 580 580 { 581 581 CVirtualBox vbox = vboxGlobal().virtualBox(); 582 QUuid machineId = aItem ? aItem-> getMachineId() : aHd.GetMachineId();583 584 QString src = aItem ? aItem-> getPath() : aHd.GetLocation();582 QUuid machineId = aItem ? aItem->machineId() : aHd.GetMachineId(); 583 584 QString src = aItem ? aItem->path() : aHd.GetLocation(); 585 585 QString location = aItem || aHd.GetStorageType() == KHardDiskStorageType_ISCSIHardDisk ? src : 586 586 QDir::convertSeparators (QFileInfo (src).absoluteFilePath()); 587 587 588 QString storageType = aItem ? aItem-> getStorageType() :588 QString storageType = aItem ? aItem->storageType() : 589 589 vboxGlobal().toString (aHd.GetStorageType()); 590 QString hardDiskType = aItem ? aItem-> getDiskType() :590 QString hardDiskType = aItem ? aItem->diskType() : 591 591 vboxGlobal().hardDiskTypeString (aHd); 592 592 593 593 QString usage; 594 594 if (aItem) 595 usage = aItem-> getUsage();595 usage = aItem->usage(); 596 596 else if (!machineId.isNull()) 597 597 usage = vbox.GetMachine (machineId).GetName(); 598 598 599 QUuid snapshotId = aItem ? aItem-> getUuid() : aHd.GetSnapshotId();599 QUuid snapshotId = aItem ? aItem->uuid() : aHd.GetSnapshotId(); 600 600 QString snapshotName; 601 601 if (aItem) 602 snapshotName = aItem-> getSnapshotName();602 snapshotName = aItem->snapshotName(); 603 603 else if (!machineId.isNull() && !snapshotId.isNull()) 604 604 { … … 664 664 DiskImageItem *aItem) 665 665 { 666 QString location = aItem ? aItem-> getPath() :666 QString location = aItem ? aItem->path() : 667 667 QDir::convertSeparators (QFileInfo (aCd.GetFilePath()).absoluteFilePath()); 668 QUuid uuid = aItem ? aItem-> getUuid() : aCd.GetId();668 QUuid uuid = aItem ? aItem->uuid() : aCd.GetId(); 669 669 QString usage; 670 670 if (aItem) 671 usage = aItem-> getTotalUsage();671 usage = aItem->totalUsage(); 672 672 else 673 673 { … … 730 730 DiskImageItem *aItem) 731 731 { 732 QString location = aItem ? aItem-> getPath() :732 QString location = aItem ? aItem->path() : 733 733 QDir::convertSeparators (QFileInfo (aFd.GetFilePath()).absoluteFilePath()); 734 QUuid uuid = aItem ? aItem-> getUuid() : aFd.GetId();734 QUuid uuid = aItem ? aItem->uuid() : aFd.GetId(); 735 735 QString usage; 736 736 if (aItem) 737 usage = aItem-> getTotalUsage();737 usage = aItem->totalUsage(); 738 738 else 739 739 { … … 961 961 case VBoxDefs::HD: 962 962 item = createHdItem (mHdsTree, aMedia); 963 if (item-> getUuid() == mHdSelectedId)963 if (item->uuid() == mHdSelectedId) 964 964 { 965 965 setCurrentItem (mHdsTree, item); … … 969 969 case VBoxDefs::CD: 970 970 item = createCdItem (mCdsTree, aMedia); 971 if (item-> getUuid() == mCdSelectedId)971 if (item->uuid() == mCdSelectedId) 972 972 { 973 973 setCurrentItem (mCdsTree, item); … … 977 977 case VBoxDefs::FD: 978 978 item = createFdItem (mFdsTree, aMedia); 979 if (item-> getUuid() == mFdSelectedId)979 if (item->uuid() == mFdSelectedId) 980 980 { 981 981 setCurrentItem (mFdsTree, item); … … 1140 1140 1141 1141 QString dir; 1142 if (item && item-> getStatus() == VBoxMedia::Ok)1143 dir = QFileInfo (item-> getPath().trimmed()).absolutePath ();1142 if (item && item->status() == VBoxMedia::Ok) 1143 dir = QFileInfo (item->path().trimmed()).absolutePath (); 1144 1144 1145 1145 if (dir.isEmpty()) … … 1196 1196 CVirtualBox vbox = vboxGlobal().virtualBox(); 1197 1197 1198 QUuid uuid = item-> getUuid();1198 QUuid uuid = item->uuid(); 1199 1199 AssertMsg (!uuid.isNull(), ("Current item must have uuid\n")); 1200 1200 1201 QString src = item-> getPath().trimmed();1201 QString src = item->path().trimmed(); 1202 1202 VBoxDefs::DiskType type = currentTreeWidgetType(); 1203 1203 … … 1211 1211 /// enable image deletion for them as well (use 1212 1212 /// GetStorageType() to define the correct cast). 1213 CHardDisk disk = item-> getMedia().disk;1213 CHardDisk disk = item->media().disk; 1214 1214 if (disk.GetStorageType() == KHardDiskStorageType_VirtualDiskImage && 1215 1215 disk.GetParent().isNull() && /* must not be differencing (see below) */ 1216 item-> getStatus() == VBoxMedia::Ok)1216 item->status() == VBoxMedia::Ok) 1217 1217 { 1218 1218 int rc = vboxProblem().confirmHardDiskImageDeletion (this, src); … … 1273 1273 CVirtualBox vbox = vboxGlobal().virtualBox(); 1274 1274 1275 QUuid itemId = item-> getUuid();1275 QUuid itemId = item->uuid(); 1276 1276 AssertMsg (!itemId.isNull(), ("Current item must have uuid\n")); 1277 1277 … … 1281 1281 case VBoxDefs::HD: 1282 1282 { 1283 CHardDisk hd = item-> getMedia().disk;1283 CHardDisk hd = item->media().disk; 1284 1284 QUuid machineId = hd.GetMachineId(); 1285 1285 if (vboxProblem().confirmReleaseImage (this, … … 1287 1287 { 1288 1288 releaseDisk (machineId, itemId, VBoxDefs::HD); 1289 VBoxMedia media (item-> getMedia());1289 VBoxMedia media (item->media()); 1290 1290 media.status = hd.GetAccessible() ? VBoxMedia::Ok : 1291 1291 hd.isOk() ? VBoxMedia::Inaccessible : … … 1298 1298 case VBoxDefs::CD: 1299 1299 { 1300 QString usage = item-> getTotalUsage();1300 QString usage = item->totalUsage(); 1301 1301 if (vboxProblem().confirmReleaseImage (this, usage)) 1302 1302 { … … 1309 1309 1310 1310 CDVDImage cd = vbox.GetDVDImage (itemId); 1311 VBoxMedia media (item-> getMedia());1311 VBoxMedia media (item->media()); 1312 1312 media.status = cd.GetAccessible() ? VBoxMedia::Ok : 1313 1313 cd.isOk() ? VBoxMedia::Inaccessible : … … 1319 1319 case VBoxDefs::FD: 1320 1320 { 1321 QString usage = item-> getTotalUsage();1321 QString usage = item->totalUsage(); 1322 1322 if (vboxProblem().confirmReleaseImage (this, usage)) 1323 1323 { … … 1330 1330 1331 1331 CFloppyImage fd = vbox.GetFloppyImage (itemId); 1332 VBoxMedia media (item-> getMedia());1332 VBoxMedia media (item->media()); 1333 1333 media.status = fd.GetAccessible() ? VBoxMedia::Ok : 1334 1334 fd.isOk() ? VBoxMedia::Inaccessible : … … 1558 1558 bool notInEnum = !vboxGlobal().isMediaEnumerationStarted(); 1559 1559 bool modifyEnabled = notInEnum && 1560 item && item-> getUsage().isNull() &&1561 (item->childCount() == 0) && !item-> getPath().isNull();1562 bool releaseEnabled = item && !item-> getUsage().isNull() &&1563 item-> getSnapshotUsage().isNull() &&1560 item && item->usage().isNull() && 1561 (item->childCount() == 0) && !item->path().isNull(); 1562 bool releaseEnabled = item && !item->usage().isNull() && 1563 item->snapshotUsage().isNull() && 1564 1564 checkImage (item) && 1565 1565 !item->parent() && (item->childCount() == 0) && 1566 item-> getSnapshotName().isNull();1566 item->snapshotName().isNull(); 1567 1567 bool newEnabled = notInEnum && 1568 1568 currentTreeWidget() == mHdsTree ? true : false; … … 1579 1579 bool selectEnabled = item && !item->parent() && 1580 1580 (!newEnabled || 1581 (item-> getUsage().isNull() ||1582 item-> getMachineId() == mTargetVMId));1581 (item->usage().isNull() || 1582 item->machineId() == mTargetVMId)); 1583 1583 1584 1584 mButtonBox->button (QDialogButtonBox::Ok)->setEnabled (selectEnabled); … … 1589 1589 if (item->treeWidget() == mHdsTree) 1590 1590 { 1591 mHdsPane1->setText (item-> getInformation (item->getPath(), true, "end"));1592 mHdsPane2->setText (item-> getInformation (item->getDiskType(), false));1593 mHdsPane3->setText (item-> getInformation (item->getStorageType(), false));1594 mHdsPane4->setText (item-> getInformation (item->getUsage()));1595 mHdsPane5->setText (item-> getInformation (item->getSnapshotName()));1591 mHdsPane1->setText (item->information (item->path(), true, "end")); 1592 mHdsPane2->setText (item->information (item->diskType(), false)); 1593 mHdsPane3->setText (item->information (item->storageType(), false)); 1594 mHdsPane4->setText (item->information (item->usage())); 1595 mHdsPane5->setText (item->information (item->snapshotName())); 1596 1596 } 1597 1597 else if (item->treeWidget() == mCdsTree) 1598 1598 { 1599 mCdsPane1->setText (item-> getInformation (item->getPath(), true, "end"));1600 mCdsPane2->setText (item-> getInformation (item->getTotalUsage()));1599 mCdsPane1->setText (item->information (item->path(), true, "end")); 1600 mCdsPane2->setText (item->information (item->totalUsage())); 1601 1601 } 1602 1602 else if (item->treeWidget() == mFdsTree) 1603 1603 { 1604 mFdsPane1->setText (item-> getInformation (item->getPath(), true, "end"));1605 mFdsPane2->setText (item-> getInformation (item->getTotalUsage()));1604 mFdsPane1->setText (item->information (item->path(), true, "end")); 1605 mFdsPane2->setText (item->information (item->totalUsage())); 1606 1606 } 1607 1607 } … … 1866 1866 while (*iterator) 1867 1867 { 1868 if ((*iterator)-> getUuid() == aId)1868 if ((*iterator)->uuid() == aId) 1869 1869 return *iterator; 1870 1870 ++iterator; … … 1879 1879 while (*iterator) 1880 1880 { 1881 if ((*iterator)-> getStatus() == aStatus)1881 if ((*iterator)->status() == aStatus) 1882 1882 return *iterator; 1883 1883 ++iterator; … … 1888 1888 bool VBoxDiskImageManagerDlg::checkImage (DiskImageItem *aItem) 1889 1889 { 1890 QUuid itemId = aItem ? aItem-> getUuid() : QUuid();1890 QUuid itemId = aItem ? aItem->uuid() : QUuid(); 1891 1891 if (itemId.isNull()) 1892 1892 return false; … … 1898 1898 case VBoxDefs::HD: 1899 1899 { 1900 CHardDisk hd = aItem-> getMedia().disk;1900 CHardDisk hd = aItem->media().disk; 1901 1901 QUuid machineId = hd.GetMachineId(); 1902 1902 if (machineId.isNull() || … … 2027 2027 di = toDiskImageItem (mHdsTree->currentItem()); 2028 2028 if (mHdSelectedId.isNull()) 2029 mHdSelectedId = di ? di-> getUuid() : QUuid();2029 mHdSelectedId = di ? di->uuid() : QUuid(); 2030 2030 2031 2031 di = toDiskImageItem (mCdsTree->currentItem()); 2032 2032 if (mCdSelectedId.isNull()) 2033 mCdSelectedId = di ? di-> getUuid() : QUuid();2033 mCdSelectedId = di ? di->uuid() : QUuid(); 2034 2034 2035 2035 di = toDiskImageItem (mFdsTree->currentItem()); 2036 2036 if (mFdSelectedId.isNull()) 2037 mFdSelectedId = di ? di-> getUuid() : QUuid();2037 mFdSelectedId = di ? di->uuid() : QUuid(); 2038 2038 2039 2039 /* Finally, clear all lists */
Note:
See TracChangeset
for help on using the changeset viewer.