Changeset 56088 in vbox
- Timestamp:
- May 27, 2015 8:55:54 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r56035 r56088 705 705 && (controllerType == a.controllerType) 706 706 && (driverType == a.driverType) 707 && (properties == a.properties) 707 708 ); 708 709 } … … 711 712 AudioControllerType_T controllerType; 712 713 AudioDriverType_T driverType; 714 std::map<com::Utf8Str, com::Utf8Str> properties; 713 715 }; 714 716 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r56035 r56088 18397 18397 </desc> 18398 18398 </attribute> 18399 <attribute name="propertiesList" type="wstring" readonly="yes" safearray="yes"> 18400 <desc> 18401 Array of names of tunable properties, which can be supported by audio driver. 18402 </desc> 18403 </attribute> 18404 18405 <method name="setProperty"> 18406 <desc> 18407 Sets an audio specific property string. 18408 18409 If you pass @c null or empty string as a key @a value, the given @a key 18410 will be deleted. 18411 18412 </desc> 18413 <param name="key" type="wstring" dir="in"> 18414 <desc>Name of the key to set.</desc> 18415 </param> 18416 <param name="value" type="wstring" dir="in"> 18417 <desc>Value to assign to the key.</desc> 18418 </param> 18419 </method> 18420 18421 <method name="getProperty" const="yes"> 18422 <desc> 18423 Returns an audio specific property string. 18424 18425 If the requested data @a key does not exist, this function will 18426 succeed and return an empty string in the @a value argument. 18427 18428 </desc> 18429 <param name="key" type="wstring" dir="in"> 18430 <desc>Name of the key to get.</desc> 18431 </param> 18432 <param name="value" type="wstring" dir="return"> 18433 <desc>Value of the requested key.</desc> 18434 </param> 18435 </method> 18436 18399 18437 </interface> 18400 18438 -
trunk/src/VBox/Main/include/AudioAdapterImpl.h
r55528 r56088 65 65 HRESULT getAudioController(AudioControllerType_T *aAudioController); 66 66 HRESULT setAudioController(AudioControllerType_T aAudioController); 67 HRESULT getPropertiesList(std::vector<com::Utf8Str>& aProperties); 68 HRESULT getProperty(const com::Utf8Str &aKey, com::Utf8Str &aValue); 69 HRESULT setProperty(const com::Utf8Str &aKey, const com::Utf8Str &aValue); 67 70 68 71 Machine * const mParent; -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r56085 r56088 2736 2736 InsertConfigNode(pInst, "Config", &pCfg); 2737 2737 } 2738 } 2739 2740 PCFGMNODE pCfgAudioSettings = NULL; 2741 InsertConfigNode(pInst, "AudioConfig", &pCfgAudioSettings); 2742 SafeArray<BSTR> audioProps; 2743 hrc = audioAdapter->COMGETTER(PropertiesList)(ComSafeArrayAsOutParam(audioProps)); H(); 2744 2745 std::list<Utf8Str> audioPropertyNamesList; 2746 std::map<Utf8Str, Utf8Str> audioProperties; 2747 for (size_t i = 0; i < audioProps.size(); ++i) 2748 { 2749 Bstr bstrValue; 2750 audioPropertyNamesList.push_back(Utf8Str(audioProps[i])); 2751 hrc = audioAdapter->GetProperty(audioProps[i], bstrValue.asOutParam()); 2752 Utf8Str strKey(audioProps[i]); 2753 audioProperties[strKey] = Utf8Str(bstrValue); 2754 InsertConfigString(pCfgAudioSettings, strKey.c_str(), bstrValue); 2738 2755 } 2739 2756 -
trunk/src/VBox/Main/src-server/AudioAdapterImpl.cpp
r55548 r56088 39 39 AudioDriverType_T mAudioDriver; 40 40 AudioControllerType_T mAudioController; 41 std::map<com::Utf8Str, com::Utf8Str> properties; 41 42 }; 42 43 … … 347 348 } 348 349 350 HRESULT AudioAdapter::getPropertiesList(std::vector<com::Utf8Str>& aProperties) 351 { 352 using namespace settings; 353 354 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 355 356 aProperties.resize(0); 357 StringsMap::const_iterator cit = mData->m->properties.begin(); 358 while(cit!=mData->m->properties.end()) 359 { 360 Utf8Str key = cit->first; 361 aProperties.push_back(cit->first); 362 ++cit; 363 } 364 365 return S_OK; 366 } 367 368 HRESULT AudioAdapter::getProperty(const com::Utf8Str &aKey, com::Utf8Str &aValue) 369 { 370 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 371 372 settings::StringsMap::const_iterator cit = mData->m->properties.find(aKey); 373 if (cit != mData->m->properties.end()) 374 aValue = cit->second; 375 376 return S_OK; 377 } 378 379 HRESULT AudioAdapter::setProperty(const com::Utf8Str &aKey, const com::Utf8Str &aValue) 380 { 381 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 382 383 /* Generic properties processing. 384 * Look up the old value first; if nothing's changed then do nothing. 385 */ 386 Utf8Str strOldValue; 387 388 settings::StringsMap::const_iterator cit = mData->m->properties.find(aKey); 389 if (cit != mData->m->properties.end()) 390 strOldValue = cit->second; 391 392 if (strOldValue != aValue) 393 { 394 if (aValue.isEmpty()) 395 mData->m->properties.erase(aKey); 396 else 397 mData->m->properties[aKey] = aValue; 398 } 399 400 alock.release(); 401 402 return S_OK; 403 } 404 349 405 // IAudioAdapter methods 350 406 ///////////////////////////////////////////////////////////////////////////// … … 383 439 mData->m->mAudioDriver = data.driverType; 384 440 441 std::map<com::Utf8Str, com::Utf8Str>::const_iterator cit = data.properties.begin(); 442 while(cit!=data.properties.end()) 443 { 444 mData->m->properties[cit->first] = cit->second; 445 ++cit; 446 } 447 385 448 return S_OK; 386 449 } … … 403 466 data.controllerType = mData->m->mAudioController; 404 467 data.driverType = mData->m->mAudioDriver; 468 469 std::map<com::Utf8Str, com::Utf8Str>::const_iterator cit = mData->m->properties.begin(); 470 while(cit!=mData->m->properties.end()) 471 { 472 data.properties[cit->first] = cit->second; 473 ++cit; 474 } 475 405 476 return S_OK; 406 477 } -
trunk/src/VBox/Main/xml/Settings.cpp
r56035 r56088 2622 2622 AudioAdapter &aa) 2623 2623 { 2624 2625 // get all properties 2626 xml::NodesLoop nl1(elmAudioAdapter, "Property"); 2627 const xml::ElementNode *pelmModeChild; 2628 while ((pelmModeChild = nl1.forAllNodes())) 2629 { 2630 Utf8Str strPropName, strPropValue; 2631 if ( pelmModeChild->getAttributeValue("name", strPropName) 2632 && pelmModeChild->getAttributeValue("value", strPropValue) ) 2633 aa.properties[strPropName] = strPropValue; 2634 else 2635 throw ConfigFileError(this, pelmModeChild, N_("Required AudioAdapter/Property/@name or @value attribute " 2636 "is missing")); 2637 } 2638 2624 2639 elmAudioAdapter.getAttributeValue("enabled", aa.fEnabled); 2625 2640 … … 4730 4745 4731 4746 pelmAudio->setAttribute("enabled", hw.audioAdapter.fEnabled); 4747 4748 if (hw.audioAdapter.properties.size() > 0) 4749 { 4750 for (StringsMap::const_iterator it = hw.audioAdapter.properties.begin(); 4751 it != hw.audioAdapter.properties.end(); 4752 ++it) 4753 { 4754 const Utf8Str &strName = it->first; 4755 const Utf8Str &strValue = it->second; 4756 xml::ElementNode *pelm = pelmAudio->createChild("Property"); 4757 pelm->setAttribute("name", strName); 4758 pelm->setAttribute("value", strValue); 4759 } 4760 } 4732 4761 4733 4762 xml::ElementNode *pelmSharedFolders = pelmHardware->createChild("SharedFolders");
Note:
See TracChangeset
for help on using the changeset viewer.