Changeset 95774 in vbox for trunk/src/VBox
- Timestamp:
- Jul 21, 2022 11:42:04 AM (2 years ago)
- 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 31 31 #include "UIFilmContainer.h" 32 32 #include "UIRecordingSettingsEditor.h" 33 34 /* COM includes: */ 35 #include "CSystemProperties.h" 33 36 34 37 /* Defines: */ … … 132 135 { 133 136 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(); 140 139 } 141 140 } … … 822 821 } 823 822 823 void 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 868 void 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 824 877 void UIRecordingSettingsEditor::updateWidgetAvailability() 825 878 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIRecordingSettingsEditor.h
r95773 r95774 140 140 void prepareConnections(); 141 141 142 /** Populates mode combo-box. */ 143 void populateComboMode(); 144 145 /** Updates widget visibility. */ 146 void updateWidgetVisibility(); 142 147 /** Updates widget availability. */ 143 148 void updateWidgetAvailability(); … … 164 169 bool m_fScreenOptionsAvailable; 165 170 171 /** Holds the list of supported modes. */ 172 QVector<UISettingsDefs::RecordingMode> m_supportedValues; 166 173 /** Holds the mode. */ 167 UISettingsDefs::RecordingMode m_enmMode;174 UISettingsDefs::RecordingMode m_enmMode; 168 175 169 176 /** Holds the folder. */
Note:
See TracChangeset
for help on using the changeset viewer.