当前位置: 首页>>代码示例>>C++>>正文


C++ CSettingList::GetValue方法代码示例

本文整理汇总了C++中CSettingList::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CSettingList::GetValue方法的具体用法?C++ CSettingList::GetValue怎么用?C++ CSettingList::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSettingList的用法示例。


在下文中一共展示了CSettingList::GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnClick

bool CGUIControlRangeSetting::OnClick()
{
  if (m_pSlider == NULL ||
      m_pSetting->GetType() != SettingTypeList)
    return false;

  CSettingList *settingList = static_cast<CSettingList*>(m_pSetting);
  const SettingPtrList &settingListValues = settingList->GetValue();
  if (settingListValues.size() != 2)
    return false;

  std::vector<CVariant> values;
  const CSetting *listDefintion = settingList->GetDefinition();
  switch (listDefintion->GetType())
  {
    case SettingTypeInteger:
      values.push_back(m_pSlider->GetIntValue(CGUISliderControl::RangeSelectorLower));
      values.push_back(m_pSlider->GetIntValue(CGUISliderControl::RangeSelectorUpper));
      break;

    case SettingTypeNumber:
      values.push_back(m_pSlider->GetFloatValue(CGUISliderControl::RangeSelectorLower));
      values.push_back(m_pSlider->GetFloatValue(CGUISliderControl::RangeSelectorUpper));
      break;
    
    default:
      return false;
  }
  
  if (values.size() != 2)
    return false;

  SetValid(CSettingUtils::SetList(settingList, values));
  return IsValid();
}
开发者ID:gellis12,项目名称:xbmc,代码行数:35,代码来源:GUIControlSettings.cpp

示例2: ListToValues

std::vector<CVariant> CSettings::GetList(const std::string &id) const
{
  CSetting *setting = m_settingsManager->GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeList)
    return std::vector<CVariant>();

  CSettingList *listSetting = static_cast<CSettingList*>(setting);
  return ListToValues(listSetting, listSetting->GetValue());
}
开发者ID:Anankin,项目名称:xbmc,代码行数:9,代码来源:Settings.cpp

示例3: Update

void CGUIControlRangeSetting::Update(bool updateDisplayOnly /* = false */)
{
  if (m_pSlider == NULL ||
      m_pSetting->GetType() != SettingTypeList)
    return;

  CGUIControlBaseSetting::Update();

  CSettingList *settingList = static_cast<CSettingList*>(m_pSetting);
  const SettingPtrList &settingListValues = settingList->GetValue();
  if (settingListValues.size() != 2)
    return;

  const CSetting *listDefintion = settingList->GetDefinition();
  const CSettingControlRange *controlRange = static_cast<const CSettingControlRange*>(m_pSetting->GetControl());
  const std::string &controlFormat = controlRange->GetFormat();

  std::string strText;
  std::string strTextLower, strTextUpper;
  std::string formatString = g_localizeStrings.Get(controlRange->GetFormatLabel() > -1 ? controlRange->GetFormatLabel() : 21469);
  std::string valueFormat = controlRange->GetValueFormat();
  if (controlRange->GetValueFormatLabel() > -1)
    valueFormat = g_localizeStrings.Get(controlRange->GetValueFormatLabel());

  switch (listDefintion->GetType())
  {
    case SettingTypeInteger:
    {
      int valueLower, valueUpper;
      if (updateDisplayOnly)
      {
        valueLower = m_pSlider->GetIntValue(CGUISliderControl::RangeSelectorLower);
        valueUpper = m_pSlider->GetIntValue(CGUISliderControl::RangeSelectorUpper);
      }
      else
      {
        valueLower = static_cast<CSettingInt*>(settingListValues[0].get())->GetValue();
        valueUpper = static_cast<CSettingInt*>(settingListValues[1].get())->GetValue();
        m_pSlider->SetIntValue(valueLower, CGUISliderControl::RangeSelectorLower);
        m_pSlider->SetIntValue(valueUpper, CGUISliderControl::RangeSelectorUpper);
      }

      if (controlFormat == "date" || controlFormat == "time")
      {
        CDateTime dateLower = (time_t)valueLower;
        CDateTime dateUpper = (time_t)valueUpper;

        if (controlFormat == "date")
        {
          if (valueFormat.empty())
          {
            strTextLower = dateLower.GetAsLocalizedDate();
            strTextUpper = dateUpper.GetAsLocalizedDate();
          }
          else
          {
            strTextLower = dateLower.GetAsLocalizedDate(valueFormat);
            strTextUpper = dateUpper.GetAsLocalizedDate(valueFormat);
          }
        }
        else
        {
          if (valueFormat.empty())
            valueFormat = "mm:ss";

          strTextLower = dateLower.GetAsLocalizedTime(valueFormat);
          strTextUpper = dateUpper.GetAsLocalizedTime(valueFormat);
        }
      }
      else
      {
        strTextLower = StringUtils::Format(valueFormat.c_str(), valueLower);
        strTextUpper = StringUtils::Format(valueFormat.c_str(), valueUpper);
      }

      if (valueLower != valueUpper)
        strText = StringUtils::Format(formatString.c_str(), strTextLower.c_str(), strTextUpper.c_str());
      else
        strText = strTextLower;
      break;
    }

    case SettingTypeNumber:
    {
      double valueLower, valueUpper;
      if (updateDisplayOnly)
      {
        valueLower = static_cast<double>(m_pSlider->GetFloatValue(CGUISliderControl::RangeSelectorLower));
        valueUpper = static_cast<double>(m_pSlider->GetFloatValue(CGUISliderControl::RangeSelectorUpper));
      }
      else
      {
        valueLower = static_cast<CSettingNumber*>(settingListValues[0].get())->GetValue();
        valueUpper = static_cast<CSettingNumber*>(settingListValues[1].get())->GetValue();
        m_pSlider->SetFloatValue((float)valueLower, CGUISliderControl::RangeSelectorLower);
        m_pSlider->SetFloatValue((float)valueUpper, CGUISliderControl::RangeSelectorUpper);
      }

      strTextLower = StringUtils::Format(valueFormat.c_str(), valueLower);
      if (valueLower != valueUpper)
//.........这里部分代码省略.........
开发者ID:gellis12,项目名称:xbmc,代码行数:101,代码来源:GUIControlSettings.cpp


注:本文中的CSettingList::GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。