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;
    }
}
Example #2
0
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;
	}
}
Example #3
0
BOOL LLControlGroup::getBOOL(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_BOOLEAN))
		return control->get().asBoolean();
	else
	{
		CONTROL_ERRS << "Invalid BOOL control " << name << llendl;
		return FALSE;
	}
}
Example #4
0
U32 LLControlGroup::getU32(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_U32))		
		return control->get().asInteger();
	else
	{
		CONTROL_ERRS << "Invalid U32 control " << name << llendl;
		return 0;
	}
}
LLColor3 LLControlGroup::getColor3(const std::string& name)
{
    LLControlVariable* control = getControl(name);

    if (control && control->isType(TYPE_COL3))
        return control->get();
    else
    {
        CONTROL_ERRS << "Invalid LLColor3 control " << name << llendl;
        return LLColor3::white;
    }
}
LLRect LLControlGroup::getRect(const std::string& name)
{
    LLControlVariable* control = getControl(name);

    if (control && control->isType(TYPE_RECT))
        return control->get();
    else
    {
        CONTROL_ERRS << "Invalid rect control " << name << llendl;
        return LLRect::null;
    }
}
LLVector3d LLControlGroup::getVector3d(const std::string& name)
{
    LLControlVariable* control = getControl(name);

    if (control && control->isType(TYPE_VEC3D))
        return control->get();
    else
    {
        CONTROL_ERRS << "Invalid LLVector3d control " << name << llendl;
        return LLVector3d::zero;
    }
}
Example #8
0
// 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;
}
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;
	}
}
void LLControlGroup::setLLSD(const std::string& name, const LLSD& val)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_LLSD))
	{
		setValue(name, val);
	}
	else
	{
		CONTROL_ERRS << "Invalid LLSD control " << name << llendl;
	}
}
// 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);
	}
}
void LLControlGroup::setU32(const std::string& name, U32 val)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_U32))
	{
		control->set((LLSD::Integer) val);
	}
	else
	{
		CONTROL_ERRS << "Invalid control " << name << llendl;
	}
}
void LLControlGroup::setColor4(const std::string& name, const LLColor4 &val)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_COL4))
	{
		control->set(val.getValue());
	}
	else
	{
		CONTROL_ERRS << "Invalid LLColor4 control " << name << llendl;
	}
}
Example #14
0
	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));
	}
Example #15
0
void LLControlGroup::setBOOL(const std::string& name, BOOL val)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_BOOLEAN))
	{
		control->set(val);
		if(mChangeCallback)
			mChangeCallback(name,(val) ? "1" : "0");
	}
	else
	{
		CONTROL_ERRS << "Invalid control " << name << llendl;
	}
}
Example #16
0
void LLControlGroup::setF32(const std::string& name, F32 val)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_F32))
	{
		control->set(val);
		if(mChangeCallback)
			mChangeCallback(name,llformat("%f",val));
	}
	else
	{
		CONTROL_ERRS << "Invalid control " << name << llendl;
	}
}
Example #17
0
void LLControlGroup::setRect(const std::string& name, const LLRect &val)
{
	LLControlVariable* control = getControl(name);

	if (control && control->isType(TYPE_RECT))
	{
		control->set(val.getValue());
		if(mChangeCallback)
			mChangeCallback(name,llformat("[%f,%f,%f,%f]",val.mBottom,val.mLeft,val.mRight,val.mTop));
	}
	else
	{
		CONTROL_ERRS << "Invalid rect control " << name << llendl;
	}
}
Example #18
0
void LLControlGroup::setColor4(const std::string& name, const LLColor4 &val)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_COL4))
	{
		control->set(val.getValue());
		if(mChangeCallback)
			mChangeCallback(name,llformat("<%f,%f,%f,%f>",val.mV[VX],val.mV[VY],val.mV[VZ],val.mV[VW]));
	}
	else
	{
		CONTROL_ERRS << "Invalid LLColor4 control " << name << llendl;
	}
}
	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));
		}
	}
Example #20
0
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);
		} */
	}
}
//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;
		}
	}
}
	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));
		}
	}
Example #23
0
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;
    }
}
Example #24
0
// 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;
	}
}
Example #25
0
// 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;
		}
	}
}
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();
		}
	}
}
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);
		}
	}	
}
Example #28
0
U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only)
{
	LLSD settings;
	int num_saved = 0;
	for (ctrl_name_table_t::iterator iter = mNameTable.begin();
		 iter != mNameTable.end(); iter++)
	{
		LLControlVariable* control = iter->second;
		if (!control)
		{
			LL_WARNS("Settings") << "Tried to save invalid control: " << iter->first << LL_ENDL;
		}
		else if( control->shouldSave(nondefault_only) )
		{
			settings[iter->first]["Type"] = typeEnumToString(control->type());
			settings[iter->first]["Comment"] = control->getComment();
			settings[iter->first]["Value"] = control->getSaveValue();
			++num_saved;
		}
	}
	llofstream file;
	file.open(filename.c_str());
	if (file.is_open())
	{
		LLSDSerialize::toPrettyXML(settings, file);
		file.close();
		LL_INFOS("Settings") << "Saved to " << filename << LL_ENDL;
	}
	else
	{
        // This is a warning because sometime we want to use settings files which can't be written...
		LL_WARNS("Settings") << "Unable to open settings file: " << filename << LL_ENDL;
		return 0;
	}
	return num_saved;
}
//static
void LLViewerControlListener::toggleControl(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);
			if(control->isType(TYPE_BOOLEAN))
			{
				control->set(!control->get().asBoolean());
			}
			else
			{
				llwarns << "requested toggle of non-boolean control: \"" << key << "\", type is " << control->type() << llendl;
			}
		}
		else
		{
			llwarns << "requested unknown control: \"" << key << '\"' << llendl;
		}
	}
}
Example #30
0
U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only)
{
    LLSD settings;
    int num_saved = 0;
    for (ctrl_name_table_t::iterator iter = mNameTable.begin();
            iter != mNameTable.end(); iter++)
    {
        LLControlVariable* control = iter->second;
        if (!control)
        {
            llwarns << "Tried to save invalid control: " << iter->first << llendl;
        }

        if( control && control->isPersisted() )
        {
            if (!(nondefault_only && (control->isSaveValueDefault())))
            {
                settings[iter->first]["Type"] = typeEnumToString(control->type());
                settings[iter->first]["Comment"] = control->getComment();
                settings[iter->first]["Value"] = control->getSaveValue();
                ++num_saved;
            }
            else
            {
                // Debug spam
                // llinfos << "Skipping " << control->getName() << llendl;
            }
        }
    }
    llofstream file;
    file.open(filename);
    if (file.is_open())
    {
        LLSDSerialize::toPrettyXML(settings, file);
        file.close();
        llinfos << "Saved to " << filename << llendl;
    }
    else
    {
        // This is a warning because sometime we want to use settings files which can't be written...
        llwarns << "Unable to open settings file: " << filename << llendl;
        return 0;
    }
    return num_saved;
}