Changeset 48259 in vbox
- Timestamp:
- Sep 4, 2013 10:22:19 AM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp
r45292 r48259 44 44 45 45 /* Search for corresponding medium: */ 46 m_medium = vboxGlobal(). findMedium(strMediumId).medium();46 m_medium = vboxGlobal().medium(strMediumId).medium(); 47 47 m_oldMediumType = m_medium.GetType(); 48 48 m_newMediumType = m_oldMediumType; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r48124 r48259 961 961 } 962 962 963 QString VBoxGlobal::details(const CMedium & medium, bool fPredictDiff, bool fUseHtml /*= true*/)963 QString VBoxGlobal::details(const CMedium &cmedium, bool fPredictDiff, bool fUseHtml /*= true*/) 964 964 { 965 965 /* Search for corresponding UI medium: */ 966 966 UIMedium uimedium; 967 if (! findMedium(medium, uimedium))967 if (!medium(cmedium, uimedium)) 968 968 { 969 969 /* UI medium may be new and not in medium list, request enumeration: */ … … 971 971 972 972 /* Search for corresponding UI medium again: */ 973 if (! findMedium(medium, uimedium))973 if (!medium(cmedium, uimedium)) 974 974 { 975 975 /* Medium might be deleted already, return null string: */ … … 1975 1975 } 1976 1976 1977 /** 1978 * Searches for a VBoxMedum object representing the given COM medium object. 1979 * 1980 * @return true if found and false otherwise. 1981 */ 1982 bool VBoxGlobal::findMedium (const CMedium &aObj, UIMedium &aMedium) const 1983 { 1984 for (VBoxMediaList::ConstIterator it = m_mediums.begin(); it != m_mediums.end(); ++ it) 1985 { 1986 if (((*it).medium().isNull() && aObj.isNull()) || 1987 (!(*it).medium().isNull() && !aObj.isNull() && (*it).medium().GetId() == aObj.GetId())) 1988 { 1989 aMedium = (*it); 1977 bool VBoxGlobal::medium(const CMedium &cmedium, UIMedium &uimedium) const 1978 { 1979 for (VBoxMediaList::ConstIterator it = m_mediums.begin(); it != m_mediums.end(); ++it) 1980 { 1981 if (((*it).medium().isNull() && cmedium.isNull()) || 1982 (!(*it).medium().isNull() && !cmedium.isNull() && (*it).medium().GetId() == cmedium.GetId())) 1983 { 1984 uimedium = (*it); 1990 1985 return true; 1991 1986 } … … 1994 1989 } 1995 1990 1996 /** 1997 * Searches for a VBoxMedum object with the given medium id attribute. 1998 * 1999 * @return VBoxMedum if found which is invalid otherwise. 2000 */ 2001 UIMedium VBoxGlobal::findMedium (const QString &aMediumId) const 2002 { 2003 for (VBoxMediaList::ConstIterator it = m_mediums.begin(); it != m_mediums.end(); ++ it) 2004 if ((*it).id() == aMediumId) 1991 UIMedium VBoxGlobal::medium(const QString &strMediumID) const 1992 { 1993 for (VBoxMediaList::ConstIterator it = m_mediums.begin(); it != m_mediums.end(); ++it) 1994 if ((*it).id() == strMediumID) 2005 1995 return *it; 2006 1996 return UIMedium(); … … 2118 2108 2119 2109 /* Open corresponding medium: */ 2120 CMedium c omMedium = vbox.OpenMedium(strMediumLocation, mediumTypeToGlobal(mediumType), KAccessMode_ReadWrite, false);2110 CMedium cmedium = vbox.OpenMedium(strMediumLocation, mediumTypeToGlobal(mediumType), KAccessMode_ReadWrite, false); 2121 2111 2122 2112 if (vbox.isOk()) 2123 2113 { 2124 2114 /* Prepare vbox medium wrapper: */ 2125 UIMedium vboxMedium;2115 UIMedium uimedium; 2126 2116 2127 2117 /* First of all we should test if that medium already opened: */ 2128 if (!vboxGlobal(). findMedium(comMedium, vboxMedium))2118 if (!vboxGlobal().medium(cmedium, uimedium)) 2129 2119 { 2130 2120 /* And create new otherwise: */ 2131 vboxMedium = UIMedium(CMedium(comMedium), mediumType, KMediumState_Created);2132 vboxGlobal().addMedium( vboxMedium);2133 } 2134 2135 /* Return vboxMedium id: */2136 return vboxMedium.id();2121 uimedium = UIMedium(cmedium, mediumType, KMediumState_Created); 2122 vboxGlobal().addMedium(uimedium); 2123 } 2124 2125 /* Return uimedium id: */ 2126 return uimedium.id(); 2137 2127 } 2138 2128 else … … 4977 4967 return true; 4978 4968 } 4969 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r48124 r48259 252 252 void removeMedium (UIMediumType, const QString &); 253 253 254 bool findMedium (const CMedium &, UIMedium &) const;255 UIMedium findMedium (const QString &aMediumId) const;254 bool medium(const CMedium &cmedium, UIMedium &uimedium) const; 255 UIMedium medium(const QString &strMediumID) const; 256 256 257 257 QString openMediumWithFileOpenDialog(UIMediumType mediumType, QWidget *pParent = 0, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r47774 r48259 1599 1599 bool fMount = !newId.isEmpty(); 1600 1600 1601 UIMedium vmedium = vboxGlobal(). findMedium(newId);1601 UIMedium vmedium = vboxGlobal().medium(newId); 1602 1602 CMedium medium = vmedium.medium(); // @todo r=dj can this be cached somewhere? 1603 1603 … … 1610 1610 { 1611 1611 /* Ask for force remounting: */ 1612 if (msgCenter().cannotRemountMedium(machine, vboxGlobal(). findMedium(fMount ? newId : currentId),1612 if (msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? newId : currentId), 1613 1613 fMount, true /* retry? */, activeMachineWindow())) 1614 1614 { … … 1618 1618 fWasMounted = true; 1619 1619 else 1620 msgCenter().cannotRemountMedium(machine, vboxGlobal(). findMedium(fMount ? newId : currentId),1620 msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? newId : currentId), 1621 1621 fMount, false /* retry? */, activeMachineWindow()); 1622 1622 } … … 1658 1658 1659 1659 /* Prepare target medium: */ 1660 const UIMedium &vboxMedium = fMount ? vboxGlobal(). findMedium(strNewId) : UIMedium();1660 const UIMedium &vboxMedium = fMount ? vboxGlobal().medium(strNewId) : UIMedium(); 1661 1661 const CMedium &comMedium = fMount ? vboxMedium.medium() : CMedium(); 1662 1662 … … 1671 1671 { 1672 1672 /* Ask for force remounting: */ 1673 if (msgCenter().cannotRemountMedium(machine, vboxGlobal(). findMedium(fMount ? strNewId : strCurrentId),1673 if (msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? strNewId : strCurrentId), 1674 1674 fMount, true /* retry? */, activeMachineWindow())) 1675 1675 { … … 1679 1679 fWasMounted = true; 1680 1680 else 1681 msgCenter().cannotRemountMedium(machine, vboxGlobal(). findMedium(fMount ? strNewId : strCurrentId),1681 msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? strNewId : strCurrentId), 1682 1682 fMount, false /* retry? */, activeMachineWindow()); 1683 1683 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r48124 r48259 653 653 { 654 654 AssertMsg(!aAttMediumId.isEmpty(), ("Medium ID value can't be null/empty!\n")); 655 mAttMediumId = vboxGlobal(). findMedium(aAttMediumId).id();655 mAttMediumId = vboxGlobal().medium(aAttMediumId).id(); 656 656 cache(); 657 657 } … … 704 704 void AttachmentItem::cache() 705 705 { 706 UIMedium medium = vboxGlobal(). findMedium(mAttMediumId);706 UIMedium medium = vboxGlobal().medium(mAttMediumId); 707 707 708 708 /* Cache medium information */ … … 1961 1961 storageAttachmentData.m_fAttachmentTempEject = attachment.GetTemporaryEject(); 1962 1962 storageAttachmentData.m_fAttachmentNonRotational = attachment.GetNonRotational(); 1963 CMedium c omMedium(attachment.GetMedium());1964 UIMedium vboxMedium;1965 vboxGlobal(). findMedium(comMedium, vboxMedium);1966 storageAttachmentData.m_strAttachmentMediumId = vboxMedium.id();1963 CMedium cmedium = attachment.GetMedium(); 1964 UIMedium uimedium; 1965 vboxGlobal().medium(cmedium, uimedium); 1966 storageAttachmentData.m_strAttachmentMediumId = uimedium.id(); 1967 1967 } 1968 1968 … … 2148 2148 QString value (QString ("%1 (%2)").arg (ctrName, gpConverter->toString (attSlot))); 2149 2149 /* Check for emptiness: */ 2150 if (vboxGlobal(). findMedium(key).isNull() && attDevice == KDeviceType_HardDisk)2150 if (vboxGlobal().medium(key).isNull() && attDevice == KDeviceType_HardDisk) 2151 2151 { 2152 2152 message.second << tr("No hard disk is selected for <i>%1</i>.").arg (value); … … 2154 2154 } 2155 2155 /* Check for coincidence: */ 2156 if (!vboxGlobal(). findMedium(key).isNull() && config.contains (key))2156 if (!vboxGlobal().medium(key).isNull() && config.contains (key)) 2157 2157 { 2158 2158 message.second << tr("<i>%1</i> is using a disk that is already attached to <i>%2</i>.") … … 3080 3080 int iAnswer = msgCenter().confirmOpticalAttachmentCreation(strControllerName, this); 3081 3081 if (iAnswer == AlertButton_Choice1) 3082 strMediumId = vboxGlobal(). findMedium(strMediumId).id();3082 strMediumId = vboxGlobal().medium(strMediumId).id(); 3083 3083 else if (iAnswer == AlertButton_Choice2) 3084 3084 strMediumId = vboxGlobal().openMediumWithFileOpenDialog(UIMediumType_DVD, this, strMachineFolder); … … 3089 3089 int iAnswer = msgCenter().confirmFloppyAttachmentCreation(strControllerName, this); 3090 3090 if (iAnswer == AlertButton_Choice1) 3091 strMediumId = vboxGlobal(). findMedium(strMediumId).id();3091 strMediumId = vboxGlobal().medium(strMediumId).id(); 3092 3092 else if (iAnswer == AlertButton_Choice2) 3093 3093 strMediumId = vboxGlobal().openMediumWithFileOpenDialog(UIMediumType_Floppy, this, strMachineFolder); … … 3495 3495 bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational; 3496 3496 /* Get GUI medium object: */ 3497 UIMedium vboxMedium = vboxGlobal(). findMedium(strAttachmentMediumId);3497 UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId); 3498 3498 /* Get COM medium object: */ 3499 3499 CMedium comMedium = vboxMedium.medium(); … … 3579 3579 { 3580 3580 /* Get GUI medium object: */ 3581 UIMedium vboxMedium = vboxGlobal(). findMedium(strAttachmentMediumId);3581 UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId); 3582 3582 /* Get COM medium object: */ 3583 3583 CMedium comMedium = vboxMedium.medium(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp
r47184 r48259 49 49 CMedium UIWizardCloneVDPage1::sourceVirtualDisk() const 50 50 { 51 return vboxGlobal(). findMedium(m_pSourceDiskSelector->id()).medium();51 return vboxGlobal().medium(m_pSourceDiskSelector->id()).medium(); 52 52 } 53 53 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.cpp
r45292 r48259 74 74 /* Get chosen 'dvd' medium to mount: */ 75 75 QString mediumId = field("id").toString(); 76 UIMedium vmedium = vboxGlobal(). findMedium(mediumId);76 UIMedium vmedium = vboxGlobal().medium(mediumId); 77 77 CMedium medium = vmedium.medium(); // @todo r=dj can this be cached somewhere? 78 78 /* Mount medium to the predefined port/device: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp
r47184 r48259 133 133 { 134 134 /* Make sure valid medium chosen: */ 135 return !vboxGlobal(). findMedium(id()).isNull();135 return !vboxGlobal().medium(id()).isNull(); 136 136 } 137 137 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r47401 r48259 210 210 if (!strId.isNull()) 211 211 { 212 UIMedium vmedium = vboxGlobal(). findMedium(strId);212 UIMedium vmedium = vboxGlobal().medium(strId); 213 213 CMedium medium = vmedium.medium(); // @todo r=dj can this be cached somewhere? 214 214 machine.AttachDevice(strHDName, 0, 0, KDeviceType_HardDisk, medium); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
r47184 r48259 236 236 return m_pDiskSkip->isChecked() || 237 237 !m_pDiskPresent->isChecked() || 238 !vboxGlobal(). findMedium(m_pDiskSelector->id()).isNull();238 !vboxGlobal().medium(m_pDiskSelector->id()).isNull(); 239 239 } 240 240 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r47814 r48259 251 251 return UIWizardPage::isComplete() && 252 252 (m_pRamSlider->value() >= qMax(1, (int)m_pRamSlider->minRAM()) && m_pRamSlider->value() <= (int)m_pRamSlider->maxRAM()) && 253 (m_pDiskSkip->isChecked() || !m_pDiskPresent->isChecked() || !vboxGlobal(). findMedium(m_pDiskSelector->id()).isNull());253 (m_pDiskSkip->isChecked() || !m_pDiskPresent->isChecked() || !vboxGlobal().medium(m_pDiskSelector->id()).isNull()); 254 254 } 255 255
Note:
See TracChangeset
for help on using the changeset viewer.