本文整理汇总了C++中CSettingInt::GetStep方法的典型用法代码示例。如果您正苦于以下问题:C++ CSettingInt::GetStep方法的具体用法?C++ CSettingInt::GetStep怎么用?C++ CSettingInt::GetStep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSettingInt
的用法示例。
在下文中一共展示了CSettingInt::GetStep方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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: 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();
}
示例4: OnClick
bool CGUIControlButtonSetting::OnClick()
{
if (m_pButton == NULL)
return false;
const ISettingControl *control = m_pSetting->GetControl();
const std::string &controlType = control->GetType();
const std::string &controlFormat = control->GetFormat();
if (controlType == "button")
{
const CSettingControlButton *buttonControl = static_cast<const CSettingControlButton*>(control);
if (controlFormat == "addon")
{
// prompt for the addon
CSettingAddon *setting = (CSettingAddon *)m_pSetting;
std::string addonID = setting->GetValue();
if (CGUIWindowAddonBrowser::SelectAddonID(setting->GetAddonType(), addonID, setting->AllowEmpty(),
buttonControl->ShowAddonDetails(), buttonControl->ShowInstalledAddons(),
buttonControl->ShowInstallableAddons(), buttonControl->ShowMoreAddons()) != 1)
return false;
SetValid(setting->SetValue(addonID));
}
else if (controlFormat == "path")
SetValid(GetPath((CSettingPath *)m_pSetting));
else if (controlFormat == "action")
{
// simply call the OnSettingAction callback and whoever knows what to
// do can do so (based on the setting's identification
CSettingAction *pSettingAction = (CSettingAction *)m_pSetting;
pSettingAction->OnSettingAction(pSettingAction);
SetValid(true);
}
}
else if (controlType == "slider")
{
float value, min, step, max;
if (m_pSetting->GetType() == SettingTypeInteger)
{
CSettingInt *settingInt = static_cast<CSettingInt*>(m_pSetting);
value = (float)settingInt->GetValue();
min = (float)settingInt->GetMinimum();
step = (float)settingInt->GetStep();
max = (float)settingInt->GetMaximum();
}
else if (m_pSetting->GetType() == SettingTypeNumber)
{
CSettingNumber *settingNumber = static_cast<CSettingNumber*>(m_pSetting);
value = (float)settingNumber->GetValue();
min = (float)settingNumber->GetMinimum();
step = (float)settingNumber->GetStep();
max = (float)settingNumber->GetMaximum();
}
else
return false;
const CSettingControlSlider *sliderControl = static_cast<const CSettingControlSlider*>(control);
CGUIDialogSlider::ShowAndGetInput(g_localizeStrings.Get(sliderControl->GetHeading()), value, min, step, max, this, NULL);
SetValid(true);
}
return IsValid();
}
示例5: CreateSettings
void CGUIDialogPeripheralSettings::CreateSettings()
{
m_bIsInitialising = true;
m_usePopupSliders = g_SkinInfo->HasSkinFile("DialogSlider.xml");
if (m_item)
{
CPeripheral *peripheral = g_peripherals.GetByPath(m_item->GetPath());
if (peripheral)
{
vector<CSetting *> settings = peripheral->GetSettings();
for (size_t iPtr = 0; iPtr < settings.size(); iPtr++)
{
CSetting *setting = settings[iPtr];
if (!setting->IsVisible())
{
CLog::Log(LOGDEBUG, "%s - invisible", __FUNCTION__);
continue;
}
switch(setting->GetType())
{
case SettingTypeBool:
{
CSettingBool *boolSetting = (CSettingBool *) setting;
if (boolSetting)
{
m_boolSettings.insert(make_pair(CStdString(boolSetting->GetId()), boolSetting->GetValue()));
AddBool(m_settingId++, boolSetting->GetLabel(), &m_boolSettings[boolSetting->GetId()], true);
}
}
break;
case SettingTypeInteger:
{
CSettingInt *intSetting = (CSettingInt *) setting;
if (intSetting)
{
if (intSetting->GetControl()->GetFormat() == "integer")
{
m_intSettings.insert(make_pair(CStdString(intSetting->GetId()), (float) intSetting->GetValue()));
AddSlider(m_settingId++, intSetting->GetLabel(), &m_intSettings[intSetting->GetId()], (float)intSetting->GetMinimum(), (float)intSetting->GetStep(), (float)intSetting->GetMaximum(), CGUIDialogVideoSettings::FormatInteger, false);
}
else if (intSetting->GetControl()->GetFormat() == "string")
{
m_intTextSettings.insert(make_pair(CStdString(intSetting->GetId()), intSetting->GetValue()));
vector<pair<int, int> > entries;
StaticIntegerSettingOptions::const_iterator entriesItr = intSetting->GetOptions().begin();
while (entriesItr != intSetting->GetOptions().end())
{
entries.push_back(make_pair(entriesItr->first, entriesItr->second));
++entriesItr;
}
AddSpin(m_settingId++, intSetting->GetLabel(), &m_intTextSettings[intSetting->GetId()], entries);
}
}
}
break;
case SettingTypeNumber:
{
CSettingNumber *floatSetting = (CSettingNumber *) setting;
if (floatSetting)
{
m_floatSettings.insert(make_pair(CStdString(floatSetting->GetId()), (float)floatSetting->GetValue()));
AddSlider(m_settingId++, floatSetting->GetLabel(), &m_floatSettings[floatSetting->GetId()], (float)floatSetting->GetMinimum(), (float)floatSetting->GetStep(), (float)floatSetting->GetMaximum(), CGUIDialogVideoSettings::FormatFloat, false);
}
}
break;
case SettingTypeString:
{
CSettingString *stringSetting = (CSettingString *) setting;
if (stringSetting)
{
m_stringSettings.insert(make_pair(CStdString(stringSetting->GetId()), stringSetting->GetValue()));
AddString(m_settingId++, stringSetting->GetLabel(), &m_stringSettings[stringSetting->GetId()]);
}
}
break;
default:
//TODO add more types if needed
CLog::Log(LOGDEBUG, "%s - unknown type", __FUNCTION__);
break;
}
}
}
else
{
CLog::Log(LOGDEBUG, "%s - no peripheral", __FUNCTION__);
}
}
m_bIsInitialising = false;
}