DD-195 : Add text filtering to the marketplace listings floater

master
Merov Linden 2014-09-07 22:54:50 -07:00
parent 8f119c04d4
commit 9fd904220b
3 changed files with 45 additions and 7 deletions

View File

@ -30,6 +30,7 @@
#include "llfloatermarketplacelistings.h"
#include "llfloaterreg.h"
#include "llfiltereditor.h"
#include "llfolderview.h"
#include "llinventorybridge.h"
#include "llinventorymodelbackgroundfetch.h"
@ -63,6 +64,9 @@ BOOL LLPanelMarketplaceListings::postBuild()
childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this));
childSetAction("audit_btn", boost::bind(&LLPanelMarketplaceListings::onAuditButtonClicked, this));
mFilterEditor = getChild<LLFilterEditor>("filter_editor");
mFilterEditor->setCommitCallback(boost::bind(&LLPanelMarketplaceListings::onFilterEdit, this, _2));
return LLPanel::postBuild();
}
@ -107,6 +111,19 @@ LLInventoryPanel* LLPanelMarketplaceListings::buildInventoryPanel(const std::str
return panel;
}
void LLPanelMarketplaceListings::onFilterEdit(const std::string& search_string)
{
// Find active panel
LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
if (panel)
{
// Save filter string (needed when switching tabs)
mFilterSubString = search_string;
// Set filter string on active panel
panel->setFilterSubString(mFilterSubString);
}
}
void LLPanelMarketplaceListings::draw()
{
if (LLMarketplaceData::instance().checkDirtyCount())
@ -123,11 +140,17 @@ void LLPanelMarketplaceListings::onSelectionChange(LLInventoryPanel *panel, cons
void LLPanelMarketplaceListings::onTabChange()
{
LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
LLInventoryPanel* panel = static_cast<LLInventoryPanel*>(tabs_panel->getCurrentPanel());
// If the panel doesn't allow drop on root, it doesn't allow the creation of new folder on root either
LLButton* add_btn = getChild<LLButton>("add_btn");
add_btn->setEnabled(panel->getAllowDropOnRoot());
// Find active panel
LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
if (panel)
{
// If the panel doesn't allow drop on root, it doesn't allow the creation of new folder on root either
LLButton* add_btn = getChild<LLButton>("add_btn");
add_btn->setEnabled(panel->getAllowDropOnRoot());
// Set filter string on active panel
panel->setFilterSubString(mFilterSubString);
}
}
void LLPanelMarketplaceListings::onAddButtonClicked()

View File

@ -39,6 +39,7 @@ class LLInventoryCategoriesObserver;
class LLInventoryCategoryAddedObserver;
class LLTextBox;
class LLView;
class LLFilterEditor;
class LLFloaterMarketplaceListings;
@ -66,8 +67,11 @@ private:
void onAuditButtonClicked();
void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
void onTabChange();
void onFilterEdit(const std::string& search_string);
LLInventoryPanel* mAllPanel;
LLFilterEditor* mFilterEditor;
std::string mFilterSubString;
LLInventoryFilter::ESortOrderType mSortOrder;
LLInventoryFilter::EFilterType mFilterType;
};

View File

@ -60,15 +60,26 @@
default_tab_group="1"
width="308"
height="400">
<filter_editor
text_pad_left="10"
follows="left|top|right"
height="23"
label="Filter Marketplace Listings"
layout="topleft"
left="0"
max_length_chars="300"
name="filter_editor"
top="0"
width="308" />
<tab_container
name="marketplace_filter_tabs"
follows="all"
layout="topleft"
top="0"
top="30"
left="0"
top_pad="0"
width="308"
height="400"
height="370"
halign="center"
tab_height="30"
tab_group="1"