summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-03-29 18:02:04 +0300
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-03-29 18:02:04 +0300
commitc10eed08189161bab67cfc296b1891a989d5748d (patch)
tree845828bf1731241681349380af59a8ebe558d876 /indra
parente5b8b799cc75f3b9cd259403c323cd47b59453d8 (diff)
SL-19379 WIP allow change search type for Gallery
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinventorybridge.cpp43
-rw-r--r--indra/newview/llinventoryfunctions.cpp50
-rw-r--r--indra/newview/llinventoryfunctions.h3
-rw-r--r--indra/newview/llinventorygallery.cpp39
-rw-r--r--indra/newview/llinventorygallery.h21
-rw-r--r--indra/newview/llpanelmaininventory.cpp32
-rw-r--r--indra/newview/llpanelmaininventory.h1
7 files changed, 138 insertions, 51 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 86a3fb8ec0..41aa11628f 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -215,54 +215,17 @@ const std::string& LLInvFVBridge::getDisplayName() const
std::string LLInvFVBridge::getSearchableDescription() const
{
- const LLInventoryModel* model = getInventoryModel();
- if (model)
- {
- const LLInventoryItem *item = model->getItem(mUUID);
- if(item)
- {
- std::string desc = item->getDescription();
- LLStringUtil::toUpper(desc);
- return desc;
- }
- }
- return LLStringUtil::null;
+ return get_searchable_description(getInventoryModel(), mUUID);
}
std::string LLInvFVBridge::getSearchableCreatorName() const
{
- const LLInventoryModel* model = getInventoryModel();
- if (model)
- {
- const LLInventoryItem *item = model->getItem(mUUID);
- if(item)
- {
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name))
- {
- std::string username = av_name.getUserName();
- LLStringUtil::toUpper(username);
- return username;
- }
- }
- }
- return LLStringUtil::null;
+ return get_searchable_creator_name(getInventoryModel(), mUUID);
}
std::string LLInvFVBridge::getSearchableUUIDString() const
{
- const LLInventoryModel* model = getInventoryModel();
- if (model)
- {
- const LLViewerInventoryItem *item = model->getItem(mUUID);
- if(item && (item->getIsFullPerm() || gAgent.isGodlikeWithoutAdminMenuFakery()))
- {
- std::string uuid = item->getAssetUUID().asString();
- LLStringUtil::toUpper(uuid);
- return uuid;
- }
- }
- return LLStringUtil::null;
+ return get_searchable_UUID(getInventoryModel(), mUUID);
}
// Folders have full perms
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index d38208da71..548d3243e5 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -46,6 +46,7 @@
#include "llappearancemgr.h"
#include "llappviewer.h"
#include "llavataractions.h"
+#include "llavatarnamecache.h"
#include "llclipboard.h"
#include "lldirpicker.h"
#include "lldonotdisturbnotificationstorage.h"
@@ -2164,6 +2165,55 @@ void ungroup_folder_items(const LLUUID& folder_id)
gInventory.removeCategory(inv_cat->getUUID());
gInventory.notifyObservers();
}
+
+std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id)
+{
+ if (model)
+ {
+ const LLInventoryItem *item = model->getItem(item_id);
+ if(item)
+ {
+ std::string desc = item->getDescription();
+ LLStringUtil::toUpper(desc);
+ return desc;
+ }
+ }
+ return LLStringUtil::null;
+}
+
+std::string get_searchable_creator_name(LLInventoryModel* model, const LLUUID& item_id)
+{
+ if (model)
+ {
+ const LLInventoryItem *item = model->getItem(item_id);
+ if(item)
+ {
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name))
+ {
+ std::string username = av_name.getUserName();
+ LLStringUtil::toUpper(username);
+ return username;
+ }
+ }
+ }
+ return LLStringUtil::null;
+}
+
+std::string get_searchable_UUID(LLInventoryModel* model, const LLUUID& item_id)
+{
+ if (model)
+ {
+ const LLViewerInventoryItem *item = model->getItem(item_id);
+ if(item && (item->getIsFullPerm() || gAgent.isGodlikeWithoutAdminMenuFakery()))
+ {
+ std::string uuid = item->getAssetUUID().asString();
+ LLStringUtil::toUpper(uuid);
+ return uuid;
+ }
+ }
+ return LLStringUtil::null;
+}
///----------------------------------------------------------------------------
/// LLMarketplaceValidator implementations
///----------------------------------------------------------------------------
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 5f1c5067d5..5c4a325eca 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -103,6 +103,9 @@ bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_ca
std::string get_localized_folder_name(LLUUID cat_uuid);
void new_folder_window(const LLUUID& folder_id);
void ungroup_folder_items(const LLUUID& folder_id);
+std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id);
+std::string get_searchable_creator_name(LLInventoryModel* model, const LLUUID& item_id);
+std::string get_searchable_UUID(LLInventoryModel* model, const LLUUID& item_id);
/** Miscellaneous global functions
** **
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index bfca22ba8a..8516ff37c2 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -83,7 +83,8 @@ LLInventoryGallery::LLInventoryGallery(const LLInventoryGallery::Params& p)
mItemsInRow(p.items_in_row),
mRowPanWidthFactor(p.row_panel_width_factor),
mGalleryWidthFactor(p.gallery_width_factor),
- mIsInitialized(false)
+ mIsInitialized(false),
+ mSearchType(LLInventoryFilter::SEARCHTYPE_NAME)
{
updateGalleryWidth();
@@ -473,6 +474,9 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L
gitem->setGallery(this);
gitem->setType(type, is_link);
gitem->setThumbnail(thumbnail_id);
+ gitem->setCreatorName(get_searchable_creator_name(&gInventory, item_id));
+ gitem->setDescription(get_searchable_description(&gInventory, item_id));
+ gitem->setAssetIDStr(get_searchable_UUID(&gInventory, item_id));
return gitem;
}
@@ -556,16 +560,43 @@ void LLInventoryGallery::applyFilter(LLInventoryGalleryItem* item, const std::st
{
if (!item) return;
- std::string item_name = item->getItemName();
- LLStringUtil::toUpper(item_name);
+ std::string desc;
+
+ switch(mSearchType)
+ {
+ case LLInventoryFilter::SEARCHTYPE_CREATOR:
+ desc = item->getCreatorName();
+ break;
+ case LLInventoryFilter::SEARCHTYPE_DESCRIPTION:
+ desc = item->getDescription();
+ break;
+ case LLInventoryFilter::SEARCHTYPE_UUID:
+ desc = item->getAssetIDStr();
+ break;
+ case LLInventoryFilter::SEARCHTYPE_NAME:
+ default:
+ desc = item->getItemName();
+ break;
+ }
+
+ LLStringUtil::toUpper(desc);
std::string cur_filter = filter_substring;
LLStringUtil::toUpper(cur_filter);
- bool hidden = (std::string::npos == item_name.find(cur_filter));
+ bool hidden = (std::string::npos == desc.find(cur_filter));
item->setHidden(hidden);
}
+void LLInventoryGallery::setSearchType(LLInventoryFilter::ESearchType type)
+{
+ if(mSearchType != type)
+ {
+ mSearchType = type;
+ reArrangeRows();
+ }
+}
+
void LLInventoryGallery::getCurrentCategories(uuid_vec_t& vcur)
{
for (gallery_item_map_t::const_iterator iter = mItemMap.begin();
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index 5c529e7589..09eafc8396 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -29,6 +29,7 @@
#include "lllistcontextmenu.h"
#include "llpanel.h"
+#include "llinventoryfilter.h"
#include "llinventorymodel.h"
class LLInventoryCategoriesObserver;
@@ -108,6 +109,9 @@ public:
void signalSelectionItemID(const LLUUID& category_id);
boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb);
+ void setSearchType(LLInventoryFilter::ESearchType type);
+ LLInventoryFilter::ESearchType getSearchType() { return mSearchType; }
+
protected:
void onChangeItemSelection(const LLUUID& category_id);
@@ -181,6 +185,8 @@ private:
typedef std::map<LLUUID, LLInventoryGalleryItem*> gallery_item_map_t;
gallery_item_map_t mItemMap;
std::map<LLInventoryGalleryItem*, S32> mItemIndexMap;
+
+ LLInventoryFilter::ESearchType mSearchType;
};
class LLInventoryGalleryItem : public LLPanel
@@ -217,7 +223,14 @@ public:
void setSelected(bool value);
void setUUID(LLUUID id) {mUUID = id;}
LLUUID getUUID() { return mUUID;}
-
+
+ void setAssetIDStr(std::string asset_id) {mAssetIDStr = asset_id;}
+ std::string getAssetIDStr() { return mAssetIDStr;}
+ void setDescription(std::string desc) {mDesc = desc;}
+ std::string getDescription() { return mDesc;}
+ void setCreatorName(std::string name) {mCreatorName = name;}
+ std::string getCreatorName() { return mCreatorName;}
+
std::string getItemName() {return mName;}
bool isDefaultImage() {return mDefaultImage;}
@@ -238,7 +251,11 @@ private:
bool mDefaultImage;
bool mHidden;
bool mIsFolder;
-
+
+ std::string mAssetIDStr;
+ std::string mDesc;
+ std::string mCreatorName;
+
EInventorySortGroup mSortGroup;
LLAssetType::EType mType;
std::string mName;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 3679a22e5e..ffa92a3c11 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -566,25 +566,47 @@ void LLPanelMainInventory::onSelectSearchType()
std::string new_type = mSearchTypeCombo->getValue();
if (new_type == "search_by_name")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_NAME);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_NAME);
}
if (new_type == "search_by_creator")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR);
}
if (new_type == "search_by_description")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION);
}
if (new_type == "search_by_UUID")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_UUID);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_UUID);
}
}
+void LLPanelMainInventory::setSearchType(LLInventoryFilter::ESearchType type)
+{
+ if(mSingleFolderMode && isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->setSearchType(type);
+ }
+ else
+ {
+ getActivePanel()->setSearchType(type);
+ }
+}
+
void LLPanelMainInventory::updateSearchTypeCombo()
{
- LLInventoryFilter::ESearchType search_type = getActivePanel()->getSearchType();
+ LLInventoryFilter::ESearchType search_type(LLInventoryFilter::SEARCHTYPE_NAME);
+
+ if(mSingleFolderMode && isGalleryViewMode())
+ {
+ search_type = mInventoryGalleryPanel->getSearchType();
+ }
+ else
+ {
+ search_type = getActivePanel()->getSearchType();
+ }
+
switch(search_type)
{
case LLInventoryFilter::SEARCHTYPE_CREATOR:
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index ac97cc4052..974b4ebd26 100644
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -154,6 +154,7 @@ protected:
void onFocusReceived();
void onSelectSearchType();
void updateSearchTypeCombo();
+ void setSearchType(LLInventoryFilter::ESearchType type);
LLSidepanelInventory* getParentSidepanelInventory();