void UIMachineSettingsDisplay::sltHandleVideoCaptureCheckboxToggle() { /* Video Capture options should be enabled only if: * 1. Machine is in 'offline' or 'saved' state and check-box is checked, * 2. Machine is in 'online' state, check-box is checked, and video recording is *disabled* currently. */ bool fIsVideoCaptureOptionsEnabled = ((isMachineOffline() || isMachineSaved()) && m_pCheckboxVideoCapture->isChecked()) || (isMachineOnline() && !m_cache.base().m_fVideoCaptureEnabled && m_pCheckboxVideoCapture->isChecked()); /* Video Capture Screens option should be enabled only if: * Machine is in *any* valid state and check-box is checked. */ bool fIsVideoCaptureScreenOptionEnabled = isMachineInValidMode() && m_pCheckboxVideoCapture->isChecked(); m_pLabelVideoCapturePath->setEnabled(fIsVideoCaptureOptionsEnabled); m_pEditorVideoCapturePath->setEnabled(fIsVideoCaptureOptionsEnabled); m_pLabelVideoCaptureSize->setEnabled(fIsVideoCaptureOptionsEnabled); m_pComboVideoCaptureSize->setEnabled(fIsVideoCaptureOptionsEnabled); m_pEditorVideoCaptureWidth->setEnabled(fIsVideoCaptureOptionsEnabled); m_pEditorVideoCaptureHeight->setEnabled(fIsVideoCaptureOptionsEnabled); m_pLabelVideoCaptureFrameRate->setEnabled(fIsVideoCaptureOptionsEnabled); m_pContainerSliderVideoCaptureFrameRate->setEnabled(fIsVideoCaptureOptionsEnabled); m_pEditorVideoCaptureFrameRate->setEnabled(fIsVideoCaptureOptionsEnabled); m_pLabelVideoCaptureFrameRateUnits->setEnabled(fIsVideoCaptureOptionsEnabled); m_pLabelVideoCaptureRate->setEnabled(fIsVideoCaptureOptionsEnabled); m_pContainerSliderVideoCaptureQuality->setEnabled(fIsVideoCaptureOptionsEnabled); m_pEditorVideoCaptureBitRate->setEnabled(fIsVideoCaptureOptionsEnabled); m_pLabelVideoCaptureBitRateUnits->setEnabled(fIsVideoCaptureOptionsEnabled); m_pLabelVideoCaptureScreens->setEnabled(fIsVideoCaptureScreenOptionEnabled); m_pScrollerVideoCaptureScreens->setEnabled(fIsVideoCaptureScreenOptionEnabled); }
void UIMachineSettingsSystem::polishPage() { /* Get system data from cache: */ const UIDataSettingsMachineSystem &systemData = m_cache.base(); /* Motherboard tab: */ m_pLabelMemorySize->setEnabled(isMachineOffline()); m_pLabelMemoryMin->setEnabled(isMachineOffline()); m_pLabelMemoryMax->setEnabled(isMachineOffline()); m_pLabelMemoryUnits->setEnabled(isMachineOffline()); m_pSliderMemorySize->setEnabled(isMachineOffline()); m_pEditorMemorySize->setEnabled(isMachineOffline()); m_pLabelBootOrder->setEnabled(isMachineOffline()); mTwBootOrder->setEnabled(isMachineOffline()); mTbBootItemUp->setEnabled(isMachineOffline() && mTwBootOrder->hasFocus() && mTwBootOrder->currentRow() > 0); mTbBootItemDown->setEnabled(isMachineOffline() && mTwBootOrder->hasFocus() && (mTwBootOrder->currentRow() < mTwBootOrder->count() - 1)); m_pLabelChipsetType->setEnabled(isMachineOffline()); m_pComboChipsetType->setEnabled(isMachineOffline()); m_pLabelPointingHIDType->setEnabled(isMachineOffline()); m_pComboPointingHIDType->setEnabled(isMachineOffline()); m_pLabelMotherboardExtended->setEnabled(isMachineOffline()); m_pCheckBoxApic->setEnabled(isMachineOffline()); m_pCheckBoxEFI->setEnabled(isMachineOffline()); m_pCheckBoxUseUTC->setEnabled(isMachineOffline()); /* Processor tab: */ m_pLabelCPUCount->setEnabled(isMachineOffline()); m_pLabelCPUMin->setEnabled(isMachineOffline()); m_pLabelCPUMax->setEnabled(isMachineOffline()); m_pSliderCPUCount->setEnabled(isMachineOffline() && systemData.m_fSupportedHwVirtEx); m_pEditorCPUCount->setEnabled(isMachineOffline() && systemData.m_fSupportedHwVirtEx); m_pLabelCPUExecCap->setEnabled(isMachineInValidMode()); m_pLabelCPUExecCapMin->setEnabled(isMachineInValidMode()); m_pLabelCPUExecCapMax->setEnabled(isMachineInValidMode()); m_pSliderCPUExecCap->setEnabled(isMachineInValidMode()); m_pEditorCPUExecCap->setEnabled(isMachineInValidMode()); m_pLabelCPUExtended->setEnabled(isMachineOffline()); m_pCheckBoxPAE->setEnabled(isMachineOffline() && systemData.m_fSupportedPAE); /* Acceleration tab: */ m_pTabWidgetSystem->setTabEnabled(2, systemData.m_fSupportedHwVirtEx); m_pLabelVirtualization->setEnabled(isMachineOffline()); m_pCheckBoxVirtualization->setEnabled(isMachineOffline()); m_pCheckBoxNestedPaging->setEnabled(isMachineOffline() && m_pCheckBoxVirtualization->isChecked()); }
void UIMachineSettingsSystem::polishPage() { /* Get system data from cache: */ const UIDataSettingsMachineSystem &systemData = m_cache.base(); /* Motherboard tab: */ mLbMemory->setEnabled(isMachineOffline()); mLbMemoryMin->setEnabled(isMachineOffline()); mLbMemoryMax->setEnabled(isMachineOffline()); mLbMemoryUnit->setEnabled(isMachineOffline()); mSlMemory->setEnabled(isMachineOffline()); mLeMemory->setEnabled(isMachineOffline()); mLbBootOrder->setEnabled(isMachineOffline()); mTwBootOrder->setEnabled(isMachineOffline()); mTbBootItemUp->setEnabled(isMachineOffline() && mTwBootOrder->hasFocus() && mTwBootOrder->currentRow() > 0); mTbBootItemDown->setEnabled(isMachineOffline() && mTwBootOrder->hasFocus() && (mTwBootOrder->currentRow() < mTwBootOrder->count() - 1)); mLbChipset->setEnabled(isMachineOffline()); mCbChipset->setEnabled(isMachineOffline()); mLbMotherboardExtended->setEnabled(isMachineOffline()); mCbApic->setEnabled(isMachineOffline()); mCbEFI->setEnabled(isMachineOffline()); mCbTCUseUTC->setEnabled(isMachineOffline()); mCbUseAbsHID->setEnabled(isMachineOffline()); /* Processor tab: */ mLbCPU->setEnabled(isMachineOffline()); mLbCPUMin->setEnabled(isMachineOffline()); mLbCPUMax->setEnabled(isMachineOffline()); mSlCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported); mLeCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported); mLbCPUExecCap->setEnabled(isMachineInValidMode()); mLbCPUExecCapMin->setEnabled(isMachineInValidMode()); mLbCPUExecCapMax->setEnabled(isMachineInValidMode()); mSlCPUExecCap->setEnabled(isMachineInValidMode()); mLeCPUExecCap->setEnabled(isMachineInValidMode()); mLbProcessorExtended->setEnabled(isMachineOffline()); mCbPae->setEnabled(isMachineOffline() && systemData.m_fPFPAESupported); /* Acceleration tab: */ mTwSystem->setTabEnabled(2, systemData.m_fPFHwVirtExSupported); mLbVirt->setEnabled(isMachineOffline()); mCbVirt->setEnabled(isMachineOffline()); mCbNestedPaging->setEnabled(isMachineOffline() && mCbVirt->isChecked()); }
void UIMachineSettingsDisplay::polishPage() { /* Get system data from cache: */ const UIDataSettingsMachineDisplay &displayData = m_cache.base(); /* Screen tab: */ m_pLabelVideoMemorySize->setEnabled(isMachineOffline()); m_pSliderVideoMemorySize->setEnabled(isMachineOffline()); m_pLabelVideoMemorySizeMin->setEnabled(isMachineOffline()); m_pLabelVideoMemorySizeMax->setEnabled(isMachineOffline()); m_pEditorVideoMemorySize->setEnabled(isMachineOffline()); m_pLabelVideoScreenCount->setEnabled(isMachineOffline()); m_pSliderVideoScreenCount->setEnabled(isMachineOffline()); m_pLabelVideoScreenCountMin->setEnabled(isMachineOffline()); m_pLabelVideoScreenCountMax->setEnabled(isMachineOffline()); m_pEditorVideoScreenCount->setEnabled(isMachineOffline()); m_pLabelGuestScreenScale->setEnabled(isMachineInValidMode()); m_pSliderGuestScreenScale->setEnabled(isMachineInValidMode()); m_pLabelGuestScreenScaleMin->setEnabled(isMachineInValidMode()); m_pLabelGuestScreenScaleMax->setEnabled(isMachineInValidMode()); m_pEditorGuestScreenScale->setEnabled(isMachineInValidMode()); #ifdef Q_WS_MAC m_pLabelHiDPI->setEnabled(isMachineInValidMode()); m_pCheckBoxUnscaledHiDPIOutput->setEnabled(isMachineInValidMode()); #else /* !Q_WS_MAC */ m_pLabelHiDPI->hide(); m_pCheckBoxUnscaledHiDPIOutput->hide(); #endif /* !Q_WS_MAC */ m_pLabelVideoOptions->setEnabled(isMachineOffline()); m_pCheckbox3D->setEnabled(isMachineOffline()); #ifdef VBOX_WITH_VIDEOHWACCEL m_pCheckbox2DVideo->setEnabled(isMachineOffline() && VBoxGlobal::isAcceleration2DVideoAvailable()); #else /* !VBOX_WITH_VIDEOHWACCEL */ m_pCheckbox2DVideo->hide(); #endif /* !VBOX_WITH_VIDEOHWACCEL */ /* Remote Display tab: */ m_pTabWidget->setTabEnabled(1, displayData.m_fRemoteDisplayServerSupported); m_pContainerRemoteDisplay->setEnabled(isMachineInValidMode()); m_pContainerRemoteDisplayOptions->setEnabled(m_pCheckboxRemoteDisplay->isChecked()); m_pLabelRemoteDisplayOptions->setEnabled(isMachineOffline() || isMachineSaved()); m_pCheckboxMultipleConn->setEnabled(isMachineOffline() || isMachineSaved()); /* Video Capture tab: */ m_pContainerVideoCapture->setEnabled(isMachineInValidMode()); sltHandleVideoCaptureCheckboxToggle(); }
void UIMachineSettingsGeneral::polishPage() { /* Basic tab: */ m_pNameAndSystemEditor->setEnabled(isMachineOffline()); /* Advanced tab: */ mLbSnapshot->setEnabled(isMachineOffline()); mPsSnapshot->setEnabled(isMachineOffline()); mLbClipboard->setEnabled(isMachineInValidMode()); mCbClipboard->setEnabled(isMachineInValidMode()); mLbDragAndDrop->setEnabled(isMachineInValidMode()); mCbDragAndDrop->setEnabled(isMachineInValidMode()); mLbMedia->setEnabled(isMachineInValidMode()); mCbSaveMounted->setEnabled(isMachineInValidMode()); mLbToolBar->setEnabled(isMachineInValidMode()); mCbShowToolBar->setEnabled(isMachineInValidMode()); mCbToolBarAlignment->setEnabled(isMachineInValidMode() && mCbShowToolBar->isChecked()); }
/* Save data from cache to corresponding external object(s), * this task COULD be performed in other than GUI thread: */ void UIMachineSettingsSystem::saveFromCacheTo(QVariant &data) { /* Fetch data to machine: */ UISettingsPageMachine::fetchData(data); /* Check if system data was changed: */ if (m_cache.wasChanged()) { /* Get system data from cache: */ const UIDataSettingsMachineSystem &systemData = m_cache.data(); /* Store system data: */ if (isMachineOffline()) { /* Motherboard tab: */ m_machine.SetMemorySize(systemData.m_iMemorySize); /* Save boot-items of current VM: */ int iBootIndex = 0; for (int i = 0; i < systemData.m_bootItems.size(); ++i) { if (systemData.m_bootItems[i].m_fEnabled) m_machine.SetBootOrder(++iBootIndex, systemData.m_bootItems[i].m_type); } /* Save other unique boot-items: */ for (int i = 0; i < systemData.m_bootItems.size(); ++i) { if (!systemData.m_bootItems[i].m_fEnabled) m_machine.SetBootOrder(++iBootIndex, KDeviceType_Null); } m_machine.SetChipsetType(systemData.m_chipsetType); m_machine.SetPointingHIDType(systemData.m_pointingHIDType); m_machine.GetBIOSSettings().SetIOAPICEnabled(systemData.m_fEnabledIoApic); m_machine.SetFirmwareType(systemData.m_fEnabledEFI ? KFirmwareType_EFI : KFirmwareType_BIOS); m_machine.SetRTCUseUTC(systemData.m_fEnabledUTC); /* Processor tab: */ m_machine.SetCPUCount(systemData.m_cCPUCount); m_machine.SetCPUProperty(KCPUPropertyType_PAE, systemData.m_fEnabledPAE); /* Acceleration tab: */ m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, systemData.m_fEnabledHwVirtEx); m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, systemData.m_fEnabledNestedPaging); } if (isMachineInValidMode()) { /* Processor tab: */ m_machine.SetCPUExecutionCap(systemData.m_iCPUExecCap); } } /* Upload machine to data: */ UISettingsPageMachine::uploadData(data); }
void UIMachineSettingsParallelPage::polishPage() { /* Get the count of parallel port tabs: */ for (int iPort = 0; iPort < mTabWidget->count(); ++iPort) { mTabWidget->setTabEnabled(iPort, isMachineOffline() || (isMachineInValidMode() && m_cache.child(iPort).base().m_fPortEnabled)); UIMachineSettingsParallel *pTab = qobject_cast<UIMachineSettingsParallel*>(mTabWidget->widget(iPort)); pTab->polishTab(); } }
void UIMachineSettingsNetworkPage::polishPage() { /* Get the count of network adapter tabs: */ for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot) { m_pTwAdapters->setTabEnabled(iSlot, isMachineOffline() || (isMachineInValidMode() && m_cache.child(iSlot).base().m_fAdapterEnabled)); UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot)); pTab->polishTab(); } }
void UIMachineSettingsDisplay::polishPage() { /* Get system data from cache: */ const UIDataSettingsMachineDisplay &displayData = m_cache.base(); /* Video tab: */ m_pContainerVideo->setEnabled(isMachineOffline()); #ifdef VBOX_WITH_VIDEOHWACCEL m_pCheckbox2DVideo->setEnabled(VBoxGlobal::isAcceleration2DVideoAvailable()); #endif /* VBOX_WITH_VIDEOHWACCEL */ /* Remote Display tab: */ m_pTabWidget->setTabEnabled(1, displayData.m_fRemoteDisplayServerSupported); m_pContainerRemoteDisplay->setEnabled(isMachineInValidMode()); m_pContainerRemoteDisplayOptions->setEnabled(m_pCheckboxRemoteDisplay->isChecked()); m_pLabelRemoteDisplayOptions->setEnabled(isMachineOffline() || isMachineSaved()); m_pCheckboxMultipleConn->setEnabled(isMachineOffline() || isMachineSaved()); /* Video Capture tab: */ m_pContainerVideoCapture->setEnabled(isMachineInValidMode()); sltHandleVideoCaptureCheckboxToggle(); }
/* 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); }
/* Save data from cache to corresponding external object(s), * this task COULD be performed in other than GUI thread: */ void UIMachineSettingsDisplay::saveFromCacheTo(QVariant &data) { /* Fetch data to machine: */ UISettingsPageMachine::fetchData(data); /* Make sure machine is in valid mode & display data was changed: */ if (isMachineInValidMode() && m_cache.wasChanged()) { /* Get display data from cache: */ const UIDataSettingsMachineDisplay &displayData = m_cache.data(); /* Make sure machine is 'offline': */ if (isMachineOffline()) { /* Store Video data: */ m_machine.SetVRAMSize(displayData.m_iCurrentVRAM); m_machine.SetMonitorCount(displayData.m_cGuestScreenCount); m_machine.SetAccelerate3DEnabled(displayData.m_f3dAccelerationEnabled); #ifdef VBOX_WITH_VIDEOHWACCEL m_machine.SetAccelerate2DVideoEnabled(displayData.m_f2dAccelerationEnabled); #endif /* VBOX_WITH_VIDEOHWACCEL */ } /* Check if Remote Display server still valid: */ CVRDEServer remoteDisplayServer = m_machine.GetVRDEServer(); if (!remoteDisplayServer.isNull()) { /* Store Remote Display data: */ remoteDisplayServer.SetEnabled(displayData.m_fRemoteDisplayServerEnabled); remoteDisplayServer.SetVRDEProperty("TCP/Ports", displayData.m_strRemoteDisplayPort); remoteDisplayServer.SetAuthType(displayData.m_remoteDisplayAuthType); remoteDisplayServer.SetAuthTimeout(displayData.m_uRemoteDisplayTimeout); /* Make sure machine is 'offline' or 'saved': */ if (isMachineOffline() || isMachineSaved()) remoteDisplayServer.SetAllowMultiConnection(displayData.m_fRemoteDisplayMultiConnAllowed); } /* Store Video Capture data: */ if (isMachineOnline()) { /* If Video Capture is *enabled* now: */ if (m_cache.base().m_fVideoCaptureEnabled) { /* We can still save the *screens* option: */ m_machine.SetVideoCaptureScreens(displayData.m_screens); /* Finally we should *disable* Video Capture if necessary: */ if (!displayData.m_fVideoCaptureEnabled) m_machine.SetVideoCaptureEnabled(displayData.m_fVideoCaptureEnabled); } /* If Video Capture is *disabled* now: */ else { /* We should save all the options *before* Video Capture activation: */ m_machine.SetVideoCaptureFile(displayData.m_strVideoCaptureFilePath); m_machine.SetVideoCaptureWidth(displayData.m_iVideoCaptureFrameWidth); m_machine.SetVideoCaptureHeight(displayData.m_iVideoCaptureFrameHeight); m_machine.SetVideoCaptureFPS(displayData.m_iVideoCaptureFrameRate); m_machine.SetVideoCaptureRate(displayData.m_iVideoCaptureBitRate); m_machine.SetVideoCaptureScreens(displayData.m_screens); /* Finally we should *enable* Video Capture if necessary: */ if (displayData.m_fVideoCaptureEnabled) m_machine.SetVideoCaptureEnabled(displayData.m_fVideoCaptureEnabled); } } else { /* For 'offline' and 'saved' states the order is irrelevant: */ m_machine.SetVideoCaptureEnabled(displayData.m_fVideoCaptureEnabled); m_machine.SetVideoCaptureFile(displayData.m_strVideoCaptureFilePath); m_machine.SetVideoCaptureWidth(displayData.m_iVideoCaptureFrameWidth); m_machine.SetVideoCaptureHeight(displayData.m_iVideoCaptureFrameHeight); m_machine.SetVideoCaptureFPS(displayData.m_iVideoCaptureFrameRate); m_machine.SetVideoCaptureRate(displayData.m_iVideoCaptureBitRate); m_machine.SetVideoCaptureScreens(displayData.m_screens); } } /* Upload machine to data: */ UISettingsPageMachine::uploadData(data); }
/* Save data from cache to corresponding external object(s), * this task COULD be performed in other than GUI thread: */ void UIMachineSettingsNetworkPage::saveFromCacheTo(QVariant &data) { /* Fetch data to machine: */ UISettingsPageMachine::fetchData(data); /* Check if network data was changed: */ if (m_cache.wasChanged()) { /* For each network adapter: */ for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot) { /* Check if adapter data was changed: */ const UICacheSettingsMachineNetworkAdapter &adapterCache = m_cache.child(iSlot); if (adapterCache.wasChanged()) { /* Check if adapter still valid: */ CNetworkAdapter adapter = m_machine.GetNetworkAdapter(iSlot); if (!adapter.isNull()) { /* Get adapter data from cache: */ const UIDataSettingsMachineNetworkAdapter &adapterData = adapterCache.data(); /* Store adapter data: */ if (isMachineOffline()) { /* Basic attributes: */ adapter.SetEnabled(adapterData.m_fAdapterEnabled); adapter.SetAdapterType(adapterData.m_adapterType); adapter.SetMACAddress(adapterData.m_strMACAddress); } if (isMachineInValidMode()) { /* Attachment type: */ switch (adapterData.m_attachmentType) { case KNetworkAttachmentType_Bridged: adapter.SetBridgedInterface(adapterData.m_strBridgedAdapterName); break; case KNetworkAttachmentType_Internal: adapter.SetInternalNetwork(adapterData.m_strInternalNetworkName); break; case KNetworkAttachmentType_HostOnly: adapter.SetHostOnlyInterface(adapterData.m_strHostInterfaceName); break; case KNetworkAttachmentType_Generic: adapter.SetGenericDriver(adapterData.m_strGenericDriverName); updateGenericProperties(adapter, adapterData.m_strGenericProperties); break; default: break; } adapter.SetAttachmentType(adapterData.m_attachmentType); /* Advanced attributes: */ adapter.SetPromiscModePolicy(adapterData.m_promiscuousMode); /* Cable connected flag: */ adapter.SetCableConnected(adapterData.m_fCableConnected); /* Redirect options: */ QVector<QString> oldRedirects = adapter.GetNATEngine().GetRedirects(); for (int i = 0; i < oldRedirects.size(); ++i) adapter.GetNATEngine().RemoveRedirect(oldRedirects[i].section(',', 0, 0)); UIPortForwardingDataList newRedirects = adapterData.m_redirects; for (int i = 0; i < newRedirects.size(); ++i) { UIPortForwardingData newRedirect = newRedirects[i]; adapter.GetNATEngine().AddRedirect(newRedirect.name, newRedirect.protocol, newRedirect.hostIp, newRedirect.hostPort.value(), newRedirect.guestIp, newRedirect.guestPort.value()); } } } } } } /* Upload machine to data: */ UISettingsPageMachine::uploadData(data); }
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); connect(&uiprogress, SIGNAL(sigProgressError(QString)), this, SIGNAL(sigOperationProgressError(QString)), Qt::BlockingQueuedConnection); uiprogress.run(350); } } } } }