diff options
author | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-01-18 20:13:48 +0200 |
---|---|---|
committer | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-01-18 20:13:48 +0200 |
commit | a5dfdf0c6f64d40dc8d3d61434427471dbcfc0b2 (patch) | |
tree | 0eacde6a79fa3cbff81d52519b15655513de20ea | |
parent | 48123c536c8ae182b39440163d7002a07d126e0c (diff) |
Refactored fix for (EXT-4156) [BSI] Friendslist doesn't toggle open/close on shortcut
- Moved side panel toggling from viewer menu to side tray class.
--HG--
branch : product-engine
-rw-r--r-- | indra/newview/llsidetray.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llsidetray.h | 10 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 25 |
3 files changed, 33 insertions, 17 deletions
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index fb8aa39445..50c47e293e 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -639,6 +639,21 @@ LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& para return NULL; } +void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params) +{ + if(!sub_panel) + return; + + if (sub_panel->isInVisibleChain()) + { + LLSideTray::getInstance()->collapseSideBar(); + } + else + { + LLSideTray::getInstance()->showPanel(panel_name, params); + } +} + // This is just LLView::findChildView specialized to restrict the search to LLPanels. // Optimization for EXT-4068 to avoid searching down to the individual item level // when inventories are large. diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h index de2cfe9711..b1c8675793 100644 --- a/indra/newview/llsidetray.h +++ b/indra/newview/llsidetray.h @@ -94,7 +94,15 @@ public: * if no such tab - return NULL, otherwise a pointer to the panel * Pass params as array, or they may be overwritten(example - params["name"]="nearby") */ - LLPanel* showPanel (const std::string& panel_name, const LLSD& params); + LLPanel* showPanel (const std::string& panel_name, const LLSD& params); + + /** + * Toggling Side Tray tab which contains "sub_panel" child of "panel_name" panel. + * If "sub_panel" is not visible Side Tray is opened to display it, + * otherwise Side Tray is collapsed. + * params are passed to "panel_name" panel onOpen(). + */ + void togglePanel (LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params); /* * get the panel (don't show it or do anything else with it) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f87d5693e8..88a61c9d49 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3365,13 +3365,13 @@ void handle_show_side_tray() root->addChild(side_tray); } -class LLShowPanelPeopleTab : public view_listener_t +// Toggle one of "People" panel tabs in side tray. +class LLTogglePanelPeopleTab : public view_listener_t { bool handleEvent(const LLSD& userdata) { std::string panel_name = userdata.asString(); - // Open tab of the "People" panel in side tray. LLSD param; param["people_panel_tab_name"] = panel_name; @@ -3381,15 +3381,15 @@ class LLShowPanelPeopleTab : public view_listener_t if (panel_name == "friends_panel") { - return togglePanel(friends_panel, param); + return togglePeoplePanel(friends_panel, panel_name, param); } else if (panel_name == "groups_panel") { - return togglePanel(groups_panel, param); + return togglePeoplePanel(groups_panel, panel_name, param); } else if (panel_name == "nearby_panel") { - return togglePanel(nearby_panel, param); + return togglePeoplePanel(nearby_panel, panel_name, param); } else { @@ -3397,23 +3397,16 @@ class LLShowPanelPeopleTab : public view_listener_t } } - static bool togglePanel(LLPanel* &panel, const LLSD& param) + static bool togglePeoplePanel(LLPanel* &panel, const std::string& panel_name, const LLSD& param) { if(!panel) { - panel = LLSideTray::getInstance()->findChild<LLPanel>(param["people_panel_tab_name"].asString()); + panel = LLSideTray::getInstance()->getPanel(panel_name); if(!panel) return false; } - if (panel->isInVisibleChain()) - { - LLSideTray::getInstance()->collapseSideBar(); - } - else - { - LLSideTray::getInstance()->showPanel("panel_people", param); - } + LLSideTray::getInstance()->togglePanel(panel, "panel_people", param); return true; } @@ -7940,7 +7933,7 @@ void initialize_menus() view_listener_t::addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments"); // we don't use boost::bind directly to delay side tray construction - view_listener_t::addMenu( new LLShowPanelPeopleTab(), "SideTray.PanelPeopleTab"); + view_listener_t::addMenu( new LLTogglePanelPeopleTab(), "SideTray.PanelPeopleTab"); // Avatar pie menu view_listener_t::addMenu(new LLObjectMute(), "Avatar.Mute"); |