VirtualBox

Changeset 95774 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 21, 2022 11:42:04 AM (2 years ago)
Author:
vboxsync
Message:

FE/Qt/Ds: bugref:9286: UIRecordingSettingsEditor: Handle supported video/audio capturing features dynamically.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIRecordingSettingsEditor.cpp

    r95773 r95774  
    3131#include "UIFilmContainer.h"
    3232#include "UIRecordingSettingsEditor.h"
     33
     34/* COM includes: */
     35#include "CSystemProperties.h"
    3336
    3437/* Defines: */
     
    132135    {
    133136        m_enmMode = enmMode;
    134         if (m_pComboMode)
    135         {
    136             const int iIndex = m_pComboMode->findData(QVariant::fromValue(enmMode));
    137             if (iIndex != -1)
    138                 m_pComboMode->setCurrentIndex(iIndex);
    139         }
     137        populateComboMode();
     138        updateWidgetVisibility();
    140139    }
    141140}
     
    822821}
    823822
     823void UIRecordingSettingsEditor::populateComboMode()
     824{
     825    if (m_pComboMode)
     826    {
     827        /* Clear combo first of all: */
     828        m_pComboMode->clear();
     829
     830        /* Load currently supported recording features: */
     831        CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
     832        int iSupportedFlag = 0;
     833        foreach (const KRecordingFeature &enmFeature, comProperties.GetSupportedRecordingFeatures())
     834            iSupportedFlag |= enmFeature;
     835        m_supportedValues.clear();
     836        if (!iSupportedFlag)
     837            m_supportedValues << UISettingsDefs::RecordingMode_None;
     838        else
     839        {
     840            if (   (iSupportedFlag & KRecordingFeature_Video)
     841                && (iSupportedFlag & KRecordingFeature_Audio))
     842                m_supportedValues << UISettingsDefs::RecordingMode_VideoAudio;
     843            if (iSupportedFlag & KRecordingFeature_Video)
     844                m_supportedValues << UISettingsDefs::RecordingMode_VideoOnly;
     845            if (iSupportedFlag & KRecordingFeature_Audio)
     846                m_supportedValues << UISettingsDefs::RecordingMode_AudioOnly;
     847        }
     848
     849        /* Make sure requested value if sane is present as well: */
     850        if (   m_enmMode != UISettingsDefs::RecordingMode_Max
     851            && !m_supportedValues.contains(m_enmMode))
     852            m_supportedValues.prepend(m_enmMode);
     853
     854        /* Update combo with all the supported values: */
     855        foreach (const UISettingsDefs::RecordingMode &enmType, m_supportedValues)
     856            m_pComboMode->addItem(QString(), QVariant::fromValue(enmType));
     857
     858        /* Look for proper index to choose: */
     859        const int iIndex = m_pComboMode->findData(QVariant::fromValue(m_enmMode));
     860        if (iIndex != -1)
     861            m_pComboMode->setCurrentIndex(iIndex);
     862
     863        /* Retranslate finally: */
     864        retranslateUi();
     865    }
     866}
     867
     868void UIRecordingSettingsEditor::updateWidgetVisibility()
     869{
     870    /* Only the Audio stuff can be totally disabled, so we will add the code for hiding Audio stuff only: */
     871    const bool fAudioSettingsVisible =    m_supportedValues.isEmpty()
     872                                       || m_supportedValues.contains(UISettingsDefs::RecordingMode_AudioOnly);
     873    m_pWidgetAudioQualitySettings->setVisible(fAudioSettingsVisible);
     874    m_pLabelAudioQuality->setVisible(fAudioSettingsVisible);
     875}
     876
    824877void UIRecordingSettingsEditor::updateWidgetAvailability()
    825878{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIRecordingSettingsEditor.h

    r95773 r95774  
    140140    void prepareConnections();
    141141
     142    /** Populates mode combo-box. */
     143    void populateComboMode();
     144
     145    /** Updates widget visibility. */
     146    void updateWidgetVisibility();
    142147    /** Updates widget availability. */
    143148    void updateWidgetAvailability();
     
    164169        bool  m_fScreenOptionsAvailable;
    165170
     171        /** Holds the list of supported modes. */
     172        QVector<UISettingsDefs::RecordingMode>  m_supportedValues;
    166173        /** Holds the mode. */
    167         UISettingsDefs::RecordingMode  m_enmMode;
     174        UISettingsDefs::RecordingMode           m_enmMode;
    168175
    169176        /** Holds the folder. */
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