VirtualBox

Changeset 78542 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 16, 2019 11:00:44 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130588
Message:

FE/Qt: bugref:6247: VM Settings / Storage page: Make sure there is no excessive devices left for controller when bus type is changed to one with smaller amount of supported devices.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r78539 r78542  
    11231123                             "change to type which doesn't support optical devices.</p><p>If you proceed optical "
    11241124                             "devices will be removed.</p>"));
     1125}
     1126
     1127bool UIMessageCenter::confirmStorageBusChangeWithExcessiveRemoval(QWidget *pParent /* = 0 */) const
     1128{
     1129    return questionBinary(pParent, MessageType_Question,
     1130                          tr("<p>This controller has devices attached.  You have requested storage bus change to "
     1131                             "type which supports smaller amount of attached devices.</p><p>If you proceed "
     1132                             "excessive devices will be removed.</p>"));
    11251133}
    11261134
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r78539 r78542  
    320320    int confirmRemovingOfLastDVDDevice(QWidget *pParent = 0) const;
    321321    bool confirmStorageBusChangeWithOpticalRemoval(QWidget *pParent = 0) const;
     322    bool confirmStorageBusChangeWithExcessiveRemoval(QWidget *pParent = 0) const;
    322323    void cannotAttachDevice(const CMachine &machine, UIMediumDeviceType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0);
    323324    bool warnAboutIncorrectPort(QWidget *pParent = 0) const;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r78539 r78542  
    17151715                    }
    17161716
     1717                    /* Lets make sure there is enough of place for all the remaining attachments: */
     1718                    const uint uMaxPortCount =
     1719                        (uint)vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(enmNewCtrBusType);
     1720                    const uint uMaxDevicePerPortCount =
     1721                        (uint)vboxGlobal().virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus(enmNewCtrBusType);
     1722                    const QList<QUuid> ids = pItemController->attachmentIDs();
     1723                    if (uMaxPortCount * uMaxDevicePerPortCount < (uint)ids.size())
     1724                    {
     1725                        if (!msgCenter().confirmStorageBusChangeWithExcessiveRemoval())
     1726                            return false;
     1727                        for (int i = uMaxPortCount * uMaxDevicePerPortCount; i < ids.size(); ++i)
     1728                            delAttachment(pItemController->id(), ids.at(i));
     1729                    }
     1730
    17171731                    pItemController->setCtrBusType(enmNewCtrBusType);
    17181732                    emit dataChanged(aIndex, aIndex);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette