Changeset 28178 in vbox
- Timestamp:
- Apr 12, 2010 8:20:25 AM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/vm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.cpp
r27957 r28178 56 56 m_minVRAM = sys.GetMinGuestVRAM(); 57 57 m_maxVRAM = sys.GetMaxGuestVRAM(); 58 m_maxVRAMVisible = m_maxVRAM; 58 59 const uint MinMonitors = 1; 59 60 const uint MaxMonitors = sys.GetMaxGuestMonitors(); 60 61 61 62 /* Setup validators */ 62 mLeMemory->setValidator (new QIntValidator (m_minVRAM, m_maxVRAM , this));63 mLeMemory->setValidator (new QIntValidator (m_minVRAM, m_maxVRAMVisible, this)); 63 64 mLeMonitors->setValidator (new QIntValidator (MinMonitors, MaxMonitors, this)); 64 65 mLeVRDPPort->setValidator (new QRegExpValidator (QRegExp ("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this)); … … 72 73 73 74 /* Setup initial values */ 74 mSlMemory->setPageStep (calcPageStep (m_maxVRAM ));75 mSlMemory->setPageStep (calcPageStep (m_maxVRAMVisible)); 75 76 mSlMemory->setSingleStep (mSlMemory->pageStep() / 4); 76 77 mSlMemory->setTickInterval (mSlMemory->pageStep()); … … 80 81 /* Setup the scale so that ticks are at page step boundaries */ 81 82 mSlMemory->setMinimum ((m_minVRAM / mSlMemory->pageStep()) * mSlMemory->pageStep()); 82 mSlMemory->setMaximum (m_maxVRAM );83 mSlMemory->setMaximum (m_maxVRAMVisible); 83 84 mSlMemory->setSnappingEnabled (true); 84 85 quint64 needMBytes = VBoxGlobal::requiredVideoMemory (&mMachine) / _1M; 85 86 mSlMemory->setErrorHint (0, 1); 86 87 mSlMemory->setWarningHint (1, needMBytes); 87 mSlMemory->setOptimalHint (needMBytes, m_maxVRAM );88 mSlMemory->setOptimalHint (needMBytes, m_maxVRAMVisible); 88 89 mSlMonitors->setMinimum (MinMonitors); 89 90 mSlMonitors->setMaximum (MaxMonitors); … … 123 124 mMachine = aMachine; 124 125 126 int currentSize = mMachine.GetVRAMSize(); 127 m_initialVRAM = RT_MIN(currentSize, m_maxVRAM); 128 129 /* must come _before_ setting the initial memory value */ 130 checkMultiMonitorReqs(); 131 125 132 /* Memory Size */ 126 mSlMemory->setValue ( mMachine.GetVRAMSize());133 mSlMemory->setValue (currentSize); 127 134 128 135 /* Monitors Count */ … … 155 162 mTwDisplay->setTabEnabled (1, false); 156 163 } 157 158 checkMultiMonitorReqs();159 164 } 160 165 … … 262 267 263 268 CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties(); 264 mLbMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg ( sys.GetMinGuestVRAM()));265 mLbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg ( sys.GetMaxGuestVRAM()));269 mLbMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg (m_minVRAM)); 270 mLbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg (m_maxVRAMVisible)); 266 271 mLbMonitorsMin->setText (tr ("<qt>%1</qt>").arg (1)); 267 272 mLbMonitorsMax->setText (tr ("<qt>%1</qt>").arg (sys.GetMaxGuestMonitors())); … … 316 321 /* The memory requirements have changed too. */ 317 322 quint64 needMBytes = VBoxGlobal::requiredVideoMemory (&mMachine, cVal) / _1M; 323 /* Limit the maximum memory to save careless users from setting useless big values */ 324 m_maxVRAMVisible = 128 + (cVal - 1) * 32; 325 if (m_maxVRAMVisible < m_initialVRAM) 326 m_maxVRAMVisible = m_initialVRAM; 318 327 mSlMemory->setWarningHint (1, needMBytes); 319 mSlMemory->setOptimalHint (needMBytes, m_maxVRAM); 320 } 321 328 mSlMemory->setPageStep (calcPageStep (m_maxVRAMVisible)); 329 mSlMemory->setMaximum (m_maxVRAMVisible); 330 mSlMemory->setOptimalHint (needMBytes, m_maxVRAMVisible); 331 mLeMemory->setValidator (new QIntValidator (m_minVRAM, m_maxVRAMVisible, this)); 332 mLbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg (m_maxVRAMVisible)); 333 /* ... or just call retranslateUi()? */ 334 } 335 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.h
r27413 r28178 67 67 QIWidgetValidator *mValidator; 68 68 69 /* System minimum lower limit of VRAM (MB). */ 69 70 int m_minVRAM; 71 /* System maximum limit of VRAM (MB). */ 70 72 int m_maxVRAM; 73 /* Upper limit of VRAM in MB for this dialog. This value is lower than 74 * m_maxVRAM to save careless users from setting useless big values. */ 75 int m_maxVRAMVisible; 76 /* Initial VRAM value when the dialog is opened. */ 77 int m_initialVRAM; 71 78 }; 72 79
Note:
See TracChangeset
for help on using the changeset viewer.