本文整理汇总了C++中BaseSettingControlPtr类的典型用法代码示例。如果您正苦于以下问题:C++ BaseSettingControlPtr类的具体用法?C++ BaseSettingControlPtr怎么用?C++ BaseSettingControlPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseSettingControlPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSettingControl
void CGUIWindowSettingsCategory::UpdateControl(const std::string &dependingSetting, const CSettingDependency &dependency)
{
if (dependingSetting.empty())
return;
BaseSettingControlPtr pControl = GetSettingControl(dependingSetting);
if (pControl == NULL)
return;
CSetting *pSetting = pControl->GetSetting();
if (pSetting == NULL)
return;
CheckDependency(pControl, dependency);
const SettingDependencyMap& deps = m_settings.GetDependencies(pSetting->GetId());
for (SettingDependencyMap::const_iterator depsIt = deps.begin(); depsIt != deps.end(); depsIt++)
{
for (SettingDependencies::const_iterator depIt = depsIt->second.begin(); depIt != depsIt->second.end(); depIt++)
UpdateControl(depsIt->first, *depIt);
}
// update GUI of the changed setting as the change could have been triggered by something else
pControl->Update();
}
示例2: OnClick
void CGUIWindowSettingsCategory::OnClick(BaseSettingControlPtr pSettingControl)
{
if (pSettingControl->GetSetting()->GetId() == RESET_SETTING_ID)
{
OnAction(CAction(ACTION_SETTINGS_RESET));
return;
}
// we need to first set the delayed setting and then execute OnClick()
// because OnClick() triggers OnSettingChanged() and there we need to
// know if the changed setting is delayed or not
if (pSettingControl->IsDelayed())
{
m_delayedSetting = pSettingControl;
if (m_delayedTimer.IsRunning())
m_delayedTimer.Restart();
else
m_delayedTimer.Start(SETTING_DELAY);
return;
}
// if changing the setting fails
// we need to restore the proper state
if (!pSettingControl->OnClick())
pSettingControl->Update();
}
示例3: UpdateSettings
void CGUIWindowSettingsCategory::UpdateSettings()
{
for (vector<BaseSettingControlPtr>::iterator it = m_settingControls.begin(); it != m_settingControls.end(); it++)
{
BaseSettingControlPtr pSettingControl = *it;
CSetting *pSetting = pSettingControl->GetSetting();
CGUIControl *pControl = pSettingControl->GetControl();
if (pSetting == NULL || pControl == NULL)
continue;
// update the setting's control's state (enabled/disabled etc)
const SettingDependencies &deps = pSetting->GetDependencies();
for (SettingDependencies::const_iterator dep = deps.begin(); dep != deps.end(); dep++)
{
// don't check "update" dependencies here as all the controls are already
// setup properly based on the existing values
if (dep->GetType() == SettingDependencyTypeUpdate)
continue;
CheckDependency(pSettingControl, *dep);
}
pSettingControl->Update();
}
}
示例4: GetItems
void CGUIDialogMediaFilter::UpdateControls()
{
for (map<std::string, Filter>::iterator itFilter = m_filters.begin(); itFilter != m_filters.end(); itFilter++)
{
if (itFilter->second.controlType != "list")
continue;
std::vector<std::string> items;
int size = GetItems(itFilter->second, items, true);
std::string label = g_localizeStrings.Get(itFilter->second.label);
BaseSettingControlPtr control = GetSettingControl(itFilter->second.setting->GetId());
if (control == NULL)
continue;
if (size <= 0 ||
(size == 1 && itFilter->second.field != FieldSet && itFilter->second.field != FieldTag))
CONTROL_DISABLE(control->GetID());
else
{
CONTROL_ENABLE(control->GetID());
label = StringUtils::Format(g_localizeStrings.Get(21470).c_str(), label.c_str(), size);
}
SET_CONTROL_LABEL(control->GetID(), label);
}
}
示例5: GetSettingControl
void CGUIDialogNetworkSetup::OnProtocolChange()
{
BaseSettingControlPtr settingControl = GetSettingControl(SETTING_PROTOCOL);
if (settingControl != NULL && settingControl->GetControl() != NULL)
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), settingControl->GetID());
if (!OnMessage(msg))
return;
m_protocol = (NET_PROTOCOL)msg.GetParam1();
// set defaults for the port
if (m_protocol == NET_PROTOCOL_FTP)
m_port = "21";
else if (m_protocol == NET_PROTOCOL_HTTP ||
m_protocol == NET_PROTOCOL_RSS ||
m_protocol == NET_PROTOCOL_DAV)
m_port = "80";
else if (m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_DAVS)
m_port = "443";
else if (m_protocol == NET_PROTOCOL_SFTP)
m_port = "22";
else
m_port = "0";
UpdateButtons();
}
}
示例6: CheckDependency
void CGUIWindowSettingsCategory::CheckDependency(BaseSettingControlPtr pSettingControl, const CSettingDependency &dependency)
{
if (pSettingControl == NULL || pSettingControl->GetControl() == NULL)
return;
CSetting *pSetting = pSettingControl->GetSetting();
if (pSetting == NULL)
return;
switch (dependency.GetType())
{
case SettingDependencyTypeEnable:
pSettingControl->SetEnabled(dependency.Check());
break;
case SettingDependencyTypeUpdate:
{
FillControl(pSetting, pSettingControl->GetControl());
break;
}
case SettingDependencyTypeNone:
default:
break;
}
}
示例7: GetSettingControl
void CGUIDialogLockSettings::setLockCodeLabel()
{
// adjust label2 of the lock code button
if (m_locks.mode > LOCK_MODE_QWERTY)
m_locks.mode = LOCK_MODE_EVERYONE;
BaseSettingControlPtr settingControl = GetSettingControl(SETTING_LOCKCODE);
if (settingControl != NULL && settingControl->GetControl() != NULL)
SET_CONTROL_LABEL2(settingControl->GetID(), g_localizeStrings.Get(m_locks.mode == LOCK_MODE_EVERYONE ? 1223 : 12336 + m_locks.mode));
}
示例8: GetSettingControl
void CGUIDialogPVRTimerSettings::SetButtonLabels()
{
// timer start time
BaseSettingControlPtr settingControl = GetSettingControl(SETTING_TMR_BEGIN);
if (settingControl != NULL && settingControl->GetControl() != NULL)
{
if (!m_bIsNewTimer && m_bStartAnytime)
SET_CONTROL_LABEL2(settingControl->GetID(), g_localizeStrings.Get(19161)); // "any time"
else
SET_CONTROL_LABEL2(settingControl->GetID(), m_timerStartTimeStr);
}
// timer end time
settingControl = GetSettingControl(SETTING_TMR_END);
if (settingControl != NULL && settingControl->GetControl() != NULL)
{
if (!m_bIsNewTimer && m_bEndAnytime)
SET_CONTROL_LABEL2(settingControl->GetID(), g_localizeStrings.Get(19161)); // "any time"
else
SET_CONTROL_LABEL2(settingControl->GetID(), m_timerEndTimeStr);
}
// weekdays
settingControl = GetSettingControl(SETTING_TMR_WEEKDAYS);
if (settingControl != NULL && settingControl->GetControl() != NULL)
SET_CONTROL_LABEL2(settingControl->GetID(),
CPVRTimerInfoTag::GetWeekdaysString(
m_iWeekdays, m_timerType->IsEpgBased(), true));
}
示例9: GetSettingControl
void CGUIDialogContentSettings::ToggleState(const std::string &settingid, bool enabled)
{
BaseSettingControlPtr settingControl = GetSettingControl(settingid);
if (settingControl != NULL && settingControl->GetControl() != NULL)
{
if (enabled)
CONTROL_ENABLE(settingControl->GetID());
else
CONTROL_DISABLE(settingControl->GetID());
}
}
示例10: GetSettingControl
void CGUIWindowSettingsCategory::OnSettingPropertyChanged(const CSetting *setting, const char *propertyName)
{
if (setting == NULL || propertyName == NULL)
return;
BaseSettingControlPtr settingControl = GetSettingControl(setting->GetId());
if (settingControl == NULL)
return;
settingControl->Update();
}
示例11: GetSettingControl
void CGUIDialogPVRTimerSettings::setButtonLabels()
{
// timer start time
BaseSettingControlPtr settingControl = GetSettingControl(SETTING_TMR_BEGIN);
if (settingControl != NULL && settingControl->GetControl() != NULL)
SET_CONTROL_LABEL2(settingControl->GetID(), m_timerStartTimeStr);
// timer end time
settingControl = GetSettingControl(SETTING_TMR_END);
if (settingControl != NULL && settingControl->GetControl() != NULL)
SET_CONTROL_LABEL2(settingControl->GetID(), m_timerEndTimeStr);
}
示例12: UpdateSettings
void CGUIDialogSettingsBase::UpdateSettings()
{
for (vector<BaseSettingControlPtr>::iterator it = m_settingControls.begin(); it != m_settingControls.end(); it++)
{
BaseSettingControlPtr pSettingControl = *it;
CSetting *pSetting = pSettingControl->GetSetting();
CGUIControl *pControl = pSettingControl->GetControl();
if (pSetting == NULL || pControl == NULL)
continue;
pSettingControl->Update();
}
}
示例13: UpdateSettingControl
void CGUIDialogSettingsBase::UpdateSettingControl(BaseSettingControlPtr pSettingControl)
{
if (pSettingControl == NULL)
return;
// we send a thread message so that it's processed the following frame (some settings won't
// like being changed during Render())
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), pSettingControl->GetID());
g_windowManager.SendThreadMessage(message, GetID());
}
示例14: OnClick
void CGUIDialogSettingsBase::OnClick(BaseSettingControlPtr pSettingControl)
{
if (AllowResettingSettings() &&
pSettingControl->GetSetting()->GetId() == SETTINGS_RESET_SETTING_ID)
{
OnAction(CAction(ACTION_SETTINGS_RESET));
return;
}
// we need to first set the delayed setting and then execute OnClick()
// because OnClick() triggers OnSettingChanged() and there we need to
// know if the changed setting is delayed or not
if (pSettingControl->IsDelayed())
{
m_delayedSetting = pSettingControl;
// for some controls we need to update its displayed data/text before
// OnClick() is called after the delay timer has expired because
// otherwise the displayed value of the control does not match with
// the user's interaction
pSettingControl->Update(true);
// either start or restart the delay timer which will result in a call to
// the control's OnClick() method to update the setting's value
if (m_delayedTimer.IsRunning())
m_delayedTimer.Restart();
else
m_delayedTimer.Start(GetDelayMs());
return;
}
// if changing the setting fails
// we need to restore the proper state
if (!pSettingControl->OnClick())
pSettingControl->Update();
}
示例15: AddSetting
CGUIControl* CGUIWindowSettingsCategory::AddSetting(CSetting *pSetting, float width, int &iControlID)
{
if (pSetting == NULL)
return NULL;
BaseSettingControlPtr pSettingControl;
CGUIControl *pControl = NULL;
switch (pSetting->GetControl().GetType())
{
case SettingControlTypeCheckmark:
{
pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
if (pControl == NULL)
return NULL;
((CGUIRadioButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
pSettingControl.reset(new CGUIControlRadioButtonSetting((CGUIRadioButtonControl *)pControl, iControlID, pSetting));
break;
}
case SettingControlTypeSpinner:
{
pControl = new CGUISpinControlEx(*m_pOriginalSpin);
if (pControl == NULL)
return NULL;
((CGUISpinControlEx *)pControl)->SetText(g_localizeStrings.Get(pSetting->GetLabel()));
pSettingControl.reset(new CGUIControlSpinExSetting((CGUISpinControlEx *)pControl, iControlID, pSetting));
break;
}
case SettingControlTypeEdit:
{
pControl = new CGUIEditControl(*m_pOriginalEdit);
if (pControl == NULL)
return NULL;
((CGUIEditControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
pSettingControl.reset(new CGUIControlEditSetting((CGUIEditControl *)pControl, iControlID, pSetting));
break;
}
case SettingControlTypeButton:
{
pControl = new CGUIButtonControl(*m_pOriginalButton);
if (pControl == NULL)
return NULL;
((CGUIButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
pSettingControl.reset(new CGUIControlButtonSetting((CGUIButtonControl *)pControl, iControlID, pSetting));
break;
}
case SettingControlTypeNone:
default:
return NULL;
}
if (pSetting->GetControl().GetDelayed())
pSettingControl->SetDelayed();
return AddSettingControl(pControl, pSettingControl, width, iControlID);
}