本文整理汇总了C++中CSettingInt类的典型用法代码示例。如果您正苦于以下问题:C++ CSettingInt类的具体用法?C++ CSettingInt怎么用?C++ CSettingInt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSettingInt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetControl
void CGUIWindowAddonBrowser::UpdateButtons()
{
const CGUIControl *control = GetControl(CONTROL_AUTOUPDATE);
if (control && control->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
{ // set label
CSettingInt *setting = (CSettingInt *)CSettings::Get().GetSetting("general.addonupdates");
if (setting)
{
const StaticIntegerSettingOptions& options = setting->GetOptions();
for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it)
{
if (it->second == setting->GetValue())
{
SET_CONTROL_LABEL(CONTROL_AUTOUPDATE, it->first);
break;
}
}
}
}
else
{ // old skin with toggle button - set on if auto updates are on
SET_CONTROL_SELECTED(GetID(),CONTROL_AUTOUPDATE, CSettings::Get().GetInt("general.addonupdates") == AUTO_UPDATES_ON);
}
SET_CONTROL_SELECTED(GetID(),CONTROL_SHUTUP, CSettings::Get().GetBool("general.addonnotifications"));
SET_CONTROL_SELECTED(GetID(),CONTROL_FOREIGNFILTER, CSettings::Get().GetBool("general.addonforeignfilter"));
SET_CONTROL_SELECTED(GetID(),CONTROL_BROKENFILTER, CSettings::Get().GetBool("general.addonbrokenfilter"));
CONTROL_ENABLE(CONTROL_CHECK_FOR_UPDATES);
bool allowFilter = CAddonsDirectory::IsRepoDirectory(CURL(m_vecItems->GetPath()));
CONTROL_ENABLE_ON_CONDITION(CONTROL_FOREIGNFILTER, allowFilter);
CONTROL_ENABLE_ON_CONDITION(CONTROL_BROKENFILTER, allowFilter);
CGUIMediaWindow::UpdateButtons();
}
示例2: getChannelNames
CSetting* CGUIDialogPVRTimerSettings::AddChannelNames(CSettingGroup *group, bool bRadio)
{
std::vector< std::pair<std::string, int> > options;
getChannelNames(bRadio, options, m_selectedChannelEntry, true);
int timerChannelID;
if (m_timerItem->GetPVRTimerInfoTag()->ChannelTag())
timerChannelID = m_timerItem->GetPVRTimerInfoTag()->ChannelTag()->ChannelID();
else
timerChannelID = PVR_VIRTUAL_CHANNEL_UID;
for (std::vector< std::pair<std::string, int> >::const_iterator option = options.begin(); option != options.end(); ++option)
{
std::map<std::pair<bool, int>, int>::const_iterator channelEntry = m_channelEntries.find(std::make_pair(bRadio, option->second));
if (channelEntry != m_channelEntries.end() && channelEntry->second == timerChannelID)
{
m_selectedChannelEntry = option->second;
break;
}
}
CSettingInt *setting = AddSpinner(group, bRadio ? SETTING_TMR_CHNAME_RADIO : SETTING_TMR_CHNAME_TV, 19078, 0, m_selectedChannelEntry, ChannelNamesOptionsFiller);
if (setting == NULL)
return NULL;
// define an enable dependency with tag->m_bIsRadio
CSettingDependency depdendencyIsRadio(SettingDependencyTypeEnable, m_settingsManager);
depdendencyIsRadio.And()
->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_TMR_RADIO, "true", SettingDependencyOperatorEquals, !bRadio, m_settingsManager)));
SettingDependencies deps;
deps.push_back(depdendencyIsRadio);
setting->SetDependencies(deps);
return setting;
}
示例3: node
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();
}
示例4: GetSettingInt
int CPeripheral::GetSettingInt(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() == SettingTypeInteger)
{
CSettingInt *intSetting = (CSettingInt *) (*it).second.m_setting;
if (intSetting)
return intSetting->GetValue();
}
return 0;
}
示例5: GetSettingInt
int CPeripheral::GetSettingInt(const CStdString &strKey) const
{
map<CStdString, CSetting *>::const_iterator it = m_settings.find(strKey);
if (it != m_settings.end() && (*it).second->GetType() == SettingTypeInteger)
{
CSettingInt *intSetting = (CSettingInt *) (*it).second;
if (intSetting)
return intSetting->GetValue();
}
return 0;
}
示例6: 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());
}
示例7: if
void CGUISpinExSettingControl::Update()
{
if (!m_pSpin)
return;
if (m_pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
{
CSettingFloat *pSettingFloat = (CSettingFloat *)m_pSetting;
m_pSpin->SetFloatValue(pSettingFloat->GetData());
}
else if (m_pSetting->GetControlType() == SPIN_CONTROL_INT_PLUS || m_pSetting->GetControlType() == SPIN_CONTROL_INT)
{
CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
m_pSpin->SetValue(pSettingInt->GetData());
}
}
示例8: OnClick
bool CGUISpinExSettingControl::OnClick()
{
// TODO: Should really check for a change here (as end of spincontrols may
// cause no change)
if (m_pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
((CSettingFloat *)m_pSetting)->SetData(m_pSpin->GetFloatValue());
else
{
if (m_pSetting->GetType() == SETTINGS_TYPE_INT)
{
CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
pSettingInt->SetData(m_pSpin->GetValue());
}
}
return true;
}
示例9: bChanged
bool CPeripheral::SetSetting(const CStdString &strKey, int iValue)
{
bool bChanged(false);
map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
if (it != m_settings.end() && (*it).second->GetType() == SettingTypeInteger)
{
CSettingInt *intSetting = (CSettingInt *) (*it).second;
if (intSetting)
{
bChanged = intSetting->GetValue() != iValue;
intSetting->SetValue(iValue);
if (bChanged && m_bInitialised)
m_changedSettings.insert(strKey);
}
}
return bChanged;
}
示例10: GetSetting
void CSettingsManager::UpdateSettingByDependency(const std::string &settingId, const CSettingDependency &dependency)
{
CSetting *setting = GetSetting(settingId);
if (setting == NULL)
return;
switch (dependency.GetType())
{
case SettingDependencyTypeEnable:
// just trigger the property changed callback and a call to
// CSetting::IsEnabled() will automatically determine the new
// enabled state
OnSettingPropertyChanged(setting, "enabled");
break;
case SettingDependencyTypeUpdate:
{
SettingType type = (SettingType)setting->GetType();
if (type == SettingTypeInteger)
{
CSettingInt *settingInt = ((CSettingInt*)setting);
if (settingInt->GetOptionsType() == SettingOptionsTypeDynamic)
settingInt->UpdateDynamicOptions();
}
else if (type == SettingTypeString)
{
CSettingString *settingString = ((CSettingString*)setting);
if (settingString->GetOptionsType() == SettingOptionsTypeDynamic)
settingString->UpdateDynamicOptions();
}
break;
}
case SettingDependencyTypeVisible:
// just trigger the property changed callback and a call to
// CSetting::IsVisible() will automatically determine the new
// visible state
OnSettingPropertyChanged(setting, "visible");
break;
case SettingDependencyTypeNone:
default:
break;
}
}
示例11: GetSetting
CSettingList* CGUIDialogSettingsManualBase::AddRange(CSettingGroup *group, const std::string &id, int label, int level, int valueLower, int valueUpper, int minimum,
int step, int 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;
CSettingInt *settingDefinition = new CSettingInt(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;
}
示例12: CGUIControlBaseSetting
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();
}
示例13: if
bool CDisplaySettings::OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
{
if (setting == NULL)
return false;
const std::string &settingId = setting->GetId();
if (settingId == CSettings::SETTING_VIDEOSCREEN_SCREENMODE)
{
CSettingString *screenmodeSetting = (CSettingString*)setting;
std::string screenmode = screenmodeSetting->GetValue();
// in Eden there was no character ("i" or "p") indicating interlaced/progressive
// at the end so we just add a "p" and assume progressive
// no 3d mode existed before, so just assume std modes
if (screenmode.size() == 20)
return screenmodeSetting->SetValue(screenmode + "pstd");
if (screenmode.size() == 21)
return screenmodeSetting->SetValue(screenmode + "std");
}
else if (settingId == CSettings::SETTING_VIDEOSCREEN_VSYNC)
{
// This ifdef is intended to catch everything except Linux and FreeBSD
#if !defined(TARGET_LINUX) || defined(TARGET_DARWIN) || defined(TARGET_ANDROID) || defined(TARGET_RASPBERRY_PI)
// in the Gotham alphas through beta3 the default value for darwin and android was set incorrectly.
CSettingInt *vsyncSetting = (CSettingInt*)setting;
if (vsyncSetting->GetValue() == VSYNC_DRIVER)
return vsyncSetting->SetValue(VSYNC_ALWAYS);
#endif
}
else if (settingId == CSettings::SETTING_VIDEOSCREEN_PREFEREDSTEREOSCOPICMODE)
{
CSettingInt *stereomodeSetting = (CSettingInt*)setting;
STEREOSCOPIC_PLAYBACK_MODE playbackMode = (STEREOSCOPIC_PLAYBACK_MODE) CSettings::Get().GetInt(CSettings::SETTING_VIDEOPLAYER_STEREOSCOPICPLAYBACKMODE);
if (stereomodeSetting->GetValue() == RENDER_STEREO_MODE_OFF)
{
// if preferred playback mode was OFF, update playback mode to ignore
if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_PREFERRED)
CSettings::Get().SetInt(CSettings::SETTING_VIDEOPLAYER_STEREOSCOPICPLAYBACKMODE, STEREOSCOPIC_PLAYBACK_MODE_IGNORE);
return stereomodeSetting->SetValue(RENDER_STEREO_MODE_AUTO);
}
else if (stereomodeSetting->GetValue() == RENDER_STEREO_MODE_MONO)
{
// if preferred playback mode was MONO, update playback mode
if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_PREFERRED)
CSettings::Get().SetInt(CSettings::SETTING_VIDEOPLAYER_STEREOSCOPICPLAYBACKMODE, STEREOSCOPIC_PLAYBACK_MODE_MONO);
return stereomodeSetting->SetValue(RENDER_STEREO_MODE_AUTO);
}
}
return false;
}
示例14: switch
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);
}
示例15: if
bool CDisplaySettings::OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
{
if (setting == NULL)
return false;
const std::string &settingId = setting->GetId();
if (settingId == CSettings::SETTING_VIDEOSCREEN_SCREENMODE)
{
CSettingString *screenmodeSetting = (CSettingString*)setting;
std::string screenmode = screenmodeSetting->GetValue();
// in Eden there was no character ("i" or "p") indicating interlaced/progressive
// at the end so we just add a "p" and assume progressive
// no 3d mode existed before, so just assume std modes
if (screenmode.size() == 20)
return screenmodeSetting->SetValue(screenmode + "pstd");
if (screenmode.size() == 21)
return screenmodeSetting->SetValue(screenmode + "std");
}
else if (settingId == CSettings::SETTING_VIDEOSCREEN_PREFEREDSTEREOSCOPICMODE)
{
CSettingInt *stereomodeSetting = (CSettingInt*)setting;
STEREOSCOPIC_PLAYBACK_MODE playbackMode = (STEREOSCOPIC_PLAYBACK_MODE) CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_STEREOSCOPICPLAYBACKMODE);
if (stereomodeSetting->GetValue() == RENDER_STEREO_MODE_OFF)
{
// if preferred playback mode was OFF, update playback mode to ignore
if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_PREFERRED)
CSettings::GetInstance().SetInt(CSettings::SETTING_VIDEOPLAYER_STEREOSCOPICPLAYBACKMODE, STEREOSCOPIC_PLAYBACK_MODE_IGNORE);
return stereomodeSetting->SetValue(RENDER_STEREO_MODE_AUTO);
}
else if (stereomodeSetting->GetValue() == RENDER_STEREO_MODE_MONO)
{
// if preferred playback mode was MONO, update playback mode
if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_PREFERRED)
CSettings::GetInstance().SetInt(CSettings::SETTING_VIDEOPLAYER_STEREOSCOPICPLAYBACKMODE, STEREOSCOPIC_PLAYBACK_MODE_MONO);
return stereomodeSetting->SetValue(RENDER_STEREO_MODE_AUTO);
}
}
return false;
}