DD-100 : Fixed! Had to create the inventory panels after we get the marketplace listings root id

meow-7.2.2
Merov Linden 2014-08-09 20:34:55 -07:00
parent 7b28251259
commit 231572cfed
8 changed files with 157 additions and 184 deletions

View File

@ -60,34 +60,50 @@ LLPanelMarketplaceListings::LLPanelMarketplaceListings()
BOOL LLPanelMarketplaceListings::postBuild()
{
mAllPanel = getChild<LLInventoryPanel>("All Items");
childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this));
childSetAction("audit_btn", boost::bind(&LLPanelMarketplaceListings::onAuditButtonClicked, this));
// Set the sort order newest to oldest
LLInventoryPanel* panel = getChild<LLInventoryPanel>("All Items");
panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
panel->getFilter().markDefault();
panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2));
return LLPanel::postBuild();
}
// Set filters on the 3 prefiltered panels
panel = getChild<LLInventoryPanel>("Active Items");
panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
void LLPanelMarketplaceListings::buildAllPanels()
{
LLInventoryPanel* panel;
panel = buildInventoryPanel("All Items", "panel_marketplace_listings_inventory.xml");
panel->getFilter().markDefault();
mAllPanel = panel;
panel = buildInventoryPanel("Active Items", "panel_marketplace_listings_listed.xml");
panel->getFilter().setFilterMarketplaceActiveFolders();
panel->getFilter().markDefault();
panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2));
panel = getChild<LLInventoryPanel>("Inactive Items");
panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
panel = buildInventoryPanel("Inactive Items", "panel_marketplace_listings_unlisted.xml");
panel->getFilter().setFilterMarketplaceInactiveFolders();
panel->getFilter().markDefault();
panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2));
panel = getChild<LLInventoryPanel>("Unassociated Items");
panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
panel = buildInventoryPanel("Unassociated Items", "panel_marketplace_listings_unassociated.xml");
panel->getFilter().setFilterMarketplaceUnassociatedFolders();
panel->getFilter().markDefault();
panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2));
LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
tabs_panel->selectTabPanel(mAllPanel);
}
LLInventoryPanel* LLPanelMarketplaceListings::buildInventoryPanel(const std::string& childname, const std::string& filename)
{
LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
LLInventoryPanel* panel = getChild<LLInventoryPanel>(childname);
if (panel)
{
tabs_panel->removeTabPanel(panel);
delete panel;
}
panel = LLUICtrlFactory::createFromFile<LLInventoryPanel>(filename, tabs_panel, LLInventoryPanel::child_registry_t::instance());
llassert(panel != NULL);
return LLPanel::postBuild();
// Set sort order and callbacks
panel = getChild<LLInventoryPanel>(childname);
panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2));
return panel;
}
void LLPanelMarketplaceListings::draw()
@ -189,6 +205,7 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key)
, mInventoryText(NULL)
, mInventoryTitle(NULL)
, mPanelListings(NULL)
, mFirstViewListings(true)
{
}
@ -267,7 +284,6 @@ void LLFloaterMarketplaceListings::setup()
{
if (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
{
//llinfos << "Merov D&D : setup failed: we're not a merchant" << llendl;
// If we are *not* a merchant or we have no market place connection established yet, do nothing
return;
}
@ -277,25 +293,10 @@ void LLFloaterMarketplaceListings::setup()
if (marketplacelistings_id.isNull())
{
// We should never get there unless the inventory fails badly
//llinfos << "Merov D&D : setup failed: couldn't get to the marketplace listings folder" << llendl;
LL_ERRS("SLM") << "Inventory problem: failure to create the marketplace listings folder for a merchant!" << LL_ENDL;
return;
}
//llinfos << "Merov D&D : setup : marketplace listings folder = " << marketplacelistings_id << llendl;
// Consolidate Marketplace listings
// We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually
gInventory.consolidateForType(marketplacelistings_id, LLFolderType::FT_MARKETPLACE_LISTINGS);
if (marketplacelistings_id == mRootFolderId)
{
//llinfos << "Merov D&D : setup failed: Marketplace listings folder already set" << llendl;
LL_WARNS("SLM") << "Inventory warning: Marketplace listings folder already set" << LL_ENDL;
return;
}
mRootFolderId = marketplacelistings_id;
// No longer need to observe new category creation
if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
{
@ -305,42 +306,29 @@ void LLFloaterMarketplaceListings::setup()
}
llassert(!mCategoryAddedObserver);
// Merov : Hack...
/*
LLInventoryPanel* inventory_panel = mPanelListings->mAllPanel;
LLTabContainer* tabs_panel = getChild<LLTabContainer>("marketplace_filter_tabs");
if (inventory_panel)
if (marketplacelistings_id == mRootFolderId)
{
tabs_panel->removeTabPanel(inventory_panel);
delete inventory_panel;
LL_WARNS("SLM") << "Inventory warning: Marketplace listings folder already set" << LL_ENDL;
return;
}
inventory_panel = LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_marketplace_listings_inventory.xml", tabs_panel, LLInventoryPanel::child_registry_t::instance());
llassert(inventory_panel != NULL);
// Reshape to the proper size
//LLRect tabs_panel_rect = tabs_panel->getRect();
//inventory_panel->setShape(tabs_panel_rect);
mRootFolderId = marketplacelistings_id;
// Set sort order and callbacks
LLInventoryPanel* panel = getChild<LLInventoryPanel>("All Items");
//panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);
//panel->getFilter().markDefault();
//panel->setSelectCallback(boost::bind(&LLPanelMarketplaceListings::onSelectionChange, this, panel, _1, _2));
mPanelListings->mAllPanel = panel;
*/
// Merov : end hack...
// Consolidate Marketplace listings
// We shouldn't have to do that but with a client/server system relying on a "well known folder" convention,
// things get messy and conventions get broken down eventually
gInventory.consolidateForType(marketplacelistings_id, LLFolderType::FT_MARKETPLACE_LISTINGS);
// Now that we do have a non NULL root, we can build the inventory panels
mPanelListings->buildAllPanels();
// Create observer for marketplace listings modifications : clear the old one and create a new one
if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
{
gInventory.removeObserver(mCategoriesObserver);
delete mCategoriesObserver;
}
mCategoriesObserver = new LLInventoryCategoriesObserver();
gInventory.addObserver(mCategoriesObserver);
mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this));
llassert(mCategoriesObserver);
// Create observer for marketplace listings modifications
if (!mCategoriesObserver && mRootFolderId.notNull())
{
mCategoriesObserver = new LLInventoryCategoriesObserver();
llassert(mCategoriesObserver);
gInventory.addObserver(mCategoriesObserver);
mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this));
}
// Get the content of the marketplace listings folder
fetchContents();
@ -379,7 +367,6 @@ void LLFloaterMarketplaceListings::updateView()
// Get or create the root folder if we are a merchant and it hasn't been done already
if (mRootFolderId.isNull() && (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
{
//llinfos << "Merov D&D : setup from updateView because root folder is null" << llendl;
setup();
}
@ -398,14 +385,19 @@ void LLFloaterMarketplaceListings::updateView()
// Update the middle portion : tabs or messages
if (getFolderCount() > 0)
{
if (mFirstViewListings)
{
// We need to rebuild the tabs cleanly the first time we make them visible
// setup() does it if the root is nixed first
mRootFolderId.setNull();
setup();
mFirstViewListings = false;
}
mPanelListings->setVisible(TRUE);
mInventoryPlaceholder->setVisible(FALSE);
}
else
{
// Merov : Hack...
//mPanelListings->setVisible(TRUE);
//mInventoryPlaceholder->setVisible(FALSE);
mPanelListings->setVisible(FALSE);
mInventoryPlaceholder->setVisible(TRUE);
@ -419,11 +411,6 @@ void LLFloaterMarketplaceListings::updateView()
// *TODO : check those messages and create better appropriate ones in strings.xml
if (mRootFolderId.notNull())
{
// Does the marketplace listings folder needs recreation?
if (!mPanelListings || !gInventory.getCategory(mRootFolderId))
{
setup();
}
// "Marketplace listings is empty!" message strings
text = LLTrans::getString("InventoryMarketplaceListingsNoItems", subs);
title = LLTrans::getString("InventoryMarketplaceListingsNoItemsTitle");

View File

@ -40,6 +40,8 @@ class LLInventoryCategoryAddedObserver;
class LLTextBox;
class LLView;
class LLFloaterMarketplaceListings;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPanelMarketplaceListings
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -52,7 +54,11 @@ public:
void draw();
LLFolderView* getRootFolder() { return mAllPanel->getRootFolder(); } // *TODO : Suppress and get DnD in here instead...
void buildAllPanels();
private:
LLInventoryPanel* buildInventoryPanel(const std::string& childname, const std::string& filename);
// UI callbacks
void onViewSortMenuItemClicked(const LLSD& userdata);
bool onViewSortMenuItemCheck(const LLSD& userdata);
@ -117,8 +123,9 @@ private:
LLTextBox * mInventoryText;
LLTextBox * mInventoryTitle;
LLUUID mRootFolderId;
LLUUID mRootFolderId;
LLPanelMarketplaceListings * mPanelListings;
bool mFirstViewListings;
};
//-----------------------------------------------------------------------------

View File

@ -240,7 +240,6 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
{
// Determine the root folder in case specified, and
// build the views starting with that folder.
//llinfos << "Merov : panel = " << getName() << ", create folder root id = " << root_id << llendl;
LLFolderView* folder_view = createFolderRoot(root_id);
mFolderRoot = folder_view->getHandle();
@ -272,7 +271,6 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
// otherwise wait for idle callback.
if (mInventory->isInventoryUsable() && !mViewsInitialized)
{
//llinfos << "Merov : panel = " << getName() << ", initializeViews" << llendl;
initializeViews();
}
@ -590,13 +588,13 @@ void LLInventoryPanel::modelChanged(U32 mask)
LLUUID LLInventoryPanel::getRootFolderID()
{
LLUUID root_id;
if (mFolderRoot.get() && mFolderRoot.get()->getViewModelItem())
{
return static_cast<LLFolderViewModelItemInventory*>(mFolderRoot.get()->getViewModelItem())->getUUID();
root_id = static_cast<LLFolderViewModelItemInventory*>(mFolderRoot.get()->getViewModelItem())->getUUID();
}
else
{
LLUUID root_id;
if (mParams.start_folder.id.isChosen())
{
root_id = mParams.start_folder.id;
@ -624,8 +622,8 @@ LLUUID LLInventoryPanel::getRootFolderID()
}
}
}
return root_id;
}
return root_id;
}
// static
@ -784,11 +782,14 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
{
LLInventoryObject const* objectp = gInventory.getObject(id);
if (!objectp) return NULL;
if (!objectp)
{
return NULL;
}
LLFolderViewItem* folder_view_item = getItemByID(id);
const LLUUID &parent_id = objectp->getParentUUID();
const LLUUID &parent_id = objectp->getParentUUID();
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)getItemByID(parent_id);
// Force the creation of an extra root level folder item if required by the inventory panel (default is "false")
@ -813,8 +814,8 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
objectp->getType() >= LLAssetType::AT_COUNT)
{
LL_WARNS() << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : "
<< ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
<< LL_ENDL;
<< ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
<< LL_ENDL;
return NULL;
}

View File

@ -74,98 +74,6 @@
tab_group="1"
tab_position="top"
tab_min_width="50">
<inventory_panel
label="ALL"
name="All Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
top="16"
left="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
start_folder.type="merchant"
tool_tip="Drag and drop items here to sell them"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>
<inventory_panel
label="LISTED"
name="Active Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
left_delta="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
allow_drop_on_root="false"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>
<inventory_panel
label="UNLISTED"
name="Inactive Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
left_delta="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
allow_drop_on_root="false"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>
<inventory_panel
label="UNASSOCIATED"
name="Unassociated Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
left_delta="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>
</tab_container>
</panel>
</panel>

View File

@ -3,24 +3,23 @@
label="ALL"
name="All Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
top="16"
left="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
start_folder.type="merchant"
follows="all"
layout="topleft"
top="16"
left="0"
height="370"
width="308"
top_pad="0"
tool_tip="Drag and drop items here to sell them"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
tool_tip="Drag and drop items here to sell them"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<inventory_panel
label="LISTED"
name="Active Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
left_delta="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
allow_drop_on_root="false"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<inventory_panel
label="UNASSOCIATED"
name="Unassociated Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
left_delta="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<inventory_panel
label="UNLISTED"
name="Inactive Items"
help_topic="marketplace_tab"
layout="topleft"
follows="all"
width="308"
height="370"
left_delta="0"
start_folder.name="Marketplace listings"
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
allow_drop_on_root="false"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
show_item_link_overlays="true">
<item allow_wear="false"/>
</inventory_panel>