Changeset 78539 in vbox for trunk/src/VBox
- Timestamp:
- May 16, 2019 9:42:39 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130584
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r78396 r78539 1115 1115 QString() /* cancel button text */, 1116 1116 false /* ok button by default? */); 1117 } 1118 1119 bool UIMessageCenter::confirmStorageBusChangeWithOpticalRemoval(QWidget *pParent /* = 0 */) const 1120 { 1121 return questionBinary(pParent, MessageType_Question, 1122 tr("<p>This controller has optical devices attached. You have requested storage bus " 1123 "change to type which doesn't support optical devices.</p><p>If you proceed optical " 1124 "devices will be removed.</p>")); 1117 1125 } 1118 1126 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r78396 r78539 319 319 bool confirmSettingsReloading(QWidget *pParent = 0) const; 320 320 int confirmRemovingOfLastDVDDevice(QWidget *pParent = 0) const; 321 bool confirmStorageBusChangeWithOpticalRemoval(QWidget *pParent = 0) const; 321 322 void cannotAttachDevice(const CMachine &machine, UIMediumDeviceType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0); 322 323 bool warnAboutIncorrectPort(QWidget *pParent = 0) const; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r78538 r78539 805 805 } 806 806 807 QList<QUuid> ControllerItem::attachmentIDs(KDeviceType enmType /* = KDeviceType_Null */) const 808 { 809 QList<QUuid> ids; 810 foreach (AbstractItem *pItem, mAttachments) 811 { 812 AttachmentItem *pItemAttachment = static_cast<AttachmentItem*>(pItem); 813 if ( enmType == KDeviceType_Null 814 || pItemAttachment->attDeviceType() == enmType) 815 ids << pItem->id(); 816 } 817 return ids; 818 } 819 807 820 AbstractItem::ItemType ControllerItem::rtti() const 808 821 { … … 1687 1700 ControllerItem *pItemController = static_cast<ControllerItem*>(pItem); 1688 1701 const KStorageBus enmNewCtrBusType = aValue.value<KStorageBus>(); 1702 1703 /* PCIe devices allows for hard-drives attachments only, 1704 * no optical devices. So, lets make sure that rule is fulfilled. */ 1705 if (enmNewCtrBusType == KStorageBus_PCIe) 1706 { 1707 const QList<QUuid> opticalIds = pItemController->attachmentIDs(KDeviceType_DVD); 1708 if (!opticalIds.isEmpty()) 1709 { 1710 if (!msgCenter().confirmStorageBusChangeWithOpticalRemoval()) 1711 return false; 1712 foreach (const QUuid &uId, opticalIds) 1713 delAttachment(pItemController->id(), uId); 1714 } 1715 } 1716 1689 1717 pItemController->setCtrBusType(enmNewCtrBusType); 1690 1718 emit dataChanged(aIndex, aIndex); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r78538 r78539 278 278 SlotsList ctrUsedSlots() const; 279 279 DeviceTypeList ctrDeviceTypeList() const; 280 281 QList<QUuid> attachmentIDs(KDeviceType enmType = KDeviceType_Null) const; 280 282 281 283 void setAttachments(const QList<AbstractItem*> &attachments) { mAttachments = attachments; }
Note:
See TracChangeset
for help on using the changeset viewer.