VirtualBox

Changeset 77170 in vbox


Ignore:
Timestamp:
Feb 6, 2019 9:18:49 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9340. Adding create action to medium selection dialog

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r77167 r77170  
    26362636QUuid VBoxGlobal::createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strMachineName, const QString &strFolder)
    26372637{
    2638 
    26392638    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
    26402639    QPointer<UIVisoCreator> pVisoCreator = new UIVisoCreator(pDialogParent, strMachineName);
     
    27212720QUuid VBoxGlobal::showCreateFloppyDiskDialog(QWidget *pParent, const QString &strMachineName, const QString &strMachineFolder)
    27222721{
     2722    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
     2723
    27232724    UIFDCreationDialog *pDialog = new UIFDCreationDialog(pParent, strMachineName, strMachineFolder);
     2725    if (!pDialog)
     2726        return QUuid();
     2727    windowManager().registerNewParent(pDialog, pDialogParent);
     2728
    27242729    if (pDialog->exec())
    27252730    {
     
    27312736
    27322737QUuid VBoxGlobal::openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType  enmMediumType,
    2733                                            const QString &strMachineName, const QString &strMachineFolder)
     2738                                           const QString &strMachineName, const QString &strMachineFolder,
     2739                                           const QString &strMachineGuestOSTypeId  /* = QString() */)
    27342740{
    27352741    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
    27362742    QPointer<UIMediumSelector> pSelector = new UIMediumSelector(enmMediumType, strMachineName,
    2737                                                                 strMachineFolder, pDialogParent);
     2743                                                                strMachineFolder, strMachineGuestOSTypeId, pDialogParent);
    27382744
    27392745    if (!pSelector)
    2740         return QString();
     2746        return QUuid();
    27412747    windowManager().registerNewParent(pSelector, pDialogParent);
    27422748    if (pSelector->exec(false))
     
    27622768    /* Show New VD wizard: */
    27632769    UISafePointerWizardNewVD pWizard = new UIWizardNewVD(pParent, QString(), fileInfo.absolutePath(), comGuestOSType.GetRecommendedHDD());
     2770
     2771    if (!pWizard)
     2772        return QUuid();
     2773    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
     2774    windowManager().registerNewParent(pWizard, pDialogParent);
    27642775    pWizard->prepare();
     2776
    27652777    const QUuid uResult = pWizard->exec() == QDialog::Accepted ? pWizard->virtualDisk().GetId() : QUuid();
    27662778    if (pWizard)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r77167 r77170  
    513513
    514514        /** Creates and shows a UIMediumSelector dialog.
    515           * @param  parent            Passes the parent of the dialog,
    516           * @param  enmMediumType     Passes the medium type.
    517           * @param  strMachineName    Passes the name of the machine,
    518           * @param  strMachineFolder  Passes the machine folder,
     515          * @param  parent                   Passes the parent of the dialog,
     516          * @param  enmMediumType            Passes the medium type.
     517          * @param  strMachineName           Passes the name of the machine,
     518          * @param  strMachineFolder         Passes the machine folder,
     519          * @param  strMachineGuestOSTypeId  Passes the type ID of machine's guest os,
    519520          * returns the ID of the  selected/created medium if successful, a null QUuid otherwise.*/
    520521        QUuid openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType  enmMediumType,
    521                                        const QString &strMachineName, const QString &strMachineFolder);
     522                                       const QString &strMachineName, const QString &strMachineFolder,
     523                                       const QString &strMachineGuestOSTypeId = QString());
    522524
    523525        /** Creates and shows a UIWizardNewVD wizard.
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp

    r77009 r77170  
    5555
    5656UIMediumSelector::UIMediumSelector(UIMediumDeviceType enmMediumType, const QString &machineName /* = QString() */,
    57                                    const QString &machineSettigFilePath /* = QString() */, QWidget *pParent /* = 0 */)
     57                                   const QString &machineSettingsFilePath /* = QString() */,
     58                                   const QString &strMachineGuestOSTypeId /*= QString() */, QWidget *pParent /* = 0 */)
    5859    :QIWithRetranslateUI<QIMainDialog>(pParent)
    5960    , m_pCentralWidget(0)
     
    7273    , m_pSearchWidget(0)
    7374    , m_iCurrentShownIndex(0)
    74     , m_strMachineSettingsFilePath(machineSettigFilePath)
     75    , m_strMachineSettingsFilePath(machineSettingsFilePath)
    7576    , m_strMachineName(machineName)
     77    , m_strMachineGuestOSTypeId(strMachineGuestOSTypeId)
    7678{
    7779    configure();
     
    176178    }
    177179
    178     /* Currently create is supported only for Floppy: */
    179     if (m_enmMediumType == UIMediumDeviceType_Floppy)
    180     {
    181         m_pActionCreate = new QAction(this);
    182     }
     180    m_pActionCreate = new QAction(this);
    183181    if (m_pActionCreate)
    184182    {
     
    407405void UIMediumSelector::sltCreateMedium()
    408406{
    409     QString strMachineFolder = QFileInfo(m_strMachineSettingsFilePath).absolutePath();
    410     UIFDCreationDialog *pDialog = new UIFDCreationDialog(this, m_strMachineName, strMachineFolder);
    411     if (pDialog->exec())
     407    QUuid uMediumId;
     408
     409    if (m_enmMediumType == UIMediumDeviceType_Floppy)
     410        uMediumId = vboxGlobal().showCreateFloppyDiskDialog(this, m_strMachineName, m_strMachineSettingsFilePath);
     411    else if (m_enmMediumType == UIMediumDeviceType_HardDisk)
     412        uMediumId = vboxGlobal().createHDWithNewHDWizard(this, m_strMachineGuestOSTypeId, m_strMachineSettingsFilePath);
     413    else if (m_enmMediumType == UIMediumDeviceType_DVD)
     414        uMediumId = vboxGlobal().createVisoMediumWithVisoCreator(this, m_strMachineName, m_strMachineSettingsFilePath);
     415
     416    if (!uMediumId.isNull())
    412417    {
    413418        repopulateTreeWidget();
    414         selectMedium(pDialog->mediumID());
    415     }
    416     delete pDialog;
     419        selectMedium(uMediumId);
     420    }
    417421}
    418422
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.h

    r77009 r77170  
    5252
    5353    UIMediumSelector(UIMediumDeviceType enmMediumType, const QString &machineName = QString(),
    54                      const QString &machineSettigFilePath = QString(), QWidget *pParent = 0);
     54                     const QString &machineSettingsFilePath = QString(), const QString &strMachineGuestOSTypeId = QString(),
     55                     QWidget *pParent = 0);
     56
    5557    QList<QUuid> selectedMediumIds() const;
    5658
     
    131133    QString               m_strMachineSettingsFilePath;
    132134    QString               m_strMachineName;
     135    QString               m_strMachineGuestOSTypeId;
    133136};
    134137
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r77167 r77170  
    38103810            else if (iAnswer == AlertButton_Choice2)
    38113811                uMediumId = vboxGlobal().openMediumSelectorDialog(this, UIMediumDeviceType_HardDisk,
    3812                                                                   m_strMachineName, m_strMachineSettingsFilePath);
     3812                                                                  m_strMachineName, m_strMachineSettingsFilePath,
     3813                                                                  m_strMachineGuestOSTypeId);
    38133814            else if (iAnswer == AlertButton_Cancel)
    38143815                fCancelled = true;
     
    38343835                uMediumId = vboxGlobal().openMediumSelectorDialog(this, UIMediumDeviceType_Floppy,
    38353836                                                                  m_strMachineName, m_strMachineSettingsFilePath);
     3837
    38363838            /* We allow creating an empty floppy drive: */
    38373839            else if (iAnswer == AlertButton_Choice1)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r77167 r77170  
    744744    /** Prepares connections. */
    745745    void prepareConnections();
    746     /** Opens medium selector dialog and retrieves uuid of a selected medium (if any). */
    747     QUuid openMediumSelectorDialog(UIMediumDeviceType  enmMediumType,
    748                                    const QString &strMachineName, const QString &strMachineSettingsFilePath);
     746
    749747    /** Cleanups all. */
    750748    void cleanup();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp

    r76606 r77170  
    6464    QUuid uMediumId = vboxGlobal().openMediumSelectorDialog(thisImp(), UIMediumDeviceType_HardDisk,
    6565                                                            fieldImp("machineBaseName").toString(),
    66                                                             fieldImp("machineFolder").toString());
     66                                                            fieldImp("machineFolder").toString(),
     67                                                            fieldImp("type").value<CGuestOSType>().GetFamilyId());
    6768    if (!uMediumId.isNull())
    6869    {
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