diff options
author | Merov Linden <merov@lindenlab.com> | 2014-04-28 14:11:17 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-04-28 14:11:17 -0700 |
commit | fc4939033e089354bc05fd0ca7fe402a4a1198bd (patch) | |
tree | 1cdef2ecf856b25f4455b7839270c5662c8d2b55 /indra/newview | |
parent | 6d7b33f77e6d6facd585faf8c5d355f68942fcef (diff) |
DD-22 : WIP : Fix initialization glitch and got rid of old Merchant Outbox remnants in Marketplace
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloatermarketplacelistings.cpp | 73 | ||||
-rwxr-xr-x | indra/newview/llfloatermarketplacelistings.h | 3 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 21 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 6 |
4 files changed, 45 insertions, 58 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 27b31518a1..ccfca71df9 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -160,8 +160,7 @@ public: if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS) { - //mMarketplaceListingsFloater->initializeMarketPlace(); - LLMarketplaceData::instance().initializeSLM(); + mMarketplaceListingsFloater->initializeMarketPlace(); } } } @@ -235,11 +234,9 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key) // // Initialize the Market Place or go update the marketplace listings // - //if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) { - //initializeMarketPlace(); - LLMarketplaceData::instance().initializeSLM(); + initializeMarketPlace(); } else { @@ -272,7 +269,6 @@ void LLFloaterMarketplaceListings::fetchContents() void LLFloaterMarketplaceListings::setup() { - //if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) if (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) { // If we are *not* a merchant or we have no market place connection established yet, do nothing @@ -327,18 +323,7 @@ void LLFloaterMarketplaceListings::setup() void LLFloaterMarketplaceListings::initializeMarketPlace() { - // - // Initialize the marketplace import API - // - LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); - - if (!importer.isInitialized()) - { - importer.setInitializationErrorCallback(boost::bind(&LLFloaterMarketplaceListings::initializationReportError, this, _1, _2)); - importer.setStatusChangedCallback(boost::bind(&LLFloaterMarketplaceListings::importStatusChanged, this, _1)); - importer.setStatusReportCallback(boost::bind(&LLFloaterMarketplaceListings::importReportResults, this, _1, _2)); - importer.initialize(); - } + LLMarketplaceData::instance().initializeSLM(boost::bind(&LLFloaterMarketplaceListings::updateView, this)); } S32 LLFloaterMarketplaceListings::getFolderCount() @@ -379,9 +364,27 @@ void LLFloaterMarketplaceListings::updateView() std::string tooltip; const LLSD& subs = getMarketplaceStringSubstitutions(); - //U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus(); U32 mkt_status = LLMarketplaceData::instance().getSLMStatus(); + // 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)) + { + setup(); + } + + // Update the bottom initializing status and progress dial + if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) + { + setStatusString(getString("MarketplaceListingsInitializing")); + mInventoryInitializationInProgress->setVisible(true); + } + else + { + setStatusString(""); + mInventoryInitializationInProgress->setVisible(false); + } + + // Update the top message or flip to the tabs and folders view // *TODO : check those messages and create better appropriate ones in strings.xml if (mRootFolderId.notNull()) { @@ -483,38 +486,6 @@ void LLFloaterMarketplaceListings::onChanged() } } -void LLFloaterMarketplaceListings::initializationReportError(U32 status, const LLSD& content) -{ - updateView(); -} - -void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress) -{ - //if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)) - if (mRootFolderId.isNull() && (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)) - { - setup(); - } - - if (inProgress) - { - setStatusString(getString("MarketplaceListingsInitializing")); - mInventoryInitializationInProgress->setVisible(true); - } - else - { - setStatusString(""); - mInventoryInitializationInProgress->setVisible(false); - } - - updateView(); -} - -void LLFloaterMarketplaceListings::importReportResults(U32 status, const LLSD& content) -{ - updateView(); -} - //----------------------------------------------------------------------------- // LLFloaterAssociateListing //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index cb900c903c..f68097f156 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -94,9 +94,6 @@ protected: void setup(); void fetchContents(); - void importReportResults(U32 status, const LLSD& content); - void importStatusChanged(bool inProgress); - void initializationReportError(U32 status, const LLSD& content); void setStatusString(const std::string& statusString); void onClose(bool app_quitting); diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 607f907ed1..c3aaf66071 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -602,7 +602,8 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, // Data map LLMarketplaceData::LLMarketplaceData() : - mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) + mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED), + mStatusUpdatedSignal(NULL) { mTestCurrentMarketplaceID = 1234567; } @@ -612,9 +613,14 @@ S32 LLMarketplaceData::getTestMarketplaceID() return mTestCurrentMarketplaceID++; } -void LLMarketplaceData::initializeSLM() +void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& cb) { mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING; + if (mStatusUpdatedSignal == NULL) + { + mStatusUpdatedSignal = new status_updated_signal_t(); + } + mStatusUpdatedSignal->connect(cb); // Get DirectDelivery cap std::string url = ""; @@ -638,6 +644,17 @@ void LLMarketplaceData::initializeSLM() LLHTTPClient::get(url, new LLSLMMerchantResponder(), LLSD()); } +void LLMarketplaceData::setSLMStatus(U32 status) +{ + mMarketPlaceStatus = status; /* call cb if status is "done" */ + + // Make sure we trigger the status change with the current state + if (mStatusUpdatedSignal) + { + (*mStatusUpdatedSignal)(); + } +} + // Creation / Deletion bool LLMarketplaceData::addListing(const LLUUID& folder_id) { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index a71ccfd53e..237432068c 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -146,9 +146,10 @@ public: LLMarketplaceData(); // SLM + typedef boost::signals2::signal<void ()> status_updated_signal_t; U32 getSLMStatus() const { return mMarketPlaceStatus; } - void setSLMStatus(U32 status) { mMarketPlaceStatus = status; } - void initializeSLM(); + void setSLMStatus(U32 status); + void initializeSLM(const status_updated_signal_t::slot_type& cb); bool isEmpty() { return (mMarketplaceItems.size() == 0); } @@ -179,6 +180,7 @@ public: private: marketplace_items_list_t mMarketplaceItems; U32 mMarketPlaceStatus; + status_updated_signal_t * mStatusUpdatedSignal; // Merov : This is for test only, waiting for SLM API S32 mTestCurrentMarketplaceID; }; |