VirtualBox

Changeset 47276 in vbox


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

FE/Qt: Machine settings: System page: Cleanup/rework (part 10): Some stuff reordering.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r46536 r47276  
    120120    UIMachineSettingsDisplay();
    121121
    122     /* API: Guest OS type stuff: */
     122    /* API: Correlation stuff: */
    123123    void setGuestOSType(CGuestOSType guestOSType);
    124 
    125     /* API: 2D video acceleration stuff: */
    126124#ifdef VBOX_WITH_VIDEOHWACCEL
    127125    bool isAcceleration2DVideoSelected() const;
     
    133131    bool changed() const { return m_cache.wasChanged(); }
    134132
    135     /* Load data to cache from corresponding external object(s),
     133    /* API: Load data to cache from corresponding external object(s),
    136134     * this task COULD be performed in other than GUI thread: */
    137135    void loadToCacheFrom(QVariant &data);
    138     /* Load data to corresponding widgets from cache,
     136    /* API: Load data to corresponding widgets from cache,
    139137     * this task SHOULD be performed in GUI thread only: */
    140138    void getFromCache();
    141139
    142     /* Save data from corresponding widgets to cache,
     140    /* API: Save data from corresponding widgets to cache,
    143141     * this task SHOULD be performed in GUI thread only: */
    144142    void putToCache();
    145     /* Save data from cache to corresponding external object(s),
     143    /* API: Save data from cache to corresponding external object(s),
    146144     * this task COULD be performed in other than GUI thread: */
    147145    void saveFromCacheTo(QVariant &data);
     
    151149    bool revalidate(QString &strWarning, QString &strTitle);
    152150
    153     /* API: Focus-order stuff: */
     151    /* Helper: Navigation stuff: */
    154152    void setOrderAfter(QWidget *pWidget);
    155153
    156     /* Helper: Translate stuff: */
     154    /* Helper: Translation stuff: */
    157155    void retranslateUi();
    158156
    159     /* Helper: Polish stuff: */
     157    /* Helper: Polishing stuff: */
    160158    void polishPage();
    161159
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r47274 r47276  
    564564}
    565565
    566 void 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 
    578 void 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();
    588 }
    589 
    590 void UIMachineSettingsSystem::onCurrentBootItemChanged(int iCurrentItem)
    591 {
    592     /* Update boot-order tool-buttons: */
    593     bool fEnabledUP = iCurrentItem > 0;
    594     bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1;
    595     if ((mTbBootItemUp->hasFocus() && !fEnabledUP) ||
    596         (mTbBootItemDown->hasFocus() && !fEnabledDOWN))
    597         mTwBootOrder->setFocus();
    598     mTbBootItemUp->setEnabled(fEnabledUP);
    599     mTbBootItemDown->setEnabled(fEnabledDOWN);
    600 }
    601 
    602 void UIMachineSettingsSystem::adjustBootOrderTWSize()
    603 {
    604     /* Adjust boot-table size: */
    605     mTwBootOrder->adjustSizeToFitContent();
    606     /* Update the layout system */
    607     if (m_pTabMotherboard->layout())
    608     {
    609         m_pTabMotherboard->layout()->activate();
    610         m_pTabMotherboard->layout()->update();
    611     }
    612 }
    613 
    614 void UIMachineSettingsSystem::repopulateComboPointingHIDType()
    615 {
    616     /* Is there any value currently present/selected? */
    617     KPointingHIDType currentValue = KPointingHIDType_None;
    618     {
    619         int iCurrentIndex = m_pComboPointingHIDType->currentIndex();
    620         if (iCurrentIndex != -1)
    621             currentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt();
    622     }
    623 
    624     /* Clear combo: */
    625     m_pComboPointingHIDType->clear();
    626 
    627     /* Repopulate combo taking into account currently cached value: */
    628     KPointingHIDType cachedValue = m_cache.base().m_pointingHIDType;
    629     {
    630         /* "PS/2 Mouse" value is always here: */
    631         m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_PS2Mouse), (int)KPointingHIDType_PS2Mouse);
    632 
    633         /* "USB Mouse" value is here only if it is currently selected: */
    634         if (cachedValue == KPointingHIDType_USBMouse)
    635             m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMouse), (int)KPointingHIDType_USBMouse);
    636 
    637         /* "USB Mouse/Tablet" value is always here: */
    638         m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBTablet), (int)KPointingHIDType_USBTablet);
    639 
    640         /* "PS/2 and USB Mouse" value is here only if it is currently selected: */
    641         if (cachedValue == KPointingHIDType_ComboMouse)
    642             m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_ComboMouse), (int)KPointingHIDType_ComboMouse);
    643 
    644         /* "USB Multi-Touch Mouse/Tablet" value is always here: */
    645         m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMultiTouch), (int)KPointingHIDType_USBMultiTouch);
    646     }
    647 
    648     /* Was there any value previously present/selected? */
    649     if (currentValue != KPointingHIDType_None)
    650     {
    651         int iPreviousIndex = m_pComboPointingHIDType->findData((int)currentValue);
    652         if (iPreviousIndex != -1)
    653             m_pComboPointingHIDType->setCurrentIndex(iPreviousIndex);
    654     }
    655 }
    656 
    657 void 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 
    669 void 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 
    681 void 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 
    693 void 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();
    703 }
    704 
    705 void UIMachineSettingsSystem::retranslateComboPointingChipsetType()
    706 {
    707     /* For each the element in KPointingHIDType enum: */
    708     for (int iIndex = (int)KChipsetType_Null; iIndex < (int)KChipsetType_Max; ++iIndex)
    709     {
    710         /* Cast to the corresponding type: */
    711         KChipsetType type = (KChipsetType)iIndex;
    712         /* Look for the corresponding item: */
    713         int iCorrespondingIndex = m_pComboChipsetType->findData((int)type);
    714         /* Re-translate if corresponding item was found: */
    715         if (iCorrespondingIndex != -1)
    716             m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(type));
    717     }
    718 }
    719 
    720 void UIMachineSettingsSystem::retranslateComboPointingHIDType()
    721 {
    722     /* For each the element in KPointingHIDType enum: */
    723     for (int iIndex = (int)KPointingHIDType_None; iIndex < (int)KPointingHIDType_Max; ++iIndex)
    724     {
    725         /* Cast to the corresponding type: */
    726         KPointingHIDType type = (KPointingHIDType)iIndex;
    727         /* Look for the corresponding item: */
    728         int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)type);
    729         /* Re-translate if corresponding item was found: */
    730         if (iCorrespondingIndex != -1)
    731             m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString(type));
    732     }
    733 }
    734 
    735566void UIMachineSettingsSystem::polishPage()
    736567{
     
    777608    m_pCheckBoxVirtualization->setEnabled(isMachineOffline());
    778609    m_pCheckBoxNestedPaging->setEnabled(isMachineOffline() && m_pCheckBoxVirtualization->isChecked());
     610}
     611
     612void UIMachineSettingsSystem::sltHandleMemorySizeSliderChange()
     613{
     614    /* Apply new memory-size value: */
     615    m_pEditorMemorySize->blockSignals(true);
     616    m_pEditorMemorySize->setValue(m_pSliderMemorySize->value());
     617    m_pEditorMemorySize->blockSignals(false);
     618
     619    /* Revalidate if possible: */
     620    if (m_pValidator)
     621        m_pValidator->revalidate();
     622}
     623
     624void UIMachineSettingsSystem::sltHandleMemorySizeEditorChange()
     625{
     626    /* Apply new memory-size value: */
     627    m_pSliderMemorySize->blockSignals(true);
     628    m_pSliderMemorySize->setValue(m_pEditorMemorySize->value());
     629    m_pSliderMemorySize->blockSignals(false);
     630
     631    /* Revalidate if possible: */
     632    if (m_pValidator)
     633        m_pValidator->revalidate();
     634}
     635
     636void UIMachineSettingsSystem::onCurrentBootItemChanged(int iCurrentItem)
     637{
     638    /* Update boot-order tool-buttons: */
     639    bool fEnabledUP = iCurrentItem > 0;
     640    bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1;
     641    if ((mTbBootItemUp->hasFocus() && !fEnabledUP) ||
     642        (mTbBootItemDown->hasFocus() && !fEnabledDOWN))
     643        mTwBootOrder->setFocus();
     644    mTbBootItemUp->setEnabled(fEnabledUP);
     645    mTbBootItemDown->setEnabled(fEnabledDOWN);
     646}
     647
     648void UIMachineSettingsSystem::adjustBootOrderTWSize()
     649{
     650    /* Adjust boot-table size: */
     651    mTwBootOrder->adjustSizeToFitContent();
     652    /* Update the layout system */
     653    if (m_pTabMotherboard->layout())
     654    {
     655        m_pTabMotherboard->layout()->activate();
     656        m_pTabMotherboard->layout()->update();
     657    }
     658}
     659
     660void UIMachineSettingsSystem::repopulateComboPointingHIDType()
     661{
     662    /* Is there any value currently present/selected? */
     663    KPointingHIDType currentValue = KPointingHIDType_None;
     664    {
     665        int iCurrentIndex = m_pComboPointingHIDType->currentIndex();
     666        if (iCurrentIndex != -1)
     667            currentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt();
     668    }
     669
     670    /* Clear combo: */
     671    m_pComboPointingHIDType->clear();
     672
     673    /* Repopulate combo taking into account currently cached value: */
     674    KPointingHIDType cachedValue = m_cache.base().m_pointingHIDType;
     675    {
     676        /* "PS/2 Mouse" value is always here: */
     677        m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_PS2Mouse), (int)KPointingHIDType_PS2Mouse);
     678
     679        /* "USB Mouse" value is here only if it is currently selected: */
     680        if (cachedValue == KPointingHIDType_USBMouse)
     681            m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMouse), (int)KPointingHIDType_USBMouse);
     682
     683        /* "USB Mouse/Tablet" value is always here: */
     684        m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBTablet), (int)KPointingHIDType_USBTablet);
     685
     686        /* "PS/2 and USB Mouse" value is here only if it is currently selected: */
     687        if (cachedValue == KPointingHIDType_ComboMouse)
     688            m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_ComboMouse), (int)KPointingHIDType_ComboMouse);
     689
     690        /* "USB Multi-Touch Mouse/Tablet" value is always here: */
     691        m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMultiTouch), (int)KPointingHIDType_USBMultiTouch);
     692    }
     693
     694    /* Was there any value previously present/selected? */
     695    if (currentValue != KPointingHIDType_None)
     696    {
     697        int iPreviousIndex = m_pComboPointingHIDType->findData((int)currentValue);
     698        if (iPreviousIndex != -1)
     699            m_pComboPointingHIDType->setCurrentIndex(iPreviousIndex);
     700    }
     701}
     702
     703void UIMachineSettingsSystem::sltHandleCPUCountSliderChange()
     704{
     705    /* Apply new memory-size value: */
     706    m_pEditorCPUCount->blockSignals(true);
     707    m_pEditorCPUCount->setValue(m_pSliderCPUCount->value());
     708    m_pEditorCPUCount->blockSignals(false);
     709
     710    /* Revalidate if possible: */
     711    if (m_pValidator)
     712        m_pValidator->revalidate();
     713}
     714
     715void UIMachineSettingsSystem::sltHandleCPUCountEditorChange()
     716{
     717    /* Apply new memory-size value: */
     718    m_pSliderCPUCount->blockSignals(true);
     719    m_pSliderCPUCount->setValue(m_pEditorCPUCount->value());
     720    m_pSliderCPUCount->blockSignals(false);
     721
     722    /* Revalidate if possible: */
     723    if (m_pValidator)
     724        m_pValidator->revalidate();
     725}
     726
     727void UIMachineSettingsSystem::sltHandleCPUExecCapSliderChange()
     728{
     729    /* Apply new memory-size value: */
     730    m_pEditorCPUExecCap->blockSignals(true);
     731    m_pEditorCPUExecCap->setValue(m_pSliderCPUExecCap->value());
     732    m_pEditorCPUExecCap->blockSignals(false);
     733
     734    /* Revalidate if possible: */
     735    if (m_pValidator)
     736        m_pValidator->revalidate();
     737}
     738
     739void UIMachineSettingsSystem::sltHandleCPUExecCapEditorChange()
     740{
     741    /* Apply new memory-size value: */
     742    m_pSliderCPUExecCap->blockSignals(true);
     743    m_pSliderCPUExecCap->setValue(m_pEditorCPUExecCap->value());
     744    m_pSliderCPUExecCap->blockSignals(false);
     745
     746    /* Revalidate if possible: */
     747    if (m_pValidator)
     748        m_pValidator->revalidate();
     749}
     750
     751void UIMachineSettingsSystem::retranslateComboPointingChipsetType()
     752{
     753    /* For each the element in KPointingHIDType enum: */
     754    for (int iIndex = (int)KChipsetType_Null; iIndex < (int)KChipsetType_Max; ++iIndex)
     755    {
     756        /* Cast to the corresponding type: */
     757        KChipsetType type = (KChipsetType)iIndex;
     758        /* Look for the corresponding item: */
     759        int iCorrespondingIndex = m_pComboChipsetType->findData((int)type);
     760        /* Re-translate if corresponding item was found: */
     761        if (iCorrespondingIndex != -1)
     762            m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(type));
     763    }
     764}
     765
     766void UIMachineSettingsSystem::retranslateComboPointingHIDType()
     767{
     768    /* For each the element in KPointingHIDType enum: */
     769    for (int iIndex = (int)KPointingHIDType_None; iIndex < (int)KPointingHIDType_Max; ++iIndex)
     770    {
     771        /* Cast to the corresponding type: */
     772        KPointingHIDType type = (KPointingHIDType)iIndex;
     773        /* Look for the corresponding item: */
     774        int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)type);
     775        /* Re-translate if corresponding item was found: */
     776        if (iCorrespondingIndex != -1)
     777            m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString(type));
     778    }
    779779}
    780780
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r47274 r47276  
    162162    void retranslateUi();
    163163
     164    /* Helper: Polishing stuff: */
     165    void polishPage();
     166
    164167private slots:
    165168
     
    182185    void retranslateComboPointingChipsetType();
    183186    void retranslateComboPointingHIDType();
    184 
    185     /* Handler: Polishing stuff: */
    186     void polishPage();
    187187
    188188    /* Handler: Event-filtration stuff: */
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