- Timestamp:
- Apr 12, 2017 4:03:58 PM (8 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
r66460 r66541 692 692 KStorageBus aBusType, KStorageControllerType aControllerType) 693 693 : AbstractItem (aParent) 694 , mOldCtrName (aName) 694 695 , mCtrName (aName) 695 696 , mCtrType (0) … … 743 744 { 744 745 return mCtrType->busType(); 746 } 747 748 QString ControllerItem::oldCtrName() const 749 { 750 return mOldCtrName; 745 751 } 746 752 … … 1403 1409 } 1404 1410 1411 case R_CtrOldName: 1412 { 1413 if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer())) 1414 if (item->rtti() == AbstractItem::Type_ControllerItem) 1415 return static_cast <ControllerItem*> (item)->oldCtrName(); 1416 return QString(); 1417 } 1405 1418 case R_CtrName: 1406 1419 { … … 2181 2194 for (int iControllerIndex = 0; iControllerIndex < controllers.size(); ++iControllerIndex) 2182 2195 { 2183 /* Prepare old controller data : */2196 /* Prepare old controller data & cache key: */ 2184 2197 UIDataSettingsMachineStorageController oldControllerData; 2198 QString strControllerKey = QString::number(iControllerIndex); 2185 2199 2186 2200 /* Check whether controller is valid: */ … … 2194 2208 oldControllerData.m_uPortCount = comController.GetPortCount(); 2195 2209 oldControllerData.m_fUseHostIOCache = comController.GetUseHostIOCache(); 2210 /* Override controller cache key: */ 2211 strControllerKey = oldControllerData.m_strControllerName; 2196 2212 2197 2213 /* Sort attachments before caching/fetching: */ … … 2210 2226 for (int iAttachmentIndex = 0; iAttachmentIndex < attachments.size(); ++iAttachmentIndex) 2211 2227 { 2212 /* Prepare old attachment data : */2228 /* Prepare old attachment data & cache key: */ 2213 2229 UIDataSettingsMachineStorageAttachment oldAttachmentData; 2230 QString strAttachmentKey = QString::number(iAttachmentIndex); 2214 2231 2215 2232 /* Check whether attachment is valid: */ … … 2227 2244 const CMedium comMedium = comAttachment.GetMedium(); 2228 2245 oldAttachmentData.m_strAttachmentMediumId = comMedium.isNull() ? UIMedium::nullID() : comMedium.GetId(); 2246 /* Override controller cache key: */ 2247 strAttachmentKey = QString("%1:%2").arg(oldAttachmentData.m_iAttachmentPort).arg(oldAttachmentData.m_iAttachmentDevice); 2229 2248 } 2230 2249 2231 2250 /* Cache old attachment data: */ 2232 m_pCache->child( iControllerIndex).child(iAttachmentIndex).cacheInitialData(oldAttachmentData);2251 m_pCache->child(strControllerKey).child(strAttachmentKey).cacheInitialData(oldAttachmentData); 2233 2252 } 2234 2253 } 2235 2254 2236 2255 /* Cache old controller data: */ 2237 m_pCache->child( iControllerIndex).cacheInitialData(oldControllerData);2256 m_pCache->child(strControllerKey).cacheInitialData(oldControllerData); 2238 2257 } 2239 2258 … … 2318 2337 UIDataSettingsMachineStorageController newControllerData; 2319 2338 2320 /* Gather new controller data from model: */2339 /* Gather new controller data & cache key from model: */ 2321 2340 const QModelIndex controllerIndex = m_pModelStorage->index(iControllerIndex, 0, rootIndex); 2322 2341 newControllerData.m_strControllerName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString(); … … 2325 2344 newControllerData.m_uPortCount = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrPortCount).toUInt(); 2326 2345 newControllerData.m_fUseHostIOCache = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrIoCache).toBool(); 2346 const QString strControllerKey = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrOldName).toString(); 2327 2347 2328 2348 /* For each attachment: */ … … 2332 2352 UIDataSettingsMachineStorageAttachment newAttachmentData; 2333 2353 2334 /* Gather new controller datafrom model: */2354 /* Gather new attachment data & cache key from model: */ 2335 2355 const QModelIndex attachmentIndex = m_pModelStorage->index(iAttachmentIndex, 0, controllerIndex); 2336 2356 newAttachmentData.m_attachmentType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>(); … … 2343 2363 newAttachmentData.m_fAttachmentHotPluggable = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool(); 2344 2364 newAttachmentData.m_strAttachmentMediumId = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString(); 2365 const QString strAttachmentKey = QString("%1:%2").arg(newAttachmentData.m_iAttachmentPort).arg(newAttachmentData.m_iAttachmentDevice); 2345 2366 2346 2367 /* Cache new attachment data: */ 2347 m_pCache->child( iControllerIndex).child(iAttachmentIndex).cacheCurrentData(newAttachmentData);2368 m_pCache->child(strControllerKey).child(strAttachmentKey).cacheCurrentData(newAttachmentData); 2348 2369 } 2349 2370 2350 2371 /* Cache new controller data: */ 2351 m_pCache->child( iControllerIndex).cacheCurrentData(newControllerData);2372 m_pCache->child(strControllerKey).cacheCurrentData(newControllerData); 2352 2373 } 2353 2374 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r66444 r66541 330 330 331 331 KStorageBus ctrBusType() const; 332 QString oldCtrName() const; 332 333 QString ctrName() const; 333 334 KStorageControllerType ctrType() const; … … 361 362 void delChild (AbstractItem *aItem); 362 363 364 QString mOldCtrName; 363 365 QString mCtrName; 364 366 AbstractControllerType *mCtrType; … … 468 470 R_IsMoreAttachmentsPossible, 469 471 472 R_CtrOldName, 470 473 R_CtrName, 471 474 R_CtrType,
Note:
See TracChangeset
for help on using the changeset viewer.