本文整理汇总了C++中CGuestOSType类的典型用法代码示例。如果您正苦于以下问题:C++ CGuestOSType类的具体用法?C++ CGuestOSType怎么用?C++ CGuestOSType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGuestOSType类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vboxGlobal
void VBoxOSTypeSelectorButton::setOSTypeId (const QString& aOSTypeId)
{
mOSTypeId = aOSTypeId;
CGuestOSType type = vboxGlobal().vmGuestOSType (aOSTypeId);
/* Looks ugly on the Mac */
#ifndef Q_WS_MAC
setIcon (vboxGlobal().vmGuestOSTypeIcon (type.GetId()));
#endif /* Q_WS_MAC */
setText (type.GetDescription());
}
示例2: vboxGlobal
void UIGuestOSTypeSelectionButton::setOSTypeId(const QString &strOSTypeId)
{
m_strOSTypeId = strOSTypeId;
CGuestOSType enmType = vboxGlobal().vmGuestOSType(strOSTypeId);
#ifndef VBOX_WS_MAC
/* Looks ugly on the Mac: */
setIcon(vboxGlobal().vmGuestOSTypePixmapDefault(enmType.GetId()));
#endif
setText(enmType.GetDescription());
}
示例3: retranslateUi
void UINewVMWzdPage3::initializePage()
{
/* Fill and translate */
retranslateUi();
/* Assign recommended 'ram' field value */
CGuestOSType type = field("type").value<CGuestOSType>();
ramSliderValueChanged(type.GetRecommendedRAM());
/* 'Ram' field should have focus initially */
m_pRamSlider->setFocus();
}
示例4: retranslateUi
void UIWizardNewVMPageBasic2::initializePage()
{
/* Translate page: */
retranslateUi();
/* Get recommended 'ram' field value: */
CGuestOSType type = field("type").value<CGuestOSType>();
m_pRamSlider->setValue(type.GetRecommendedRAM());
m_pRamEditor->setText(QString::number(type.GetRecommendedRAM()));
/* 'Ram' field should have focus initially: */
m_pRamSlider->setFocus();
}
示例5: onOsTypeChanged
void UIWizardNewVMPageExpert::sltOsTypeChanged()
{
/* Call to base-class: */
onOsTypeChanged();
/* Fetch recommended RAM value: */
CGuestOSType type = m_pNameAndSystemEditor->type();
m_pRamSlider->setValue(type.GetRecommendedRAM());
m_pRamEditor->setText(QString::number(type.GetRecommendedRAM()));
/* Broadcast complete-change: */
emit completeChanged();
}
示例6: setType
void VBoxOSTypeSelectorWidget::setType (const CGuestOSType &aType)
{
QString familyId (aType.GetFamilyId());
QString typeId (aType.GetId());
int familyIndex = mCbFamily->findData (familyId, RoleTypeID);
AssertMsg (familyIndex != -1, ("Family ID should be valid: '%s'", familyId.toLatin1().constData()));
if (familyIndex != -1)
mCbFamily->setCurrentIndex (familyIndex);
int typeIndex = mCbType->findData (typeId, RoleTypeID);
AssertMsg (typeIndex != -1, ("Type ID should be valid: '%s'", typeId.toLatin1().constData()));
if (typeIndex != -1)
mCbType->setCurrentIndex (typeIndex);
}
示例7: vboxGlobal
/* Save data from cache to corresponding external object(s),
* this task COULD be performed in other than GUI thread: */
void UIMachineSettingsGeneral::saveFromCacheTo(QVariant &data)
{
/* Fetch data to machine: */
UISettingsPageMachine::fetchData(data);
/* Check if general data was changed: */
if (m_cache.wasChanged())
{
/* Get general data from cache: */
const UIDataSettingsMachineGeneral &generalData = m_cache.data();
/* Store general data: */
if (isMachineInValidMode())
{
/* Advanced tab: */
m_machine.SetClipboardMode(generalData.m_clipboardMode);
m_machine.SetDragAndDropMode(generalData.m_dragAndDropMode);
m_machine.SetExtraData(GUI_SaveMountedAtRuntime, generalData.m_fSaveMountedAtRuntime ? "yes" : "no");
m_machine.SetExtraData(GUI_ShowMiniToolBar, generalData.m_fShowMiniToolBar ? "yes" : "no");
m_machine.SetExtraData(GUI_MiniToolBarAlignment, generalData.m_fMiniToolBarAtTop ? "top" : "bottom");
/* Description tab: */
m_machine.SetDescription(generalData.m_strDescription);
}
if (isMachineOffline())
{
/* Basic tab: Must update long mode CPU feature bit when os type changes. */
if (generalData.m_strGuestOsTypeId != m_cache.base().m_strGuestOsTypeId)
{
m_machine.SetOSTypeId(generalData.m_strGuestOsTypeId);
CVirtualBox vbox = vboxGlobal().virtualBox();
CGuestOSType newType = vbox.GetGuestOSType(generalData.m_strGuestOsTypeId);
m_machine.SetCPUProperty(KCPUPropertyType_LongMode, newType.GetIs64Bit());
}
/* Advanced tab: */
m_machine.SetSnapshotFolder(generalData.m_strSnapshotsFolder);
/* Basic (again) tab: */
/* VM name must be last as otherwise its VM rename magic can collide with other settings in the config,
* especially with the snapshot folder: */
m_machine.SetName(generalData.m_strName);
}
}
/* Upload machine to data: */
UISettingsPageMachine::uploadData(data);
}
示例8: vboxGlobal
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();
//.........这里部分代码省略.........
示例9: vboxGlobal
bool UINewVMWzdPage5::constructMachine()
{
CVirtualBox vbox = vboxGlobal().virtualBox();
/* OS type */
CGuestOSType type = field("type").value<CGuestOSType>();
AssertMsg(!type.isNull(), ("GuestOSType must return non-null type"));
QString typeId = type.GetId();
/* Create a machine with the default settings file location */
if (m_Machine.isNull())
{
m_Machine = vbox.CreateMachine(QString::null, // auto-compose filename
field("name").toString(),
typeId,
QString::null, // machine ID
false); // forceOverwrite
if (!vbox.isOk())
{
msgCenter().cannotCreateMachine(vbox, this);
return false;
}
/* The FirstRun wizard is to be shown only when we don't attach any hard disk or attach a new (empty) one.
* Selecting an existing hard disk will cancel the wizard. */
if (field("hardDiskId").toString().isNull() || !field("hardDisk").value<CMedium>().isNull())
m_Machine.SetExtraData(VBoxDefs::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(typeId) / _1M)));
/* Selecting recommended chipset type */
m_Machine.SetChipsetType(type.GetRecommendedChipset());
/* Selecting recommended Audio Controller */
m_Machine.GetAudioAdapter().SetAudioController(type.GetRecommendedAudioController());
/* Enabling audio by default */
m_Machine.GetAudioAdapter().SetEnabled(true);
/* Enable the OHCI and EHCI controller by default for new VMs. (new in 2.2) */
CUSBController usbController = m_Machine.GetUSBController();
if ( !usbController.isNull()
&& usbController.GetProxyAvailable())
{
usbController.SetEnabled(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(UI_ExtPackName))
usbController.SetEnabledEhci(true);
}
/* Create recommended DVD storage controller */
KStorageBus ctrDvdBus = type.GetRecommendedDvdStorageBus();
QString ctrDvdName = getNextControllerName(ctrDvdBus);
m_Machine.AddStorageController(ctrDvdName, ctrDvdBus);
/* Set recommended DVD storage controller type */
CStorageController dvdCtr = m_Machine.GetStorageControllerByName(ctrDvdName);
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();
CStorageController hdCtr;
QString ctrHdName;
if (ctrHdBus != ctrDvdBus || hdStorageControllerType != dvdStorageControllerType)
{
ctrHdName = getNextControllerName(ctrHdBus);
m_Machine.AddStorageController(ctrHdName, ctrHdBus);
hdCtr = m_Machine.GetStorageControllerByName(ctrHdName);
hdCtr.SetControllerType(hdStorageControllerType);
/* Set the port count to 1 if SATA is used. */
if (hdStorageControllerType == KStorageControllerType_IntelAhci)
hdCtr.SetPortCount(1);
}
else
{
/* The HD controller is the same as DVD */
hdCtr = dvdCtr;
ctrHdName = ctrDvdName;
}
/* Turn on PAE, if recommended */
m_Machine.SetCPUProperty(KCPUPropertyType_PAE, type.GetRecommendedPae());
//.........这里部分代码省略.........
示例10: vboxGlobal
void UIMachineSettingsGeneral::saveFromCacheTo(QVariant &data)
{
/* Fetch data to machine: */
UISettingsPageMachine::fetchData(data);
/* Check if general data was changed: */
if (m_cache.wasChanged())
{
/* Get general data from cache: */
const UIDataSettingsMachineGeneral &generalData = m_cache.data();
if (isMachineInValidMode())
{
/* 'Advanced' tab data: */
if (generalData.m_clipboardMode != m_cache.base().m_clipboardMode)
m_machine.SetClipboardMode(generalData.m_clipboardMode);
if (generalData.m_dndMode != m_cache.base().m_dndMode)
m_machine.SetDnDMode(generalData.m_dndMode);
/* 'Description' tab: */
if (generalData.m_strDescription != m_cache.base().m_strDescription)
m_machine.SetDescription(generalData.m_strDescription);
}
if (isMachineOffline())
{
/* 'Basic' tab data: Must update long mode CPU feature bit when os type changes. */
if (generalData.m_strGuestOsTypeId != m_cache.base().m_strGuestOsTypeId)
{
m_machine.SetOSTypeId(generalData.m_strGuestOsTypeId);
CVirtualBox vbox = vboxGlobal().virtualBox();
CGuestOSType newType = vbox.GetGuestOSType(generalData.m_strGuestOsTypeId);
m_machine.SetCPUProperty(KCPUPropertyType_LongMode, newType.GetIs64Bit());
}
/* 'Advanced' tab data: */
if (generalData.m_strSnapshotsFolder != m_cache.base().m_strSnapshotsFolder)
m_machine.SetSnapshotFolder(generalData.m_strSnapshotsFolder);
/* 'Basic' (again) tab data: */
/* VM name must be last as otherwise its VM rename magic
* can collide with other settings in the config,
* especially with the snapshot folder: */
if (generalData.m_strName != m_cache.base().m_strName)
m_machine.SetName(generalData.m_strName);
/* Encryption tab data: */
if (generalData.m_fEncryptionEnabled != m_cache.base().m_fEncryptionEnabled ||
generalData.m_fEncryptionCipherChanged != m_cache.base().m_fEncryptionCipherChanged ||
generalData.m_fEncryptionPasswordChanged != m_cache.base().m_fEncryptionPasswordChanged)
{
/* Cipher attribute changed? */
QString strNewCipher;
if (generalData.m_fEncryptionCipherChanged)
{
strNewCipher = generalData.m_fEncryptionEnabled ?
m_encryptionCiphers.at(generalData.m_iEncryptionCipherIndex) : QString();
}
/* Password attribute changed? */
QString strNewPassword;
QString strNewPasswordId;
if (generalData.m_fEncryptionPasswordChanged)
{
strNewPassword = generalData.m_fEncryptionEnabled ?
generalData.m_strEncryptionPassword : QString();
strNewPasswordId = generalData.m_fEncryptionEnabled ?
m_machine.GetName() : QString();
}
/* Get the maps of encrypted mediums and their passwords: */
const EncryptedMediumMap &encryptedMedium = generalData.m_encryptedMediums;
const EncryptionPasswordMap &encryptionPasswords = generalData.m_encryptionPasswords;
/* Enumerate attachments: */
foreach (const CMediumAttachment &attachment, m_machine.GetMediumAttachments())
{
/* Enumerate hard-drives only: */
if (attachment.GetType() == KDeviceType_HardDisk)
{
/* Get corresponding medium: */
CMedium medium = attachment.GetMedium();
/* Check if old password exists/provided: */
QString strOldPasswordId = encryptedMedium.key(medium.GetId());
QString strOldPassword = encryptionPasswords.value(strOldPasswordId);
/* Update encryption: */
CProgress cprogress = medium.ChangeEncryption(strOldPassword,
strNewCipher,
strNewPassword,
strNewPasswordId);
if (!medium.isOk())
{
QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,
Q_ARG(QString, UIMessageCenter::formatErrorInfo(medium)));
continue;
}
UIProgress uiprogress(cprogress);
connect(&uiprogress, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
Qt::QueuedConnection);
//.........这里部分代码省略.........