From 00fe1b7fbe605ddcb6fb56e0a3d20b1208fbd5fd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 10 Mar 2014 11:44:40 -0700 Subject: DD-3 : WIP : Add test data to LLMarketplaceData when opening the floater for the first time --- indra/newview/llfloateroutbox.cpp | 24 ++++++++++++++++++++++++ indra/newview/llmarketplacefunctions.cpp | 2 ++ indra/newview/llmarketplacefunctions.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index c5ece0ccd6..86387c548a 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -697,6 +697,10 @@ BOOL LLFloaterMerchantItems::postBuild() mCategoryAddedObserver = new LLMerchantItemsAddedObserver(this); gInventory.addObserver(mCategoryAddedObserver); + // Merov : Debug : fetch aggressively so we can create test data right onOpen() + llinfos << "Merov : postBuild, do fetchContent() ahead of time" << llendl; + fetchContents(); + return TRUE; } @@ -737,6 +741,26 @@ void LLFloaterMerchantItems::onOpen(const LLSD& key) // Trigger fetch of the contents // fetchContents(); + + // Merov : Debug : Create fake Marketplace data if none is present + if (LLMarketplaceData::instance().isEmpty() && (getFolderCount() > 0)) + { + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); + + int index = 0; + for (LLInventoryModel::cat_array_t::iterator iter = cats->begin(); iter != cats->end(); iter++, index++) + { + LLViewerInventoryCategory* category = *iter; + LLMarketplaceData::instance().addTestItem(category->getUUID()); + if (index%2) + { + LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); + } + LLMarketplaceData::instance().setActivation(category->getUUID(),(index%3 == 0)); + } + } } void LLFloaterMerchantItems::onFocusReceived() diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index d231202f40..b39889c721 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -629,10 +629,12 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) // Test methods void LLMarketplaceData::addTestItem(const LLUUID& folder_id) { + llinfos << "Merov : addTestItem, id = " << folder_id << llendl; mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); } void LLMarketplaceData::addTestItem(const LLUUID& folder_id, const LLUUID& version_id) { + llinfos << "Merov : addTestItem, id = " << folder_id << ", version = " << version_id << llendl; mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); setVersionFolderID(folder_id, version_id); } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index c3cde740a2..c86df08476 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -142,6 +142,8 @@ class LLMarketplaceData public: LLMarketplaceData(); + bool isEmpty() { return (mMarketplaceItems.size() == 0); } + // Access Marketplace Data : methods return default value if the folder_id can't be found bool getActivationState(const LLUUID& folder_id); std::string getListingID(const LLUUID& folder_id); -- cgit v1.2.3