Changeset 23239 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 22, 2009 10:11:42 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h
r23238 r23239 507 507 private slots: 508 508 509 void mediumUpdated (const VBoxMedium &aMedium); 510 void mediumRemoved (VBoxDefs::MediumType aType, const QString &aMediumId); 511 509 512 void addController(); 510 513 void addIDEController(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp
r23238 r23239 40 40 41 41 /* String Tags */ 42 const char *firstAvailable = "first available";42 const char *firstAvailableId = "first available"; 43 43 44 44 /* Type converters */ … … 750 750 751 751 /* Caching first available medium */ 752 if (aAttMediumId == firstAvailable && !attMediumIds (false).isEmpty())752 if (aAttMediumId == firstAvailableId && !attMediumIds (false).isEmpty()) 753 753 medium = vboxGlobal().findMedium (attMediumIds (false) [0]); 754 754 /* Caching passed medium */ … … 1549 1549 1550 1550 /* Setup connections */ 1551 connect (&vboxGlobal(), SIGNAL (mediumEnumerated (const VBoxMedium &)), 1552 this, SLOT (mediumUpdated (const VBoxMedium &))); 1553 connect (&vboxGlobal(), SIGNAL (mediumUpdated (const VBoxMedium &)), 1554 this, SLOT (mediumUpdated (const VBoxMedium &))); 1555 connect (&vboxGlobal(), SIGNAL (mediumRemoved (VBoxDefs::MediumType, const QString &)), 1556 this, SLOT (mediumRemoved (VBoxDefs::MediumType, const QString &))); 1551 1557 connect (mAddCtrAction, SIGNAL (triggered (bool)), this, SLOT (addController())); 1552 1558 connect (mAddIDECtrAction, SIGNAL (triggered (bool)), this, SLOT (addIDEController())); … … 1760 1766 } 1761 1767 1768 void VBoxVMSettingsHD::mediumUpdated (const VBoxMedium &aMedium) 1769 { 1770 QModelIndex rootIndex = mStorageModel->root(); 1771 for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i) 1772 { 1773 QModelIndex ctrIndex = rootIndex.child (i, 0); 1774 for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j) 1775 { 1776 QModelIndex attIndex = ctrIndex.child (j, 0); 1777 QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString(); 1778 if (attMediumId == aMedium.id()) 1779 { 1780 mStorageModel->setData (attIndex, attMediumId, StorageModel::R_AttMediumId); 1781 mValidator->revalidate(); 1782 } 1783 } 1784 } 1785 } 1786 1787 void VBoxVMSettingsHD::mediumRemoved (VBoxDefs::MediumType /* aType */, const QString &aMediumId) 1788 { 1789 QModelIndex rootIndex = mStorageModel->root(); 1790 for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i) 1791 { 1792 QModelIndex ctrIndex = rootIndex.child (i, 0); 1793 for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j) 1794 { 1795 QModelIndex attIndex = ctrIndex.child (j, 0); 1796 QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString(); 1797 if (attMediumId == aMediumId) 1798 { 1799 mStorageModel->setData (attIndex, firstAvailableId, StorageModel::R_AttMediumId); 1800 mValidator->revalidate(); 1801 } 1802 } 1803 } 1804 } 1805 1762 1806 void VBoxVMSettingsHD::addController() 1763 1807 { … … 2032 2076 askResult == QIMessageBox::No ? getWithMediaManager (typeToLocal (deviceType)) : QString(); 2033 2077 if (mediumId.isNull()) 2034 mediumId = firstAvailable ;2078 mediumId = firstAvailableId; 2035 2079 mStorageModel->setData (index, mediumId, StorageModel::R_AttMediumId); 2036 2080 }
Note:
See TracChangeset
for help on using the changeset viewer.