diff options
| author | leslie@leslie-HPz600.lindenlab.com <leslie@leslie-HPz600.lindenlab.com> | 2011-08-02 13:12:39 -0700 | 
|---|---|---|
| committer | leslie@leslie-HPz600.lindenlab.com <leslie@leslie-HPz600.lindenlab.com> | 2011-08-02 13:12:39 -0700 | 
| commit | 45bf1debaa805b64ce30e3c0670a2e9f24d43e08 (patch) | |
| tree | 9b00db2f91d759c3257dd5c310de4dadbd60e6c7 | |
| parent | 9778824b8c8ac3a0b6b373bbaac24f436fb23130 (diff) | |
* Fixed up outbox UI alignment to match inbox
* Added outbox item count to outbox button title
* Updated sync loading indicator to keep moving until http request complete
* Updated outbox panel display to use user_status http get response
* Removed inbox/outbox folder name hack from LLInventoryPanel
| -rw-r--r-- | indra/newview/llinventorypanel.cpp | 43 | ||||
| -rw-r--r-- | indra/newview/llpanelmarketplaceoutbox.cpp | 76 | ||||
| -rw-r--r-- | indra/newview/llpanelmarketplaceoutbox.h | 4 | ||||
| -rw-r--r-- | indra/newview/llsidepanelinventory.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llviewermedia.cpp | 46 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_inbox_inventory.xml | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_outbox_inventory.xml | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 40 | 
8 files changed, 118 insertions, 98 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index c3545efeaf..503c67d01b 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -163,49 +163,6 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params)  	{  		root_id = gInventory.getLibraryRootFolderID();  	} -	// leslie -- temporary HACK to work around sim not creating inbox and outbox with proper system folder type -	else if (preferred_type == LLFolderType::FT_INBOX) -	{ -		LLInventoryModel::cat_array_t* cats; -		LLInventoryModel::item_array_t* items; -		 -		gInventory.getDirectDescendentsOf(gInventory.getRootFolderID(), cats, items); -		 -		if (cats) -		{ -			for (LLInventoryModel::cat_array_t::const_iterator cat_it = cats->begin(); cat_it != cats->end(); ++cat_it) -			{ -				LLInventoryCategory* cat = *cat_it; -				 -				if (cat->getName() == "Received Items") -				{ -					root_id = cat->getUUID(); -				} -			} -		} -	} -	// leslie -- temporary HACK to work around sim not creating inbox and outbox with proper system folder type -	/*else if (preferred_type == LLFolderType::FT_OUTBOX) -	{ -		LLInventoryModel::cat_array_t* cats; -		LLInventoryModel::item_array_t* items; -		 -		gInventory.getDirectDescendentsOf(gInventory.getRootFolderID(), cats, items); -		 -		if (cats) -		{ -			for (LLInventoryModel::cat_array_t::const_iterator cat_it = cats->begin(); cat_it != cats->end(); ++cat_it) -			{ -				LLInventoryCategory* cat = *cat_it; -				 -				if (cat->getName() == "Merchant Outbox") -				{ -					root_id = cat->getUUID(); -				} -			} -		} -	}*/ -	// leslie -- end temporary HACK  	else  	{  		root_id = (preferred_type != LLFolderType::FT_NONE) diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 074fea546d..90c7f9728b 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -147,7 +147,7 @@ BOOL LLPanelMarketplaceOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL d  {  	BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); -	if (!handled && mInventoryPanel->getRootFolder()) +	if (!handled && mInventoryPanel && mInventoryPanel->getRootFolder())  	{  		handled = mInventoryPanel->getRootFolder()->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg); @@ -197,54 +197,65 @@ void timeDelay(LLCoros::self& self, LLPanelMarketplaceOutbox* outboxPanel)  class LLInventorySyncResponder : public LLHTTPClient::Responder  {  public: -	LLInventorySyncResponder() +	LLInventorySyncResponder(LLPanelMarketplaceOutbox * outboxPanel)  		: LLCurl::Responder() +		, mOutboxPanel(outboxPanel)  	{  	}  	void completed(U32 status, const std::string& reason, const LLSD& content)  	{ +		llinfos << "inventory_import complete status: " << status << llendl; +  		if (isGoodStatus(status))  		{  			// Complete success -			llinfos << "sync complete" << llendl; +			llinfos << "success" << llendl;  		}	  		else  		{ -			llwarns << "sync failed" << llendl; +			llwarns << "failed" << llendl;  		} + +		mOutboxPanel->onSyncComplete();  	} + +private: +	LLPanelMarketplaceOutbox *	mOutboxPanel;  };  void LLPanelMarketplaceOutbox::onSyncButtonClicked()  {	 -	std::string url = "http://pdp24.lindenlab.com/3000"; /*"https://marketplace.secondlife.com/"; +	// Get the sync animation going +	mSyncInProgress = true; +	updateSyncButtonStatus(); + +	// Make the url for the inventory import request +	std::string url = "https://marketplace.secondlife.com/";  	if (!LLGridManager::getInstance()->isInProductionGrid())  	{  		std::string gridLabel = LLGridManager::getInstance()->getGridLabel();  		url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str()); + +		// TEMP for Jim's pdp +		//url = "http://pdp24.lindenlab.com:3000/";  	} -	*/ +	  	url += "api/1/users/";  	url += gAgent.getID().getString();  	url += "/inventory_import"; -	LLHTTPClient::get(url, new LLInventorySyncResponder(), LLViewerMedia::getHeaders()); - - -	mSyncInProgress = true; -	updateSyncButtonStatus(); +	llinfos << "http get:  " << url << llendl; +	LLHTTPClient::get(url, new LLInventorySyncResponder(this), LLViewerMedia::getHeaders());  	// Set a timer (for testing only) - -    gTimeDelayDebugFunc = LLCoros::instance().launch("LLPanelMarketplaceOutbox timeDelay", boost::bind(&timeDelay, _1, this)); +    //gTimeDelayDebugFunc = LLCoros::instance().launch("LLPanelMarketplaceOutbox timeDelay", boost::bind(&timeDelay, _1, this));  }  void LLPanelMarketplaceOutbox::onSyncComplete()  {  	mSyncInProgress = false; -  	updateSyncButtonStatus();  } @@ -267,3 +278,40 @@ void LLPanelMarketplaceOutbox::updateSyncButtonStatus()  		mSyncButton->setEnabled(!isOutboxEmpty());  	}  } + +U32 LLPanelMarketplaceOutbox::getTotalItemCount() const
 +{
 +	U32 item_count = 0;
 +
 +	if (mInventoryPanel)
 +	{
 +		const LLFolderViewFolder * outbox_folder = mInventoryPanel->getRootFolder();
 +
 +		if (outbox_folder)
 +		{
 +			item_count += outbox_folder->getFoldersCount();
 +		}
 +	}
 +
 +	return item_count;
 +}
 + +void LLPanelMarketplaceOutbox::draw() +{ +	U32 item_count = getTotalItemCount();
 +
 +	if (item_count > 0)
 +	{
 +		std::string item_count_str = llformat("%d", item_count);
 +
 +		LLStringUtil::format_map_t args;
 +		args["[NUM]"] = item_count_str;
 +		getChild<LLButton>("outbox_btn")->setLabel(getString("OutboxLabelWithArg", args));
 +	}
 +	else
 +	{
 +		getChild<LLButton>("outbox_btn")->setLabel(getString("OutboxLabelNoArg"));
 +	}
 +
 +	LLPanel::draw();
 +} diff --git a/indra/newview/llpanelmarketplaceoutbox.h b/indra/newview/llpanelmarketplaceoutbox.h index d5671edad6..b5ee3f72cc 100644 --- a/indra/newview/llpanelmarketplaceoutbox.h +++ b/indra/newview/llpanelmarketplaceoutbox.h @@ -54,8 +54,12 @@ public:  	/*virtual*/ BOOL postBuild(); +	/*virtual*/ void draw(); +  	void setupInventoryPanel(); +	U32 getTotalItemCount() const; +  	bool isOutboxEmpty() const;  	bool isSyncInProgress() const; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 6f809ba3ca..41a0b57f2d 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -301,8 +301,7 @@ void LLSidepanelInventory::handleLoginComplete()  		observeOutboxModifications(outbox_id);  		// Enable the display of the outbox if it exists -		//enableOutbox(true); -		// leslie NOTE: Disabling outbox until we support it officially. +		enableOutbox(true);  	}  } diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index d5a8772461..fc71e19a7d 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1378,13 +1378,18 @@ public:  	{  		if (isGoodStatus(status))  		{ +			std::string merchantStatus = content[gAgent.getID().getString()].asString(); +			llinfos << "Marketplace merchant status: " << merchantStatus << llendl; +  			// Complete success  			gSavedSettings.setBOOL("InventoryDisplayInbox", true); +			gSavedSettings.setBOOL("InventoryDisplayOutbox", (merchantStatus == "merchant"));  		}  		else if (status == 401)  		{  			// API is available for use but OpenID authorization failed  			gSavedSettings.setBOOL("InventoryDisplayInbox", true); +			//gSavedSettings.setBOOL("InventoryDisplayOutbox", true);  		}  		else  		{ @@ -1395,6 +1400,28 @@ public:  }; +void doOnetimeEarlyHTTPRequests() +{ +	std::string url = "https://marketplace.secondlife.com/"; + +	if (!LLGridManager::getInstance()->isInProductionGrid()) +	{ +		std::string gridLabel = LLGridManager::getInstance()->getGridLabel(); +		url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str()); + +		// TEMP for Jim's pdp +		//url = "http://pdp24.lindenlab.com:3000/"; +	} +	 +	url += "api/1/users/"; +	url += gAgent.getID().getString(); +	url += "/user_status"; + +	llinfos << "http get: " << url << llendl; +	LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), LLViewerMedia::getHeaders()); +} + +  LLSD LLViewerMedia::getHeaders()  {  	LLSD headers = LLSD::emptyMap(); @@ -1452,24 +1479,7 @@ void LLViewerMedia::setOpenIDCookie()  			new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()),  			headers); -		std::string url = "https://marketplace.secondlife.com/"; - -		if (!LLGridManager::getInstance()->isInProductionGrid()) -		{ -			std::string gridLabel = LLGridManager::getInstance()->getGridLabel(); -			url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str()); -		} -	 -		url += "api/1/users/"; -		url += gAgent.getID().getString(); -		url += "/user_status"; - -		headers = LLSD::emptyMap(); -		headers["Accept"] = "*/*"; -		headers["Cookie"] = sOpenIDCookie; -		headers["User-Agent"] = getCurrentUserAgent(); - -		LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), headers); +		doOnetimeEarlyHTTPRequests();  	}  } diff --git a/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml index d06190ec54..383e637ace 100644 --- a/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml @@ -4,7 +4,7 @@      start_folder="Received Items"      follows="all" layout="topleft"      top="0" left="0" height="165" width="308" -	top_pad="0" +    top_pad="0"      bg_opaque_color="DkGray2"      bg_alpha_color="DkGray2"      background_visible="true" diff --git a/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml index af32056428..396d5cf2f5 100644 --- a/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outbox_inventory.xml @@ -4,7 +4,7 @@      start_folder="Outbox"      follows="all" layout="topleft"      top="0" left="0" height="165" width="308" -	top_pad="0" +    top_pad="0"      bg_opaque_color="DkGray2"      bg_alpha_color="DkGray2"      background_visible="true" diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 79a0ec7c72..1d1d4ca01e 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -129,41 +129,43 @@                   </panel>               </layout_panel>               <layout_panel -                width="330" -                auto_resize="true" -                user_resize="false" -                follows="bottom|left|right" -                name="outbox_layout_panel" -                visible="false" -                min_dim="35" -                max_dim="200" -                expanded_min_dim="90" -                height="200"> +                 width="330" +                 auto_resize="true" +                 user_resize="false" +                 follows="bottom|left|right" +                 name="outbox_layout_panel" +                 visible="false" +                 min_dim="35" +                 max_dim="200" +                 expanded_min_dim="90" +                 height="200">                   <panel                        follows="all"                        layout="topleft" -                      left="10" +                      left="0"                        name="marketplace_outbox"                        class="panel_marketplace_outbox"                        top="0"                        label=""                        height="200" -                      width="310"> +                      width="330"> +                     <string name="OutboxLabelWithArg">Merchant Outbox ([NUM])</string> +                     <string name="OutboxLabelNoArg">Merchant Outbox</string>                       <button                          label="Merchant Outbox" -                        is_toggle="true" -                        handle_right_mouse="false"                          name="outbox_btn" -                        follows="top|left|right" -                        image_unselected="MarketplaceBtn_Off" -                        image_selected="MarketplaceBtn_Selected"                          height="35" -                        tab_stop="false"                          width="308" +                        image_unselected="MarketplaceBtn_Off" +                        image_selected="MarketplaceBtn_Selected"                          halign="left" +                        handle_right_mouse="false" +                        follows="top|left|right" +                        is_toggle="true" +                        tab_stop="false"                          pad_left="35"                          top="0" -                        left="0" /> +                        left="10" />                       <button                           image_unselected="OutboxPush_Off"                           image_selected="OutboxPush_Selected"  | 
