void CGUIDialogLockSettings::InitializeSettings() { CGUIDialogSettingsManualBase::InitializeSettings(); CSettingCategory *category = AddCategory("locksettings", -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogLockSettings: unable to setup settings"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogLockSettings: unable to setup settings"); return; } if (m_getUser) { AddEdit(group, SETTING_USERNAME, 20142, 0, m_user); AddEdit(group, SETTING_PASSWORD, 12326, 0, m_locks.code, false, true); if (m_saveUserDetails != NULL) AddToggle(group, SETTING_PASSWORD_REMEMBER, 13423, 0, *m_saveUserDetails); return; } AddButton(group, SETTING_LOCKCODE, m_buttonLabel, 0); if (m_details) { CSettingGroup *groupDetails = AddGroup(category); if (groupDetails == NULL) { CLog::Log(LOGERROR, "CGUIDialogLockSettings: unable to setup settings"); return; } AddToggle(groupDetails, SETTING_LOCK_MUSIC, 20038, 0, m_locks.music); AddToggle(groupDetails, SETTING_LOCK_VIDEOS, 20039, 0, m_locks.video); AddToggle(groupDetails, SETTING_LOCK_PICTURES, 20040, 0, m_locks.pictures); AddToggle(groupDetails, SETTING_LOCK_PROGRAMS, 20041, 0, m_locks.programs); AddToggle(groupDetails, SETTING_LOCK_FILEMANAGER, 20042, 0, m_locks.files); StaticIntegerSettingOptions settingsLevelOptions; settingsLevelOptions.push_back(std::make_pair(106, LOCK_LEVEL::NONE)); settingsLevelOptions.push_back(std::make_pair(593, LOCK_LEVEL::ALL)); settingsLevelOptions.push_back(std::make_pair(10037, LOCK_LEVEL::STANDARD)); settingsLevelOptions.push_back(std::make_pair(10038, LOCK_LEVEL::ADVANCED)); settingsLevelOptions.push_back(std::make_pair(10039, LOCK_LEVEL::EXPERT)); AddSpinner(groupDetails, SETTING_LOCK_SETTINGS, 20043, 0, static_cast<int>(m_locks.settings), settingsLevelOptions); AddToggle(groupDetails, SETTING_LOCK_ADDONMANAGER, 24090, 0, m_locks.addonManager); } m_changed = false; }
void CGUIDialogAudioSubtitleSettings::AddAudioStreams(CSettingGroup *group, const std::string &settingId) { m_audioStreamStereoMode = false; if (group == NULL || settingId.empty()) return; m_audioStream = g_application.m_pPlayer->GetAudioStream(); if (m_audioStream < 0) m_audioStream = 0; // check if we have a single, stereo stream, and if so, allow us to split into // left, right or both if (g_application.m_pPlayer->GetAudioStreamCount() == 1) { CStdString strAudioInfo; g_application.m_pPlayer->GetAudioInfo(strAudioInfo); /* TODO:STRING_CLEANUP */ int iNumChannels = 0; size_t pos = strAudioInfo.find("chns:"); if (pos != std::string::npos) iNumChannels = static_cast<int>(strtol(strAudioInfo.substr(pos + 5).c_str(), NULL, 0)); std::string strAudioCodec; if (strAudioInfo.size() > 7) strAudioCodec = strAudioInfo.substr(7, strAudioInfo.find(") VBR") - 5); bool bDTS = strAudioCodec.find("DTS") != std::string::npos; bool bAC3 = strAudioCodec.find("AC3") != std::string::npos; if (iNumChannels == 2 && !(bDTS || bAC3)) { // ok, enable these options /* if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream == -1) { // default to stereo stream CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = 0; }*/ StaticIntegerSettingOptions options; for (int i = 0; i < 3; ++i) options.push_back(make_pair(i, 13320 + i)); m_audioStream = -CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream - 1; m_audioStreamStereoMode = true; AddSpinner(group, settingId, 460, 0, m_audioStream, options); return; } } AddSpinner(group, settingId, 460, 0, m_audioStream, AudioStreamsOptionFiller); }
void CGUIDialogProfileSettings::InitializeSettings() { CGUIDialogSettingsManualBase::InitializeSettings(); CSettingCategory *category = AddCategory("profilesettings", -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogProfileSettings: unable to setup settings"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogProfileSettings: unable to setup settings"); return; } AddEdit(group, SETTING_PROFILE_NAME, 20093, 0, m_name); AddButton(group, SETTING_PROFILE_IMAGE, 20065, 0); if (!m_isDefault && m_showDetails) AddButton(group, SETTING_PROFILE_DIRECTORY, 20070, 0); if (m_showDetails || (m_locks.mode == LOCK_MODE_EVERYONE && CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)) AddButton(group, SETTING_PROFILE_LOCKS, 20066, 0); if (!m_isDefault && m_showDetails) { CSettingGroup *groupMedia = AddGroup(category); if (groupMedia == NULL) { CLog::Log(LOGERROR, "CGUIDialogProfileSettings: unable to setup settings"); return; } StaticIntegerSettingOptions entries; entries.push_back(std::make_pair(20062, 0)); entries.push_back(std::make_pair(20063, 1)); entries.push_back(std::make_pair(20061, 2)); if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE) entries.push_back(std::make_pair(20107, 3)); AddSpinner(groupMedia, SETTING_PROFILE_MEDIA, 20060, 0, m_dbMode, entries); AddSpinner(groupMedia, SETTING_PROFILE_MEDIA_SOURCES, 20094, 0, m_sourcesMode, entries); } }
void CGUIDialogNetworkSetup::InitializeSettings() { CGUIDialogSettingsManualBase::InitializeSettings(); CSettingCategory *category = AddCategory("networksetupsettings", -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogNetworkSetup: unable to setup settings"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogNetworkSetup: unable to setup settings"); return; } // Add our protocols StaticIntegerSettingOptions labels; #ifdef HAS_FILESYSTEM_SMB labels.push_back(std::make_pair(20171, NET_PROTOCOL_SMB)); #endif labels.push_back(std::make_pair(20301, NET_PROTOCOL_HTTPS)); labels.push_back(std::make_pair(20300, NET_PROTOCOL_HTTP)); labels.push_back(std::make_pair(20254, NET_PROTOCOL_DAVS)); labels.push_back(std::make_pair(20253, NET_PROTOCOL_DAV)); labels.push_back(std::make_pair(20173, NET_PROTOCOL_FTP)); labels.push_back(std::make_pair(20175, NET_PROTOCOL_UPNP)); labels.push_back(std::make_pair(20304, NET_PROTOCOL_RSS)); #ifdef HAS_FILESYSTEM_NFS labels.push_back(std::make_pair(20259, NET_PROTOCOL_NFS)); #endif #ifdef HAS_FILESYSTEM_SFTP labels.push_back(std::make_pair(20260, NET_PROTOCOL_SFTP)); #endif AddSpinner(group, SETTING_PROTOCOL, 1008, 0, m_protocol, labels); AddEdit(group, SETTING_SERVER_ADDRESS, 1010, 0, m_server, true); CSettingAction *subsetting = AddButton(group, SETTING_SERVER_BROWSE, 1024, 0, false); if (subsetting != NULL) subsetting->SetParent(SETTING_SERVER_ADDRESS); AddEdit(group, SETTING_REMOTE_PATH, 1012, 0, m_path, true); AddEdit(group, SETTING_PORT_NUMBER, 1013, 0, m_port, true); AddEdit(group, SETTING_USERNAME, 1014, 0, m_username, true); AddEdit(group, SETTING_PASSWORD, 15052, 0, m_password, true, true); }
void CGUIDialogVideoSettings::InitializeSettings() { CGUIDialogSettingsManualBase::InitializeSettings(); CSettingCategory *category = AddCategory("videosettings", -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings"); return; } // get all necessary setting groups CSettingGroup *groupVideoStream = AddGroup(category); if (groupVideoStream == NULL) { CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings"); return; } CSettingGroup *groupVideo = AddGroup(category); if (groupVideo == NULL) { CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings"); return; } CSettingGroup *groupVideoPlayback = AddGroup(category); if (groupVideoPlayback == NULL) { CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings"); return; } CSettingGroup *groupStereoscopic = AddGroup(category); if (groupStereoscopic == NULL) { CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings"); return; } CSettingGroup *groupSaveAsDefault = AddGroup(category); if (groupSaveAsDefault == NULL) { CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings"); return; } bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml"); CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings(); StaticIntegerSettingOptions entries; entries.clear(); entries.push_back(std::make_pair(16039, VS_INTERLACEMETHOD_NONE)); entries.push_back(std::make_pair(16019, VS_INTERLACEMETHOD_AUTO)); entries.push_back(std::make_pair(20131, VS_INTERLACEMETHOD_RENDER_BLEND)); entries.push_back(std::make_pair(20130, VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED)); entries.push_back(std::make_pair(20129, VS_INTERLACEMETHOD_RENDER_WEAVE)); entries.push_back(std::make_pair(16022, VS_INTERLACEMETHOD_RENDER_BOB_INVERTED)); entries.push_back(std::make_pair(16021, VS_INTERLACEMETHOD_RENDER_BOB)); entries.push_back(std::make_pair(16020, VS_INTERLACEMETHOD_DEINTERLACE)); entries.push_back(std::make_pair(16036, VS_INTERLACEMETHOD_DEINTERLACE_HALF)); entries.push_back(std::make_pair(16314, VS_INTERLACEMETHOD_INVERSE_TELECINE)); entries.push_back(std::make_pair(16311, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL)); entries.push_back(std::make_pair(16310, VS_INTERLACEMETHOD_VDPAU_TEMPORAL)); entries.push_back(std::make_pair(16325, VS_INTERLACEMETHOD_VDPAU_BOB)); entries.push_back(std::make_pair(16318, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF)); entries.push_back(std::make_pair(16317, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF)); entries.push_back(std::make_pair(16314, VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE)); entries.push_back(std::make_pair(16325, VS_INTERLACEMETHOD_AUTO_ION)); entries.push_back(std::make_pair(16327, VS_INTERLACEMETHOD_VAAPI_BOB)); entries.push_back(std::make_pair(16328, VS_INTERLACEMETHOD_VAAPI_MADI)); entries.push_back(std::make_pair(16329, VS_INTERLACEMETHOD_VAAPI_MACI)); entries.push_back(std::make_pair(16330, VS_INTERLACEMETHOD_MMAL_ADVANCED)); entries.push_back(std::make_pair(16331, VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF)); entries.push_back(std::make_pair(16332, VS_INTERLACEMETHOD_MMAL_BOB)); entries.push_back(std::make_pair(16333, VS_INTERLACEMETHOD_MMAL_BOB_HALF)); entries.push_back(std::make_pair(16334, VS_INTERLACEMETHOD_IMX_FASTMOTION)); entries.push_back(std::make_pair(16335, VS_INTERLACEMETHOD_IMX_FASTMOTION_DOUBLE)); /* remove unsupported methods */ for (StaticIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); ) { if (g_application.m_pPlayer->Supports((EINTERLACEMETHOD)it->second)) ++it; else it = entries.erase(it); } if (!entries.empty()) { AddSpinner(groupVideo, SETTING_VIDEO_INTERLACEMETHOD, 16038, 0, static_cast<int>(videoSettings.m_InterlaceMethod), entries); } entries.clear(); entries.push_back(std::make_pair(16301, VS_SCALINGMETHOD_NEAREST)); entries.push_back(std::make_pair(16302, VS_SCALINGMETHOD_LINEAR)); entries.push_back(std::make_pair(16303, VS_SCALINGMETHOD_CUBIC )); entries.push_back(std::make_pair(16304, VS_SCALINGMETHOD_LANCZOS2)); entries.push_back(std::make_pair(16323, VS_SCALINGMETHOD_SPLINE36_FAST)); entries.push_back(std::make_pair(16315, VS_SCALINGMETHOD_LANCZOS3_FAST)); entries.push_back(std::make_pair(16322, VS_SCALINGMETHOD_SPLINE36)); entries.push_back(std::make_pair(16305, VS_SCALINGMETHOD_LANCZOS3)); entries.push_back(std::make_pair(16306, VS_SCALINGMETHOD_SINC8)); // entries.push_back(make_pair(?????, VS_SCALINGMETHOD_NEDI)); entries.push_back(std::make_pair(16307, VS_SCALINGMETHOD_BICUBIC_SOFTWARE)); entries.push_back(std::make_pair(16308, VS_SCALINGMETHOD_LANCZOS_SOFTWARE)); entries.push_back(std::make_pair(16309, VS_SCALINGMETHOD_SINC_SOFTWARE)); entries.push_back(std::make_pair(13120, VS_SCALINGMETHOD_VDPAU_HARDWARE)); entries.push_back(std::make_pair(16319, VS_SCALINGMETHOD_DXVA_HARDWARE)); entries.push_back(std::make_pair(16316, VS_SCALINGMETHOD_AUTO)); /* remove unsupported methods */ for(StaticIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); ) { if (g_application.m_pPlayer->Supports((ESCALINGMETHOD)it->second)) ++it; else it = entries.erase(it); } AddSpinner(groupVideo, SETTING_VIDEO_SCALINGMETHOD, 16300, 0, static_cast<int>(videoSettings.m_ScalingMethod), entries); #ifdef HAS_VIDEO_PLAYBACK AddVideoStreams(groupVideoStream, SETTING_VIDEO_STREAM); if (g_application.m_pPlayer->Supports(RENDERFEATURE_STRETCH) || g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO)) { entries.clear(); for (int i = 0; i < 7; ++i) entries.push_back(std::make_pair(630 + i, i)); AddSpinner(groupVideo, SETTING_VIDEO_VIEW_MODE, 629, 0, videoSettings.m_ViewMode, entries); } if (g_application.m_pPlayer->Supports(RENDERFEATURE_ZOOM)) AddSlider(groupVideo, SETTING_VIDEO_ZOOM, 216, 0, videoSettings.m_CustomZoomAmount, "%2.2f", 0.5f, 0.01f, 2.0f, 216, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_VERTICAL_SHIFT)) AddSlider(groupVideo, SETTING_VIDEO_VERTICAL_SHIFT, 225, 0, videoSettings.m_CustomVerticalShift, "%2.2f", -2.0f, 0.01f, 2.0f, 225, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO)) AddSlider(groupVideo, SETTING_VIDEO_PIXEL_RATIO, 217, 0, videoSettings.m_CustomPixelRatio, "%2.2f", 0.5f, 0.01f, 2.0f, 217, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_POSTPROCESS)) AddToggle(groupVideo, SETTING_VIDEO_POSTPROCESS, 16400, 0, videoSettings.m_PostProcess); if (g_application.m_pPlayer->Supports(RENDERFEATURE_BRIGHTNESS)) AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_BRIGHTNESS, 464, 0, static_cast<int>(videoSettings.m_Brightness), 14047, 1, 464, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_CONTRAST)) AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_CONTRAST, 465, 0, static_cast<int>(videoSettings.m_Contrast), 14047, 1, 465, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_GAMMA)) AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_GAMMA, 466, 0, static_cast<int>(videoSettings.m_Gamma), 14047, 1, 466, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_NOISE)) AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_NOISE, 16312, 0, videoSettings.m_NoiseReduction, "%2.2f", 0.0f, 0.01f, 1.0f, 16312, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_SHARPNESS)) AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_SHARPNESS, 16313, 0, videoSettings.m_Sharpness, "%2.2f", -1.0f, 0.02f, 1.0f, 16313, usePopup); if (g_application.m_pPlayer->Supports(RENDERFEATURE_NONLINSTRETCH)) AddToggle(groupVideoPlayback, SETTING_VIDEO_NONLIN_STRETCH, 659, 0, videoSettings.m_CustomNonLinStretch); #endif // stereoscopic settings entries.clear(); entries.push_back(std::make_pair(16316, RENDER_STEREO_MODE_OFF)); entries.push_back(std::make_pair(36503, RENDER_STEREO_MODE_SPLIT_HORIZONTAL)); entries.push_back(std::make_pair(36504, RENDER_STEREO_MODE_SPLIT_VERTICAL)); AddSpinner(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICMODE , 36535, 0, videoSettings.m_StereoMode, entries); AddToggle(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICINVERT, 36536, 0, videoSettings.m_StereoInvert); // general settings AddButton(groupSaveAsDefault, SETTING_VIDEO_MAKE_DEFAULT, 12376, 0); AddButton(groupSaveAsDefault, SETTING_VIDEO_CALIBRATION, 214, 0); }
void CGUIDialogMediaFilter::InitializeSettings() { CGUIDialogSettingsManualBase::InitializeSettings(); if (m_filter == NULL) return; Reset(true); int handledRules = 0; CSettingCategory *category = AddCategory("filter", -1); if (category == NULL) { CLog::Log(LOGERROR, "CGUIDialogMediaFilter: unable to setup filters"); return; } CSettingGroup *group = AddGroup(category); if (group == NULL) { CLog::Log(LOGERROR, "CGUIDialogMediaFilter: unable to setup filters"); return; } for (unsigned int index = 0; index < NUM_FILTERS; index++) { if (filterList[index].mediaType != m_mediaType) continue; Filter filter = filterList[index]; // check the smartplaylist if it contains a matching rule for (CDatabaseQueryRules::iterator rule = m_filter->m_ruleCombination.m_rules.begin(); rule != m_filter->m_ruleCombination.m_rules.end(); rule++) { if ((*rule)->m_field == filter.field) { filter.rule = (CSmartPlaylistRule *)rule->get(); handledRules++; break; } } std::string settingId = StringUtils::Format("filter.%s.%d", filter.mediaType.c_str(), filter.field); if (filter.controlType == "edit") { CVariant data; if (filter.rule != NULL && filter.rule->m_parameter.size() == 1) data = filter.rule->m_parameter.at(0); if (filter.settingType == SettingTypeString) filter.setting = AddEdit(group, settingId, filter.label, 0, data.asString(), true, false, filter.label, true); else if (filter.settingType == SettingTypeInteger) filter.setting = AddEdit(group, settingId, filter.label, 0, static_cast<int>(data.asInteger()), 0, 1, 0, false, filter.label, true); else if (filter.settingType == SettingTypeNumber) filter.setting = AddEdit(group, settingId, filter.label, 0, data.asFloat(), 0.0f, 1.0f, 0.0f, false, filter.label, true); } else if (filter.controlType == "toggle") { int value = CHECK_ALL; if (filter.rule != NULL) value = filter.rule->m_operator == CDatabaseQueryRule::OPERATOR_TRUE ? CHECK_YES : CHECK_NO; StaticIntegerSettingOptions entries; entries.push_back(pair<int, int>(CHECK_LABEL_ALL, CHECK_ALL)); entries.push_back(pair<int, int>(CHECK_LABEL_NO, CHECK_NO)); entries.push_back(pair<int, int>(CHECK_LABEL_YES, CHECK_YES)); filter.setting = AddSpinner(group, settingId, filter.label, 0, value, entries, true); } else if (filter.controlType == "list") { std::vector<std::string> values; if (filter.rule != NULL && filter.rule->m_parameter.size() > 0) { values = StringUtils::Split(filter.rule->GetParameter(), DATABASEQUERY_RULE_VALUE_SEPARATOR); if (values.size() == 1 && values.at(0).empty()) values.erase(values.begin()); } filter.setting = AddList(group, settingId, filter.label, 0, values, GetStringListOptions, filter.label); } else if (filter.controlType == "range") { CVariant valueLower, valueUpper; if (filter.rule != NULL) { if (filter.rule->m_parameter.size() == 2) { valueLower = filter.rule->m_parameter.at(0); valueUpper = filter.rule->m_parameter.at(1); } else { DeleteRule(filter.field); filter.rule = NULL; } } if (filter.settingType == SettingTypeInteger) { int min, interval, max; GetRange(filter, min, interval, max); // don't create the filter if there's no real range if (min == max) break; int iValueLower = valueLower.isNull() ? min : static_cast<int>(valueLower.asInteger()); int iValueUpper = valueUpper.isNull() ? max : static_cast<int>(valueUpper.asInteger()); if (filter.controlFormat == "integer") filter.setting = AddRange(group, settingId, filter.label, 0, iValueLower, iValueUpper, min, interval, max, -1, 21469, true); else if (filter.controlFormat == "percentage") filter.setting = AddPercentageRange(group, settingId, filter.label, 0, iValueLower, iValueUpper, -1, 1, 21469, true); else if (filter.controlFormat == "date") filter.setting = AddDateRange(group, settingId, filter.label, 0, iValueLower, iValueUpper, min, interval, max, -1, 21469, true); else if (filter.controlFormat == "time") filter.setting = AddTimeRange(group, settingId, filter.label, 0, iValueLower, iValueUpper, min, interval, max, -1, 21469, true); } else if (filter.settingType == SettingTypeNumber) { float min, interval, max; GetRange(filter, min, interval, max); // don't create the filter if there's no real range if (min == max) break; float fValueLower = valueLower.isNull() ? min : valueLower.asFloat(); float fValueUpper = valueUpper.isNull() ? max : valueUpper.asFloat(); filter.setting = AddRange(group, settingId, filter.label, 0, fValueLower, fValueUpper, min, interval, max, -1, 21469, true); } } else { if (filter.rule != NULL) handledRules--; CLog::Log(LOGWARNING, "CGUIDialogMediaFilter: filter %d of media type %s with unknown control type '%s'", filter.field, filter.mediaType.c_str(), filter.controlType.c_str()); continue; } if (filter.setting == NULL) { if (filter.rule != NULL) handledRules--; CLog::Log(LOGWARNING, "CGUIDialogMediaFilter: failed to create filter %d of media type %s with control type '%s'", filter.field, filter.mediaType.c_str(), filter.controlType.c_str()); continue; } m_filters.insert(make_pair(settingId, filter)); } // make sure that no change in capacity size is needed when adding new rules // which would copy around the rules and our pointers in the Filter struct // wouldn't work anymore m_filter->m_ruleCombination.m_rules.reserve(m_filters.size() + (m_filter->m_ruleCombination.m_rules.size() - handledRules)); }
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); } } } }