/* static */ void UIApplianceEditorWidget::initSystemSettings() { if (m_minGuestRAM == -1) { /* We need some global defaults from the current VirtualBox installation */ CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties(); m_minGuestRAM = sp.GetMinGuestRAM(); m_maxGuestRAM = sp.GetMaxGuestRAM(); m_minGuestCPUCount = sp.GetMinGuestCPUCount(); m_maxGuestCPUCount = sp.GetMaxGuestCPUCount(); } }
void UIMachineSettingsSystem::prepareTabProcessor() { /* Load configuration: */ CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); uint hostCPUs = vboxGlobal().host().GetProcessorCount(); m_uMinGuestCPU = properties.GetMinGuestCPUCount(); m_uMaxGuestCPU = qMin(2 * hostCPUs, (uint)properties.GetMaxGuestCPUCount()); m_uMinGuestCPUExecCap = 1; m_uMedGuestCPUExecCap = 40; m_uMaxGuestCPUExecCap = 100; /* Preconfigure CPU-count slider: */ m_pSliderCPUCount->setPageStep(1); m_pSliderCPUCount->setSingleStep(1); m_pSliderCPUCount->setTickInterval(1); m_pSliderCPUCount->setMinimum(m_uMinGuestCPU); m_pSliderCPUCount->setMaximum(m_uMaxGuestCPU); m_pSliderCPUCount->setOptimalHint(1, hostCPUs); m_pSliderCPUCount->setWarningHint(hostCPUs, m_uMaxGuestCPU); /* Preconfigure CPU-count editor: */ m_pEditorCPUCount->setMinimum(m_uMinGuestCPU); m_pEditorCPUCount->setMaximum(m_uMaxGuestCPU); vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUCount, 4); /* Preconfigure CPU-execution-cap slider: */ m_pSliderCPUExecCap->setPageStep(10); m_pSliderCPUExecCap->setSingleStep(1); m_pSliderCPUExecCap->setTickInterval(10); /* Setup the scale so that ticks are at page step boundaries: */ m_pSliderCPUExecCap->setMinimum(m_uMinGuestCPUExecCap); m_pSliderCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap); m_pSliderCPUExecCap->setWarningHint(m_uMinGuestCPUExecCap, m_uMedGuestCPUExecCap); m_pSliderCPUExecCap->setOptimalHint(m_uMedGuestCPUExecCap, m_uMaxGuestCPUExecCap); /* Preconfigure CPU-execution-cap editor: */ m_pEditorCPUExecCap->setMinimum(m_uMinGuestCPUExecCap); m_pEditorCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap); vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUExecCap, 4); /* Install CPU widget connections: */ connect(m_pSliderCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountSliderChange())); connect(m_pEditorCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountEditorChange())); connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapSliderChange())); connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange())); }
UIMachineSettingsSystem::UIMachineSettingsSystem() : mValidator(0) , mMinGuestCPU(0), mMaxGuestCPU(0) , mMinGuestCPUExecCap(0), mMedGuestCPUExecCap(0), mMaxGuestCPUExecCap(0) , m_fOHCIEnabled(false) { /* Apply UI decorations */ Ui::UIMachineSettingsSystem::setupUi (this); /* Setup constants */ CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); uint hostCPUs = vboxGlobal().host().GetProcessorCount(); mMinGuestCPU = properties.GetMinGuestCPUCount(); mMaxGuestCPU = RT_MIN (2 * hostCPUs, properties.GetMaxGuestCPUCount()); mMinGuestCPUExecCap = 1; mMedGuestCPUExecCap = 40; mMaxGuestCPUExecCap = 100; /* Populate possible boot items list. * Currently, it seems, we are supporting only 4 possible boot device types: * 1. Floppy, 2. DVD-ROM, 3. Hard Disk, 4. Network. * But maximum boot devices count supported by machine * should be retrieved through the ISystemProperties getter. * Moreover, possible boot device types are not listed in some separate Main vector, * so we should get them (randomely?) from the list of all device types. * Until there will be separate Main getter for list of supported boot device types, * this list will be hard-coded here... */ int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition()); for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition) { switch (iBootPosition) { case 1: m_possibleBootItems << KDeviceType_Floppy; break; case 2: m_possibleBootItems << KDeviceType_DVD; break; case 3: m_possibleBootItems << KDeviceType_HardDisk; break; case 4: m_possibleBootItems << KDeviceType_Network; break; default: break; } } /* Add all available devices types, so we could initially calculate the * right size. */ for (int i = 0; i < m_possibleBootItems.size(); ++i) { QListWidgetItem *pItem = new UIBootTableItem(m_possibleBootItems[i]); mTwBootOrder->addItem(pItem); } /* Setup validators */ mLeMemory->setValidator (new QIntValidator (mSlMemory->minRAM(), mSlMemory->maxRAM(), this)); mLeCPU->setValidator (new QIntValidator (mMinGuestCPU, mMaxGuestCPU, this)); mLeCPUExecCap->setValidator(new QIntValidator(mMinGuestCPUExecCap, mMaxGuestCPUExecCap, this)); /* Setup connections */ connect (mSlMemory, SIGNAL (valueChanged (int)), this, SLOT (valueChangedRAM (int))); connect (mLeMemory, SIGNAL (textChanged (const QString&)), this, SLOT (textChangedRAM (const QString&))); connect (mTbBootItemUp, SIGNAL (clicked()), mTwBootOrder, SLOT(sltMoveItemUp())); connect (mTbBootItemDown, SIGNAL (clicked()), mTwBootOrder, SLOT(sltMoveItemDown())); connect (mTwBootOrder, SIGNAL (sigRowChanged(int)), this, SLOT (onCurrentBootItemChanged (int))); connect (mSlCPU, SIGNAL (valueChanged (int)), this, SLOT (valueChangedCPU (int))); connect (mLeCPU, SIGNAL (textChanged (const QString&)), this, SLOT (textChangedCPU (const QString&))); connect(mSlCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedCPUExecCap(int))); connect(mLeCPUExecCap, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedCPUExecCap(const QString&))); /* Setup iconsets */ mTbBootItemUp->setIcon(UIIconPool::iconSet(":/list_moveup_16px.png", ":/list_moveup_disabled_16px.png")); mTbBootItemDown->setIcon(UIIconPool::iconSet(":/list_movedown_16px.png", ":/list_movedown_disabled_16px.png")); #ifdef Q_WS_MAC /* We need a little space for the focus rect. */ mLtBootOrder->setContentsMargins (3, 3, 3, 3); mLtBootOrder->setSpacing (3); #endif /* Q_WS_MAC */ /* Limit min/max. size of QLineEdit */ mLeMemory->setFixedWidthByText (QString().fill ('8', 5)); /* Ensure mLeMemory value and validation is updated */ valueChangedRAM (mSlMemory->value()); /* Setup cpu slider */ mSlCPU->setPageStep (1); mSlCPU->setSingleStep (1); mSlCPU->setTickInterval (1); /* Setup the scale so that ticks are at page step boundaries */ mSlCPU->setMinimum (mMinGuestCPU); mSlCPU->setMaximum (mMaxGuestCPU); mSlCPU->setOptimalHint (1, hostCPUs); mSlCPU->setWarningHint (hostCPUs, mMaxGuestCPU); /* Limit min/max. size of QLineEdit */ mLeCPU->setFixedWidthByText(QString().fill('8', 4)); /* Ensure mLeMemory value and validation is updated */ valueChangedCPU (mSlCPU->value()); /* Setup cpu cap slider: */ mSlCPUExecCap->setPageStep(10); mSlCPUExecCap->setSingleStep(1); mSlCPUExecCap->setTickInterval(10); /* Setup the scale so that ticks are at page step boundaries: */ mSlCPUExecCap->setMinimum(mMinGuestCPUExecCap); mSlCPUExecCap->setMaximum(mMaxGuestCPUExecCap); mSlCPUExecCap->setWarningHint(mMinGuestCPUExecCap, mMedGuestCPUExecCap); mSlCPUExecCap->setOptimalHint(mMedGuestCPUExecCap, mMaxGuestCPUExecCap); /* Limit min/max. size of QLineEdit: */ mLeCPUExecCap->setFixedWidthByText(QString().fill('8', 4)); /* Ensure mLeMemory value and validation is updated: */ sltValueChangedCPUExecCap(mSlCPUExecCap->value()); /* Populate chipset combo: */ mCbChipset->insertItem(0, gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3)); mCbChipset->insertItem(1, gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9)); /* Install global event filter */ qApp->installEventFilter (this); /* Applying language settings */ retranslateUi(); }