diff options
4 files changed, 164 insertions, 136 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 64f95c4a1a..ca2a1d54fc 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -35,7 +35,6 @@  #include "llinventorybridge.h"  #include "llinventorymodelbackgroundfetch.h"  #include "llinventoryobserver.h" -#include "llinventorypanel.h"  #include "llmarketplacefunctions.h"  #include "llnotificationhandler.h"  #include "llnotificationmanager.h" @@ -47,6 +46,109 @@  #include "llwindowshade.h"  ///---------------------------------------------------------------------------- +/// LLPanelMarketplaceListings +///---------------------------------------------------------------------------- + +static LLPanelInjector<LLPanelMarketplaceListings> t_panel_status("llpanelmarketplacelistings"); + +LLPanelMarketplaceListings::LLPanelMarketplaceListings() +: mAllPanel(NULL) +, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) +, mFilterType(LLInventoryFilter::FILTERTYPE_NONE) +{ +	mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action",  boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemClicked,  this, _2)); +	mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem",	boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemCheck,	this, _2)); +} + +BOOL LLPanelMarketplaceListings::postBuild() +{ +	mAllPanel = getChild<LLInventoryPanel>("All Items"); + +	// Set the sort order newest to oldest +	LLInventoryPanel* panel = getChild<LLInventoryPanel>("All Items"); +	panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); +	panel->getFilter().markDefault(); +     +    // Set filters on the 3 prefiltered panels +	panel = getChild<LLInventoryPanel>("Active Items"); +	panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); +	panel->getFilter().setFilterMarketplaceActiveFolders(); +	panel->getFilter().markDefault(); +	panel = getChild<LLInventoryPanel>("Inactive Items"); +	panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); +	panel->getFilter().setFilterMarketplaceInactiveFolders(); +	panel->getFilter().markDefault(); +	panel = getChild<LLInventoryPanel>("Unassociated Items"); +	panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); +	panel->getFilter().setFilterMarketplaceUnassociatedFolders(); +	panel->getFilter().markDefault(); +	 +    return LLPanel::postBuild(); +} + +void LLPanelMarketplaceListings::draw() +{ +	LLPanel::draw(); +} + +void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata) +{ +	std::string chosen_item = userdata.asString(); +     +    llinfos << "Merov : MenuItemClicked, item = " << chosen_item << llendl; +     +    // Sort options +	if (chosen_item == "sort_by_stock_amount") +	{ +        mSortOrder = (mSortOrder == LLInventoryFilter::SO_FOLDERS_BY_NAME ? LLInventoryFilter::SO_FOLDERS_BY_WEIGHT : LLInventoryFilter::SO_FOLDERS_BY_NAME); +        mAllPanel->getFolderViewModel()->setSorter(mSortOrder); +	} +    // View/filter options +	else if (chosen_item == "show_all") +	{ +        mFilterType = LLInventoryFilter::FILTERTYPE_NONE; +        mAllPanel->getFilter().resetDefault(); +	} +	else if (chosen_item == "show_unassociated") +	{ +        mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_UNASSOCIATED; +        mAllPanel->getFilter().resetDefault(); +        mAllPanel->getFilter().setFilterMarketplaceUnassociatedFolders(); +	} +	else if (chosen_item == "show_active") +	{ +        mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_ACTIVE; +        mAllPanel->getFilter().resetDefault(); +        mAllPanel->getFilter().setFilterMarketplaceActiveFolders(); +	} +	else if (chosen_item == "show_inactive") +	{ +        mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_INACTIVE; +        mAllPanel->getFilter().resetDefault(); +        mAllPanel->getFilter().setFilterMarketplaceInactiveFolders(); +	} +} + +bool LLPanelMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata) +{ +	std::string chosen_item = userdata.asString(); +     +    llinfos << "Merov : MenuItemCheck, item = " << chosen_item << ", filter type = " << mFilterType << llendl; +     +	if (chosen_item == "sort_by_stock_amount") +		return mSortOrder == LLInventoryFilter::SO_FOLDERS_BY_WEIGHT; +	if (chosen_item == "show_all") +		return mFilterType == LLInventoryFilter::FILTERTYPE_NONE; +	if (chosen_item == "show_unassociated") +		return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_UNASSOCIATED; +	if (chosen_item == "show_active") +		return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_ACTIVE; +	if (chosen_item == "show_inactive") +		return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_INACTIVE; +	return false; +} + +///----------------------------------------------------------------------------  /// LLMarketplaceListingsAddedObserver helper class  ///---------------------------------------------------------------------------- @@ -92,11 +194,8 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key)  , mInventoryPlaceholder(NULL)  , mInventoryText(NULL)  , mInventoryTitle(NULL) -, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) -, mFilterType(LLInventoryFilter::FILTERTYPE_NONE) +, mPanelListings(NULL)  { -	mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action",  boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemClicked,  this, _2)); -	mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem",	boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemCheck,	this, _2));  }  LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() @@ -122,6 +221,8 @@ BOOL LLFloaterMarketplaceListings::postBuild()  	mInventoryText = mInventoryPlaceholder->getChild<LLTextBox>("marketplace_listings_inventory_placeholder_text");  	mInventoryTitle = mInventoryPlaceholder->getChild<LLTextBox>("marketplace_listings_inventory_placeholder_title"); +	mPanelListings = static_cast<LLPanelMarketplaceListings*>(getChild<LLUICtrl>("panel_marketplace_listing")); +  	LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this));  	// Observe category creation to catch marketplace listings creation (moot if already existing) @@ -135,16 +236,6 @@ BOOL LLFloaterMarketplaceListings::postBuild()  	return TRUE;  } -void LLFloaterMarketplaceListings::clean() -{ -    // Note: we cannot delete the mOutboxInventoryPanel as that point -    // as this is called through callback observers of the panel itself. -    // Doing so would crash rapidly. -	 -	// Invalidate the outbox data -    mRootFolderId.setNull(); -} -  void LLFloaterMarketplaceListings::onClose(bool app_quitting)  {  } @@ -202,71 +293,6 @@ void LLFloaterMarketplaceListings::onFocusReceived()  	fetchContents();  } - -void LLFloaterMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata) -{ -	std::string chosen_item = userdata.asString(); -     -	LLInventoryPanel* panel = mInventoryPanel.get(); -     -    llinfos << "Merov : MenuItemClicked, item = " << chosen_item << ", panel on = " << panel->hasFocus() << llendl; -     -    // Sort options -	if (chosen_item == "sort_by_stock_amount") -	{ -        mSortOrder = (mSortOrder == LLInventoryFilter::SO_FOLDERS_BY_NAME ? LLInventoryFilter::SO_FOLDERS_BY_WEIGHT : LLInventoryFilter::SO_FOLDERS_BY_NAME); -        panel->getFolderViewModel()->setSorter(mSortOrder); -	} -    // View/filter options -	else if (chosen_item == "show_all") -	{ -        mFilterType = LLInventoryFilter::FILTERTYPE_NONE; -        panel->getFilter().resetDefault(); -	} -	else if (chosen_item == "show_non_associated_listings") -	{ -        mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_UNASSOCIATED; -        panel->getFilter().setFilterMarketplaceUnassociatedFolders(); -	} -	else if (chosen_item == "show_active") -	{ -        mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_ACTIVE; -        panel->getFilter().setFilterMarketplaceActiveFolders(); -	} -	else if (chosen_item == "show_inactive_listings") -	{ -        mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_INACTIVE; -        panel->getFilter().setFilterMarketplaceInactiveFolders(); -	} -} - -bool LLFloaterMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata) -{ -	std::string chosen_item = userdata.asString(); -     -	LLInventoryPanel* panel = mInventoryPanel.get(); -     -    llinfos << "Merov : MenuItemCheck, item = " << chosen_item << ", panel on = " << panel->hasFocus() << llendl; - -    if (!panel->hasFocus()) -    { -        return false; -    } -     -	if (chosen_item == "sort_by_stock_amount") -		return mSortOrder == LLInventoryFilter::SO_FOLDERS_BY_WEIGHT; -	if (chosen_item == "show_all") -		return mFilterType == LLInventoryFilter::FILTERTYPE_NONE; -	if (chosen_item == "show_non_associated_listings") -		return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_UNASSOCIATED; -	if (chosen_item == "show_active") -		return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_ACTIVE; -	if (chosen_item == "show_inactive_listings") -		return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_INACTIVE; -	return false; -} - -  void LLFloaterMarketplaceListings::fetchContents()  {  	if (mRootFolderId.notNull()) @@ -325,34 +351,15 @@ void LLFloaterMarketplaceListings::setup()      mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this));  	llassert(mCategoriesObserver); -	// Set up the marketplace listings inventory view -    LLPanel* inventory_panel = LLUICtrlFactory::createFromFile<LLPanel>("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); -	LLInventoryPanel* items_panel = inventory_panel->getChild<LLInventoryPanel>("All Items"); -    mInventoryPanel = items_panel->getInventoryPanelHandle(); -	llassert(mInventoryPanel.get() != NULL); +	// Set up the marketplace listings panel view +    //LLPanel* inventory_panel = LLUICtrlFactory::createFromFile<LLPanel>("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); +    //LLPanelMarketplaceListings* panel = LLUICtrlFactory::createFromFile<LLPanelMarketplaceListings>("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLPanel::child_registry_t::instance()); +    //mPanelListings = panel;  	// Reshape the inventory to the proper size -	LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); -	inventory_panel->setShape(inventory_placeholder_rect); +	//LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); +	//panel->setShape(inventory_placeholder_rect); -	// Set the sort order newest to oldest -	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();  } @@ -375,7 +382,7 @@ void LLFloaterMarketplaceListings::initializeMarketPlace()  S32 LLFloaterMarketplaceListings::getFolderCount()  { -	if (mInventoryPanel.get() && mRootFolderId.notNull()) +	if (mPanelListings && mRootFolderId.notNull())  	{          LLInventoryModel::cat_array_t * cats;          LLInventoryModel::item_array_t * items; @@ -395,19 +402,17 @@ void LLFloaterMarketplaceListings::setStatusString(const std::string& statusStri  }  void LLFloaterMarketplaceListings::updateView() -{ -	LLInventoryPanel* panel = mInventoryPanel.get(); -     +{      	if (getFolderCount() > 0)  	{ -		panel->setVisible(TRUE); +		mPanelListings->setVisible(TRUE);  		mInventoryPlaceholder->setVisible(FALSE);  	}  	else  	{ -        if (panel) +        if (mPanelListings)          { -            panel->setVisible(FALSE); +            mPanelListings->setVisible(FALSE);          }          std::string text; @@ -421,7 +426,7 @@ void LLFloaterMarketplaceListings::updateView()          if (mRootFolderId.notNull())          {              // Does the outbox needs recreation? -            if ((panel == NULL) || !gInventory.getCategory(mRootFolderId)) +            if (!mPanelListings || !gInventory.getCategory(mRootFolderId))              {                  setup();              } @@ -471,7 +476,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO  										EAcceptance* accept,  										std::string& tooltip_msg)  { -	if ((mInventoryPanel.get() == NULL) || mRootFolderId.isNull()) +	if (!mPanelListings || mRootFolderId.isNull())  	{  		return FALSE;  	} @@ -482,16 +487,15 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO  	// Determine if the mouse is inside the inventory panel itself or just within the floater  	bool pointInInventoryPanel = false;  	bool pointInInventoryPanelChild = false; -	LLInventoryPanel* panel = mInventoryPanel.get(); -	LLFolderView* root_folder = panel->getRootFolder(); -	if (panel->getVisible()) +	LLFolderView* root_folder = mPanelListings->getRootFolder(); +	if (mPanelListings->getVisible())  	{  		S32 inv_x, inv_y; -		localPointToOtherView(x, y, &inv_x, &inv_y, panel); +		localPointToOtherView(x, y, &inv_x, &inv_y, mPanelListings); -		pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y); +		pointInInventoryPanel = mPanelListings->getRect().pointInRect(inv_x, inv_y); -		LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true); +		LLView * inventory_panel_child_at_point = mPanelListings->childFromPoint(inv_x, inv_y, true);  		pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder);  	} @@ -529,7 +533,8 @@ void LLFloaterMarketplaceListings::onChanged()      }      else      { -        clean(); +        // Invalidate the outbox data +        mRootFolderId.setNull();      }  } diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index fab2040deb..9ae665f74d 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -29,13 +29,14 @@  #include "llfloater.h"  #include "llfoldertype.h" +#include "llfolderview.h"  #include "llinventoryfilter.h" +#include "llinventorypanel.h"  #include "llnotificationptr.h"  class LLButton;  class LLInventoryCategoriesObserver;  class LLInventoryCategoryAddedObserver; -class LLInventoryPanel;  class LLLoadingIndicator;  class LLNotification;  class LLTextBox; @@ -43,6 +44,28 @@ class LLView;  class LLWindowShade;  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLPanelMarketplaceListings +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLPanelMarketplaceListings : public LLPanel +{ +public: +    LLPanelMarketplaceListings(); +	BOOL postBuild(); +	void draw(); +	LLFolderView* getRootFolder() { return mAllPanel->getRootFolder(); }    // *TODO : Suppress and get DnD in here instead... +     +private: +    // UI callbacks +	void onViewSortMenuItemClicked(const LLSD& userdata); +	bool onViewSortMenuItemCheck(const LLSD& userdata); +     +    LLInventoryPanel* mAllPanel; +    LLInventoryFilter::ESortOrderType mSortOrder; +    LLInventoryFilter::EFilterType mFilterType; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  // Class LLFloaterMarketplaceListings  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -69,7 +92,6 @@ public:  protected:  	void setup(); -    void clean();  	void fetchContents();  	void importReportResults(U32 status, const LLSD& content); @@ -88,9 +110,6 @@ protected:  private:      S32 getFolderCount(); -    // UI callbacks -	void onViewSortMenuItemClicked(const LLSD& userdata); -	bool onViewSortMenuItemCheck(const LLSD& userdata);  	LLInventoryCategoriesObserver *		mCategoriesObserver;  	LLInventoryCategoryAddedObserver *	mCategoryAddedObserver; @@ -102,9 +121,7 @@ private:  	LLTextBox *		mInventoryTitle;  	LLUUID				mRootFolderId; -	LLHandle<LLInventoryPanel> mInventoryPanel; -    LLInventoryFilter::ESortOrderType mSortOrder; -    LLInventoryFilter::EFilterType mFilterType; +	LLPanelMarketplaceListings * mPanelListings;  };  #endif // LL_LLFLOATERMARKETPLACELISTINGS_H diff --git a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml index 80d6187e1e..0f511c4a66 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -64,7 +64,13 @@            wrap="true"            halign="left" />        </panel> -    </panel> +      <panel +        name="panel_marketplace_listing" +        filename="panel_marketplace_listings.xml" +        class="llpanelmarketplacelistings" +        top="0" +        follows="all"/> +      </panel>      <panel        follows="bottom|left|right"        layout="topleft" diff --git a/indra/newview/skins/default/xui/en/menu_marketplace_view.xml b/indra/newview/skins/default/xui/en/menu_marketplace_view.xml index 9ed93e2f11..4043c5c93d 100755 --- a/indra/newview/skins/default/xui/en/menu_marketplace_view.xml +++ b/indra/newview/skins/default/xui/en/menu_marketplace_view.xml @@ -22,13 +22,13 @@          function="Marketplace.ViewSort.CheckItem"          parameter="show_all" />      </menu_item_check> -    <menu_item_check name="show_associated_listings" label="Show Associated Listings Only"> +    <menu_item_check name="show_unassociated" label="Show Unassociated Listings Only">          <menu_item_check.on_click          function="Marketplace.ViewSort.Action" -        parameter="show_associated_listings" /> +        parameter="show_unassociated" />          <menu_item_check.on_check          function="Marketplace.ViewSort.CheckItem" -        parameter="show_associated_listings" /> +        parameter="show_unassociated" />      </menu_item_check>      <menu_item_check name="show_active" label="Show Active Listings and Folders Only">          <menu_item_check.on_click @@ -38,12 +38,12 @@          function="Marketplace.ViewSort.CheckItem"          parameter="show_active" />      </menu_item_check> -    <menu_item_check name="show_inactive_listings" label="Show Inactive Listings Only"> +    <menu_item_check name="show_inactive" label="Show Inactive Listings Only">          <menu_item_check.on_click          function="Marketplace.ViewSort.Action" -        parameter="show_inactive_listings" /> +        parameter="show_inactive" />          <menu_item_check.on_check          function="Marketplace.ViewSort.CheckItem" -        parameter="show_inactive_listings" /> +        parameter="show_inactive" />      </menu_item_check>  </toggleable_menu>  | 
