SL-13852 Add visibility options to inventory search results

master
Mnikolenko Productengine 2020-08-31 21:27:37 +03:00
parent f8fb2dab5b
commit bc07bc526c
15 changed files with 259 additions and 23 deletions

View File

@ -283,6 +283,9 @@ public:
void resetContextMenu() { setContextMenu(NULL); };
void setBgImage(LLPointer<LLUIImage> image) { mBgImage = image; }
void setBgImageFocused(LLPointer<LLUIImage> image) { mBgImageFocused = image; }
private:
// private helper methods

View File

@ -34,7 +34,11 @@
LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
: LLUICtrl(p),
mSearchButton(NULL),
mClearButton(NULL)
mClearButton(NULL),
mEditorImage(p.background_image),
mEditorImageFocused(p.background_image_focused),
mEditorSearchImage(p.background_image_highlight),
mHighlightTextField(p.highlight_text_field)
{
S32 srch_btn_top = p.search_button.top_pad + p.search_button.rect.height;
S32 srch_btn_right = p.search_button.rect.width + p.search_button.left_pad;
@ -57,6 +61,8 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
// Set up line editor.
LLLineEditor::Params line_editor_params(p);
line_editor_params.name("filter edit box");
line_editor_params.background_image(p.background_image);
line_editor_params.background_image_focused(p.background_image_focused);
line_editor_params.rect(getLocalRect());
line_editor_params.follows.flags(FOLLOWS_ALL);
line_editor_params.text_pad_left(text_pad_left);
@ -104,6 +110,20 @@ void LLSearchEditor::draw()
if (mClearButton)
mClearButton->setVisible(!mSearchEditor->getWText().empty());
if (mHighlightTextField)
{
if (!mSearchEditor->getWText().empty())
{
mSearchEditor->setBgImage(mEditorSearchImage);
mSearchEditor->setBgImageFocused(mEditorSearchImage);
}
else
{
mSearchEditor->setBgImage(mEditorImage);
mSearchEditor->setBgImageFocused(mEditorImageFocused);
}
}
LLUICtrl::draw();
}

View File

@ -47,14 +47,23 @@ public:
Optional<LLButton::Params> search_button,
clear_button;
Optional<bool> search_button_visible,
clear_button_visible;
clear_button_visible,
highlight_text_field;
Optional<commit_callback_t> keystroke_callback;
Optional<LLUIImage*> background_image,
background_image_focused,
background_image_highlight;
Params()
: search_button("search_button"),
search_button_visible("search_button_visible"),
clear_button("clear_button"),
clear_button_visible("clear_button_visible")
clear_button_visible("clear_button_visible"),
highlight_text_field("highlight_text_field"),
background_image("background_image"),
background_image_focused("background_image_focused"),
background_image_highlight("background_image_highlight")
{}
};
@ -93,6 +102,13 @@ protected:
LLLineEditor* mSearchEditor;
LLButton* mSearchButton;
LLButton* mClearButton;
LLPointer<LLUIImage> mEditorImage;
LLPointer<LLUIImage> mEditorImageFocused;
LLPointer<LLUIImage> mEditorSearchImage;
LLPointer<LLUIImage> mEditorSearchImageFocused;
bool mHighlightTextField;
};
#endif // LL_SEARCHEDITOR_H

View File

@ -45,6 +45,7 @@ public:
virtual LLFolderType::EType getPreferredType() const = 0;
virtual void showProperties(void) = 0;
virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.
virtual BOOL isAgentInventory() const { return FALSE; }
virtual BOOL isUpToDate() const = 0;
virtual bool hasChildren() const = 0;
virtual LLInventoryType::EType getInventoryType() const = 0;

View File

@ -63,7 +63,8 @@ LLInventoryFilter::FilterOps::FilterOps(const Params& p)
mPermissions(p.permissions),
mFilterTypes(p.types),
mFilterUUID(p.uuid),
mFilterLinks(p.links)
mFilterLinks(p.links),
mSearchVisibility(0xffffFFFFffffFFFFULL)
{
}
@ -154,6 +155,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item)
passed = passed && checkAgainstPermissions(listener);
passed = passed && checkAgainstFilterLinks(listener);
passed = passed && checkAgainstCreator(listener);
passed = passed && checkAgainstSearchVisibility(listener);
return passed;
}
@ -550,6 +552,27 @@ bool LLInventoryFilter::checkAgainstCreator(const LLFolderViewModelItemInventory
}
}
bool LLInventoryFilter::checkAgainstSearchVisibility(const LLFolderViewModelItemInventory* listener) const
{
if (!listener || !hasFilterString()) return TRUE;
const LLUUID object_id = listener->getUUID();
const LLInventoryObject *object = gInventory.getObject(object_id);
if (!object) return TRUE;
const BOOL is_link = object->getIsLinkType();
if (is_link && ((mFilterOps.mSearchVisibility & VISIBILITY_LINKS) == 0))
return FALSE;
if (listener->isItemInTrash() && ((mFilterOps.mSearchVisibility & VISIBILITY_TRASH) == 0))
return FALSE;
if (!listener->isAgentInventory() && ((mFilterOps.mSearchVisibility & VISIBILITY_LIBRARY) == 0))
return FALSE;
return TRUE;
}
const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const
{
return mFilterSubString;
@ -718,6 +741,61 @@ void LLInventoryFilter::setFilterMarketplaceListingFolders(bool select_only_list
}
}
void LLInventoryFilter::toggleSearchVisibilityLinks()
{
bool hide_links = mFilterOps.mSearchVisibility & VISIBILITY_LINKS;
if (hide_links)
{
mFilterOps.mSearchVisibility &= ~VISIBILITY_LINKS;
}
else
{
mFilterOps.mSearchVisibility |= VISIBILITY_LINKS;
}
if (hasFilterString())
{
setModified(hide_links ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
}
}
void LLInventoryFilter::toggleSearchVisibilityTrash()
{
bool hide_trash = mFilterOps.mSearchVisibility & VISIBILITY_TRASH;
if (hide_trash)
{
mFilterOps.mSearchVisibility &= ~VISIBILITY_TRASH;
}
else
{
mFilterOps.mSearchVisibility |= VISIBILITY_TRASH;
}
if (hasFilterString())
{
setModified(hide_trash ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
}
}
void LLInventoryFilter::toggleSearchVisibilityLibrary()
{
bool hide_library = mFilterOps.mSearchVisibility & VISIBILITY_LIBRARY;
if (hide_library)
{
mFilterOps.mSearchVisibility &= ~VISIBILITY_LIBRARY;
}
else
{
mFilterOps.mSearchVisibility |= VISIBILITY_LIBRARY;
}
if (hasFilterString())
{
setModified(hide_library ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
}
}
void LLInventoryFilter::setFilterNoMarketplaceFolder()
{
mFilterOps.mFilterTypes |= FILTERTYPE_NO_MARKETPLACE_ITEMS;
@ -1349,6 +1427,11 @@ U64 LLInventoryFilter::getFilterSettingsTypes() const
return mFilterOps.mFilterSettingsTypes;
}
U64 LLInventoryFilter::getSearchVisibilityTypes() const
{
return mFilterOps.mSearchVisibility;
}
bool LLInventoryFilter::hasFilterString() const
{
return mFilterSubString.size() > 0;

View File

@ -99,6 +99,14 @@ public:
FILTERCREATOR_OTHERS
};
enum ESearchVisibility
{
VISIBILITY_NONE = 0,
VISIBILITY_TRASH = 0x1 << 0,
VISIBILITY_LIBRARY = 0x1 << 1,
VISIBILITY_LINKS = 0x1 << 2
};
struct FilterOps
{
struct DateRange : public LLInitParam::Block<DateRange>
@ -154,6 +162,7 @@ public:
mFilterWearableTypes,
mFilterSettingsTypes, // for _SETTINGS
mFilterLinks,
mSearchVisibility,
mFilterCategoryTypes; // For _CATEGORY
LLUUID mFilterUUID; // for UUID
@ -193,7 +202,8 @@ public:
U64 getFilterObjectTypes() const;
U64 getFilterCategoryTypes() const;
U64 getFilterWearableTypes() const;
U64 getFilterSettingsTypes() const;
U64 getFilterSettingsTypes() const;
U64 getSearchVisibilityTypes() const;
bool isFilterObjectTypesWith(LLInventoryType::EType t) const;
void setFilterObjectTypes(U64 types);
@ -213,6 +223,10 @@ public:
ESearchType getSearchType() { return mSearchType; }
void setFilterCreator(EFilterCreatorType type);
void toggleSearchVisibilityLinks();
void toggleSearchVisibilityTrash();
void toggleSearchVisibilityLibrary();
void setFilterSubString(const std::string& string);
const std::string& getFilterSubString(BOOL trim = FALSE) const;
const std::string& getFilterSubStringOrig() const { return mFilterSubStringOrig; }
@ -309,6 +323,7 @@ private:
bool checkAgainstPermissions(const LLInventoryItem* item) const;
bool checkAgainstFilterLinks(const class LLFolderViewModelItemInventory* listener) const;
bool checkAgainstCreator(const class LLFolderViewModelItemInventory* listener) const;
bool checkAgainstSearchVisibility(const class LLFolderViewModelItemInventory* listener) const;
bool checkAgainstClipboard(const LLUUID& object_id) const;
FilterOps mFilterOps;

View File

@ -115,6 +115,7 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mSavedFolderState(NULL),
mFilterText(""),
mMenuGearDefault(NULL),
mMenuVisibility(NULL),
mMenuAddHandle(),
mNeedUploadCost(true)
{
@ -238,6 +239,7 @@ BOOL LLPanelMainInventory::postBuild()
}
mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
mVisibilityMenuButton = getChild<LLMenuButton>("options_visibility_btn");
initListCommandsHandlers();
@ -1174,6 +1176,9 @@ void LLPanelMainInventory::initListCommandsHandlers()
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mMenuAddHandle = menu->getHandle();
mMenuVisibility = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_search_visibility.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mVisibilityMenuButton->setMenu(mMenuVisibility);
// Update the trash button when selected item(s) get worn or taken off.
LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLPanelMainInventory::updateListCommands, this));
}
@ -1363,6 +1368,21 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
}
LLFloaterReg::showInstance("linkreplace", params);
}
if (command_name == "toggle_search_trash")
{
mActivePanel->getFilter().toggleSearchVisibilityTrash();
}
if (command_name == "toggle_search_library")
{
mActivePanel->getFilter().toggleSearchVisibilityLibrary();
}
if (command_name == "include_links")
{
mActivePanel->getFilter().toggleSearchVisibilityLinks();
}
}
void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility )
@ -1508,6 +1528,21 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
return sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
}
if (command_name == "toggle_search_trash")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_TRASH) != 0;
}
if (command_name == "toggle_search_library")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_LIBRARY) != 0;
}
if (command_name == "include_links")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_LINKS) != 0;
}
return FALSE;
}

View File

@ -171,7 +171,9 @@ protected:
private:
LLDragAndDropButton* mTrashButton;
LLToggleableMenu* mMenuGearDefault;
LLToggleableMenu* mMenuVisibility;
LLMenuButton* mGearMenuButton;
LLMenuButton* mVisibilityMenuButton;
LLHandle<LLView> mMenuAddHandle;
bool mNeedUploadCost;

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

View File

@ -333,6 +333,8 @@ with the same filename but different name
<texture name="Inv_Unknown" file_name="icons/Inv_UnknownObject.png" preload="false" />
<texture name="Inv_VersionFolderClosed" file_name="icons/Inv_VersionFolderClosed.png" preload="false" />
<texture name="Inv_VersionFolderOpen" file_name="icons/Inv_VersionFolderOpen.png" preload="false" />
<texture name="Inv_Toolbar_SearchVisibility" file_name="icons/Inv_Toolbar_SearchVisibility.png" preload="false" />
<texture name="Linden_Dollar_Alert" file_name="widgets/Linden_Dollar_Alert.png"/>
<texture name="Linden_Dollar_Background" file_name="widgets/Linden_Dollar_Background.png"/>
@ -648,6 +650,7 @@ with the same filename but different name
<texture name="TextField_Search_Off" file_name="widgets/TextField_Search_Off.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
<texture name="TextField_Disabled" file_name="widgets/TextField_Disabled.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
<texture name="TextField_Active" file_name="widgets/TextField_Active.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
<texture name="TextField_Search_Highlight" file_name="widgets/TextField_Search_Highlight.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
<texture name="Toast_CloseBtn" file_name="windows/Toast_CloseBtn.png" preload="true" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<toggleable_menu
bottom="806"
layout="topleft"
left="0"
mouse_opaque="false"
name="menu_search_visibility"
visible="false">
<menu_item_check
label="Search Trash"
layout="topleft"
name="search_trash">
<on_click
function="Inventory.GearDefault.Custom.Action"
parameter="toggle_search_trash" />
<on_check
function="Inventory.GearDefault.Check"
parameter="toggle_search_trash" />
</menu_item_check>
<menu_item_check
label="Search Library"
layout="topleft"
name="search_library">
<on_click
function="Inventory.GearDefault.Custom.Action"
parameter="toggle_search_library" />
<on_check
function="Inventory.GearDefault.Check"
parameter="toggle_search_library" />
</menu_item_check>
<menu_item_separator
layout="topleft" />
<menu_item_check
label="Include links"
layout="topleft"
name="include_links">
<on_click
function="Inventory.GearDefault.Custom.Action"
parameter="include_links" />
<on_check
function="Inventory.GearDefault.Check"
parameter="include_links" />
</menu_item_check>
</toggleable_menu>

View File

@ -32,30 +32,20 @@
left="12"
name="ItemcountText"
font="SansSerifMedium"
text_color="EmphasisColor"
text_color="InventoryItemLinkColor"
use_ellipses="true"
top_pad="0"
width="300">
Items:
</text>
<filter_editor
text_pad_left="10"
follows="left|top|right"
height="23"
label="Enter search text"
layout="topleft"
left="10"
max_length_chars="300"
name="inventory search editor"
top="18"
width="208" />
<combo_box
height="23"
layout="topleft"
left_pad="4"
left="10"
top="18"
name="search_type"
follows="top|right"
width="90">
follows="top|left"
width="88">
<item
label="Name"
name="Name"
@ -72,7 +62,27 @@
label="UUID"
name="UUID"
value="search_by_UUID"/>
</combo_box>
</combo_box>
<menu_button
follows="top|left"
tool_tip="Show search visibility options"
height="23"
image_overlay="Inv_Toolbar_SearchVisibility"
layout="topleft"
left_pad="3"
name="options_visibility_btn"
width="31" />
<filter_editor
text_pad_left="10"
follows="left|top|right"
height="23"
label="Enter search text"
layout="topleft"
left_pad="3"
max_length_chars="300"
highlight_text_field="true"
name="inventory search editor"
width="177" />
<tab_container
follows="all"
halign="center"

View File

@ -6,9 +6,11 @@
text_pad_left="7"
select_on_focus="true"
text_tentative_color="TextFgTentativeColor"
highlight_text_field="false"
background_image="TextField_Search_Off"
background_image_disabled="TextField_Search_Disabled"
background_image_focused="TextField_Search_Active">
background_image_focused="TextField_Search_Active"
background_image_highlight="TextField_Search_Highlight">
<search_button label=""
top_pad="4"
left_pad="4"

View File

@ -7,9 +7,11 @@
text_pad_right="6"
select_on_focus="true"
text_tentative_color="TextFgTentativeColor"
highlight_text_field="false"
background_image="TextField_Search_Off"
background_image_disabled="TextField_Search_Disabled"
background_image_focused="TextField_Search_Active" >
background_image_focused="TextField_Search_Active"
background_image_highlight="TextField_Search_Highlight">
<search_button
top_pad="4"
left_pad="4"