VirtualBox

Changeset 47274 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 19, 2013 5:42:33 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Machine settings: System page: Cleanup/rework (part 9): Replace line-editors with spin-boxes.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r47270 r47274  
    9090    }
    9191
    92     /* Setup validators: */
    93     m_pEditorMemorySize->setValidator(new QIntValidator(m_pSliderMemorySize->minRAM(), m_pSliderMemorySize->maxRAM(), this));
    94     m_pEditorCPUCount->setValidator(new QIntValidator(m_uMinGuestCPU, m_uMaxGuestCPU, this));
    95     m_pEditorCPUExecCap->setValidator(new QIntValidator(m_uMinGuestCPUExecCap, m_uMaxGuestCPUExecCap, this));
    96 
    97     /* Setup RAM connections: */
    98     connect(m_pSliderMemorySize, SIGNAL(valueChanged(int)), this, SLOT(valueChangedRAM(int)));
    99     connect(m_pEditorMemorySize, SIGNAL(textChanged(const QString&)), this, SLOT(textChangedRAM(const QString&)));
     92    /* Pre-configure memory-size editor: */
     93    m_pEditorMemorySize->setMinimum(m_pSliderMemorySize->minRAM());
     94    m_pEditorMemorySize->setMaximum(m_pSliderMemorySize->maxRAM());
     95    vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorMemorySize, 5);
     96
     97    /* Pre-configure CPU-count editor: */
     98    m_pEditorCPUCount->setMinimum(m_uMinGuestCPU);
     99    m_pEditorCPUCount->setMaximum(m_uMaxGuestCPU);
     100    vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUCount, 4);
     101
     102    /* Pre-configure CPU-execution-cap editor: */
     103    m_pEditorCPUExecCap->setMinimum(m_uMinGuestCPUExecCap);
     104    m_pEditorCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap);
     105    vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUExecCap, 4);
     106
     107    /* Setup memory-size connections: */
     108    connect(m_pSliderMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeSliderChange()));
     109    connect(m_pEditorMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeEditorChange()));
    100110
    101111    /* Setup boot-table connections: */
     
    105115
    106116    /* Setup CPU connections: */
    107     connect(m_pSliderCPUCount, SIGNAL(valueChanged(int)), this, SLOT(valueChangedCPU(int)));
    108     connect(m_pEditorCPUCount, SIGNAL(textChanged(const QString&)), this, SLOT(textChangedCPU(const QString&)));
    109     connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltValueChangedCPUExecCap(int)));
    110     connect(m_pEditorCPUExecCap, SIGNAL(textChanged(const QString&)), this, SLOT(sltTextChangedCPUExecCap(const QString&)));
     117    connect(m_pSliderCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountSliderChange()));
     118    connect(m_pEditorCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountEditorChange()));
     119    connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapSliderChange()));
     120    connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange()));
    111121
    112122    /* Setup boot-table iconsets: */
     
    119129    m_pLayoutBootOrder->setSpacing (3);
    120130#endif /* Q_WS_MAC */
    121 
    122     /* Limit min/max size of QLineEdit: */
    123     m_pEditorMemorySize->setFixedWidthByText(QString().fill('8', 5));
    124     /* Ensure m_pEditorMemorySize value and validation is updated: */
    125     valueChangedRAM(m_pSliderMemorySize->value());
    126131
    127132    /* Setup cpu slider: */
     
    134139    m_pSliderCPUCount->setOptimalHint(1, hostCPUs);
    135140    m_pSliderCPUCount->setWarningHint(hostCPUs, m_uMaxGuestCPU);
    136     /* Limit min/max. size of QLineEdit: */
    137     m_pEditorCPUCount->setFixedWidthByText(QString().fill('8', 4));
    138     /* Ensure m_pEditorMemorySize value and validation is updated: */
    139     valueChangedCPU(m_pSliderCPUCount->value());
    140141
    141142    /* Setup cpu cap slider: */
     
    148149    m_pSliderCPUExecCap->setWarningHint(m_uMinGuestCPUExecCap, m_uMedGuestCPUExecCap);
    149150    m_pSliderCPUExecCap->setOptimalHint(m_uMedGuestCPUExecCap, m_uMaxGuestCPUExecCap);
    150     /* Limit min/max. size of QLineEdit: */
    151     m_pEditorCPUExecCap->setFixedWidthByText(QString().fill('8', 4));
    152     /* Ensure m_pEditorMemorySize value and validation is updated: */
    153     sltValueChangedCPUExecCap(m_pSliderCPUExecCap->value());
    154151
    155152    /* Configure 'pointing HID type' combo: */
     
    205202
    206203    /* Load motherboard data: */
    207     systemData.m_iRAMSize = m_machine.GetMemorySize();
     204    systemData.m_iMemorySize = m_machine.GetMemorySize();
    208205    /* Load boot-items of current VM: */
    209206    QList<KDeviceType> usedBootItems;
     
    268265
    269266    /* Load motherboard data to page: */
    270     m_pSliderMemorySize->setValue(systemData.m_iRAMSize);
     267    m_pSliderMemorySize->setValue(systemData.m_iMemorySize);
    271268    /* Remove any old data in the boot view: */
    272269    QAbstractItemView *iv = qobject_cast <QAbstractItemView*> (mTwBootOrder);
     
    314311
    315312    /* Gather motherboard data: */
    316     systemData.m_iRAMSize = m_pSliderMemorySize->value();
     313    systemData.m_iMemorySize = m_pSliderMemorySize->value();
    317314    /* Gather boot-table data: */
    318315    systemData.m_bootItems.clear();
     
    363360        {
    364361            /* Motherboard tab: */
    365             m_machine.SetMemorySize(systemData.m_iRAMSize);
     362            m_machine.SetMemorySize(systemData.m_iMemorySize);
    366363            /* Save boot-items of current VM: */
    367364            int iBootIndex = 0;
     
    567564}
    568565
    569 void UIMachineSettingsSystem::valueChangedRAM(int iValue)
    570 {
    571     m_pEditorMemorySize->setText(QString::number(iValue));
    572 }
    573 
    574 void UIMachineSettingsSystem::textChangedRAM(const QString &strText)
    575 {
    576     m_pSliderMemorySize->setValue(strText.toInt());
     566void UIMachineSettingsSystem::sltHandleMemorySizeSliderChange()
     567{
     568    /* Apply new memory-size value: */
     569    m_pEditorMemorySize->blockSignals(true);
     570    m_pEditorMemorySize->setValue(m_pSliderMemorySize->value());
     571    m_pEditorMemorySize->blockSignals(false);
     572
     573    /* Revalidate if possible: */
     574    if (m_pValidator)
     575        m_pValidator->revalidate();
     576}
     577
     578void UIMachineSettingsSystem::sltHandleMemorySizeEditorChange()
     579{
     580    /* Apply new memory-size value: */
     581    m_pSliderMemorySize->blockSignals(true);
     582    m_pSliderMemorySize->setValue(m_pEditorMemorySize->value());
     583    m_pSliderMemorySize->blockSignals(false);
     584
     585    /* Revalidate if possible: */
     586    if (m_pValidator)
     587        m_pValidator->revalidate();
    577588}
    578589
     
    644655}
    645656
    646 void UIMachineSettingsSystem::valueChangedCPU(int iValue)
    647 {
    648     m_pEditorCPUCount->setText(QString::number(iValue));
    649 }
    650 
    651 void UIMachineSettingsSystem::textChangedCPU(const QString &strText)
    652 {
    653     m_pSliderCPUCount->setValue(strText.toInt());
    654 }
    655 
    656 void UIMachineSettingsSystem::sltValueChangedCPUExecCap(int iValue)
    657 {
    658     m_pEditorCPUExecCap->setText(QString::number(iValue));
    659 }
    660 
    661 void UIMachineSettingsSystem::sltTextChangedCPUExecCap(const QString &strText)
    662 {
    663     m_pSliderCPUExecCap->setValue(strText.toInt());
     657void UIMachineSettingsSystem::sltHandleCPUCountSliderChange()
     658{
     659    /* Apply new memory-size value: */
     660    m_pEditorCPUCount->blockSignals(true);
     661    m_pEditorCPUCount->setValue(m_pSliderCPUCount->value());
     662    m_pEditorCPUCount->blockSignals(false);
     663
     664    /* Revalidate if possible: */
     665    if (m_pValidator)
     666        m_pValidator->revalidate();
     667}
     668
     669void UIMachineSettingsSystem::sltHandleCPUCountEditorChange()
     670{
     671    /* Apply new memory-size value: */
     672    m_pSliderCPUCount->blockSignals(true);
     673    m_pSliderCPUCount->setValue(m_pEditorCPUCount->value());
     674    m_pSliderCPUCount->blockSignals(false);
     675
     676    /* Revalidate if possible: */
     677    if (m_pValidator)
     678        m_pValidator->revalidate();
     679}
     680
     681void UIMachineSettingsSystem::sltHandleCPUExecCapSliderChange()
     682{
     683    /* Apply new memory-size value: */
     684    m_pEditorCPUExecCap->blockSignals(true);
     685    m_pEditorCPUExecCap->setValue(m_pSliderCPUExecCap->value());
     686    m_pEditorCPUExecCap->blockSignals(false);
     687
     688    /* Revalidate if possible: */
     689    if (m_pValidator)
     690        m_pValidator->revalidate();
     691}
     692
     693void UIMachineSettingsSystem::sltHandleCPUExecCapEditorChange()
     694{
     695    /* Apply new memory-size value: */
     696    m_pSliderCPUExecCap->blockSignals(true);
     697    m_pSliderCPUExecCap->setValue(m_pEditorCPUExecCap->value());
     698    m_pSliderCPUExecCap->blockSignals(false);
     699
     700    /* Revalidate if possible: */
     701    if (m_pValidator)
     702        m_pValidator->revalidate();
    664703}
    665704
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r47269 r47274  
    5151        , m_fSupportedHwVirtEx(false)
    5252        /* Motherboard data: */
    53         , m_iRAMSize(-1)
     53        , m_iMemorySize(-1)
    5454        , m_bootItems(QList<UIBootItemData>())
    5555        , m_chipsetType(KChipsetType_Null)
     
    7474               (m_fSupportedHwVirtEx == other.m_fSupportedHwVirtEx) &&
    7575               /* Motherboard data: */
    76                (m_iRAMSize == other.m_iRAMSize) &&
     76               (m_iMemorySize == other.m_iMemorySize) &&
    7777               (m_bootItems == other.m_bootItems) &&
    7878               (m_chipsetType == other.m_chipsetType) &&
     
    9999
    100100    /* Variables: Motherboard data: */
    101     int m_iRAMSize;
     101    int m_iMemorySize;
    102102    QList<UIBootItemData> m_bootItems;
    103103    KChipsetType m_chipsetType;
     
    164164private slots:
    165165
    166     /* Handlers: RAM stuff: */
    167     void valueChangedRAM(int iValue);
    168     void textChangedRAM(const QString &strText);
     166    /* Handlers: Memory-size stuff: */
     167    void sltHandleMemorySizeSliderChange();
     168    void sltHandleMemorySizeEditorChange();
    169169
    170170    /* Handler: Boot-table stuff: */
     
    172172
    173173    /* Handlers: CPU stuff: */
    174     void valueChangedCPU(int iValue);
    175     void textChangedCPU(const QString &strText);
    176     void sltValueChangedCPUExecCap(int iValue);
    177     void sltTextChangedCPUExecCap(const QString &strText);
     174    void sltHandleCPUCountSliderChange();
     175    void sltHandleCPUCountEditorChange();
     176    void sltHandleCPUExecCapSliderChange();
     177    void sltHandleCPUExecCapEditorChange();
    178178
    179179private:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui

    r47272 r47274  
    33 VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
    44
    5  Copyright (C) 2008-2012 Oracle Corporation
     5 Copyright (C) 2008-2013 Oracle Corporation
    66
    77 This file is part of VirtualBox Open Source Edition (OSE), as
     
    9090        <layout class="QHBoxLayout">
    9191         <item>
    92           <widget class="QILineEdit" name="m_pEditorMemorySize">
    93            <property name="sizePolicy">
    94             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
    95              <horstretch>0</horstretch>
    96              <verstretch>0</verstretch>
    97             </sizepolicy>
    98            </property>
     92          <widget class="QSpinBox" name="m_pEditorMemorySize">
    9993           <property name="whatsThis">
    10094            <string>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</string>
     
    448442       </item>
    449443       <item row="0" column="2">
    450         <widget class="QILineEdit" name="m_pEditorCPUCount">
    451          <property name="sizePolicy">
    452           <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
    453            <horstretch>0</horstretch>
    454            <verstretch>0</verstretch>
    455           </sizepolicy>
    456          </property>
     444        <widget class="QSpinBox" name="m_pEditorCPUCount">
    457445         <property name="whatsThis">
    458446          <string>Controls the number of virtual CPUs in the virtual machine. You need hardware virtualization support on your host system to use more than one virtual CPU.</string>
     
    517505       </item>
    518506       <item row="2" column="2">
    519         <widget class="QILineEdit" name="m_pEditorCPUExecCap">
    520          <property name="sizePolicy">
    521           <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
    522            <horstretch>0</horstretch>
    523            <verstretch>0</verstretch>
    524           </sizepolicy>
    525          </property>
     507        <widget class="QSpinBox" name="m_pEditorCPUExecCap">
    526508         <property name="whatsThis">
    527509          <string>Limits the amount of time that each virtual CPU is allowed to run for. Each virtual CPU will be allowed to use up to this percentage of the processing time available on one physical CPU. The execution cap can be disabled by setting it to 100%. Setting the cap too low can make the machine feel slow to respond.</string>
     
    632614   <extends>QListWidget</extends>
    633615   <header>UIBootTable.h</header>
    634   </customwidget>
    635   <customwidget>
    636    <class>QILineEdit</class>
    637    <extends>QLineEdit</extends>
    638    <header>QILineEdit.h</header>
    639616  </customwidget>
    640617  <customwidget>
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