VirtualBox

Changeset 21130 in vbox for trunk


Ignore:
Timestamp:
Jul 1, 2009 2:53:57 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: Changed max values for the guest memory/VCPUs based on the host.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp

    r21027 r21130  
    2424#include "VBoxVMSettingsSystem.h"
    2525
     26#include <iprt/cdefs.h>
     27
    2628#define ITEM_TYPE_ROLE Qt::UserRole + 1
    2729
     
    5355    /* Setup constants */
    5456    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());
    5961
    6062    /* 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));
    6365
    6466    /* Setup connections */
     
    9597
    9698    /* Setup memory slider */
    97     mSlMemory->setPageStep (calcPageStep (MaxRAM));
     99    mSlMemory->setPageStep (calcPageStep (mMaxGuestRAM));
    98100    mSlMemory->setSingleStep (mSlMemory->pageStep() / 4);
    99101    mSlMemory->setTickInterval (mSlMemory->pageStep());
    100102    /* 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);
    103105    /* Limit min/max. size of QLineEdit */
    104106    mLeMemory->setFixedWidthByText (QString().fill ('8', 5));
     
    111113    mSlCPU->setTickInterval (1);
    112114    /* 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);
    115117    /* Limit min/max. size of QLineEdit */
    116118    mLeCPU->setFixedWidthByText (QString().fill ('8', 3));
     
    455457
    456458    /* Retranslate the memory slider legend */
    457     mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (sys.GetMinGuestRAM()));
    458     mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (sys.GetMaxGuestRAM()));
     459    mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mMinGuestRAM));
     460    mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mMaxGuestRAM));
    459461
    460462    /* Retranslate the cpu slider legend */
    461     mLbCPUMin->setText (tr ("<qt>%1&nbsp;CPU</qt>", "%1 is 1 for now").arg (sys.GetMinGuestCPUCount()));
    462     mLbCPUMax->setText (tr ("<qt>%1&nbsp;CPUs</qt>", "%1 is 32 for now").arg (sys.GetMaxGuestCPUCount()));
     463    mLbCPUMin->setText (tr ("<qt>%1&nbsp;CPU</qt>", "%1 is 1 for now").arg (mMinGuestCPU));
     464    mLbCPUMax->setText (tr ("<qt>%1&nbsp;CPUs</qt>", "%1 is host cpu count * 2 for now").arg (mMaxGuestCPU));
    463465}
    464466
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette