Example #1
0
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;
}
Example #2
0
bool CPeripheral::SetSetting(const CStdString &strKey, const CStdString &strValue)
{
  bool bChanged(false);
  map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
  if (it != m_settings.end())
  {
    if ((*it).second->GetType() == SettingTypeString)
    {
        CSettingString *stringSetting = (CSettingString *) (*it).second;
      if (stringSetting)
      {
        bChanged = !StringUtils::EqualsNoCase(stringSetting->GetValue(), strValue);
        stringSetting->SetValue(strValue);
        if (bChanged && m_bInitialised)
          m_changedSettings.insert(strKey);
      }
    }
    else if ((*it).second->GetType() == SettingTypeInteger)
      bChanged = SetSetting(strKey, (int) (strValue.empty() ? 0 : atoi(strValue.c_str())));
    else if ((*it).second->GetType() == SettingTypeNumber)
      bChanged = SetSetting(strKey, (float) (strValue.empty() ? 0 : atof(strValue.c_str())));
    else if ((*it).second->GetType() == SettingTypeBool)
      bChanged = SetSetting(strKey, strValue.Equals("1"));
  }
  return bChanged;
}
Example #3
0
void CGUIWindowSettingsCategory::FillControl(CSetting *pSetting, CGUIControl *pSettingControl)
{
  void *filler = CSettings::Get().GetSettingOptionsFiller(pSetting);
  if (filler == NULL)
    return;

  if (pSetting->GetType() == SettingTypeInteger)
  {
    CSettingInt *pSettingInt = (CSettingInt*)pSetting;

    // get the list of options and the current option
    IntegerSettingOptions options;
    int currentOption = pSettingInt->GetValue();
    ((IntegerSettingOptionsFiller)filler)(pSetting, options, currentOption);

    // clear the spinner control
    CGUISpinControlEx *pSpinControl = (CGUISpinControlEx *)pSettingControl;
    pSpinControl->Clear();

    // fill the spinner control
    for (IntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); option++)
      pSpinControl->AddLabel(option->first, option->second);

    // set the current option
    pSpinControl->SetValue(currentOption);

    // check if the current setting has changed
    if (currentOption != pSettingInt->GetValue())
      pSettingInt->SetValue(currentOption);
  }
  else if (pSetting->GetType() == SettingTypeString)
  {
    CSettingString *pSettingString = (CSettingString*)pSetting;

    // get the list of options and the current option
    StringSettingOptions options;
    std::string currentOption = pSettingString->GetValue();
    ((StringSettingOptionsFiller)filler)(pSetting, options, currentOption);

    // clear the spinner control
    CGUISpinControlEx *pSpinControl = (CGUISpinControlEx *)pSettingControl;
    pSpinControl->Clear();

    // fill the spinner control
    for (StringSettingOptions::const_iterator option = options.begin(); option != options.end(); option++)
      pSpinControl->AddLabel(option->first, option->second);

    // set the current option
    pSpinControl->SetStringValue(currentOption);

    // check if the current setting has changed
    if (currentOption.compare(pSettingString->GetValue()) != 0)
      pSettingString->SetValue(currentOption);
  }
}
Example #4
0
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;
}
Example #5
0
bool CDisplaySettings::OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
{
  if (setting == NULL)
    return false;

  const std::string &settingId = setting->GetId();
  if (settingId == "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
    if (screenmode.size() == 20)
      return screenmodeSetting->SetValue(screenmode + "p");
  }

  return false;
}