Changeset 48260 in vbox
- Timestamp:
- Sep 4, 2013 11:42:46 AM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp
r47998 r48260 116 116 connect (pMachineWindow->machineView(), SIGNAL (resizeHintDone()), this, SLOT (processStatistics())); 117 117 connect (mInfoStack, SIGNAL (currentChanged (int)), this, SLOT (onPageChanged (int))); 118 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished( const VBoxMediaList&)), this, SLOT(updateDetails()));118 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(updateDetails())); 119 119 connect (mStatTimer, SIGNAL (timeout()), this, SLOT (processStatistics())); 120 120 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r48259 r48260 1842 1842 } 1843 1843 1844 /** 1845 * Adds a new medium to the current media list and emits the #mediumAdded() 1846 * signal. 1847 * 1848 * @sa #currentMediaList() 1849 */ 1850 void VBoxGlobal::addMedium (const UIMedium &aMedium) 1844 void VBoxGlobal::createMedium(const UIMedium &uimedium) 1851 1845 { 1852 1846 VBoxMediaList::iterator it = m_mediums.begin(); 1853 1847 1854 if ( aMedium.type() == UIMediumType_HardDisk)1848 if (uimedium.type() == UIMediumType_HardDisk) 1855 1849 { 1856 1850 VBoxMediaList::iterator itParent = m_mediums.end(); … … 1864 1858 break; 1865 1859 1866 if ( aMedium.parent() != NULL && itParent == m_mediums.end())1860 if (uimedium.parent() != NULL && itParent == m_mediums.end()) 1867 1861 { 1868 if (&*it == aMedium.parent())1862 if (&*it == uimedium.parent()) 1869 1863 itParent = it; 1870 1864 } … … 1872 1866 { 1873 1867 /* break if met a parent's sibling (will insert before it) */ 1874 if ( aMedium.parent() != NULL &&1868 if (uimedium.parent() != NULL && 1875 1869 (*it).parent() == (*itParent).parent()) 1876 1870 break; 1877 1871 1878 /* compare to aMedium's siblings */1879 if ((*it).parent() == aMedium.parent() &&1880 (*it).name().localeAwareCompare ( aMedium.name()) > 0)1872 /* compare to uimedium's siblings */ 1873 if ((*it).parent() == uimedium.parent() && 1874 (*it).name().localeAwareCompare (uimedium.name()) > 0) 1881 1875 break; 1882 1876 } 1883 1877 } 1884 1878 1885 AssertReturnVoid ( aMedium.parent() == NULL || itParent != m_mediums.end());1879 AssertReturnVoid (uimedium.parent() == NULL || itParent != m_mediums.end()); 1886 1880 } 1887 1881 else … … 1897 1891 1898 1892 /* skip DVD when inserting Floppy */ 1899 if ( aMedium.type() == UIMediumType_Floppy &&1893 if (uimedium.type() == UIMediumType_Floppy && 1900 1894 (*it).type() == UIMediumType_DVD) 1901 1895 continue; 1902 1896 1903 if ((*it).name().localeAwareCompare ( aMedium.name()) > 0 ||1904 ( aMedium.type() == UIMediumType_DVD &&1897 if ((*it).name().localeAwareCompare (uimedium.name()) > 0 || 1898 (uimedium.type() == UIMediumType_DVD && 1905 1899 (*it).type() == UIMediumType_Floppy)) 1906 1900 break; … … 1908 1902 } 1909 1903 1910 it = m_mediums.insert (it, aMedium); 1911 1912 emit mediumAdded (*it); 1913 } 1914 1915 /** 1916 * Updates the medium in the current media list and emits the #mediumUpdated() 1917 * signal. 1918 * 1919 * @sa #currentMediaList() 1920 */ 1921 void VBoxGlobal::updateMedium (const UIMedium &aMedium) 1904 it = m_mediums.insert (it, uimedium); 1905 1906 emit sigMediumCreated(*it); 1907 } 1908 1909 void VBoxGlobal::updateMedium(const UIMedium &uimedium) 1922 1910 { 1923 1911 VBoxMediaList::Iterator it; 1924 1912 for (it = m_mediums.begin(); it != m_mediums.end(); ++ it) 1925 if ((*it).id() == aMedium.id())1913 if ((*it).id() == uimedium.id()) 1926 1914 break; 1927 1915 1928 1916 AssertReturnVoid (it != m_mediums.end()); 1929 1917 1930 if (&*it != &aMedium) 1931 *it = aMedium; 1932 1933 emit mediumUpdated (*it); 1934 } 1935 1936 /** 1937 * Removes the medium from the current media list and emits the #mediumRemoved() 1938 * signal. 1939 * 1940 * @sa #currentMediaList() 1941 */ 1942 void VBoxGlobal::removeMedium (UIMediumType aType, const QString &aId) 1918 if (&*it != &uimedium) 1919 *it = uimedium; 1920 1921 emit sigMediumUpdated(*it); 1922 } 1923 1924 void VBoxGlobal::deleteMedium(const QString &strMediumID) 1943 1925 { 1944 1926 VBoxMediaList::Iterator it; 1945 for (it = m_mediums.begin(); it != m_mediums.end(); ++ 1946 if ((*it).id() == aId)1927 for (it = m_mediums.begin(); it != m_mediums.end(); ++it) 1928 if ((*it).id() == strMediumID) 1947 1929 break; 1948 1930 1949 AssertReturnVoid 1931 AssertReturnVoid(it != m_mediums.end()); 1950 1932 1951 1933 #if DEBUG … … 1953 1935 { 1954 1936 VBoxMediaList::Iterator jt = it; 1955 ++ 1956 AssertReturnVoid 1957 } 1958 #endif 1937 ++jt; 1938 AssertReturnVoid(jt == m_mediums.end() || (*jt).parent() != &*it); 1939 } 1940 #endif /* DEBUG */ 1959 1941 1960 1942 UIMedium *pParent = (*it).parent(); … … 1962 1944 /* remove the medium from the list to keep it in sync with the server "for 1963 1945 * free" when the medium is deleted from one of our UIs */ 1964 m_mediums.erase 1965 1966 emit mediumRemoved (aType, aId);1946 m_mediums.erase(it); 1947 1948 emit sigMediumDeleted(strMediumID); 1967 1949 1968 1950 /* also emit the parent update signal because some attributes like … … 1971 1953 { 1972 1954 pParent->refresh(); 1973 emit mediumUpdated(*pParent);1955 emit sigMediumUpdated(*pParent); 1974 1956 } 1975 1957 } … … 2120 2102 /* And create new otherwise: */ 2121 2103 uimedium = UIMedium(cmedium, mediumType, KMediumState_Created); 2122 vboxGlobal(). addMedium(uimedium);2104 vboxGlobal().createMedium(uimedium); 2123 2105 } 2124 2106 … … 4049 4031 4050 4032 /* Notify listeners about enumeration finished: */ 4051 emit sigMediumEnumerationFinished( m_mediums);4033 emit sigMediumEnumerationFinished(); 4052 4034 4053 4035 /* Accept event: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r48259 r48260 248 248 const VBoxMediaList ¤tMediaList() const { return m_mediums; } 249 249 250 void addMedium (const UIMedium &); 251 void updateMedium (const UIMedium &); 252 void removeMedium (UIMediumType, const QString &); 250 /* API: Medium-processing stuff: */ 251 void createMedium(const UIMedium &medium); 252 void updateMedium(const UIMedium &medium); 253 void deleteMedium(const QString &strMediumID); 253 254 254 255 bool medium(const CMedium &cmedium, UIMedium &uimedium) const; … … 378 379 void sigMediumEnumerationStarted(); 379 380 void sigMediumEnumerated(const UIMedium &medium); 380 void sigMediumEnumerationFinished(const VBoxMediaList &mediums); 381 382 /** Emitted when a new media is added using #addMedia(). */ 383 void mediumAdded (const UIMedium &); 384 385 /** Emitted when the media is updated using #updateMedia(). */ 386 void mediumUpdated (const UIMedium &); 387 388 /** Emitted when the media is removed using #removeMedia(). */ 389 void mediumRemoved (UIMediumType, const QString &); 381 void sigMediumEnumerationFinished(); 382 383 /* Notifiers: Medium-processing stuff: */ 384 void sigMediumCreated(const UIMedium &medium); 385 void sigMediumUpdated(const UIMedium &medium); 386 void sigMediumDeleted(const QString &strMediumID); 390 387 391 388 public slots: -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r48124 r48260 272 272 } 273 273 274 void UIMediumManager::sltHandleMedium Added(const UIMedium &medium)274 void UIMediumManager::sltHandleMediumCreated(const UIMedium &medium) 275 275 { 276 276 /* Ignore non-interesting mediums: */ … … 370 370 } 371 371 372 void UIMediumManager::sltHandleMedium Removed(UIMediumType type, const QString &strId)372 void UIMediumManager::sltHandleMediumDeleted(const QString &strMediumID) 373 373 { 374 374 /* Get tree/item: */ 375 QTreeWidget *pTree = treeWidget(type); 376 UIMediumItem *pMediumItem = toMediumItem(searchItem(pTree, strId)); 375 QList<UIMediumType> types; 376 types << UIMediumType_HardDisk << UIMediumType_DVD << UIMediumType_Floppy; 377 QTreeWidget *pTree = 0; 378 UIMediumItem *pMediumItem = 0; 379 foreach (UIMediumType type, types) 380 { 381 pTree = treeWidget(type); 382 pMediumItem = searchItem(pTree, strMediumID); 383 if (pMediumItem) 384 break; 385 } 377 386 if (!pMediumItem) 378 387 return; … … 411 420 VBoxMediaList::const_iterator it; 412 421 for (it = mediums.begin(); it != mediums.end(); ++it) 413 sltHandleMedium Added(*it);422 sltHandleMediumCreated(*it); 414 423 415 424 /* Select the first item to be the current one … … 495 504 496 505 /* Remember ID/type as they may get lost after the closure/deletion: */ 497 QString str Id= pMediumItem->id();498 AssertReturnVoid(!str Id.isNull());506 QString strMediumID = pMediumItem->id(); 507 AssertReturnVoid(!strMediumID.isNull()); 499 508 UIMediumType type = pMediumItem->type(); 500 509 … … 581 590 /* Verify result: */ 582 591 if (result.isOk()) 583 vboxGlobal(). removeMedium(type, strId);592 vboxGlobal().deleteMedium(strMediumID); 584 593 else 585 594 msgCenter().cannotCloseMedium(pMediumItem->medium(), result, this); … … 625 634 break; 626 635 627 /* Update medium-item: */628 pMediumItem->refreshAll();629 636 /* Inform others about medium changes: */ 630 637 vboxGlobal().updateMedium(pMediumItem->medium()); … … 851 858 852 859 /* Configure medium-processing connections: */ 853 connect(&vboxGlobal(), SIGNAL( mediumAdded(const UIMedium&)),854 this, SLOT(sltHandleMedium Added(const UIMedium&)));855 connect(&vboxGlobal(), SIGNAL( mediumUpdated(const UIMedium&)),860 connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const UIMedium&)), 861 this, SLOT(sltHandleMediumCreated(const UIMedium&))); 862 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const UIMedium&)), 856 863 this, SLOT(sltHandleMediumUpdated(const UIMedium&))); 857 connect(&vboxGlobal(), SIGNAL( mediumRemoved(UIMediumType,const QString&)),858 this, SLOT(sltHandleMedium Removed(UIMediumType,const QString&)));864 connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)), 865 this, SLOT(sltHandleMediumDeleted(const QString&))); 859 866 860 867 /* Configure medium-enumeration connections: */ … … 863 870 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const UIMedium&)), 864 871 this, SLOT(sltHandleMediumEnumerated(const UIMedium&))); 865 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished( const VBoxMediaList&)),872 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), 866 873 this, SLOT(sltHandleMediumEnumerationFinish())); 867 874 … … 1152 1159 for (it = mediums.begin(); it != mediums.end(); ++it) 1153 1160 { 1154 sltHandleMedium Added(*it);1161 sltHandleMediumCreated(*it); 1155 1162 /* But advance progress-bar only for created mediums: */ 1156 1163 if ((*it).state() != KMediumState_NotCreated) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r48090 r48260 64 64 65 65 /* Handlers: Medium-processing stuff: */ 66 void sltHandleMedium Added(const UIMedium &medium);66 void sltHandleMediumCreated(const UIMedium &medium); 67 67 void sltHandleMediumUpdated(const UIMedium &medium); 68 void sltHandleMedium Removed(UIMediumType type, const QString &strId);68 void sltHandleMediumDeleted(const QString &strMediumID); 69 69 70 70 /* Handlers: Medium-enumeration stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r48101 r48260 581 581 if (!strCntName.isNull()) 582 582 { 583 /* Create a new UIMedium: */ 584 UIMedium vboxMedium(image, UIMediumType_DVD, KMediumState_Created); 585 /* Register it in GUI internal list: */ 586 vboxGlobal().addMedium(vboxMedium); 583 /* Create new UIMedium: */ 584 UIMedium medium(image, UIMediumType_DVD, KMediumState_Created); 585 586 /* Inform VBoxGlobal about it: */ 587 vboxGlobal().createMedium(medium); 587 588 588 589 /* Mount medium to the predefined port/device: */ 589 machine.MountMedium(strCntName, iCntPort, iCntDevice, vboxMedium.medium(), false /* force */);590 machine.MountMedium(strCntName, iCntPort, iCntDevice, medium.medium(), false /* force */); 590 591 if (!machine.isOk()) 591 592 { 592 593 /* Ask for force mounting: */ 593 if (msgCenter().cannotRemountMedium(machine, vboxMedium, true /* mount? */,594 if (msgCenter().cannotRemountMedium(machine, medium, true /* mount? */, 594 595 true /* retry? */, mainMachineWindow())) 595 596 { 596 597 /* Force mount medium to the predefined port/device: */ 597 machine.MountMedium(strCntName, iCntPort, iCntDevice, vboxMedium.medium(), true /* force */);598 machine.MountMedium(strCntName, iCntPort, iCntDevice, medium.medium(), true /* force */); 598 599 if (!machine.isOk()) 599 msgCenter().cannotRemountMedium(machine, vboxMedium, true /* mount? */,600 msgCenter().cannotRemountMedium(machine, medium, true /* mount? */, 600 601 false /* retry? */, mainMachineWindow()); 601 602 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r48086 r48260 1403 1403 { 1404 1404 /* Medium enumeration connections: */ 1405 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished( const VBoxMediaList &)), this, SLOT(sltHandleMediumEnumerationFinish()));1405 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltHandleMediumEnumerationFinish())); 1406 1406 1407 1407 /* Menu-bar connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp
r47998 r48260 347 347 /* Meidum-enumeration connections: */ 348 348 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationStarted()), this, SLOT(sltUpdateAppearance())); 349 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished( const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));349 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltUpdateAppearance())); 350 350 } 351 351 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r47998 r48260 553 553 554 554 /* Allow to reset first-run flag just when medium enumeration was finished: */ 555 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished( const VBoxMediaList &)), this, SLOT(sltAllowResetFirstRunFlag()));555 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltAllowResetFirstRunFlag())); 556 556 557 557 /* Get corresponding machine (required to determine dialog type and page availability): */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r48259 r48260 1830 1830 mLbUsageValue->setFullSizeSelection (true); 1831 1831 1832 /* Setup connections */1833 connect (&vboxGlobal(), SIGNAL (sigMediumEnumerated (const UIMedium&)),1834 this, SLOT (sltHandleMediumUpdated (const UIMedium&)));1835 connect (&vboxGlobal(), SIGNAL (mediumUpdated (const UIMedium&)),1836 this, SLOT (sltHandleMediumUpdated (const UIMedium&)));1837 connect (&vboxGlobal(), SIGNAL (mediumRemoved (UIMediumType, const QString&)),1838 this, SLOT (sltHandleMediumRemoved (UIMediumType, const QString&)));1832 /* Setup connections: */ 1833 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const UIMedium&)), 1834 this, SLOT(sltHandleMediumUpdated(const UIMedium&))); 1835 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const UIMedium&)), 1836 this, SLOT(sltHandleMediumUpdated(const UIMedium&))); 1837 connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)), 1838 this, SLOT(sltHandleMediumDeleted(const QString&))); 1839 1839 connect (mAddCtrAction, SIGNAL (triggered (bool)), this, SLOT (addController())); 1840 1840 connect (mAddIDECtrAction, SIGNAL (triggered (bool)), this, SLOT (addIDEController())); … … 2271 2271 } 2272 2272 2273 void UIMachineSettingsStorage::sltHandleMediumUpdated(const UIMedium & aMedium)2273 void UIMachineSettingsStorage::sltHandleMediumUpdated(const UIMedium &medium) 2274 2274 { 2275 2275 QModelIndex rootIndex = mStorageModel->root(); … … 2281 2281 QModelIndex attIndex = ctrIndex.child (j, 0); 2282 2282 QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString(); 2283 if (attMediumId == aMedium.id())2283 if (attMediumId == medium.id()) 2284 2284 { 2285 2285 mStorageModel->setData (attIndex, attMediumId, StorageModel::R_AttMediumId); … … 2292 2292 } 2293 2293 2294 void UIMachineSettingsStorage::sltHandleMedium Removed(UIMediumType /* aType */, const QString &aMediumId)2294 void UIMachineSettingsStorage::sltHandleMediumDeleted(const QString &strMediumID) 2295 2295 { 2296 2296 QModelIndex rootIndex = mStorageModel->root(); … … 2302 2302 QModelIndex attIndex = ctrIndex.child (j, 0); 2303 2303 QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString(); 2304 if (attMediumId == aMediumId)2304 if (attMediumId == strMediumID) 2305 2305 { 2306 2306 mStorageModel->setData (attIndex, UIMedium().id(), StorageModel::R_AttMediumId); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r47998 r48260 682 682 private slots: 683 683 684 void sltHandleMediumUpdated(const UIMedium &aMedium); 685 void sltHandleMediumRemoved(UIMediumType aType, const QString &aMediumId); 684 /* Handlers: Medium-processing stuff: */ 685 void sltHandleMediumUpdated(const UIMedium &medium); 686 void sltHandleMediumDeleted(const QString &strMediumID); 686 687 687 688 void addController(); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
r48124 r48260 41 41 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationStarted()), 42 42 this, SLOT(sltHandleMediumEnumerationStart())); 43 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated 44 this, SLOT(sltHandleMedium Enumerated(const UIMedium&)));45 46 /* Setup update handlers*/47 connect (&vboxGlobal(), SIGNAL (mediumAdded (const UIMedium&)),48 this, SLOT (mediumAdded (const UIMedium&)));49 connect (&vboxGlobal(), SIGNAL (mediumUpdated (const UIMedium&)),50 this, SLOT (mediumUpdated (const UIMedium&)));51 connect (&vboxGlobal(), SIGNAL (mediumRemoved (UIMediumType, const QString&)),52 this, SLOT (mediumRemoved (UIMediumType, const QString&)));43 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const UIMedium&)), 44 this, SLOT(sltHandleMediumUpdated(const UIMedium&))); 45 46 /* Setup medium-processing handlers: */ 47 connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const UIMedium&)), 48 this, SLOT(sltHandleMediumCreated(const UIMedium&))); 49 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const UIMedium&)), 50 this, SLOT(sltHandleMediumUpdated(const UIMedium&))); 51 connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)), 52 this, SLOT(sltHandleMediumDeleted(const QString&))); 53 53 54 54 /* Setup other connections */ … … 69 69 VBoxMediaList list (vboxGlobal().currentMediaList()); 70 70 foreach (UIMedium medium, list) 71 mediumAdded(medium);71 sltHandleMediumCreated(medium); 72 72 73 73 /* If at least one real medium present, process null medium */ … … 173 173 } 174 174 175 void VBoxMediaComboBox::sltHandleMediumEnumerated(const UIMedium &aMedium) 176 { 177 mediumUpdated (aMedium); 178 } 179 180 void VBoxMediaComboBox::mediumAdded (const UIMedium &aMedium) 181 { 182 if (aMedium.isNull() || aMedium.type() == mType) 183 { 184 if (!mShowDiffs && aMedium.type() == UIMediumType_HardDisk) 175 void VBoxMediaComboBox::sltHandleMediumCreated(const UIMedium &medium) 176 { 177 if (medium.isNull() || medium.type() == mType) 178 { 179 if (!mShowDiffs && medium.type() == UIMediumType_HardDisk) 185 180 { 186 if ( aMedium.parent() != NULL)181 if (medium.parent() != NULL) 187 182 { 188 183 /* In !mShowDiffs mode, we ignore all diffs except ones that are 189 184 * directly attached to the related VM in the current state */ 190 if (! aMedium.isAttachedInCurStateTo (mMachineId))185 if (!medium.isAttachedInCurStateTo (mMachineId)) 191 186 return; 192 187 } 193 188 } 194 189 195 appendItem (aMedium);196 197 /* Activate the required item if there is any */198 if ( aMedium.id() == mLastId)199 setCurrentItem (aMedium.id());200 /* Select last added item if there is no item selected */190 appendItem(medium); 191 192 /* Activate the required item if there is any: */ 193 if (medium.id() == mLastId) 194 setCurrentItem(medium.id()); 195 /* Select last added item if there is no item selected: */ 201 196 else if (currentText().isEmpty()) 202 QComboBox::setCurrentIndex 203 } 204 } 205 206 void VBoxMediaComboBox:: mediumUpdated (const UIMedium &aMedium)207 { 208 if ( aMedium.isNull() || aMedium.type() == mType)197 QComboBox::setCurrentIndex(count() - 1); 198 } 199 } 200 201 void VBoxMediaComboBox::sltHandleMediumUpdated(const UIMedium &medium) 202 { 203 if (medium.isNull() || medium.type() == mType) 209 204 { 210 205 int index; 211 if (!findMediaIndex (aMedium.id(), index))206 if (!findMediaIndex(medium.id(), index)) 212 207 return; 213 208 214 replaceItem (index, aMedium);209 replaceItem(index, medium); 215 210 216 211 /* Emit the signal to ensure the parent dialog handles the change of 217 * the selected item's data */218 emit activated 219 } 220 } 221 222 void VBoxMediaComboBox:: mediumRemoved (UIMediumType aType,223 const QString &aId) 224 { 225 if ( mType != aType)212 * the selected item's data: */ 213 emit activated(currentIndex()); 214 } 215 } 216 217 void VBoxMediaComboBox::sltHandleMediumDeleted(const QString &strMediumID) 218 { 219 int index; 220 if (!findMediaIndex(strMediumID, index)) 226 221 return; 227 222 228 int index; 229 if (!findMediaIndex (aId, index)) 230 return; 231 232 removeItem (index); 233 mMedia.erase (mMedia.begin() + index); 234 235 /* If no real medium left, add the null medium */ 223 removeItem(index); 224 mMedia.erase(mMedia.begin() + index); 225 226 /* If no real medium left, add the null medium: */ 236 227 if (count() == 0) 237 mediumAdded(UIMedium());228 sltHandleMediumCreated(UIMedium()); 238 229 239 230 /* Emit the signal to ensure the parent dialog handles the change of 240 * the selected item */241 emit activated 231 * the selected item: */ 232 emit activated(currentIndex()); 242 233 } 243 234 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.h
r47998 r48260 52 52 protected slots: 53 53 54 /* Handler: Medium-enumeration stuff: */ 54 55 void sltHandleMediumEnumerationStart(); 55 void sltHandleMediumEnumerated(const UIMedium &);56 56 57 void mediumAdded (const UIMedium &); 58 void mediumUpdated (const UIMedium &); 59 void mediumRemoved (UIMediumType, const QString &); 57 /* Handlers: Medium-processing stuff: */ 58 void sltHandleMediumCreated(const UIMedium &medium); 59 void sltHandleMediumUpdated(const UIMedium &medium); 60 void sltHandleMediumDeleted(const QString &strMediumID); 60 61 61 62 void processActivated (int aIndex); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
r47927 r48260 103 103 m_virtualDisk = virtualDisk; 104 104 105 /* Inform everybody there is a new medium: */106 vboxGlobal(). addMedium(UIMedium(m_virtualDisk, UIMediumType_HardDisk, KMediumState_Created));105 /* Inform VBoxGlobal about it: */ 106 vboxGlobal().createMedium(UIMedium(m_virtualDisk, UIMediumType_HardDisk, KMediumState_Created)); 107 107 108 108 return true; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
r48259 r48260 103 103 104 104 /* Remember virtual-disk attributes: */ 105 QString str Id= m_virtualDisk.GetId();105 QString strMediumID = m_virtualDisk.GetId(); 106 106 QString strLocation = m_virtualDisk.GetLocation(); 107 107 /* Prepare delete storage progress: */ … … 117 117 msgCenter().cannotDeleteHardDiskStorage(m_virtualDisk, strLocation, thisImp()); 118 118 119 /* Remove virtual-disk from GUI anyway: */120 vboxGlobal(). removeMedium(UIMediumType_HardDisk, strId);119 /* Inform VBoxGlobal about it: */ 120 vboxGlobal().deleteMedium(strMediumID); 121 121 122 122 /* Detach virtual-disk anyway: */
Note:
See TracChangeset
for help on using the changeset viewer.