Changeset 90763 in vbox
- Timestamp:
- Aug 20, 2021 3:34:22 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r90761 r90763 121 121 UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard()); 122 122 AssertReturnVoid(pWizard); 123 QString strSelectedPath = UIWizardNewVDSizeLocation::selectNewMediumLocation(pWizard); 123 CMediumFormat comMediumFormat(pWizard->mediumFormat()); 124 QString strSelectedPath = 125 UIDiskEditorGroupBox::openFileDialogForDiskFile(pWizard->mediumPath(), comMediumFormat, 126 KDeviceType_HardDisk, pWizard); 124 127 if (strSelectedPath.isEmpty()) 125 128 return; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageSizeLocation.cpp
r90761 r90763 30 30 /* COM includes: */ 31 31 #include "CSystemProperties.h" 32 33 QString UIWizardNewVDSizeLocation::selectNewMediumLocation(UIWizardNewVD *pWizard)34 {35 AssertReturn(pWizard, QString());36 QString strChosenFilePath;37 /* Get current folder and filename: */38 QFileInfo fullFilePath(pWizard->mediumPath());39 QDir folder = fullFilePath.path();40 QString strFileName = fullFilePath.fileName();41 42 /* Set the first parent folder that exists as the current: */43 while (!folder.exists() && !folder.isRoot())44 {45 QFileInfo folderInfo(folder.absolutePath());46 if (folder == QDir(folderInfo.absolutePath()))47 break;48 folder = folderInfo.absolutePath();49 }50 AssertReturn(folder.exists() && !folder.isRoot(), strChosenFilePath);51 52 QVector<QString> fileExtensions;53 QVector<KDeviceType> deviceTypes;54 CMediumFormat mediumFormat = pWizard->mediumFormat();55 mediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes);56 QStringList validExtensionList;57 for (int i = 0; i < fileExtensions.size(); ++i)58 if (deviceTypes[i] == KDeviceType_HardDisk)59 validExtensionList << QString("*.%1").arg(fileExtensions[i]);60 /* Compose full filter list: */61 QString strBackendsList = QString("%1 (%2)").arg(mediumFormat.GetName()).arg(validExtensionList.join(" "));62 63 strChosenFilePath = QIFileDialog::getSaveFileName(folder.absoluteFilePath(strFileName),64 strBackendsList, pWizard,65 UICommon::tr("Please choose a location for new virtual hard disk file"));66 return strChosenFilePath;67 }68 69 32 70 33 UIWizardNewVDPageSizeLocation::UIWizardNewVDPageSizeLocation(const QString &strDefaultName, … … 101 64 UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard()); 102 65 AssertReturnVoid(pWizard); 103 QString strSelectedPath = UIWizardNewVDSizeLocation::selectNewMediumLocation(pWizard); 66 CMediumFormat comMediumFormat(pWizard->mediumFormat()); 67 QString strSelectedPath = 68 UIDiskEditorGroupBox::openFileDialogForDiskFile(pWizard->mediumPath(), comMediumFormat, 69 KDeviceType_HardDisk, pWizard); 70 104 71 if (strSelectedPath.isEmpty()) 105 72 return; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageSizeLocation.h
r90427 r90763 29 29 class UIMediumSizeAndPathGroupBox; 30 30 class UIWizardNewVD; 31 32 namespace UIWizardNewVDSizeLocation33 {34 QString selectNewMediumLocation(UIWizardNewVD *pWizard);35 }36 31 37 32 class SHARED_LIBRARY_STUFF UIWizardNewVDPageSizeLocation : public UINativeWizardPage -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPageBasic.cpp
r90748 r90763 56 56 return QUuid(); 57 57 return uMediumId; 58 }59 60 QString UIWizardNewVMDiskPage::selectNewMediumLocation(UIWizardNewVM *pWizard)61 {62 AssertReturn(pWizard, QString());63 QString strChosenFilePath;64 /* Get current folder and filename: */65 QFileInfo fullFilePath(pWizard->mediumPath());66 QDir folder = fullFilePath.path();67 QString strFileName = fullFilePath.fileName();68 69 /* Set the first parent folder that exists as the current: */70 while (!folder.exists() && !folder.isRoot())71 {72 QFileInfo folderInfo(folder.absolutePath());73 if (folder == QDir(folderInfo.absolutePath()))74 break;75 folder = folderInfo.absolutePath();76 }77 AssertReturn(folder.exists() && !folder.isRoot(), strChosenFilePath);78 79 QVector<QString> fileExtensions;80 QVector<KDeviceType> deviceTypes;81 CMediumFormat mediumFormat = pWizard->mediumFormat();82 mediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes);83 QStringList validExtensionList;84 for (int i = 0; i < fileExtensions.size(); ++i)85 if (deviceTypes[i] == KDeviceType_HardDisk)86 validExtensionList << QString("*.%1").arg(fileExtensions[i]);87 /* Compose full filter list: */88 QString strBackendsList = QString("%1 (%2)").arg(mediumFormat.GetName()).arg(validExtensionList.join(" "));89 90 strChosenFilePath = QIFileDialog::getSaveFileName(folder.absoluteFilePath(strFileName),91 strBackendsList, pWizard,92 UICommon::tr("Please choose a location for new virtual hard disk file"));93 return strChosenFilePath;94 58 } 95 59 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPageBasic.h
r90413 r90763 59 59 const QString &strMachineBaseName, 60 60 QWidget *pCaller); 61 QString selectNewMediumLocation(UIWizardNewVM *pWizard);62 61 } 63 62 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r90761 r90763 692 692 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 693 693 AssertReturnVoid(pWizard); 694 QString strSelectedPath = UIWizardNewVMDiskPage::selectNewMediumLocation(pWizard); 694 CMediumFormat comMediumFormat(pWizard->mediumFormat()); 695 QString strSelectedPath = 696 UIDiskEditorGroupBox::openFileDialogForDiskFile(pWizard->mediumPath(), comMediumFormat, KDeviceType_HardDisk, pWizard); 695 697 if (strSelectedPath.isEmpty()) 696 698 return;
Note:
See TracChangeset
for help on using the changeset viewer.