summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpreference.cpp
diff options
context:
space:
mode:
authorleviathan <leviathan@lindenlab.com>2024-07-17 15:25:22 -0700
committerAndrew Meadows <andrew.l.meadows@gmail.com>2024-10-03 09:03:31 -0700
commit59ed92522f7b72731911825a831bab559f0c1c8b (patch)
tree1d8642c8169f9e1641e7b497e070873657f265f8 /indra/newview/llfloaterpreference.cpp
parente74ce9655ed9f1124887aa31aa2e2155ea62d3da (diff)
even more correct GameControl feature-flag switch
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r--indra/newview/llfloaterpreference.cpp53
1 files changed, 47 insertions, 6 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 3c4eab0282..7ea9f9b4c2 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -402,6 +402,7 @@ void LLFloaterPreference::saveAvatarProperties( void )
}
}
+// static
void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bool allow_publish)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
@@ -439,6 +440,7 @@ bool LLFloaterPreference::postBuild()
mDisabledPopups = getChild<LLScrollListCtrl>("disabled_popups");
mEnablePopupBtn = getChild<LLButton>("enable_this_popup");
mDisablePopupBtn = getChild<LLButton>("disable_this_popup");
+ setPanelVisibility("game_control", LLGameControl::isEnabled());
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
@@ -1048,6 +1050,15 @@ void LLFloaterPreference::onBtnCancel(const LLSD& userdata)
}
}
+//static
+void LLFloaterPreference::refreshInstance()
+{
+ if (LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences"))
+ {
+ instance->refresh();
+ }
+}
+
// static
void LLFloaterPreference::updateUserInfo(const std::string& visibility)
{
@@ -1057,6 +1068,7 @@ void LLFloaterPreference::updateUserInfo(const std::string& visibility)
}
}
+// static
void LLFloaterPreference::refreshEnabledGraphics()
{
if (LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences"))
@@ -1292,6 +1304,16 @@ void LLAvatarComplexityControls::setIndirectMaxArc()
void LLFloaterPreference::refresh()
{
+ setPanelVisibility("game_control", LLGameControl::isEnabled());
+ LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
+ for (LLView* view : *tabcontainer->getChildList())
+ {
+ if (LLPanelPreferenceControls* panel = dynamic_cast<LLPanelPreferenceControls*>(view))
+ {
+ panel->refresh();
+ break;
+ }
+ }
LLFloater::refresh();
setMaxNonImpostorsText(
gSavedSettings.getU32("RenderAvatarMaxNonImpostors"),
@@ -1945,6 +1967,16 @@ void LLFloaterPreference::selectPanel(const LLSD& name)
}
}
+void LLFloaterPreference::setPanelVisibility(const LLSD& name, bool visible)
+{
+ LLTabContainer * tab_containerp = getChild<LLTabContainer>("pref core");
+ LLPanel * panel = tab_containerp->getPanelByName(name.asStringRef());
+ if (NULL != panel)
+ {
+ tab_containerp->setTabVisibility(panel, visible);
+ }
+}
+
void LLFloaterPreference::selectPrivacyPanel()
{
selectPanel("im");
@@ -2532,6 +2564,12 @@ LLPanelPreferenceControls::~LLPanelPreferenceControls()
{
}
+void LLPanelPreferenceControls::refresh()
+{
+ populateControlTable();
+ LLPanelPreference::refresh();
+}
+
bool LLPanelPreferenceControls::postBuild()
{
// populate list of controls
@@ -2710,7 +2748,10 @@ void LLPanelPreferenceControls::populateControlTable()
addControlTableSeparator();
addControlTableRows("control_table_contents_media.xml");
addControlTableSeparator();
- addControlTableRows("control_table_contents_game_control.xml");
+ if (LLGameControl::isEnabled())
+ {
+ addControlTableRows("control_table_contents_game_control.xml");
+ }
}
// MODE_THIRD_PERSON; MODE_EDIT_AVATAR; MODE_SITTING
else if (mEditingMode < LLKeyConflictHandler::MODE_SAVED_SETTINGS)
@@ -2729,7 +2770,10 @@ void LLPanelPreferenceControls::populateControlTable()
addControlTableRows("control_table_contents_media.xml");
addControlTableSeparator();
- addControlTableRows("control_table_contents_game_control.xml");
+ if (LLGameControl::isEnabled())
+ {
+ addControlTableRows("control_table_contents_game_control.xml");
+ }
}
else
{
@@ -3440,12 +3484,10 @@ void LLPanelPreferenceGameControl::onCommitNumericValue()
bool LLPanelPreferenceGameControl::postBuild()
{
// Above the tab container
- mCheckEnableGameControl = getChild<LLCheckBoxCtrl>("enable_game_control");
mCheckGameControlToServer = getChild<LLCheckBoxCtrl>("game_control_to_server");
mCheckGameControlToAgent = getChild<LLCheckBoxCtrl>("game_control_to_agent");
mCheckAgentToGameControl = getChild<LLCheckBoxCtrl>("agent_to_game_control");
- mCheckEnableGameControl->setCommitCallback([this](LLUICtrl*, const LLSD&) { updateEnable(); });
mCheckGameControlToAgent->setCommitCallback([this](LLUICtrl*, const LLSD&) { updateActionTableState(); });
mCheckAgentToGameControl->setCommitCallback([this](LLUICtrl*, const LLSD&) { updateActionTableState(); });
@@ -3522,7 +3564,6 @@ bool LLPanelPreferenceGameControl::postBuild()
// This function is called before floater is shown
void LLPanelPreferenceGameControl::onOpen(const LLSD& key)
{
- mCheckEnableGameControl->setValue(LLGameControl::isEnabled());
mCheckGameControlToServer->setValue(LLGameControl::getSendToServer());
mCheckGameControlToAgent->setValue(LLGameControl::getControlAgent());
mCheckAgentToGameControl->setValue(LLGameControl::getTranslateAgentActions());
@@ -3882,7 +3923,7 @@ void LLPanelPreferenceGameControl::addActionTableSeparator()
void LLPanelPreferenceGameControl::updateEnable()
{
- bool enabled = mCheckEnableGameControl->get();
+ bool enabled = LLGameControl::isEnabled();
LLGameControl::setEnabled(enabled);
mCheckGameControlToServer->setEnabled(enabled);