本文整理汇总了C++中CGuestOSType::GetRecommendedHDStorageController方法的典型用法代码示例。如果您正苦于以下问题:C++ CGuestOSType::GetRecommendedHDStorageController方法的具体用法?C++ CGuestOSType::GetRecommendedHDStorageController怎么用?C++ CGuestOSType::GetRecommendedHDStorageController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGuestOSType
的用法示例。
在下文中一共展示了CGuestOSType::GetRecommendedHDStorageController方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createVM
bool UIWizardNewVM::createVM()
{
/* Get VBox object: */
CVirtualBox vbox = vboxGlobal().virtualBox();
/* OS type: */
CGuestOSType type = field("type").value<CGuestOSType>();
QString strTypeId = type.GetId();
/* Create virtual machine: */
if (m_machine.isNull())
{
QVector<QString> groups;
if (!m_strGroup.isEmpty())
groups << m_strGroup;
m_machine = vbox.CreateMachine(field("machineFilePath").toString(),
field("machineBaseName").toString(),
groups, strTypeId, QString());
if (!vbox.isOk())
{
msgCenter().cannotCreateMachine(vbox, this);
return false;
}
/* The First RUN Wizard is to be shown:
* 1. if we don't attach any virtual hard-drive
* 2. or attach a new (empty) one.
* Usually we are assigning extra-data values through UIExtraDataManager,
* but in that special case VM was not registered yet, so UIExtraDataManager is unaware of it. */
if (field("virtualDiskId").toString().isNull() || !field("virtualDisk").value<CMedium>().isNull())
m_machine.SetExtraData(GUI_FirstRun, "yes");
}
/* RAM size: */
m_machine.SetMemorySize(field("ram").toInt());
/* VRAM size - select maximum between recommended and minimum for fullscreen: */
m_machine.SetVRAMSize(qMax(type.GetRecommendedVRAM(), (ULONG)(VBoxGlobal::requiredVideoMemory(strTypeId) / _1M)));
/* Selecting recommended chipset type: */
m_machine.SetChipsetType(type.GetRecommendedChipset());
/* Selecting recommended Audio Controller: */
m_machine.GetAudioAdapter().SetAudioController(type.GetRecommendedAudioController());
/* And the Audio Codec: */
m_machine.GetAudioAdapter().SetAudioCodec(type.GetRecommendedAudioCodec());
/* Enabling audio by default: */
m_machine.GetAudioAdapter().SetEnabled(true);
/* Enable the OHCI and EHCI controller by default for new VMs. (new in 2.2): */
CUSBDeviceFilters usbDeviceFilters = m_machine.GetUSBDeviceFilters();
bool fOhciEnabled = false;
if (!usbDeviceFilters.isNull() && type.GetRecommendedUSB3() && m_machine.GetUSBProxyAvailable())
{
/* USB 3.0 is only available if the proper ExtPack is installed. */
CExtPackManager manager = vboxGlobal().virtualBox().GetExtensionPackManager();
if (manager.IsExtPackUsable(GUI_ExtPackName))
{
m_machine.AddUSBController("XHCI", KUSBControllerType_XHCI);
/* xHci includes OHCI */
fOhciEnabled = true;
}
}
if ( !fOhciEnabled
&& !usbDeviceFilters.isNull() && type.GetRecommendedUSB() && m_machine.GetUSBProxyAvailable())
{
m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
fOhciEnabled = true;
/* USB 2.0 is only available if the proper ExtPack is installed.
* Note. Configuring EHCI here and providing messages about
* the missing extpack isn't exactly clean, but it is a
* necessary evil to patch over legacy compatability issues
* introduced by the new distribution model. */
CExtPackManager manager = vboxGlobal().virtualBox().GetExtensionPackManager();
if (manager.IsExtPackUsable(GUI_ExtPackName))
m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);
}
/* Create a floppy controller if recommended: */
QString strFloppyName = getNextControllerName(KStorageBus_Floppy);
if (type.GetRecommendedFloppy())
{
m_machine.AddStorageController(strFloppyName, KStorageBus_Floppy);
CStorageController flpCtr = m_machine.GetStorageControllerByName(strFloppyName);
flpCtr.SetControllerType(KStorageControllerType_I82078);
}
/* Create recommended DVD storage controller: */
KStorageBus strDVDBus = type.GetRecommendedDVDStorageBus();
QString strDVDName = getNextControllerName(strDVDBus);
m_machine.AddStorageController(strDVDName, strDVDBus);
/* Set recommended DVD storage controller type: */
CStorageController dvdCtr = m_machine.GetStorageControllerByName(strDVDName);
KStorageControllerType dvdStorageControllerType = type.GetRecommendedDVDStorageController();
dvdCtr.SetControllerType(dvdStorageControllerType);
/* Create recommended HD storage controller if it's not the same as the DVD controller: */
KStorageBus ctrHDBus = type.GetRecommendedHDStorageBus();
KStorageControllerType hdStorageControllerType = type.GetRecommendedHDStorageController();
//.........这里部分代码省略.........