本文整理汇总了C++中CGUISettingsSliderControl类的典型用法代码示例。如果您正苦于以下问题:C++ CGUISettingsSliderControl类的具体用法?C++ CGUISettingsSliderControl怎么用?C++ CGUISettingsSliderControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGUISettingsSliderControl类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void CGUIDialogSettings::UpdateSetting(unsigned int id)
{
unsigned int settingNum = (unsigned int)-1;
for (unsigned int i = 0; i < m_settings.size(); i++)
{
if (m_settings[i].id == id)
{
settingNum = i;
break;
}
}
if(settingNum == (unsigned int)-1)
return;
SettingInfo &setting = m_settings.at(settingNum);
unsigned int controlID = settingNum + CONTROL_START;
if (setting.type == SettingInfo::SPIN)
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(controlID);
if (pControl && setting.data) pControl->SetValue(*(int *)setting.data);
}
else if (setting.type == SettingInfo::CHECK)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(bool *)setting.data);
}
else if (setting.type == SettingInfo::CHECK_UCHAR)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(unsigned char*)setting.data ? true : false);
}
else if (setting.type == SettingInfo::SLIDER)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
float value = *(float *)setting.data;
if (pControl && setting.data)
{
pControl->SetFloatValue(value);
if (setting.formatFunction) pControl->SetTextValue(setting.formatFunction(value, setting.interval));
}
}
else if (setting.type == SettingInfo::BUTTON)
{
SET_CONTROL_LABEL(controlID,setting.name);
if (m_usePopupSliders && setting.data && setting.formatFunction)
SET_CONTROL_LABEL2(controlID,setting.formatFunction(*(float *)setting.data, setting.interval));
}
if (setting.enabled)
{
CONTROL_ENABLE(controlID);
}
else
{
CONTROL_DISABLE(controlID);
}
}
示例2: set_enabled
void Interface_GUIControlSettingsSlider::set_enabled(void* kodiBase, void* handle, bool enabled)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR, "Interface_GUIControlSettingsSlider::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, addon, control, addon ? addon->ID().c_str() : "unknown");
return;
}
control->SetEnabled(enabled);
}
示例3: get_float_value
float Interface_GUIControlSettingsSlider::get_float_value(void* kodiBase, void* handle)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR, "Interface_GUIControlSettingsSlider::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, addon, control, addon ? addon->ID().c_str() : "unknown");
return 0.0f;
}
return control->GetFloatValue();
}
示例4: set_float_value
void Interface_GUIControlSettingsSlider::set_float_value(void* kodiBase, void* handle, float value)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR, "Interface_GUIControlSettingsSlider::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, addon, control, addon ? addon->ID().c_str() : "unknown");
return;
}
control->SetType(SLIDER_CONTROL_TYPE_FLOAT);
control->SetFloatValue(value);
}
示例5: reset
void Interface_GUIControlSettingsSlider::reset(void* kodiBase, void* handle)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR, "Interface_GUIControlSettingsSlider::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, addon, control, addon ? addon->ID().c_str() : "unknown");
return;
}
CGUIMessage msg(GUI_MSG_LABEL_RESET, control->GetParentID(), control->GetID());
g_windowManager.SendThreadMessage(msg, control->GetParentID());
}
示例6: set_percentage
void Interface_GUIControlSettingsSlider::set_percentage(void* kodiBase, void* handle, float percent)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR, "Interface_GUIControlSettingsSlider::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
return;
}
control->SetType(SLIDER_CONTROL_TYPE_PERCENTAGE);
control->SetPercentage(percent);
}
示例7: set_int_range
void Interface_GUIControlSettingsSlider::set_int_range(void* kodiBase, void* handle, int start, int end)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR, "Interface_GUIControlSettingsSlider::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
return;
}
control->SetType(SLIDER_CONTROL_TYPE_INT);
control->SetRange(start, end);
}
示例8: SetFloatValue
void Interface_GUIControlSettingsSlider::SetFloatValue(void* kodiBase, void* handle, float value)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid data", __FUNCTION__);
return;
}
if (!handle)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
return;
}
CGUISettingsSliderControl* pControl = static_cast<CGUISettingsSliderControl*>(handle);
pControl->SetType(SLIDER_CONTROL_TYPE_FLOAT);
pControl->SetFloatValue(value);
}
示例9: Reset
void Interface_GUIControlSettingsSlider::Reset(void* kodiBase, void* handle)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid data", __FUNCTION__);
return;
}
if (!handle)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
return;
}
CGUISettingsSliderControl* pControl = static_cast<CGUISettingsSliderControl*>(handle);
CGUIMessage msg(GUI_MSG_LABEL_RESET, pControl->GetParentID(), pControl->GetID());
g_windowManager.SendThreadMessage(msg, pControl->GetParentID());
}
示例10: SetText
void Interface_GUIControlSettingsSlider::SetText(void* kodiBase, void* handle, const char *text)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid data", __FUNCTION__);
return;
}
if (!handle || !text)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
return;
}
CGUISettingsSliderControl* pControl = static_cast<CGUISettingsSliderControl*>(handle);
// create message
CGUIMessage msg(GUI_MSG_LABEL_SET, pControl->GetParentID(), pControl->GetID());
msg.SetLabel(text);
// send message
g_windowManager.SendThreadMessage(msg, pControl->GetParentID());
}
示例11: if
void CGUIDialogSettings::UpdateSetting(unsigned int id)
{
unsigned int settingNum = (unsigned int)-1;
for (unsigned int i = 0; i < m_settings.size(); i++)
{
if (m_settings[i].id == id)
{
settingNum = i;
break;
}
}
if(settingNum == (unsigned int)-1)
return;
SettingInfo &setting = m_settings.at(settingNum);
unsigned int controlID = settingNum + CONTROL_START;
if (setting.type == SettingInfo::SPIN)
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(controlID);
if (pControl && setting.data) pControl->SetValue(*(int *)setting.data);
}
else if (setting.type == SettingInfo::CHECK)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(bool *)setting.data);
}
else if (setting.type == SettingInfo::CHECK_UCHAR)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(unsigned char*)setting.data ? true : false);
}
else if (setting.type == SettingInfo::SLIDER)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
if (pControl && setting.data)
{
float value = *(float *)setting.data;
pControl->SetFloatValue(value);
if (setting.formatFunction) pControl->SetTextValue(setting.formatFunction(value, setting.interval));
}
}
else if (setting.type == SettingInfo::BUTTON_DIALOG)
{
SET_CONTROL_LABEL(controlID,setting.name);
CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
}
else if (setting.type == SettingInfo::EDIT)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
}
else if (setting.type == SettingInfo::EDIT_NUM)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
if (pControl && setting.data) {
CStdString strIndex;
strIndex.Format("%i", *(int *)setting.data);
pControl->SetLabel2(strIndex);
}
}
else if (setting.type == SettingInfo::STRING)
{
SET_CONTROL_LABEL(controlID, setting.name);
string strNewValue = string(*(CStdString *)setting.data);
if (strNewValue.empty())
strNewValue = "-";
SET_CONTROL_LABEL2(controlID, strNewValue);
}
if (setting.enabled)
{
CONTROL_ENABLE(controlID);
}
else
{
CONTROL_DISABLE(controlID);
}
}
示例12: FreeControls
void CGUIDialogAddonSettings::CreateControls()
{
FreeControls();
CGUISpinControlEx *pOriginalSpin = dynamic_cast<CGUISpinControlEx*>(GetControl(CONTROL_DEFAULT_SPIN));
CGUIRadioButtonControl *pOriginalRadioButton = dynamic_cast<CGUIRadioButtonControl *>(GetControl(CONTROL_DEFAULT_RADIOBUTTON));
CGUIButtonControl *pOriginalButton = dynamic_cast<CGUIButtonControl *>(GetControl(CONTROL_DEFAULT_BUTTON));
CGUIImage *pOriginalImage = dynamic_cast<CGUIImage *>(GetControl(CONTROL_DEFAULT_SEPARATOR));
CGUILabelControl *pOriginalLabel = dynamic_cast<CGUILabelControl *>(GetControl(CONTROL_DEFAULT_LABEL_SEPARATOR));
CGUISettingsSliderControl *pOriginalSlider = dynamic_cast<CGUISettingsSliderControl *>(GetControl(CONTROL_DEFAULT_SLIDER));
if (!m_addon || !pOriginalSpin || !pOriginalRadioButton || !pOriginalButton || !pOriginalImage
|| !pOriginalLabel || !pOriginalSlider)
return;
pOriginalSpin->SetVisible(false);
pOriginalRadioButton->SetVisible(false);
pOriginalButton->SetVisible(false);
pOriginalImage->SetVisible(false);
pOriginalLabel->SetVisible(false);
pOriginalSlider->SetVisible(false);
CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(CONTROL_SETTINGS_AREA));
if (!group)
return;
// set our dialog heading
SET_CONTROL_LABEL(CONTROL_HEADING_LABEL, m_strHeading);
CGUIControl* pControl = NULL;
int controlId = CONTROL_START_SETTING;
const TiXmlElement *setting = GetFirstSetting();
while (setting)
{
const std::string type = XMLUtils::GetAttribute(setting, "type");
const std::string id = XMLUtils::GetAttribute(setting, "id");
const std::string values = XMLUtils::GetAttribute(setting, "values");
const std::string lvalues = XMLUtils::GetAttribute(setting, "lvalues");
const std::string entries = XMLUtils::GetAttribute(setting, "entries");
const std::string defaultVal = XMLUtils::GetAttribute(setting, "default");
const std::string subsetting = XMLUtils::GetAttribute(setting, "subsetting");
const std::string label = GetString(setting->Attribute("label"), subsetting == "true");
bool bSort = XMLUtils::GetAttribute(setting, "sort") == "yes";
if (!type.empty())
{
bool isAddonSetting = false;
if (type == "text" || type == "ipaddress"
|| type == "number" || type == "video"
|| type == "audio" || type == "image"
|| type == "folder" || type == "executable"
|| type == "file" || type == "action"
|| type == "date" || type == "time"
|| type == "select" || (isAddonSetting = type == "addon"))
{
pControl = new CGUIButtonControl(*pOriginalButton);
if (!pControl) return;
((CGUIButtonControl *)pControl)->SetLabel(label);
if (!id.empty())
{
std::string value = m_settings[id];
m_buttonValues[id] = value;
// get any option to test for hidden
const std::string option = XMLUtils::GetAttribute(setting, "option");
if (option == "urlencoded")
value = CURL::Decode(value);
else if (option == "hidden")
{
std::string hiddenText;
hiddenText.append(value.size(), L'*');
((CGUIButtonControl *)pControl)->SetLabel2(hiddenText);
}
else
{
if (isAddonSetting)
((CGUIButtonControl *)pControl)->SetLabel2(GetAddonNames(value));
else if (type == "select" && !lvalues.empty())
{
vector<string> valuesVec = StringUtils::Split(lvalues, '|');
int selected = atoi(value.c_str());
if (selected >= 0 && selected < (int)valuesVec.size())
{
std::string label = m_addon->GetString(atoi(valuesVec[selected].c_str()));
if (label.empty())
label = g_localizeStrings.Get(atoi(valuesVec[selected].c_str()));
((CGUIButtonControl *)pControl)->SetLabel2(label);
}
}
else
((CGUIButtonControl *)pControl)->SetLabel2(value);
}
}
else
((CGUIButtonControl *)pControl)->SetLabel2(defaultVal);
}
else if (type == "bool" && !id.empty())
{
pControl = new CGUIRadioButtonControl(*pOriginalRadioButton);
if (!pControl) return;
((CGUIRadioButtonControl *)pControl)->SetLabel(label);
//.........这里部分代码省略.........
示例13: OnOkay
void CGUIDialogSettings::OnClick(int iID)
{
if (iID == CONTROL_OKAY_BUTTON)
{
OnOkay();
Close();
return;
}
if (iID == CONTROL_CANCEL_BUTTON)
{
OnCancel();
Close();
return;
}
unsigned int settingNum = iID - CONTROL_START;
if (settingNum >= m_settings.size()) return;
SettingInfo &setting = m_settings.at(settingNum);
if (setting.type == SettingInfo::SPIN)
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID);
if (setting.data) *(int *)setting.data = pControl->GetValue();
}
else if (setting.type == SettingInfo::BUTTON_DIALOG)
{
CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(iID);
if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
}
else if (setting.type == SettingInfo::EDIT)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
}
else if (setting.type == SettingInfo::EDIT_NUM)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
if (setting.data) {
CStdString strIndex = pControl->GetLabel2();
*(int *)setting.data = atol(strIndex.c_str());
}
}
else if (setting.type == SettingInfo::CHECK)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
if (setting.data) *(bool *)setting.data = pControl->IsSelected();
}
else if (setting.type == SettingInfo::CHECK_UCHAR)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
if (setting.data) *(unsigned char*)setting.data = pControl->IsSelected() ? 1 : 0;
}
else if (setting.type == SettingInfo::SLIDER)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
if (setting.data) *(float *)setting.data = pControl->GetFloatValue();
if (setting.formatFunction.standard) pControl->SetTextValue(setting.formatFunction.standard(pControl->GetFloatValue(), setting.interval));
}
else if (setting.type == SettingInfo::BUTTON && m_usePopupSliders && setting.data)
{ // we're using popup sliders
CGUIDialogSlider::ShowAndGetInput(setting.name, *(float *)setting.data, setting.min, setting.interval, setting.max, this, &setting);
if (setting.formatFunction.standard)
SET_CONTROL_LABEL2(iID, setting.formatFunction.standard(*(float *)setting.data, setting.interval));
}
else if (setting.type == SettingInfo::STRING)
{
CGUIKeyboardFactory::ShowAndGetInput(*(CStdString *) setting.data, true);
string strNewValue = string(*(CStdString *)setting.data);
if (strNewValue.empty())
strNewValue = "-";
SET_CONTROL_LABEL2(iID, strNewValue);
}
else if (setting.type == SettingInfo::RANGE)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
if (setting.data)
{
*((float **)setting.data)[0] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower);
*((float **)setting.data)[1] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper);
}
if (setting.formatFunction.range)
pControl->SetTextValue(setting.formatFunction.range(pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower),
pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper),
setting.interval));
}
OnSettingChanged(setting);
}