void UIMachineSettingsSystem::prepareTabMotherboard() { /* Load configuration: */ CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); /* Preconfigure memory-size editor: */ m_pEditorMemorySize->setMinimum(m_pSliderMemorySize->minRAM()); m_pEditorMemorySize->setMaximum(m_pSliderMemorySize->maxRAM()); vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorMemorySize, 5); /* Preconfigure boot-table widgets: */ 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: */ m_pLayoutBootOrder->setContentsMargins(3, 3, 3, 3); m_pLayoutBootOrder->setSpacing(3); #endif /* Q_WS_MAC */ /* Install global event filter * to handle boot-table focus in/out events: */ // TODO: Get rid of that *crap*! qApp->installEventFilter(this); /* 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); } /* Populate 'chipset type' combo: */ m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3)); m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9)); /* Preconfigure 'pointing HID type' combo: */ m_pComboPointingHIDType->setSizeAdjustPolicy(QComboBox::AdjustToContents); /* Install memory-size widget connections: */ connect(m_pSliderMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeSliderChange())); connect(m_pEditorMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeEditorChange())); /* Install boot-table connections: */ connect(mTbBootItemUp, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemUp())); connect(mTbBootItemDown, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemDown())); connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(sltCurrentBootItemChanged(int))); }
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(); }