Fix setting adult, mostly

This commit is contained in:
Siana Gearz
2011-11-06 16:35:49 +01:00
parent 5f074c8c82
commit 4ce0345842
4 changed files with 17 additions and 16 deletions

View File

@@ -265,6 +265,9 @@ void LLAgent::init()
// LLDebugVarMessageBox::show("Camera Lag", &CAMERA_FOCUS_HALF_LIFE, 0.5f, 0.01f);
*mEffectColor = gSavedSettings.getColor4("EffectColor");
gSavedSettings.getControl("PreferredMaturity")->getValidateSignal()->connect(boost::bind(&LLAgent::validateMaturity, this, _2));
gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLAgent::handleMaturity, this, _2));
mInitialized = TRUE;
}
@@ -2377,6 +2380,15 @@ const LLAgentAccess& LLAgent::getAgentAccess()
return *mAgentAccess;
}
bool LLAgent::validateMaturity(const LLSD& newvalue)
{
return mAgentAccess->canSetMaturity(newvalue.asInteger());
}
void LLAgent::handleMaturity(const LLSD& newvalue)
{
sendMaturityPreferenceToServer(newvalue.asInteger());
}
void LLAgent::buildFullname(std::string& name) const
{

View File

@@ -661,6 +661,10 @@ public:
static int convertTextToMaturity(char text);
bool sendMaturityPreferenceToServer(int preferredMaturity); // ! "U8" instead of "int"?
// Maturity callbacks for PreferredMaturity control variable
void handleMaturity(const LLSD& newvalue);
bool validateMaturity(const LLSD& newvalue);
/** Access

View File

@@ -172,6 +172,7 @@ int LLAgentAccess::convertTextToMaturity(char text)
void LLAgentAccess::setMaturity(char text)
{
mAccess = LLAgentAccess::convertTextToMaturity(text);
llinfos << "Setting agent maturity to " << text << " " << (int)mAccess << llendl;
U32 preferred_access = mSavedSettings.getU32("PreferredMaturity");
while (!canSetMaturity(preferred_access))
{

View File

@@ -154,22 +154,6 @@ void LLPanelGeneral::apply()
LLComboBox* crash_behavior_combobox = getChild<LLComboBox>("crash_behavior_combobox");
gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior_combobox->getCurrentIndex());
// if we have no agent, we can't let them choose anything
// if we have an agent, then we only let them choose if they have a choice
bool can_choose = gAgent.getID().notNull() &&
(gAgent.isMature() || gAgent.isGodlike());
if (can_choose)
{
int preferred_maturity = childGetValue("maturity_desired_combobox").asInteger();
if (preferred_maturity != gSavedSettings.getU32("PreferredMaturity"))
{
gSavedSettings.setU32("PreferredMaturity", preferred_maturity);
gAgent.sendMaturityPreferenceToServer(preferred_maturity);
}
}
}
void LLPanelGeneral::cancel()