From a030b30d34ef3152791b123c4f52d4086f3eb549 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 6 Mar 2014 18:15:51 -0800 Subject: DD-4, DD-5, DD-6, DD-7, DD-8: WIP : Add Merchant Items panel and make it somewhat work, in a clunky sort of way --- indra/newview/llfloateroutbox.cpp | 395 +++++++++++++++++++++++++++++++++++++- 1 file changed, 394 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index de96f75602..5ed72e4250 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -1,6 +1,8 @@ /** * @file llfloateroutbox.cpp - * @brief Implementation of the merchant outbox window + * @brief Implementation of the merchant outbox window and of the merchant items window + * + * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermerchantitems * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -104,6 +106,39 @@ private: LLFloaterOutbox * mOutboxFloater; }; +///---------------------------------------------------------------------------- +/// LLMerchantItemsAddedObserver helper class +///---------------------------------------------------------------------------- + +class LLMerchantItemsAddedObserver : public LLInventoryCategoryAddedObserver +{ +public: + LLMerchantItemsAddedObserver(LLFloaterMerchantItems * merchant_items_floater) + : LLInventoryCategoryAddedObserver() + , mMerchantItemsFloater(merchant_items_floater) + { + } + + void done() + { + for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it) + { + LLViewerInventoryCategory* added_category = *it; + + LLFolderType::EType added_category_type = added_category->getPreferredType(); + + if (added_category_type == LLFolderType::FT_MERCHANT_ITEMS) + { + mMerchantItemsFloater->initializeMarketPlace(); + } + } + } + +private: + LLFloaterMerchantItems * mMerchantItemsFloater; +}; + + ///---------------------------------------------------------------------------- /// LLFloaterOutbox ///---------------------------------------------------------------------------- @@ -617,3 +652,361 @@ void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification) notification_handler->processNotification(notification); } +///---------------------------------------------------------------------------- +/// LLFloaterMerchantItems +///---------------------------------------------------------------------------- + +LLFloaterMerchantItems::LLFloaterMerchantItems(const LLSD& key) +: LLFloater(key) +, mCategoriesObserver(NULL) +, mCategoryAddedObserver(NULL) +, mRootFolderId(LLUUID::null) +, mInventoryPlaceholder(NULL) +, mInventoryText(NULL) +, mInventoryTitle(NULL) +, mTopLevelDropZone(NULL) +{ +} + +LLFloaterMerchantItems::~LLFloaterMerchantItems() +{ + if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) + { + gInventory.removeObserver(mCategoriesObserver); + } + delete mCategoriesObserver; + + if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) + { + gInventory.removeObserver(mCategoryAddedObserver); + } + delete mCategoryAddedObserver; +} + +BOOL LLFloaterMerchantItems::postBuild() +{ + mInventoryPlaceholder = getChild("merchant_items_inventory_placeholder_panel"); + mInventoryText = mInventoryPlaceholder->getChild("merchant_items_inventory_placeholder_text"); + mInventoryTitle = mInventoryPlaceholder->getChild("merchant_items_inventory_placeholder_title"); + + mTopLevelDropZone = getChild("merchant_items_generic_drag_target"); + + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMerchantItems::onFocusReceived, this)); + + // Observe category creation to catch merchant items creation (moot if already existing) + mCategoryAddedObserver = new LLMerchantItemsAddedObserver(this); + gInventory.addObserver(mCategoryAddedObserver); + + return TRUE; +} + +void LLFloaterMerchantItems::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 LLFloaterMerchantItems::onClose(bool app_quitting) +{ +} + +void LLFloaterMerchantItems::onOpen(const LLSD& key) +{ + // + // Initialize the Market Place or go update the outbox + // + if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) + { + initializeMarketPlace(); + } + else + { + setup(); + } + + // + // Update the floater view + // + updateView(); + + // + // Trigger fetch of the contents + // + fetchContents(); +} + +void LLFloaterMerchantItems::onFocusReceived() +{ + fetchContents(); +} + +void LLFloaterMerchantItems::fetchContents() +{ + if (mRootFolderId.notNull()) + { + LLInventoryModelBackgroundFetch::instance().start(mRootFolderId); + } +} + +void LLFloaterMerchantItems::setup() +{ + if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) + { + // If we are *not* a merchant or we have no market place connection established yet, do nothing + return; + } + + // We are a merchant. Get the Merchant items folder, create it if needs be. + LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MERCHANT_ITEMS, true); + if (outbox_id.isNull()) + { + // We should never get there unless the inventory fails badly + llinfos << "Merov : Inventory problem: failure to create the merchant items folder for a merchant!" << llendl; + llerrs << "Inventory problem: failure to create the merchant items folder for a merchant!" << llendl; + return; + } + + // Consolidate Merchant items + // We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually + gInventory.consolidateForType(outbox_id, LLFolderType::FT_MERCHANT_ITEMS); + + if (outbox_id == mRootFolderId) + { + llinfos << "Merov : Inventory warning: Merchant items folder already set" << llendl; + llwarns << "Inventory warning: Merchant items folder already set" << llendl; + return; + } + mRootFolderId = outbox_id; + + // No longer need to observe new category creation + if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) + { + gInventory.removeObserver(mCategoryAddedObserver); + delete mCategoryAddedObserver; + mCategoryAddedObserver = NULL; + } + llassert(!mCategoryAddedObserver); + + // Create observer for merchant items modifications : clear the old one and create a new one + if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) + { + gInventory.removeObserver(mCategoriesObserver); + delete mCategoriesObserver; + } + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMerchantItems::onChanged, this)); + llassert(mCategoriesObserver); + + // Set up the merchant items inventory view + LLInventoryPanel* inventory_panel = mInventoryPanel.get(); + if (inventory_panel) + { + delete inventory_panel; + } + inventory_panel = LLUICtrlFactory::createFromFile("panel_merchant_items_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + mInventoryPanel = inventory_panel->getInventoryPanelHandle(); + llassert(mInventoryPanel.get() != NULL); + + // Reshape the inventory to the proper size + LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); + inventory_panel->setShape(inventory_placeholder_rect); + + // Set the sort order newest to oldest + inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + inventory_panel->getFilter().markDefault(); + + // Get the content of the merchant items folder + fetchContents(); +} + +void LLFloaterMerchantItems::initializeMarketPlace() +{ + // *TODO : What do we need to do really once the merchant items folder has been created? + // + // Initialize the marketplace import API + // + //LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); + + //if (!importer.isInitialized()) + //{ + //importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2)); + //importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1)); + //importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); + //importer.initialize(); + //} +} + +S32 LLFloaterMerchantItems::getFolderCount() +{ + if (mInventoryPanel.get() && mRootFolderId.notNull()) + { + LLInventoryModel::cat_array_t * cats; + LLInventoryModel::item_array_t * items; + gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); + + return (cats->count() + items->count()); + } + else + { + return 0; + } +} + +void LLFloaterMerchantItems::updateView() +{ + LLInventoryPanel* panel = mInventoryPanel.get(); + + if (getFolderCount() > 0) + { + panel->setVisible(TRUE); + mInventoryPlaceholder->setVisible(FALSE); + mTopLevelDropZone->setVisible(TRUE); + } + else + { + if (panel) + { + panel->setVisible(FALSE); + } + + // Show the drop zone if there is an outbox folder + mTopLevelDropZone->setVisible(mRootFolderId.notNull()); + + std::string text; + std::string title; + std::string tooltip; + + const LLSD& subs = getMarketplaceStringSubstitutions(); + U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus(); + + // *TODO : check those messages and create better appropriate ones in strings.xml + if (mRootFolderId.notNull()) + { + // Does the outbox needs recreation? + if ((panel == NULL) || !gInventory.getCategory(mRootFolderId)) + { + setup(); + } + // "Merchant items is empty!" message strings + text = LLTrans::getString("InventoryMerchantItemsNoItems", subs); + title = LLTrans::getString("InventoryMerchantItemsNoItemsTitle"); + tooltip = LLTrans::getString("InventoryMerchantItemsNoItemsTooltip"); + } + else if (mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) + { + // "Initializing!" message strings + text = LLTrans::getString("InventoryOutboxInitializing", subs); + title = LLTrans::getString("InventoryOutboxInitializingTitle"); + tooltip = LLTrans::getString("InventoryOutboxInitializingTooltip"); + } + else if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT) + { + // "Not a merchant!" message strings + text = LLTrans::getString("InventoryOutboxNotMerchant", subs); + title = LLTrans::getString("InventoryOutboxNotMerchantTitle"); + tooltip = LLTrans::getString("InventoryOutboxNotMerchantTooltip"); + } + else + { + // "Errors!" message strings + text = LLTrans::getString("InventoryOutboxError", subs); + title = LLTrans::getString("InventoryOutboxErrorTitle"); + tooltip = LLTrans::getString("InventoryOutboxErrorTooltip"); + } + + mInventoryText->setValue(text); + mInventoryTitle->setValue(title); + mInventoryPlaceholder->getParent()->setToolTip(tooltip); + } +} + +bool LLFloaterMerchantItems::isAccepted(EAcceptance accept) +{ + // *TODO : Need a bit more test on what we accept: depends of what and where... + return (accept >= ACCEPT_YES_COPY_SINGLE); +} + + +BOOL LLFloaterMerchantItems::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + if ((mInventoryPanel.get() == NULL) || + mRootFolderId.isNull()) + { + return FALSE; + } + + LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + BOOL handled = (handled_view != NULL); + + // 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()) + { + S32 inv_x, inv_y; + localPointToOtherView(x, y, &inv_x, &inv_y, panel); + + pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y); + + LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true); + pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder); + } + + // Pass all drag and drop for this floater to the outbox inventory control + if (!handled || !isAccepted(*accept)) + { + // Handle the drag and drop directly to the root of the outbox if we're not in the inventory panel + // (otherwise the inventory panel itself will handle the drag and drop operation, without any override) + if (!pointInInventoryPanel) + { + handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + } + + mTopLevelDropZone->setBackgroundVisible(handled && !drop && isAccepted(*accept)); + } + else + { + mTopLevelDropZone->setBackgroundVisible(!pointInInventoryPanelChild); + } + + return handled; +} + +BOOL LLFloaterMerchantItems::handleHover(S32 x, S32 y, MASK mask) +{ + mTopLevelDropZone->setBackgroundVisible(FALSE); + + return LLFloater::handleHover(x, y, mask); +} + +void LLFloaterMerchantItems::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mTopLevelDropZone->setBackgroundVisible(FALSE); + + LLFloater::onMouseLeave(x, y, mask); +} + +void LLFloaterMerchantItems::onChanged() +{ + LLViewerInventoryCategory* category = gInventory.getCategory(mRootFolderId); + if (mRootFolderId.notNull() && category) + { + fetchContents(); + updateView(); + } + else + { + clean(); + } +} -- cgit v1.3 From 93da0cea6294c354614cd2c4e7b4a49b7e08cd6f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 6 Mar 2014 19:12:25 -0800 Subject: DD-7 : Initialize the Merchant Items floater checking the is a Merchant status correctly. No indication it's initializing (UI) but the code works --- indra/newview/llfloateroutbox.cpp | 61 +++++++++++++++++++++++++++++++++------ indra/newview/llfloateroutbox.h | 4 +++ 2 files changed, 56 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 5ed72e4250..c5ece0ccd6 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -826,19 +826,18 @@ void LLFloaterMerchantItems::setup() void LLFloaterMerchantItems::initializeMarketPlace() { - // *TODO : What do we need to do really once the merchant items folder has been created? // // Initialize the marketplace import API // - //LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); + LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); - //if (!importer.isInitialized()) - //{ - //importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2)); - //importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1)); - //importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); - //importer.initialize(); - //} + if (!importer.isInitialized()) + { + importer.setInitializationErrorCallback(boost::bind(&LLFloaterMerchantItems::initializationReportError, this, _1, _2)); + importer.setStatusChangedCallback(boost::bind(&LLFloaterMerchantItems::importStatusChanged, this, _1)); + importer.setStatusReportCallback(boost::bind(&LLFloaterMerchantItems::importReportResults, this, _1, _2)); + importer.initialize(); + } } S32 LLFloaterMerchantItems::getFolderCount() @@ -1010,3 +1009,47 @@ void LLFloaterMerchantItems::onChanged() clean(); } } + +void LLFloaterMerchantItems::initializationReportError(U32 status, const LLSD& content) +{ + updateView(); +} + +void LLFloaterMerchantItems::importStatusChanged(bool inProgress) +{ + if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)) + { + setup(); + } + /* + if (inProgress) + { + if (mImportBusy) + { + setStatusString(getString("OutboxImporting")); + } + else + { + setStatusString(getString("OutboxInitializing")); + } + + mImportBusy = true; + mInventoryImportInProgress->setVisible(true); + } + else + { + setStatusString(""); + mImportBusy = false; + mInventoryImportInProgress->setVisible(false); + } + */ + + updateView(); +} + +void LLFloaterMerchantItems::importReportResults(U32 status, const LLSD& content) +{ + updateView(); +} + + diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index b63faa860b..1b1e1e0439 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -144,6 +144,10 @@ protected: void clean(); void fetchContents(); + void importReportResults(U32 status, const LLSD& content); + void importStatusChanged(bool inProgress); + void initializationReportError(U32 status, const LLSD& content); + void onClose(bool app_quitting); void onOpen(const LLSD& key); void onFocusReceived(); -- cgit v1.3 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(+) (limited to 'indra/newview/llfloateroutbox.cpp') 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.3 From 9de02b0cd3ac05ce172e12dbc2d288a5deccba11 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 10 Mar 2014 18:49:40 -0700 Subject: DD-17 : WIP : some work on the suffix for Listing folders --- indra/newview/llfloateroutbox.cpp | 22 +++++++++---------- indra/newview/llinventorybridge.cpp | 44 +++++++++++++++++++++++++++++++++++++ indra/newview/llinventorybridge.h | 3 ++- 3 files changed, 57 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 86387c548a..8f4daa83f9 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -732,23 +732,13 @@ void LLFloaterMerchantItems::onOpen(const LLSD& key) setup(); } - // - // Update the floater view - // - updateView(); - - // - // 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++) { @@ -761,6 +751,16 @@ void LLFloaterMerchantItems::onOpen(const LLSD& key) LLMarketplaceData::instance().setActivation(category->getUUID(),(index%3 == 0)); } } + + // + // Update the floater view + // + updateView(); + + // + // Trigger fetch of the contents + // + fetchContents(); } void LLFloaterMerchantItems::onFocusReceived() diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 44943d8722..c2f6ce8fb1 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -959,6 +959,18 @@ BOOL LLInvFVBridge::isInboxFolder() const return gInventory.isObjectDescendentOf(mUUID, inbox_id); } +BOOL LLInvFVBridge::isMerchantItemsFolder() const +{ + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MERCHANT_ITEMS, false); + + if (folder_id.isNull()) + { + return FALSE; + } + + return gInventory.isObjectDescendentOf(mUUID, folder_id); +} + BOOL LLInvFVBridge::isOutboxFolder() const { const LLUUID outbox_id = getOutboxFolder(); @@ -1931,6 +1943,38 @@ void LLFolderBridge::buildDisplayName() const } } +std::string LLFolderBridge::getLabelSuffix() const +{ + /* + + LLInventoryCategory* cat = gInventory.getCategory(getUUID()); + if(cat) + { + const LLUUID& parent_folder_id = cat->getParentUUID(); + accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); + } + */ + if (isMerchantItemsFolder()) + { + if (LLMarketplaceData::instance().isListed(getUUID())) + { + llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; + std::string suffix = " (" + LLMarketplaceData::instance().getListingID(getUUID()) + ")"; + return LLInvFVBridge::getLabelSuffix() + suffix; + } + else + { + llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; + return LLInvFVBridge::getLabelSuffix(); + } + } + else + { + llinfos << "Merov : not in merchant folder : id = " << getUUID() << llendl; + return LLInvFVBridge::getLabelSuffix(); + } +} + void LLFolderBridge::update() { diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index bc875e8f37..199a46d275 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -160,6 +160,7 @@ protected: BOOL isInboxFolder() const; // true if COF or descendant of marketplace inbox BOOL isOutboxFolder() const; // true if COF or descendant of marketplace outbox BOOL isOutboxFolderDirectParent() const; + BOOL isMerchantItemsFolder() const; // true if descendant of Merchant items folder const LLUUID getOutboxFolder() const; virtual BOOL isItemPermissive() const; @@ -274,7 +275,7 @@ public: virtual LLUIImagePtr getIcon() const; virtual LLUIImagePtr getIconOpen() const; virtual LLUIImagePtr getIconOverlay() const; - + virtual std::string getLabelSuffix() const; static LLUIImagePtr getIcon(LLFolderType::EType preferred_type); virtual BOOL renameItem(const std::string& new_name); -- cgit v1.3 From 705d4182c8a84728e7f00cf48110c8f9720e4c29 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 13 Mar 2014 16:45:52 -0700 Subject: DD-42 : Rename merchant items to marketplace listings to be consistent with spec --- indra/llcommon/llfoldertype.cpp | 2 +- indra/llcommon/llfoldertype.h | 2 +- indra/newview/llfloateroutbox.cpp | 114 +++++++++---------- indra/newview/llfloateroutbox.h | 12 +- indra/newview/llinventorybridge.cpp | 6 +- indra/newview/llinventorybridge.h | 2 +- indra/newview/llinventorypanel.cpp | 4 +- indra/newview/llviewerfloaterreg.cpp | 2 +- indra/newview/llviewerfoldertype.cpp | 2 +- .../xui/en/floater_marketplace_listings.xml | 121 +++++++++++++++++++++ .../default/xui/en/floater_merchant_items.xml | 121 --------------------- indra/newview/skins/default/xui/en/menu_viewer.xml | 6 +- .../en/panel_marketplace_listings_inventory.xml | 32 ++++++ .../xui/en/panel_merchant_items_inventory.xml | 32 ------ indra/newview/skins/default/xui/en/strings.xml | 6 +- 15 files changed, 232 insertions(+), 232 deletions(-) create mode 100755 indra/newview/skins/default/xui/en/floater_marketplace_listings.xml delete mode 100755 indra/newview/skins/default/xui/en/floater_merchant_items.xml create mode 100755 indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml delete mode 100755 indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp index 64bc17c422..5b80189d2a 100755 --- a/indra/llcommon/llfoldertype.cpp +++ b/indra/llcommon/llfoldertype.cpp @@ -97,7 +97,7 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); - addEntry(LLFolderType::FT_MERCHANT_ITEMS, new FolderEntry("merchant", FALSE)); + addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new FolderEntry("merchant", FALSE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index 81f9c0b678..91dc1da543 100644 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -87,7 +87,7 @@ public: FT_BASIC_ROOT = 52, - FT_MERCHANT_ITEMS = 53, + FT_MARKETPLACE_LISTINGS = 53, FT_COUNT, diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 8f4daa83f9..2ed4605e0c 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -1,8 +1,8 @@ /** * @file llfloateroutbox.cpp - * @brief Implementation of the merchant outbox window and of the merchant items window + * @brief Implementation of the merchant outbox window and of the marketplace listings window * - * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermerchantitems + * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermarketplacelistings * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -107,15 +107,15 @@ private: }; ///---------------------------------------------------------------------------- -/// LLMerchantItemsAddedObserver helper class +/// LLMarketplaceListingsAddedObserver helper class ///---------------------------------------------------------------------------- -class LLMerchantItemsAddedObserver : public LLInventoryCategoryAddedObserver +class LLMarketplaceListingsAddedObserver : public LLInventoryCategoryAddedObserver { public: - LLMerchantItemsAddedObserver(LLFloaterMerchantItems * merchant_items_floater) + LLMarketplaceListingsAddedObserver(LLFloaterMarketplaceListings * marketplace_listings_floater) : LLInventoryCategoryAddedObserver() - , mMerchantItemsFloater(merchant_items_floater) + , mMarketplaceListingsFloater(marketplace_listings_floater) { } @@ -127,15 +127,15 @@ public: LLFolderType::EType added_category_type = added_category->getPreferredType(); - if (added_category_type == LLFolderType::FT_MERCHANT_ITEMS) + if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS) { - mMerchantItemsFloater->initializeMarketPlace(); + mMarketplaceListingsFloater->initializeMarketPlace(); } } } private: - LLFloaterMerchantItems * mMerchantItemsFloater; + LLFloaterMarketplaceListings * mMarketplaceListingsFloater; }; @@ -653,10 +653,10 @@ void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification) } ///---------------------------------------------------------------------------- -/// LLFloaterMerchantItems +/// LLFloaterMarketplaceListings ///---------------------------------------------------------------------------- -LLFloaterMerchantItems::LLFloaterMerchantItems(const LLSD& key) +LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) : LLFloater(key) , mCategoriesObserver(NULL) , mCategoryAddedObserver(NULL) @@ -668,7 +668,7 @@ LLFloaterMerchantItems::LLFloaterMerchantItems(const LLSD& key) { } -LLFloaterMerchantItems::~LLFloaterMerchantItems() +LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() { if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { @@ -683,18 +683,18 @@ LLFloaterMerchantItems::~LLFloaterMerchantItems() delete mCategoryAddedObserver; } -BOOL LLFloaterMerchantItems::postBuild() +BOOL LLFloaterMarketplaceListings::postBuild() { - mInventoryPlaceholder = getChild("merchant_items_inventory_placeholder_panel"); - mInventoryText = mInventoryPlaceholder->getChild("merchant_items_inventory_placeholder_text"); - mInventoryTitle = mInventoryPlaceholder->getChild("merchant_items_inventory_placeholder_title"); + mInventoryPlaceholder = getChild("marketplace_listings_inventory_placeholder_panel"); + mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); + mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); - mTopLevelDropZone = getChild("merchant_items_generic_drag_target"); + mTopLevelDropZone = getChild("marketplace_listings_generic_drag_target"); - LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMerchantItems::onFocusReceived, this)); + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this)); - // Observe category creation to catch merchant items creation (moot if already existing) - mCategoryAddedObserver = new LLMerchantItemsAddedObserver(this); + // Observe category creation to catch marketplace listings creation (moot if already existing) + mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(this); gInventory.addObserver(mCategoryAddedObserver); // Merov : Debug : fetch aggressively so we can create test data right onOpen() @@ -704,7 +704,7 @@ BOOL LLFloaterMerchantItems::postBuild() return TRUE; } -void LLFloaterMerchantItems::clean() +void LLFloaterMarketplaceListings::clean() { // Note: we cannot delete the mOutboxInventoryPanel as that point // as this is called through callback observers of the panel itself. @@ -714,11 +714,11 @@ void LLFloaterMerchantItems::clean() mRootFolderId.setNull(); } -void LLFloaterMerchantItems::onClose(bool app_quitting) +void LLFloaterMarketplaceListings::onClose(bool app_quitting) { } -void LLFloaterMerchantItems::onOpen(const LLSD& key) +void LLFloaterMarketplaceListings::onOpen(const LLSD& key) { // // Initialize the Market Place or go update the outbox @@ -763,12 +763,12 @@ void LLFloaterMerchantItems::onOpen(const LLSD& key) fetchContents(); } -void LLFloaterMerchantItems::onFocusReceived() +void LLFloaterMarketplaceListings::onFocusReceived() { fetchContents(); } -void LLFloaterMerchantItems::fetchContents() +void LLFloaterMarketplaceListings::fetchContents() { if (mRootFolderId.notNull()) { @@ -776,7 +776,7 @@ void LLFloaterMerchantItems::fetchContents() } } -void LLFloaterMerchantItems::setup() +void LLFloaterMarketplaceListings::setup() { if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) { @@ -784,24 +784,24 @@ void LLFloaterMerchantItems::setup() return; } - // We are a merchant. Get the Merchant items folder, create it if needs be. - LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MERCHANT_ITEMS, true); + // We are a merchant. Get the Marketplace listings folder, create it if needs be. + LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true); if (outbox_id.isNull()) { // We should never get there unless the inventory fails badly - llinfos << "Merov : Inventory problem: failure to create the merchant items folder for a merchant!" << llendl; - llerrs << "Inventory problem: failure to create the merchant items folder for a merchant!" << llendl; + llinfos << "Merov : Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; + llerrs << "Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; return; } - // Consolidate Merchant items + // Consolidate Marketplace listings // We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually - gInventory.consolidateForType(outbox_id, LLFolderType::FT_MERCHANT_ITEMS); + gInventory.consolidateForType(outbox_id, LLFolderType::FT_MARKETPLACE_LISTINGS); if (outbox_id == mRootFolderId) { - llinfos << "Merov : Inventory warning: Merchant items folder already set" << llendl; - llwarns << "Inventory warning: Merchant items folder already set" << llendl; + llinfos << "Merov : Inventory warning: Marketplace listings folder already set" << llendl; + llwarns << "Inventory warning: Marketplace listings folder already set" << llendl; return; } mRootFolderId = outbox_id; @@ -815,7 +815,7 @@ void LLFloaterMerchantItems::setup() } llassert(!mCategoryAddedObserver); - // Create observer for merchant items modifications : clear the old one and create a new one + // Create observer for marketplace listings modifications : clear the old one and create a new one if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -823,16 +823,16 @@ void LLFloaterMerchantItems::setup() } mCategoriesObserver = new LLInventoryCategoriesObserver(); gInventory.addObserver(mCategoriesObserver); - mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMerchantItems::onChanged, this)); + mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this)); llassert(mCategoriesObserver); - // Set up the merchant items inventory view + // Set up the marketplace listings inventory view LLInventoryPanel* inventory_panel = mInventoryPanel.get(); if (inventory_panel) { delete inventory_panel; } - inventory_panel = LLUICtrlFactory::createFromFile("panel_merchant_items_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); mInventoryPanel = inventory_panel->getInventoryPanelHandle(); llassert(mInventoryPanel.get() != NULL); @@ -844,11 +844,11 @@ void LLFloaterMerchantItems::setup() inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); inventory_panel->getFilter().markDefault(); - // Get the content of the merchant items folder + // Get the content of the marketplace listings folder fetchContents(); } -void LLFloaterMerchantItems::initializeMarketPlace() +void LLFloaterMarketplaceListings::initializeMarketPlace() { // // Initialize the marketplace import API @@ -857,14 +857,14 @@ void LLFloaterMerchantItems::initializeMarketPlace() if (!importer.isInitialized()) { - importer.setInitializationErrorCallback(boost::bind(&LLFloaterMerchantItems::initializationReportError, this, _1, _2)); - importer.setStatusChangedCallback(boost::bind(&LLFloaterMerchantItems::importStatusChanged, this, _1)); - importer.setStatusReportCallback(boost::bind(&LLFloaterMerchantItems::importReportResults, this, _1, _2)); + 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(); } } -S32 LLFloaterMerchantItems::getFolderCount() +S32 LLFloaterMarketplaceListings::getFolderCount() { if (mInventoryPanel.get() && mRootFolderId.notNull()) { @@ -880,7 +880,7 @@ S32 LLFloaterMerchantItems::getFolderCount() } } -void LLFloaterMerchantItems::updateView() +void LLFloaterMarketplaceListings::updateView() { LLInventoryPanel* panel = mInventoryPanel.get(); @@ -915,10 +915,10 @@ void LLFloaterMerchantItems::updateView() { setup(); } - // "Merchant items is empty!" message strings - text = LLTrans::getString("InventoryMerchantItemsNoItems", subs); - title = LLTrans::getString("InventoryMerchantItemsNoItemsTitle"); - tooltip = LLTrans::getString("InventoryMerchantItemsNoItemsTooltip"); + // "Marketplace listings is empty!" message strings + text = LLTrans::getString("InventoryMarketplaceListingsNoItems", subs); + title = LLTrans::getString("InventoryMarketplaceListingsNoItemsTitle"); + tooltip = LLTrans::getString("InventoryMarketplaceListingsNoItemsTooltip"); } else if (mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) { @@ -948,14 +948,14 @@ void LLFloaterMerchantItems::updateView() } } -bool LLFloaterMerchantItems::isAccepted(EAcceptance accept) +bool LLFloaterMarketplaceListings::isAccepted(EAcceptance accept) { // *TODO : Need a bit more test on what we accept: depends of what and where... return (accept >= ACCEPT_YES_COPY_SINGLE); } -BOOL LLFloaterMerchantItems::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -1006,21 +1006,21 @@ BOOL LLFloaterMerchantItems::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro return handled; } -BOOL LLFloaterMerchantItems::handleHover(S32 x, S32 y, MASK mask) +BOOL LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask) { mTopLevelDropZone->setBackgroundVisible(FALSE); return LLFloater::handleHover(x, y, mask); } -void LLFloaterMerchantItems::onMouseLeave(S32 x, S32 y, MASK mask) +void LLFloaterMarketplaceListings::onMouseLeave(S32 x, S32 y, MASK mask) { mTopLevelDropZone->setBackgroundVisible(FALSE); LLFloater::onMouseLeave(x, y, mask); } -void LLFloaterMerchantItems::onChanged() +void LLFloaterMarketplaceListings::onChanged() { LLViewerInventoryCategory* category = gInventory.getCategory(mRootFolderId); if (mRootFolderId.notNull() && category) @@ -1034,12 +1034,12 @@ void LLFloaterMerchantItems::onChanged() } } -void LLFloaterMerchantItems::initializationReportError(U32 status, const LLSD& content) +void LLFloaterMarketplaceListings::initializationReportError(U32 status, const LLSD& content) { updateView(); } -void LLFloaterMerchantItems::importStatusChanged(bool inProgress) +void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress) { if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)) { @@ -1071,7 +1071,7 @@ void LLFloaterMerchantItems::importStatusChanged(bool inProgress) updateView(); } -void LLFloaterMerchantItems::importReportResults(U32 status, const LLSD& content) +void LLFloaterMarketplaceListings::importReportResults(U32 status, const LLSD& content) { updateView(); } diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 1b1e1e0439..e28fb320ea 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -1,8 +1,8 @@ /** * @file llfloateroutbox.h - * @brief Implementation of the merchant outbox window and of the merchant items window + * @brief Implementation of the merchant outbox window and of the marketplace listings window * - * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermerchantitems + * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermarketplacelistings * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -115,14 +115,14 @@ private: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFloaterMerchantItems +// Class LLFloaterMarketplaceListings //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFloaterMerchantItems : public LLFloater +class LLFloaterMarketplaceListings : public LLFloater { public: - LLFloaterMerchantItems(const LLSD& key); - ~LLFloaterMerchantItems(); + LLFloaterMarketplaceListings(const LLSD& key); + ~LLFloaterMarketplaceListings(); void initializeMarketPlace(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c2f6ce8fb1..9d9279ce90 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -959,9 +959,9 @@ BOOL LLInvFVBridge::isInboxFolder() const return gInventory.isObjectDescendentOf(mUUID, inbox_id); } -BOOL LLInvFVBridge::isMerchantItemsFolder() const +BOOL LLInvFVBridge::isMarketplaceListingsFolder() const { - const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MERCHANT_ITEMS, false); + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (folder_id.isNull()) { @@ -1954,7 +1954,7 @@ std::string LLFolderBridge::getLabelSuffix() const accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); } */ - if (isMerchantItemsFolder()) + if (isMarketplaceListingsFolder()) { if (LLMarketplaceData::instance().isListed(getUUID())) { diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 199a46d275..d9533b537c 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -160,7 +160,7 @@ protected: BOOL isInboxFolder() const; // true if COF or descendant of marketplace inbox BOOL isOutboxFolder() const; // true if COF or descendant of marketplace outbox BOOL isOutboxFolderDirectParent() const; - BOOL isMerchantItemsFolder() const; // true if descendant of Merchant items folder + BOOL isMarketplaceListingsFolder() const; // true if descendant of Marketplace listings folder const LLUUID getOutboxFolder() const; virtual BOOL isItemPermissive() const; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index c1607fbbc0..bf8f7819ef 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -288,7 +288,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX)); getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_OUTBOX)); - getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_MERCHANT_ITEMS)); + getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_MARKETPLACE_LISTINGS)); } // set the filter for the empty folder if the debug setting is on @@ -1490,6 +1490,6 @@ namespace LLInitParam declare(LLFolderType::lookup(LLFolderType::FT_INBOX) , LLFolderType::FT_INBOX); declare(LLFolderType::lookup(LLFolderType::FT_OUTBOX) , LLFolderType::FT_OUTBOX); declare(LLFolderType::lookup(LLFolderType::FT_BASIC_ROOT) , LLFolderType::FT_BASIC_ROOT); - declare(LLFolderType::lookup(LLFolderType::FT_MERCHANT_ITEMS) , LLFolderType::FT_MERCHANT_ITEMS); + declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_LISTINGS) , LLFolderType::FT_MARKETPLACE_LISTINGS); } } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index f55de790d8..853d98693b 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -243,7 +243,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("tex_fetch_debugger", "floater_texture_fetch_debugger.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); } LLFloaterReg::add("media_settings", "floater_media_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("merchant_items", "floater_merchant_items.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index 413814cec0..ee8f85782f 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -141,7 +141,7 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); - addEntry(LLFolderType::FT_MERCHANT_ITEMS, new ViewerFolderEntry("Merchant items", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); + addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace listings", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); diff --git a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml new file mode 100755 index 0000000000..94a9466c16 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -0,0 +1,121 @@ + + + + + + + Loading... + + + + + + + + Drag items you want to sell + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_merchant_items.xml b/indra/newview/skins/default/xui/en/floater_merchant_items.xml deleted file mode 100755 index 2e54ed2ce3..0000000000 --- a/indra/newview/skins/default/xui/en/floater_merchant_items.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - Loading... - - - - - - - - Drag items you want to sell - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 2dc974eff1..a8e02a9d02 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -182,11 +182,11 @@ parameter="outbox" /> + label="Marketplace listings..." + name="MarketplaceListings"> + parameter="marketplace_listings" /> + + + + diff --git a/indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml b/indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml deleted file mode 100755 index a013516267..0000000000 --- a/indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 515e912ee5..387ad138d9 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2219,9 +2219,9 @@ We are accessing your account on the [[MARKETPLACE_CREATE_STORE_URL] Marketplace The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. - Your Merchant Items folder is empty. - - + Your Marketplace Listings folder is empty. + + Drag folders to this area to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace]. -- cgit v1.3 From 68dbb5692f11eed39175ebf3313d96b5430231f9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 14 Mar 2014 17:34:15 -0700 Subject: DD-17 : WIP : Add live status to active listing folders, clean up getLabelSuffix() code a bit --- indra/newview/llfloateroutbox.cpp | 11 +++++++---- indra/newview/llinventorybridge.cpp | 12 ++++++++++-- indra/newview/skins/default/xui/en/strings.xml | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 2ed4605e0c..d9bc3a1ce0 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -743,12 +743,15 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key) 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) + if (index%3) { - LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); + LLMarketplaceData::instance().addTestItem(category->getUUID()); + if (index%3 == 1) + { + LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); + } + LLMarketplaceData::instance().setActivation(category->getUUID(),(index%2)); } - LLMarketplaceData::instance().setActivation(category->getUUID(),(index%3 == 0)); } } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9d9279ce90..38dcb24477 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1959,7 +1959,16 @@ std::string LLFolderBridge::getLabelSuffix() const if (LLMarketplaceData::instance().isListed(getUUID())) { llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; - std::string suffix = " (" + LLMarketplaceData::instance().getListingID(getUUID()) + ")"; + std::string suffix = LLMarketplaceData::instance().getListingID(getUUID()); + if (suffix.empty()) + { + suffix = LLTrans::getString("MarketplaceNoID"); + } + suffix = " (" + suffix + ")"; + if (LLMarketplaceData::instance().getActivationState(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; + } return LLInvFVBridge::getLabelSuffix() + suffix; } else @@ -1970,7 +1979,6 @@ std::string LLFolderBridge::getLabelSuffix() const } else { - llinfos << "Merov : not in merchant folder : id = " << getUUID() << llendl; return LLInvFVBridge::getLabelSuffix(); } } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 387ad138d9..1d3c112495 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2235,6 +2235,9 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. Error: This item can not be sold on the marketplace. Error: There was a problem with this item. Try again later. + no Mkt ID + live + Open landmarks -- cgit v1.3 From 28fe8352549c0fd99da0c3f0119d96386e52a703 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 18 Mar 2014 13:03:04 -0700 Subject: DD-17, DD-40 : Style active listings in bold, implement a working initialization indicator --- indra/newview/llfloateroutbox.cpp | 28 ++++++++++------------ indra/newview/llfloateroutbox.h | 3 +++ indra/newview/llinventorybridge.cpp | 14 ++++++++++- indra/newview/llinventorybridge.h | 1 + .../xui/en/floater_marketplace_listings.xml | 16 ++++++++++++- 5 files changed, 45 insertions(+), 17 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index d9bc3a1ce0..281e9124e7 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -661,6 +661,8 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) , mCategoriesObserver(NULL) , mCategoryAddedObserver(NULL) , mRootFolderId(LLUUID::null) +, mInventoryStatus(NULL) +, mInventoryInitializationInProgress(NULL) , mInventoryPlaceholder(NULL) , mInventoryText(NULL) , mInventoryTitle(NULL) @@ -685,6 +687,8 @@ LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() BOOL LLFloaterMarketplaceListings::postBuild() { + mInventoryStatus = getChild("marketplace_status"); + mInventoryInitializationInProgress = getChild("initialization_progress_indicator"); mInventoryPlaceholder = getChild("marketplace_listings_inventory_placeholder_panel"); mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); @@ -883,6 +887,11 @@ S32 LLFloaterMarketplaceListings::getFolderCount() } } +void LLFloaterMarketplaceListings::setStatusString(const std::string& statusString) +{ + mInventoryStatus->setText(statusString); +} + void LLFloaterMarketplaceListings::updateView() { LLInventoryPanel* panel = mInventoryPanel.get(); @@ -1048,28 +1057,17 @@ void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress) { setup(); } - /* + if (inProgress) { - if (mImportBusy) - { - setStatusString(getString("OutboxImporting")); - } - else - { - setStatusString(getString("OutboxInitializing")); - } - - mImportBusy = true; - mInventoryImportInProgress->setVisible(true); + setStatusString(getString("MarketplaceListingsInitializing")); + mInventoryInitializationInProgress->setVisible(true); } else { setStatusString(""); - mImportBusy = false; - mInventoryImportInProgress->setVisible(false); + mInventoryInitializationInProgress->setVisible(false); } - */ updateView(); } diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index e28fb320ea..04a9f91f51 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -147,6 +147,7 @@ protected: 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); void onOpen(const LLSD& key); @@ -163,6 +164,8 @@ private: LLInventoryCategoriesObserver * mCategoriesObserver; LLInventoryCategoryAddedObserver * mCategoryAddedObserver; + LLTextBox * mInventoryStatus; + LLView * mInventoryInitializationInProgress; LLView * mInventoryPlaceholder; LLTextBox * mInventoryText; LLTextBox * mInventoryTitle; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 38dcb24477..3d418105e3 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1945,8 +1945,8 @@ void LLFolderBridge::buildDisplayName() const std::string LLFolderBridge::getLabelSuffix() const { + // *TODO : We need to display some suffix also for the version folder! /* - LLInventoryCategory* cat = gInventory.getCategory(getUUID()); if(cat) { @@ -1983,6 +1983,18 @@ std::string LLFolderBridge::getLabelSuffix() const } } +LLFontGL::StyleFlags LLFolderBridge::getLabelStyle() const +{ + if (isMarketplaceListingsFolder() && LLMarketplaceData::instance().getActivationState(getUUID())) + { + return LLFontGL::BOLD; + } + else + { + return LLFontGL::NORMAL; + } +} + void LLFolderBridge::update() { diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index d9533b537c..26c48fdc57 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -276,6 +276,7 @@ public: virtual LLUIImagePtr getIconOpen() const; virtual LLUIImagePtr getIconOverlay() const; virtual std::string getLabelSuffix() const; + virtual LLFontGL::StyleFlags getLabelStyle() const; static LLUIImagePtr getIcon(LLFolderType::EType preferred_type); virtual BOOL renameItem(const std::string& new_name); 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 94a9466c16..b212518f85 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -13,6 +13,7 @@ reuse_instance="true" title="MARKETPLACE LISTINGS" width="333"> + Initializing... + - + -- cgit v1.3 From e08296f6dc44c1b18b1ca36a0ee7dc2f8578d84b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 18 Mar 2014 15:14:09 -0700 Subject: DD-40 : WIP : Got rid o the useless Drop Target text (not part of that UI) --- indra/newview/llfloateroutbox.cpp | 17 --------- indra/newview/llfloateroutbox.h | 1 - .../xui/en/floater_marketplace_listings.xml | 40 ++++------------------ 3 files changed, 6 insertions(+), 52 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 281e9124e7..a1661a2a94 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -666,7 +666,6 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) , mInventoryPlaceholder(NULL) , mInventoryText(NULL) , mInventoryTitle(NULL) -, mTopLevelDropZone(NULL) { } @@ -693,8 +692,6 @@ BOOL LLFloaterMarketplaceListings::postBuild() mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); - mTopLevelDropZone = getChild("marketplace_listings_generic_drag_target"); - LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this)); // Observe category creation to catch marketplace listings creation (moot if already existing) @@ -900,7 +897,6 @@ void LLFloaterMarketplaceListings::updateView() { panel->setVisible(TRUE); mInventoryPlaceholder->setVisible(FALSE); - mTopLevelDropZone->setVisible(TRUE); } else { @@ -909,9 +905,6 @@ void LLFloaterMarketplaceListings::updateView() panel->setVisible(FALSE); } - // Show the drop zone if there is an outbox folder - mTopLevelDropZone->setVisible(mRootFolderId.notNull()); - std::string text; std::string title; std::string tooltip; @@ -1007,12 +1000,6 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO { handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } - - mTopLevelDropZone->setBackgroundVisible(handled && !drop && isAccepted(*accept)); - } - else - { - mTopLevelDropZone->setBackgroundVisible(!pointInInventoryPanelChild); } return handled; @@ -1020,15 +1007,11 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO BOOL LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask) { - mTopLevelDropZone->setBackgroundVisible(FALSE); - return LLFloater::handleHover(x, y, mask); } void LLFloaterMarketplaceListings::onMouseLeave(S32 x, S32 y, MASK mask) { - mTopLevelDropZone->setBackgroundVisible(FALSE); - LLFloater::onMouseLeave(x, y, mask); } diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 04a9f91f51..eba3e4217b 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -172,7 +172,6 @@ private: LLUUID mRootFolderId; LLHandle mInventoryPanel; - LLPanel * mTopLevelDropZone; }; #endif // LL_LLFLOATEROUTBOX_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 b212518f85..625b71645e 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -66,40 +66,12 @@ - - - Drag items you want to sell - - - + Date: Tue, 18 Mar 2014 16:36:50 -0700 Subject: DD-50 : WIP : Add tabs to the marketplace listing UI --- indra/newview/llfloateroutbox.cpp | 21 +-- .../en/panel_marketplace_listings_inventory.xml | 151 ++++++++++++++++----- 2 files changed, 132 insertions(+), 40 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index a1661a2a94..92c120a0b6 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -831,13 +831,16 @@ void LLFloaterMarketplaceListings::setup() llassert(mCategoriesObserver); // Set up the marketplace listings inventory view - LLInventoryPanel* inventory_panel = mInventoryPanel.get(); - if (inventory_panel) - { - delete inventory_panel; - } - inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); - mInventoryPanel = inventory_panel->getInventoryPanelHandle(); +// LLInventoryPanel* inventory_panel = mInventoryPanel.get(); +// if (inventory_panel) +// { +// delete inventory_panel; +// } +// inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); +// mInventoryPanel = inventory_panel->getInventoryPanelHandle(); + LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + LLInventoryPanel* all_items_panel = inventory_panel->getChild("All Items"); + mInventoryPanel = all_items_panel->getInventoryPanelHandle(); llassert(mInventoryPanel.get() != NULL); // Reshape the inventory to the proper size @@ -845,8 +848,8 @@ void LLFloaterMarketplaceListings::setup() inventory_panel->setShape(inventory_placeholder_rect); // Set the sort order newest to oldest - inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - inventory_panel->getFilter().markDefault(); + all_items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + all_items_panel->getFilter().markDefault(); // Get the content of the marketplace listings folder fetchContents(); diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml index dcb634fe59..33ac08d87f 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml @@ -1,32 +1,121 @@ - - - - + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.3 From 03622e0833fd2d2bdcc9ed3ed0c009ad9e9fee3e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 20 Mar 2014 09:31:35 -0700 Subject: DD-50 : Adding new filter code for marketplace filtered tabs (active, unactive and unassociated) --- indra/newview/llfloateroutbox.cpp | 32 +++++++----- indra/newview/llinventoryfilter.cpp | 58 ++++++++++++++++++++++ indra/newview/llinventoryfilter.h | 8 ++- .../en/panel_marketplace_listings_inventory.xml | 2 +- 4 files changed, 85 insertions(+), 15 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 92c120a0b6..d6da0ad971 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -831,16 +831,9 @@ void LLFloaterMarketplaceListings::setup() llassert(mCategoriesObserver); // Set up the marketplace listings inventory view -// LLInventoryPanel* inventory_panel = mInventoryPanel.get(); -// if (inventory_panel) -// { -// delete inventory_panel; -// } -// inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); -// mInventoryPanel = inventory_panel->getInventoryPanelHandle(); LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); - LLInventoryPanel* all_items_panel = inventory_panel->getChild("All Items"); - mInventoryPanel = all_items_panel->getInventoryPanelHandle(); + LLInventoryPanel* items_panel = inventory_panel->getChild("All Items"); + mInventoryPanel = items_panel->getInventoryPanelHandle(); llassert(mInventoryPanel.get() != NULL); // Reshape the inventory to the proper size @@ -848,9 +841,23 @@ void LLFloaterMarketplaceListings::setup() inventory_panel->setShape(inventory_placeholder_rect); // Set the sort order newest to oldest - all_items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - all_items_panel->getFilter().markDefault(); + 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("Active Items"); + items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + items_panel->getFilter().setFilterMarketplaceActiveFolders(); + items_panel->getFilter().markDefault(); + items_panel = inventory_panel->getChild("Inactive Items"); + items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + items_panel->getFilter().setFilterMarketplaceInactiveFolders(); + items_panel->getFilter().markDefault(); + items_panel = inventory_panel->getChild("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(); } @@ -969,8 +976,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO EAcceptance* accept, std::string& tooltip_msg) { - if ((mInventoryPanel.get() == NULL) || - mRootFolderId.isNull()) + if ((mInventoryPanel.get() == NULL) || mRootFolderId.isNull()) { return FALSE; } diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 3c6974cf6d..284c354fc6 100755 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -33,6 +33,7 @@ #include "llfolderviewitem.h" #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" +#include "llmarketplacefunctions.h" #include "llviewercontrol.h" #include "llfolderview.h" #include "llinventorybridge.h" @@ -243,6 +244,48 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent } } } + + //////////////////////////////////////////////////////////////////////////////// + // FILTERTYPE_MARKETPLACE_ACTIVE + // Pass if this item is a folder and is active + if (filterTypes & FILTERTYPE_MARKETPLACE_ACTIVE) + { + if (object_type == LLInventoryType::IT_CATEGORY) + { + if (LLMarketplaceData::instance().getActivationState(object_id)) + { + return FALSE; + } + } + } + + //////////////////////////////////////////////////////////////////////////////// + // FILTERTYPE_MARKETPLACE_INACTIVE + // Pass if this item is a folder and is not active + if (filterTypes & FILTERTYPE_MARKETPLACE_INACTIVE) + { + if (object_type == LLInventoryType::IT_CATEGORY) + { + if (!LLMarketplaceData::instance().getActivationState(object_id)) + { + return FALSE; + } + } + } + + //////////////////////////////////////////////////////////////////////////////// + // FILTERTYPE_MARKETPLACE_UNASSOCIATED + // Pass if this item is a folder and is active + if (filterTypes & FILTERTYPE_MARKETPLACE_UNASSOCIATED) + { + if (object_type == LLInventoryType::IT_CATEGORY) + { + if (LLMarketplaceData::instance().getListingID(object_id).empty()) + { + return FALSE; + } + } + } return TRUE; } @@ -468,6 +511,21 @@ void LLInventoryFilter::setFilterEmptySystemFolders() mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS; } +void LLInventoryFilter::setFilterMarketplaceActiveFolders() +{ + mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_ACTIVE; +} + +void LLInventoryFilter::setFilterMarketplaceInactiveFolders() +{ + mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_INACTIVE; +} + +void LLInventoryFilter::setFilterMarketplaceUnassociatedFolders() +{ + mFilterOps.mFilterTypes |= FILTERTYPE_MARKETPLACE_UNASSOCIATED; +} + void LLInventoryFilter::setFilterUUID(const LLUUID& object_id) { if (mFilterOps.mFilterUUID == LLUUID::null) diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index ce516af0b9..e553355036 100755 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -52,7 +52,10 @@ public: FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it FILTERTYPE_DATE = 0x1 << 3, // search by date range FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type - FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if + FILTERTYPE_EMPTYFOLDERS = 0x1 << 5, // pass if folder is not a system folder to be hidden if empty + FILTERTYPE_MARKETPLACE_ACTIVE = 0x1 << 6, // pass if folder is a marketplace active folder + FILTERTYPE_MARKETPLACE_INACTIVE = 0x1 << 7, // pass if folder is a marketplace inactive folder + FILTERTYPE_MARKETPLACE_UNASSOCIATED = 0x1 << 8 // pass if folder is a marketplace non associated (no market ID) folder }; enum EFilterLink @@ -160,6 +163,9 @@ public: void setFilterUUID(const LLUUID &object_id); void setFilterWearableTypes(U64 types); void setFilterEmptySystemFolders(); + void setFilterMarketplaceActiveFolders(); + void setFilterMarketplaceInactiveFolders(); + void setFilterMarketplaceUnassociatedFolders(); void updateFilterTypes(U64 types, U64& current_types); void setFilterSubString(const std::string& string); diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml index 89020c7e80..3c184ba54b 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml @@ -37,7 +37,7 @@ width="308" height="340"> Date: Thu, 20 Mar 2014 16:39:30 -0700 Subject: DD-16 : WIP : Update sort / show menu, not actionable yet though --- indra/newview/llfloateroutbox.cpp | 36 ++++++++++++++++ indra/newview/llfloateroutbox.h | 3 ++ .../skins/default/xui/en/menu_marketplace_view.xml | 49 ++++++++++++++++++++++ .../en/panel_marketplace_listings_inventory.xml | 2 +- 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100755 indra/newview/skins/default/xui/en/menu_marketplace_view.xml (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index d6da0ad971..0b02cb8f64 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -667,6 +667,8 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) , mInventoryText(NULL) , mInventoryTitle(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() @@ -772,6 +774,40 @@ void LLFloaterMarketplaceListings::onFocusReceived() fetchContents(); } + +void LLFloaterMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata) +{ + /* + std::string chosen_item = userdata.asString(); + + if (chosen_item == "sort_by_stock_amount") + { + setSortOrder(mNearbyList, E_SORT_BY_RECENT_SPEAKERS); + } + else if (chosen_item == "show_low_stock") + { + mNearbyList->toggleIcons(); + } + */ +} + +bool LLFloaterMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata) +{ + /* + std::string item = userdata.asString(); + U32 sort_order = gSavedSettings.getU32("NearbyPeopleSortOrder"); + + if (item == "sort_by_recent_speakers") + return sort_order == E_SORT_BY_RECENT_SPEAKERS; + if (item == "sort_name") + return sort_order == E_SORT_BY_NAME; + if (item == "sort_distance") + return sort_order == E_SORT_BY_DISTANCE; + */ + return false; +} + + void LLFloaterMarketplaceListings::fetchContents() { if (mRootFolderId.notNull()) diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index eba3e4217b..3da7c6c985 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -160,6 +160,9 @@ protected: private: S32 getFolderCount(); + // UI callbacks + void onViewSortMenuItemClicked(const LLSD& userdata); + bool onViewSortMenuItemCheck(const LLSD& userdata); LLInventoryCategoriesObserver * mCategoriesObserver; LLInventoryCategoryAddedObserver * mCategoryAddedObserver; diff --git a/indra/newview/skins/default/xui/en/menu_marketplace_view.xml b/indra/newview/skins/default/xui/en/menu_marketplace_view.xml new file mode 100755 index 0000000000..6d31ff4960 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_marketplace_view.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml index 3c184ba54b..54fc3a0c0f 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml @@ -23,7 +23,7 @@ width="31" height="25" left="2" - menu_filename="menu_people_nearby_view.xml" + menu_filename="menu_marketplace_view.xml" image_hover_unselected="Toolbar_Middle_Over" image_overlay="Conv_toolbar_sort" image_selected="Toolbar_Middle_Selected" -- cgit v1.3 From 5b0882872871a5601b216655ea408a2a9675f159 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Mar 2014 15:43:07 -0700 Subject: DD-16 : WIP : More code on sort/show menu but still not actionable. --- indra/newview/llfloateroutbox.cpp | 63 ++++++++++++++++------ indra/newview/llfloateroutbox.h | 3 ++ indra/newview/llinventoryfilter.h | 3 +- .../skins/default/xui/en/menu_marketplace_view.xml | 28 +++++----- 4 files changed, 67 insertions(+), 30 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 0b02cb8f64..0d87cf63e8 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -666,6 +666,8 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) , mInventoryPlaceholder(NULL) , mInventoryText(NULL) , mInventoryTitle(NULL) +, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) +, mFilterType(LLInventoryFilter::FILTERTYPE_NONE) { mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action", boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemClicked, this, _2)); mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemCheck, this, _2)); @@ -777,33 +779,64 @@ void LLFloaterMarketplaceListings::onFocusReceived() 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") { - setSortOrder(mNearbyList, E_SORT_BY_RECENT_SPEAKERS); + 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_low_stock") + else if (chosen_item == "show_inactive_listings") { - mNearbyList->toggleIcons(); + mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_INACTIVE; + panel->getFilter().setFilterMarketplaceInactiveFolders(); } - */ } bool LLFloaterMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata) { - /* - std::string item = userdata.asString(); - U32 sort_order = gSavedSettings.getU32("NearbyPeopleSortOrder"); + 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 (item == "sort_by_recent_speakers") - return sort_order == E_SORT_BY_RECENT_SPEAKERS; - if (item == "sort_name") - return sort_order == E_SORT_BY_NAME; - if (item == "sort_distance") - return sort_order == E_SORT_BY_DISTANCE; - */ + 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; } diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 3da7c6c985..4908e4342b 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -31,6 +31,7 @@ #include "llfloater.h" #include "llfoldertype.h" +#include "llinventoryfilter.h" #include "llnotificationptr.h" @@ -175,6 +176,8 @@ private: LLUUID mRootFolderId; LLHandle mInventoryPanel; + LLInventoryFilter::ESortOrderType mSortOrder; + LLInventoryFilter::EFilterType mFilterType; }; #endif // LL_LLFLOATEROUTBOX_H diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index e553355036..113596b0eb 100755 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -70,7 +70,8 @@ public: SO_NAME = 0, // Sort inventory by name SO_DATE = 0x1, // Sort inventory by date SO_FOLDERS_BY_NAME = 0x1 << 1, // Force folder sort by name - SO_SYSTEM_FOLDERS_TO_TOP = 0x1 << 2 // Force system folders to be on top + SO_SYSTEM_FOLDERS_TO_TOP = 0x1 << 2,// Force system folders to be on top + SO_FOLDERS_BY_WEIGHT = 0x1 << 3, // Force folder sort by weight, usually, amount of some elements in their descendents }; struct FilterOps 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 6d31ff4960..36c73b9f4b 100755 --- a/indra/newview/skins/default/xui/en/menu_marketplace_view.xml +++ b/indra/newview/skins/default/xui/en/menu_marketplace_view.xml @@ -1,6 +1,6 @@ - + + function="Marketplace.ViewSort.Action" + parameter="show_all" /> + function="Marketplace.ViewSort.CheckItem" + parameter="show_all" /> - + + function="People.Nearby.ViewSort.Action" + parameter="show_active" /> + function="People.Nearby.ViewSort.CheckItem" + parameter="show_active" /> - + + parameter="show_inactive_listings" /> + parameter="show_inactive_listings" /> -- cgit v1.3 From f813a25224081e68d4772676909d2cff14407486 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Mar 2014 10:22:10 -0700 Subject: DD-10 : WIP : Some XUI clean up, menu still not working --- indra/newview/llfloateroutbox.cpp | 2 +- .../skins/default/xui/en/menu_marketplace_view.xml | 4 +- .../default/xui/en/panel_marketplace_listings.xml | 138 +++++++++++++++++++++ .../en/panel_marketplace_listings_inventory.xml | 138 --------------------- 4 files changed, 141 insertions(+), 141 deletions(-) create mode 100755 indra/newview/skins/default/xui/en/panel_marketplace_listings.xml delete mode 100755 indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 0d87cf63e8..9ea83e9621 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -900,7 +900,7 @@ void LLFloaterMarketplaceListings::setup() llassert(mCategoriesObserver); // Set up the marketplace listings inventory view - LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); LLInventoryPanel* items_panel = inventory_panel->getChild("All Items"); mInventoryPanel = items_panel->getInventoryPanelHandle(); llassert(mInventoryPanel.get() != NULL); 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 36c73b9f4b..9ed93e2f11 100755 --- a/indra/newview/skins/default/xui/en/menu_marketplace_view.xml +++ b/indra/newview/skins/default/xui/en/menu_marketplace_view.xml @@ -32,10 +32,10 @@ diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml new file mode 100755 index 0000000000..54fc3a0c0f --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml deleted file mode 100755 index 54fc3a0c0f..0000000000 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.3 From a65ea2f5a00762f7c2748acf315c7396c3da088f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Mar 2014 13:41:40 -0700 Subject: DD-40 : WIP : Refactor marketplace listings UI classes in their own cpp / h files --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloatermarketplacelistings.cpp | 567 +++++++++++++++++++++++++ indra/newview/llfloatermarketplacelistings.h | 110 +++++ indra/newview/llfloateroutbox.cpp | 522 +---------------------- indra/newview/llfloateroutbox.h | 69 +-- indra/newview/llviewerfloaterreg.cpp | 1 + 6 files changed, 682 insertions(+), 589 deletions(-) create mode 100755 indra/newview/llfloatermarketplacelistings.cpp create mode 100755 indra/newview/llfloatermarketplacelistings.h (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 17e340d136..0365b1a847 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -245,6 +245,7 @@ set(viewer_SOURCE_FILES llfloaterlagmeter.cpp llfloaterland.cpp llfloaterlandholdings.cpp + llfloatermarketplacelistings.cpp llfloatermap.cpp llfloatermediasettings.cpp llfloatermemleak.cpp @@ -835,6 +836,7 @@ set(viewer_HEADER_FILES llfloaterland.h llfloaterlandholdings.h llfloatermap.h + llfloatermarketplacelistings.h llfloatermediasettings.h llfloatermemleak.h llfloatermodelpreview.h diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp new file mode 100755 index 0000000000..64f95c4a1a --- /dev/null +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -0,0 +1,567 @@ +/** + * @file llfloatermarketplacelistings.cpp + * @brief Implementation of the marketplace listings floater and panels + * + * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermarketplacelistings + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatermarketplacelistings.h" + +#include "llfloaterreg.h" +#include "llfolderview.h" +#include "llinventorybridge.h" +#include "llinventorymodelbackgroundfetch.h" +#include "llinventoryobserver.h" +#include "llinventorypanel.h" +#include "llmarketplacefunctions.h" +#include "llnotificationhandler.h" +#include "llnotificationmanager.h" +#include "llnotificationsutil.h" +#include "lltextbox.h" +#include "lltransientfloatermgr.h" +#include "lltrans.h" +#include "llviewernetwork.h" +#include "llwindowshade.h" + +///---------------------------------------------------------------------------- +/// LLMarketplaceListingsAddedObserver helper class +///---------------------------------------------------------------------------- + +class LLMarketplaceListingsAddedObserver : public LLInventoryCategoryAddedObserver +{ +public: + LLMarketplaceListingsAddedObserver(LLFloaterMarketplaceListings * marketplace_listings_floater) + : LLInventoryCategoryAddedObserver() + , mMarketplaceListingsFloater(marketplace_listings_floater) + { + } + + void done() + { + for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it) + { + LLViewerInventoryCategory* added_category = *it; + + LLFolderType::EType added_category_type = added_category->getPreferredType(); + + if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS) + { + mMarketplaceListingsFloater->initializeMarketPlace(); + } + } + } + +private: + LLFloaterMarketplaceListings * mMarketplaceListingsFloater; +}; + +///---------------------------------------------------------------------------- +/// LLFloaterMarketplaceListings +///---------------------------------------------------------------------------- + +LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) +: LLFloater(key) +, mCategoriesObserver(NULL) +, mCategoryAddedObserver(NULL) +, mRootFolderId(LLUUID::null) +, mInventoryStatus(NULL) +, mInventoryInitializationInProgress(NULL) +, mInventoryPlaceholder(NULL) +, mInventoryText(NULL) +, mInventoryTitle(NULL) +, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) +, mFilterType(LLInventoryFilter::FILTERTYPE_NONE) +{ + mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action", boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemClicked, this, _2)); + mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemCheck, this, _2)); +} + +LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() +{ + if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) + { + gInventory.removeObserver(mCategoriesObserver); + } + delete mCategoriesObserver; + + if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) + { + gInventory.removeObserver(mCategoryAddedObserver); + } + delete mCategoryAddedObserver; +} + +BOOL LLFloaterMarketplaceListings::postBuild() +{ + mInventoryStatus = getChild("marketplace_status"); + mInventoryInitializationInProgress = getChild("initialization_progress_indicator"); + mInventoryPlaceholder = getChild("marketplace_listings_inventory_placeholder_panel"); + mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); + mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); + + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this)); + + // Observe category creation to catch marketplace listings creation (moot if already existing) + mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(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; +} + +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) +{ +} + +void LLFloaterMarketplaceListings::onOpen(const LLSD& key) +{ + // + // Initialize the Market Place or go update the outbox + // + if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) + { + initializeMarketPlace(); + } + else + { + setup(); + } + + // 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; + if (index%3) + { + LLMarketplaceData::instance().addTestItem(category->getUUID()); + if (index%3 == 1) + { + LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); + } + LLMarketplaceData::instance().setActivation(category->getUUID(),(index%2)); + } + } + } + + // + // Update the floater view + // + updateView(); + + // + // Trigger fetch of the contents + // + fetchContents(); +} + +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()) + { + LLInventoryModelBackgroundFetch::instance().start(mRootFolderId); + } +} + +void LLFloaterMarketplaceListings::setup() +{ + if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) + { + // If we are *not* a merchant or we have no market place connection established yet, do nothing + return; + } + + // We are a merchant. Get the Marketplace listings folder, create it if needs be. + LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true); + if (outbox_id.isNull()) + { + // We should never get there unless the inventory fails badly + llinfos << "Merov : Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; + llerrs << "Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; + return; + } + + // Consolidate Marketplace listings + // We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually + gInventory.consolidateForType(outbox_id, LLFolderType::FT_MARKETPLACE_LISTINGS); + + if (outbox_id == mRootFolderId) + { + llinfos << "Merov : Inventory warning: Marketplace listings folder already set" << llendl; + llwarns << "Inventory warning: Marketplace listings folder already set" << llendl; + return; + } + mRootFolderId = outbox_id; + + // No longer need to observe new category creation + if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) + { + gInventory.removeObserver(mCategoryAddedObserver); + delete mCategoryAddedObserver; + mCategoryAddedObserver = NULL; + } + llassert(!mCategoryAddedObserver); + + // Create observer for marketplace listings modifications : clear the old one and create a new one + if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) + { + gInventory.removeObserver(mCategoriesObserver); + delete mCategoriesObserver; + } + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this)); + llassert(mCategoriesObserver); + + // Set up the marketplace listings inventory view + LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + LLInventoryPanel* items_panel = inventory_panel->getChild("All Items"); + mInventoryPanel = items_panel->getInventoryPanelHandle(); + llassert(mInventoryPanel.get() != NULL); + + // Reshape the inventory to the proper size + LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); + inventory_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("Active Items"); + items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + items_panel->getFilter().setFilterMarketplaceActiveFolders(); + items_panel->getFilter().markDefault(); + items_panel = inventory_panel->getChild("Inactive Items"); + items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + items_panel->getFilter().setFilterMarketplaceInactiveFolders(); + items_panel->getFilter().markDefault(); + items_panel = inventory_panel->getChild("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(); +} + +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(); + } +} + +S32 LLFloaterMarketplaceListings::getFolderCount() +{ + if (mInventoryPanel.get() && mRootFolderId.notNull()) + { + LLInventoryModel::cat_array_t * cats; + LLInventoryModel::item_array_t * items; + gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); + + return (cats->count() + items->count()); + } + else + { + return 0; + } +} + +void LLFloaterMarketplaceListings::setStatusString(const std::string& statusString) +{ + mInventoryStatus->setText(statusString); +} + +void LLFloaterMarketplaceListings::updateView() +{ + LLInventoryPanel* panel = mInventoryPanel.get(); + + if (getFolderCount() > 0) + { + panel->setVisible(TRUE); + mInventoryPlaceholder->setVisible(FALSE); + } + else + { + if (panel) + { + panel->setVisible(FALSE); + } + + std::string text; + std::string title; + std::string tooltip; + + const LLSD& subs = getMarketplaceStringSubstitutions(); + U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus(); + + // *TODO : check those messages and create better appropriate ones in strings.xml + if (mRootFolderId.notNull()) + { + // Does the outbox needs recreation? + if ((panel == NULL) || !gInventory.getCategory(mRootFolderId)) + { + setup(); + } + // "Marketplace listings is empty!" message strings + text = LLTrans::getString("InventoryMarketplaceListingsNoItems", subs); + title = LLTrans::getString("InventoryMarketplaceListingsNoItemsTitle"); + tooltip = LLTrans::getString("InventoryMarketplaceListingsNoItemsTooltip"); + } + else if (mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) + { + // "Initializing!" message strings + text = LLTrans::getString("InventoryOutboxInitializing", subs); + title = LLTrans::getString("InventoryOutboxInitializingTitle"); + tooltip = LLTrans::getString("InventoryOutboxInitializingTooltip"); + } + else if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT) + { + // "Not a merchant!" message strings + text = LLTrans::getString("InventoryOutboxNotMerchant", subs); + title = LLTrans::getString("InventoryOutboxNotMerchantTitle"); + tooltip = LLTrans::getString("InventoryOutboxNotMerchantTooltip"); + } + else + { + // "Errors!" message strings + text = LLTrans::getString("InventoryOutboxError", subs); + title = LLTrans::getString("InventoryOutboxErrorTitle"); + tooltip = LLTrans::getString("InventoryOutboxErrorTooltip"); + } + + mInventoryText->setValue(text); + mInventoryTitle->setValue(title); + mInventoryPlaceholder->getParent()->setToolTip(tooltip); + } +} + +bool LLFloaterMarketplaceListings::isAccepted(EAcceptance accept) +{ + // *TODO : Need a bit more test on what we accept: depends of what and where... + return (accept >= ACCEPT_YES_COPY_SINGLE); +} + + +BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + if ((mInventoryPanel.get() == NULL) || mRootFolderId.isNull()) + { + return FALSE; + } + + LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + BOOL handled = (handled_view != NULL); + + // 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()) + { + S32 inv_x, inv_y; + localPointToOtherView(x, y, &inv_x, &inv_y, panel); + + pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y); + + LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true); + pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder); + } + + // Pass all drag and drop for this floater to the outbox inventory control + if (!handled || !isAccepted(*accept)) + { + // Handle the drag and drop directly to the root of the outbox if we're not in the inventory panel + // (otherwise the inventory panel itself will handle the drag and drop operation, without any override) + if (!pointInInventoryPanel) + { + handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + } + } + + return handled; +} + +BOOL LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask) +{ + return LLFloater::handleHover(x, y, mask); +} + +void LLFloaterMarketplaceListings::onMouseLeave(S32 x, S32 y, MASK mask) +{ + LLFloater::onMouseLeave(x, y, mask); +} + +void LLFloaterMarketplaceListings::onChanged() +{ + LLViewerInventoryCategory* category = gInventory.getCategory(mRootFolderId); + if (mRootFolderId.notNull() && category) + { + fetchContents(); + updateView(); + } + else + { + clean(); + } +} + +void LLFloaterMarketplaceListings::initializationReportError(U32 status, const LLSD& content) +{ + updateView(); +} + +void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress) +{ + if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == 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(); +} + + diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h new file mode 100755 index 0000000000..fab2040deb --- /dev/null +++ b/indra/newview/llfloatermarketplacelistings.h @@ -0,0 +1,110 @@ +/** + * @file llfloatermarketplacelistings.h + * @brief Implementation of the marketplace listings floater and panels + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERMARKETPLACELISTINGS_H +#define LL_LLFLOATERMARKETPLACELISTINGS_H + +#include "llfloater.h" +#include "llfoldertype.h" +#include "llinventoryfilter.h" +#include "llnotificationptr.h" + +class LLButton; +class LLInventoryCategoriesObserver; +class LLInventoryCategoryAddedObserver; +class LLInventoryPanel; +class LLLoadingIndicator; +class LLNotification; +class LLTextBox; +class LLView; +class LLWindowShade; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFloaterMarketplaceListings +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLFloaterMarketplaceListings : public LLFloater +{ +public: + LLFloaterMarketplaceListings(const LLSD& key); + ~LLFloaterMarketplaceListings(); + + void initializeMarketPlace(); + + // virtuals + BOOL postBuild(); + BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + + void showNotification(const LLNotificationPtr& notification); + + BOOL handleHover(S32 x, S32 y, MASK mask); + void onMouseLeave(S32 x, S32 y, MASK mask); + +protected: + void setup(); + void clean(); + 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); + void onOpen(const LLSD& key); + void onFocusReceived(); + void onChanged(); + + bool isAccepted(EAcceptance accept); + + void updateView(); + +private: + S32 getFolderCount(); + // UI callbacks + void onViewSortMenuItemClicked(const LLSD& userdata); + bool onViewSortMenuItemCheck(const LLSD& userdata); + + LLInventoryCategoriesObserver * mCategoriesObserver; + LLInventoryCategoryAddedObserver * mCategoryAddedObserver; + + LLTextBox * mInventoryStatus; + LLView * mInventoryInitializationInProgress; + LLView * mInventoryPlaceholder; + LLTextBox * mInventoryText; + LLTextBox * mInventoryTitle; + + LLUUID mRootFolderId; + LLHandle mInventoryPanel; + LLInventoryFilter::ESortOrderType mSortOrder; + LLInventoryFilter::EFilterType mFilterType; +}; + +#endif // LL_LLFLOATERMARKETPLACELISTINGS_H diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 9ea83e9621..f5ebd5cf51 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -1,8 +1,6 @@ /** * @file llfloateroutbox.cpp - * @brief Implementation of the merchant outbox window and of the marketplace listings window - * - * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermarketplacelistings + * @brief Implementation of the merchant outbox window * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -106,39 +104,6 @@ private: LLFloaterOutbox * mOutboxFloater; }; -///---------------------------------------------------------------------------- -/// LLMarketplaceListingsAddedObserver helper class -///---------------------------------------------------------------------------- - -class LLMarketplaceListingsAddedObserver : public LLInventoryCategoryAddedObserver -{ -public: - LLMarketplaceListingsAddedObserver(LLFloaterMarketplaceListings * marketplace_listings_floater) - : LLInventoryCategoryAddedObserver() - , mMarketplaceListingsFloater(marketplace_listings_floater) - { - } - - void done() - { - for (cat_vec_t::iterator it = mAddedCategories.begin(); it != mAddedCategories.end(); ++it) - { - LLViewerInventoryCategory* added_category = *it; - - LLFolderType::EType added_category_type = added_category->getPreferredType(); - - if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS) - { - mMarketplaceListingsFloater->initializeMarketPlace(); - } - } - } - -private: - LLFloaterMarketplaceListings * mMarketplaceListingsFloater; -}; - - ///---------------------------------------------------------------------------- /// LLFloaterOutbox ///---------------------------------------------------------------------------- @@ -652,490 +617,5 @@ void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification) notification_handler->processNotification(notification); } -///---------------------------------------------------------------------------- -/// LLFloaterMarketplaceListings -///---------------------------------------------------------------------------- - -LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) -: LLFloater(key) -, mCategoriesObserver(NULL) -, mCategoryAddedObserver(NULL) -, mRootFolderId(LLUUID::null) -, mInventoryStatus(NULL) -, mInventoryInitializationInProgress(NULL) -, mInventoryPlaceholder(NULL) -, mInventoryText(NULL) -, mInventoryTitle(NULL) -, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) -, mFilterType(LLInventoryFilter::FILTERTYPE_NONE) -{ - mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action", boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemClicked, this, _2)); - mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLFloaterMarketplaceListings::onViewSortMenuItemCheck, this, _2)); -} - -LLFloaterMarketplaceListings::~LLFloaterMarketplaceListings() -{ - if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) - { - gInventory.removeObserver(mCategoriesObserver); - } - delete mCategoriesObserver; - - if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) - { - gInventory.removeObserver(mCategoryAddedObserver); - } - delete mCategoryAddedObserver; -} - -BOOL LLFloaterMarketplaceListings::postBuild() -{ - mInventoryStatus = getChild("marketplace_status"); - mInventoryInitializationInProgress = getChild("initialization_progress_indicator"); - mInventoryPlaceholder = getChild("marketplace_listings_inventory_placeholder_panel"); - mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); - mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); - - LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this)); - - // Observe category creation to catch marketplace listings creation (moot if already existing) - mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(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; -} - -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) -{ -} - -void LLFloaterMarketplaceListings::onOpen(const LLSD& key) -{ - // - // Initialize the Market Place or go update the outbox - // - if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) - { - initializeMarketPlace(); - } - else - { - setup(); - } - - // 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; - if (index%3) - { - LLMarketplaceData::instance().addTestItem(category->getUUID()); - if (index%3 == 1) - { - LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); - } - LLMarketplaceData::instance().setActivation(category->getUUID(),(index%2)); - } - } - } - - // - // Update the floater view - // - updateView(); - - // - // Trigger fetch of the contents - // - fetchContents(); -} - -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()) - { - LLInventoryModelBackgroundFetch::instance().start(mRootFolderId); - } -} - -void LLFloaterMarketplaceListings::setup() -{ - if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) - { - // If we are *not* a merchant or we have no market place connection established yet, do nothing - return; - } - - // We are a merchant. Get the Marketplace listings folder, create it if needs be. - LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true); - if (outbox_id.isNull()) - { - // We should never get there unless the inventory fails badly - llinfos << "Merov : Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; - llerrs << "Inventory problem: failure to create the marketplace listings folder for a merchant!" << llendl; - return; - } - - // Consolidate Marketplace listings - // We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually - gInventory.consolidateForType(outbox_id, LLFolderType::FT_MARKETPLACE_LISTINGS); - - if (outbox_id == mRootFolderId) - { - llinfos << "Merov : Inventory warning: Marketplace listings folder already set" << llendl; - llwarns << "Inventory warning: Marketplace listings folder already set" << llendl; - return; - } - mRootFolderId = outbox_id; - - // No longer need to observe new category creation - if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) - { - gInventory.removeObserver(mCategoryAddedObserver); - delete mCategoryAddedObserver; - mCategoryAddedObserver = NULL; - } - llassert(!mCategoryAddedObserver); - - // Create observer for marketplace listings modifications : clear the old one and create a new one - if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) - { - gInventory.removeObserver(mCategoriesObserver); - delete mCategoriesObserver; - } - mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this)); - llassert(mCategoriesObserver); - - // Set up the marketplace listings inventory view - LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); - LLInventoryPanel* items_panel = inventory_panel->getChild("All Items"); - mInventoryPanel = items_panel->getInventoryPanelHandle(); - llassert(mInventoryPanel.get() != NULL); - - // Reshape the inventory to the proper size - LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - inventory_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("Active Items"); - items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - items_panel->getFilter().setFilterMarketplaceActiveFolders(); - items_panel->getFilter().markDefault(); - items_panel = inventory_panel->getChild("Inactive Items"); - items_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - items_panel->getFilter().setFilterMarketplaceInactiveFolders(); - items_panel->getFilter().markDefault(); - items_panel = inventory_panel->getChild("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(); -} - -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(); - } -} - -S32 LLFloaterMarketplaceListings::getFolderCount() -{ - if (mInventoryPanel.get() && mRootFolderId.notNull()) - { - LLInventoryModel::cat_array_t * cats; - LLInventoryModel::item_array_t * items; - gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); - - return (cats->count() + items->count()); - } - else - { - return 0; - } -} - -void LLFloaterMarketplaceListings::setStatusString(const std::string& statusString) -{ - mInventoryStatus->setText(statusString); -} - -void LLFloaterMarketplaceListings::updateView() -{ - LLInventoryPanel* panel = mInventoryPanel.get(); - - if (getFolderCount() > 0) - { - panel->setVisible(TRUE); - mInventoryPlaceholder->setVisible(FALSE); - } - else - { - if (panel) - { - panel->setVisible(FALSE); - } - - std::string text; - std::string title; - std::string tooltip; - - const LLSD& subs = getMarketplaceStringSubstitutions(); - U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus(); - - // *TODO : check those messages and create better appropriate ones in strings.xml - if (mRootFolderId.notNull()) - { - // Does the outbox needs recreation? - if ((panel == NULL) || !gInventory.getCategory(mRootFolderId)) - { - setup(); - } - // "Marketplace listings is empty!" message strings - text = LLTrans::getString("InventoryMarketplaceListingsNoItems", subs); - title = LLTrans::getString("InventoryMarketplaceListingsNoItemsTitle"); - tooltip = LLTrans::getString("InventoryMarketplaceListingsNoItemsTooltip"); - } - else if (mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING) - { - // "Initializing!" message strings - text = LLTrans::getString("InventoryOutboxInitializing", subs); - title = LLTrans::getString("InventoryOutboxInitializingTitle"); - tooltip = LLTrans::getString("InventoryOutboxInitializingTooltip"); - } - else if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT) - { - // "Not a merchant!" message strings - text = LLTrans::getString("InventoryOutboxNotMerchant", subs); - title = LLTrans::getString("InventoryOutboxNotMerchantTitle"); - tooltip = LLTrans::getString("InventoryOutboxNotMerchantTooltip"); - } - else - { - // "Errors!" message strings - text = LLTrans::getString("InventoryOutboxError", subs); - title = LLTrans::getString("InventoryOutboxErrorTitle"); - tooltip = LLTrans::getString("InventoryOutboxErrorTooltip"); - } - - mInventoryText->setValue(text); - mInventoryTitle->setValue(title); - mInventoryPlaceholder->getParent()->setToolTip(tooltip); - } -} - -bool LLFloaterMarketplaceListings::isAccepted(EAcceptance accept) -{ - // *TODO : Need a bit more test on what we accept: depends of what and where... - return (accept >= ACCEPT_YES_COPY_SINGLE); -} - - -BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - if ((mInventoryPanel.get() == NULL) || mRootFolderId.isNull()) - { - return FALSE; - } - - LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - BOOL handled = (handled_view != NULL); - - // 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()) - { - S32 inv_x, inv_y; - localPointToOtherView(x, y, &inv_x, &inv_y, panel); - - pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y); - - LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true); - pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder); - } - - // Pass all drag and drop for this floater to the outbox inventory control - if (!handled || !isAccepted(*accept)) - { - // Handle the drag and drop directly to the root of the outbox if we're not in the inventory panel - // (otherwise the inventory panel itself will handle the drag and drop operation, without any override) - if (!pointInInventoryPanel) - { - handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } - } - - return handled; -} - -BOOL LLFloaterMarketplaceListings::handleHover(S32 x, S32 y, MASK mask) -{ - return LLFloater::handleHover(x, y, mask); -} - -void LLFloaterMarketplaceListings::onMouseLeave(S32 x, S32 y, MASK mask) -{ - LLFloater::onMouseLeave(x, y, mask); -} - -void LLFloaterMarketplaceListings::onChanged() -{ - LLViewerInventoryCategory* category = gInventory.getCategory(mRootFolderId); - if (mRootFolderId.notNull() && category) - { - fetchContents(); - updateView(); - } - else - { - clean(); - } -} - -void LLFloaterMarketplaceListings::initializationReportError(U32 status, const LLSD& content) -{ - updateView(); -} - -void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress) -{ - if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == 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(); -} diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 4908e4342b..2cf69fc3cc 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -1,8 +1,6 @@ /** * @file llfloateroutbox.h - * @brief Implementation of the merchant outbox window and of the marketplace listings window - * - * *TODO : Eventually, take out all the merchant outbox stuff and rename that file to llfloatermarketplacelistings + * @brief Implementation of the merchant outbox window * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -115,69 +113,4 @@ private: LLWindowShade * mWindowShade; }; -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFloaterMarketplaceListings -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLFloaterMarketplaceListings : public LLFloater -{ -public: - LLFloaterMarketplaceListings(const LLSD& key); - ~LLFloaterMarketplaceListings(); - - void initializeMarketPlace(); - - // virtuals - BOOL postBuild(); - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); - - void showNotification(const LLNotificationPtr& notification); - - BOOL handleHover(S32 x, S32 y, MASK mask); - void onMouseLeave(S32 x, S32 y, MASK mask); - -protected: - void setup(); - void clean(); - 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); - void onOpen(const LLSD& key); - void onFocusReceived(); - void onChanged(); - - bool isAccepted(EAcceptance accept); - - void updateView(); - -private: - S32 getFolderCount(); - // UI callbacks - void onViewSortMenuItemClicked(const LLSD& userdata); - bool onViewSortMenuItemCheck(const LLSD& userdata); - - LLInventoryCategoriesObserver * mCategoriesObserver; - LLInventoryCategoryAddedObserver * mCategoryAddedObserver; - - LLTextBox * mInventoryStatus; - LLView * mInventoryInitializationInProgress; - LLView * mInventoryPlaceholder; - LLTextBox * mInventoryText; - LLTextBox * mInventoryTitle; - - LLUUID mRootFolderId; - LLHandle mInventoryPanel; - LLInventoryFilter::ESortOrderType mSortOrder; - LLInventoryFilter::EFilterType mFilterType; -}; - #endif // LL_LLFLOATEROUTBOX_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 853d98693b..9bb6153e56 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -79,6 +79,7 @@ #include "llfloaterland.h" #include "llfloaterlandholdings.h" #include "llfloatermap.h" +#include "llfloatermarketplacelistings.h" #include "llfloatermemleak.h" #include "llfloaternamedesc.h" #include "llfloaternotificationsconsole.h" -- cgit v1.3 From c58af954101ea23f38f7fca6a1d5fd4ed4139e31 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 19 Oct 2014 21:53:07 -0700 Subject: DD-170 : Set the import callback for Merchant Outbox only when clicking the import button --- indra/newview/llfloateroutbox.cpp | 4 +++- indra/newview/llmarketplacefunctions.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 772f73867a..0c4b58e501 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -303,7 +303,6 @@ void LLFloaterOutbox::initializeMarketPlace() { importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2)); importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1)); - importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); importer.initialize(); } } @@ -516,6 +515,9 @@ void LLFloaterOutbox::onImportButtonClicked() { mOutboxInventoryPanel.get()->clearSelection(); } + + LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); + importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index fbfddd09a5..b4a2921f8c 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1030,13 +1030,13 @@ void LLMarketplaceInventoryImporter::updateImport() } } } - - // Make sure we trigger the status change with the final state (in case of auto trigger after initialize) - if (mStatusChangedSignal) - { - (*mStatusChangedSignal)(mImportInProgress); - } } + + // Make sure we trigger the status change with the final state (in case of auto trigger after initialize) + if (mStatusChangedSignal) + { + (*mStatusChangedSignal)(mImportInProgress); + } } // -- cgit v1.3 From 0291b82f94533a1c1471ce8deedd13337273aa1f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 24 Oct 2014 22:46:26 -0700 Subject: DD-243 : Set up callbacks for merchant outbox importer in the postBuild --- indra/newview/llfloateroutbox.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 0c4b58e501..b7b1634a5f 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -160,6 +160,12 @@ BOOL LLFloaterOutbox::postBuild() mCategoryAddedObserver = new LLOutboxAddedObserver(this); gInventory.addObserver(mCategoryAddedObserver); + // Setup callbacks for importer + LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); + importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2)); + importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1)); + importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); + return TRUE; } @@ -298,11 +304,8 @@ void LLFloaterOutbox::initializeMarketPlace() // Initialize the marketplace import API // LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); - if (!importer.isInitialized()) { - importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2)); - importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1)); importer.initialize(); } } @@ -516,9 +519,6 @@ void LLFloaterOutbox::onImportButtonClicked() mOutboxInventoryPanel.get()->clearSelection(); } - LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance(); - importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2)); - mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); } -- cgit v1.3