本文整理汇总了C++中LLControlVariable类的典型用法代码示例。如果您正苦于以下问题:C++ LLControlVariable类的具体用法?C++ LLControlVariable怎么用?C++ LLControlVariable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLControlVariable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getControl
std::string LLControlGroup::getString(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_STRING))
return control->get().asString();
else
{
CONTROL_ERRS << "Invalid string control " << name << llendl;
return LLStringUtil::null;
}
}
示例2: getControl
F32 LLControlGroup::getF32(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_F32))
return (F32) control->get().asReal();
else
{
CONTROL_ERRS << "Invalid F32 control " << name << llendl;
return 0.0f;
}
}
示例3: onSetDebug
// Checked: 2009-10-10 (RLVa-1.0.4e) | Modified: RLVa-1.0.4e
ERlvCmdRet RlvExtGetSet::onSetDebug(std::string strSetting, const std::string& strValue)
{
S16 dbgFlags; ERlvCmdRet eRet = RLV_RET_FAILED_UNKNOWN;
if ( (findDebugSetting(strSetting, dbgFlags)) && ((dbgFlags & DBG_WRITE) == DBG_WRITE) )
{
eRet = RLV_RET_FAILED_OPTION;
if ((dbgFlags & DBG_PSEUDO) == 0)
{
LLControlVariable* pSetting = gSavedSettings.getControl(strSetting);
if (pSetting)
{
U32 u32Value; S32 s32Value; BOOL fValue;
switch (pSetting->type())
{
case TYPE_U32:
if (LLStringUtil::convertToU32(strValue, u32Value))
{
gSavedSettings.setU32(strSetting, u32Value);
eRet = RLV_RET_SUCCESS;
}
break;
case TYPE_S32:
if (LLStringUtil::convertToS32(strValue, s32Value))
{
gSavedSettings.setS32(strSetting, s32Value);
eRet = RLV_RET_SUCCESS;
}
break;
case TYPE_BOOLEAN:
if (LLStringUtil::convertToBOOL(strValue, fValue))
{
gSavedSettings.setBOOL(strSetting, fValue);
eRet = RLV_RET_SUCCESS;
}
break;
default:
RLV_ERRS << "Unexpected debug setting type" << LL_ENDL;
eRet = RLV_RET_FAILED;
break;
}
// Default settings should persist if they were marked that way, but non-default settings should never persist
pSetting->setPersist( (pSetting->isDefault()) ? ((dbgFlags & DBG_PERSIST) == DBG_PERSIST) : false );
}
}
else
{
eRet = onSetPseudoDebug(strSetting, strValue);
}
}
return eRet;
}
示例4: getControl
void LLControlGroup::setString(const std::string& name, const std::string &val)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_STRING))
{
control->set(val);
}
else
{
CONTROL_ERRS << "Invalid control " << name << llendl;
}
}
示例5: onClickDefault
// static
void LLFloaterSettingsDebug::onClickDefault(void* user_data)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();
if (controlp)
{
controlp = controlp->getCOAActive();
controlp->resetToDefault(true);
floaterp->updateControl(controlp);
}
}
示例6:
void control_group_t::test<3>()
{
int results = mCG->loadFromFile(mTestConfigFile.c_str());
LLControlVariable* control = mCG->getControl("TestSetting");
LLSD new_value = 13;
control->setValue(new_value, FALSE);
ensure_equals("value of changed setting", mCG->getU32("TestSetting"), 13);
LLControlGroup test_cg;
std::string temp_test_file = (mTestConfigDir + "setting_llsd_persist_temp.xml");
mCG->saveToFile(temp_test_file.c_str(), TRUE);
results = test_cg.loadFromFile(temp_test_file.c_str());
//If we haven't changed any settings, then we shouldn't have any settings to load
ensure("number of non-persisted changed settings loaded", (results == 0));
}
示例7: LLNearbyChatScreenChannel
LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id)
{
mStopProcessing = false;
LLControlVariable* ctrl = gSavedSettings.getControl("NearbyToastLifeTime").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLNearbyChatScreenChannel::updateToastsLifetime, this));
}
ctrl = gSavedSettings.getControl("NearbyToastFadingTime").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLNearbyChatScreenChannel::updateToastFadingTime, this));
}
}
示例8: getLoginURIs
void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const
{
// return the login uri set on the command line.
LLControlVariable* c = gSavedSettings.getControl("CmdLineLoginURI");
if(c && !LLStartUp::shouldAutoLogin())
{
LLSD v = c->getValue();
if(v.isArray())
{
for(LLSD::array_const_iterator itr = v.beginArray();
itr != v.endArray(); ++itr)
{
std::string uri = itr->asString();
if(!uri.empty())
{
uris.push_back(uri);
}
}
}
else
{
std::string uri = v.asString();
if(!uri.empty())
{
uris.push_back(uri);
}
}
}
// If there was no command line uri...
if(uris.empty())
{
uris.push_back(gHippoGridManager->getConnectedGrid()->getLoginUri());
/*
// If its a known grid choice, get the uri from the table,
// else try the grid name.
if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
{
uris.push_back(gGridInfo[mGridChoice].mLoginURI);
}
else
{
uris.push_back(mGridName);
} */
}
}
示例9: key
//static
void LLViewerControlListener::setDefault(LLControlGroup * controls, LLSD const & event_data)
{
if(event_data.has("key"))
{
std::string key(event_data["key"]);
if(controls->controlExists(key))
{
LLControlVariable * control = controls->getControl(key);
control->resetToDefault();
}
else
{
llwarns << "requested unknown control: \"" << key << '\"' << llendl;
}
}
}
示例10: LLNearbyChatScreenChannel
LLNearbyChatScreenChannel(const Params& p)
: LLScreenChannelBase(p)
{
mWorldViewRectConnection = gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLNearbyChatScreenChannel::updateSize, this, _1, _2));
mStopProcessing = false;
LLControlVariable* ctrl = gSavedSettings.getControl("NearbyToastLifeTime").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLNearbyChatScreenChannel::updateToastsLifetime, this));
}
ctrl = gSavedSettings.getControl("NearbyToastFadingTime").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLNearbyChatScreenChannel::updateToastFadingTime, this));
}
}
示例11: getControl
void LLControlGroup::setUntypedValue(const std::string& name, const LLSD& val)
{
if (name.empty())
{
return;
}
LLControlVariable* control = getControl(name);
if (control)
{
control->setValue(val);
}
else
{
CONTROL_ERRS << "Invalid control " << name << llendl;
}
}
示例12: onClickSearchDefault
// static
void LLPanelNetwork::onClickSearchDefault(void* user_data)
{
LLPanelNetwork* self = (LLPanelNetwork*)user_data;
LLControlVariable* controlp =
(gHippoGridManager->getConnectedGrid()->isSecondLife())
?
gSavedSettings.getControl("SearchURLQuery")
:
gSavedSettings.getControl("SearchURLQueryOpenSim");
if (controlp)
{
self->childSetValue("world_search_editor",controlp->getDefault().asString()) ;
}
else
{
llwarns << "SearchURLQuery or SearchURLQueryOpenSim missing from settings.xml - thats bad!" << llendl;
}
}
示例13:
// Checked: 2009-06-03 (RLVa-0.2.0h) | Modified: RLVa-0.2.0h
RlvExtGetSet::RlvExtGetSet()
{
if (!m_DbgAllowed.size()) // m_DbgAllowed is static and should only be initialized once
{
m_DbgAllowed.insert(std::pair<std::string, S16>("AvatarSex", DBG_READ | DBG_WRITE | DBG_PSEUDO));
m_DbgAllowed.insert(std::pair<std::string, S16>("RenderResolutionDivisor", DBG_READ | DBG_WRITE));
#ifdef RLV_EXTENSION_CMD_GETSETDEBUG_EX
m_DbgAllowed.insert(std::pair<std::string, S16>(RLV_SETTING_FORBIDGIVETORLV, DBG_READ));
m_DbgAllowed.insert(std::pair<std::string, S16>(RLV_SETTING_NOSETENV, DBG_READ));
m_DbgAllowed.insert(std::pair<std::string, S16>("WindLightUseAtmosShaders", DBG_READ));
#endif // RLV_EXTENSION_CMD_GETSETDEBUG_EX
// Cache persistance of every setting
LLControlVariable* pSetting;
for (std::map<std::string, S16>::iterator itDbg = m_DbgAllowed.begin(); itDbg != m_DbgAllowed.end(); ++itDbg)
{
if ( ((pSetting = gSavedSettings.getControl(itDbg->first)) != NULL) && (pSetting->isPersisted()) )
itDbg->second |= DBG_PERSIST;
}
}
}
示例14: cancel
void LLPanelPreference::cancel()
{
for (control_values_map_t::iterator iter = mSavedValues.begin();
iter != mSavedValues.end(); ++iter)
{
LLControlVariable* control = iter->first;
LLSD ctrl_value = iter->second;
control->set(ctrl_value);
}
for (string_color_map_t::iterator iter = mSavedColors.begin();
iter != mSavedColors.end(); ++iter)
{
LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>(iter->first);
if(color_swatch)
{
color_swatch->set(iter->second);
color_swatch->onCommit();
}
}
}
示例15: while
void LLPanelPreference::saveSettings()
{
// Save the value of all controls in the hierarchy
mSavedValues.clear();
std::list<LLView*> view_stack;
view_stack.push_back(this);
while(!view_stack.empty())
{
// Process view on top of the stack
LLView* curview = view_stack.front();
view_stack.pop_front();
LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl *>(curview);
if (color_swatch)
{
mSavedColors[color_swatch->getName()] = color_swatch->get();
}
else
{
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
{
LLControlVariable* control = ctrl->getControlVariable();
if (control)
{
mSavedValues[control] = control->getValue();
}
}
}
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
view_stack.push_back(*iter);
}
}
}