VirtualBox

Changeset 99406 in vbox


Ignore:
Timestamp:
Apr 14, 2023 5:04:14 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156856
Message:

FE/Qt: bugref:6669: VirtualBox Manager: A bit of fixes for New VD wizard modal case, s.a. r156827.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp

    r99390 r99406  
    172172                                        const QString &strMachineGuestOSTypeId  /* = QString() */)
    173173{
    174     /* Initialize variables: */
    175     QString strDefaultFolder = strMachineFolder;
    176     if (strDefaultFolder.isEmpty())
    177         strDefaultFolder = uiCommon().defaultFolderPathForType(UIMediumDeviceType_HardDisk);
    178 
    179     /* In case we dont have a 'guest os type id' default back to 'Other': */
     174    /* Default path: */
     175    const QString strDefaultPath = !strMachineFolder.isEmpty()
     176                                 ? strMachineFolder
     177                                 : uiCommon().defaultFolderPathForType(UIMediumDeviceType_HardDisk);
     178
     179    /* Default name: */
     180    const QString strDiskName = uiCommon().findUniqueFileName(strDefaultPath,
     181                                                                !strMachineName.isEmpty()
     182                                                              ? strMachineName
     183                                                              : "NewVirtualDisk");
     184
     185    /* Default size: */
    180186    const CGuestOSType comGuestOSType = uiCommon().virtualBox().GetGuestOSType(  !strMachineGuestOSTypeId.isEmpty()
    181                                                                                  ? strMachineGuestOSTypeId
    182                                                                                  : "Other");
    183     const QString strDiskName = uiCommon().findUniqueFileName(strDefaultFolder,   !strMachineName.isEmpty()
    184                                                                      ? strMachineName
    185                                                                      : "NewVirtualDisk");
    186 
    187     /* Show New VD wizard: */
    188     UISafePointerWizardNewVD pWizard = new UIWizardNewVD(pParent,
     187                                                                               ? strMachineGuestOSTypeId
     188                                                                               : "Other");
     189    const qulonglong uDefaultSize = comGuestOSType.GetRecommendedHDD();
     190
     191    /* Show New VD wizard the safe way: */
     192    QWidget *pRealParent = windowManager().realParentWindow(pParent);
     193    UISafePointerWizardNewVD pWizard = new UIWizardNewVD(pRealParent,
    189194                                                         strDiskName,
    190                                                          strDefaultFolder,
    191                                                          comGuestOSType.GetRecommendedHDD());
     195                                                         strDefaultPath,
     196                                                         uDefaultSize);
    192197    if (!pWizard)
    193198        return QUuid();
    194     QWidget *pDialogParent = windowManager().realParentWindow(pParent);
    195     windowManager().registerNewParent(pWizard, pDialogParent);
    196     QUuid mediumId = pWizard->mediumId();
     199    windowManager().registerNewParent(pWizard, pRealParent);
    197200    pWizard->exec();
     201    const QUuid uMediumId = pWizard->mediumId();
    198202    delete pWizard;
    199     return mediumId;
     203    return uMediumId;
    200204}
    201205
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