diff options
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/newview/llfloatermarketplacelistings.cpp | 20 | ||||
| -rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 35 | ||||
| -rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 16 | ||||
| -rwxr-xr-x | indra/newview/skins/default/xui/en/floater_marketplace_listings.xml | 1 | 
4 files changed, 54 insertions, 18 deletions
| diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 92ada398e0..bed4ea841c 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -357,7 +357,7 @@ BOOL LLFloaterMarketplaceListings::postBuild()  	mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(this);  	gInventory.addObserver(mCategoryAddedObserver); -    // Debug : fetch aggressively so we can create test data right onOpen() +    // Fetch aggressively so we can interact with listings right onOpen()  	fetchContents();  	return TRUE; @@ -389,10 +389,13 @@ void LLFloaterMarketplaceListings::onFocusReceived()  void LLFloaterMarketplaceListings::fetchContents()  { -	if (mRootFolderId.notNull()) +	if (mRootFolderId.notNull() && +        (LLMarketplaceData::instance().getSLMDataFetched() != MarketplaceFetchCodes::MARKET_FETCH_LOADING) && +        (LLMarketplaceData::instance().getSLMDataFetched() != MarketplaceFetchCodes::MARKET_FETCH_DONE))  	{ +        LLMarketplaceData::instance().setDataFetchedSignal(boost::bind(&LLFloaterMarketplaceListings::updateView, this)); +        LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_LOADING);  		LLInventoryModelBackgroundFetch::instance().start(mRootFolderId); -        // Get all the SLM Listings          LLMarketplaceData::instance().getSLMListings();  	}  } @@ -492,6 +495,7 @@ void LLFloaterMarketplaceListings::setStatusString(const std::string& statusStri  void LLFloaterMarketplaceListings::updateView()  {      U32 mkt_status = LLMarketplaceData::instance().getSLMStatus(); +    U32 data_fetched = LLMarketplaceData::instance().getSLMDataFetched();      // 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)) @@ -500,14 +504,18 @@ void LLFloaterMarketplaceListings::updateView()      }      // Update the bottom initializing status and progress dial -    if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) +    if ((mkt_status == MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) || +        (data_fetched == MarketplaceFetchCodes::MARKET_FETCH_NOT_DONE) || +        (data_fetched == MarketplaceFetchCodes::MARKET_FETCH_LOADING))      { -        setStatusString(getString("MarketplaceListingsInitializing")); +        // Just show the loading indicator in that case and fetch the data (fetch will be skipped if it's already loading)          mInventoryInitializationInProgress->setVisible(true); +        mPanelListings->setVisible(FALSE); +        fetchContents(); +        return;      }      else      { -        setStatusString("");          mInventoryInitializationInProgress->setVisible(false);      } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index c0823cf1de..ab3be79a2e 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -154,10 +154,6 @@ void log_SLM_infos(const std::string& request, const std::string& url, const std      }  } -// Merov: This is a temporary hack used by dev while secondlife-staging is down... -// *TODO : Suppress that before shipping! -static bool sBypassMerchant = false; -  class LLSLMGetMerchantResponder : public LLHTTPClient::Responder  {  	LOG_CLASS(LLSLMGetMerchantResponder); @@ -168,13 +164,7 @@ public:  protected:      virtual void httpFailure()      { -        if (sBypassMerchant) -        { -            // *TODO : Suppress that before shipping! -            log_SLM_infos("Get /merchant", getStatus(), "SLM Connection error bypassed (debug only)"); -            LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_MERCHANT); -        } -        else if (HTTP_NOT_FOUND == getStatus()) +        if (HTTP_NOT_FOUND == getStatus())          {              log_SLM_infos("Get /merchant", getStatus(), "User is not a merchant");              LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT); @@ -222,6 +212,7 @@ public:  		if (!isGoodStatus())  		{              log_SLM_warning("Get /listings", getStatus(), getReason(), "", body); +            LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_FAILED);              update_marketplace_category(mExpectedFolderId, false);              gInventory.notifyObservers();              return; @@ -232,6 +223,7 @@ public:          if (!reader.parse(body,root))          {              log_SLM_warning("Get /listings", getStatus(), "Json parsing failed", reader.getFormatedErrorMessages(), body); +            LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_FAILED);              update_marketplace_category(mExpectedFolderId, false);              gInventory.notifyObservers();              return; @@ -263,6 +255,7 @@ public:          }          // Update all folders under the root +        LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_DONE);          update_marketplace_category(mExpectedFolderId, false);          gInventory.notifyObservers();              } @@ -1194,7 +1187,9 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id,  // Data map  LLMarketplaceData::LLMarketplaceData() :    mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED), + mMarketPlaceDataFetched(MarketplaceFetchCodes::MARKET_FETCH_NOT_DONE),   mStatusUpdatedSignal(NULL), + mDataFetchedSignal(NULL),   mDirtyCount(false)  {      mInventoryObserver = new LLMarketplaceInventoryObserver; @@ -1232,6 +1227,15 @@ void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type&      }  } +void LLMarketplaceData::setDataFetchedSignal(const status_updated_signal_t::slot_type& cb) +{ +	if (mDataFetchedSignal == NULL) +	{ +		mDataFetchedSignal = new status_updated_signal_t(); +	} +	mDataFetchedSignal->connect(cb); +} +  // Get/Post/Put requests to the SLM Server using the SLM API  void LLMarketplaceData::getSLMListings()  { @@ -1397,6 +1401,15 @@ void LLMarketplaceData::setSLMStatus(U32 status)      }  } +void LLMarketplaceData::setSLMDataFetched(U32 status) +{ +    mMarketPlaceDataFetched = status; +    if (mDataFetchedSignal) +    { +        (*mDataFetchedSignal)(); +    } +} +  // Creation / Deletion / Update  // Methods publicly called  bool LLMarketplaceData::createListing(const LLUUID& folder_id) diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 755643ccd0..34b650b0ce 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -73,6 +73,17 @@ namespace MarketplaceStatusCodes  	};  } +namespace MarketplaceFetchCodes +{ +	enum sCode +	{ +		MARKET_FETCH_NOT_DONE = 0, +		MARKET_FETCH_LOADING = 1, +		MARKET_FETCH_FAILED = 2, +		MARKET_FETCH_DONE = 3 +	}; +} +  class LLMarketplaceInventoryImporter  	: public LLSingleton<LLMarketplaceInventoryImporter> @@ -190,6 +201,9 @@ public:  	void setSLMStatus(U32 status);      void getSLMListings();      bool isEmpty() { return (mMarketplaceItems.size() == 0); } +    void setDataFetchedSignal(const status_updated_signal_t::slot_type& cb); +    void setSLMDataFetched(U32 status); +    U32 getSLMDataFetched() { return mMarketPlaceDataFetched; }      // High level create/delete/set Marketplace data: each method returns true if the function succeeds, false if error      bool createListing(const LLUUID& folder_id); @@ -253,6 +267,8 @@ private:      bool mDirtyCount;   // If true, stock count value need to be updated at the next check      // Update data +    U32 mMarketPlaceDataFetched; +	status_updated_signal_t* mDataFetchedSignal;      std::set<LLUUID> mPendingUpdateSet;      // Listing folders waiting for validation 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 8f58146a48..0806a87288 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -13,7 +13,6 @@    save_rect="true"    save_visibility="false"    reuse_instance="true"> -  <string name="MarketplaceListingsInitializing">Initializing...</string>    <panel      name="marketplace_listings_panel"      follows="all" | 
