void CGUIControlButtonSetting::OnSliderChange(void *data, CGUISliderControl *slider) { if (slider == NULL) return; std::string strText; switch (m_pSetting->GetType()) { case SettingTypeInteger: { CSettingInt *settingInt = static_cast<CSettingInt*>(m_pSetting); if (settingInt->SetValue(slider->GetIntValue())) strText = CGUIControlSliderSetting::GetText(static_cast<const CSettingControlSlider*>(m_pSetting->GetControl()), settingInt->GetValue(), settingInt->GetMinimum(), settingInt->GetStep(), settingInt->GetMaximum()); break; } case SettingTypeNumber: { CSettingNumber *settingNumber = static_cast<CSettingNumber*>(m_pSetting); if (settingNumber->SetValue(static_cast<double>(slider->GetFloatValue()))) strText = CGUIControlSliderSetting::GetText(static_cast<const CSettingControlSlider*>(m_pSetting->GetControl()), settingNumber->GetValue(), settingNumber->GetMinimum(), settingNumber->GetStep(), settingNumber->GetMaximum()); break; } default: break; } if (!strText.empty()) slider->SetTextValue(strText); }
void CPeripheral::PersistSettings(bool bExiting /* = false */) { CXBMCTinyXML doc; TiXmlElement node("settings"); doc.InsertEndChild(node); for (map<CStdString, CSetting *>::const_iterator itr = m_settings.begin(); itr != m_settings.end(); itr++) { TiXmlElement nodeSetting("setting"); nodeSetting.SetAttribute("id", itr->first.c_str()); CStdString strValue; switch ((*itr).second->GetType()) { case SettingTypeString: { CSettingString *stringSetting = (CSettingString *) (*itr).second; if (stringSetting) strValue = stringSetting->GetValue(); } break; case SettingTypeInteger: { CSettingInt *intSetting = (CSettingInt *) (*itr).second; if (intSetting) strValue = StringUtils::Format("%d", intSetting->GetValue()); } break; case SettingTypeNumber: { CSettingNumber *floatSetting = (CSettingNumber *) (*itr).second; if (floatSetting) strValue = StringUtils::Format("%.2f", floatSetting->GetValue()); } break; case SettingTypeBool: { CSettingBool *boolSetting = (CSettingBool *) (*itr).second; if (boolSetting) strValue = StringUtils::Format("%d", boolSetting->GetValue() ? 1:0); } break; default: break; } nodeSetting.SetAttribute("value", strValue.c_str()); doc.RootElement()->InsertEndChild(nodeSetting); } doc.SaveFile(m_strSettingsFile); if (!bExiting) { for (set<CStdString>::const_iterator it = m_changedSettings.begin(); it != m_changedSettings.end(); it++) OnSettingChanged(*it); } m_changedSettings.clear(); }
float CPeripheral::GetSettingFloat(const CStdString &strKey) const { map<CStdString, CSetting *>::const_iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second->GetType() == SettingTypeNumber) { CSettingNumber *floatSetting = (CSettingNumber *) (*it).second; if (floatSetting) return (float)floatSetting->GetValue(); } return 0; }
float CPeripheral::GetSettingFloat(const std::string &strKey) const { std::map<std::string, PeripheralDeviceSetting>::const_iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeNumber) { CSettingNumber *floatSetting = (CSettingNumber *) (*it).second.m_setting; if (floatSetting) return (float)floatSetting->GetValue(); } return 0; }
void CGUIControlSpinExSetting::FillControl() { m_pSpin->Clear(); switch (m_pSetting->GetControl().GetFormat()) { case SettingControlFormatNumber: { CSettingNumber *pSettingNumber = (CSettingNumber *)m_pSetting; m_pSpin->SetType(SPIN_CONTROL_TYPE_FLOAT); m_pSpin->SetFloatRange((float)pSettingNumber->GetMinimum(), (float)pSettingNumber->GetMaximum()); m_pSpin->SetFloatInterval((float)pSettingNumber->GetStep()); m_pSpin->SetFloatValue((float)pSettingNumber->GetValue()); break; } case SettingControlFormatInteger: { m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT); FillIntegerSettingControl(); break; } case SettingControlFormatString: { m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT); if (m_pSetting->GetType() == SettingTypeInteger) FillIntegerSettingControl(); else if (m_pSetting->GetType() == SettingTypeString) { CSettingString *pSettingString = (CSettingString *)m_pSetting; if (pSettingString->GetOptionsType() == SettingOptionsTypeDynamic) { DynamicStringSettingOptions options = pSettingString->UpdateDynamicOptions(); for (std::vector< std::pair<std::string, std::string> >::const_iterator option = options.begin(); option != options.end(); ++option) m_pSpin->AddLabel(option->first, option->second); m_pSpin->SetStringValue(pSettingString->GetValue()); } } break; } default: break; } }
bool CPeripheral::SetSetting(const CStdString &strKey, float fValue) { bool bChanged(false); map<CStdString, CSetting *>::iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second->GetType() == SettingTypeNumber) { CSettingNumber *floatSetting = (CSettingNumber *) (*it).second; if (floatSetting) { bChanged = floatSetting->GetValue() != fValue; floatSetting->SetValue(fValue); if (bChanged && m_bInitialised) m_changedSettings.insert(strKey); } } return bChanged; }
void CGUIControlSpinExSetting::FillControl() { if (m_pSpin == NULL) return; m_pSpin->Clear(); const std::string &controlFormat = m_pSetting->GetControl()->GetFormat(); if (controlFormat == "number") { CSettingNumber *pSettingNumber = (CSettingNumber *)m_pSetting; m_pSpin->SetType(SPIN_CONTROL_TYPE_FLOAT); m_pSpin->SetFloatRange((float)pSettingNumber->GetMinimum(), (float)pSettingNumber->GetMaximum()); m_pSpin->SetFloatInterval((float)pSettingNumber->GetStep()); m_pSpin->SetFloatValue((float)pSettingNumber->GetValue()); } else if (controlFormat == "integer") { m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT); FillIntegerSettingControl(); } else if (controlFormat == "string") { m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT); if (m_pSetting->GetType() == SettingTypeInteger) FillIntegerSettingControl(); else if (m_pSetting->GetType() == SettingTypeString) { DynamicStringSettingOptions options; std::set<std::string> selectedValues; // get the string options if (!GetStringOptions(m_pSetting, options, selectedValues) || selectedValues.size() != 1) return; // add them to the spinner for (const auto& option : options) m_pSpin->AddLabel(option.first, option.second); // and set the current value m_pSpin->SetStringValue(*selectedValues.begin()); } } }
CSettingList* CGUIDialogSettingsManualBase::AddRange(CSettingGroup *group, const std::string &id, int label, int level, float valueLower, float valueUpper, float minimum, float step, float maximum, const std::string &format, int formatLabel, int valueFormatLabel, const std::string &valueFormatString, bool delayed, bool visible, int help) { if (group == NULL || id.empty() || label < 0 || GetSetting(id) != NULL) return NULL; CSettingNumber *settingDefinition = new CSettingNumber(id, m_settingsManager); if (settingDefinition == NULL) return NULL; settingDefinition->SetMinimum(minimum); settingDefinition->SetStep(step); settingDefinition->SetMaximum(maximum); CSettingList *setting = new CSettingList(id, settingDefinition, label, m_settingsManager); if (setting == NULL) { delete settingDefinition; return NULL; } std::vector<CVariant> valueList; valueList.push_back(valueLower); valueList.push_back(valueUpper); SettingPtrList settingValues; if (!CSettingUtils::ValuesToList(setting, valueList, settingValues)) { delete settingDefinition; delete setting; return NULL; } // setting the default will also set the actual value on an unchanged setting setting->SetDefault(settingValues); setting->SetControl(GetRangeControl(format, delayed, formatLabel, valueFormatLabel, valueFormatString)); setting->SetMinimumItems(2); setting->SetMaximumItems(2); setSettingDetails(setting, level, visible, help); group->AddSetting(setting); return setting; }
CSettingNumber* CGUIDialogSettingsManualBase::AddEdit(CSettingGroup *group, const std::string &id, int label, int level, float value, float minimum /* = 0.0f */, float step /* = 1.0f */, float maximum /* = 0.0f */, bool verifyNewValue /* = false */, int heading /* = -1 */, bool delayed /* = false */, bool visible /* = true */, int help /* = -1 */) { if (group == NULL || id.empty() || label < 0 || GetSetting(id) != NULL) return NULL; CSettingNumber *setting = new CSettingNumber(id, label, value, minimum, step, maximum, m_settingsManager); if (setting == NULL) return NULL; setting->SetControl(GetEditControl("number", delayed, false, verifyNewValue, heading)); setSettingDetails(setting, level, visible, help); group->AddSetting(setting); return setting; }
CSettingNumber* CGUIDialogSettingsManualBase::AddSlider(CSettingGroup *group, const std::string &id, int label, int level, float value, const std::string &formatString, float minimum, float step, float maximum, int heading /* = -1 */, bool usePopup /* = false */, bool delayed /* = false */, bool visible /* = true */, int help /* = -1 */) { if (group == NULL || id.empty() || label < 0 || GetSetting(id) != NULL) return NULL; CSettingNumber *setting = new CSettingNumber(id, label, value, m_settingsManager); if (setting == NULL) return NULL; setting->SetControl(GetSliderControl("number", delayed, heading, usePopup, -1, formatString)); setting->SetMinimum(minimum); setting->SetStep(step); setting->SetMaximum(maximum); setSettingDetails(setting, level, visible, help); group->AddSetting(setting); return setting; }
CGUIControlSliderSetting::CGUIControlSliderSetting(CGUISettingsSliderControl *pSlider, int id, CSetting *pSetting) : CGUIControlBaseSetting(id, pSetting) { m_pSlider = pSlider; if (m_pSlider == NULL) return; m_pSlider->SetID(id); switch (m_pSetting->GetType()) { case SettingTypeInteger: { CSettingInt *settingInt = static_cast<CSettingInt*>(m_pSetting); if (m_pSetting->GetControl()->GetFormat() == "percentage") m_pSlider->SetType(SLIDER_CONTROL_TYPE_PERCENTAGE); else { m_pSlider->SetType(SLIDER_CONTROL_TYPE_INT); m_pSlider->SetRange(settingInt->GetMinimum(), settingInt->GetMaximum()); } m_pSlider->SetIntInterval(settingInt->GetStep()); break; } case SettingTypeNumber: { CSettingNumber *settingNumber = static_cast<CSettingNumber*>(m_pSetting); m_pSlider->SetType(SLIDER_CONTROL_TYPE_FLOAT); m_pSlider->SetFloatRange((float)settingNumber->GetMinimum(), (float)settingNumber->GetMaximum()); m_pSlider->SetFloatInterval((float)settingNumber->GetStep()); break; } default: break; } Update(); }
void CPeripheral::AddSetting(const CStdString &strKey, const CSetting *setting) { if (!setting) { CLog::Log(LOGERROR, "%s - invalid setting", __FUNCTION__); return; } if (!HasSetting(strKey)) { switch(setting->GetType()) { case SettingTypeBool: { const CSettingBool *mappedSetting = (const CSettingBool *) setting; CSettingBool *boolSetting = new CSettingBool(strKey, *mappedSetting); if (boolSetting) { boolSetting->SetVisible(mappedSetting->IsVisible()); m_settings.insert(make_pair(strKey, boolSetting)); } } break; case SettingTypeInteger: { const CSettingInt *mappedSetting = (const CSettingInt *) setting; CSettingInt *intSetting = new CSettingInt(strKey, *mappedSetting); if (intSetting) { intSetting->SetVisible(mappedSetting->IsVisible()); m_settings.insert(make_pair(strKey, intSetting)); } } break; case SettingTypeNumber: { const CSettingNumber *mappedSetting = (const CSettingNumber *) setting; CSettingNumber *floatSetting = new CSettingNumber(strKey, *mappedSetting); if (floatSetting) { floatSetting->SetVisible(mappedSetting->IsVisible()); m_settings.insert(make_pair(strKey, floatSetting)); } } break; case SettingTypeString: { const CSettingString *mappedSetting = (const CSettingString *) setting; CSettingString *stringSetting = new CSettingString(strKey, *mappedSetting); if (stringSetting) { stringSetting->SetVisible(mappedSetting->IsVisible()); m_settings.insert(make_pair(strKey, stringSetting)); } } break; default: //TODO add more types if needed break; } } }
void CGUIDialogAudioSubtitleSettings::InitializeSettings() { CGUIDialogSettingsManualBase::InitializeSettings(); CSettingCategory *category = AddCategory("audiosubtitlesettings", -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings"); return; } // get all necessary setting groups CSettingGroup *groupAudio = AddGroup(category); if (groupAudio == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings"); return; } CSettingGroup *groupSubtitles = AddGroup(category); if (groupSubtitles == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings"); return; } CSettingGroup *groupSaveAsDefault = AddGroup(category); if (groupSaveAsDefault == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings"); return; } bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml"); CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings(); if (g_application.m_pPlayer->HasPlayer()) { g_application.m_pPlayer->GetAudioCapabilities(m_audioCaps); g_application.m_pPlayer->GetSubtitleCapabilities(m_subCaps); } // register IsPlayingPassthrough condition m_settingsManager->AddCondition("IsPlayingPassthrough", IsPlayingPassthrough); CSettingDependency dependencyAudioOutputPassthroughDisabled(SettingDependencyTypeEnable, m_settingsManager); dependencyAudioOutputPassthroughDisabled.Or() ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_AUDIO_PASSTHROUGH, "false", SettingDependencyOperatorEquals, false, m_settingsManager))) ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition("IsPlayingPassthrough", "", "", true, m_settingsManager))); SettingDependencies depsAudioOutputPassthroughDisabled; depsAudioOutputPassthroughDisabled.push_back(dependencyAudioOutputPassthroughDisabled); m_dspEnabled = CServiceBroker::GetSettings().GetBool(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED); // audio settings // audio volume setting m_volume = g_application.GetVolume(false); CSettingNumber *settingAudioVolume = AddSlider(groupAudio, SETTING_AUDIO_VOLUME, 13376, 0, m_volume, 14054, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM); settingAudioVolume->SetDependencies(depsAudioOutputPassthroughDisabled); static_cast<CSettingControlSlider*>(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel); if (m_dspEnabled) AddButton(groupAudio, SETTING_AUDIO_DSP, 24136, 0); // audio volume amplification setting if (SupportsAudioFeature(IPC_AUD_AMP) && !m_dspEnabled) { CSettingNumber *settingAudioVolumeAmplification = AddSlider(groupAudio, SETTING_AUDIO_VOLUME_AMPLIFICATION, 660, 0, videoSettings.m_VolumeAmplification, 14054, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f); settingAudioVolumeAmplification->SetDependencies(depsAudioOutputPassthroughDisabled); } // audio delay setting if (SupportsAudioFeature(IPC_AUD_OFFSET) && !m_dspEnabled) { CSettingNumber *settingAudioDelay = AddSlider(groupAudio, SETTING_AUDIO_DELAY, 297, 0, videoSettings.m_AudioDelay, 0, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, 297, usePopup); static_cast<CSettingControlSlider*>(settingAudioDelay->GetControl())->SetFormatter(SettingFormatterDelay); } // audio stream setting if (SupportsAudioFeature(IPC_AUD_SELECT_STREAM)) AddAudioStreams(groupAudio, SETTING_AUDIO_STREAM); // audio output to all speakers setting //! @todo remove this setting if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO) && !m_dspEnabled) AddToggle(groupAudio, SETTING_AUDIO_OUTPUT_TO_ALL_SPEAKERS, 252, 0, videoSettings.m_OutputToAllSpeakers); // audio digital/analog setting if (SupportsAudioFeature(IPC_AUD_SELECT_OUTPUT)) { m_passthrough = CServiceBroker::GetSettings().GetBool(CSettings::SETTING_AUDIOOUTPUT_PASSTHROUGH); AddToggle(groupAudio, SETTING_AUDIO_PASSTHROUGH, 348, 0, m_passthrough); } // subtitle settings m_subtitleVisible = g_application.m_pPlayer->GetSubtitleVisible(); // subtitle enabled setting AddToggle(groupSubtitles, SETTING_SUBTITLE_ENABLE, 13397, 0, m_subtitleVisible); // subtitle delay setting if (SupportsSubtitleFeature(IPC_SUBS_OFFSET)) { CSettingNumber *settingSubtitleDelay = AddSlider(groupSubtitles, SETTING_SUBTITLE_DELAY, 22006, 0, videoSettings.m_SubtitleDelay, 0, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, 22006, usePopup); static_cast<CSettingControlSlider*>(settingSubtitleDelay->GetControl())->SetFormatter(SettingFormatterDelay); } // subtitle stream setting if (SupportsSubtitleFeature(IPC_SUBS_SELECT)) AddSubtitleStreams(groupSubtitles, SETTING_SUBTITLE_STREAM); // subtitle browser setting if (SupportsSubtitleFeature(IPC_SUBS_EXTERNAL)) AddButton(groupSubtitles, SETTING_SUBTITLE_BROWSER, 13250, 0); // subtitle stream setting AddButton(groupSaveAsDefault, SETTING_AUDIO_MAKE_DEFAULT, 12376, 0); }
void CGUIDialogPeripheralSettings::InitializeSettings() { if (m_item == NULL) { m_initialising = false; return; } m_initialising = true; bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml"); CPeripheral *peripheral = g_peripherals.GetByPath(m_item->GetPath()); if (peripheral == NULL) { CLog::Log(LOGDEBUG, "%s - no peripheral", __FUNCTION__); m_initialising = false; return; } m_settingsMap.clear(); CGUIDialogSettingsManualBase::InitializeSettings(); CSettingCategory *category = AddCategory("peripheralsettings", -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogPeripheralSettings: unable to setup settings"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogPeripheralSettings: unable to setup settings"); return; } std::vector<CSetting*> settings = peripheral->GetSettings(); for (std::vector<CSetting*>::iterator itSetting = settings.begin(); itSetting != settings.end(); ++itSetting) { CSetting *setting = *itSetting; if (setting == NULL) continue; if (!setting->IsVisible()) { CLog::Log(LOGDEBUG, "%s - invisible", __FUNCTION__); continue; } // we need to create a copy of the setting because the CSetting instances // are destroyed when leaving the dialog CSetting *settingCopy = NULL; switch(setting->GetType()) { case SettingTypeBool: { CSettingBool *settingBool = new CSettingBool(setting->GetId(), *static_cast<CSettingBool*>(setting)); settingBool->SetControl(GetCheckmarkControl()); settingCopy = static_cast<CSetting*>(settingBool); break; } case SettingTypeInteger: { CSettingInt *intSetting = static_cast<CSettingInt*>(setting); if (intSetting == NULL) break; CSettingInt *settingInt = new CSettingInt(setting->GetId(), *intSetting); if (settingInt->GetOptions().empty()) settingInt->SetControl(GetSliderControl("integer", false, -1, usePopup, -1, "%i")); else settingInt->SetControl(GetSpinnerControl("string")); settingCopy = static_cast<CSetting*>(settingInt); break; } case SettingTypeNumber: { CSettingNumber *settingNumber = new CSettingNumber(setting->GetId(), *static_cast<CSettingNumber*>(setting)); settingNumber->SetControl(GetSliderControl("number", false, -1, usePopup, -1, "%2.2f")); settingCopy = static_cast<CSetting*>(settingNumber); break; } case SettingTypeString: { CSettingString *settingString = new CSettingString(setting->GetId(), *static_cast<CSettingString*>(setting)); settingString->SetControl(GetEditControl("string")); settingCopy = static_cast<CSetting*>(settingString); break; } default: // TODO: add more types if needed CLog::Log(LOGDEBUG, "%s - unknown type", __FUNCTION__); break; } if (settingCopy != NULL && settingCopy->GetControl() != NULL) { settingCopy->SetLevel(SettingLevelBasic); group->AddSetting(settingCopy); m_settingsMap.insert(std::make_pair(setting->GetId(), setting)); } } m_initialising = false; }
bool CGUIControlButtonSetting::OnClick() { if (m_pButton == NULL) return false; const ISettingControl *control = m_pSetting->GetControl(); const std::string &controlType = control->GetType(); const std::string &controlFormat = control->GetFormat(); if (controlType == "button") { const CSettingControlButton *buttonControl = static_cast<const CSettingControlButton*>(control); if (controlFormat == "addon") { // prompt for the addon CSettingAddon *setting = (CSettingAddon *)m_pSetting; std::string addonID = setting->GetValue(); if (CGUIWindowAddonBrowser::SelectAddonID(setting->GetAddonType(), addonID, setting->AllowEmpty(), buttonControl->ShowAddonDetails(), buttonControl->ShowInstalledAddons(), buttonControl->ShowInstallableAddons(), buttonControl->ShowMoreAddons()) != 1) return false; SetValid(setting->SetValue(addonID)); } else if (controlFormat == "path") SetValid(GetPath((CSettingPath *)m_pSetting)); else if (controlFormat == "action") { // simply call the OnSettingAction callback and whoever knows what to // do can do so (based on the setting's identification CSettingAction *pSettingAction = (CSettingAction *)m_pSetting; pSettingAction->OnSettingAction(pSettingAction); SetValid(true); } } else if (controlType == "slider") { float value, min, step, max; if (m_pSetting->GetType() == SettingTypeInteger) { CSettingInt *settingInt = static_cast<CSettingInt*>(m_pSetting); value = (float)settingInt->GetValue(); min = (float)settingInt->GetMinimum(); step = (float)settingInt->GetStep(); max = (float)settingInt->GetMaximum(); } else if (m_pSetting->GetType() == SettingTypeNumber) { CSettingNumber *settingNumber = static_cast<CSettingNumber*>(m_pSetting); value = (float)settingNumber->GetValue(); min = (float)settingNumber->GetMinimum(); step = (float)settingNumber->GetStep(); max = (float)settingNumber->GetMaximum(); } else return false; const CSettingControlSlider *sliderControl = static_cast<const CSettingControlSlider*>(control); CGUIDialogSlider::ShowAndGetInput(g_localizeStrings.Get(sliderControl->GetHeading()), value, min, step, max, this, NULL); SetValid(true); } return IsValid(); }
void CGUIDialogPeripheralSettings::CreateSettings() { m_bIsInitialising = true; m_usePopupSliders = g_SkinInfo->HasSkinFile("DialogSlider.xml"); if (m_item) { CPeripheral *peripheral = g_peripherals.GetByPath(m_item->GetPath()); if (peripheral) { vector<CSetting *> settings = peripheral->GetSettings(); for (size_t iPtr = 0; iPtr < settings.size(); iPtr++) { CSetting *setting = settings[iPtr]; if (!setting->IsVisible()) { CLog::Log(LOGDEBUG, "%s - invisible", __FUNCTION__); continue; } switch(setting->GetType()) { case SettingTypeBool: { CSettingBool *boolSetting = (CSettingBool *) setting; if (boolSetting) { m_boolSettings.insert(make_pair(CStdString(boolSetting->GetId()), boolSetting->GetValue())); AddBool(m_settingId++, boolSetting->GetLabel(), &m_boolSettings[boolSetting->GetId()], true); } } break; case SettingTypeInteger: { CSettingInt *intSetting = (CSettingInt *) setting; if (intSetting) { if (intSetting->GetControl()->GetFormat() == "integer") { m_intSettings.insert(make_pair(CStdString(intSetting->GetId()), (float) intSetting->GetValue())); AddSlider(m_settingId++, intSetting->GetLabel(), &m_intSettings[intSetting->GetId()], (float)intSetting->GetMinimum(), (float)intSetting->GetStep(), (float)intSetting->GetMaximum(), CGUIDialogVideoSettings::FormatInteger, false); } else if (intSetting->GetControl()->GetFormat() == "string") { m_intTextSettings.insert(make_pair(CStdString(intSetting->GetId()), intSetting->GetValue())); vector<pair<int, int> > entries; StaticIntegerSettingOptions::const_iterator entriesItr = intSetting->GetOptions().begin(); while (entriesItr != intSetting->GetOptions().end()) { entries.push_back(make_pair(entriesItr->first, entriesItr->second)); ++entriesItr; } AddSpin(m_settingId++, intSetting->GetLabel(), &m_intTextSettings[intSetting->GetId()], entries); } } } break; case SettingTypeNumber: { CSettingNumber *floatSetting = (CSettingNumber *) setting; if (floatSetting) { m_floatSettings.insert(make_pair(CStdString(floatSetting->GetId()), (float)floatSetting->GetValue())); AddSlider(m_settingId++, floatSetting->GetLabel(), &m_floatSettings[floatSetting->GetId()], (float)floatSetting->GetMinimum(), (float)floatSetting->GetStep(), (float)floatSetting->GetMaximum(), CGUIDialogVideoSettings::FormatFloat, false); } } break; case SettingTypeString: { CSettingString *stringSetting = (CSettingString *) setting; if (stringSetting) { m_stringSettings.insert(make_pair(CStdString(stringSetting->GetId()), stringSetting->GetValue())); AddString(m_settingId++, stringSetting->GetLabel(), &m_stringSettings[stringSetting->GetId()]); } } break; default: //TODO add more types if needed CLog::Log(LOGDEBUG, "%s - unknown type", __FUNCTION__); break; } } } else { CLog::Log(LOGDEBUG, "%s - no peripheral", __FUNCTION__); } } m_bIsInitialising = false; }
void CPeripheral::AddSetting(const std::string &strKey, const CSetting *setting, int order) { if (!setting) { CLog::Log(LOGERROR, "%s - invalid setting", __FUNCTION__); return; } if (!HasSetting(strKey)) { PeripheralDeviceSetting deviceSetting = { NULL, order }; switch(setting->GetType()) { case SettingTypeBool: { const CSettingBool *mappedSetting = (const CSettingBool *) setting; CSettingBool *boolSetting = new CSettingBool(strKey, *mappedSetting); if (boolSetting) { boolSetting->SetVisible(mappedSetting->IsVisible()); deviceSetting.m_setting = boolSetting; } } break; case SettingTypeInteger: { const CSettingInt *mappedSetting = (const CSettingInt *) setting; CSettingInt *intSetting = new CSettingInt(strKey, *mappedSetting); if (intSetting) { intSetting->SetVisible(mappedSetting->IsVisible()); deviceSetting.m_setting = intSetting; } } break; case SettingTypeNumber: { const CSettingNumber *mappedSetting = (const CSettingNumber *) setting; CSettingNumber *floatSetting = new CSettingNumber(strKey, *mappedSetting); if (floatSetting) { floatSetting->SetVisible(mappedSetting->IsVisible()); deviceSetting.m_setting = floatSetting; } } break; case SettingTypeString: { const CSettingString *mappedSetting = (const CSettingString *) setting; CSettingString *stringSetting = new CSettingString(strKey, *mappedSetting); if (stringSetting) { stringSetting->SetVisible(mappedSetting->IsVisible()); deviceSetting.m_setting = stringSetting; } } break; default: //! @todo add more types if needed break; } if (deviceSetting.m_setting != NULL) m_settings.insert(make_pair(strKey, deviceSetting)); } }
void CGUIDialogAudioDSPSettings::InitializeSettings() { CGUIDialogSettingsManualBase::InitializeSettings(); CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_MAIN, -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmainsettings'"); return; } // get all necessary setting groups CSettingGroup *groupAudioModeSel = AddGroup(category); if (groupAudioModeSel == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioModeSel'"); return; } CSettingGroup *groupAudioVolumeSel = AddGroup(category); if (groupAudioVolumeSel == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioVolumeSel'"); return; } CSettingGroup *groupAudioSubmenuSel = AddGroup(category); if (groupAudioSubmenuSel == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioSubmenuSel'"); return; } CSettingGroup *groupSaveAsDefault = AddGroup(category); if (groupSaveAsDefault == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupSaveAsDefault'"); return; } bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml"); CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings(); m_audioCaps.clear(); if (g_application.m_pPlayer->HasPlayer()) g_application.m_pPlayer->GetAudioCapabilities(m_audioCaps); m_ActiveStreamId = CActiveAEDSP::GetInstance().GetActiveStreamId(); m_ActiveStreamProcess = CActiveAEDSP::GetInstance().GetDSPProcess(m_ActiveStreamId); if (m_ActiveStreamId == (unsigned int)-1 || !m_ActiveStreamProcess) { m_iCategory = FindCategoryIndex(SETTING_AUDIO_CAT_MAIN); Close(true); return; } int modeUniqueId; m_ActiveStreamProcess->GetMasterModeTypeInformation(m_streamTypeUsed, m_baseTypeUsed, modeUniqueId); int modesAvailable = 0; for (int i = 0; i < AE_DSP_ASTREAM_AUTO; i++) { m_MasterModes[i].clear(); m_ActiveStreamProcess->GetAvailableMasterModes((AE_DSP_STREAMTYPE)i, m_MasterModes[i]); if (!m_MasterModes[i].empty()) modesAvailable++; } if (modesAvailable > 0) { /* about size() > 1, it is always the fallback (ignore of master processing) present. */ StaticIntegerSettingOptions modeEntries; if (m_MasterModes[AE_DSP_ASTREAM_BASIC].size() > 1) modeEntries.push_back(std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_BASIC), AE_DSP_ASTREAM_BASIC)); if (m_MasterModes[AE_DSP_ASTREAM_MUSIC].size() > 1) modeEntries.push_back(std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MUSIC), AE_DSP_ASTREAM_MUSIC)); if (m_MasterModes[AE_DSP_ASTREAM_MOVIE].size() > 1) modeEntries.push_back(std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MOVIE), AE_DSP_ASTREAM_MOVIE)); if (m_MasterModes[AE_DSP_ASTREAM_GAME].size() > 1) modeEntries.push_back(std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_GAME), AE_DSP_ASTREAM_GAME)); if (m_MasterModes[AE_DSP_ASTREAM_APP].size() > 1) modeEntries.push_back(std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_APP), AE_DSP_ASTREAM_APP)); if (m_MasterModes[AE_DSP_ASTREAM_MESSAGE].size() > 1) modeEntries.push_back(std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MESSAGE), AE_DSP_ASTREAM_MESSAGE)); if (m_MasterModes[AE_DSP_ASTREAM_PHONE].size() > 1) modeEntries.push_back(std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_PHONE), AE_DSP_ASTREAM_PHONE)); if (modesAvailable > 1 && m_MasterModes[m_streamTypeUsed].size() > 1) modeEntries.insert(modeEntries.begin(), std::pair<int, int>(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_AUTO), AE_DSP_ASTREAM_AUTO)); AddSpinner(groupAudioModeSel, SETTING_AUDIO_MAIN_STREAMTYPE, 15021, 0, (AE_DSP_STREAMTYPE)CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterStreamTypeSel, modeEntries); } bool AddonMasterModeSetupPresent = false; m_ModeList.clear(); for (unsigned int i = 0; i < m_MasterModes[m_streamTypeUsed].size(); i++) { if (m_MasterModes[m_streamTypeUsed][i]) { AE_DSP_ADDON addon; int modeId = m_MasterModes[m_streamTypeUsed][i]->ModeID(); if (modeId == AE_DSP_MASTER_MODE_ID_PASSOVER || modeId >= AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES) { m_ModeList.push_back(make_pair(g_localizeStrings.Get(m_MasterModes[m_streamTypeUsed][i]->ModeName()), modeId)); } else if (CActiveAEDSP::GetInstance().GetAudioDSPAddon(m_MasterModes[m_streamTypeUsed][i]->AddonID(), addon)) { m_ModeList.push_back(make_pair(g_localizeStrings.GetAddonString(addon->ID(), m_MasterModes[m_streamTypeUsed][i]->ModeName()), modeId)); if (!AddonMasterModeSetupPresent) AddonMasterModeSetupPresent = m_MasterModes[m_streamTypeUsed][i]->HasSettingsDialog(); } } } m_modeTypeUsed = CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[m_streamTypeUsed][m_baseTypeUsed]; CSettingInt *spinner = AddSpinner(groupAudioModeSel, SETTING_AUDIO_MAIN_MODETYPE, 15022, 0, m_modeTypeUsed, AudioModeOptionFiller); spinner->SetOptionsFiller(AudioModeOptionFiller, this); ///----------------------- // audio settings // audio volume setting m_volume = g_application.GetVolume(false); if (!g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS)) { CSettingNumber *settingAudioVolume = AddSlider(groupAudioVolumeSel, SETTING_AUDIO_MAIN_VOLUME, 13376, 0, m_volume, 14054, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM); static_cast<CSettingControlSlider*>(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel); } // audio volume amplification setting if (SupportsAudioFeature(IPC_AUD_AMP)) AddSlider(groupAudioVolumeSel, SETTING_AUDIO_MAIN_VOLUME_AMPLIFICATION, 660, 0, videoSettings.m_VolumeAmplification, 14054, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f); ///----------------------- AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_MASTER, 15025, 0, false, AddonMasterModeSetupPresent, -1); AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_OUTPUT, 15026, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_POST_PROCESS) || SupportsAudioFeature(IPC_AUD_OFFSET), -1); AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_RESAMPLE, 15033, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_RESAMPLE), -1); AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_PRE_PROC, 15039, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_PRE_PROCESS), -1); AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_MISC, 15034, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_MISCELLANEOUS), -1); AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_INFO, 15027, 0, false, true, -1); ///----------------------- AddButton(groupSaveAsDefault, SETTING_AUDIO_MAIN_MAKE_DEFAULT, 12376, 0); m_Menus.clear(); /** * Audio Master mode settings Dialog init */ { CSettingCategory *categoryMaster = AddCategory(SETTING_AUDIO_CAT_MASTER, -1); if (categoryMaster == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmastersettings'"); return; } CSettingGroup *groupMasterMode = AddGroup(categoryMaster); if (groupMasterMode == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupMasterMode'"); return; } for (unsigned int i = 0; i < m_MasterModes[m_streamTypeUsed].size(); i++) { if (m_MasterModes[m_streamTypeUsed][i]->HasSettingsDialog()) { AE_DSP_ADDON addon; if (CActiveAEDSP::GetInstance().GetAudioDSPAddon(m_MasterModes[m_streamTypeUsed][i]->AddonID(), addon)) { AE_DSP_MENUHOOKS hooks; if (CActiveAEDSP::GetInstance().GetMenuHooks(m_MasterModes[m_streamTypeUsed][i]->AddonID(), AE_DSP_MENUHOOK_MASTER_PROCESS, hooks)) { for (unsigned int j = 0; j < hooks.size(); j++) { if (hooks[j].iRelevantModeId != m_MasterModes[m_streamTypeUsed][i]->AddonModeNumber()) continue; MenuHookMember menu; menu.addonId = m_MasterModes[m_streamTypeUsed][i]->AddonID(); menu.hook.category = hooks[j].category; menu.hook.iHookId = hooks[j].iHookId; menu.hook.iLocalizedStringId = hooks[j].iLocalizedStringId; menu.hook.iRelevantModeId = hooks[j].iRelevantModeId; m_Menus.push_back(menu); std::string setting = StringUtils::Format("%s%i", SETTING_AUDIO_MASTER_SETTINGS_MENUS, (int)m_Menus.size()-1); AddButton(groupMasterMode, setting, 15041, 0); break; } } } } } } /** * Audio post processing settings Dialog init */ { CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_POST_PROCESS, -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodsppostsettings'"); return; } CSettingGroup *groupInternal = AddGroup(category); if (groupInternal == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupInternal'"); return; } CSettingGroup *groupAddon = AddGroup(category); if (groupAddon == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAddon'"); return; } // audio delay setting if (SupportsAudioFeature(IPC_AUD_OFFSET)) { CSettingNumber *settingAudioDelay = AddSlider(groupInternal, SETTING_AUDIO_POST_PROC_AUDIO_DELAY, 297, 0, videoSettings.m_AudioDelay, 0, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, 297, usePopup); static_cast<CSettingControlSlider*>(settingAudioDelay->GetControl())->SetFormatter(SettingFormatterDelay); } GetAudioDSPMenus(groupAddon, AE_DSP_MENUHOOK_POST_PROCESS); } /** * Audio add-on resampling setting dialog's */ { CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_RESAMPLING, -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspresamplesettings'"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'"); return; } GetAudioDSPMenus(group, AE_DSP_MENUHOOK_RESAMPLE); } /** * Audio add-on's pre processing setting dialog's */ { CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_PRE_PROCESS, -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodsppresettings'"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'"); return; } GetAudioDSPMenus(group, AE_DSP_MENUHOOK_PRE_PROCESS); } /** * Audio add-on's miscellaneous setting dialog's */ { CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_MISC, -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmiscsettings'"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'"); return; } GetAudioDSPMenus(group, AE_DSP_MENUHOOK_MISCELLANEOUS); } /** * Audio Information Dialog init */ { CSettingGroup *group; CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_PROC_INFO, -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspprocinfo'"); return; } m_ActiveModes.clear(); m_ActiveStreamProcess->GetActiveModes(AE_DSP_MODE_TYPE_UNDEFINED, m_ActiveModes); m_ActiveModesData.resize(m_ActiveModes.size()); group = AddGroup(category, 15089); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15089).c_str()); return; } m_InputChannels = StringUtils::Format("%i", m_ActiveStreamProcess->GetInputChannels()); AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_CHANNELS, 21444, 0, m_InputChannels); m_InputChannelNames = m_ActiveStreamProcess->GetInputChannelNames(); AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_CHANNEL_NAMES, 15091, 0, m_InputChannelNames); m_InputSamplerate = StringUtils::Format("%i Hz", (int)m_ActiveStreamProcess->GetInputSamplerate()); AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_SAMPLERATE, 613, 0, m_InputSamplerate); group = AddGroup(category, 15090); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15090).c_str()); return; } m_OutputChannels = StringUtils::Format("%i", m_ActiveStreamProcess->GetOutputChannels()); AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_CHANNELS, 21444, 0, m_OutputChannels); m_OutputChannelNames = m_ActiveStreamProcess->GetOutputChannelNames(); AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_CHANNEL_NAMES, 15091, 0, m_OutputChannelNames); m_OutputSamplerate = StringUtils::Format("%i Hz", (int)m_ActiveStreamProcess->GetOutputSamplerate()); AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_SAMPLERATE, 613, 0, m_OutputSamplerate); group = AddGroup(category, 15081); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15081).c_str()); return; } m_CPUUsage = StringUtils::Format("%.02f %%", m_ActiveStreamProcess->GetCPUUsage()); AddInfoLabelButton(group, SETTING_STREAM_INFO_CPU_USAGE, 15092, 0, m_CPUUsage); bool foundPreProcess = false, foundPostProcess = false; for (unsigned int i = 0; i < m_ActiveModes.size(); i++) { AE_DSP_ADDON addon; if (CActiveAEDSP::GetInstance().GetAudioDSPAddon(m_ActiveModes[i]->AddonID(), addon)) { std::string label; switch (m_ActiveModes[i]->ModeType()) { case AE_DSP_MODE_TYPE_INPUT_RESAMPLE: group = AddGroup(category, 15087, -1, true, true); label = StringUtils::Format(g_localizeStrings.Get(15082).c_str(), m_ActiveStreamProcess->GetProcessSamplerate()); break; case AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE: group = AddGroup(category, 15088, -1, true, true); label = StringUtils::Format(g_localizeStrings.Get(15083).c_str(), m_ActiveStreamProcess->GetOutputSamplerate()); break; case AE_DSP_MODE_TYPE_MASTER_PROCESS: group = AddGroup(category, 15084, -1, true, true); label = g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName()); break; case AE_DSP_MODE_TYPE_PRE_PROCESS: if (!foundPreProcess) { foundPreProcess = true; group = AddGroup(category, 15085, -1, true, true); } label = g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName()); break; case AE_DSP_MODE_TYPE_POST_PROCESS: if (!foundPostProcess) { foundPostProcess = true; group = AddGroup(category, 15086, -1, true, true); } label = g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName()); break; default: { label += g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName()); label += " - "; label += addon->GetFriendlyName(); } }; m_ActiveModesData[i].CPUUsage = StringUtils::Format("%.02f %%", m_ActiveModes[i]->CPUUsage()); MenuHookMember menu; menu.addonId = -1; AE_DSP_MENUHOOKS hooks; m_ActiveModesData[i].MenuListPtr = -1; if (CActiveAEDSP::GetInstance().GetMenuHooks(m_ActiveModes[i]->AddonID(), AE_DSP_MENUHOOK_INFORMATION, hooks)) { for (unsigned int j = 0; j < hooks.size(); j++) { if (hooks[j].iRelevantModeId != m_ActiveModes[i]->AddonModeNumber()) continue; menu.addonId = m_ActiveModes[i]->AddonID(); menu.hook.category = hooks[j].category; menu.hook.iHookId = hooks[j].iHookId; menu.hook.iLocalizedStringId = hooks[j].iLocalizedStringId; menu.hook.iRelevantModeId = hooks[j].iRelevantModeId; m_Menus.push_back(menu); m_ActiveModesData[i].MenuListPtr = m_Menus.size()-1; label += " ..."; break; } } m_ActiveModesData[i].MenuName = label; std::string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i); AddInfoLabelButton(group, settingId, 15041, 0, m_ActiveModesData[i].CPUUsage); } } } }