diff options
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 193 |
1 files changed, 188 insertions, 5 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index eb40616a9c..ec80ff8de7 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -30,10 +30,11 @@ #include "llagent.h" #include "llagentcamera.h" #include "llavataractions.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" #include "lldndbutton.h" #include "lleconomy.h" #include "llfilepicker.h" -#include "llfloaterinventory.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" @@ -85,6 +86,9 @@ public: BOOL getCheckSinceLogoff(); U32 getDateSearchDirection(); + void onCreatorSelfFilterCommit(); + void onCreatorOtherFilterCommit(); + static void onTimeAgo(LLUICtrl*, void *); static void onCloseBtn(void* user_data); static void selectAllTypes(void* user_data); @@ -93,6 +97,8 @@ private: LLPanelMainInventory* mPanelMainInventory; LLSpinCtrl* mSpinSinceDays; LLSpinCtrl* mSpinSinceHours; + LLCheckBoxCtrl* mCreatorSelf; + LLCheckBoxCtrl* mCreatorOthers; LLInventoryFilter* mFilter; }; @@ -103,6 +109,7 @@ private: LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) : LLPanel(p), mActivePanel(NULL), + mWornItemsPanel(NULL), mSavedFolderState(NULL), mFilterText(""), mMenuGearDefault(NULL), @@ -115,7 +122,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)); @@ -156,10 +162,30 @@ BOOL LLPanelMainInventory::postBuild() recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); LLInventoryFilter& recent_filter = recent_items_panel->getFilter(); recent_filter.setFilterObjectTypes(recent_filter.getFilterObjectTypes() & ~(0x1 << LLInventoryType::IT_CATEGORY)); + recent_filter.setEmptyLookupMessage("InventoryNoMatchingRecentItems"); recent_filter.markDefault(); recent_items_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, recent_items_panel, _1, _2)); } + mWornItemsPanel = getChild<LLInventoryPanel>("Worn Items"); + if (mWornItemsPanel) + { + U32 filter_types = 0x0; + filter_types |= 0x1 << LLInventoryType::IT_WEARABLE; + filter_types |= 0x1 << LLInventoryType::IT_ATTACHMENT; + filter_types |= 0x1 << LLInventoryType::IT_OBJECT; + mWornItemsPanel->setFilterTypes(filter_types); + mWornItemsPanel->setFilterWorn(); + mWornItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mWornItemsPanel->setFilterLinks(LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS); + mWornItemsPanel->getFilter().markDefault(); + mWornItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mWornItemsPanel, _1, _2)); + } + mSearchTypeCombo = getChild<LLComboBox>("search_type"); + if(mSearchTypeCombo) + { + mSearchTypeCombo->setCommitCallback(boost::bind(&LLPanelMainInventory::onSelectSearchType, this)); + } // Now load the stored settings from disk, if available. std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME)); LL_INFOS() << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL; @@ -264,6 +290,16 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) delete mSavedFolderState; } +LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel() +{ + return getChild<LLInventoryPanel>("All Items"); +} + +void LLPanelMainInventory::selectAllItemsPanel() +{ + mFilterTabs->selectFirstTab(); +} + void LLPanelMainInventory::startSearch() { // this forces focus to line editor portion of search editor @@ -389,6 +425,48 @@ void LLPanelMainInventory::setSortBy(const LLSD& userdata) } } +void LLPanelMainInventory::onSelectSearchType() +{ + std::string new_type = mSearchTypeCombo->getValue(); + if (new_type == "search_by_name") + { + getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_NAME); + } + if (new_type == "search_by_creator") + { + getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR); + } + if (new_type == "search_by_description") + { + getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION); + } + if (new_type == "search_by_UUID") + { + getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_UUID); + } +} + +void LLPanelMainInventory::updateSearchTypeCombo() +{ + LLInventoryFilter::ESearchType search_type = getActivePanel()->getSearchType(); + switch(search_type) + { + case LLInventoryFilter::SEARCHTYPE_CREATOR: + mSearchTypeCombo->setValue("search_by_creator"); + break; + case LLInventoryFilter::SEARCHTYPE_DESCRIPTION: + mSearchTypeCombo->setValue("search_by_description"); + break; + case LLInventoryFilter::SEARCHTYPE_UUID: + mSearchTypeCombo->setValue("search_by_UUID"); + break; + case LLInventoryFilter::SEARCHTYPE_NAME: + default: + mSearchTypeCombo->setValue("search_by_name"); + break; + } +} + // static BOOL LLPanelMainInventory::filtersVisible(void* user_data) { @@ -402,7 +480,7 @@ void LLPanelMainInventory::onClearSearch() { BOOL initially_active = FALSE; LLFloater *finder = getFinder(); - if (mActivePanel) + if (mActivePanel && (getActivePanel() != mWornItemsPanel)) { initially_active = mActivePanel->getFilter().isNotDefault(); mActivePanel->setFilterSubString(LLStringUtil::null); @@ -509,6 +587,11 @@ void LLPanelMainInventory::onFilterSelected() return; } + if (getActivePanel() == mWornItemsPanel) + { + mActivePanel->openAllFolders(); + } + updateSearchTypeCombo(); setFilterSubString(mFilterSubString); LLInventoryFilter& filter = mActivePanel->getFilter(); LLFloaterInventoryFinder *finder = getFinder(); @@ -542,7 +625,7 @@ BOOL LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { // Check to see if we are auto scrolling from the last frame LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel(); - BOOL needsToScroll = panel->getScrollableContainer()->autoScroll(x, y); + BOOL needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y); if(mFilterTabs) { if(needsToScroll) @@ -707,6 +790,11 @@ BOOL LLFloaterInventoryFinder::postBuild() mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago"); childSetCommitCallback("spin_days_ago", onTimeAgo, this); + mCreatorSelf = getChild<LLCheckBoxCtrl>("check_created_by_me"); + mCreatorOthers = getChild<LLCheckBoxCtrl>("check_created_by_others"); + mCreatorSelf->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorSelfFilterCommit, this)); + mCreatorOthers->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorOtherFilterCommit, this)); + childSetAction("Close", onCloseBtn, this); updateElementsFromFilter(); @@ -765,6 +853,10 @@ void LLFloaterInventoryFinder::updateElementsFromFilter() U32 hours = mFilter->getHoursAgo(); U32 date_search_direction = mFilter->getDateSearchDirection(); + LLInventoryFilter::EFilterCreatorType filter_creator = mFilter->getFilterCreator(); + bool show_created_by_me = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_SELF)); + bool show_created_by_others = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_OTHERS)); + // update the ui elements setTitle(mFilter->getName()); @@ -782,6 +874,10 @@ void LLFloaterInventoryFinder::updateElementsFromFilter() getChild<LLUICtrl>("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE)); getChild<LLUICtrl>("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT)); getChild<LLUICtrl>("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS); + + getChild<LLUICtrl>("check_created_by_me")->setValue(show_created_by_me); + getChild<LLUICtrl>("check_created_by_others")->setValue(show_created_by_others); + getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff()); mSpinSinceHours->set((F32)(hours % 24)); mSpinSinceDays->set((F32)(hours / 24)); @@ -879,6 +975,7 @@ void LLFloaterInventoryFinder::draw() mPanelMainInventory->getPanel()->setShowFolderState(getCheckShowEmpty() ? LLInventoryFilter::SHOW_ALL_FOLDERS : LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); mPanelMainInventory->getPanel()->setFilterTypes(filter); + if (getCheckSinceLogoff()) { mSpinSinceDays->set(0); @@ -907,6 +1004,46 @@ void LLFloaterInventoryFinder::draw() LLPanel::draw(); } +void LLFloaterInventoryFinder::onCreatorSelfFilterCommit() +{ + bool show_creator_self = mCreatorSelf->getValue(); + bool show_creator_other = mCreatorOthers->getValue(); + + if(show_creator_self && show_creator_other) + { + mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_ALL); + } + else if(show_creator_self) + { + mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_SELF); + } + else if(!show_creator_self || !show_creator_other) + { + mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_OTHERS); + mCreatorOthers->set(TRUE); + } +} + +void LLFloaterInventoryFinder::onCreatorOtherFilterCommit() +{ + bool show_creator_self = mCreatorSelf->getValue(); + bool show_creator_other = mCreatorOthers->getValue(); + + if(show_creator_self && show_creator_other) + { + mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_ALL); + } + else if(show_creator_other) + { + mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_OTHERS); + } + else if(!show_creator_other || !show_creator_self) + { + mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_SELF); + mCreatorSelf->set(TRUE); + } +} + BOOL LLFloaterInventoryFinder::getCheckShowEmpty() { return getChild<LLUICtrl>("check_show_empty")->getValue(); @@ -1160,6 +1297,26 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) mFilterEditor->setText(item_name); mFilterEditor->setFocus(TRUE); } + + if (command_name == "replace_links") + { + LLSD params; + LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); + if (current_item) + { + LLInvFVBridge* bridge = (LLInvFVBridge*)current_item->getViewModelItem(); + + if (bridge) + { + LLInventoryObject* obj = bridge->getInventoryObject(); + if (obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getActualType() != LLAssetType::AT_LINK_FOLDER) + { + params = LLSD(obj->getUUID()); + } + } + } + LLFloaterReg::showInstance("linkreplace", params); + } } void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility ) @@ -1194,6 +1351,20 @@ bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) { const std::string command_name = userdata.asString(); + if (command_name == "not_empty") + { + BOOL status = FALSE; + LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); + if (current_item) + { + const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID(); + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(item_id, cat_array, item_array); + status = (0 == cat_array->size() && 0 == item_array->size()); + } + return status; + } if (command_name == "delete") { return getActivePanel()->isSelectionRemovable(); @@ -1251,6 +1422,18 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) LLSidepanelInventory* parent = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); return parent ? parent->canShare() : FALSE; } + if (command_name == "empty_trash") + { + const LLUUID &trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(trash_id); + return children != LLInventoryModel::CHILDREN_NO && gInventory.isCategoryComplete(trash_id); + } + if (command_name == "empty_lostnfound") + { + const LLUUID &trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(trash_id); + return children != LLInventoryModel::CHILDREN_NO && gInventory.isCategoryComplete(trash_id); + } return TRUE; } @@ -1309,7 +1492,7 @@ void LLPanelMainInventory::setUploadCostIfNeeded() LLMenuItemBranchGL* upload_menu = menu->findChild<LLMenuItemBranchGL>("upload"); if(upload_menu) { - S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); std::string cost_str; // getPriceUpload() returns -1 if no data available yet. |