VirtualBox

Changeset 77195 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 7, 2019 12:17:13 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9340. In machine storage settings, replacing medium file selector with medium selector.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r77189 r77195  
    30363036                pCreateNewHardDisk->setIcon(iconPool()->icon(HDNewEn, HDNewDis));
    30373037                connect(pCreateNewHardDisk, SIGNAL(triggered(bool)), this, SLOT(sltCreateNewHardDisk()));
    3038                 /* Add "Choose a virtual hard disk file" action: */
    3039                 addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose Virtual Hard Disk File..."));
     3038                /* Add "Choose a virtual hard disk" action: */
     3039                addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose Virtual Hard Disk..."));
    30403040                /* Add recent media list: */
    30413041                addRecentMediumActions(pOpenMediumMenu, m_pMediumIdHolder->type());
     
    30443044            case UIMediumDeviceType_DVD:
    30453045            {
    3046                 /* Add "Choose a virtual optical disk file" action: */
    3047                 addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose Virtual Optical Disk File..."));
     3046                /* Add "Choose a virtual optical disk" action: */
     3047                addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose Virtual Optical Disk..."));
    30483048                /* Add "Choose a physical drive" actions: */
    30493049                addChooseHostDriveActions(pOpenMediumMenu);
     
    30603060            case UIMediumDeviceType_Floppy:
    30613061            {
    3062                 /* Add "Choose a virtual floppy disk file" action: */
    3063                 addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose Virtual Floppy Disk File..."));
     3062                /* Add "Choose a virtual floppy disk" action: */
     3063                addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose Virtual Floppy Disk..."));
    30643064                /* Add "Choose a physical drive" actions: */
    30653065                addChooseHostDriveActions(pOpenMediumMenu);
     
    30963096{
    30973097    const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
    3098     const QUuid uMediumId = vboxGlobal().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), this, strMachineFolder);
    3099     if (!uMediumId.isNull())
    3100         m_pMediumIdHolder->setId(uMediumId);
     3098
     3099    QUuid uMediumId;
     3100    int iResult = vboxGlobal().openMediumSelectorDialog(this, m_pMediumIdHolder->type(), uMediumId,
     3101                                                        m_strMachineName, strMachineFolder,
     3102                                                        m_strMachineGuestOSTypeId);
     3103
     3104    if (iResult == UIMediumSelector::ReturnCode_Rejected ||
     3105        (iResult == UIMediumSelector::ReturnCode_Accepted && uMediumId.isNull()))
     3106        return;
     3107    if (iResult == static_cast<int>(UIMediumSelector::ReturnCode_LeftEmpty) &&
     3108        (m_pMediumIdHolder->type() != UIMediumDeviceType_DVD && m_pMediumIdHolder->type() != UIMediumDeviceType_Floppy))
     3109        return;
     3110
     3111    m_pMediumIdHolder->setId(uMediumId);
    31013112}
    31023113
     
    37953806    Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool());
    37963807    Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool());
    3797     const QString strControllerName(m_pModelStorage->data(index, StorageModel::R_CtrName).toString());
     3808    // const QString strControllerName(m_pModelStorage->data(index, StorageModel::R_CtrName).toString());
    37983809    const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
    37993810
    38003811    QUuid uMediumId;
    3801     int iAnswer = static_cast<int>(UIMediumSelector::ReturnCode_Rejected);
    3802 
    3803     switch (enmDevice)
    3804     {
    3805         case KDeviceType_HardDisk:
    3806         {
    3807             iAnswer = vboxGlobal().openMediumSelectorDialog(this, UIMediumDeviceType_HardDisk, uMediumId,
    3808                                                             m_strMachineName, strMachineFolder,
    3809                                                             m_strMachineGuestOSTypeId);
    3810             break;
    3811         }
    3812         case KDeviceType_DVD:
    3813         {
    3814             iAnswer = vboxGlobal().openMediumSelectorDialog(this, UIMediumDeviceType_DVD, uMediumId,
    3815                                                             m_strMachineName, strMachineFolder);
    3816             break;
    3817         }
    3818         case KDeviceType_Floppy:
    3819         {
    3820             iAnswer = vboxGlobal().openMediumSelectorDialog(this, UIMediumDeviceType_Floppy, uMediumId,
    3821                                                             m_strMachineName, strMachineFolder);
    3822         }
    3823         default: break; /* Shut up, MSC! */
    3824     }
    3825     /* continue only if iAnswer is either UIMediumSelector::ReturnCode_Accepted or UIMediumSelector::ReturnCode_LeftEmpty: */
    3826     if (iAnswer != static_cast<int>(UIMediumSelector::ReturnCode_Accepted) &&
    3827         iAnswer != static_cast<int>(UIMediumSelector::ReturnCode_LeftEmpty))
     3812    int iResult = vboxGlobal().openMediumSelectorDialog(this, UIMediumDefs::mediumTypeToLocal(enmDevice), uMediumId,
     3813                                                        m_strMachineName, strMachineFolder,
     3814                                                        m_strMachineGuestOSTypeId);
     3815
     3816    /* Continue only if iResult is either UIMediumSelector::ReturnCode_Accepted or UIMediumSelector::ReturnCode_LeftEmpty: */
     3817    /* If iResult is UIMediumSelector::ReturnCode_Accepted then we have to have a valid uMediumId: */
     3818    if (iResult == UIMediumSelector::ReturnCode_Rejected ||
     3819        (iResult == UIMediumSelector::ReturnCode_Accepted && uMediumId.isNull()))
    38283820        return;
    38293821
    38303822    /* Only DVDs and floppy can be created empty: */
    3831     if (iAnswer == static_cast<int>(UIMediumSelector::ReturnCode_LeftEmpty) &&
    3832         (enmDevice != KDeviceType_DVD && enmDevice != KDeviceType_Floppy))
    3833         return;
    3834 
    3835     /* if iAnswer is UIMediumSelector::ReturnCode_Accepted then we have to have a valid uMediumId: */
    3836     if (iAnswer == static_cast<int>(UIMediumSelector::ReturnCode_Accepted) && uMediumId.isNull())
     3823    if (iResult == static_cast<int>(UIMediumSelector::ReturnCode_LeftEmpty) &&
     3824        (m_pMediumIdHolder->type() != UIMediumDeviceType_DVD && m_pMediumIdHolder->type() != UIMediumDeviceType_Floppy))
    38373825        return;
    38383826
Note: See TracChangeset for help on using the changeset viewer.

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