summaryrefslogtreecommitdiff
path: root/indra
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
parente74ce9655ed9f1124887aa31aa2e2155ea62d3da (diff)
even more correct GameControl feature-flag switch
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/lltabcontainer.cpp28
-rw-r--r--indra/llwindow/llgamecontrol.cpp2
-rw-r--r--indra/newview/app_settings/settings.xml2
-rw-r--r--indra/newview/llfloaterpreference.cpp53
-rw-r--r--indra/newview/llfloaterpreference.h12
-rw-r--r--indra/newview/llviewermenu.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml32
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_controls.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_game_control.xml18
9 files changed, 98 insertions, 53 deletions
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 5e0985c79c..7c9aa42e5f 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1258,7 +1258,6 @@ void LLTabContainer::removeTabPanel(LLPanel* child)
bool has_focus = gFocusMgr.childHasKeyboardFocus(this);
- // If the tab being deleted is the selected one, select a different tab.
for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
@@ -1296,6 +1295,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child)
// make sure we don't have more locked tabs than we have tabs
mLockedTabCount = llmin(getTabCount(), mLockedTabCount);
+ // If the tab being deleted is the selected one, select a different tab.
if (mCurrentTabIdx >= (S32)mTabList.size())
{
mCurrentTabIdx = static_cast<S32>(mTabList.size()) - 1;
@@ -1723,7 +1723,7 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
{
S32 image_overlay_width = 0;
- if(mCustomIconCtrlUsed)
+ if (mCustomIconCtrlUsed)
{
LLCustomButtonIconCtrl* button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton);
LLIconCtrl* icon_ctrl = button ? button->getIconCtrl() : NULL;
@@ -2173,12 +2173,22 @@ S32 LLTabContainer::getTotalTabWidth() const
void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
{
- for( tuple_list_t::const_iterator itr = mTabList.begin(); itr != mTabList.end(); ++itr )
+ S32 num_tabs = S32(mTabList.size());
+ for (S32 i = 0; i < num_tabs; ++i)
{
- LLTabTuple const *pTT = *itr;
- if( pTT->mTabPanel == aPanel )
+ LLTabTuple* tuple = mTabList[i];
+ if( tuple->mTabPanel == aPanel )
{
- pTT->mVisible = aVisible;
+ if (tuple->mVisible != aVisible)
+ {
+ tuple->mVisible = aVisible;
+ if (aVisible)
+ {
+ this->selectTab(i);
+ this->setVisible(true);
+ }
+ updateMaxScrollPos();
+ }
break;
}
}
@@ -2194,11 +2204,7 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
break;
}
}
-
- if( foundTab )
- this->setVisible( true );
- else
- this->setVisible( false );
+ this->setVisible( foundTab );
updateMaxScrollPos();
}
diff --git a/indra/llwindow/llgamecontrol.cpp b/indra/llwindow/llgamecontrol.cpp
index 0e3782a10e..812c861370 100644
--- a/indra/llwindow/llgamecontrol.cpp
+++ b/indra/llwindow/llgamecontrol.cpp
@@ -434,7 +434,7 @@ namespace
// data state. However, to keep the ambient resend bandwidth low we
// expand the resend period at a geometric rate.
//
- constexpr U64 MSEC_PER_NSEC = 1e6;
+ constexpr U64 MSEC_PER_NSEC = 1000000;
constexpr U64 FIRST_RESEND_PERIOD = 100 * MSEC_PER_NSEC;
constexpr U64 RESEND_EXPANSION_RATE = 10;
LLGameControl::State g_outerState; // from controller devices
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 2057ddaa0d..36abebc942 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -2612,7 +2612,7 @@
<key>Value</key>
<integer>1</integer>
</map>
- <key>GameControl</key>
+ <key>EnableGameControl</key>
<map>
<key>Comment</key>
<string>Enable GameControl feature</string>
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);
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 1a498c035e..b3872958ac 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -92,6 +92,8 @@ public:
virtual void changed() override;
virtual void changed(const LLUUID& session_id, U32 mask) override {};
+ static void refreshInstance();
+
// static data update, called from message handler
static void updateUserInfo(const std::string& visibility);
@@ -201,6 +203,7 @@ public:
void buildPopupLists();
static void refreshSkin(void* data);
void selectPanel(const LLSD& name);
+ void setPanelVisibility(const LLSD& name, bool visible);
void saveGraphicsPreset(std::string& preset);
void setRecommendedSettings();
@@ -327,6 +330,8 @@ public:
bool postBuild() override;
+ void refresh() override;
+
void apply() override;
void cancel(const std::vector<std::string> settings_to_skip = {}) override;
void saveSettings() override;
@@ -349,6 +354,9 @@ public:
void onDefaultKeyBind(bool all_modes) override;
void onCancelKeyBind() override;
+ // Cleans content and then adds content from xml files according to current mEditingMode
+ void populateControlTable();
+
private:
// reloads settings, discards current changes, updates table
void regenerateControls();
@@ -358,9 +366,6 @@ private:
bool addControlTableRows(const std::string &filename);
void addControlTableSeparator();
- // Cleans content and then adds content from xml files according to current mEditingMode
- void populateControlTable();
-
// Updates keybindings from storage to table
void updateTable();
@@ -435,7 +440,6 @@ private:
void resetButtonMappingsToDefaults();
// Above the tab container
- LLCheckBoxCtrl *mCheckEnableGameControl;
LLCheckBoxCtrl *mCheckGameControlToServer; // send game_control data to server
LLCheckBoxCtrl *mCheckGameControlToAgent; // use game_control data to move avatar
LLCheckBoxCtrl *mCheckAgentToGameControl; // translate external avatar actions to game_control data
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index a6614542b8..39aa85beea 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -72,6 +72,7 @@
#include "llfloaterpathfindingcharacters.h"
#include "llfloaterpathfindinglinksets.h"
#include "llfloaterpay.h"
+#include "llfloaterpreference.h"
#include "llfloaterreporter.h"
#include "llfloatersearch.h"
#include "llfloaterscriptdebug.h"
@@ -965,6 +966,7 @@ class LLAdvancedToggleExperiment : public view_listener_t
if (feature == "GameControl")
{
LLGameControl::setEnabled(! LLGameControl::isEnabled());
+ LLFloaterPreference::refreshInstance();
return true;
}
return false;
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index f6946f5304..da9cc0c98d 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2464,22 +2464,6 @@ function="World.EnvPreset"
<menu_item_separator/>
- <menu
- create_jump_keys="true"
- label="Experimental Features"
- name="Experimental Features"
- tear_off="true">
- <menu_item_check
- label="GameControl"
- name="ToggleGameControl">
- <menu_item_check.on_check
- function="Advanced.CheckExperiment"
- parameter="GameControl" />
- <menu_item_check.on_click
- function="Advanced.ToggleExperiment"
- parameter="GameControl" />
- </menu_item_check>
- </menu>
<menu_item_call
label="Show Debug Settings"
name="Debug Settings">
@@ -2507,6 +2491,22 @@ function="World.EnvPreset"
visible="false">
<menu
create_jump_keys="true"
+ label="Experimental Features"
+ name="Experimental Features"
+ tear_off="true">
+ <menu_item_check
+ label="GameControl"
+ name="ToggleGameControl">
+ <menu_item_check.on_check
+ function="Advanced.CheckExperiment"
+ parameter="GameControl" />
+ <menu_item_check.on_click
+ function="Advanced.ToggleExperiment"
+ parameter="GameControl" />
+ </menu_item_check>
+ </menu>
+ <menu
+ create_jump_keys="true"
label="Consoles"
name="Consoles"
tear_off="true">
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_controls.xml b/indra/newview/skins/default/xui/en/panel_preferences_controls.xml
index f8801f9c89..b02270dd9e 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_controls.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_controls.xml
@@ -6,7 +6,7 @@
label="Controls"
layout="topleft"
left="102"
- name="controls"
+ name="controls_panel"
top="1"
width="517">
<combo_box
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_game_control.xml b/indra/newview/skins/default/xui/en/panel_preferences_game_control.xml
index 8c9e15a180..bd92fe895d 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_game_control.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_game_control.xml
@@ -6,25 +6,17 @@
label="Game Controls"
layout="topleft"
left="102"
- name="gamecontrol"
+ name="game_control_panel"
top="1"
width="517">
<check_box
- name="enable_game_control"
- control_name="EnableGameControl"
- label="Enable GameControl"
- layout="topleft"
- height="15"
- left="10"
- top="10"/>
- <check_box
name="game_control_to_server"
control_name="GameControlToServer"
label="Send GameControl Data to server"
layout="topleft"
height="15"
left="10"
- top="30"/>
+ top="10"/>
<check_box
name="game_control_to_agent"
control_name="GameControlToAgent"
@@ -32,7 +24,7 @@
layout="topleft"
height="15"
left="10"
- top="50"/>
+ top="30"/>
<check_box
name="agent_to_game_control"
control_name="AgentToGameControl"
@@ -40,12 +32,12 @@
layout="topleft"
height="15"
left="10"
- top="70"/>
+ top="50"/>
<tab_container
name="game_control_tabs"
layout="topleft"
follows="all"
- top="90"
+ top="70"
left="2"
right="-2"
bottom="-32">