Пример #1
0
bool LLAppViewerLinux::initParseCommandLine(LLCommandLineParser& clp)
{
	if (!clp.parseCommandLine(gArgC, gArgV))
	{
		return false;
	}

	// Find the system language.
	FL_Locale *locale = NULL;
	FL_Success success = FL_FindLocale(&locale, FL_MESSAGES);
	if (success != 0)
	{
		if (success >= 2 && locale->lang) // confident!
		{
			LL_INFOS("AppInit") << "Language " << ll_safe_string(locale->lang) << LL_ENDL;
			LL_INFOS("AppInit") << "Location " << ll_safe_string(locale->country) << LL_ENDL;
			LL_INFOS("AppInit") << "Variant " << ll_safe_string(locale->variant) << LL_ENDL;

			LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
			if(c)
			{
				c->setValue(std::string(locale->lang), false);
			}
		}
	}
	FL_FreeLocale(&locale);

	return true;
}
//workaround for lineeditor dumbness in regards to control_name
void LLPanelEmerald::onCommitApplyControl(LLUICtrl* caller, void* user_data)
{
	LLLineEditor* line = (LLLineEditor*)caller;
	if(line)
	{
		LLControlVariable *var = line->findControl(line->getControlName());
		if(var)var->setValue(line->getValue());
	}
}
Пример #3
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));
	}
Пример #4
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;
    }
}
Пример #5
0
//----------------------------------------------------------------------------
// LLControlGroupCLP defintions
//----------------------------------------------------------------------------
void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
                       const std::string& opt_name,
                       LLControlGroup* ctrlGroup)
{
    // *FIX: Do sematic conversion here.
    // LLSD (ImplString) Is no good for doing string to type conversion for...
    // booleans
    // compound types
    // ?...

    LLControlVariable* ctrl = ctrlGroup->getControl(opt_name);
    if(NULL != ctrl)
    {
        switch(ctrl->type())
        {
        case TYPE_BOOLEAN:
            if(value.size() > 1)
            {
                llwarns << "Ignoring extra tokens." << llendl;
            }

            if(value.size() > 0)
            {
                // There's a token. check the string for true/false/1/0 etc.
                BOOL result = false;
                BOOL gotSet = LLStringUtil::convertToBOOL(value[0], result);
                if(gotSet)
                {
                    ctrl->setValue(LLSD(result), false);
                }
            }
            else
            {
                ctrl->setValue(LLSD(true), false);
            }
            break;

        default:
        {
            // For the default types, let llsd do the conversion.
            if(value.size() > 1 && ctrl->isType(TYPE_LLSD))
            {
                // Assume its an array...
                LLSD llsdArray;
                for(unsigned int i = 0; i < value.size(); ++i)
                {
                    LLSD llsdValue;
                    llsdValue.assign(LLSD::String(value[i]));
                    llsdArray.set(i, llsdValue);
                }

                ctrl->setValue(llsdArray, false);
            }
            else if(value.size() > 0)
            {
                if(value.size() > 1)
                {
                    llwarns << "Ignoring extra tokens mapped to the setting: " << opt_name << "." << llendl;
                }

                LLSD llsdValue;
                llsdValue.assign(LLSD::String(value[0]));
                ctrl->setValue(llsdValue, false);
            }
        }
        break;
        }
    }
    else
    {
        llwarns << "Command Line option mapping '"
                << opt_name
                << "' not found! Ignoring."
                << llendl;
    }
}