- Timestamp:
- Jul 19, 2023 6:59:39 AM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 158477
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r100349 r100640 1675 1675 break; 1676 1676 case UIMediumDeviceType_DVD: 1677 uMediumId =UIVisoCreatorDialog::createViso(pActionPool, pParent, strDefaultFolder, strMachineName);1677 UIVisoCreatorDialog::createViso(pActionPool, pParent, strDefaultFolder, strMachineName); 1678 1678 break; 1679 1679 case UIMediumDeviceType_Floppy: … … 1686 1686 return QUuid(); 1687 1687 1688 /* Update the recent medium list only if the medium type is DVD or floppy: */1689 if (enmMediumType == UIMediumDeviceType_ DVD || enmMediumType == UIMediumDeviceType_Floppy)1688 /* Update the recent medium list only if the medium type is floppy since updating when a VISO is created is not optimal: */ 1689 if (enmMediumType == UIMediumDeviceType_Floppy) 1690 1690 updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location()); 1691 1691 return uMediumId; … … 1908 1908 } 1909 1909 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateAdHocVISO) 1910 uMediumID =UIVisoCreatorDialog::createViso(pActionPool, windowManager().mainWindowShown(),1911 1910 UIVisoCreatorDialog::createViso(pActionPool, windowManager().mainWindowShown(), 1911 strMachineFolder, comConstMachine.GetName()); 1912 1912 1913 1913 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateFloppyDisk) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r100630 r100640 184 184 m_pButtonBox->setDoNotPickDefaultButton(true); 185 185 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 186 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence(Qt::Key_Escape)); 186 187 pMainLayout->addWidget(m_pButtonBox); 187 188 … … 225 226 emit sigClosed(false); 226 227 } 227 228 228 229 229 void UIVisoSettingWidget::setSettings(const UIVisoCreatorWidget::Settings &settings) … … 445 445 setVisoName(fileInfo.completeBaseName()); 446 446 } 447 emit sigSave(); 447 448 } 448 449 … … 810 811 connect(m_pVisoCreatorWidget, &UIVisoCreatorWidget::sigSettingDialogToggle, 811 812 this, &UIVisoCreatorDialog::sltSettingDialogToggle); 813 connect(m_pVisoCreatorWidget, &UIVisoCreatorWidget::sigSave, 814 this, &UIVisoCreatorDialog::sltSave); 812 815 } 813 816 … … 891 894 } 892 895 896 void UIVisoCreatorDialog::sltSave() 897 { 898 saveVISOFile(); 899 } 900 893 901 void UIVisoCreatorDialog::loadSettings() 894 902 { … … 928 936 929 937 /* static */ 930 QUuid UIVisoCreatorDialog::createViso(UIActionPool *pActionPool, QWidget *pParent,931 932 938 void UIVisoCreatorDialog::createViso(UIActionPool *pActionPool, QWidget *pParent, 939 const QString &strDefaultFolder /* = QString() */, 940 const QString &strMachineName /* = QString() */) 933 941 { 934 942 QString strVisoSaveFolder(strDefaultFolder); … … 939 947 UIVisoCreatorDialog *pVisoCreator = new UIVisoCreatorDialog(pActionPool, pDialogParent, 940 948 strVisoSaveFolder, strMachineName); 941 AssertPtrReturn (pVisoCreator, QUuid());949 AssertPtrReturnVoid(pVisoCreator); 942 950 943 951 windowManager().registerNewParent(pVisoCreator, pDialogParent); … … 946 954 if (pVisoCreator->exec(false /* not application modal */)) 947 955 { 948 QStringList VisoEntryList = pVisoCreator->entryList(); 949 QString strImportedISOPath = pVisoCreator->importedISOPath(); 950 if ((VisoEntryList.empty() || VisoEntryList[0].isEmpty()) && strImportedISOPath.isEmpty()) 956 if (pVisoCreator->saveVISOFile()) 957 gEDataManager->setVISOCreatorRecentFolder(pVisoCreator->currentPath()); 958 } 959 960 delete pVisoCreator; 961 return; 962 } 963 964 bool UIVisoCreatorDialog::saveVISOFile() 965 { 966 QStringList VisoEntryList = entryList(); 967 QString strImportedISOPath = importedISOPath(); 968 if ((VisoEntryList.empty() || VisoEntryList[0].isEmpty()) && strImportedISOPath.isEmpty()) 969 return false; 970 971 QFile file(visoFileFullPath()); 972 if (file.open(QFile::WriteOnly | QFile::Truncate)) 973 { 974 QString strVisoName = visoName(); 975 976 QTextStream stream(&file); 977 stream << QString("%1 %2").arg("--iprt-iso-maker-file-marker-bourne-sh").arg(QUuid::createUuid().toString()) << "\n"; 978 stream<< "--volume-id=" << strVisoName << "\n"; 979 if (!strImportedISOPath.isEmpty()) 980 stream << "--import-iso=" << strImportedISOPath << "\n"; 981 stream << VisoEntryList.join("\n"); 982 if (!customOptions().isEmpty()) 951 983 { 952 delete pVisoCreator;953 return QUuid();984 stream << "\n"; 985 stream << customOptions().join("\n"); 954 986 } 955 956 QFile file(pVisoCreator->visoFileFullPath()); 957 if (file.open(QFile::WriteOnly | QFile::Truncate)) 958 { 959 QString strVisoName = pVisoCreator->visoName(); 960 if (strVisoName.isEmpty()) 961 strVisoName = strMachineName; 962 963 QTextStream stream(&file); 964 stream << QString("%1 %2").arg("--iprt-iso-maker-file-marker-bourne-sh").arg(QUuid::createUuid().toString()) << "\n"; 965 stream<< "--volume-id=" << strVisoName << "\n"; 966 if (!strImportedISOPath.isEmpty()) 967 stream << "--import-iso=" << strImportedISOPath << "\n"; 968 stream << VisoEntryList.join("\n"); 969 if (!pVisoCreator->customOptions().isEmpty()) 970 { 971 stream << "\n"; 972 stream << pVisoCreator->customOptions().join("\n"); 973 } 974 file.close(); 975 } 976 } // if (pVisoCreator->exec(false /* not application modal */)) 977 gEDataManager->setVISOCreatorRecentFolder(pVisoCreator->currentPath()); 978 979 delete pVisoCreator; 980 return QUuid(); 981 } 982 987 file.close(); 988 } 989 return true; 990 } 983 991 984 992 #include "UIVisoCreator.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r100500 r100640 70 70 void sigVisoFilePathChanged(const QString &strPath); 71 71 void sigSettingDialogToggle(bool fDialogShown); 72 void sigSave(); 72 73 73 74 public: … … 192 193 * @param pParent Passes the dialog parent. 193 194 * @param strDefaultFolder Passes the folder to save the VISO file. 194 * @param strMachineName Passes the name of the machine, 195 * returns the UUID of the created medium or a null QUuid. */ 196 static QUuid createViso(UIActionPool *pActionPool, QWidget *pParent, 197 const QString &strDefaultFolder = QString(), 198 const QString &strMachineName = QString()); 195 * @param strMachineName Passes the name of the machine. */ 196 static void createViso(UIActionPool *pActionPool, QWidget *pParent, 197 const QString &strDefaultFolder = QString(), 198 const QString &strMachineName = QString()); 199 199 200 200 protected: … … 208 208 void sltVisoFilePathChanged(const QString &strPath); 209 209 void sltSettingDialogToggle(bool fIsShown); 210 void sltSave(); 210 211 211 212 private: 213 214 bool saveVISOFile(); 212 215 void prepareWidgets(const QString& strVisoSavePath, const QString &strMachineName); 213 216 virtual void retranslateUi() final override;
Note:
See TracChangeset
for help on using the changeset viewer.