Changeset 46479 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 10, 2013 4:48:17 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86322
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r46477 r46479 140 140 141 141 /* Load Video data to page: */ 142 m_p SliderVideoScreenCount->setValue(displayData.m_cGuestScreenCount);142 m_pEditorVideoScreenCount->setValue(displayData.m_cGuestScreenCount); 143 143 m_pCheckbox3D->setChecked(displayData.m_f3dAccelerationEnabled); 144 144 #ifdef VBOX_WITH_VIDEOHWACCEL 145 145 m_pCheckbox2DVideo->setChecked(displayData.m_f2dAccelerationEnabled); 146 146 #endif /* VBOX_WITH_VIDEOHWACCEL */ 147 checkVRAMRequirements();148 m_p SliderVideoMemorySize->setValue(displayData.m_iCurrentVRAM);147 /* Should be the last one from this tab: */ 148 m_pEditorVideoMemorySize->setValue(displayData.m_iCurrentVRAM); 149 149 150 150 /* If Remote Display server is supported: */ … … 184 184 185 185 /* Gather Video data from page: */ 186 displayData.m_iCurrentVRAM = m_p SliderVideoMemorySize->value();187 displayData.m_cGuestScreenCount = m_p SliderVideoScreenCount->value();186 displayData.m_iCurrentVRAM = m_pEditorVideoMemorySize->value(); 187 displayData.m_cGuestScreenCount = m_pEditorVideoScreenCount->value(); 188 188 displayData.m_f3dAccelerationEnabled = m_pCheckbox3D->isChecked(); 189 189 #ifdef VBOX_WITH_VIDEOHWACCEL … … 300 300 if (shouldWeWarnAboutLowVideoMemory() && !m_guestOSType.isNull()) 301 301 { 302 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), m_p SliderVideoScreenCount->value());302 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), m_pEditorVideoScreenCount->value()); 303 303 304 304 /* Basic video RAM amount test: */ 305 if ((quint64)m_p SliderVideoMemorySize->value() * _1M < uNeedBytes)305 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes) 306 306 { 307 307 strWarning = tr("you have assigned less than <b>%1</b> of video memory which is " … … 316 316 { 317 317 uNeedBytes += VBoxGlobal::required2DOffscreenVideoMemory(); 318 if ((quint64)m_p SliderVideoMemorySize->value() * _1M < uNeedBytes)318 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes) 319 319 { 320 320 strWarning = tr("you have assigned less than <b>%1</b> of video memory which is " … … 329 329 if (m_pCheckbox3D->isChecked() && m_fWddmModeSupported) 330 330 { 331 int cGuestScreenCount = m_p SliderVideoScreenCount->value();331 int cGuestScreenCount = m_pEditorVideoScreenCount->value(); 332 332 uNeedBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), cGuestScreenCount); 333 333 uNeedBytes = qMax(uNeedBytes, 128 * _1M); … … 403 403 m_pLabelVideoMemorySizeMax->setText(tr("<qt>%1 MB</qt>").arg(m_iMaxVRAMVisible)); 404 404 m_pLabelVideoScreenCountMin->setText(tr("<qt>%1</qt>").arg(1)); 405 m_pLabelVideoScreenCountMax->setText(tr("<qt>%1</qt>").arg( sys.GetMaxGuestMonitors()));405 m_pLabelVideoScreenCountMax->setText(tr("<qt>%1</qt>").arg(qMin(sys.GetMaxGuestMonitors(), (ULONG)8))); 406 406 407 407 /* Remote Display stuff: */ … … 444 444 } 445 445 446 void UIMachineSettingsDisplay::sltValueChangedVRAM(int iValue) 447 { 448 m_pEditorVideoMemorySize->setText(QString::number(iValue)); 449 } 450 451 void UIMachineSettingsDisplay::sltTextChangedVRAM(const QString &strText) 452 { 453 m_pSliderVideoMemorySize->setValue(strText.toInt()); 454 } 455 456 void UIMachineSettingsDisplay::sltValueChangedScreens(int iValue) 457 { 458 m_pEditorVideoScreenCount->setText(QString::number(iValue)); 446 void UIMachineSettingsDisplay::sltHandleVideoMemorySizeSliderChange() 447 { 448 /* Apply proposed memory-size: */ 449 m_pEditorVideoMemorySize->blockSignals(true); 450 m_pEditorVideoMemorySize->setValue(m_pSliderVideoMemorySize->value()); 451 m_pEditorVideoMemorySize->blockSignals(false); 452 453 /* Revalidate if possible: */ 454 if (m_pValidator) 455 m_pValidator->revalidate(); 456 } 457 458 void UIMachineSettingsDisplay::sltHandleVideoMemorySizeEditorChange() 459 { 460 /* Apply proposed memory-size: */ 461 m_pSliderVideoMemorySize->blockSignals(true); 462 m_pSliderVideoMemorySize->setValue(m_pEditorVideoMemorySize->value()); 463 m_pSliderVideoMemorySize->blockSignals(false); 464 465 /* Revalidate if possible: */ 466 if (m_pValidator) 467 m_pValidator->revalidate(); 468 } 469 470 void UIMachineSettingsDisplay::sltHandleVideoScreenCountSliderChange() 471 { 472 /* Apply proposed screen-count: */ 473 m_pEditorVideoScreenCount->blockSignals(true); 474 m_pEditorVideoScreenCount->setValue(m_pSliderVideoScreenCount->value()); 475 m_pEditorVideoScreenCount->blockSignals(false); 476 477 /* Update Video RAM requirements: */ 459 478 checkVRAMRequirements(); 460 } 461 462 void UIMachineSettingsDisplay::sltTextChangedScreens(const QString &strText) 463 { 464 m_pSliderVideoScreenCount->setValue(strText.toInt()); 479 480 /* Revalidate if possible: */ 481 if (m_pValidator) 482 m_pValidator->revalidate(); 483 } 484 485 void UIMachineSettingsDisplay::sltHandleVideoScreenCountEditorChange() 486 { 487 /* Apply proposed screen-count: */ 488 m_pSliderVideoScreenCount->blockSignals(true); 489 m_pSliderVideoScreenCount->setValue(m_pEditorVideoScreenCount->value()); 490 m_pSliderVideoScreenCount->blockSignals(false); 491 492 /* Update Video RAM requirements: */ 493 checkVRAMRequirements(); 494 495 /* Revalidate if possible: */ 496 if (m_pValidator) 497 m_pValidator->revalidate(); 465 498 } 466 499 … … 564 597 const uint cHostScreens = QApplication::desktop()->numScreens(); 565 598 #endif /* !(QT_VERSION >= 0x040600) */ 566 const uint cMinGuestScreens = 1; 567 const uint cMaxGuestScreens = sys.GetMaxGuestMonitors(); 568 569 /* Setup validators: */ 570 m_pEditorVideoMemorySize->setValidator(new QIntValidator(m_iMinVRAM, m_iMaxVRAMVisible, this)); 571 m_pEditorVideoScreenCount->setValidator(new QIntValidator(cMinGuestScreens, cMaxGuestScreens, this)); 572 573 /* Setup connections: */ 574 connect(m_pSliderVideoMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedVRAM(int))); 575 connect(m_pEditorVideoMemorySize, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedVRAM(const QString&))); 576 connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedScreens(int))); 577 connect(m_pEditorVideoScreenCount, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedScreens(const QString&))); 578 579 /* Setup widgets: */ 599 m_pSliderVideoMemorySize->setMinimum(m_iMinVRAM); 600 m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 580 601 m_pSliderVideoMemorySize->setPageStep(calcPageStep(m_iMaxVRAMVisible)); 581 602 m_pSliderVideoMemorySize->setSingleStep(m_pSliderVideoMemorySize->pageStep() / 4); 582 603 m_pSliderVideoMemorySize->setTickInterval(m_pSliderVideoMemorySize->pageStep()); 604 m_pSliderVideoMemorySize->setSnappingEnabled(true); 605 m_pSliderVideoMemorySize->setErrorHint(0, 1); 606 connect(m_pSliderVideoMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoMemorySizeSliderChange())); 607 608 /* Prepare memory-size editor: */ 609 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoMemorySize, 4); 610 m_pEditorVideoMemorySize->setMinimum(m_iMinVRAM); 611 m_pEditorVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 612 connect(m_pEditorVideoMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoMemorySizeEditorChange())); 613 614 /* Prepare screen-count slider: */ 615 const uint cMinGuestScreens = 1; 616 const uint cMaxGuestScreens = sys.GetMaxGuestMonitors(); 617 const uint cMaxGuestScreensForSlider = qMin(cMaxGuestScreens, (uint)8); 618 m_pSliderVideoScreenCount->setMinimum(cMinGuestScreens); 619 m_pSliderVideoScreenCount->setMaximum(cMaxGuestScreensForSlider); 583 620 m_pSliderVideoScreenCount->setPageStep(1); 584 621 m_pSliderVideoScreenCount->setSingleStep(1); 585 622 m_pSliderVideoScreenCount->setTickInterval(1); 586 587 /* Setup the scale so that ticks are at page step boundaries: */588 m_pSliderVideoMemorySize->setMinimum((m_iMinVRAM / m_pSliderVideoMemorySize->pageStep()) * m_pSliderVideoMemorySize->pageStep());589 m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible);590 m_pSliderVideoMemorySize->setSnappingEnabled(true);591 m_pSliderVideoMemorySize->setErrorHint(0, 1);592 m_pSliderVideoScreenCount->setMinimum(cMinGuestScreens);593 m_pSliderVideoScreenCount->setMaximum(cMaxGuestScreens);594 m_pSliderVideoScreenCount->setErrorHint(0, cMinGuestScreens);595 623 m_pSliderVideoScreenCount->setOptimalHint(cMinGuestScreens, cHostScreens); 596 m_pSliderVideoScreenCount->setWarningHint(cHostScreens, cMaxGuestScreens); 597 598 /* Limit min/max. size of QLineEdit: */ 599 m_pEditorVideoMemorySize->setFixedWidthByText(QString().fill('8', 4)); 600 m_pEditorVideoScreenCount->setFixedWidthByText(QString().fill('8', 4)); 601 602 /* Ensure value and validation is updated: */ 603 sltValueChangedVRAM(m_pSliderVideoMemorySize->value()); 604 sltValueChangedScreens(m_pSliderVideoScreenCount->value()); 624 m_pSliderVideoScreenCount->setWarningHint(cHostScreens, cMaxGuestScreensForSlider); 625 connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoScreenCountSliderChange())); 626 627 /* Prepare screen-count editor: */ 628 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoScreenCount, 3); 629 m_pEditorVideoScreenCount->setMinimum(1); 630 m_pEditorVideoScreenCount->setMaximum(cMaxGuestScreens); 631 connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoScreenCountEditorChange())); 605 632 606 633 #ifndef VBOX_WITH_VIDEOHWACCEL … … 699 726 700 727 /* Get monitors count and base video memory requirements: */ 701 int cGuestScreenCount = m_p SliderVideoScreenCount->value();728 int cGuestScreenCount = m_pEditorVideoScreenCount->value(); 702 729 quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), cGuestScreenCount) / _1M; 703 730 704 /* Initial value s: */731 /* Initial value: */ 705 732 m_iMaxVRAMVisible = cGuestScreenCount * 32; 706 if (m_iMaxVRAMVisible < 128) 733 734 /* No more than m_iMaxVRAM: */ 735 if (m_iMaxVRAMVisible > m_iMaxVRAM) 736 m_iMaxVRAMVisible = m_iMaxVRAM; 737 738 /* No less than 128MB (if possible): */ 739 if (m_iMaxVRAMVisible < 128 && m_iMaxVRAM >= 128) 707 740 m_iMaxVRAMVisible = 128; 741 742 /* No less than initial VRAM size (wtf?): */ 708 743 if (m_iMaxVRAMVisible < m_iInitialVRAM) 709 744 m_iMaxVRAMVisible = m_iInitialVRAM; … … 715 750 } 716 751 #endif /* VBOX_WITH_VIDEOHWACCEL */ 752 717 753 #ifdef VBOX_WITH_CRHGSMI 718 754 if (m_pCheckbox3D->isChecked() && m_fWddmModeSupported) … … 723 759 uNeedMBytes = qMin(uNeedMBytes, 256); 724 760 # endif 725 m_iMaxVRAMVisible = 256; 761 /* No less than 256MB (if possible): */ 762 if (m_iMaxVRAMVisible < 256 && m_iMaxVRAM >= 256) 763 m_iMaxVRAMVisible = 256; 726 764 } 727 765 #endif /* VBOX_WITH_CRHGSMI */ 728 766 729 m_pSliderVideoMemorySize->setWarningHint(1, uNeedMBytes); 767 m_pEditorVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 768 m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 730 769 m_pSliderVideoMemorySize->setPageStep(calcPageStep(m_iMaxVRAMVisible)); 731 m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 732 m_pSliderVideoMemorySize->setOptimalHint(uNeedMBytes, m_iMaxVRAMVisible); 733 m_pEditorVideoMemorySize->setValidator(new QIntValidator(m_iMinVRAM, m_iMaxVRAMVisible, this)); 770 m_pSliderVideoMemorySize->setWarningHint(1, qMin((int)uNeedMBytes, m_iMaxVRAMVisible)); 771 m_pSliderVideoMemorySize->setOptimalHint(qMin((int)uNeedMBytes, m_iMaxVRAMVisible), m_iMaxVRAMVisible); 734 772 m_pLabelVideoMemorySizeMax->setText(tr("<qt>%1 MB</qt>").arg(m_iMaxVRAMVisible)); 735 773 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r46477 r46479 161 161 162 162 /* Handlers: Video stuff: */ 163 void slt ValueChangedVRAM(int iValue);164 void slt TextChangedVRAM(const QString &strText);165 void slt ValueChangedScreens(int iValue);166 void slt TextChangedScreens(const QString &strText);163 void sltHandleVideoMemorySizeSliderChange(); 164 void sltHandleVideoMemorySizeEditorChange(); 165 void sltHandleVideoScreenCountSliderChange(); 166 void sltHandleVideoScreenCountEditorChange(); 167 167 168 168 /* Handlers: Video Capture stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui
r46476 r46479 87 87 </item> 88 88 <item row="0" column="2"> 89 <widget class="QILineEdit" name="m_pEditorVideoMemorySize"> 90 <property name="sizePolicy"> 91 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 92 <horstretch>0</horstretch> 93 <verstretch>0</verstretch> 94 </sizepolicy> 95 </property> 89 <widget class="QSpinBox" name="m_pEditorVideoMemorySize"> 96 90 <property name="whatsThis"> 97 91 <string>Controls the amount of video memory provided to the virtual machine.</string> … … 159 153 </item> 160 154 <item row="2" column="2"> 161 <widget class="QILineEdit" name="m_pEditorVideoScreenCount"> 162 <property name="sizePolicy"> 163 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 164 <horstretch>0</horstretch> 165 <verstretch>0</verstretch> 166 </sizepolicy> 167 </property> 155 <widget class="QSpinBox" name="m_pEditorVideoScreenCount"> 168 156 <property name="whatsThis"> 169 157 <string>Controls the amount of virtual monitors provided to the virtual machine.</string> … … 647 635 </widget> 648 636 <customwidgets> 649 <customwidget>650 <class>QILineEdit</class>651 <extends>QLineEdit</extends>652 <header>QILineEdit.h</header>653 </customwidget>654 637 <customwidget> 655 638 <class>QIAdvancedSlider</class>
Note:
See TracChangeset
for help on using the changeset viewer.