From 65e5463ae176dd148a4edcc45d0d4e1160cc6108 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 11 Sep 2009 16:33:01 -0700 Subject: Applied inventory Search menu from Emerald viewer (still ugly) --- linden/indra/newview/app_settings/settings.xml | 11 ++++++ linden/indra/newview/llfolderview.cpp | 45 +++++++++++++++++++++- linden/indra/newview/llfolderview.h | 5 +++ linden/indra/newview/llinventoryactions.cpp | 36 +++++++++++++++++ linden/indra/newview/llinventoryview.cpp | 9 +++++ .../skins/default/xui/en-us/floater_inventory.xml | 18 +++++++++ 6 files changed, 122 insertions(+), 2 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 39b482b..088631b 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -4032,6 +4032,17 @@ Value 1.0 + InventorySearchType + + Comment + Controls what type of inventory search we perform. + Persist + 0 + Type + U32 + Value + 0 + InventorySortOrder Comment diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index 70c4ead..5407f06 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp @@ -281,7 +281,28 @@ void LLFolderViewItem::refreshFromListener() { if(mListener) { + //Super crazy hack to build the creator search label - RK + LLInventoryItem* item = gInventory.getItem(mListener->getUUID()); + std::string creator_name; + if(item) + { + if(item->getCreatorUUID().notNull()) + { + gCacheName->getFullName(item->getCreatorUUID(), creator_name); + } + } + mLabelCreator = creator_name; + /*if(creator_name == "(Loading...)") + mLabelCreator = ""; + else + mLabelCreator = creator_name;*/ + + //Label for name search mLabel = mListener->getDisplayName(); + + //Build label for combined search - RK + mLabelAll = mLabel + " " + mLabelCreator; + setIcon(mListener->getIcon()); time_t creation_date = mListener->getCreationDate(); if (mCreationDate != creation_date) @@ -299,12 +320,26 @@ void LLFolderViewItem::refresh() refreshFromListener(); std::string searchable_label(mLabel); + std::string searchable_label_creator(mLabelCreator); + std::string searchable_label_all(mLabelAll); + + //add the (no modify), (no transfer) etc stuff to each label. searchable_label.append(mLabelSuffix); + searchable_label_creator.append(mLabelSuffix); + searchable_label_all.append(mLabelSuffix); + + //all labels need to be uppercase. LLStringUtil::toUpper(searchable_label); + LLStringUtil::toUpper(searchable_label_creator); + LLStringUtil::toUpper(searchable_label_all); - if (mSearchableLabel.compare(searchable_label)) + if (mSearchableLabel.compare(searchable_label) || + mSearchableLabelCreator.compare(searchable_label_creator)) { mSearchableLabel.assign(searchable_label); + mSearchableLabelCreator.assign(searchable_label_creator); + mSearchableLabelAll.assign(searchable_label_all); + dirtyFilter(); // some part of label has changed, so overall width has potentially changed if (mParentFolder) @@ -588,7 +623,13 @@ void LLFolderViewItem::rename(const std::string& new_name) const std::string& LLFolderViewItem::getSearchableLabel() const { - return mSearchableLabel; + U32 search_type = gSavedSettings.getU32("InventorySearchType"); + if(search_type == 4) + return mSearchableLabelAll; + else if(search_type == 1) + return mSearchableLabelCreator; + else + return mSearchableLabel; } const std::string& LLFolderViewItem::getName( void ) const diff --git a/linden/indra/newview/llfolderview.h b/linden/indra/newview/llfolderview.h index 3c350d4..25b4362 100644 --- a/linden/indra/newview/llfolderview.h +++ b/linden/indra/newview/llfolderview.h @@ -338,6 +338,11 @@ protected: std::string mLabel; std::string mSearchableLabel; + std::string mLabelAll; + std::string mSearchableLabelAll; + std::string mLabelCreator; + std::string mSearchableLabelCreator; + std::string mType; S32 mLabelWidth; U32 mCreationDate; diff --git a/linden/indra/newview/llinventoryactions.cpp b/linden/indra/newview/llinventoryactions.cpp index 0bf3ab2..2ee7307 100644 --- a/linden/indra/newview/llinventoryactions.cpp +++ b/linden/indra/newview/llinventoryactions.cpp @@ -464,6 +464,40 @@ class LLDoCreateFloater : public inventory_listener_t } }; +//Handles the search type buttons +class SetSearchType : public inventory_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + std::string search_type = userdata.asString(); + if(search_type == "name") + { + gSavedSettings.setU32("InventorySearchType", 0); + + mPtr->getControl("Inventory.SearchByName")->setValue(TRUE); + mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE); + mPtr->getControl("Inventory.SearchByAll")->setValue(FALSE); + } + else if(search_type == "creator") + { + gSavedSettings.setU32("InventorySearchType", 1); + + mPtr->getControl("Inventory.SearchByName")->setValue(FALSE); + mPtr->getControl("Inventory.SearchByCreator")->setValue(TRUE); + mPtr->getControl("Inventory.SearchByAll")->setValue(FALSE); + } + else if(search_type == "all") + { + gSavedSettings.setU32("InventorySearchType", 4); + + mPtr->getControl("Inventory.SearchByName")->setValue(FALSE); + mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE); + mPtr->getControl("Inventory.SearchByAll")->setValue(TRUE); + } + return true; + } +}; + class LLSetSortBy : public inventory_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -711,6 +745,8 @@ void init_inventory_actions(LLInventoryView *floater) (new LLShowFilters())->registerListener(floater, "Inventory.ShowFilters"); (new LLResetFilter())->registerListener(floater, "Inventory.ResetFilter"); (new LLSetSortBy())->registerListener(floater, "Inventory.SetSortBy"); + + (new SetSearchType())->registerListener(floater, "Inventory.SetSearchBy"); } void init_inventory_panel_actions(LLInventoryPanel *panel) diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index 0f1eb2b..cc89ee1 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -521,6 +521,15 @@ void LLInventoryView::init(LLInventoryModel* inventory) addBoolControl("Inventory.FoldersAlwaysByName", sort_folders_by_name ); addBoolControl("Inventory.SystemFoldersToTop", sort_system_folders_to_top ); + //Search Controls + U32 search_type = gSavedSettings.getU32("InventorySearchType"); + BOOL search_by_name = (search_type == 0); + + addBoolControl("Inventory.SearchByName", search_by_name); + addBoolControl("Inventory.SearchByCreator", !search_by_name); + + addBoolControl("Inventory.SearchByAll", !search_by_name); + mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml index 3d1c569..f0c97f2 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml @@ -205,5 +205,23 @@ + + + + + + + + + + + + -- cgit v1.1