wlfPanel_AdvSettings cleanup. Removed some duplicate code, and register to rlv to catch behavior change instead of polling every draw call. Also now references wlfAdvSettingsPopup setting only during build.

This commit is contained in:
Shyotl
2013-06-20 00:49:02 -05:00
parent e015771c64
commit f24fe44df8
4 changed files with 48 additions and 45 deletions

View File

@@ -153,11 +153,11 @@ LLOverlayBar::LLOverlayBar()
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map);
} }
bool updateAdvSettingsPopup(const LLSD &data) bool LLOverlayBar::updateAdvSettingsPopup()
{ {
bool wfl_adv_settings_popup = gSavedSettings.getBOOL("wlfAdvSettingsPopup"); bool wfl_adv_settings_popup = gSavedSettings.getBOOL("wlfAdvSettingsPopup");
wlfPanel_AdvSettings::updateClass(); wlfPanel_AdvSettings::updateClass();
if(LLLayoutStack* layout_stack = gOverlayBar->findChild<LLLayoutStack>("overlay_layout_panel")) if(LLLayoutStack* layout_stack = findChild<LLLayoutStack>("overlay_layout_panel"))
{ {
LLLayoutPanel* layout_panel = layout_stack->findChild<LLLayoutPanel>("AdvSettings_container"); LLLayoutPanel* layout_panel = layout_stack->findChild<LLLayoutPanel>("AdvSettings_container");
if(layout_panel) if(layout_panel)
@@ -218,27 +218,14 @@ BOOL LLOverlayBar::postBuild()
sChatVisible = gSavedSettings.getBOOL("ChatVisible"); sChatVisible = gSavedSettings.getBOOL("ChatVisible");
LLControlVariable* wfl_adv_settings_popupp = gSavedSettings.getControl("wlfAdvSettingsPopup"); gSavedSettings.getControl("wlfAdvSettingsPopup")->getSignal()->connect(boost::bind(&LLOverlayBar::updateAdvSettingsPopup,this));
wfl_adv_settings_popupp->getSignal()->connect(boost::bind(&updateAdvSettingsPopup,_2));
gSavedSettings.getControl("ChatVisible")->getSignal()->connect(boost::bind(&updateChatVisible,_2)); gSavedSettings.getControl("ChatVisible")->getSignal()->connect(boost::bind(&updateChatVisible,_2));
gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(boost::bind(&updateAORemote,_2)); gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(boost::bind(&updateAORemote,_2));
gSavedSettings.getControl("ShowNearbyMediaFloater")->getSignal()->connect(boost::bind(&updateNearbyMediaFloater,_2)); gSavedSettings.getControl("ShowNearbyMediaFloater")->getSignal()->connect(boost::bind(&updateNearbyMediaFloater,_2));
childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote"));
wlfPanel_AdvSettings::updateClass(); updateAdvSettingsPopup();
bool wfl_adv_settings_popup = wfl_adv_settings_popupp->getValue().asBoolean();
if(LLLayoutStack* layout_stack = findChild<LLLayoutStack>("overlay_layout_panel"))
{
LLLayoutPanel* layout_panel = layout_stack->findChild<LLLayoutPanel>("AdvSettings_container");
if(layout_panel)
{
layout_stack->collapsePanel(layout_panel,!wfl_adv_settings_popup);
if(wfl_adv_settings_popup)
layout_panel->setTargetDim(layout_panel->getChild<LLView>("Adv_Settings")->getBoundingRect().getWidth());
}
}
return TRUE; return TRUE;
} }

View File

@@ -130,8 +130,8 @@ protected:
private: private:
/*static void updateAdvSettingsPopup(const LLSD &data); bool updateAdvSettingsPopup();
static void updateChatVisible(const LLSD &data);*/ //static void updateChatVisible(const LLSD &data);
}; };

View File

@@ -53,14 +53,13 @@
#include "llwlparamset.h" #include "llwlparamset.h"
#include "llwlparammanager.h" #include "llwlparammanager.h"
// [RLVa:KB] wlfPanel_AdvSettings::wlfPanel_AdvSettings() : mExpanded(false)
#include "rlvhandler.h"
// [/RLVa:KB]
wlfPanel_AdvSettings::wlfPanel_AdvSettings() : mBuilt(false)
{ {
setVisible(false);
setIsChrome(TRUE); setIsChrome(TRUE);
setFocusRoot(TRUE); setFocusRoot(TRUE);
if(rlv_handler_t::isEnabled())
gRlvHandler.setBehaviourToggleCallback(boost::bind(&wlfPanel_AdvSettings::onRlvBehaviorChange, this, _1, _2));
} }
//static //static
@@ -73,41 +72,48 @@ void wlfPanel_AdvSettings::updateClass()
void wlfPanel_AdvSettings::build() void wlfPanel_AdvSettings::build()
{ {
deleteAllChildren(); deleteAllChildren();
std::string ButtonState; std::string ButtonState;
if (gSavedSettings.getBOOL("wlfAdvSettingsPopup")) if (gSavedSettings.getBOOL("wlfAdvSettingsPopup"))
{ {
mExpanded = true;
LLUICtrlFactory::getInstance()->buildPanel(this, "wlfPanel_AdvSettings_expanded.xml", &getFactoryMap()); LLUICtrlFactory::getInstance()->buildPanel(this, "wlfPanel_AdvSettings_expanded.xml", &getFactoryMap());
ButtonState = "arrow_down.tga"; ButtonState = "arrow_down.tga";
} }
else else
{ {
mExpanded = false;
LLUICtrlFactory::getInstance()->buildPanel(this, "wlfPanel_AdvSettings.xml", &getFactoryMap()); LLUICtrlFactory::getInstance()->buildPanel(this, "wlfPanel_AdvSettings.xml", &getFactoryMap());
ButtonState = "arrow_up.tga"; ButtonState = "arrow_up.tga";
} }
getChild<LLButton>("expand")->setImageOverlay(ButtonState); getChild<LLButton>("expand")->setImageOverlay(ButtonState);
} }
void wlfPanel_AdvSettings::refresh() // [RLVa:KB] - Checked: 2013-06-20
void wlfPanel_AdvSettings::updateRlvVisibility()
{ {
// [RLVa:KB] - Checked: 2009-09-19 if(!mExpanded || !rlv_handler_t::isEnabled())
if (rlv_handler_t::isEnabled() && gSavedSettings.getBOOL("wlfAdvSettingsPopup")) return;
bool enable = !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV);
childSetEnabled("use_estate_wl", enable);
childSetEnabled("EnvAdvancedWaterButton", enable);
childSetEnabled("WLWaterPresetsCombo", enable);
childSetEnabled("WWprev", enable);
childSetEnabled("WWnext", enable);
childSetEnabled("EnvAdvancedSkyButton", enable);
childSetEnabled("WLSkyPresetsCombo", enable);
childSetEnabled("WLprev", enable);
childSetEnabled("WLnext", enable);
childSetEnabled("EnvTimeSlider", enable);
}
void wlfPanel_AdvSettings::onRlvBehaviorChange(ERlvBehaviour eBhvr, ERlvParamType eType)
{ {
if (!findChild<LLView>("use_estate_wl")) return; // Singu Note: Not certain why, but sometimes none of these exist even though the above setting implies they should if(eBhvr == RLV_BHVR_SETENV)
childSetEnabled("use_estate_wl", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)); updateRlvVisibility();
childSetEnabled("EnvAdvancedWaterButton", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("WLWaterPresetsCombo", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("WWprev", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("WWnext", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("EnvAdvancedSkyButton", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("WLSkyPresetsCombo", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("WLprev", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("WLnext", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
childSetEnabled("EnvTimeSlider", !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV));
} }
// [/RLVa:KB] // [/RLVa:KB]
}
void wlfPanel_AdvSettings::refreshLists() void wlfPanel_AdvSettings::refreshLists()
{ {
@@ -139,9 +145,10 @@ void wlfPanel_AdvSettings::refreshLists()
BOOL wlfPanel_AdvSettings::postBuild() BOOL wlfPanel_AdvSettings::postBuild()
{ {
setVisible(true);
childSetAction("expand", onClickExpandBtn, this); childSetAction("expand", onClickExpandBtn, this);
if (gSavedSettings.getBOOL("wlfAdvSettingsPopup")) if (mExpanded)
{ {
getChild<LLCheckBoxCtrl>("use_estate_wl")->setCommitCallback(onUseRegionSettings); getChild<LLCheckBoxCtrl>("use_estate_wl")->setCommitCallback(onUseRegionSettings);
@@ -175,6 +182,7 @@ BOOL wlfPanel_AdvSettings::postBuild()
mTimeSlider = getChild<LLSliderCtrl>("EnvTimeSlider"); mTimeSlider = getChild<LLSliderCtrl>("EnvTimeSlider");
mTimeSlider->setCommitCallback(onChangeDayTime); mTimeSlider->setCommitCallback(onChangeDayTime);
updateTimeSlider(); updateTimeSlider();
updateRlvVisibility();
} }
return TRUE; return TRUE;
} }

View File

@@ -34,6 +34,11 @@
#include "llpanel.h" #include "llpanel.h"
// [RLVa:KB]
#include "rlvhandler.h"
// [/RLVa:KB]
class LLComboBox; class LLComboBox;
class LLSliderCtrl; class LLSliderCtrl;
@@ -45,7 +50,10 @@ public:
~wlfPanel_AdvSettings (); ~wlfPanel_AdvSettings ();
BOOL postBuild(); BOOL postBuild();
void draw(); void draw();
void refresh();
void updateRlvVisibility();
void onRlvBehaviorChange(ERlvBehaviour eBhvr, ERlvParamType eType);
static void updateClass(); static void updateClass();
static void onClickExpandBtn(void* user_data); static void onClickExpandBtn(void* user_data);
@@ -76,7 +84,7 @@ protected:
// LLComboBox* mDayCyclePresetCombo; // LLComboBox* mDayCyclePresetCombo;
LLSliderCtrl* mTimeSlider; LLSliderCtrl* mTimeSlider;
bool mBuilt; bool mExpanded;
}; };
#endif // LL_wlfPanel_AdvSettings_H #endif // LL_wlfPanel_AdvSettings_H