VirtualBox

Changeset 78268 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 24, 2019 9:34:14 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8664. Factoring out vm configuration code to a separate function.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r77592 r78268  
    120120    }
    121121
     122    return configureVM(strTypeId, type);
     123}
     124
     125bool UIWizardNewVM::configureVM(const QString &strGuestTypeId, const CGuestOSType &comGuestType)
     126{
     127    CVirtualBox vbox = vboxGlobal().virtualBox();
     128
    122129    /* RAM size: */
    123130    m_machine.SetMemorySize(field("ram").toInt());
    124131
    125132    /* Graphics Controller type: */
    126     m_machine.SetGraphicsControllerType(type.GetRecommendedGraphicsController());
     133    m_machine.SetGraphicsControllerType(comGuestType.GetRecommendedGraphicsController());
    127134
    128135    /* VRAM size - select maximum between recommended and minimum for fullscreen: */
    129     m_machine.SetVRAMSize(qMax(type.GetRecommendedVRAM(), (ULONG)(VBoxGlobal::requiredVideoMemory(strTypeId) / _1M)));
     136    m_machine.SetVRAMSize(qMax(comGuestType.GetRecommendedVRAM(), (ULONG)(VBoxGlobal::requiredVideoMemory(strGuestTypeId) / _1M)));
    130137
    131138    /* Selecting recommended chipset type: */
    132     m_machine.SetChipsetType(type.GetRecommendedChipset());
     139    m_machine.SetChipsetType(comGuestType.GetRecommendedChipset());
    133140
    134141    /* Selecting recommended Audio Controller: */
    135     m_machine.GetAudioAdapter().SetAudioController(type.GetRecommendedAudioController());
     142    m_machine.GetAudioAdapter().SetAudioController(comGuestType.GetRecommendedAudioController());
    136143    /* And the Audio Codec: */
    137     m_machine.GetAudioAdapter().SetAudioCodec(type.GetRecommendedAudioCodec());
     144    m_machine.GetAudioAdapter().SetAudioCodec(comGuestType.GetRecommendedAudioCodec());
    138145    /* Enabling audio by default: */
    139146    m_machine.GetAudioAdapter().SetEnabled(true);
     
    143150    CUSBDeviceFilters usbDeviceFilters = m_machine.GetUSBDeviceFilters();
    144151    bool fOhciEnabled = false;
    145     if (!usbDeviceFilters.isNull() && type.GetRecommendedUSB3() && m_machine.GetUSBProxyAvailable())
     152    if (!usbDeviceFilters.isNull() && comGuestType.GetRecommendedUSB3() && m_machine.GetUSBProxyAvailable())
    146153    {
    147154        /* USB 3.0 is only available if the proper ExtPack is installed. */
     
    155162    }
    156163    if (   !fOhciEnabled
    157         && !usbDeviceFilters.isNull() && type.GetRecommendedUSB() && m_machine.GetUSBProxyAvailable())
     164        && !usbDeviceFilters.isNull() && comGuestType.GetRecommendedUSB() && m_machine.GetUSBProxyAvailable())
    158165    {
    159166        m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
     
    171178    /* Create a floppy controller if recommended: */
    172179    QString strFloppyName = getNextControllerName(KStorageBus_Floppy);
    173     if (type.GetRecommendedFloppy())
     180    if (comGuestType.GetRecommendedFloppy())
    174181    {
    175182        m_machine.AddStorageController(strFloppyName, KStorageBus_Floppy);
     
    179186
    180187    /* Create recommended DVD storage controller: */
    181     KStorageBus strDVDBus = type.GetRecommendedDVDStorageBus();
     188    KStorageBus strDVDBus = comGuestType.GetRecommendedDVDStorageBus();
    182189    QString strDVDName = getNextControllerName(strDVDBus);
    183190    m_machine.AddStorageController(strDVDName, strDVDBus);
     
    185192    /* Set recommended DVD storage controller type: */
    186193    CStorageController dvdCtr = m_machine.GetStorageControllerByName(strDVDName);
    187     KStorageControllerType dvdStorageControllerType = type.GetRecommendedDVDStorageController();
     194    KStorageControllerType dvdStorageControllerType = comGuestType.GetRecommendedDVDStorageController();
    188195    dvdCtr.SetControllerType(dvdStorageControllerType);
    189196
    190197    /* Create recommended HD storage controller if it's not the same as the DVD controller: */
    191     KStorageBus ctrHDBus = type.GetRecommendedHDStorageBus();
    192     KStorageControllerType hdStorageControllerType = type.GetRecommendedHDStorageController();
     198    KStorageBus ctrHDBus = comGuestType.GetRecommendedHDStorageBus();
     199    KStorageControllerType hdStorageControllerType = comGuestType.GetRecommendedHDStorageController();
    193200    CStorageController hdCtr;
    194201    QString strHDName;
     
    216223
    217224    /* Turn on PAE, if recommended: */
    218     m_machine.SetCPUProperty(KCPUPropertyType_PAE, type.GetRecommendedPAE());
     225    m_machine.SetCPUProperty(KCPUPropertyType_PAE, comGuestType.GetRecommendedPAE());
    219226
    220227    /* Set the recommended triple fault behavior: */
    221     m_machine.SetCPUProperty(KCPUPropertyType_TripleFaultReset, type.GetRecommendedTFReset());
     228    m_machine.SetCPUProperty(KCPUPropertyType_TripleFaultReset, comGuestType.GetRecommendedTFReset());
    222229
    223230    /* Set recommended firmware type: */
    224     KFirmwareType fwType = type.GetRecommendedFirmware();
     231    KFirmwareType fwType = comGuestType.GetRecommendedFirmware();
    225232    m_machine.SetFirmwareType(fwType);
    226233
    227234    /* Set recommended human interface device types: */
    228     if (type.GetRecommendedUSBHID())
     235    if (comGuestType.GetRecommendedUSBHID())
    229236    {
    230237        m_machine.SetKeyboardHIDType(KKeyboardHIDType_USBKeyboard);
     
    234241    }
    235242
    236     if (type.GetRecommendedUSBTablet())
     243    if (comGuestType.GetRecommendedUSBTablet())
    237244    {
    238245        m_machine.SetPointingHIDType(KPointingHIDType_USBTablet);
     
    242249
    243250    /* Set HPET flag: */
    244     m_machine.SetHPETEnabled(type.GetRecommendedHPET());
     251    m_machine.SetHPETEnabled(comGuestType.GetRecommendedHPET());
    245252
    246253    /* Set UTC flags: */
    247     m_machine.SetRTCUseUTC(type.GetRecommendedRTCUseUTC());
     254    m_machine.SetRTCUseUTC(comGuestType.GetRecommendedRTCUseUTC());
    248255
    249256    /* Set graphic bits: */
    250     if (type.GetRecommended2DVideoAcceleration())
    251         m_machine.SetAccelerate2DVideoEnabled(type.GetRecommended2DVideoAcceleration());
    252 
    253     if (type.GetRecommended3DAcceleration())
    254         m_machine.SetAccelerate3DEnabled(type.GetRecommended3DAcceleration());
     257    if (comGuestType.GetRecommended2DVideoAcceleration())
     258        m_machine.SetAccelerate2DVideoEnabled(comGuestType.GetRecommended2DVideoAcceleration());
     259
     260    if (comGuestType.GetRecommended3DAcceleration())
     261        m_machine.SetAccelerate3DEnabled(comGuestType.GetRecommended3DAcceleration());
    255262
    256263    /* Register the VM prior to attaching hard disks: */
     
    290297
    291298            /* Attach an empty floppy drive if recommended */
    292             if (type.GetRecommendedFloppy()) {
     299            if (comGuestType.GetRecommendedFloppy()) {
    293300                machine.AttachDevice(strFloppyName, 0, 0, KDeviceType_Floppy, CMedium());
    294301                if (!machine.isOk())
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r77592 r78268  
    6161protected:
    6262
    63     /* Create VM stuff: */
     63    /* Create a new VM: */
    6464    bool createVM();
     65    /* Configure the newly created VM: */
     66    bool configureVM(const QString &strGuestTypeId, const CGuestOSType &comGuestType);
    6567
    6668    /* Who will be able to create virtual-machine: */
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