- internal : hide locked debug settings with LLControlVariable::setHiddenFromSettingsEditor()

--HG--
branch : RLVa
master
Kitty Barnett 2011-05-28 02:36:26 +02:00
parent e3add549f9
commit 0b8099dc75
4 changed files with 36 additions and 29 deletions

View File

@ -34,10 +34,6 @@
#include "llcolorswatch.h"
#include "llviewercontrol.h"
#include "lltexteditor.h"
// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0a)
#include "rlvhandler.h"
#include "rlvextensions.h"
// [/RLVa:KB]
LLFloaterSettingsDebug::LLFloaterSettingsDebug(const LLSD& key)
@ -213,31 +209,18 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
if (controlp)
{
// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0e) | Modified: RLVa-0.2.1d
// TODO-RLVa: [RLVa-1.2.1] Look into rewriting the whole debug setting blocking code
if (rlv_handler_t::isEnabled())
{
// Don't allow changing DBG_WRITE debug settings under @setdebug=n
bool fEnable = !( (gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG)) &&
(RlvExtGetSet::getDebugSettingFlags(controlp->getName()) & RlvExtGetSet::DBG_WRITE) );
// Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n
fEnable &= !((gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) &&
(("VertexShaderEnable" == controlp->getName()) || ("WindLightUseAtmosShaders" == controlp->getName())));
#ifdef RLV_EXTENSION_STARTLOCATION
// Don't allow toggling RestrainedLoveLoginLastLocation
fEnable &= !(RLV_SETTING_LOGINLASTLOCATION == controlp->getName());
#endif // RLV_EXTENSION_STARTLOCATION
// NOTE: this runs per-frame so there's no need to explictly handle onCommitSettings() or onClickDefault()
spinner1->setEnabled(fEnable);
spinner2->setEnabled(fEnable);
spinner3->setEnabled(fEnable);
spinner4->setEnabled(fEnable);
color_swatch->setEnabled(fEnable);
childSetEnabled("val_text", fEnable);
childSetEnabled("boolean_combo", fEnable);
childSetEnabled("default_btn", fEnable);
}
// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a
// If "HideFromEditor" was toggled while the floater is open then we need to manually disable access to the control
// NOTE: this runs per-frame so there's no need to explictly handle onCommitSettings() or onClickDefault()
bool fEnable = !controlp->isHiddenFromSettingsEditor();
spinner1->setEnabled(fEnable);
spinner2->setEnabled(fEnable);
spinner3->setEnabled(fEnable);
spinner4->setEnabled(fEnable);
color_swatch->setEnabled(fEnable);
childSetEnabled("val_text", fEnable);
childSetEnabled("boolean_combo", fEnable);
childSetEnabled("default_btn", fEnable);
// [/RLVa:KB]
eControlType type = controlp->type();

View File

@ -92,6 +92,12 @@ void RlvSettings::initClass()
if (gSavedSettings.controlExists(RLV_SETTING_SHOWNAMETAGS))
gSavedSettings.getControl(RLV_SETTING_SHOWNAMETAGS)->getSignal()->connect(boost::bind(&onChangedSettingBOOL, _2, &fShowNameTags));
#ifdef RLV_EXTENSION_STARTLOCATION
// Don't allow toggling RLVaLoginLastLocation from the debug settings floater
if (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION))
gSavedPerAccountSettings.getControl(RLV_SETTING_LOGINLASTLOCATION)->setHiddenFromSettingsEditor(true);
#endif // RLV_EXTENSION_STARTLOCATION
if (gSavedSettings.controlExists(RLV_SETTING_AVATAROFFSET_Z))
gSavedSettings.getControl(RLV_SETTING_AVATAROFFSET_Z)->getSignal()->connect(boost::bind(&onChangedAvatarOffset, _2));

View File

@ -46,6 +46,7 @@
#include "rlvui.h"
#include "rlvhandler.h"
#include "rlvextensions.h"
// ============================================================================
@ -75,6 +76,7 @@ RlvUIEnabler::RlvUIEnabler()
// onToggleXXX
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_EDIT, boost::bind(&RlvUIEnabler::onToggleEdit, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_REZ, boost::bind(&RlvUIEnabler::onToggleRez, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SETDEBUG, boost::bind(&RlvUIEnabler::onToggleSetDebug, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SETENV, boost::bind(&RlvUIEnabler::onToggleSetEnv, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SHOWINV, boost::bind(&RlvUIEnabler::onToggleShowInv, this, _1)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SHOWLOC, boost::bind(&RlvUIEnabler::onToggleShowLoc, this)));
@ -164,6 +166,17 @@ void RlvUIEnabler::onToggleRez()
LLBottomTray::getInstance()->getChild<LLButton>("build_btn")->setEnabled(isBuildEnabled());
}
// Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a
void RlvUIEnabler::onToggleSetDebug()
{
bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG);
for (auto itSetting = RlvExtGetSet::m_DbgAllowed.cbegin(); itSetting != RlvExtGetSet::m_DbgAllowed.cend(); ++itSetting)
{
if (itSetting->second & RlvExtGetSet::DBG_WRITE)
gSavedSettings.getControl(itSetting->first)->setHiddenFromSettingsEditor(!fEnable);
}
}
// Checked: 2010-03-17 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
void RlvUIEnabler::onToggleSetEnv()
{
@ -185,6 +198,10 @@ void RlvUIEnabler::onToggleSetEnv()
removeGenericFloaterFilter(strEnvFloaters[idxFloater]);
}
}
// Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n
gSavedSettings.getControl("VertexShaderEnable")->setHiddenFromSettingsEditor(!fEnable);
gSavedSettings.getControl("WindLightUseAtmosShaders")->setHiddenFromSettingsEditor(!fEnable);
}
// Checked: 2010-09-07 (RLVa-1.4.0a) | Modified: RLVa-1.2.1a

View File

@ -47,6 +47,7 @@ protected:
void onToggleEdit(); // edit
void onToggleMovement(); // fly, alwaysrun and temprun
void onToggleRez(); // rez
void onToggleSetDebug(); // setdebug
void onToggleSetEnv(); // setenv
void onToggleShowInv(bool fQuitting); // showinv
void onToggleShowLoc(); // showloc