Changeset 47255 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 19, 2013 1:21:02 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r47253 r47255 35 35 36 36 UIMachineSettingsSystem::UIMachineSettingsSystem() 37 : m Validator(0)38 , m MinGuestCPU(0), mMaxGuestCPU(0)39 , m MinGuestCPUExecCap(0), mMedGuestCPUExecCap(0), mMaxGuestCPUExecCap(0)37 : m_pValidator(0) 38 , m_uMinGuestCPU(0), m_uMaxGuestCPU(0) 39 , m_uMinGuestCPUExecCap(0), m_uMedGuestCPUExecCap(0), m_uMaxGuestCPUExecCap(0) 40 40 , m_fOHCIEnabled(false) 41 41 { … … 46 46 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 47 47 uint hostCPUs = vboxGlobal().host().GetProcessorCount(); 48 m MinGuestCPU = properties.GetMinGuestCPUCount();49 m MaxGuestCPU = RT_MIN (2 * hostCPUs, properties.GetMaxGuestCPUCount());50 m MinGuestCPUExecCap = 1;51 m MedGuestCPUExecCap = 40;52 m MaxGuestCPUExecCap = 100;48 m_uMinGuestCPU = properties.GetMinGuestCPUCount(); 49 m_uMaxGuestCPU = RT_MIN (2 * hostCPUs, properties.GetMaxGuestCPUCount()); 50 m_uMinGuestCPUExecCap = 1; 51 m_uMedGuestCPUExecCap = 40; 52 m_uMaxGuestCPUExecCap = 100; 53 53 54 54 /* Populate possible boot items list. … … 91 91 92 92 /* Setup validators: */ 93 mLeMemory->setValidator (new QIntValidator(mSlMemory->minRAM(), mSlMemory->maxRAM(), this));94 mLeCPU->setValidator (new QIntValidator (mMinGuestCPU, mMaxGuestCPU, this));95 mLeCPUExecCap->setValidator(new QIntValidator(m MinGuestCPUExecCap, mMaxGuestCPUExecCap, this));93 mLeMemory->setValidator(new QIntValidator(mSlMemory->minRAM(), mSlMemory->maxRAM(), this)); 94 mLeCPU->setValidator(new QIntValidator(m_uMinGuestCPU, m_uMaxGuestCPU, this)); 95 mLeCPUExecCap->setValidator(new QIntValidator(m_uMinGuestCPUExecCap, m_uMaxGuestCPUExecCap, this)); 96 96 97 97 /* Setup RAM connections: */ 98 connect (mSlMemory, SIGNAL (valueChanged (int)), 99 this, SLOT (valueChangedRAM (int))); 100 connect (mLeMemory, SIGNAL (textChanged (const QString&)), 101 this, SLOT (textChangedRAM (const QString&))); 98 connect(mSlMemory, SIGNAL(valueChanged(int)), this, SLOT(valueChangedRAM(int))); 99 connect(mLeMemory, SIGNAL(textChanged(const QString&)), this, SLOT(textChangedRAM(const QString&))); 102 100 103 101 /* Setup boot-table connections: */ 104 connect (mTbBootItemUp, SIGNAL (clicked()), 105 mTwBootOrder, SLOT(sltMoveItemUp())); 106 connect (mTbBootItemDown, SIGNAL (clicked()), 107 mTwBootOrder, SLOT(sltMoveItemDown())); 108 connect (mTwBootOrder, SIGNAL (sigRowChanged(int)), 109 this, SLOT (onCurrentBootItemChanged (int))); 102 connect(mTbBootItemUp, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemUp())); 103 connect(mTbBootItemDown, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemDown())); 104 connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(onCurrentBootItemChanged(int))); 110 105 111 106 /* Setup CPU connections: */ 112 connect (mSlCPU, SIGNAL (valueChanged (int)), 113 this, SLOT (valueChangedCPU (int))); 114 connect (mLeCPU, SIGNAL (textChanged (const QString&)), 115 this, SLOT (textChangedCPU (const QString&))); 107 connect(mSlCPU, SIGNAL(valueChanged(int)), this, SLOT(valueChangedCPU(int))); 108 connect(mLeCPU, SIGNAL(textChanged(const QString&)), this, SLOT(textChangedCPU(const QString&))); 116 109 connect(mSlCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedCPUExecCap(int))); 117 110 connect(mLeCPUExecCap, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedCPUExecCap(const QString&))); 118 111 119 112 /* Setup boot-table iconsets: */ 120 mTbBootItemUp->setIcon(UIIconPool::iconSet(":/list_moveup_16px.png", 121 ":/list_moveup_disabled_16px.png")); 122 mTbBootItemDown->setIcon(UIIconPool::iconSet(":/list_movedown_16px.png", 123 ":/list_movedown_disabled_16px.png")); 113 mTbBootItemUp->setIcon(UIIconPool::iconSet(":/list_moveup_16px.png", ":/list_moveup_disabled_16px.png")); 114 mTbBootItemDown->setIcon(UIIconPool::iconSet(":/list_movedown_16px.png", ":/list_movedown_disabled_16px.png")); 124 115 125 116 #ifdef Q_WS_MAC … … 130 121 131 122 /* Limit min/max size of QLineEdit: */ 132 mLeMemory->setFixedWidthByText (QString().fill('8', 5));123 mLeMemory->setFixedWidthByText(QString().fill('8', 5)); 133 124 /* Ensure mLeMemory value and validation is updated: */ 134 valueChangedRAM 125 valueChangedRAM(mSlMemory->value()); 135 126 136 127 /* Setup cpu slider: */ 137 mSlCPU->setPageStep 138 mSlCPU->setSingleStep 139 mSlCPU->setTickInterval 128 mSlCPU->setPageStep(1); 129 mSlCPU->setSingleStep(1); 130 mSlCPU->setTickInterval(1); 140 131 /* Setup the scale so that ticks are at page step boundaries: */ 141 mSlCPU->setMinimum (mMinGuestCPU);142 mSlCPU->setMaximum (mMaxGuestCPU);143 mSlCPU->setOptimalHint 144 mSlCPU->setWarningHint (hostCPUs, mMaxGuestCPU);132 mSlCPU->setMinimum(m_uMinGuestCPU); 133 mSlCPU->setMaximum(m_uMaxGuestCPU); 134 mSlCPU->setOptimalHint(1, hostCPUs); 135 mSlCPU->setWarningHint(hostCPUs, m_uMaxGuestCPU); 145 136 /* Limit min/max. size of QLineEdit: */ 146 137 mLeCPU->setFixedWidthByText(QString().fill('8', 4)); 147 138 /* Ensure mLeMemory value and validation is updated: */ 148 valueChangedCPU 139 valueChangedCPU(mSlCPU->value()); 149 140 150 141 /* Setup cpu cap slider: */ … … 153 144 mSlCPUExecCap->setTickInterval(10); 154 145 /* Setup the scale so that ticks are at page step boundaries: */ 155 mSlCPUExecCap->setMinimum(m MinGuestCPUExecCap);156 mSlCPUExecCap->setMaximum(m MaxGuestCPUExecCap);157 mSlCPUExecCap->setWarningHint(m MinGuestCPUExecCap, mMedGuestCPUExecCap);158 mSlCPUExecCap->setOptimalHint(m MedGuestCPUExecCap, mMaxGuestCPUExecCap);146 mSlCPUExecCap->setMinimum(m_uMinGuestCPUExecCap); 147 mSlCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap); 148 mSlCPUExecCap->setWarningHint(m_uMinGuestCPUExecCap, m_uMedGuestCPUExecCap); 149 mSlCPUExecCap->setOptimalHint(m_uMedGuestCPUExecCap, m_uMaxGuestCPUExecCap); 159 150 /* Limit min/max. size of QLineEdit: */ 160 151 mLeCPUExecCap->setFixedWidthByText(QString().fill('8', 4)); … … 163 154 164 155 /* Populate chipset combo: */ 165 mCbChipset-> insertItem(0,gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3));166 mCbChipset-> insertItem(1,gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9));156 mCbChipset->addItem(gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3)); 157 mCbChipset->addItem(gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9)); 167 158 168 159 /* Install global event filter: */ 169 qApp->installEventFilter 160 qApp->installEventFilter(this); 170 161 171 162 /* Retranslate finally: */ … … 290 281 291 282 /* Revalidate if possible: */ 292 if (m Validator)293 m Validator->revalidate();283 if (m_pValidator) 284 m_pValidator->revalidate(); 294 285 } 295 286 … … 382 373 } 383 374 384 void UIMachineSettingsSystem::setValidator (QIWidgetValidator *aVal)375 void UIMachineSettingsSystem::setValidator(QIWidgetValidator *pValidator) 385 376 { 386 377 /* Configure validation: */ 387 m Validator = aVal;388 connect (mCbApic, SIGNAL (stateChanged (int)), mValidator, SLOT(revalidate()));389 connect (mCbVirt, SIGNAL (stateChanged (int)), mValidator, SLOT(revalidate()));390 connect (mCbUseAbsHID, SIGNAL (stateChanged (int)), mValidator, SLOT(revalidate()));391 connect(mCb Chipset, SIGNAL(currentIndexChanged(int)), mValidator, SLOT(revalidate()));392 } 393 394 bool UIMachineSettingsSystem::revalidate (QString &aWarning, QString & /* aTitle */)378 m_pValidator = pValidator; 379 connect(mCbChipset, SIGNAL(currentIndexChanged(int)), m_pValidator, SLOT(revalidate())); 380 connect(mCbApic, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); 381 connect(mCbVirt, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); 382 connect(mCbUseAbsHID, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); 383 } 384 385 bool UIMachineSettingsSystem::revalidate(QString &strWarning, QString& /* strTitle */) 395 386 { 396 387 /* RAM amount test: */ 397 ulong fullSize = vboxGlobal().host().GetMemorySize();388 ulong uFullSize = vboxGlobal().host().GetMemorySize(); 398 389 if (mSlMemory->value() > (int)mSlMemory->maxRAMAlw()) 399 390 { 400 aWarning = tr(391 strWarning = tr( 401 392 "you have assigned more than <b>%1%</b> of your computer's memory " 402 393 "(<b>%2</b>) to the virtual machine. Not enough memory is left " 403 394 "for your host operating system. Please select a smaller amount.") 404 .arg ((unsigned)qRound ((double)mSlMemory->maxRAMAlw() / fullSize * 100.0))405 .arg (vboxGlobal().formatSize ((uint64_t)fullSize * _1M));395 .arg((unsigned)qRound((double)mSlMemory->maxRAMAlw() / uFullSize * 100.0)) 396 .arg(vboxGlobal().formatSize((uint64_t)uFullSize * _1M)); 406 397 return false; 407 398 } 408 399 if (mSlMemory->value() > (int)mSlMemory->maxRAMOpt()) 409 400 { 410 aWarning = tr(401 strWarning = tr( 411 402 "you have assigned more than <b>%1%</b> of your computer's memory " 412 403 "(<b>%2</b>) to the virtual machine. There might not be enough memory " 413 404 "left for your host operating system. Continue at your own risk.") 414 .arg ((unsigned)qRound ((double)mSlMemory->maxRAMOpt() / fullSize * 100.0))415 .arg (vboxGlobal().formatSize ((uint64_t)fullSize * _1M));405 .arg((unsigned)qRound((double)mSlMemory->maxRAMOpt() / uFullSize * 100.0)) 406 .arg(vboxGlobal().formatSize((uint64_t)uFullSize * _1M)); 416 407 return true; 417 408 } 418 409 419 410 /* VCPU amount test: */ 420 int totalCPUs = vboxGlobal().host().GetProcessorOnlineCount();421 if (mSlCPU->value() > 2 * totalCPUs)422 { 423 aWarning = tr(411 int cTotalCPUs = vboxGlobal().host().GetProcessorOnlineCount(); 412 if (mSlCPU->value() > 2 * cTotalCPUs) 413 { 414 strWarning = tr( 424 415 "for performance reasons, the number of virtual CPUs attached to the " 425 416 "virtual machine may not be more than twice the number of physical " 426 417 "CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.") 427 .arg (totalCPUs);418 .arg(cTotalCPUs); 428 419 return false; 429 420 } 430 if (mSlCPU->value() > totalCPUs)431 { 432 aWarning = tr(421 if (mSlCPU->value() > cTotalCPUs) 422 { 423 strWarning = tr( 433 424 "you have assigned more virtual CPUs to the virtual machine than " 434 425 "the number of physical CPUs on your host system (<b>%1</b>). " 435 426 "This is likely to degrade the performance of your virtual machine. " 436 427 "Please consider reducing the number of virtual CPUs.") 437 .arg (totalCPUs);428 .arg(cTotalCPUs); 438 429 return true; 439 430 } … … 442 433 if (mSlCPU->value() > 1 && !mCbApic->isChecked()) 443 434 { 444 aWarning = tr(435 strWarning = tr( 445 436 "you have assigned more than one virtual CPU to this VM. " 446 437 "This will not work unless the IO-APIC feature is also enabled. " … … 453 444 if (mSlCPU->value() > 1 && !mCbVirt->isChecked()) 454 445 { 455 aWarning = tr(446 strWarning = tr( 456 447 "you have assigned more than one virtual CPU to this VM. " 457 448 "This will not work unless hardware virtualization (VT-x/AMD-V) is also enabled. " … … 462 453 463 454 /* CPU execution cap is low: */ 464 if (mSlCPUExecCap->value() < (int)m MedGuestCPUExecCap)465 { 466 aWarning = tr(455 if (mSlCPUExecCap->value() < (int)m_uMedGuestCPUExecCap) 456 { 457 strWarning = tr( 467 458 "you have set the processor execution cap to a low value. " 468 459 "This can make the machine feel slow to respond."); … … 473 464 if ((KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt() == KChipsetType_ICH9 && !mCbApic->isChecked()) 474 465 { 475 aWarning = tr(466 strWarning = tr( 476 467 "you have assigned ICH9 chipset type to this VM. " 477 468 "It will not work properly unless the IO-APIC feature is also enabled. " … … 484 475 if (mCbUseAbsHID->isChecked() && !m_fOHCIEnabled) 485 476 { 486 aWarning = tr(477 strWarning = tr( 487 478 "you have enabled a USB HID (Human Interface Device). " 488 479 "This will not work unless USB emulation is also enabled. " … … 495 486 } 496 487 497 void UIMachineSettingsSystem::setOrderAfter (QWidget *aWidget) 498 { 499 /* Motherboard tab-order */ 500 setTabOrder (aWidget, mTwSystem->focusProxy()); 501 setTabOrder (mTwSystem->focusProxy(), mSlMemory); 502 setTabOrder (mSlMemory, mLeMemory); 503 setTabOrder (mLeMemory, mTwBootOrder); 504 setTabOrder (mTwBootOrder, mTbBootItemUp); 505 setTabOrder (mTbBootItemUp, mTbBootItemDown); 506 setTabOrder (mTbBootItemDown, mCbApic); 507 setTabOrder (mCbApic, mCbEFI); 508 setTabOrder (mCbEFI, mCbTCUseUTC); 509 setTabOrder (mCbTCUseUTC, mCbUseAbsHID); 488 void UIMachineSettingsSystem::setOrderAfter(QWidget *pWidget) 489 { 490 /* Motherboard tab-order: */ 491 setTabOrder(pWidget, mTwSystem->focusProxy()); 492 setTabOrder(mTwSystem->focusProxy(), mSlMemory); 493 setTabOrder(mSlMemory, mLeMemory); 494 setTabOrder(mLeMemory, mTwBootOrder); 495 setTabOrder(mTwBootOrder, mTbBootItemUp); 496 setTabOrder(mTbBootItemUp, mTbBootItemDown); 497 setTabOrder(mTbBootItemDown, mCbChipset); 498 setTabOrder(mCbChipset, mCbApic); 499 setTabOrder(mCbApic, mCbEFI); 500 setTabOrder(mCbEFI, mCbTCUseUTC); 501 setTabOrder(mCbTCUseUTC, mCbUseAbsHID); 510 502 511 503 /* Processor tab-order: */ 512 setTabOrder 513 setTabOrder 504 setTabOrder(mCbUseAbsHID, mSlCPU); 505 setTabOrder(mSlCPU, mLeCPU); 514 506 setTabOrder(mLeCPU, mSlCPUExecCap); 515 507 setTabOrder(mSlCPUExecCap, mLeCPUExecCap); … … 517 509 518 510 /* Acceleration tab-order: */ 519 setTabOrder 520 setTabOrder 511 setTabOrder(mCbPae, mCbVirt); 512 setTabOrder(mCbVirt, mCbNestedPaging); 521 513 } 522 514 … … 524 516 { 525 517 /* Translate uic generated strings: */ 526 Ui::UIMachineSettingsSystem::retranslateUi 518 Ui::UIMachineSettingsSystem::retranslateUi(this); 527 519 528 520 /* Readjust the tree widget items size: */ … … 530 522 531 523 /* Retranslate the memory slider legend: */ 532 mLbMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg(mSlMemory->minRAM()));533 mLbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg(mSlMemory->maxRAM()));524 mLbMemoryMin->setText(tr("<qt>%1 MB</qt>").arg(mSlMemory->minRAM())); 525 mLbMemoryMax->setText(tr("<qt>%1 MB</qt>").arg(mSlMemory->maxRAM())); 534 526 535 527 /* Retranslate the cpu slider legend: */ 536 mLbCPUMin->setText (tr ("<qt>%1 CPU</qt>", "%1 is 1 for now").arg (mMinGuestCPU));537 mLbCPUMax->setText (tr ("<qt>%1 CPUs</qt>", "%1 is host cpu count * 2 for now").arg (mMaxGuestCPU));528 mLbCPUMin->setText(tr("<qt>%1 CPU</qt>", "%1 is 1 for now").arg(m_uMinGuestCPU)); 529 mLbCPUMax->setText(tr("<qt>%1 CPUs</qt>", "%1 is host cpu count * 2 for now").arg(m_uMaxGuestCPU)); 538 530 539 531 /* Retranslate the cpu cap slider legend: */ 540 mLbCPUExecCapMin->setText(tr("<qt>%1%</qt>", "Min CPU execution cap in %").arg(m MinGuestCPUExecCap));541 mLbCPUExecCapMax->setText(tr("<qt>%1%</qt>", "Max CPU execution cap in %").arg(m MaxGuestCPUExecCap));542 } 543 544 void UIMachineSettingsSystem::valueChangedRAM (int aVal)545 { 546 mLeMemory->setText (QString().setNum (aVal));547 } 548 549 void UIMachineSettingsSystem::textChangedRAM (const QString &aText)550 { 551 mSlMemory->setValue (aText.toInt());552 } 553 554 void UIMachineSettingsSystem::onCurrentBootItemChanged (int i)532 mLbCPUExecCapMin->setText(tr("<qt>%1%</qt>", "Min CPU execution cap in %").arg(m_uMinGuestCPUExecCap)); 533 mLbCPUExecCapMax->setText(tr("<qt>%1%</qt>", "Max CPU execution cap in %").arg(m_uMaxGuestCPUExecCap)); 534 } 535 536 void UIMachineSettingsSystem::valueChangedRAM(int iValue) 537 { 538 mLeMemory->setText(QString::number(iValue)); 539 } 540 541 void UIMachineSettingsSystem::textChangedRAM(const QString &strText) 542 { 543 mSlMemory->setValue(strText.toInt()); 544 } 545 546 void UIMachineSettingsSystem::onCurrentBootItemChanged(int iCurrentItem) 555 547 { 556 548 /* Update boot-order tool-buttons: */ 557 bool upEnabled = i> 0;558 bool downEnabled = i< mTwBootOrder->count() - 1;559 if ((mTbBootItemUp->hasFocus() && ! upEnabled) ||560 (mTbBootItemDown->hasFocus() && ! downEnabled))549 bool fEnabledUP = iCurrentItem > 0; 550 bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1; 551 if ((mTbBootItemUp->hasFocus() && !fEnabledUP) || 552 (mTbBootItemDown->hasFocus() && !fEnabledDOWN)) 561 553 mTwBootOrder->setFocus(); 562 mTbBootItemUp->setEnabled (upEnabled);563 mTbBootItemDown->setEnabled (downEnabled);554 mTbBootItemUp->setEnabled(fEnabledUP); 555 mTbBootItemDown->setEnabled(fEnabledDOWN); 564 556 } 565 557 … … 576 568 } 577 569 578 void UIMachineSettingsSystem::valueChangedCPU (int aVal)579 { 580 mLeCPU->setText (QString().setNum (aVal));581 } 582 583 void UIMachineSettingsSystem::textChangedCPU (const QString &aText)584 { 585 mSlCPU->setValue (aText.toInt());570 void UIMachineSettingsSystem::valueChangedCPU(int iValue) 571 { 572 mLeCPU->setText(QString::number(iValue)); 573 } 574 575 void UIMachineSettingsSystem::textChangedCPU(const QString &strText) 576 { 577 mSlCPU->setValue(strText.toInt()); 586 578 } 587 579 588 580 void UIMachineSettingsSystem::sltValueChangedCPUExecCap(int iValue) 589 581 { 590 mLeCPUExecCap->setText(QString ().setNum(iValue));582 mLeCPUExecCap->setText(QString::number(iValue)); 591 583 } 592 584 … … 594 586 { 595 587 mSlCPUExecCap->setValue(strText.toInt()); 596 }597 598 bool UIMachineSettingsSystem::eventFilter (QObject *aObject, QEvent *aEvent)599 {600 if (!aObject->isWidgetType())601 return QWidget::eventFilter (aObject, aEvent);602 603 QWidget *widget = static_cast<QWidget*> (aObject);604 if (widget->window() != window())605 return QWidget::eventFilter (aObject, aEvent);606 607 switch (aEvent->type())608 {609 case QEvent::FocusIn:610 {611 /* Boot Table: */612 if (widget == mTwBootOrder)613 {614 if (!mTwBootOrder->currentItem())615 mTwBootOrder->setCurrentItem (mTwBootOrder->item (0));616 else617 onCurrentBootItemChanged (mTwBootOrder->currentRow());618 mTwBootOrder->currentItem()->setSelected (true);619 }620 else if (widget != mTbBootItemUp && widget != mTbBootItemDown)621 {622 if (mTwBootOrder->currentItem())623 {624 mTwBootOrder->currentItem()->setSelected (false);625 mTbBootItemUp->setEnabled (false);626 mTbBootItemDown->setEnabled (false);627 }628 }629 break;630 }631 default:632 break;633 }634 635 return QWidget::eventFilter (aObject, aEvent);636 588 } 637 589 … … 681 633 } 682 634 635 bool UIMachineSettingsSystem::eventFilter(QObject *pObject, QEvent *pEvent) 636 { 637 if (!pObject->isWidgetType()) 638 return QWidget::eventFilter(pObject, pEvent); 639 640 QWidget *pWidget = static_cast<QWidget*>(pObject); 641 if (pWidget->window() != window()) 642 return QWidget::eventFilter(pObject, pEvent); 643 644 switch (pEvent->type()) 645 { 646 case QEvent::FocusIn: 647 { 648 /* Boot Table: */ 649 if (pWidget == mTwBootOrder) 650 { 651 if (!mTwBootOrder->currentItem()) 652 mTwBootOrder->setCurrentItem(mTwBootOrder->item(0)); 653 else 654 onCurrentBootItemChanged(mTwBootOrder->currentRow()); 655 mTwBootOrder->currentItem()->setSelected(true); 656 } 657 else if (pWidget != mTbBootItemUp && pWidget != mTbBootItemDown) 658 { 659 if (mTwBootOrder->currentItem()) 660 { 661 mTwBootOrder->currentItem()->setSelected(false); 662 mTbBootItemUp->setEnabled(false); 663 mTbBootItemDown->setEnabled(false); 664 } 665 } 666 break; 667 } 668 default: 669 break; 670 } 671 672 return QWidget::eventFilter(pObject, pEvent); 673 } 674 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r47253 r47255 29 29 /* Default constructor: */ 30 30 UIBootItemData() : m_type(KDeviceType_Null), m_fEnabled(false) {} 31 31 32 /* Operator==: */ 32 33 bool operator==(const UIBootItemData &other) const … … 35 36 (m_fEnabled == other.m_fEnabled); 36 37 } 38 37 39 /* Variables: */ 38 40 KDeviceType m_type; … … 59 61 , m_cCPUCount(-1) 60 62 , m_cCPUExecCap(-1) {} 63 61 64 /* Functions: */ 62 65 bool equal(const UIDataSettingsMachineSystem &other) const … … 77 80 (m_cCPUExecCap == other.m_cCPUExecCap); 78 81 } 82 79 83 /* Operators: */ 80 84 bool operator==(const UIDataSettingsMachineSystem &other) const { return equal(other); } 81 85 bool operator!=(const UIDataSettingsMachineSystem &other) const { return !equal(other); } 86 82 87 /* Variables: */ 83 88 QList<UIBootItemData> m_bootItems; … … 117 122 protected: 118 123 119 /* Load data to cache from corresponding external object(s), 124 /* API: Cache stuff: */ 125 bool changed() const { return m_cache.wasChanged(); } 126 127 /* API: Load data to cache from corresponding external object(s), 120 128 * this task COULD be performed in other than GUI thread: */ 121 129 void loadToCacheFrom(QVariant &data); 122 /* Load data to corresponding widgets from cache,130 /* API: Load data to corresponding widgets from cache, 123 131 * this task SHOULD be performed in GUI thread only: */ 124 132 void getFromCache(); 125 133 126 /* Save data from corresponding widgets to cache,134 /* API: Save data from corresponding widgets to cache, 127 135 * this task SHOULD be performed in GUI thread only: */ 128 136 void putToCache(); 129 /* Save data from cache to corresponding external object(s),137 /* API: Save data from cache to corresponding external object(s), 130 138 * this task COULD be performed in other than GUI thread: */ 131 139 void saveFromCacheTo(QVariant &data); 132 140 133 /* API: Cache stuff: */134 bool changed() const { return m_cache.wasChanged(); }135 136 141 /* Helpers: Validation stuff: */ 137 void setValidator (QIWidgetValidator *aVal);138 bool revalidate (QString &aWarning, QString &aTitle);142 void setValidator(QIWidgetValidator *pValidator); 143 bool revalidate(QString &strWarning, QString &strTitle); 139 144 140 145 /* Helper: Navigation stuff: */ 141 void setOrderAfter (QWidget *aWidget);146 void setOrderAfter(QWidget *pWidget); 142 147 143 148 /* Helper: Translation stuff: */ … … 147 152 148 153 /* Handlers: RAM stuff: */ 149 void valueChangedRAM (int aVal);150 void textChangedRAM (const QString &aText);154 void valueChangedRAM(int iValue); 155 void textChangedRAM(const QString &strText); 151 156 152 /* Handler: Boot stuff: */153 void onCurrentBootItemChanged (int);157 /* Handler: Boot-table stuff: */ 158 void onCurrentBootItemChanged(int iCurrentIndex); 154 159 155 160 /* Handlers: CPU stuff: */ 156 void valueChangedCPU (int aVal);157 void textChangedCPU (const QString &aText);161 void valueChangedCPU(int iValue); 162 void textChangedCPU(const QString &strText); 158 163 void sltValueChangedCPUExecCap(int iValue); 159 164 void sltTextChangedCPUExecCap(const QString &strText); … … 161 166 private: 162 167 163 /* Handler: Event-filtration stuff: */164 bool eventFilter (QObject *aObject, QEvent *aEvent);165 166 /* Helper: Boot stuff: */167 void adjustBootOrderTWSize();168 169 168 /* Handler: Polishing stuff: */ 170 169 void polishPage(); 171 170 171 /* Handler: Event-filtration stuff: */ 172 bool eventFilter(QObject *aObject, QEvent *aEvent); 173 174 /* Helper: Boot-table stuff: */ 175 void adjustBootOrderTWSize(); 176 172 177 /* Variable: Validation stuff: */ 173 QIWidgetValidator *m Validator;178 QIWidgetValidator *m_pValidator; 174 179 175 180 /* Variables: CPU stuff: */ 176 uint m MinGuestCPU;177 uint m MaxGuestCPU;178 uint m MinGuestCPUExecCap;179 uint m MedGuestCPUExecCap;180 uint m MaxGuestCPUExecCap;181 uint m_uMinGuestCPU; 182 uint m_uMaxGuestCPU; 183 uint m_uMinGuestCPUExecCap; 184 uint m_uMedGuestCPUExecCap; 185 uint m_uMaxGuestCPUExecCap; 181 186 182 /* Variable: Boot stuff: */187 /* Variable: Boot-table stuff: */ 183 188 QList<KDeviceType> m_possibleBootItems; 184 189
Note:
See TracChangeset
for help on using the changeset viewer.