Changeset 77195 in vbox for trunk/src/VBox
- Timestamp:
- Feb 7, 2019 12:17:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r77189 r77195 3036 3036 pCreateNewHardDisk->setIcon(iconPool()->icon(HDNewEn, HDNewDis)); 3037 3037 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...")); 3040 3040 /* Add recent media list: */ 3041 3041 addRecentMediumActions(pOpenMediumMenu, m_pMediumIdHolder->type()); … … 3044 3044 case UIMediumDeviceType_DVD: 3045 3045 { 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...")); 3048 3048 /* Add "Choose a physical drive" actions: */ 3049 3049 addChooseHostDriveActions(pOpenMediumMenu); … … 3060 3060 case UIMediumDeviceType_Floppy: 3061 3061 { 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...")); 3064 3064 /* Add "Choose a physical drive" actions: */ 3065 3065 addChooseHostDriveActions(pOpenMediumMenu); … … 3096 3096 { 3097 3097 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); 3101 3112 } 3102 3113 … … 3795 3806 Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool()); 3796 3807 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()); 3798 3809 const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath()); 3799 3810 3800 3811 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())) 3828 3820 return; 3829 3821 3830 3822 /* 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)) 3837 3825 return; 3838 3826
Note:
See TracChangeset
for help on using the changeset viewer.