DD-50 : Adding new filter code for marketplace filtered tabs (active, unactive and unassociated)

meow-7.2.2
Merov Linden 2014-03-20 09:31:35 -07:00
parent b502e596af
commit 03622e0833
4 changed files with 85 additions and 15 deletions

View File

@ -831,16 +831,9 @@ void LLFloaterMarketplaceListings::setup()
llassert(mCategoriesObserver);
// Set up the marketplace listings inventory view
// LLInventoryPanel* inventory_panel = mInventoryPanel.get();
// if (inventory_panel)
// {
// delete inventory_panel;
// }
// inventory_panel = LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance());
// mInventoryPanel = inventory_panel->getInventoryPanelHandle();
LLPanel* inventory_panel = LLUICtrlFactory::createFromFile<LLPanel>("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance());
LLInventoryPanel* all_items_panel = inventory_panel->getChild<LLInventoryPanel>("All Items");
mInventoryPanel = all_items_panel->getInventoryPanelHandle();
LLInventoryPanel* items_panel = inventory_panel->getChild<LLInventoryPanel>("All Items");
mInventoryPanel = items_panel->getInventoryPanelHandle();
llassert(mInventoryPanel.get() != NULL);
// Reshape the inventory to the proper size
@ -848,9 +841,23 @@ void LLFloaterMarketplaceListings::setup()
inventory_panel->setShape(inventory_placeholder_rect);
// Set the sort order newest to oldest
all_items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
all_items_panel->getFilter().markDefault();
items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
items_panel->getFilter().markDefault();
// Set filters on the 3 prefiltered panels
items_panel = inventory_panel->getChild<LLInventoryPanel>("Active Items");
items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
items_panel->getFilter().setFilterMarketplaceActiveFolders();
items_panel->getFilter().markDefault();
items_panel = inventory_panel->getChild<LLInventoryPanel>("Inactive Items");
items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
items_panel->getFilter().setFilterMarketplaceInactiveFolders();
items_panel->getFilter().markDefault();
items_panel = inventory_panel->getChild<LLInventoryPanel>("Unassociated Items");
items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
items_panel->getFilter().setFilterMarketplaceUnassociatedFolders();
items_panel->getFilter().markDefault();
// Get the content of the marketplace listings folder
fetchContents();
}
@ -969,8 +976,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO
EAcceptance* accept,
std::string& tooltip_msg)
{
if ((mInventoryPanel.get() == NULL) ||
mRootFolderId.isNull())
if ((mInventoryPanel.get() == NULL) || mRootFolderId.isNull())
{
return FALSE;
}

View File

@ -33,6 +33,7 @@
#include "llfolderviewitem.h"
#include "llinventorymodel.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llmarketplacefunctions.h"
#include "llviewercontrol.h"
#include "llfolderview.h"
#include "llinventorybridge.h"
@ -243,6 +244,48 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
}
}
}
////////////////////////////////////////////////////////////////////////////////
// FILTERTYPE_MARKETPLACE_ACTIVE
// Pass if this item is a folder and is active
if (filterTypes & FILTERTYPE_MARKETPLACE_ACTIVE)
{
if (object_type == LLInventoryType::IT_CATEGORY)
{
if (LLMarketplaceData::instance().getActivationState(object_id))
{
return FALSE;
}
}
}
////////////////////////////////////////////////////////////////////////////////
// FILTERTYPE_MARKETPLACE_INACTIVE
// Pass if this item is a folder and is not active
if (filterTypes & FILTERTYPE_MARKETPLACE_INACTIVE)
{
if (object_type == LLInventoryType::IT_CATEGORY)
{
if (!LLMarketplaceData::instance().getActivationState(object_id))
{
return FALSE;
}
}
}
////////////////////////////////////////////////////////////////////////////////
// FILTERTYPE_MARKETPLACE_UNASSOCIATED
// Pass if this item is a folder and is active
if (filterTypes & FILTERTYPE_MARKETPLACE_UNASSOCIATED)
{
if (object_type == LLInventoryType::IT_CATEGORY)
{
if (LLMarketplaceData::instance().getListingID(object_id).empty())
{
return FALSE;
}
}
}
return TRUE;
}
@ -468,6 +511,21 @@ void LLInventoryFilter::setFilterEmptySystemFolders()
mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS;
}
void LLInventoryFilter::setFilterMarketplaceActiveFolders()
{
mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_ACTIVE;
}
void LLInventoryFilter::setFilterMarketplaceInactiveFolders()
{
mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_INACTIVE;
}
void LLInventoryFilter::setFilterMarketplaceUnassociatedFolders()
{
mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_UNASSOCIATED;
}
void LLInventoryFilter::setFilterUUID(const LLUUID& object_id)
{
if (mFilterOps.mFilterUUID == LLUUID::null)

View File

@ -52,7 +52,10 @@ public:
FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it
FILTERTYPE_DATE = 0x1 << 3, // search by date range
FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type
FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if
FILTERTYPE_EMPTYFOLDERS = 0x1 << 5, // pass if folder is not a system folder to be hidden if empty
FILTERTYPE_MARKETPLACE_ACTIVE = 0x1 << 6, // pass if folder is a marketplace active folder
FILTERTYPE_MARKETPLACE_INACTIVE = 0x1 << 7, // pass if folder is a marketplace inactive folder
FILTERTYPE_MARKETPLACE_UNASSOCIATED = 0x1 << 8 // pass if folder is a marketplace non associated (no market ID) folder
};
enum EFilterLink
@ -160,6 +163,9 @@ public:
void setFilterUUID(const LLUUID &object_id);
void setFilterWearableTypes(U64 types);
void setFilterEmptySystemFolders();
void setFilterMarketplaceActiveFolders();
void setFilterMarketplaceInactiveFolders();
void setFilterMarketplaceUnassociatedFolders();
void updateFilterTypes(U64 types, U64& current_types);
void setFilterSubString(const std::string& string);

View File

@ -37,7 +37,7 @@
width="308"
height="340">
<tab_container
name="inventory filter tabs"
name="marketplace filter tabs"
follows="all"
layout="topleft"
top="0"