Changeset 95770 in vbox
- Timestamp:
- Jul 21, 2022 10:05:38 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 152480
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r95743 r95770 626 626 /** 627 627 * Recording settings for a single screen (e.g. virtual monitor). 628 * 629 * NOTE: If you add any fields in here, you must update a) the constructor and b) 630 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 631 * your settings might never get saved. 628 632 */ 629 633 struct RecordingScreenSettings … … 640 644 641 645 static const char *getDefaultOptions(void); 646 647 static int featuresFromString(const com::Utf8Str &strFeatures, RecordingFeatureMap &featureMap); 648 649 static void featuresToString(const RecordingFeatureMap &featureMap, com::Utf8Str &strFeatures); 642 650 643 651 bool operator==(const RecordingScreenSettings &d) const; … … 648 656 RecordingDestination_T enmDest; 649 657 /** Which features are enable or not. */ 650 RecordingFeatureMap featureMap; / ** @todo Implement with next settings version bump. */658 RecordingFeatureMap featureMap; // requires settings version 1.19 (VirtualBox 7.0) 651 659 /** Maximum time (in s) to record. If set to 0, no time limit is set. */ 652 660 uint32_t ulMaxTimeS; // requires settings version 1.14 (VirtualBox 4.3) … … 711 719 /** 712 720 * Common recording settings, shared among all per-screen recording settings. 721 * 722 * NOTE: If you add any fields in here, you must update a) the constructor and b) 723 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 724 * your settings might never get saved. 713 725 */ 714 726 struct RecordingCommonSettings -
trunk/src/VBox/Main/xml/Settings.cpp
r95741 r95770 2787 2787 /* Note: Needs to be kept in sync with FE/Qt's UIMachineSettingsDisplay::putToCache()! */ 2788 2788 return "vc_enabled=true,ac_enabled=false,ac_profile=med"; 2789 } 2790 2791 /** 2792 * Returns a recording settings feature map from a given string. 2793 * 2794 * @returns VBox status code. 2795 * @param strFeatures String of features to convert. 2796 * @param featureMap Where to return the converted features on success. 2797 */ 2798 /* static */ 2799 int RecordingScreenSettings::featuresFromString(const com::Utf8Str &strFeatures, RecordingFeatureMap &featureMap) 2800 { 2801 featureMap.clear(); 2802 2803 RTCList<RTCString> lstFeatures = strFeatures.split(" "); 2804 for (size_t i = 0; i < lstFeatures.size(); i++) 2805 { 2806 if (lstFeatures.at(i).compare("video", RTCString::CaseInsensitive)) 2807 featureMap[RecordingFeature_Video] = true; 2808 else if (lstFeatures.at(i).compare("audio", RTCString::CaseInsensitive)) 2809 featureMap[RecordingFeature_Audio] = true; 2810 /* ignore everything else */ 2811 } 2812 2813 return VINF_SUCCESS; 2814 } 2815 2816 /** 2817 * Converts a feature map to a serializable string. 2818 * 2819 * @param featureMap Feature map to convert. 2820 * @param strFeatures Where to return the features converted as a string. 2821 */ 2822 /* static */ 2823 void RecordingScreenSettings::featuresToString(const RecordingFeatureMap &featureMap, com::Utf8Str &strFeatures) 2824 { 2825 RecordingFeatureMap::const_iterator itFeature = featureMap.begin(); 2826 while (itFeature != featureMap.end()) 2827 { 2828 if (itFeature->first == RecordingFeature_Video && itFeature->second) 2829 strFeatures += "video "; 2830 if (itFeature->first == RecordingFeature_Audio && itFeature->second) 2831 strFeatures += "audio "; 2832 strFeatures += " "; 2833 2834 ++itFeature; 2835 } 2836 strFeatures.strip(); 2789 2837 } 2790 2838 … … 6019 6067 6020 6068 (*itScreen)->getAttributeValue("enabled", screenSettings.fEnabled); 6069 Utf8Str strFeatures; 6070 (*itScreen)->getAttributeValue("featuresEnabled", strFeatures); 6071 RecordingScreenSettings::featuresFromString(strFeatures, screenSettings.featureMap); 6021 6072 (*itScreen)->getAttributeValue("maxTimeS", screenSettings.ulMaxTimeS); 6022 6073 (*itScreen)->getAttributeValue("options", screenSettings.strOptions); … … 8054 8105 pelmScreen->setAttribute("id", itScreen->first); /* The key equals the monitor ID. */ 8055 8106 pelmScreen->setAttribute("enabled", itScreen->second.fEnabled); 8107 com::Utf8Str strFeatures; 8108 RecordingScreenSettings::featuresToString(itScreen->second.featureMap, strFeatures); 8109 pelmScreen->setAttribute("featuresEnabled", strFeatures); 8056 8110 if (itScreen->second.ulMaxTimeS) 8057 8111 pelmScreen->setAttribute("maxTimeS", itScreen->second.ulMaxTimeS);
Note:
See TracChangeset
for help on using the changeset viewer.