本文整理汇总了C++中CSetting::GetId方法的典型用法代码示例。如果您正苦于以下问题:C++ CSetting::GetId方法的具体用法?C++ CSetting::GetId怎么用?C++ CSetting::GetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSetting
的用法示例。
在下文中一共展示了CSetting::GetId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreeSettingsControls
std::set<std::string> CGUIDialogSettingsBase::CreateSettings()
{
FreeSettingsControls();
std::set<std::string> settingMap;
if (m_categories.size() <= 0)
return settingMap;
if (m_iCategory < 0 || m_iCategory >= (int)m_categories.size())
m_iCategory = 0;
CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(SETTINGS_GROUP_ID));
if (group == NULL)
return settingMap;
const CSettingCategory* category = m_categories.at(m_iCategory);
if (category == NULL)
return settingMap;
// set the description of the current category
SetDescription(category->GetHelp());
const SettingGroupList& groups = category->GetGroups((SettingLevel)GetSettingLevel());
int iControlID = CONTROL_SETTINGS_START_CONTROL;
bool first = true;
for (SettingGroupList::const_iterator groupIt = groups.begin(); groupIt != groups.end(); groupIt++)
{
if (*groupIt == NULL)
continue;
const SettingList& settings = (*groupIt)->GetSettings((SettingLevel)GetSettingLevel());
if (settings.size() <= 0)
continue;
if (first)
first = false;
else
AddSeparator(group->GetWidth(), iControlID);
for (SettingList::const_iterator settingIt = settings.begin(); settingIt != settings.end(); settingIt++)
{
CSetting *pSetting = *settingIt;
settingMap.insert(pSetting->GetId());
AddSetting(pSetting, group->GetWidth(), iControlID);
}
}
if (AllowResettingSettings() && !settingMap.empty())
{
// add "Reset" control
AddSeparator(group->GetWidth(), iControlID);
AddSetting(m_resetSetting, group->GetWidth(), iControlID);
}
// update our settings (turns controls on/off as appropriate)
UpdateSettings();
return settingMap;
}
示例2: UpdateControl
void CGUIWindowSettingsCategory::UpdateControl(const std::string &dependingSetting, const CSettingDependency &dependency)
{
if (dependingSetting.empty())
return;
BaseSettingControlPtr pControl = GetSettingControl(dependingSetting);
if (pControl == NULL)
return;
CSetting *pSetting = pControl->GetSetting();
if (pSetting == NULL)
return;
CheckDependency(pControl, dependency);
const SettingDependencyMap& deps = m_settings.GetDependencies(pSetting->GetId());
for (SettingDependencyMap::const_iterator depsIt = deps.begin(); depsIt != deps.end(); depsIt++)
{
for (SettingDependencies::const_iterator depIt = depsIt->second.begin(); depIt != depsIt->second.end(); depIt++)
UpdateControl(depsIt->first, *depIt);
}
// update GUI of the changed setting as the change could have been triggered by something else
pControl->Update();
}
示例3: CreateSettings
void CGUIWindowSettingsCategory::CreateSettings()
{
FreeSettingsControls();
if (m_categories.size() <= 0)
return;
if (m_iCategory < 0 || m_iCategory >= (int)m_categories.size())
m_iCategory = 0;
CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
if (group == NULL)
return;
const CSettingCategory* category = m_categories.at(m_iCategory);
if (category == NULL)
return;
// set the description of the current category
SetDescription(category->GetHelp());
std::set<std::string> settingMap;
const SettingGroupList& groups = category->GetGroups(CViewStateSettings::Get().GetSettingLevel());
int iControlID = CONTROL_START_CONTROL;
bool first = true;
for (SettingGroupList::const_iterator groupIt = groups.begin(); groupIt != groups.end(); groupIt++)
{
if (*groupIt == NULL)
continue;
const SettingList& settings = (*groupIt)->GetSettings(CViewStateSettings::Get().GetSettingLevel());
if (settings.size() <= 0)
continue;
if (first)
first = false;
else
AddSeparator(group->GetWidth(), iControlID);
for (SettingList::const_iterator settingIt = settings.begin(); settingIt != settings.end(); settingIt++)
{
CSetting *pSetting = *settingIt;
settingMap.insert(pSetting->GetId());
AddSetting(pSetting, group->GetWidth(), iControlID);
}
}
if (settingMap.size() > 0)
m_settings.RegisterCallback(this, settingMap);
// update our settings (turns controls on/off as appropriate)
UpdateSettings();
}
示例4: InitializeSettings
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__);
//.........这里部分代码省略.........
示例5: OnMessage
bool CGUIDialogAudioDSPSettings::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
{
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl >= CONTROL_SETTINGS_START_CONTROL && iControl < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size()))
{
CSetting *setting = GetSettingControl(iControl)->GetSetting();
if (setting != NULL)
{
if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_MASTER)
OpenMenu(SETTING_AUDIO_CAT_MASTER);
else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_OUTPUT)
OpenMenu(SETTING_AUDIO_CAT_POST_PROCESS);
else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_RESAMPLE)
OpenMenu(SETTING_AUDIO_CAT_RESAMPLING);
else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_PRE_PROC)
OpenMenu(SETTING_AUDIO_CAT_PRE_PROCESS);
else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_MISC)
OpenMenu(SETTING_AUDIO_CAT_MISC);
else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_INFO)
{
SetupView();
OpenMenu(SETTING_AUDIO_CAT_PROC_INFO);
m_GetCPUUsage = true;
}
else
{
if (setting->GetId().substr(0, 19) == SETTING_AUDIO_PROC_SETTINGS_MENUS)
OpenAudioDSPMenu(strtol(setting->GetId().substr(19).c_str(), NULL, 0));
else if (setting->GetId().substr(0, 21) == SETTING_AUDIO_MASTER_SETTINGS_MENUS)
OpenAudioDSPMenu(strtol(setting->GetId().substr(21).c_str(), NULL, 0));
else if (setting->GetId().substr(0, 27) == SETTING_STREAM_INFO_MODE_CPU_USAGE)
{
if (!OpenAudioDSPMenu(m_ActiveModesData[strtol(setting->GetId().substr(27).c_str(), NULL, 0)].MenuListPtr))
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(15031), g_localizeStrings.Get(416));
}
}
}
}
break;
}
default:
break;
}
return CGUIDialogSettingsManualBase::OnMessage(message);
}
示例6: if
std::set<std::string> CGUIDialogSettingsBase::CreateSettings()
{
FreeSettingsControls();
std::set<std::string> settingMap;
if (m_categories.size() <= 0)
return settingMap;
if (m_iCategory < 0 || m_iCategory >= (int)m_categories.size())
m_iCategory = 0;
CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(SETTINGS_GROUP_ID));
if (group == NULL)
return settingMap;
const CSettingCategory* category = m_categories.at(m_iCategory);
if (category == NULL)
return settingMap;
// set the description of the current category
SetDescription(category->GetHelp());
const SettingGroupList& groups = category->GetGroups((SettingLevel)GetSettingLevel());
int iControlID = CONTROL_SETTINGS_START_CONTROL;
bool first = true;
for (SettingGroupList::const_iterator groupIt = groups.begin(); groupIt != groups.end(); ++groupIt)
{
if (*groupIt == NULL)
continue;
const SettingList& settings = (*groupIt)->GetSettings((SettingLevel)GetSettingLevel());
if (settings.size() <= 0)
continue;
const CSettingControlTitle *title = dynamic_cast<CSettingControlTitle *>((*groupIt)->GetControl());
bool hideSeparator = title ? title->IsSeparatorHidden() : false;
bool separatorBelowGroupLabel = title ? title->IsSeparatorBelowLabel() : false;
int groupLabel = (*groupIt)->GetLabel();
// hide the separator for the first settings grouplist if it
// is the very first item in the list (also above the label)
if (first)
{
first = false;
if (groupLabel <= 0)
hideSeparator = true;
}
else if (!separatorBelowGroupLabel && !hideSeparator)
AddSeparator(group->GetWidth(), iControlID);
if (groupLabel > 0)
AddLabel(group->GetWidth(), iControlID, groupLabel);
if (separatorBelowGroupLabel && !hideSeparator)
AddSeparator(group->GetWidth(), iControlID);
for (SettingList::const_iterator settingIt = settings.begin(); settingIt != settings.end(); ++settingIt)
{
CSetting *pSetting = *settingIt;
settingMap.insert(pSetting->GetId());
AddSetting(pSetting, group->GetWidth(), iControlID);
}
}
if (AllowResettingSettings() && !settingMap.empty())
{
// add "Reset" control
AddSeparator(group->GetWidth(), iControlID);
AddSetting(m_resetSetting, group->GetWidth(), iControlID);
}
// update our settings (turns controls on/off as appropriate)
UpdateSettings();
return settingMap;
}