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.2.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 +++++++++++++++++++++++++++++++++------ 1 file changed, 52 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(); +} + + -- cgit v1.2.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 ++++++++++++++++++++++++ 1 file changed, 24 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() -- cgit v1.2.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 +++++++++++----------- 1 file changed, 11 insertions(+), 11 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() -- cgit v1.2.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/newview/llfloateroutbox.cpp | 114 +++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') 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(); } -- cgit v1.2.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 +++++++---- 1 file changed, 7 insertions(+), 4 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)); } } -- cgit v1.2.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 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 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(); } -- cgit v1.2.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 ----------------- 1 file changed, 17 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); } -- cgit v1.2.3 From d9747b3f828000d46a09a881fae2ab915cee5f4e Mon Sep 17 00:00:00 2001 From: Merov Linden 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 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 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(); -- cgit v1.2.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 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 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; } -- cgit v1.2.3 From d11a15b6dd0a6bb74b4f8f3f6ce23a05123c7e99 Mon Sep 17 00:00:00 2001 From: Merov Linden 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 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (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()) -- cgit v1.2.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 +++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 15 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; } -- cgit v1.2.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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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); -- cgit v1.2.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/llfloateroutbox.cpp | 522 +------------------------------------- 1 file changed, 1 insertion(+), 521 deletions(-) (limited to 'indra/newview/llfloateroutbox.cpp') 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(); -} -- cgit v1.2.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 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (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(); } -- cgit v1.2.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.2.3