本文整理汇总了C++中CSettingSection类的典型用法代码示例。如果您正苦于以下问题:C++ CSettingSection类的具体用法?C++ CSettingSection怎么用?C++ CSettingSection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSettingSection类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
bool CSettingsManager::Initialize(const TiXmlElement *root)
{
CExclusiveLock lock(m_critical);
CExclusiveLock settingsLock(m_settingsCritical);
if (m_initialized || root == NULL)
return false;
if (!StringUtils::EqualsNoCase(root->ValueStr(), SETTING_XML_ROOT))
{
CLog::Log(LOGERROR, "CSettingsManager: error reading settings definition: doesn't contain <settings> tag");
return false;
}
const TiXmlNode *sectionNode = root->FirstChild(SETTING_XML_ELM_SECTION);
while (sectionNode != NULL)
{
std::string sectionId;
if (CSettingSection::DeserializeIdentification(sectionNode, sectionId))
{
CSettingSection *section = NULL;
SettingSectionMap::iterator itSection = m_sections.find(sectionId);
bool update = (itSection != m_sections.end());
if (!update)
section = new CSettingSection(sectionId, this);
else
section = itSection->second;
if (section->Deserialize(sectionNode, update))
AddSection(section);
else
{
CLog::Log(LOGWARNING, "CSettingsManager: unable to read section \"%s\"", sectionId.c_str());
if (!update)
delete section;
}
}
sectionNode = sectionNode->NextSibling(SETTING_XML_ELM_SECTION);
}
return true;
}
示例2: lock
bool CSettingManager::Initialize(const XMLElement *root)
{
XR::CSingleLock lock(m_critical);
XR::CSingleLock lock2(m_settingsCritical);
if (m_initialized || root == NULL)
return false;
if (!StringUtils::EqualsNoCase(root->Value(), "settings"))
{
LOGERR("CSettingsManager: error reading settings definition: doesn't contain <settings> tag");
return false;
}
const XMLElement *sectionNode = root->FirstChildElement("section");
while (sectionNode != nullptr) {
std::string settingId;
if (CSetting::DeserializeIdentification(sectionNode, settingId)) {
CSettingSection* section = nullptr;
SectionMap::iterator itSection = m_sections.find(settingId);
bool update = (itSection != m_sections.end());
if (!update)
section = new CSettingSection(settingId, this);
else
section = itSection->second;
if (section->Deserialize(sectionNode, update))
AddSection(section);
else {
LOGWARN("CSettingsManager: unable to read section \"%s\"", settingId.c_str());
if (!update)
delete section;
}
}
sectionNode = sectionNode->NextSiblingElement("section");
}
m_initialized = true;
return true;
}
示例3: FreeControls
void CGUIDialogSettingsBase::SetupControls(bool createSettings /* = true */)
{
// cleanup first, if necessary
FreeControls();
// get the section
CSettingSection *section = GetSection();
if (section == NULL)
return;
// update the screen string
SetHeading(section->GetLabel());
// get the categories we need
m_categories = section->GetCategories((SettingLevel)GetSettingLevel());
if (m_categories.empty())
m_categories.push_back(m_dummyCategory);
// get all controls
m_pOriginalSpin = dynamic_cast<CGUISpinControlEx*>(GetControl(CONTROL_DEFAULT_SPIN));
m_pOriginalSlider = dynamic_cast<CGUISettingsSliderControl*>(GetControl(CONTROL_DEFAULT_SLIDER));
m_pOriginalRadioButton = dynamic_cast<CGUIRadioButtonControl *>(GetControl(CONTROL_DEFAULT_RADIOBUTTON));
m_pOriginalCategoryButton = dynamic_cast<CGUIButtonControl *>(GetControl(CONTROL_DEFAULT_CATEGORY_BUTTON));
m_pOriginalButton = dynamic_cast<CGUIButtonControl *>(GetControl(CONTROL_DEFAULT_BUTTON));
m_pOriginalImage = dynamic_cast<CGUIImage *>(GetControl(CONTROL_DEFAULT_SEPARATOR));
m_pOriginalEdit = dynamic_cast<CGUIEditControl *>(GetControl(CONTROL_DEFAULT_EDIT));
if (!m_pOriginalEdit && m_pOriginalButton)
{
m_pOriginalEdit = new CGUIEditControl(*m_pOriginalButton);
m_newOriginalEdit = true;
}
if (m_pOriginalSpin) m_pOriginalSpin->SetVisible(false);
if (m_pOriginalSlider) m_pOriginalSlider->SetVisible(false);
if (m_pOriginalRadioButton) m_pOriginalRadioButton->SetVisible(false);
if (m_pOriginalButton) m_pOriginalButton->SetVisible(false);
if (m_pOriginalCategoryButton) m_pOriginalCategoryButton->SetVisible(false);
m_pOriginalEdit->SetVisible(false);
if (m_pOriginalImage) m_pOriginalImage->SetVisible(false);
if (m_pOriginalCategoryButton != NULL)
{
// setup our control groups...
CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(CATEGORY_GROUP_ID));
if (!group)
return;
// go through the categories and create the necessary buttons
int buttonIdOffset = 0;
for (SettingCategoryList::const_iterator category = m_categories.begin(); category != m_categories.end(); category++)
{
CGUIButtonControl *pButton = NULL;
if (m_pOriginalCategoryButton->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON)
pButton = new CGUIToggleButtonControl(*(CGUIToggleButtonControl *)m_pOriginalCategoryButton);
else
pButton = new CGUIButtonControl(*m_pOriginalCategoryButton);
pButton->SetLabel(GetLocalizedString((*category)->GetLabel()));
pButton->SetID(CONTROL_SETTINGS_START_BUTTONS + buttonIdOffset);
pButton->SetVisible(true);
pButton->AllocResources();
group->AddControl(pButton);
buttonIdOffset++;
}
}
if (createSettings)
CreateSettings();
// set focus correctly depending on whether there are categories visible or not
m_defaultControl = m_pOriginalCategoryButton != NULL ? CATEGORY_GROUP_ID : SETTINGS_GROUP_ID;
}
示例4: lock
bool CSettingsManager::Initialize(const TiXmlElement *root)
{
CExclusiveLock lock(m_critical);
CExclusiveLock settingsLock(m_settingsCritical);
if (m_initialized || root == NULL)
return false;
if (!StringUtils::EqualsNoCase(root->ValueStr(), SETTING_XML_ROOT))
{
CLog::Log(LOGERROR, "CSettingsManager: error reading settings definition: doesn't contain <settings> tag");
return false;
}
const TiXmlNode *sectionNode = root->FirstChild(SETTING_XML_ELM_SECTION);
while (sectionNode != NULL)
{
std::string sectionId;
if (CSettingSection::DeserializeIdentification(sectionNode, sectionId))
{
CSettingSection *section = NULL;
SettingSectionMap::iterator itSection = m_sections.find(sectionId);
bool update = (itSection != m_sections.end());
if (!update)
section = new CSettingSection(sectionId, this);
else
section = itSection->second;
if (section->Deserialize(sectionNode, update))
{
section->CheckRequirements();
if (!update)
m_sections[section->GetId()] = section;
// get all settings and add them to the settings map
for (SettingCategoryList::const_iterator categoryIt = section->GetCategories().begin(); categoryIt != section->GetCategories().end(); ++categoryIt)
{
(*categoryIt)->CheckRequirements();
for (SettingGroupList::const_iterator groupIt = (*categoryIt)->GetGroups().begin(); groupIt != (*categoryIt)->GetGroups().end(); ++groupIt)
{
(*groupIt)->CheckRequirements();
for (SettingList::const_iterator settingIt = (*groupIt)->GetSettings().begin(); settingIt != (*groupIt)->GetSettings().end(); ++settingIt)
{
(*settingIt)->CheckRequirements();
const std::string &settingId = (*settingIt)->GetId();
SettingMap::iterator setting = m_settings.find(settingId);
if (setting == m_settings.end())
{
Setting tmpSetting = { NULL };
std::pair<SettingMap::iterator, bool> tmpIt = m_settings.insert(make_pair(settingId, tmpSetting));
setting = tmpIt.first;
}
if (setting->second.setting == NULL)
{
setting->second.setting = *settingIt;
(*settingIt)->m_callback = this;
}
}
}
}
}
else
{
CLog::Log(LOGWARNING, "CSettingsManager: unable to read section \"%s\"", sectionId.c_str());
if (!update)
delete section;
}
}
sectionNode = sectionNode->NextSibling(SETTING_XML_ELM_SECTION);
}
for (SettingMap::iterator itSettingDep = m_settings.begin(); itSettingDep != m_settings.end(); ++itSettingDep)
{
if (itSettingDep->second.setting == NULL)
continue;
const SettingDependencies& deps = itSettingDep->second.setting->GetDependencies();
for (SettingDependencies::const_iterator depIt = deps.begin(); depIt != deps.end(); ++depIt)
{
std::set<std::string> settingIds = depIt->GetSettings();
for (std::set<std::string>::const_iterator itSettingId = settingIds.begin(); itSettingId != settingIds.end(); ++itSettingId)
{
SettingMap::iterator setting = m_settings.find(*itSettingId);
if (setting == m_settings.end())
continue;
bool newDep = true;
SettingDependencies &settingDeps = setting->second.dependencies[itSettingDep->first];
for (SettingDependencies::const_iterator itDeps = settingDeps.begin(); itDeps != settingDeps.end(); ++itDeps)
{
if (itDeps->GetType() == depIt->GetType())
{
newDep = false;
break;
}
}
if (newDep)
//.........这里部分代码省略.........
示例5: FreeControls
void CGUIWindowSettingsCategory::SetupControls(bool createSettings /* = true */)
{
// cleanup first, if necessary
FreeControls();
m_pOriginalSpin = (CGUISpinControlEx*)GetControl(CONTROL_DEFAULT_SPIN);
m_pOriginalRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_DEFAULT_RADIOBUTTON);
m_pOriginalCategoryButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_CATEGORY_BUTTON);
m_pOriginalButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_BUTTON);
m_pOriginalImage = (CGUIImage *)GetControl(CONTROL_DEFAULT_SEPARATOR);
if (!m_pOriginalCategoryButton || !m_pOriginalSpin || !m_pOriginalRadioButton || !m_pOriginalButton)
return ;
m_pOriginalEdit = (CGUIEditControl *)GetControl(CONTROL_DEFAULT_EDIT);
if (!m_pOriginalEdit || m_pOriginalEdit->GetControlType() != CGUIControl::GUICONTROL_EDIT)
{
delete m_pOriginalEdit;
m_pOriginalEdit = new CGUIEditControl(*m_pOriginalButton);
newOriginalEdit = true;
}
m_pOriginalSpin->SetVisible(false);
m_pOriginalRadioButton->SetVisible(false);
m_pOriginalButton->SetVisible(false);
m_pOriginalCategoryButton->SetVisible(false);
m_pOriginalEdit->SetVisible(false);
if (m_pOriginalImage) m_pOriginalImage->SetVisible(false);
// setup our control groups...
CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CATEGORY_GROUP_ID);
if (!group)
return;
CSettingSection *section = GetSection(m_iSection);
if (section == NULL)
return;
// update the screen string
SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, section->GetLabel());
SET_CONTROL_LABEL(CONTRL_BTN_LEVELS, 10036 + (int)CViewStateSettings::Get().GetSettingLevel());
// get the categories we need
m_categories = section->GetCategories(CViewStateSettings::Get().GetSettingLevel());
if (m_categories.empty())
m_categories.push_back(m_dummyCategory);
// go through the categories and create the necessary buttons
int buttonIdOffset = 0;
for (SettingCategoryList::const_iterator category = m_categories.begin(); category != m_categories.end(); ++category)
{
CGUIButtonControl *pButton = NULL;
if (m_pOriginalCategoryButton->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON)
pButton = new CGUIToggleButtonControl(*(CGUIToggleButtonControl *)m_pOriginalCategoryButton);
else
pButton = new CGUIButtonControl(*m_pOriginalCategoryButton);
pButton->SetLabel(g_localizeStrings.Get((*category)->GetLabel()));
pButton->SetID(CONTROL_START_BUTTONS + buttonIdOffset);
pButton->SetVisible(true);
pButton->AllocResources();
group->AddControl(pButton);
buttonIdOffset++;
}
if (createSettings)
CreateSettings();
// set focus correctly
m_defaultControl = CONTROL_START_BUTTONS;
}