本文整理汇总了C++中DynamicIntegerSettingOptions::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicIntegerSettingOptions::begin方法的具体用法?C++ DynamicIntegerSettingOptions::begin怎么用?C++ DynamicIntegerSettingOptions::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicIntegerSettingOptions
的用法示例。
在下文中一共展示了DynamicIntegerSettingOptions::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillIntegerSettingControl
void CGUIControlSpinExSetting::FillIntegerSettingControl()
{
CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
switch (pSettingInt->GetOptionsType())
{
case SettingOptionsTypeStatic:
{
const StaticIntegerSettingOptions& options = pSettingInt->GetOptions();
for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it)
m_pSpin->AddLabel(g_localizeStrings.Get(it->first), it->second);
break;
}
case SettingOptionsTypeDynamic:
{
DynamicIntegerSettingOptions options = pSettingInt->UpdateDynamicOptions();
for (DynamicIntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); ++option)
m_pSpin->AddLabel(option->first, option->second);
break;
}
case SettingOptionsTypeNone:
default:
{
std::string strLabel;
int i = pSettingInt->GetMinimum();
const CSettingControlSpinner *control = static_cast<const CSettingControlSpinner*>(pSettingInt->GetControl());
if (control->GetMinimumLabel() > -1)
{
strLabel = g_localizeStrings.Get(control->GetMinimumLabel());
m_pSpin->AddLabel(strLabel, pSettingInt->GetMinimum());
i += pSettingInt->GetStep();
}
for (; i <= pSettingInt->GetMaximum(); i += pSettingInt->GetStep())
{
if (control->GetFormatLabel() > -1)
strLabel = StringUtils::Format(g_localizeStrings.Get(control->GetFormatLabel()).c_str(), i);
else
strLabel = StringUtils::Format(control->GetFormatString().c_str(), i);
m_pSpin->AddLabel(strLabel, i);
}
break;
}
}
m_pSpin->SetValue(pSettingInt->GetValue());
}
示例2: SerializeSettingInt
bool CSettingsOperations::SerializeSettingInt(const CSettingInt* setting, CVariant &obj)
{
if (setting == NULL)
return false;
obj["value"] = setting->GetValue();
obj["default"] = setting->GetDefault();
switch (setting->GetOptionsType())
{
case SettingOptionsTypeStatic:
{
obj["options"] = CVariant(CVariant::VariantTypeArray);
const StaticIntegerSettingOptions& options = setting->GetOptions();
for (StaticIntegerSettingOptions::const_iterator itOption = options.begin(); itOption != options.end(); ++itOption)
{
CVariant varOption(CVariant::VariantTypeObject);
varOption["label"] = g_localizeStrings.Get(itOption->first);
varOption["value"] = itOption->second;
obj["options"].push_back(varOption);
}
break;
}
case SettingOptionsTypeDynamic:
{
obj["options"] = CVariant(CVariant::VariantTypeArray);
DynamicIntegerSettingOptions options = const_cast<CSettingInt*>(setting)->UpdateDynamicOptions();
for (DynamicIntegerSettingOptions::const_iterator itOption = options.begin(); itOption != options.end(); ++itOption)
{
CVariant varOption(CVariant::VariantTypeObject);
varOption["label"] = itOption->first;
varOption["value"] = itOption->second;
obj["options"].push_back(varOption);
}
break;
}
case SettingOptionsTypeNone:
default:
obj["minimum"] = setting->GetMinimum();
obj["step"] = setting->GetStep();
obj["maximum"] = setting->GetMaximum();
break;
}
return true;
}
示例3: GetIntegerItems
bool CGUIControlListSetting::GetIntegerItems(CSetting *setting, CFileItemList &items)
{
CSettingInt *pSettingInt = (CSettingInt *)setting;
switch (pSettingInt->GetOptionsType())
{
case SettingOptionsTypeStatic:
{
const StaticIntegerSettingOptions& options = pSettingInt->GetOptions();
for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it)
{
CFileItemPtr pItem = GetItem(g_localizeStrings.Get(it->first), it->second);
if (it->second == pSettingInt->GetValue())
pItem->Select(true);
items.Add(pItem);
}
break;
}
case SettingOptionsTypeDynamic:
{
DynamicIntegerSettingOptions options = pSettingInt->UpdateDynamicOptions();
for (DynamicIntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); ++option)
{
CFileItemPtr pItem = GetItem(option->first, option->second);
if (option->second == pSettingInt->GetValue())
pItem->Select(true);
items.Add(pItem);
}
break;
}
case SettingOptionsTypeNone:
default:
return false;
}
return true;
}
示例4: GetIntegerItems
bool CGUIControlListSetting::GetIntegerItems(const CSetting *setting, CFileItemList &items)
{
const CSettingInt *pSettingInt = NULL;
std::set<int> values;
if (setting->GetType() == SettingTypeInteger)
{
pSettingInt = static_cast<const CSettingInt*>(setting);
values.insert(pSettingInt->GetValue());
}
else if (setting->GetType() == SettingTypeList)
{
const CSettingList *settingList = static_cast<const CSettingList*>(setting);
if (settingList->GetElementType() != SettingTypeInteger)
return false;
pSettingInt = static_cast<const CSettingInt*>(settingList->GetDefinition());
std::vector<CVariant> list = CSettingUtils::GetList(settingList);
for (std::vector<CVariant>::const_iterator itValue = list.begin(); itValue != list.end(); ++itValue)
{
if (!itValue->isInteger())
return false;
values.insert((int)itValue->asInteger());
}
}
else
return false;
switch (pSettingInt->GetOptionsType())
{
case SettingOptionsTypeStatic:
{
const StaticIntegerSettingOptions& options = pSettingInt->GetOptions();
for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it)
{
CFileItemPtr pItem = GetItem(g_localizeStrings.Get(it->first), it->second);
if (values.find(it->second) != values.end())
pItem->Select(true);
items.Add(pItem);
}
break;
}
case SettingOptionsTypeDynamic:
{
DynamicIntegerSettingOptions options = const_cast<CSettingInt*>(pSettingInt)->UpdateDynamicOptions();
for (DynamicIntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); ++option)
{
CFileItemPtr pItem = GetItem(option->first, option->second);
if (values.find(option->second) != values.end())
pItem->Select(true);
items.Add(pItem);
}
break;
}
case SettingOptionsTypeNone:
default:
return false;
}
return true;
}