Changeset 23225 in vbox
- Timestamp:
- Sep 22, 2009 4:02:40 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h
r23223 r23225 320 320 QString attMediumId() const; 321 321 QStringList attMediumIds (bool aFilter = true) const; 322 bool attIsShowDiffs() const; 322 323 bool attIsHostDrive() const; 323 324 bool attIsPassthrough() const; … … 326 327 void setAttDevice (KDeviceType aAttDeviceType); 327 328 void setAttMediumId (const QString &aAttMediumId); 329 void setAttIsShowDiffs (bool aAttIsShowDiffs); 328 330 void setAttIsPassthrough (bool aPassthrough); 329 331 … … 336 338 private: 337 339 338 void cache (const VBoxMedium &aMedium);340 void cache(); 339 341 340 342 void addChild (AbstractItem *aItem); … … 345 347 StorageSlot mAttSlot; 346 348 QString mAttMediumId; 349 bool mAttIsShowDiffs; 347 350 bool mAttIsHostDrive; 348 351 bool mAttIsPassthrough; … … 391 394 R_AttDevices, 392 395 R_AttMediumId, 396 R_AttIsShowDiffs, 393 397 R_AttIsHostDrive, 394 398 R_AttIsPassthrough, -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r23223 r23225 775 775 776 776 item->setMedium (aMedium); 777 778 /* Check if swapped diff disk is required one */ 779 if (item->id() == mHDSelectedId) 780 { 781 setCurrentItem (mHardDiskView, item); 782 mHDSelectedId = QString::null; 783 } 784 777 785 updateTabIcons (item, ItemAction_Updated); 778 786 return; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp
r23223 r23225 556 556 : AbstractItem (aParent) 557 557 , mAttDeviceType (aDeviceType) 558 , mAttIsShowDiffs (false) 558 559 , mAttIsHostDrive (false) 559 560 , mAttIsPassthrough (false) … … 701 702 } 702 703 704 bool AttachmentItem::attIsShowDiffs() const 705 { 706 return mAttIsShowDiffs; 707 } 708 703 709 bool AttachmentItem::attIsHostDrive() const 704 710 { … … 732 738 medium = vboxGlobal().findMedium (aAttMediumId); 733 739 734 cache (medium); 740 mAttMediumId = medium.id(); 741 cache(); 742 } 743 744 void AttachmentItem::setAttIsShowDiffs (bool aAttIsShowDiffs) 745 { 746 mAttIsShowDiffs = aAttIsShowDiffs; 747 cache(); 735 748 } 736 749 … … 765 778 } 766 779 767 void AttachmentItem::cache (const VBoxMedium &aMedium)768 { 769 mAttMediumId = aMedium.id();780 void AttachmentItem::cache() 781 { 782 VBoxMedium medium = vboxGlobal().findMedium (mAttMediumId); 770 783 771 784 /* Cache medium information */ 772 mAttName = aMedium.name (true);773 mAttTip = aMedium.toolTipCheckRO (true);774 mAttPixmap = aMedium.iconCheckRO (true);775 mAttIsHostDrive = aMedium.isHostDrive();785 mAttName = medium.name (!mAttIsShowDiffs); 786 mAttTip = medium.toolTipCheckRO (!mAttIsShowDiffs); 787 mAttPixmap = medium.iconCheckRO (!mAttIsShowDiffs); 788 mAttIsHostDrive = medium.isHostDrive(); 776 789 777 790 /* Cache additional information */ 778 mAttSize = aMedium.size(); 779 mAttLogicalSize = aMedium.logicalSize(); 780 mAttLocation = aMedium.location(); 781 mAttFormat = QString ("%1 (%2)").arg (aMedium.hardDiskType()).arg (aMedium.hardDiskFormat()); 782 mAttUsage = aMedium.usage(); 791 mAttSize = medium.size (!mAttIsShowDiffs); 792 mAttLogicalSize = medium.logicalSize (!mAttIsShowDiffs); 793 mAttLocation = medium.location (!mAttIsShowDiffs); 794 mAttFormat = QString ("%1 (%2)").arg (medium.hardDiskType (!mAttIsShowDiffs)) 795 .arg (medium.hardDiskFormat (!mAttIsShowDiffs)); 796 mAttUsage = medium.usage (!mAttIsShowDiffs); 783 797 784 798 /* Fill empty attributes */ … … 1029 1043 return QString(); 1030 1044 } 1045 case R_AttIsShowDiffs: 1046 { 1047 if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer())) 1048 if (item->rtti() == AbstractItem::Type_AttachmentItem) 1049 return static_cast <AttachmentItem*> (item)->attIsShowDiffs(); 1050 return false; 1051 } 1031 1052 case R_AttIsHostDrive: 1032 1053 { … … 1219 1240 { 1220 1241 static_cast <AttachmentItem*> (item)->setAttMediumId (aValue.toString()); 1242 emit dataChanged (aIndex, aIndex); 1243 return true; 1244 } 1245 return false; 1246 } 1247 case R_AttIsShowDiffs: 1248 { 1249 if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer())) 1250 if (item->rtti() == AbstractItem::Type_AttachmentItem) 1251 { 1252 static_cast <AttachmentItem*> (item)->setAttIsShowDiffs (aValue.toBool()); 1221 1253 emit dataChanged (aIndex, aIndex); 1222 1254 return true; … … 1520 1552 connect (mCbVdi, SIGNAL (activated (int)), this, SLOT (setInformation())); 1521 1553 connect (mTbVmm, SIGNAL (clicked (bool)), this, SLOT (onVmmInvoked())); 1554 connect (mCbShowDiffs, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1522 1555 connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1523 1556 … … 1536 1569 { 1537 1570 mMachine = aMachine; 1571 1572 /* Set the machine id for the media-combo */ 1573 mCbVdi->setMachineId (mMachine.GetId()); 1538 1574 1539 1575 /* Load currently present controllers & attachments */ … … 1789 1825 mCbDevice->setCurrentIndex (attDevicePos == -1 ? 0 : attDevicePos); 1790 1826 1827 /* Getting Show Diffs state */ 1828 bool isShowDiffs = mStorageModel->data (index, StorageModel::R_AttIsShowDiffs).toBool(); 1829 mCbShowDiffs->setChecked (isShowDiffs); 1830 1791 1831 /* Getting Attachment Medium */ 1792 1832 mCbVdi->setType (typeToLocal (device)); 1833 mCbVdi->setShowDiffs (isShowDiffs); 1793 1834 mCbVdi->setCurrentItem (mStorageModel->data (index, StorageModel::R_AttMediumId).toString()); 1794 1835 mCbVdi->refresh(); … … 1837 1878 /* Setting Controller Sub-Type */ 1838 1879 else if (sdr == mCbType) 1839 { 1840 KStorageControllerType type = vboxGlobal().toControllerType (mCbType->currentText()); 1841 mStorageModel->setData (index, QVariant::fromValue (type), StorageModel::R_CtrType); 1842 } 1880 mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toControllerType (mCbType->currentText())), 1881 StorageModel::R_CtrType); 1843 1882 break; 1844 1883 } … … 1847 1886 /* Setting Attachment Slot */ 1848 1887 if (sdr == mCbSlot) 1849 { 1850 StorageSlot slt = vboxGlobal().toStorageSlot (mCbSlot->currentText()); 1851 mStorageModel->setData (index, QVariant::fromValue (slt), StorageModel::R_AttSlot); 1852 } 1888 mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toStorageSlot (mCbSlot->currentText())), 1889 StorageModel::R_AttSlot); 1853 1890 /* Setting Attachment Device-Type */ 1854 1891 else if (sdr == mCbDevice) … … 1857 1894 mStorageModel->setData (index, QVariant::fromValue (device), StorageModel::R_AttDevice); 1858 1895 mCbVdi->setType (typeToLocal (device)); 1896 mCbVdi->setShowDiffs (mCbShowDiffs->isChecked()); 1859 1897 mCbVdi->refresh(); 1860 1898 } … … 1862 1900 else if (sdr == mCbVdi) 1863 1901 mStorageModel->setData (index, mCbVdi->id(), StorageModel::R_AttMediumId); 1902 else if (sdr == mCbShowDiffs) 1903 mStorageModel->setData (index, mCbShowDiffs->isChecked(), StorageModel::R_AttIsShowDiffs); 1864 1904 else if (sdr == mCbPassthrough) 1865 1905 { … … 2078 2118 false /* do refresh? */, 2079 2119 mMachine, 2080 QString(),2081 false);2120 mCbVdi->id(), 2121 mCbShowDiffs->isChecked()); 2082 2122 2083 2123 return dlg.exec() == QDialog::Accepted ? dlg.selectedId() : QString();
Note:
See TracChangeset
for help on using the changeset viewer.