- Timestamp:
- May 20, 2019 12:11:10 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r78596 r78597 1918 1918 } 1919 1919 1920 void StorageModel::moveAttachment(const QUuid &uAttId, const QUuid &uCtrOldId, const QUuid &uCtrNewId) 1921 { 1922 /* No known info about attachment device type and medium ID: */ 1923 KDeviceType enmDeviceType = KDeviceType_Null; 1924 QUuid uMediumId; 1925 1926 /* First of all we are looking for old controller item: */ 1927 AbstractItem *pOldItem = mRootItem->childItemById(uCtrOldId); 1928 if (pOldItem) 1929 { 1930 /* And acquire controller position: */ 1931 const int iOldCtrPosition = mRootItem->posOfChild(pOldItem); 1932 1933 /* Then we are looking for an attachment item: */ 1934 if (AbstractItem *pSubItem = pOldItem->childItemById(uAttId)) 1935 { 1936 /* And make sure this is really an attachment: */ 1937 AttachmentItem *pSubItemAttachment = qobject_cast<AttachmentItem*>(pSubItem); 1938 if (pSubItemAttachment) 1939 { 1940 /* This way we can acquire actual attachment device type and medium ID: */ 1941 enmDeviceType = pSubItemAttachment->attDeviceType(); 1942 uMediumId = pSubItemAttachment->attMediumId(); 1943 1944 /* And delete atachment item finally: */ 1945 const int iAttPosition = pOldItem->posOfChild(pSubItem); 1946 beginRemoveRows(index(iOldCtrPosition, 0, root()), iAttPosition, iAttPosition); 1947 delete pSubItem; 1948 endRemoveRows(); 1949 } 1950 } 1951 } 1952 1953 /* As the last step we are looking for new controller item: */ 1954 AbstractItem *pNewItem = mRootItem->childItemById(uCtrNewId); 1955 if (pNewItem) 1956 { 1957 /* And acquire controller position: */ 1958 const int iNewCtrPosition = mRootItem->posOfChild(pNewItem); 1959 1960 /* Then we have to make sure moved attachment is valid: */ 1961 if (enmDeviceType != KDeviceType_Null && !uMediumId.isNull()) 1962 { 1963 /* And create new attachment item finally: */ 1964 QModelIndex newCtrIndex = index(iNewCtrPosition, 0, root()); 1965 beginInsertRows(newCtrIndex, pNewItem->childCount(), pNewItem->childCount()); 1966 AttachmentItem *pItem = new AttachmentItem(pNewItem, enmDeviceType); 1967 pItem->setAttIsHotPluggable(m_configurationAccessLevel != ConfigurationAccessLevel_Full); 1968 pItem->setAttMediumId(uMediumId); 1969 endInsertRows(); 1970 } 1971 } 1972 } 1973 1920 1974 void StorageModel::setMachineId (const QUuid &uMachineId) 1921 1975 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r78596 r78597 487 487 QModelIndex addAttachment (const QUuid &uCtrId, KDeviceType aDeviceType, const QUuid &uMediumId); 488 488 void delAttachment (const QUuid &uCtrId, const QUuid &uAttId); 489 /** Moves attachment determined by @a uAttId 490 * from controller determined by @a uCtrOldId to one determined by @a uCtrNewId. */ 491 void moveAttachment(const QUuid &uAttId, const QUuid &uCtrOldId, const QUuid &uCtrNewId); 489 492 490 493 void setMachineId (const QUuid &uMachineId);
Note:
See TracChangeset
for help on using the changeset viewer.