- Timestamp:
- Jul 1, 2009 2:53:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp
r21027 r21130 24 24 #include "VBoxVMSettingsSystem.h" 25 25 26 #include <iprt/cdefs.h> 27 26 28 #define ITEM_TYPE_ROLE Qt::UserRole + 1 27 29 … … 53 55 /* Setup constants */ 54 56 CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties(); 55 const uint MinRAM = sys.GetMinGuestRAM();56 const uint MaxRAM = sys.GetMaxGuestRAM();57 const uint MinCPU = sys.GetMinGuestCPUCount();58 const uint MaxCPU = sys.GetMaxGuestCPUCount();57 mMinGuestRAM = sys.GetMinGuestRAM(); 58 mMaxGuestRAM = RT_MIN (RT_ALIGN (vboxGlobal().virtualBox().GetHost().GetMemorySize(), _1G / _1M), sys.GetMaxGuestRAM()); 59 mMinGuestCPU = sys.GetMinGuestCPUCount(); 60 mMaxGuestCPU = RT_MIN (2 * vboxGlobal().virtualBox().GetHost().GetProcessorCount(), sys.GetMaxGuestCPUCount()); 59 61 60 62 /* Setup validators */ 61 mLeMemory->setValidator (new QIntValidator ( MinRAM, MaxRAM, this));62 mLeCPU->setValidator (new QIntValidator ( MinCPU, MaxCPU, this));63 mLeMemory->setValidator (new QIntValidator (mMinGuestRAM, mMaxGuestRAM, this)); 64 mLeCPU->setValidator (new QIntValidator (mMinGuestCPU, mMaxGuestCPU, this)); 63 65 64 66 /* Setup connections */ … … 95 97 96 98 /* Setup memory slider */ 97 mSlMemory->setPageStep (calcPageStep ( MaxRAM));99 mSlMemory->setPageStep (calcPageStep (mMaxGuestRAM)); 98 100 mSlMemory->setSingleStep (mSlMemory->pageStep() / 4); 99 101 mSlMemory->setTickInterval (mSlMemory->pageStep()); 100 102 /* Setup the scale so that ticks are at page step boundaries */ 101 mSlMemory->setMinimum (( MinRAM / mSlMemory->pageStep()) * mSlMemory->pageStep());102 mSlMemory->setMaximum ( MaxRAM);103 mSlMemory->setMinimum ((mMinGuestRAM / mSlMemory->pageStep()) * mSlMemory->pageStep()); 104 mSlMemory->setMaximum (mMaxGuestRAM); 103 105 /* Limit min/max. size of QLineEdit */ 104 106 mLeMemory->setFixedWidthByText (QString().fill ('8', 5)); … … 111 113 mSlCPU->setTickInterval (1); 112 114 /* Setup the scale so that ticks are at page step boundaries */ 113 mSlCPU->setMinimum ( MinCPU);114 mSlCPU->setMaximum ( MaxCPU);115 mSlCPU->setMinimum (mMinGuestCPU); 116 mSlCPU->setMaximum (mMaxGuestCPU); 115 117 /* Limit min/max. size of QLineEdit */ 116 118 mLeCPU->setFixedWidthByText (QString().fill ('8', 3)); … … 455 457 456 458 /* Retranslate the memory slider legend */ 457 mLbMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg ( sys.GetMinGuestRAM()));458 mLbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg ( sys.GetMaxGuestRAM()));459 mLbMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg (mMinGuestRAM)); 460 mLbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg (mMaxGuestRAM)); 459 461 460 462 /* Retranslate the cpu slider legend */ 461 mLbCPUMin->setText (tr ("<qt>%1 CPU</qt>", "%1 is 1 for now").arg ( sys.GetMinGuestCPUCount()));462 mLbCPUMax->setText (tr ("<qt>%1 CPUs</qt>", "%1 is 32 for now").arg (sys.GetMaxGuestCPUCount()));463 mLbCPUMin->setText (tr ("<qt>%1 CPU</qt>", "%1 is 1 for now").arg (mMinGuestCPU)); 464 mLbCPUMax->setText (tr ("<qt>%1 CPUs</qt>", "%1 is host cpu count * 2 for now").arg (mMaxGuestCPU)); 463 465 } 464 466
Note:
See TracChangeset
for help on using the changeset viewer.