VirtualBox

Changeset 79998 in vbox


Ignore:
Timestamp:
Jul 26, 2019 11:18:54 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7720: VM settings / System page: Replace heavily distributed across system page widgets related to base-memory editing functionality with single UIBaseMemoryEditor.

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

    r79981 r79998  
    271271
    272272    /* Load old 'Motherboard' data from the cache: */
    273     m_pSliderMemorySize->setValue(oldSystemData.m_iMemorySize);
     273    m_pBaseMemoryEditor->setValue(oldSystemData.m_iMemorySize);
    274274    m_pBootOrderEditor->setValue(oldSystemData.m_bootItems);
    275275    const int iChipsetTypePosition = m_pComboChipsetType->findData(oldSystemData.m_chipsetType);
     
    312312
    313313    /* Gather 'Motherboard' data: */
    314     newSystemData.m_iMemorySize = m_pSliderMemorySize->value();
     314    newSystemData.m_iMemorySize = m_pBaseMemoryEditor->value();
    315315    newSystemData.m_bootItems = m_pBootOrderEditor->value();
    316316    newSystemData.m_chipsetType = (KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt();
     
    371371        /* RAM amount test: */
    372372        const ulong uFullSize = uiCommon().host().GetMemorySize();
    373         if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMAlw())
     373        if (m_pBaseMemoryEditor->value() > (int)m_pBaseMemoryEditor->maxRAMAlw())
    374374        {
    375375            message.second << tr(
    376376                "More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. "
    377377                "Not enough memory is left for the host operating system. Please select a smaller amount.")
    378                 .arg((unsigned)qRound((double)m_pSliderMemorySize->maxRAMAlw() / uFullSize * 100.0))
     378                .arg((unsigned)qRound((double)m_pBaseMemoryEditor->maxRAMAlw() / uFullSize * 100.0))
    379379                .arg(uiCommon().formatSize((uint64_t)uFullSize * _1M));
    380380            fPass = false;
    381381        }
    382         else if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMOpt())
     382        else if (m_pBaseMemoryEditor->value() > (int)m_pBaseMemoryEditor->maxRAMOpt())
    383383        {
    384384            message.second << tr(
    385385                "More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. "
    386386                "There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.")
    387                 .arg((unsigned)qRound((double)m_pSliderMemorySize->maxRAMOpt() / uFullSize * 100.0))
     387                .arg((unsigned)qRound((double)m_pBaseMemoryEditor->maxRAMOpt() / uFullSize * 100.0))
    388388                .arg(uiCommon().formatSize((uint64_t)uFullSize * _1M));
    389389        }
     
    548548    /* Configure navigation for 'motherboard' tab: */
    549549    setTabOrder(pWidget, m_pTabWidgetSystem->focusProxy());
    550     setTabOrder(m_pTabWidgetSystem->focusProxy(), m_pSliderMemorySize);
    551     setTabOrder(m_pSliderMemorySize, m_pEditorMemorySize);
    552     setTabOrder(m_pEditorMemorySize, m_pBootOrderEditor);
     550    setTabOrder(m_pTabWidgetSystem->focusProxy(), m_pBaseMemoryEditor);
     551    setTabOrder(m_pBaseMemoryEditor, m_pBootOrderEditor);
    553552    setTabOrder(m_pBootOrderEditor, m_pComboChipsetType);
    554553    setTabOrder(m_pComboChipsetType, m_pComboPointingHIDType);
     
    576575    Ui::UIMachineSettingsSystem::retranslateUi(this);
    577576
    578     /* Retranslate the memory slider legend: */
    579     m_pEditorMemorySize->setSuffix(QString(" %1").arg(tr("MB")));
    580     m_pLabelMemoryMin->setText(tr("%1 MB").arg(m_pSliderMemorySize->minRAM()));
    581     m_pLabelMemoryMax->setText(tr("%1 MB").arg(m_pSliderMemorySize->maxRAM()));
    582 
    583577    /* Retranslate the cpu slider legend: */
    584578    m_pLabelCPUMin->setText(tr("%1 CPU", "%1 is 1 for now").arg(m_uMinGuestCPU));
     
    601595
    602596    /* Polish 'Motherboard' availability: */
    603     m_pLabelMemorySize->setEnabled(isMachineOffline());
    604     m_pLabelMemoryMin->setEnabled(isMachineOffline());
    605     m_pLabelMemoryMax->setEnabled(isMachineOffline());
    606     m_pSliderMemorySize->setEnabled(isMachineOffline());
    607     m_pEditorMemorySize->setEnabled(isMachineOffline());
     597    m_pBaseMemoryLabel->setEnabled(isMachineOffline());
     598    m_pBaseMemoryEditor->setEnabled(isMachineOffline());
    608599    m_pLabelBootOrder->setEnabled(isMachineOffline());
    609600    m_pBootOrderEditor->setEnabled(isMachineOffline());
     
    644635}
    645636
    646 void UIMachineSettingsSystem::sltHandleMemorySizeSliderChange()
    647 {
    648     /* Apply new memory-size value: */
    649     m_pEditorMemorySize->blockSignals(true);
    650     m_pEditorMemorySize->setValue(m_pSliderMemorySize->value());
    651     m_pEditorMemorySize->blockSignals(false);
    652 
    653     /* Revalidate: */
    654     revalidate();
    655 }
    656 
    657 void UIMachineSettingsSystem::sltHandleMemorySizeEditorChange()
    658 {
    659     /* Apply new memory-size value: */
    660     m_pSliderMemorySize->blockSignals(true);
    661     m_pSliderMemorySize->setValue(m_pEditorMemorySize->value());
    662     m_pSliderMemorySize->blockSignals(false);
    663 
    664     /* Revalidate: */
    665     revalidate();
    666 }
    667 
    668637void UIMachineSettingsSystem::sltHandleCPUCountSliderChange()
    669638{
     
    751720    /* Tab and it's layout created in the .ui file. */
    752721    {
    753         /* Memory Size editor created in the .ui file. */
    754         AssertPtrReturnVoid(m_pEditorMemorySize);
    755         {
    756             /* Configure editor: */
    757             m_pEditorMemorySize->setMinimum(m_pSliderMemorySize->minRAM());
    758             m_pEditorMemorySize->setMaximum(m_pSliderMemorySize->maxRAM());
    759             uiCommon().setMinimumWidthAccordingSymbolCount(m_pEditorMemorySize, 5);
     722        /* Base-memory label and editor created in the .ui file. */
     723        AssertPtrReturnVoid(m_pBaseMemoryLabel);
     724        AssertPtrReturnVoid(m_pBaseMemoryEditor);
     725        {
     726            /* Configure label & editor: */
     727            m_pBaseMemoryLabel->setBuddy(m_pBaseMemoryEditor->focusProxy());
    760728        }
    761729
     
    885853    connect(m_pComboChipsetType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));
    886854    connect(m_pComboPointingHIDType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));
    887     connect(m_pSliderMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeSliderChange()));
    888     connect(m_pEditorMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeEditorChange()));
     855    connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValidChanged, this, &UIMachineSettingsSystem::revalidate);
    889856    connect(m_pCheckBoxApic, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
    890857
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r79981 r79998  
    101101private slots:
    102102
    103     /** Handles memory size slider change. */
    104     void sltHandleMemorySizeSliderChange();
    105     /** Handles memory size editor change. */
    106     void sltHandleMemorySizeEditorChange();
    107 
    108103    /** Handles CPU count slider change. */
    109104    void sltHandleCPUCountSliderChange();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui

    r79978 r79998  
    2424      <layout class="QGridLayout">
    2525       <item row="0" column="0">
    26         <widget class="QLabel" name="m_pLabelMemorySize">
     26        <widget class="QLabel" name="m_pBaseMemoryLabel">
    2727         <property name="text">
    2828          <string>Base &amp;Memory:</string>
     
    3131          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    3232         </property>
    33          <property name="buddy">
    34           <cstring>m_pEditorMemorySize</cstring>
    35          </property>
    36         </widget>
    37        </item>
    38        <item row="0" column="1" rowspan="2" colspan="2">
     33        </widget>
     34       </item>
     35       <item row="0" column="1" rowspan="2" colspan="3">
    3936        <widget class="QWidget">
    4037         <property name="sizePolicy">
     
    4946          </property>
    5047          <item>
    51            <widget class="UIBaseMemorySlider" name="m_pSliderMemorySize">
     48           <widget class="UIBaseMemoryEditor" name="m_pBaseMemoryEditor">
    5249            <property name="whatsThis">
    5350             <string>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</string>
    5451            </property>
    55             <property name="orientation">
    56              <enum>Qt::Horizontal</enum>
    57             </property>
    5852           </widget>
    5953          </item>
    60           <item>
    61            <layout class="QHBoxLayout">
    62             <property name="spacing">
    63              <number>0</number>
    64             </property>
    65             <item>
    66              <widget class="QLabel" name="m_pLabelMemoryMin"/>
    67             </item>
    68             <item>
    69              <spacer name="m_pSpacerHorizontal1">
    70               <property name="orientation">
    71                <enum>Qt::Horizontal</enum>
    72               </property>
    73               <property name="sizeHint" stdset="0">
    74                <size>
    75                 <width>0</width>
    76                 <height>0</height>
    77                </size>
    78               </property>
    79              </spacer>
    80             </item>
    81             <item>
    82              <widget class="QLabel" name="m_pLabelMemoryMax"/>
    83             </item>
    84            </layout>
    85           </item>
    8654         </layout>
    87         </widget>
    88        </item>
    89        <item row="0" column="3">
    90         <widget class="QSpinBox" name="m_pEditorMemorySize">
    91          <property name="whatsThis">
    92           <string>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</string>
    93          </property>
    9455        </widget>
    9556       </item>
     
    600561  </customwidget>
    601562  <customwidget>
    602    <class>UIBaseMemorySlider</class>
    603    <extends>QIAdvancedSlider</extends>
    604    <header>UIBaseMemorySlider.h</header>
     563   <class>UIBaseMemoryEditor</class>
     564   <extends>QWidget</extends>
     565   <header>UIBaseMemoryEditor.h</header>
    605566  </customwidget>
    606567  <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