From 2e656ed358af28f56c8b900345956d431f8c7b4d Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 2 Oct 2019 20:51:47 +0300 Subject: SL-6109 Removed obsolete control, moved table init to xml, cleanup --- indra/newview/app_settings/settings.xml | 8 +- indra/newview/llfloaterpreference.cpp | 245 ++------- indra/newview/llfloaterpreference.h | 10 - indra/newview/llkeyconflict.cpp | 13 +- indra/newview/llkeyconflict.h | 2 +- indra/newview/lltoolpie.h | 1 - .../default/xui/en/control_table_contents.xml | 569 +++++++++++++++++++++ .../default/xui/en/panel_preferences_controls.xml | 258 +--------- .../default/xui/en/panel_preferences_move.xml | 64 --- .../default/xui/en/panel_preferences_sound.xml | 26 +- 10 files changed, 636 insertions(+), 560 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/control_table_contents.xml (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d0cd4e2b39..7cdb41b3cb 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3542,7 +3542,7 @@ DoubleClickAutoPilot Comment - Enable double-click auto pilot + (Obsolete)Enable double-click auto pilot Persist 1 Type @@ -3553,13 +3553,13 @@ DoubleClickTeleport Comment - Enable double-click to teleport where allowed + Enable double-click to teleport where allowed (afects minimap and people panel) Persist 1 Type Boolean Value - 0 + 1 DoubleClickShowWorldMap @@ -15559,7 +15559,7 @@ ClickToWalk Comment - Click in world to walk to location + (obsolete)Click in world to walk to location Persist 1 Type diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 47cc93175e..3668f71feb 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -564,8 +564,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mGotPersonalInfo(false), mOriginalIMViaEmail(false), mLanguageChanged(false), - mAvatarDataInitialized(false), - mClickActionDirty(false) + mAvatarDataInitialized(false) { LLConversationLog::instance().addObserver(this); @@ -587,7 +586,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); - mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); @@ -615,8 +613,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) sSkin = gSavedSettings.getString("SkinCurrent"); - mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); - gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); @@ -883,12 +879,6 @@ void LLFloaterPreference::apply() } saveAvatarProperties(); - - if (mClickActionDirty) - { - updateClickActionSettings(); - mClickActionDirty = false; - } } void LLFloaterPreference::cancel() @@ -921,12 +911,6 @@ void LLFloaterPreference::cancel() // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); - if (mClickActionDirty) - { - updateClickActionControls(); - mClickActionDirty = false; - } - LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); if (advanced_proxy_settings) { @@ -1008,9 +992,6 @@ void LLFloaterPreference::onOpen(const LLSD& key) onChangeTextureFolder(); onChangeSoundFolder(); onChangeAnimationFolder(); - - // Load (double-)click to walk/teleport settings. - updateClickActionControls(); // Enabled/disabled popups, might have been changed by user actions // while preferences floater was closed. @@ -1848,10 +1829,6 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data) refresh(); } -void LLFloaterPreference::onClickSetKey() -{ -} - void LLFloaterPreference::onClickSetMiddleMouse() { LLUICtrl* p2t_line_editor = getChild("modifier_combo"); @@ -2335,11 +2312,6 @@ void LLFloaterPreference::onClickAdvanced() } } -void LLFloaterPreference::onClickActionChange() -{ - mClickActionDirty = true; -} - void LLFloaterPreference::onClickPermsDefault() { LLFloaterReg::showInstance("perms_default"); @@ -2377,26 +2349,6 @@ void LLFloaterPreference::onLogChatHistorySaved() } } -void LLFloaterPreference::updateClickActionSettings() -{ - const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); - const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); - - gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); -} - -void LLFloaterPreference::updateClickActionControls() -{ - const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); - const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); - const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); - - getChild("single_click_action_combo")->setValue((int)click_to_walk); - getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); -} - void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); @@ -2997,70 +2949,6 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() //------------------------LLPanelPreferenceControls-------------------------------- static LLPanelInjector t_pref_contrls("panel_preference_controls"); -//name of control and name of icon if it is a group, likely 'TEMP' until xml gets properly populated -typedef std::vector > controls_to_icon_t; -static const controls_to_icon_t commands_and_headers = -{ - //{ "control_view_actions", "Search_Icon" }, - //{ "control_interactions", "Command_Gestures_Icon" }, - { "control_movements", "Move_Walk_Off" }, - { "walk_to", "" }, - { "teleport_to", "" }, - { "push_forward", "" }, - { "push_backward", "" }, - { "turn_left", "" }, - { "turn_right", "" }, - { "slide_left", "" }, - { "slide_right", "" }, - { "jump", "" }, - { "push_down", "" }, - { "run_forward", "" }, - { "run_backward", "" }, - { "run_left", "" }, - { "run_right", "" }, - { "toggle_run", "" }, - { "toggle_fly", "" }, - { "toggle_sit", "" }, - { "stop_moving", "" }, - { "control_camera", "Cam_FreeCam_Off" }, - { "look_up", "" }, - { "look_down", "" }, - { "move_forward", "" }, - { "move_backward", "" }, - { "move_forward_fast", "" }, - { "move_backward_fast", "" }, - { "move_forward_sitting", "" }, - { "move_backward_sitting", "" }, - { "spin_over", "" }, - { "spin_under", "" }, - { "spin_over_sitting", "" }, - { "spin_under_sitting", "" }, - { "pan_up", "" }, - { "pan_down", "" }, - { "pan_left", "" }, - { "pan_right", "" }, - { "pan_in", "" }, - { "pan_out", "" }, - { "spin_around_ccw", "" }, - { "spin_around_cw", "" }, - { "spin_around_ccw_sitting", "" }, - { "spin_around_cw_sitting", "" }, - { "control_edit_title", "Tool_Dozer" }, - { "edit_avatar_spin_ccw", "" }, - { "edit_avatar_spin_cw", "" }, - { "edit_avatar_spin_over", "" }, - { "edit_avatar_spin_under", "" }, - { "edit_avatar_move_forward", "" }, - { "edit_avatar_move_backward", "" }, - { "control_mediacontent", "Audio_Press" }, - { "toggle_pause_media", "" }, - { "toggle_enable_media", "" }, - { "voice_follow_key", "" }, - { "toggle_voice", "" }, - { "start_chat", "" }, - { "start_gesture", "" }, -}; - LLPanelPreferenceControls::LLPanelPreferenceControls() :LLPanelPreference(), mEditingColumn(-1), @@ -3078,10 +2966,6 @@ LLPanelPreferenceControls::~LLPanelPreferenceControls() BOOL LLPanelPreferenceControls::postBuild() { - //todo: add pitch/yaw? - //todo: should be auto-expandable with menu items and should pull names from menu when possible - - // populate list of controls pControlsTable = getChild("controls_list"); pKeyModeBox = getChild("key_mode"); @@ -3093,47 +2977,6 @@ BOOL LLPanelPreferenceControls::postBuild() return TRUE; } -void LLPanelPreferenceControls::addGroupRow(const std::string &control_name, const std::string &icon) -{ - LLScrollListItem::Params item_params; - item_params.value = ""; - - LLScrollListCell::Params icon_cell_params; - icon_cell_params.font = LLFontGL::getFontSansSerif(); - icon_cell_params.font_halign = LLFontGL::LEFT; - icon_cell_params.type = "icontext"; - - LLScrollListCell::Params cell_params; - // init basic cell params - cell_params.font = LLFontGL::getFontSansSerif(); - cell_params.font_halign = LLFontGL::LEFT; - - std::string label; - if (hasString(control_name)) - { - label = getString(control_name); - } - else - { - label = control_name; - } - icon_cell_params.column = "lst_action"; - icon_cell_params.text = label; - icon_cell_params.value = icon; - item_params.columns.add(icon_cell_params); - //dummy cells - cell_params.column = "lst_ctrl1"; - cell_params.value = ""; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl2"; - cell_params.value = ""; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl3"; - cell_params.value = ""; - item_params.columns.add(cell_params); - pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); -} - void LLPanelPreferenceControls::regenerateControls() { mEditingMode = pKeyModeBox->getValue().asInteger(); @@ -3144,58 +2987,74 @@ void LLPanelPreferenceControls::regenerateControls() void LLPanelPreferenceControls::populateControlTable() { pControlsTable->clearRows(); - - // todo: subsections need sorting? - std::string label, control_name; + pControlsTable->clearColumns(); + + std::string filename; + switch ((LLKeyConflictHandler::ESourceMode)mEditingMode) + { + case LLKeyConflictHandler::MODE_THIRD_PERSON: + case LLKeyConflictHandler::MODE_FIRST_PERSON: + case LLKeyConflictHandler::MODE_EDIT: + case LLKeyConflictHandler::MODE_EDIT_AVATAR: + case LLKeyConflictHandler::MODE_SITTING: + filename = "control_table_contents.xml"; + break; + default: + // 'saved settings' mode doesn't have UI or actual settings yet + LL_INFOS() << "Unimplemented mode" << LL_ENDL; + return; + } + + std::string full_filename = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, filename); + LLSimpleXUIParser parser; + LLScrollListCtrl::Contents contents; + if (!parser.readXUI(full_filename, contents) + || !contents.validateBlock()) + { + LL_INFOS() << "Failed to load" << LL_ENDL; + return; + } + + for (LLInitParam::ParamIterator::const_iterator row_it = contents.columns.begin(); + row_it != contents.columns.end(); + ++row_it) + { + pControlsTable->addColumn(*row_it); + } + LLScrollListCell::Params cell_params; // init basic cell params cell_params.font = LLFontGL::getFontSansSerif(); cell_params.font_halign = LLFontGL::LEFT; cell_params.column = ""; - cell_params.value = label; + cell_params.value = ""; - controls_to_icon_t::const_iterator iter = commands_and_headers.begin(); - controls_to_icon_t::const_iterator end = commands_and_headers.end(); - for (; iter != end; ++iter) + + for (LLInitParam::ParamIterator::const_iterator row_it = contents.rows.begin(); + row_it != contents.rows.end(); + ++row_it) { - if (iter->second.empty()) + std::string control = row_it->value.getValue().asString(); + if (!control.empty() && control != "menu_separator") { - // general control - LLScrollListItem::Params item_params; - item_params.value = LLSD(iter->first); - - cell_params.column = "lst_action"; - bool enabled = mConflictHandler[mEditingMode].canAssignControl(iter->first); - if (hasString(iter->first)) - { - label = getString(iter->first); - } - else - { - label = iter->first; - } - cell_params.value = label; - item_params.columns.add(cell_params); + // At the moment 4 collumns are hardcoded + LLScrollListItem::Params item_params(*row_it); + bool enabled = mConflictHandler[mEditingMode].canAssignControl(control); + item_params.enabled.setValue(enabled); cell_params.column = "lst_ctrl1"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 0); - cell_params.enabled = enabled; + cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 0); item_params.columns.add(cell_params); cell_params.column = "lst_ctrl2"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 1); - cell_params.enabled = enabled; + cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 1); item_params.columns.add(cell_params); cell_params.column = "lst_ctrl3"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 2); - cell_params.enabled = enabled; + cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 2); item_params.columns.add(cell_params); - pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); } else { - // header - addSeparator(); - addGroupRow(iter->first, iter->second); + pControlsTable->addRow(*row_it, EAddPosition::ADD_BOTTOM); } } } @@ -3211,7 +3070,6 @@ void LLPanelPreferenceControls::addSeparator() void LLPanelPreferenceControls::updateTable() { - pControlsTable->deselectAllItems(); mEditingControl.clear(); std::vector list = pControlsTable->getAllData(); for (S32 i = 0; i < list.size(); ++i) @@ -3227,6 +3085,7 @@ void LLPanelPreferenceControls::updateTable() cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2)); } } + pControlsTable->deselectAllItems(); } void LLPanelPreferenceControls::apply() diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 570f1c6caf..90697341cb 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -130,13 +130,6 @@ protected: // callback for when client turns on impostors void onAvatarImpostorsEnable(); - // callback for commit in the "Single click on land" and "Double click on land" comboboxes. - void onClickActionChange(); - // updates click/double-click action settings depending on controls values - void updateClickActionSettings(); - // updates click/double-click action controls depending on values from settings.xml - void updateClickActionControls(); - public: // This function squirrels away the current values of the controls so that // cancel() can restore them. @@ -149,7 +142,6 @@ public: void onClickResetCache(); void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata); void onSelectSkin(); - void onClickSetKey(); void onClickSetMiddleMouse(); void onClickSetSounds(); void onClickEnablePopup(); @@ -205,7 +197,6 @@ private: static std::string sSkin; notifications_map mNotificationOptions; - bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user. bool mGotPersonalInfo; bool mOriginalIMViaEmail; bool mLanguageChanged; @@ -317,7 +308,6 @@ public: void onCancelKeyBind(); private: - void addGroupRow(const std::string &control_name, const std::string &icon); void regenerateControls(); void populateControlTable(); void addSeparator(); diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index c74eea6e47..01230ea26a 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -166,7 +166,8 @@ bool LLKeyConflictHandler::canAssignControl(const std::string &control_name) { return iter->second.mAssignable; } - return false; + // If we don't know this control means it wasn't assigned by user yet and thus is editable + return true; } bool LLKeyConflictHandler::registerControl(const std::string &control_name, U32 index, EMouseClickType mouse, KEY key, MASK mask, bool ignore_mask) @@ -346,7 +347,7 @@ void LLKeyConflictHandler::loadFromSettings(ESourceMode load_mode) // E.X. In case we need placeholder keys for conflict resolution. generatePlaceholders(load_mode); - if (load_mode == MODE_GENERAL) + if (load_mode == MODE_SAVED_SETTINGS) { // load settings clss knows about, but it also possible to load settings by name separately const S32 size = std::extent::value; @@ -383,7 +384,7 @@ void LLKeyConflictHandler::saveToSettings() return; } - if (mLoadMode == MODE_GENERAL) + if (mLoadMode == MODE_SAVED_SETTINGS) { control_map_t::iterator iter = mControlsMap.begin(); control_map_t::iterator end = mControlsMap.end(); @@ -548,7 +549,7 @@ LLKeyData LLKeyConflictHandler::getDefaultControl(const std::string &control_nam { return LLKeyData(); } - if (mLoadMode == MODE_GENERAL) + if (mLoadMode == MODE_SAVED_SETTINGS) { LLControlVariablePtr var = gSavedSettings.getControl(control_name); if (var) @@ -590,7 +591,7 @@ void LLKeyConflictHandler::resetToDefaultAndResolve(const std::string &control_n { return; } - if (mLoadMode == MODE_GENERAL) + if (mLoadMode == MODE_SAVED_SETTINGS) { LLControlVariablePtr var = gSavedSettings.getControl(control_name); if (var) @@ -639,7 +640,7 @@ void LLKeyConflictHandler::resetToDefault(const std::string &control_name) void LLKeyConflictHandler::resetToDefaults(ESourceMode mode) { - if (mode == MODE_GENERAL) + if (mode == MODE_SAVED_SETTINGS) { control_map_t::iterator iter = mControlsMap.begin(); control_map_t::iterator end = mControlsMap.end(); diff --git a/indra/newview/llkeyconflict.h b/indra/newview/llkeyconflict.h index a0886bedce..e339264aaa 100644 --- a/indra/newview/llkeyconflict.h +++ b/indra/newview/llkeyconflict.h @@ -62,7 +62,7 @@ public: MODE_EDIT, MODE_EDIT_AVATAR, MODE_SITTING, - MODE_GENERAL, // for settings from saved settings + MODE_SAVED_SETTINGS, // for settings from saved settings MODE_COUNT }; diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 60159594c9..ac6751aac0 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -110,7 +110,6 @@ private: LLPointer mAutoPilotDestination; LLPointer mMouseSteerGrabPoint; bool mClockwise; - bool mBlockClickToWalk; LLUUID mMediaMouseCaptureID; LLPickInfo mPick; LLPickInfo mHoverPick; diff --git a/indra/newview/skins/default/xui/en/control_table_contents.xml b/indra/newview/skins/default/xui/en/control_table_contents.xml new file mode 100644 index 0000000000..00c2d27124 --- /dev/null +++ b/indra/newview/skins/default/xui/en/control_table_contents.xml @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 b7b5280825..eca3c550d5 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_controls.xml @@ -9,244 +9,6 @@ name="controls" top="1" width="517"> - - Walk to - - - View Actions - - - About/Profile - - - Orbit - - - Pan - - - World Map - - - Zoom - - - Interactions - - - Build - - - Drag - - - Edit - - - Menu - - - Open - - - Touch - - - Wear - - - Move Actions - - - Teleport to - - - Sit/Stand - - - Teleport To - - - Move Forward - - - Move Backward - - - Left - - - Right - - - - Strafe left - - - Strafe right - - - Jump/Up - - - Down - - - Run - - - Run Forward - - - Run Backward - - - Run Left - - - Run Right - - - Toggle Run - - - Fly/Stop flying - - - Stop Moving - - - Camera - - - Look Up - - - Look Down - - - Camera Forward - - - Camera Backward - - - Camera Forward Fast - - - Camera Backward Fast - - - Camera Forward Sitting - - - Camera Backward Sitting - - - Camera Spin Over - - - Camera Spin Under - - - Camera Spin Over - - - Camera Spin Under - - - Camera Pan Up - - - Camera Pan Down - - - Camera Pan Left - - - Camera Pan Right - - - Camera Pan In - - - Camera Pan Out - - - Sound and Media - - - Play/Pause Media - - - Play/Stop All Media - - - Voice - - - Toggle Voice - - - - - - - + name="controls_list" + fg_disable_color="ScrollUnselectedColor"/> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index 8794e3bf95..d106456b31 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -195,70 +195,6 @@ name="invert_mouse" top_delta="0" width="128" /> - - Single click on land: - - - - - - - - Double click on land: - - - - - - -