本文整理汇总了C++中CSettingInt::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CSettingInt::SetValue方法的具体用法?C++ CSettingInt::SetValue怎么用?C++ CSettingInt::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSettingInt
的用法示例。
在下文中一共展示了CSettingInt::SetValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSettingUpdate
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;
}
示例2: OnSliderChange
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);
}
示例3: OnSettingUpdate
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;
}
示例4: SetSetting
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;
}