diff options
author | Ansariel <none@none> | 2016-11-14 14:45:53 +0100 |
---|---|---|
committer | Ansariel <none@none> | 2016-11-14 14:45:53 +0100 |
commit | 420b1c9429d36d75ee3c5de85b37f47bc207a122 (patch) | |
tree | 2f4670646bb6ce1b59b2dc124960d7490a990ed0 /indra/newview | |
parent | 086c1342152895da28d2e0130d09432152604ca8 (diff) |
STORM-2141: Fix various inventory floater related issues:
* Opening new inventory via Control-Shift-I shortcut uses legacy and potentinally dangerous code path
* Closing new inventory windows don't release memory
* During shutdown legacy and inoperable code for inventory window cleanup is called
* Remove old and unused inventory legacy code
Diffstat (limited to 'indra/newview')
23 files changed, 33 insertions, 229 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 16edd39ecc..c8051bc9af 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -248,7 +248,6 @@ set(viewer_SOURCE_FILES llfloaterimsession.cpp llfloaterimcontainer.cpp llfloaterinspect.cpp - llfloaterinventory.cpp llfloaterjoystick.cpp llfloaterlagmeter.cpp llfloaterland.cpp @@ -866,7 +865,6 @@ set(viewer_HEADER_FILES llfloaterimsession.h llfloaterimcontainer.h llfloaterinspect.h - llfloaterinventory.h llfloaterjoystick.h llfloaterlagmeter.h llfloaterland.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 76d0d46997..f043155753 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -208,7 +208,7 @@ #include "llfloaterreg.h" #include "llfloateroutfitsnapshot.h" #include "llfloatersnapshot.h" -#include "llfloaterinventory.h" +#include "llsidepanelinventory.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -5488,7 +5488,7 @@ void LLAppViewer::disconnectViewer() expCache->cleanup(); // close inventory interface, close all windows - LLFloaterInventory::cleanup(); + LLSidepanelInventory::cleanup(); gAgentWearables.cleanup(); gAgentCamera.cleanup(); diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index b32ac860aa..4607b4ac41 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -44,7 +44,6 @@ #include "llinventorymodel.h" // for gInventory #include "llfirstuse.h" #include "llfloaterreg.h" -#include "llfloaterinventory.h" // for LLInventoryIcon::getIcon #include "llnotificationsutil.h" #include "llselectmgr.h" #include "llscrolllistctrl.h" diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp deleted file mode 100644 index 9b9b90e521..0000000000 --- a/indra/newview/llfloaterinventory.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @file llfloaterinventory.cpp - * @brief Implementation of the inventory view and associated stuff. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterinventory.h" - -#include "llagentcamera.h" -//#include "llfirstuse.h" -#include "llfloaterreg.h" -#include "llinventorymodel.h" -#include "llpanelmaininventory.h" -#include "llresmgr.h" -#include "llviewerfoldertype.h" -#include "lltransientfloatermgr.h" - -///---------------------------------------------------------------------------- -/// LLFloaterInventory -///---------------------------------------------------------------------------- - -LLFloaterInventory::LLFloaterInventory(const LLSD& key) - : LLFloater(key) -{ - LLTransientFloaterMgr::getInstance()->addControlView(this); -} - -LLFloaterInventory::~LLFloaterInventory() -{ - LLTransientFloaterMgr::getInstance()->removeControlView(this); -} - -BOOL LLFloaterInventory::postBuild() -{ - mPanelMainInventory = findChild<LLPanelMainInventory>("Inventory Panel"); - return TRUE; -} - -LLInventoryPanel* LLFloaterInventory::getPanel() -{ - if (mPanelMainInventory) - return mPanelMainInventory->getPanel(); - return NULL; -} - -// static -LLFloaterInventory* LLFloaterInventory::showAgentInventory() -{ - // Hack to generate semi-unique key for each inventory floater. - static S32 instance_num = 0; - instance_num = (instance_num + 1) % S32_MAX; - - LLFloaterInventory* iv = NULL; - if (!gAgentCamera.cameraMouselook()) - { - iv = LLFloaterReg::showTypedInstance<LLFloaterInventory>("inventory", LLSD(instance_num)); - } - return iv; -} - -// static -void LLFloaterInventory::cleanup() -{ - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end();) - { - LLFloaterInventory* iv = dynamic_cast<LLFloaterInventory*>(*iter++); - if (iv) - { - iv->destroy(); - } - } -} - -void LLFloaterInventory::onOpen(const LLSD& key) -{ - //LLFirstUse::useInventory(); -} - -void LLFloaterInventory::onClose(bool app_quitting) -{ - LLFloater::onClose(app_quitting); - if (mKey.asInteger() > 1) - { - destroy(); - } -} diff --git a/indra/newview/llfloaterinventory.h b/indra/newview/llfloaterinventory.h deleted file mode 100644 index 823c4903b4..0000000000 --- a/indra/newview/llfloaterinventory.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file llfloaterinventory.h - * @brief LLFloaterInventory, LLInventoryFolder, and LLInventoryItem - * class definition - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERINVENTORY_H -#define LL_LLFLOATERINVENTORY_H - -#include "llfloater.h" -#include "llfoldertype.h" - -class LLInventoryPanel; -class LLPanelMainInventory; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFloaterInventory -// -// This deals with the buttons and views used to navigate as -// well as controlling the behavior of the overall object. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLFloaterInventory : public LLFloater -{ -public: - LLFloaterInventory(const LLSD& key); - ~LLFloaterInventory(); - - BOOL postBuild(); - - // This method makes sure that an inventory view exists, is - // visible, and has focus. The view chosen is returned. - static LLFloaterInventory* showAgentInventory(); - - // Final cleanup, destroy all open inventory views. - static void cleanup(); - - // Inherited functionality - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - - LLInventoryPanel* getPanel(); - LLPanelMainInventory* getMainInventoryPanel() { return mPanelMainInventory;} -private: - LLPanelMainInventory* mPanelMainInventory; -}; - -#endif // LL_LLFLOATERINVENTORY_H - - - diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index ef746d308d..2a1749bd42 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -39,7 +39,6 @@ #include "lltextbox.h" #include "llinventorybridge.h" -#include "llfloaterinventory.h" #include "llinventorymodel.h" #include "llinventorypanel.h" #include "llpanelobjectinventory.h" diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index c7218ad9d5..8b3cfa7fd5 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -80,6 +80,11 @@ void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) } LLFloater::closeFloater(app_quitting); + + if (getInstanceName() == "inventory" && !getKey().isUndefined()) + { + destroy(); + } } LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index d7ecd52e57..635514e26c 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -53,6 +53,8 @@ public: /*virtual*/ void closeFloater(bool app_quitting = false); + void cleanup() { destroy(); } + LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); static void showPanel(const std::string& floater_name, const LLSD& key); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index d8f019374e..f04d6cc753 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -48,7 +48,6 @@ #include "llavataractions.h" #include "llclipboard.h" #include "lldonotdisturbnotificationstorage.h" -#include "llfloaterinventory.h" #include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "llfolderview.h" @@ -752,36 +751,13 @@ void show_item_original(const LLUUID& item_uuid) void reset_inventory_filter() { - //inventory floater - bool floater_inventory_visible = false; - - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); + if (sidepanel_inventory) { - LLFloaterInventory* floater_inventory = dynamic_cast<LLFloaterInventory*>(*iter); - if (floater_inventory) + LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); + if (main_inventory) { - LLPanelMainInventory* main_inventory = floater_inventory->getMainInventoryPanel(); - main_inventory->onFilterEdit(""); - - if(floater_inventory->getVisible()) - { - floater_inventory_visible = true; - } - } - } - - if(!floater_inventory_visible) - { - LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); - if (sidepanel_inventory) - { - LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); - if (main_inventory) - { - main_inventory->onFilterEdit(""); - } } } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index f5dcbf838d..6a27c0fe21 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -34,7 +34,6 @@ #include "llappearancemgr.h" #include "llavataractions.h" #include "llclipboard.h" -#include "llfloaterinventory.h" #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llfolderview.h" diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 54728885c1..48b659a81e 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -37,7 +37,6 @@ #include "llinventoryfunctions.h" #include "llinventoryicon.h" #include "llinventorymodel.h" -#include "llfloaterinventory.h" #include "llagent.h" #include "llagentui.h" diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index eb40616a9c..7510002e98 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -33,7 +33,6 @@ #include "lldndbutton.h" #include "lleconomy.h" #include "llfilepicker.h" -#include "llfloaterinventory.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" @@ -115,7 +114,6 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH)); mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND)); mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLPanelMainInventory::doCreate, this, _2)); - //mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow, this)); mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLPanelMainInventory::toggleFindOptions, this)); mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLPanelMainInventory::resetFilters, this)); mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLPanelMainInventory::setSortBy, this, _2)); diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index efa18b42c1..38936804ac 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -86,6 +86,8 @@ public: void setFocusFilterEditor(); + static void newWindow(); + protected: // // Misc functions @@ -110,7 +112,6 @@ protected: // menu callbacks void doToSelected(const LLSD& userdata); void closeAllFolders(); - void newWindow(); void doCreate(const LLSD& userdata); void resetFilters(); void setSortBy(const LLSD& userdata); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 8331c152e2..b6fcca38e9 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -51,7 +51,6 @@ #include "llbutton.h" #include "llcombobox.h" #include "llfiltereditor.h" -#include "llfloaterinventory.h" #include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp index a498d27d2b..55cb7d616b 100644 --- a/indra/newview/llplacesinventorybridge.cpp +++ b/indra/newview/llplacesinventorybridge.cpp @@ -30,7 +30,6 @@ #include "llplacesinventorybridge.h" -#include "llfloaterinventory.h" // for LLInventoryPanel #include "llfolderview.h" // for FIRST_SELECTED_ITEM #include "llinventorypanel.h" diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h index 2805fc4257..27d9b83bd1 100644 --- a/indra/newview/llplacesinventorypanel.h +++ b/indra/newview/llplacesinventorypanel.h @@ -27,7 +27,6 @@ #ifndef LL_LLINVENTORYSUBTREEPANEL_H #define LL_LLINVENTORYSUBTREEPANEL_H -#include "llfloaterinventory.h" #include "llinventorypanel.h" class LLLandmarksPanel; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 6bcae1e858..c6a0198afd 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -34,6 +34,7 @@ #include "llbutton.h" #include "lldate.h" #include "llfirstuse.h" +#include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llfoldertype.h" #include "llfolderview.h" @@ -731,3 +732,16 @@ std::set<LLFolderViewItem*> LLSidepanelInventory::getInboxSelectionList() return inventory_selected_uuids; } + +void LLSidepanelInventory::cleanup() +{ + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end();) + { + LLFloaterSidePanelContainer* iv = dynamic_cast<LLFloaterSidePanelContainer*>(*iter++); + if (iv) + { + iv->cleanup(); + } + } +} diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 17a3098db9..5060f7025f 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -82,6 +82,8 @@ public: void updateVerbs(); + static void cleanup(); + protected: // Tracks highlighted (selected) item in inventory panel. LLInventoryItem *getSelectedItem(); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index ad4f903dff..adacbfe3aa 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -43,7 +43,6 @@ #include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" -#include "llfloaterinventory.h" #include "lllineeditor.h" #include "llui.h" #include "llviewerinventory.h" diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index f6ca0bc9d7..f7dc32d0d7 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -47,7 +47,6 @@ #include "llglheaders.h" #include "llagent.h" #include "llavatariconctrl.h" -#include "llfloaterinventory.h" #include "llinventorytype.h" const S32 LLToastGroupNotifyPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 6d13d28e18..eb0a8d5a40 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -77,7 +77,6 @@ #include "llfloaterimagepreview.h" #include "llfloaterimsession.h" #include "llfloaterinspect.h" -#include "llfloaterinventory.h" #include "llfloaterjoystick.h" #include "llfloaterlagmeter.h" #include "llfloaterland.h" diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index d0813544f8..98d1e80df8 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -49,7 +49,6 @@ #include "llinventorybridge.h" #include "llinventorypanel.h" -#include "llfloaterinventory.h" #include "lllandmarkactions.h" #include "llviewerassettype.h" diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 697199df6b..20e1fce2d9 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -62,7 +62,6 @@ #include "llfloaterbuycontents.h" #include "llbuycurrencyhtml.h" #include "llfloatergodtools.h" -#include "llfloaterinventory.h" #include "llfloaterimcontainer.h" #include "llfloaterland.h" #include "llfloaterimnearbychat.h" @@ -89,6 +88,7 @@ #include "llinventoryfunctions.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" +#include "llpanelmaininventory.h" #include "llmarketplacefunctions.h" #include "llmenuoptionpathfindingrebakenavmesh.h" #include "llmoveview.h" @@ -9068,7 +9068,7 @@ void initialize_menus() view_listener_t::addMenu(new LLGoToObject(), "GoToObject"); commit.add("PayObject", boost::bind(&handle_give_money_dialog)); - commit.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::showAgentInventory)); + commit.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow)); enable.add("EnablePayObject", boost::bind(&enable_pay_object)); enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar)); |