/indra/newview/llfloaterinventory.cpp
C++ | 109 lines | 63 code | 13 blank | 33 comment | 6 complexity | 9a9610c26aca5fd4594c02fee1c5db89 MD5 | raw file
Possible License(s): LGPL-2.1
1/** 2 * @file llfloaterinventory.cpp 3 * @brief Implementation of the inventory view and associated stuff. 4 * 5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$ 6 * Second Life Viewer Source Code 7 * Copyright (C) 2010, Linden Research, Inc. 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; 12 * version 2.1 of the License only. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 * 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA 24 * $/LicenseInfo$ 25 */ 26 27#include "llviewerprecompiledheaders.h" 28 29#include "llfloaterinventory.h" 30 31#include "llagentcamera.h" 32//#include "llfirstuse.h" 33#include "llfloaterreg.h" 34#include "llinventorymodel.h" 35#include "llpanelmaininventory.h" 36#include "llresmgr.h" 37#include "llviewerfoldertype.h" 38#include "lltransientfloatermgr.h" 39 40///---------------------------------------------------------------------------- 41/// LLFloaterInventory 42///---------------------------------------------------------------------------- 43 44LLFloaterInventory::LLFloaterInventory(const LLSD& key) 45 : LLFloater(key) 46{ 47 LLTransientFloaterMgr::getInstance()->addControlView(this); 48} 49 50LLFloaterInventory::~LLFloaterInventory() 51{ 52 LLTransientFloaterMgr::getInstance()->removeControlView(this); 53} 54 55BOOL LLFloaterInventory::postBuild() 56{ 57 mPanelMainInventory = findChild<LLPanelMainInventory>("Inventory Panel"); 58 return TRUE; 59} 60 61LLInventoryPanel* LLFloaterInventory::getPanel() 62{ 63 if (mPanelMainInventory) 64 return mPanelMainInventory->getPanel(); 65 return NULL; 66} 67 68// static 69LLFloaterInventory* LLFloaterInventory::showAgentInventory() 70{ 71 // Hack to generate semi-unique key for each inventory floater. 72 static S32 instance_num = 0; 73 instance_num = (instance_num + 1) % S32_MAX; 74 75 LLFloaterInventory* iv = NULL; 76 if (!gAgentCamera.cameraMouselook()) 77 { 78 iv = LLFloaterReg::showTypedInstance<LLFloaterInventory>("inventory", LLSD(instance_num)); 79 } 80 return iv; 81} 82 83// static 84void LLFloaterInventory::cleanup() 85{ 86 LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); 87 for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end();) 88 { 89 LLFloaterInventory* iv = dynamic_cast<LLFloaterInventory*>(*iter++); 90 if (iv) 91 { 92 iv->destroy(); 93 } 94 } 95} 96 97void LLFloaterInventory::onOpen(const LLSD& key) 98{ 99 //LLFirstUse::useInventory(); 100} 101 102void LLFloaterInventory::onClose(bool app_quitting) 103{ 104 LLFloater::onClose(app_quitting); 105 if (mKey.asInteger() > 1) 106 { 107 destroy(); 108 } 109}