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/llcommon/llfoldertype.cpp | 2 + indra/llcommon/llfoldertype.h | 2 + indra/newview/llfloateroutbox.cpp | 395 ++++++++++++++++++++- indra/newview/llfloateroutbox.h | 59 ++- indra/newview/llinventorypanel.cpp | 2 + indra/newview/llviewerfloaterreg.cpp | 1 + indra/newview/llviewerfoldertype.cpp | 2 + .../default/xui/en/floater_merchant_items.xml | 121 +++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 7 + .../xui/en/panel_merchant_items_inventory.xml | 32 ++ indra/newview/skins/default/xui/en/strings.xml | 5 + 11 files changed, 625 insertions(+), 3 deletions(-) create mode 100755 indra/newview/skins/default/xui/en/floater_merchant_items.xml create mode 100755 indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml (limited to 'indra') diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp index 9c38349cf7..64bc17c422 100755 --- a/indra/llcommon/llfoldertype.cpp +++ b/indra/llcommon/llfoldertype.cpp @@ -96,6 +96,8 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", FALSE)); addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); + + addEntry(LLFolderType::FT_MERCHANT_ITEMS, 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 a0c847914f..81f9c0b678 100644 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -87,6 +87,8 @@ public: FT_BASIC_ROOT = 52, + FT_MERCHANT_ITEMS = 53, + FT_COUNT, FT_NONE = -1 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(); + } +} diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 40519c8fd2..b63faa860b 100755 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -1,7 +1,8 @@ /** * @file llfloateroutbox.h - * @brief LLFloaterOutbox - * class definition + * @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 @@ -113,4 +114,58 @@ private: LLWindowShade * mWindowShade; }; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFloaterMerchantItems +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLFloaterMerchantItems : public LLFloater +{ +public: + LLFloaterMerchantItems(const LLSD& key); + ~LLFloaterMerchantItems(); + + 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 onClose(bool app_quitting); + void onOpen(const LLSD& key); + void onFocusReceived(); + void onChanged(); + + bool isAccepted(EAcceptance accept); + + void updateView(); + +private: + S32 getFolderCount(); + + LLInventoryCategoriesObserver * mCategoriesObserver; + LLInventoryCategoryAddedObserver * mCategoryAddedObserver; + + LLView * mInventoryPlaceholder; + LLTextBox * mInventoryText; + LLTextBox * mInventoryTitle; + + LLUUID mRootFolderId; + LLHandle mInventoryPanel; + LLPanel * mTopLevelDropZone; +}; + #endif // LL_LLFLOATEROUTBOX_H diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 81ee7ac07e..c1607fbbc0 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -288,6 +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)); } // set the filter for the empty folder if the debug setting is on @@ -1489,5 +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); } } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index a8eeddb798..f55de790d8 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -243,6 +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("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 991f6b40e6..413814cec0 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -140,6 +140,8 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() addEntry(LLFolderType::FT_OUTBOX, new ViewerFolderEntry("Merchant Outbox", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); 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_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); diff --git a/indra/newview/skins/default/xui/en/floater_merchant_items.xml b/indra/newview/skins/default/xui/en/floater_merchant_items.xml new file mode 100755 index 0000000000..2e54ed2ce3 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_merchant_items.xml @@ -0,0 +1,121 @@ + + + + + + + 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 64de010eb5..2dc974eff1 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -181,6 +181,13 @@ function="Floater.ToggleOrBringToFront" parameter="outbox" /> + + + 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 new file mode 100755 index 0000000000..a013516267 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_merchant_items_inventory.xml @@ -0,0 +1,32 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 9300652eaa..515e912ee5 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2219,6 +2219,11 @@ 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. + + + Drag folders to this area to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace]. + No errors Error: Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge). -- 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 +++++++++++++++++++++++++++++++++------ indra/newview/llfloateroutbox.h | 4 +++ 2 files changed, 56 insertions(+), 9 deletions(-) (limited to 'indra') 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.2.3 From 0006840325fd88aea3c7514ca5d93f42659e4037 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Mar 2014 13:56:21 -0800 Subject: DD-2 : Implement LLMarketplaceTuple and LLMarketplaceData --- indra/newview/llmarketplacefunctions.cpp | 110 +++++++++++++++++++++++++++++++ indra/newview/llmarketplacefunctions.h | 54 +++++++++++++++ 2 files changed, 164 insertions(+) (limited to 'indra') diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 05c9d76810..d231202f40 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -528,3 +528,113 @@ void LLMarketplaceInventoryImporter::updateImport() } } +// +// Direct Delivery : Marketplace tuples and data +// + +// Tuple == Item +LLMarketplaceTuple::LLMarketplaceTuple() : + mFolderListingId(), + mListingId(""), + mActiveVersionFolderId(), + mIsActive(false) +{ +} + +LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id) : + mFolderListingId(folder_id), + mListingId(""), + mActiveVersionFolderId(), + mIsActive(false) +{ +} + +LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed) : + mFolderListingId(folder_id), + mListingId(listing_id), + mActiveVersionFolderId(version_id), + mIsActive(is_listed) +{ +} + + +// Data map +LLMarketplaceData::LLMarketplaceData() +{ +} + +// Accessors +bool LLMarketplaceData::getActivationState(const LLUUID& folder_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + return (it == mMarketplaceItems.end() ? false : (it->second).mIsActive); +} +std::string LLMarketplaceData::getListingID(const LLUUID& folder_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + return (it == mMarketplaceItems.end() ? "" : (it->second).mListingId); +} +LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mActiveVersionFolderId); +} +bool LLMarketplaceData::isListed(const LLUUID& folder_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + return (it != mMarketplaceItems.end()); +} + +// Modifiers +bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listing_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + if (it == mMarketplaceItems.end()) + { + return false; + } + else + { + (it->second).mListingId = listing_id; + return true; + } +} +bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + if (it == mMarketplaceItems.end()) + { + return false; + } + else + { + (it->second).mActiveVersionFolderId = version_id; + return true; + } +} +bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + if (it == mMarketplaceItems.end()) + { + return false; + } + else + { + (it->second).mIsActive = activate; + return true; + } +} + +// Test methods +void LLMarketplaceData::addTestItem(const LLUUID& folder_id) +{ + mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); +} +void LLMarketplaceData::addTestItem(const LLUUID& folder_id, const LLUUID& version_id) +{ + mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); + setVersionFolderID(folder_id, version_id); +} + + diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index abe60890a3..c3cde740a2 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -109,6 +109,60 @@ private: }; +// Classes handling the data coming from and going to the Marketplace DB: +// * implement the Marketplace API (TBD) +// * cache the current Marketplace data (tuples) +// * provide methods to get Marketplace data on any inventory item +class LLMarketplaceData; + +// A Marketplace item is known by its tuple +class LLMarketplaceTuple +{ +public: + friend class LLMarketplaceData; + + LLMarketplaceTuple(); + LLMarketplaceTuple(const LLUUID& folder_id); + LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed = false); + +private: + // Representation of a marketplace item in the Marketplace DB (well, what we know of it...) + LLUUID mFolderListingId; + std::string mListingId; + LLUUID mActiveVersionFolderId; + bool mIsActive; +}; +// The folder UUID is used as a key to this map. It could therefore be taken off the object themselves +typedef std::map marketplace_items_list_t; + +// There's one and only one possible set of Marketplace data per agent and per session +class LLMarketplaceData + : public LLSingleton +{ +public: + LLMarketplaceData(); + + // 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); + LLUUID getVersionFolderID(const LLUUID& folder_id); + + bool isListed(const LLUUID& folder_id); // returns true if folder_id is in the items map + + // Modify Marketplace Data : methods return true is function succeeded, false if error + bool setListingID(const LLUUID& folder_id, std::string listing_id); + bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); + bool setActivation(const LLUUID& folder_id, bool activate); + + // Merov : DD Development : methods to populate the items list with something usefull using + // inventory IDs and some pseudo random code so we can play with the UI... + void addTestItem(const LLUUID& folder_id); + void addTestItem(const LLUUID& folder_id, const LLUUID& version_id); + +private: + marketplace_items_list_t mMarketplaceItems; +}; + #endif // LL_LLMARKETPLACEFUNCTIONS_H -- 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 ++++++++++++++++++++++++ indra/newview/llmarketplacefunctions.cpp | 2 ++ indra/newview/llmarketplacefunctions.h | 2 ++ 3 files changed, 28 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index c5ece0ccd6..86387c548a 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -697,6 +697,10 @@ BOOL LLFloaterMerchantItems::postBuild() mCategoryAddedObserver = new LLMerchantItemsAddedObserver(this); gInventory.addObserver(mCategoryAddedObserver); + // Merov : Debug : fetch aggressively so we can create test data right onOpen() + llinfos << "Merov : postBuild, do fetchContent() ahead of time" << llendl; + fetchContents(); + return TRUE; } @@ -737,6 +741,26 @@ void LLFloaterMerchantItems::onOpen(const LLSD& key) // Trigger fetch of the contents // fetchContents(); + + // Merov : Debug : Create fake Marketplace data if none is present + if (LLMarketplaceData::instance().isEmpty() && (getFolderCount() > 0)) + { + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); + + int index = 0; + for (LLInventoryModel::cat_array_t::iterator iter = cats->begin(); iter != cats->end(); iter++, index++) + { + LLViewerInventoryCategory* category = *iter; + LLMarketplaceData::instance().addTestItem(category->getUUID()); + if (index%2) + { + LLMarketplaceData::instance().setListingID(category->getUUID(),"TestingID1234"); + } + LLMarketplaceData::instance().setActivation(category->getUUID(),(index%3 == 0)); + } + } } void LLFloaterMerchantItems::onFocusReceived() diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index d231202f40..b39889c721 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -629,10 +629,12 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) // Test methods void LLMarketplaceData::addTestItem(const LLUUID& folder_id) { + llinfos << "Merov : addTestItem, id = " << folder_id << llendl; mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); } void LLMarketplaceData::addTestItem(const LLUUID& folder_id, const LLUUID& version_id) { + llinfos << "Merov : addTestItem, id = " << folder_id << ", version = " << version_id << llendl; mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); setVersionFolderID(folder_id, version_id); } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index c3cde740a2..c86df08476 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -142,6 +142,8 @@ class LLMarketplaceData public: LLMarketplaceData(); + bool isEmpty() { return (mMarketplaceItems.size() == 0); } + // Access Marketplace Data : methods return default value if the folder_id can't be found bool getActivationState(const LLUUID& folder_id); std::string getListingID(const LLUUID& folder_id); -- cgit v1.2.3 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') 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.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/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') 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.2.3 From f93f860e9b565213089f945ee0d88dedf3dcd9c0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 14 Mar 2014 13:52:42 -0700 Subject: DD-43, DD-44 : implement update_marketplace_category() and get it called swhen appropriate --- indra/newview/llinventoryfunctions.cpp | 10 ++++++++++ indra/newview/llinventoryfunctions.h | 3 +++ indra/newview/llmarketplacefunctions.cpp | 7 +++++++ 3 files changed, 20 insertions(+) (limited to 'indra') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index f1a4889f5a..203eb4ec4e 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -111,6 +111,16 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } +void update_marketplace_category(const LLUUID& cat_id) +{ + // When changing the marketplace status of a folder, the only thing that needs to happen is + // for all observers of the folder to, possibly, change the display label of said folder. + // At least that's the status for the moment so, even if that function seems small, we + // prefer to encapsulate that behavior here. + gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.notifyObservers(); +} + void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) { LLViewerInventoryCategory* cat; diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index f1066a4dc9..1443c186cf 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -58,6 +58,9 @@ void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id); void show_item_original(const LLUUID& item_uuid); void reset_inventory_filter(); +// Just nudge the category in the global inventory to signal that its marketplace status changed +void update_marketplace_category(const LLUUID& cat_id); + void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name); void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& parent_id, const LLUUID& root_copy_id = LLUUID::null); diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index b39889c721..6f35cc217d 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -30,6 +30,7 @@ #include "llagent.h" #include "llhttpclient.h" +#include "llinventoryfunctions.h" #include "llsdserialize.h" #include "lltimer.h" #include "lltrans.h" @@ -596,6 +597,7 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listin else { (it->second).mListingId = listing_id; + update_marketplace_category(folder_id); return true; } } @@ -609,6 +611,7 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID else { (it->second).mActiveVersionFolderId = version_id; + update_marketplace_category(folder_id); return true; } } @@ -622,6 +625,7 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) else { (it->second).mIsActive = activate; + update_marketplace_category(folder_id); return true; } } @@ -631,12 +635,15 @@ void LLMarketplaceData::addTestItem(const LLUUID& folder_id) { llinfos << "Merov : addTestItem, id = " << folder_id << llendl; mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); + update_marketplace_category(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); + update_marketplace_category(folder_id); + update_marketplace_category(version_id); } -- cgit v1.2.3 From b6f51a0e94bc1cfcdc87faf081e520c43fa97042 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 14 Mar 2014 15:30:12 -0700 Subject: DD-2 : Clean up LLMarketplaceData definition --- indra/newview/llmarketplacefunctions.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index c86df08476..00840c6e23 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -113,6 +113,7 @@ private: // * implement the Marketplace API (TBD) // * cache the current Marketplace data (tuples) // * provide methods to get Marketplace data on any inventory item +// * signal marketplace updates to inventory class LLMarketplaceData; // A Marketplace item is known by its tuple @@ -132,7 +133,7 @@ private: LLUUID mActiveVersionFolderId; bool mIsActive; }; -// The folder UUID is used as a key to this map. It could therefore be taken off the object themselves +// Note: the folder UUID is used as a key to this map. It could therefore be taken off the object themselves typedef std::map marketplace_items_list_t; // There's one and only one possible set of Marketplace data per agent and per session @@ -144,14 +145,14 @@ public: bool isEmpty() { return (mMarketplaceItems.size() == 0); } - // Access Marketplace Data : methods return default value if the folder_id can't be found + // Access Marketplace Data : each method returns a default value if the folder_id can't be found bool getActivationState(const LLUUID& folder_id); std::string getListingID(const LLUUID& folder_id); LLUUID getVersionFolderID(const LLUUID& folder_id); bool isListed(const LLUUID& folder_id); // returns true if folder_id is in the items map - // Modify Marketplace Data : methods return true is function succeeded, false if error + // Modify Marketplace Data : each method returns true if the function succeeds, false if error bool setListingID(const LLUUID& folder_id, std::string listing_id); bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); -- 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 +++++++---- indra/newview/llinventorybridge.cpp | 12 ++++++++++-- indra/newview/skins/default/xui/en/strings.xml | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'indra') 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.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 ++++++++++------------ 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') 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.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 --------- indra/newview/llfloateroutbox.h | 1 - .../xui/en/floater_marketplace_listings.xml | 40 ++++------------------ 3 files changed, 6 insertions(+), 52 deletions(-) (limited to 'indra') 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') 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.2.3 From 15c0907942ae2e82876d4aaf25ab342da0bcf61e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 18 Mar 2014 20:59:49 -0700 Subject: DD-50 : Tabs added to the marketplace, fixed XUI, sorting not implemented yet --- .../xui/en/floater_marketplace_listings.xml | 122 ++++++++++----------- .../en/panel_marketplace_listings_inventory.xml | 2 +- 2 files changed, 62 insertions(+), 62 deletions(-) (limited to 'indra') 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 625b71645e..80d6187e1e 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -1,82 +1,82 @@ + Initializing... + - Initializing... - - + - - - Loading... - - - + + Loading... + + + + height="20"> Date: Wed, 19 Mar 2014 09:09:13 -0700 Subject: DD-10 : WIP : Added embryonic tool strip at the top of the marketplace floater --- .../en/panel_marketplace_listings_inventory.xml | 245 +++++++++++---------- 1 file changed, 131 insertions(+), 114 deletions(-) (limited to 'indra') 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 4947cb57a2..89020c7e80 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,121 +1,138 @@ + + + + + - - - - - - - - - - - - + height="340" + halign="center" + tab_height="30" + tab_group="1" + tab_position="top" + tab_min_width="50"> + + + + + + + + + + \ No newline at end of file -- 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 +++++++----- 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') 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 15:17:36 -0700 Subject: DD-50 : Add the filtering code for marketplace prefiltered tabs --- indra/newview/llinventoryfilter.cpp | 66 ++++++++++++++----------------------- 1 file changed, 24 insertions(+), 42 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 284c354fc6..41567c5237 100755 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -132,6 +132,30 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const LLInventoryModelBackgroundFetch::instance().start(folder_id); } + // Marketplace folder filtering + const U32 filterTypes = mFilterOps.mFilterTypes; + if (filterTypes & FILTERTYPE_MARKETPLACE_ACTIVE) + { + if (!LLMarketplaceData::instance().getActivationState(folder_id)) + { + return false; + } + } + if (filterTypes & FILTERTYPE_MARKETPLACE_INACTIVE) + { + if (LLMarketplaceData::instance().getActivationState(folder_id)) + { + return false; + } + } + if (filterTypes & FILTERTYPE_MARKETPLACE_UNASSOCIATED) + { + if (!LLMarketplaceData::instance().getListingID(folder_id).empty()) + { + return false; + } + } + // Always check against the clipboard const BOOL passed_clipboard = checkAgainstClipboard(folder_id); @@ -245,48 +269,6 @@ 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; } -- 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 ++++++++++++++++ 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') 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.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 ++++++++++++++++------ 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') 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.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 +- .../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') 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.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/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') 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.2.3 From 48b6a713be449f39b33b3de190b3caccd5ad55a2 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 26 Mar 2014 10:55:42 -0700 Subject: DD-10 : Make the filter tool works in All tab and finished refactor --- indra/newview/llfloatermarketplacelistings.cpp | 247 +++++++++++---------- indra/newview/llfloatermarketplacelistings.h | 33 ++- .../xui/en/floater_marketplace_listings.xml | 8 +- .../skins/default/xui/en/menu_marketplace_view.xml | 12 +- 4 files changed, 164 insertions(+), 136 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 64f95c4a1a..ca2a1d54fc 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -35,7 +35,6 @@ #include "llinventorybridge.h" #include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" -#include "llinventorypanel.h" #include "llmarketplacefunctions.h" #include "llnotificationhandler.h" #include "llnotificationmanager.h" @@ -46,6 +45,109 @@ #include "llviewernetwork.h" #include "llwindowshade.h" +///---------------------------------------------------------------------------- +/// LLPanelMarketplaceListings +///---------------------------------------------------------------------------- + +static LLPanelInjector t_panel_status("llpanelmarketplacelistings"); + +LLPanelMarketplaceListings::LLPanelMarketplaceListings() +: mAllPanel(NULL) +, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) +, mFilterType(LLInventoryFilter::FILTERTYPE_NONE) +{ + mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemClicked, this, _2)); + mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemCheck, this, _2)); +} + +BOOL LLPanelMarketplaceListings::postBuild() +{ + mAllPanel = getChild("All Items"); + + // Set the sort order newest to oldest + LLInventoryPanel* panel = getChild("All Items"); + panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + panel->getFilter().markDefault(); + + // Set filters on the 3 prefiltered panels + panel = getChild("Active Items"); + panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + panel->getFilter().setFilterMarketplaceActiveFolders(); + panel->getFilter().markDefault(); + panel = getChild("Inactive Items"); + panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + panel->getFilter().setFilterMarketplaceInactiveFolders(); + panel->getFilter().markDefault(); + panel = getChild("Unassociated Items"); + panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + panel->getFilter().setFilterMarketplaceUnassociatedFolders(); + panel->getFilter().markDefault(); + + return LLPanel::postBuild(); +} + +void LLPanelMarketplaceListings::draw() +{ + LLPanel::draw(); +} + +void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata) +{ + std::string chosen_item = userdata.asString(); + + llinfos << "Merov : MenuItemClicked, item = " << chosen_item << 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); + mAllPanel->getFolderViewModel()->setSorter(mSortOrder); + } + // View/filter options + else if (chosen_item == "show_all") + { + mFilterType = LLInventoryFilter::FILTERTYPE_NONE; + mAllPanel->getFilter().resetDefault(); + } + else if (chosen_item == "show_unassociated") + { + mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_UNASSOCIATED; + mAllPanel->getFilter().resetDefault(); + mAllPanel->getFilter().setFilterMarketplaceUnassociatedFolders(); + } + else if (chosen_item == "show_active") + { + mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_ACTIVE; + mAllPanel->getFilter().resetDefault(); + mAllPanel->getFilter().setFilterMarketplaceActiveFolders(); + } + else if (chosen_item == "show_inactive") + { + mFilterType = LLInventoryFilter::FILTERTYPE_MARKETPLACE_INACTIVE; + mAllPanel->getFilter().resetDefault(); + mAllPanel->getFilter().setFilterMarketplaceInactiveFolders(); + } +} + +bool LLPanelMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata) +{ + std::string chosen_item = userdata.asString(); + + llinfos << "Merov : MenuItemCheck, item = " << chosen_item << ", filter type = " << mFilterType << llendl; + + 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_unassociated") + return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_UNASSOCIATED; + if (chosen_item == "show_active") + return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_ACTIVE; + if (chosen_item == "show_inactive") + return mFilterType == LLInventoryFilter::FILTERTYPE_MARKETPLACE_INACTIVE; + return false; +} + ///---------------------------------------------------------------------------- /// LLMarketplaceListingsAddedObserver helper class ///---------------------------------------------------------------------------- @@ -92,11 +194,8 @@ LLFloaterMarketplaceListings::LLFloaterMarketplaceListings(const LLSD& key) , mInventoryPlaceholder(NULL) , mInventoryText(NULL) , mInventoryTitle(NULL) -, mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) -, mFilterType(LLInventoryFilter::FILTERTYPE_NONE) +, mPanelListings(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() @@ -122,6 +221,8 @@ BOOL LLFloaterMarketplaceListings::postBuild() mInventoryText = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_text"); mInventoryTitle = mInventoryPlaceholder->getChild("marketplace_listings_inventory_placeholder_title"); + mPanelListings = static_cast(getChild("panel_marketplace_listing")); + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterMarketplaceListings::onFocusReceived, this)); // Observe category creation to catch marketplace listings creation (moot if already existing) @@ -135,16 +236,6 @@ BOOL LLFloaterMarketplaceListings::postBuild() 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) { } @@ -202,71 +293,6 @@ 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()) @@ -325,34 +351,15 @@ void LLFloaterMarketplaceListings::setup() 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); + // Set up the marketplace listings panel view + //LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + //LLPanelMarketplaceListings* panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLPanel::child_registry_t::instance()); + //mPanelListings = panel; // Reshape the inventory to the proper size - LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - inventory_panel->setShape(inventory_placeholder_rect); + //LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); + //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(); } @@ -375,7 +382,7 @@ void LLFloaterMarketplaceListings::initializeMarketPlace() S32 LLFloaterMarketplaceListings::getFolderCount() { - if (mInventoryPanel.get() && mRootFolderId.notNull()) + if (mPanelListings && mRootFolderId.notNull()) { LLInventoryModel::cat_array_t * cats; LLInventoryModel::item_array_t * items; @@ -395,19 +402,17 @@ void LLFloaterMarketplaceListings::setStatusString(const std::string& statusStri } void LLFloaterMarketplaceListings::updateView() -{ - LLInventoryPanel* panel = mInventoryPanel.get(); - +{ if (getFolderCount() > 0) { - panel->setVisible(TRUE); + mPanelListings->setVisible(TRUE); mInventoryPlaceholder->setVisible(FALSE); } else { - if (panel) + if (mPanelListings) { - panel->setVisible(FALSE); + mPanelListings->setVisible(FALSE); } std::string text; @@ -421,7 +426,7 @@ void LLFloaterMarketplaceListings::updateView() if (mRootFolderId.notNull()) { // Does the outbox needs recreation? - if ((panel == NULL) || !gInventory.getCategory(mRootFolderId)) + if (!mPanelListings || !gInventory.getCategory(mRootFolderId)) { setup(); } @@ -471,7 +476,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO EAcceptance* accept, std::string& tooltip_msg) { - if ((mInventoryPanel.get() == NULL) || mRootFolderId.isNull()) + if (!mPanelListings || mRootFolderId.isNull()) { return FALSE; } @@ -482,16 +487,15 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO // 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()) + LLFolderView* root_folder = mPanelListings->getRootFolder(); + if (mPanelListings->getVisible()) { S32 inv_x, inv_y; - localPointToOtherView(x, y, &inv_x, &inv_y, panel); + localPointToOtherView(x, y, &inv_x, &inv_y, mPanelListings); - pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y); + pointInInventoryPanel = mPanelListings->getRect().pointInRect(inv_x, inv_y); - LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true); + LLView * inventory_panel_child_at_point = mPanelListings->childFromPoint(inv_x, inv_y, true); pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder); } @@ -529,7 +533,8 @@ void LLFloaterMarketplaceListings::onChanged() } else { - clean(); + // Invalidate the outbox data + mRootFolderId.setNull(); } } diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index fab2040deb..9ae665f74d 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -29,19 +29,42 @@ #include "llfloater.h" #include "llfoldertype.h" +#include "llfolderview.h" #include "llinventoryfilter.h" +#include "llinventorypanel.h" #include "llnotificationptr.h" class LLButton; class LLInventoryCategoriesObserver; class LLInventoryCategoryAddedObserver; -class LLInventoryPanel; class LLLoadingIndicator; class LLNotification; class LLTextBox; class LLView; class LLWindowShade; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLPanelMarketplaceListings +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLPanelMarketplaceListings : public LLPanel +{ +public: + LLPanelMarketplaceListings(); + BOOL postBuild(); + void draw(); + LLFolderView* getRootFolder() { return mAllPanel->getRootFolder(); } // *TODO : Suppress and get DnD in here instead... + +private: + // UI callbacks + void onViewSortMenuItemClicked(const LLSD& userdata); + bool onViewSortMenuItemCheck(const LLSD& userdata); + + LLInventoryPanel* mAllPanel; + LLInventoryFilter::ESortOrderType mSortOrder; + LLInventoryFilter::EFilterType mFilterType; +}; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLFloaterMarketplaceListings //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -69,7 +92,6 @@ public: protected: void setup(); - void clean(); void fetchContents(); void importReportResults(U32 status, const LLSD& content); @@ -88,9 +110,6 @@ protected: private: S32 getFolderCount(); - // UI callbacks - void onViewSortMenuItemClicked(const LLSD& userdata); - bool onViewSortMenuItemCheck(const LLSD& userdata); LLInventoryCategoriesObserver * mCategoriesObserver; LLInventoryCategoryAddedObserver * mCategoryAddedObserver; @@ -102,9 +121,7 @@ private: LLTextBox * mInventoryTitle; LLUUID mRootFolderId; - LLHandle mInventoryPanel; - LLInventoryFilter::ESortOrderType mSortOrder; - LLInventoryFilter::EFilterType mFilterType; + LLPanelMarketplaceListings * mPanelListings; }; #endif // LL_LLFLOATERMARKETPLACELISTINGS_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 80d6187e1e..0f511c4a66 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -64,7 +64,13 @@ wrap="true" halign="left" /> - + + - + + parameter="show_unassociated" /> + parameter="show_unassociated" /> - + + parameter="show_inactive" /> + parameter="show_inactive" /> -- cgit v1.2.3 From 1a03f7f6052fc02f4ecc3da85bd0f0d54df21fd1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 26 Mar 2014 17:15:27 -0700 Subject: DD-40 : A bit more on marketplace listings refactoring and code cleaning (and clearing) --- indra/newview/llfloatermarketplacelistings.cpp | 56 ++++++-------------------- indra/newview/llfloatermarketplacelistings.h | 7 +--- 2 files changed, 13 insertions(+), 50 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index ca2a1d54fc..00e4ea05f3 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -1,8 +1,7 @@ /** * @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 + * @author merov@lindenlab.com * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -40,10 +39,7 @@ #include "llnotificationmanager.h" #include "llnotificationsutil.h" #include "lltextbox.h" -#include "lltransientfloatermgr.h" #include "lltrans.h" -#include "llviewernetwork.h" -#include "llwindowshade.h" ///---------------------------------------------------------------------------- /// LLPanelMarketplaceListings @@ -243,7 +239,7 @@ void LLFloaterMarketplaceListings::onClose(bool app_quitting) void LLFloaterMarketplaceListings::onOpen(const LLSD& key) { // - // Initialize the Market Place or go update the outbox + // Initialize the Market Place or go update the marketplace listings // if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) { @@ -310,8 +306,8 @@ void LLFloaterMarketplaceListings::setup() } // 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()) + LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true); + if (marketplacelistings_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; @@ -321,15 +317,15 @@ void LLFloaterMarketplaceListings::setup() // 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); + gInventory.consolidateForType(marketplacelistings_id, LLFolderType::FT_MARKETPLACE_LISTINGS); - if (outbox_id == mRootFolderId) + if (marketplacelistings_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; + mRootFolderId = marketplacelistings_id; // No longer need to observe new category creation if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) @@ -351,15 +347,6 @@ void LLFloaterMarketplaceListings::setup() mCategoriesObserver->addCategory(mRootFolderId, boost::bind(&LLFloaterMarketplaceListings::onChanged, this)); llassert(mCategoriesObserver); - // Set up the marketplace listings panel view - //LLPanel* inventory_panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); - //LLPanelMarketplaceListings* panel = LLUICtrlFactory::createFromFile("panel_marketplace_listings.xml", mInventoryPlaceholder->getParent(), LLPanel::child_registry_t::instance()); - //mPanelListings = panel; - - // Reshape the inventory to the proper size - //LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - //panel->setShape(inventory_placeholder_rect); - // Get the content of the marketplace listings folder fetchContents(); } @@ -425,7 +412,7 @@ void LLFloaterMarketplaceListings::updateView() // *TODO : check those messages and create better appropriate ones in strings.xml if (mRootFolderId.notNull()) { - // Does the outbox needs recreation? + // Does the marketplace listings folder needs recreation? if (!mPanelListings || !gInventory.getCategory(mRootFolderId)) { setup(); @@ -484,30 +471,11 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO 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; - LLFolderView* root_folder = mPanelListings->getRootFolder(); - if (mPanelListings->getVisible()) - { - S32 inv_x, inv_y; - localPointToOtherView(x, y, &inv_x, &inv_y, mPanelListings); - - pointInInventoryPanel = mPanelListings->getRect().pointInRect(inv_x, inv_y); - - LLView * inventory_panel_child_at_point = mPanelListings->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 + // Pass all drag and drop for this floater to the marketplace listings 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); - } + LLFolderView* root_folder = mPanelListings->getRootFolder(); + handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } return handled; @@ -533,7 +501,7 @@ void LLFloaterMarketplaceListings::onChanged() } else { - // Invalidate the outbox data + // Invalidate the marketplace listings data mRootFolderId.setNull(); } } diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index 9ae665f74d..0eddd636e8 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -1,6 +1,7 @@ /** * @file llfloatermarketplacelistings.h * @brief Implementation of the marketplace listings floater and panels + * @author merov@lindenlab.com * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -28,20 +29,14 @@ #define LL_LLFLOATERMARKETPLACELISTINGS_H #include "llfloater.h" -#include "llfoldertype.h" -#include "llfolderview.h" #include "llinventoryfilter.h" #include "llinventorypanel.h" #include "llnotificationptr.h" -class LLButton; class LLInventoryCategoriesObserver; class LLInventoryCategoryAddedObserver; -class LLLoadingIndicator; -class LLNotification; class LLTextBox; class LLView; -class LLWindowShade; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPanelMarketplaceListings -- cgit v1.2.3 From 2f1bef16dc4549993db581ce410924c9b9966341 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 27 Mar 2014 10:53:50 -0700 Subject: DD-40 : Fix display of message when marketplace listings folder empty, clean up spam in log --- indra/newview/llfloatermarketplacelistings.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 00e4ea05f3..814f1b218a 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -91,8 +91,6 @@ void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata) { std::string chosen_item = userdata.asString(); - llinfos << "Merov : MenuItemClicked, item = " << chosen_item << llendl; - // Sort options if (chosen_item == "sort_by_stock_amount") { @@ -129,8 +127,6 @@ bool LLPanelMarketplaceListings::onViewSortMenuItemCheck(const LLSD& userdata) { std::string chosen_item = userdata.asString(); - llinfos << "Merov : MenuItemCheck, item = " << chosen_item << ", filter type = " << mFilterType << llendl; - if (chosen_item == "sort_by_stock_amount") return mSortOrder == LLInventoryFilter::SO_FOLDERS_BY_WEIGHT; if (chosen_item == "show_all") @@ -397,10 +393,8 @@ void LLFloaterMarketplaceListings::updateView() } else { - if (mPanelListings) - { - mPanelListings->setVisible(FALSE); - } + mPanelListings->setVisible(FALSE); + mInventoryPlaceholder->setVisible(TRUE); std::string text; std::string title; -- cgit v1.2.3 From 0ec8fbec6deaa24506391ef239c50009eebe1eef Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Mar 2014 15:54:36 -0700 Subject: DD-24 : Add FT_MARKETPLACE_STOCK as a new type for folders, implement the promotion code for Drag and Drop, display of stock folders and embryonic marketplace validation --- indra/llcommon/llfoldertype.cpp | 1 + indra/llcommon/llfoldertype.h | 1 + indra/newview/llinventorybridge.cpp | 56 ++++++++-- indra/newview/llinventoryfunctions.cpp | 149 +++++++++++++++++++++++++ indra/newview/llinventoryfunctions.h | 6 +- indra/newview/llinventorymodel.cpp | 4 +- indra/newview/llinventorypanel.cpp | 1 + indra/newview/llviewerfoldertype.cpp | 3 +- indra/newview/skins/default/xui/en/strings.xml | 1 + 9 files changed, 210 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp index 5b80189d2a..afa9e59832 100755 --- a/indra/llcommon/llfoldertype.cpp +++ b/indra/llcommon/llfoldertype.cpp @@ -98,6 +98,7 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new FolderEntry("merchant", FALSE)); + addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new FolderEntry("stock", FALSE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index 91dc1da543..20925eede0 100644 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -88,6 +88,7 @@ public: FT_BASIC_ROOT = 52, FT_MARKETPLACE_LISTINGS = 53, + FT_MARKETPLACE_STOCK = 54, FT_COUNT, diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 3d418105e3..d0abe6db29 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1958,7 +1958,7 @@ std::string LLFolderBridge::getLabelSuffix() const { if (LLMarketplaceData::instance().isListed(getUUID())) { - llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; + //llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; std::string suffix = LLMarketplaceData::instance().getListingID(getUUID()); if (suffix.empty()) { @@ -1971,9 +1971,15 @@ std::string LLFolderBridge::getLabelSuffix() const } return LLInvFVBridge::getLabelSuffix() + suffix; } + else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + //llinfos << "Merov : in merchant folder and is a stock folder : id = " << getUUID() << llendl; + std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ")"; + return LLInvFVBridge::getLabelSuffix() + suffix; + } else { - llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; + //llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; return LLInvFVBridge::getLabelSuffix(); } } @@ -2316,10 +2322,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const LLUUID &cat_id = inv_cat->getUUID(); const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -2499,6 +2508,12 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } } + if (is_movable && move_is_into_marketplacelistings) + { + // *TODO : Merov : Add here the logic to prevent huge nesting in marketplace listings + // For the moment, we just take in anything + is_movable = TRUE; + } if (is_movable) { @@ -2601,6 +2616,10 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId()); } + else if (move_is_into_marketplacelistings && !move_is_from_marketplacelistings) + { + move_folder_to_marketplacelistings(inv_cat, mUUID); + } else { if (model->isObjectDescendentOf(cat_id, model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false))) @@ -2620,7 +2639,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else if (LLToolDragAndDrop::SOURCE_WORLD == source) { - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -2632,7 +2651,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else if (LLToolDragAndDrop::SOURCE_LIBRARY == source) { - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -3248,6 +3267,9 @@ void LLFolderBridge::pasteFromClipboard() const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); + // *TODO : Add marketplace listings case + //const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + //const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); LLDynamicArray objects; LLClipboard::instance().pasteFromClipboard(objects); @@ -3372,12 +3394,14 @@ void LLFolderBridge::pasteLinkFromClipboard() { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { // Notify user of failure somehow -- play error sound? modal dialog? return; @@ -4047,6 +4071,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false); const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_favorites = (mUUID == favorites_id); @@ -4054,6 +4079,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_item->getUUID(), outbox_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL accept = FALSE; @@ -4150,6 +4176,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } } } + else if (move_is_into_marketplacelistings) + { + // *TODO : Add here any logic that may prevent an item to be copied into the marketplace listings + // For the moment, we let anything go + accept = TRUE; + } LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); @@ -4208,6 +4240,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { dropToOutfit(inv_item, move_is_into_current_outfit); } + // MERCHANT OUTBOX folder + // Move the item else if (move_is_into_outbox) { if (move_is_from_outbox) @@ -4219,6 +4253,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, copy_item_to_outbox(inv_item, mUUID, LLUUID::null, LLToolDragAndDrop::getOperationId()); } } + // MARKETPLACE LISTINGS folder + // Move the item + else if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(inv_item, mUUID); + } // NORMAL or TRASH folder // (move the item, restamp if into trash) else @@ -4285,7 +4325,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { accept = FALSE; } - else if (move_is_into_outbox) + else if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -4323,7 +4363,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else if(LLToolDragAndDrop::SOURCE_NOTECARD == source) { - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; @@ -4357,7 +4397,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { accept = TRUE; - if (move_is_into_outbox) + if (move_is_into_outbox || move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); accept = FALSE; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 203eb4ec4e..fe55f8955f 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -686,6 +686,155 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold open_outbox(); } +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder) +{ + // Collapse links into items/folders + LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item; + LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); + + if (linked_category != NULL) + { + // Move the linked folder directly + move_folder_to_marketplacelistings(linked_category, dest_folder); + } + else + { + // Grab the linked item if any + LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem(); + viewer_inv_item = (linked_item != NULL ? linked_item : viewer_inv_item); + + // Check that the agent has copy permission on the item: this is required as a resident cannot + // put on sale items she has no right about. Proceed with move if we have permission. + // *TODO : Check that this is adequate (copied from the Merchant Outbox permission check so should be OK...) + if (viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + // When moving an isolated item directly under the marketplace listings root, we create a new folder with that name + if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false)) + { + // *TODO : This method is not specific to the outbox folder so make it more generic + dest_folder = create_folder_in_outbox_for_item(inv_item, dest_folder, 0); + } + + // Reparent the item + gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + + // Check the item for no copy permission and promote the destination folder if necessary + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY)) + { + llinfos << "Merov : item is no copy -> change the destination folder type!" << llendl; + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (gInventory.getCategory(dest_folder)); + viewer_cat->changeType(LLFolderType::FT_MARKETPLACE_STOCK); + } + } + else + { + // *TODO : signal an error to the user (UI for this TBD) + llinfos << "Merov : user doesn't have the correct permission to put this item on sale -> move aborted!" << llendl; + } + } +} + +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder) +{ + // Check that we have adequate permission on all items being moved. Proceed if we do. + if (has_correct_permissions_for_sale(inv_cat)) + { + + // Reparent the folder + LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; + gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + + // Check the destination folder recursively for no copy items and promote the including folders if any + validate_marketplacelistings(inv_cat); + } +} + +// Returns true if all items within the argument folder are fit for sale, false otherwise +bool has_correct_permissions_for_sale(LLInventoryCategory* cat) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); + + LLInventoryModel::item_array_t item_array_copy = *item_array; + + for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) + { + LLInventoryItem* item = *iter; + LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) item; + LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); + LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem(); + // Linked items and folders cannot be put for sale + if (linked_category || linked_item) + { + llinfos << "Merov : linked items in this folder -> not allowed to sell!" << llendl; + return false; + } + // *TODO : Check that this is adequate (copied from the Merchant Outbox permission check so should be OK...) + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + llinfos << "Merov : wrong permissions on items in this folder -> not allowed to sell!" << llendl; + return false; + } + } + + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + if (!has_correct_permissions_for_sale(category)) + { + return false; + } + } + return true; +} + +// Make all relevant business logic checks on the marketplace listings starting with the folder as argument +// This function does no deletion or move but a mere audit and raises issues to the user +// The only thing that's done is to modify the type of folders containing no-copy items to stock folders +// *TODO : Signal the errors to the user somewhat (UI still TBD) +// *TODO : Add the rest of the SLM/AIS business logic (limit of nesting depth, stock folder consistency, overall limit on listings, etc...) +void validate_marketplacelistings(LLInventoryCategory* cat) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); + + LLInventoryModel::item_array_t item_array_copy = *item_array; + + for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) + { + LLInventoryItem* item = *iter; + LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) item; + LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); + LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem(); + if (linked_category || linked_item) + { + llinfos << "Merov : Validation error: there are linked items in this listing!" << llendl; + } + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + llinfos << "Merov : Validation error: there are items with incorrect permissions in this listing!" << llendl; + } + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY)) + { + llinfos << "Merov : Validation warning : item is no copy -> change the folder type to stock!" << llendl; + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); + viewer_cat->changeType(LLFolderType::FT_MARKETPLACE_STOCK); + } + } + + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + validate_marketplacelistings(category); + } +} + ///---------------------------------------------------------------------------- /// LLInventoryCollectFunctor implementations ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 1443c186cf..006cc3de68 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -70,9 +70,13 @@ void append_path(const LLUUID& id, std::string& path); void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder, S32 operation_id); void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id); - void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id); +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder); +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder); +bool has_correct_permissions_for_sale(LLInventoryCategory* cat); +void validate_marketplacelistings(LLInventoryCategory* inv_cat); + /** Miscellaneous global functions ** ** *******************************************************************************/ diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ed7fd3cd34..37e11123c6 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2160,12 +2160,12 @@ void LLInventoryModel::buildParentChildMap() // implement it, we would need a set or map of uuid pairs // which would be (folder_id, new_parent_id) to be sent up // to the server. - llinfos << "Lost categroy: " << cat->getUUID() << " - " + llinfos << "Lost category: " << cat->getUUID() << " - " << cat->getName() << llendl; ++lost; // plop it into the lost & found. LLFolderType::EType pref = cat->getPreferredType(); - if(LLFolderType::FT_NONE == pref) + if ((LLFolderType::FT_NONE == pref) || (LLFolderType::FT_MARKETPLACE_STOCK == pref)) { cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index bf8f7819ef..6305275a08 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1491,5 +1491,6 @@ namespace LLInitParam 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_MARKETPLACE_LISTINGS) , LLFolderType::FT_MARKETPLACE_LISTINGS); + declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_STOCK), LLFolderType::FT_MARKETPLACE_STOCK); } } diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index ee8f85782f..b82f954e91 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -142,7 +142,8 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "Inv_SysOpen", "Inv_SysClosed", FALSE, true)); addEntry(LLFolderType::FT_MARKETPLACE_LISTINGS, new ViewerFolderEntry("Marketplace listings", "Inv_SysOpen", "Inv_SysClosed", FALSE, boxes_invisible)); - + addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new ViewerFolderEntry("New Stock", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); + addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false, "default")); #if SUPPORT_ENSEMBLES diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 80b520622a..ce9bbbc8d2 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2273,6 +2273,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. no Mkt ID live + stock Open landmarks -- cgit v1.2.3 From e624e6ab9ea8c27c2649f6f0391b0f7d1362fda3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 31 Mar 2014 15:00:14 -0700 Subject: DD-24 : Make stock folder really work and stick. Improve validation. Handle edge cases when moving under root --- indra/newview/llinventoryfunctions.cpp | 70 +++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 22 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index fe55f8955f..de7a79502d 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -521,14 +521,17 @@ void open_outbox() LLFloaterReg::showInstance("outbox"); } -LLUUID create_folder_in_outbox_for_item(LLInventoryItem* item, const LLUUID& destFolderId, S32 operation_id) +// Create a new folder in destFolderId with the same name as the item name and return the uuid of the new folder +// Note: this is used locally in various situation where we need to wrap an item into a special folder +LLUUID create_folder_for_item(LLInventoryItem* item, const LLUUID& destFolderId) { llassert(item); llassert(destFolderId.notNull()); LLUUID created_folder_id = gInventory.createNewCategory(destFolderId, LLFolderType::FT_NONE, item->getName()); gInventory.notifyObservers(); - + + // *TODO : Create different notifications for the various cases LLNotificationsUtil::add("OutboxFolderCreated"); return created_folder_id; @@ -544,8 +547,7 @@ void move_to_outbox_cb_action(const LLSD& payload) // when moving item directly into outbox create folder with that name if (dest_folder_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false)) { - S32 operation_id = payload["operation_id"].asInteger(); - dest_folder_id = create_folder_in_outbox_for_item(viitem, dest_folder_id, operation_id); + dest_folder_id = create_folder_for_item(viitem, dest_folder_id); } LLUUID parent = viitem->getParentUUID(); @@ -616,7 +618,7 @@ void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LL // when moving item directly into outbox create folder with that name if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false)) { - dest_folder = create_folder_in_outbox_for_item(inv_item, dest_folder, operation_id); + dest_folder = create_folder_for_item(inv_item, dest_folder); } copy_inventory_item(gAgent.getID(), @@ -646,7 +648,7 @@ void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 // when moving item directly into outbox create folder with that name if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false)) { - dest_folder = create_folder_in_outbox_for_item(inv_item, dest_folder, operation_id); + dest_folder = create_folder_for_item(inv_item, dest_folder); } LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item; @@ -688,7 +690,15 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder) { - // Collapse links into items/folders + // Get the marketplace listings, exit with error if none + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + if (marketplace_listings_uuid.isNull()) + { + llinfos << "Merov : Marketplace error : There is no marketplace listings folder -> move aborted!" << llendl; + return; + } + + // We will collapse links into items/folders LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item; LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory(); @@ -709,27 +719,28 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) { // When moving an isolated item directly under the marketplace listings root, we create a new folder with that name - if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false)) + if (dest_folder == marketplace_listings_uuid) + { + dest_folder = create_folder_for_item(inv_item, dest_folder); + } + LLViewerInventoryCategory* category = gInventory.getCategory(dest_folder); + + // When moving a no copy item into a first level listing folder, we create a stock folder for it + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (category->getParentUUID() == marketplace_listings_uuid)) { - // *TODO : This method is not specific to the outbox folder so make it more generic - dest_folder = create_folder_in_outbox_for_item(inv_item, dest_folder, 0); + dest_folder = create_folder_for_item(inv_item, dest_folder); } // Reparent the item gInventory.changeItemParent(viewer_inv_item, dest_folder, false); - // Check the item for no copy permission and promote the destination folder if necessary - if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY)) - { - llinfos << "Merov : item is no copy -> change the destination folder type!" << llendl; - LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (gInventory.getCategory(dest_folder)); - viewer_cat->changeType(LLFolderType::FT_MARKETPLACE_STOCK); - } + // Validate the destination : note that this will run the validation code only on one listing folder at most... + validate_marketplacelistings(category); } else { // *TODO : signal an error to the user (UI for this TBD) - llinfos << "Merov : user doesn't have the correct permission to put this item on sale -> move aborted!" << llendl; + llinfos << "Merov : Marketplace error : User doesn't have the correct permission to put this item on sale -> move aborted!" << llendl; } } } @@ -802,6 +813,10 @@ void validate_marketplacelistings(LLInventoryCategory* cat) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); + const LLFolderType::EType folder_type = cat->getPreferredType(); + LLUUID stock_folder; + LLInventoryModel::item_array_t item_array_copy = *item_array; for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) @@ -818,14 +833,25 @@ void validate_marketplacelistings(LLInventoryCategory* cat) { llinfos << "Merov : Validation error: there are items with incorrect permissions in this listing!" << llendl; } - if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY)) + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (folder_type != LLFolderType::FT_MARKETPLACE_STOCK)) { - llinfos << "Merov : Validation warning : item is no copy -> change the folder type to stock!" << llendl; - LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); - viewer_cat->changeType(LLFolderType::FT_MARKETPLACE_STOCK); + llinfos << "Merov : Validation warning : no copy item found in non stock folder -> reparent to relevant stock folder!" << llendl; + if (stock_folder.isNull()) + { + llinfos << "Merov : Validation warning : no appropriate existing stock folder -> create a new stock folder!" << llendl; + stock_folder = gInventory.createNewCategory(viewer_cat->getParentUUID(), LLFolderType::FT_MARKETPLACE_STOCK, viewer_cat->getName()); + } + gInventory.changeItemParent(viewer_inv_item, stock_folder, false); } } + if (stock_folder.notNull() && (viewer_cat->getDescendentCount() == 0)) + { + llinfos << "Merov : Validation warning : folder content completely moved to stock folder -> remove empty folder!" << llendl; + gInventory.removeCategory(cat->getUUID()); + return; + } + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) -- cgit v1.2.3 From ec290cd059d80519ff6891149306586819ac008d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 31 Mar 2014 16:17:10 -0700 Subject: DD-18 : WIP : Implement stock folder counting but no propagation so far, also update is not working --- indra/newview/llinventorybridge.cpp | 5 +++-- indra/newview/llinventoryfunctions.cpp | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d0abe6db29..bf56be320f 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1973,8 +1973,9 @@ std::string LLFolderBridge::getLabelSuffix() const } else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { - //llinfos << "Merov : in merchant folder and is a stock folder : id = " << getUUID() << llendl; - std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ")"; + llinfos << "Merov : in merchant folder and is a stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; + std::string stock = llformat("%d", getCategory()->getDescendentCount()); + std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")"; return LLInvFVBridge::getLabelSuffix() + suffix; } else diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index de7a79502d..5e4fb557d5 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -733,6 +733,8 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Reparent the item gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + gInventory.updateCategory(category); + gInventory.notifyObservers(); // Validate the destination : note that this will run the validation code only on one listing folder at most... validate_marketplacelistings(category); @@ -754,6 +756,8 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + gInventory.updateCategory(viewer_inv_cat); + gInventory.notifyObservers(); // Check the destination folder recursively for no copy items and promote the including folders if any validate_marketplacelistings(inv_cat); @@ -815,7 +819,8 @@ void validate_marketplacelistings(LLInventoryCategory* cat) LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); const LLFolderType::EType folder_type = cat->getPreferredType(); - LLUUID stock_folder; + LLUUID stock_folder_uuid; + LLViewerInventoryCategory* stock_folder_cat = NULL; LLInventoryModel::item_array_t item_array_copy = *item_array; @@ -836,19 +841,24 @@ void validate_marketplacelistings(LLInventoryCategory* cat) if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (folder_type != LLFolderType::FT_MARKETPLACE_STOCK)) { llinfos << "Merov : Validation warning : no copy item found in non stock folder -> reparent to relevant stock folder!" << llendl; - if (stock_folder.isNull()) + if (stock_folder_uuid.isNull()) { llinfos << "Merov : Validation warning : no appropriate existing stock folder -> create a new stock folder!" << llendl; - stock_folder = gInventory.createNewCategory(viewer_cat->getParentUUID(), LLFolderType::FT_MARKETPLACE_STOCK, viewer_cat->getName()); + stock_folder_uuid = gInventory.createNewCategory(viewer_cat->getParentUUID(), LLFolderType::FT_MARKETPLACE_STOCK, viewer_cat->getName()); + stock_folder_cat = gInventory.getCategory(stock_folder_uuid); } - gInventory.changeItemParent(viewer_inv_item, stock_folder, false); + gInventory.changeItemParent(viewer_inv_item, stock_folder_uuid, false); + gInventory.updateCategory(viewer_cat); + gInventory.updateCategory(stock_folder_cat); + gInventory.notifyObservers(); } } - if (stock_folder.notNull() && (viewer_cat->getDescendentCount() == 0)) + if (stock_folder_uuid.notNull() && (viewer_cat->getDescendentCount() == 0)) { llinfos << "Merov : Validation warning : folder content completely moved to stock folder -> remove empty folder!" << llendl; gInventory.removeCategory(cat->getUUID()); + gInventory.notifyObservers(); return; } -- cgit v1.2.3 From 69fb50322eb0de9071ed22d4e62cef11ae811c4d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 31 Mar 2014 20:24:41 -0700 Subject: DD-18 : WIP : Making stock folders update work better --- indra/newview/llinventoryfunctions.cpp | 31 ++++++++++++++++++++++++------- indra/newview/llinventorymodel.cpp | 10 ++++++++-- 2 files changed, 32 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 5e4fb557d5..17bcd333f8 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -723,21 +723,28 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol { dest_folder = create_folder_for_item(inv_item, dest_folder); } - LLViewerInventoryCategory* category = gInventory.getCategory(dest_folder); + LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); // When moving a no copy item into a first level listing folder, we create a stock folder for it - if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (category->getParentUUID() == marketplace_listings_uuid)) + if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (dest_cat->getParentUUID() == marketplace_listings_uuid)) { dest_folder = create_folder_for_item(inv_item, dest_folder); } + // Get the parent folder of the moved item : we may have to update it + LLUUID src_folder = viewer_inv_item->getParentUUID(); + LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); + // Reparent the item gInventory.changeItemParent(viewer_inv_item, dest_folder, false); - gInventory.updateCategory(category); + + // Update the modified folders + gInventory.updateCategory(src_cat); + gInventory.updateCategory(dest_cat); gInventory.notifyObservers(); // Validate the destination : note that this will run the validation code only on one listing folder at most... - validate_marketplacelistings(category); + validate_marketplacelistings(dest_cat); } else { @@ -752,15 +759,25 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Check that we have adequate permission on all items being moved. Proceed if we do. if (has_correct_permissions_for_sale(inv_cat)) { - + // Get the destination folder + // *TODO : check that this folder is not full of no-copy items under its root... + LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); + + // Get the parent folder of the moved item : we may have to update it + LLUUID src_folder = inv_cat->getParentUUID(); + LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); + // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); - gInventory.updateCategory(viewer_inv_cat); + + // Update the modified folders + gInventory.updateCategory(src_cat); + gInventory.updateCategory(dest_cat); gInventory.notifyObservers(); // Check the destination folder recursively for no copy items and promote the including folders if any - validate_marketplacelistings(inv_cat); + validate_marketplacelistings(dest_cat); } } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 37e11123c6..96a2db5afb 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1027,7 +1027,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) LLViewerInventoryCategory* old_cat = getCategory(cat->getUUID()); if(old_cat) { - // We already have an old category, modify it's values + // We already have an old category, modify its values U32 mask = LLInventoryObserver::NONE; LLUUID old_parent_id = old_cat->getParentUUID(); LLUUID new_parent_id = cat->getParentUUID(); @@ -1052,7 +1052,13 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { mask |= LLInventoryObserver::LABEL; } - old_cat->copyViewerCategory(cat); + // Under marketplace, category labels are quite complex and need extra upate + const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) + { + mask |= LLInventoryObserver::LABEL; + } + old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } else -- cgit v1.2.3 From f66de28a7cf735df15d167df270943547bdbde81 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 1 Apr 2014 21:41:18 -0700 Subject: DD-20 : WIP : Implemented the cut and paste code for marketplace. Stock update still not working as expected. --- indra/newview/llinventorybridge.cpp | 90 +++++++++++++++++++++++----------- indra/newview/llinventoryfunctions.cpp | 47 +++++++++++++++--- indra/newview/llinventoryfunctions.h | 4 +- indra/newview/llinventorymodel.cpp | 3 ++ 4 files changed, 105 insertions(+), 39 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bf56be320f..5462b2bef4 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3264,13 +3264,12 @@ void LLFolderBridge::pasteFromClipboard() { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); - // *TODO : Add marketplace listings case - //const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - //const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); + const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); LLDynamicArray objects; LLClipboard::instance().pasteFromClipboard(objects); @@ -3342,21 +3341,35 @@ void LLFolderBridge::pasteFromClipboard() LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id); llassert(vicat); if (vicat) - { - //changeCategoryParent() implicity calls dirtyFilter - changeCategoryParent(model, vicat, parent_id, FALSE); + { + if (move_is_into_marketplacelistings) + { + move_folder_to_marketplacelistings(vicat, parent_id); + } + else + { + //changeCategoryParent() implicity calls dirtyFilter + changeCategoryParent(model, vicat, parent_id, FALSE); + } } } else - { - LLViewerInventoryItem* viitem = dynamic_cast(item); - llassert(viitem); - if (viitem) - { - //changeItemParent() implicity calls dirtyFilter - changeItemParent(model, viitem, parent_id, FALSE); - } - } + { + LLViewerInventoryItem* viitem = dynamic_cast(item); + llassert(viitem); + if (viitem) + { + if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(viitem, parent_id); + } + else + { + //changeItemParent() implicity calls dirtyFilter + changeItemParent(model, viitem, parent_id, FALSE); + } + } + } } else { @@ -3367,22 +3380,41 @@ void LLFolderBridge::pasteFromClipboard() llassert(vicat); if (vicat) { - copy_inventory_category(model, vicat, parent_id); + if (move_is_into_marketplacelistings) + { + move_folder_to_marketplacelistings(vicat, parent_id, true); + } + else + { + copy_inventory_category(model, vicat, parent_id); + } } } - else - { - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - parent_id, - std::string(), - LLPointer(NULL)); - } - } - } - } + else + { + LLViewerInventoryItem* viitem = dynamic_cast(item); + llassert(viitem); + if (viitem) + { + if (move_is_into_marketplacelistings) + { + move_item_to_marketplacelistings(viitem, parent_id, true); + } + else + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + parent_id, + std::string(), + LLPointer(NULL)); + } + } + } + } + } + } // Change mode to paste for next paste LLClipboard::instance().setCutMode(false); } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 17bcd333f8..8216830336 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -688,7 +688,15 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold open_outbox(); } -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder) +///---------------------------------------------------------------------------- +// Marketplace functions +// +// Handles Copy and Move to or within the Marketplace listings folder. +// Handles creation of stock folders, nesting of listings and version folders, +// permission checking and listings validation. +///---------------------------------------------------------------------------- + +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); @@ -705,7 +713,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (linked_category != NULL) { // Move the linked folder directly - move_folder_to_marketplacelistings(linked_category, dest_folder); + move_folder_to_marketplacelistings(linked_category, dest_folder, copy); } else { @@ -733,10 +741,25 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = viewer_inv_item->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); + LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); - // Reparent the item - gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + if (copy) + { + // Copy the item + copy_inventory_item( + gAgent.getID(), + viewer_inv_item->getPermissions().getOwner(), + viewer_inv_item->getUUID(), + dest_folder, + std::string(), + LLPointer(NULL)); + + } + else + { + // Reparent the item + gInventory.changeItemParent(viewer_inv_item, dest_folder, false); + } // Update the modified folders gInventory.updateCategory(src_cat); @@ -754,7 +777,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol } } -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder) +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy) { // Check that we have adequate permission on all items being moved. Proceed if we do. if (has_correct_permissions_for_sale(inv_cat)) @@ -767,9 +790,17 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU LLUUID src_folder = inv_cat->getParentUUID(); LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); - // Reparent the folder LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; - gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + if (copy) + { + // Copy the folder + copy_inventory_category(&gInventory, viewer_inv_cat, dest_folder); + } + else + { + // Reparent the folder + gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); + } // Update the modified folders gInventory.updateCategory(src_cat); diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 006cc3de68..e6f9ef6d89 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -72,8 +72,8 @@ void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LL void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id); void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id); -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder); -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder); +void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false); +void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 96a2db5afb..afddde02a4 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1056,7 +1056,10 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) { + // *TODO : Need some internal analysis to be less brutal with updates mask |= LLInventoryObserver::LABEL; + mask |= LLInventoryObserver::STRUCTURE; + mask |= LLInventoryObserver::INTERNAL; } old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); -- cgit v1.2.3 From a98346b0c3b90e75858f6ef98985c1246ad30418 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 2 Apr 2014 18:06:22 -0700 Subject: DD-20 : WIP : Improve Cut and Paste for marketplace. Still some use cases that are not working well --- indra/newview/llinventorybridge.cpp | 22 +++++++++++++++++++--- indra/newview/llinventorybridge.h | 1 + indra/newview/llinventoryfunctions.cpp | 15 ++++++++++++--- indra/newview/llinventorymodel.cpp | 4 +--- 4 files changed, 33 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5462b2bef4..68418063e7 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1186,6 +1186,22 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid) } } +void LLInvFVBridge::removeObject(LLInventoryModel *model, const LLUUID &uuid) +{ + // Keep track of the parent + LLInventoryItem* itemp = model->getItem(uuid); + LLUUID parent_id = (itemp ? itemp->getParentUUID() : LLUUID::null); + // Remove the object + model->removeObject(uuid); + // Get the parent updated + if (parent_id.notNull()) + { + LLViewerInventoryCategory* parent_cat = model->getCategory(parent_id); + model->updateCategory(parent_cat); + model->notifyObservers(); + } +} + bool LLInvFVBridge::canShare() const { bool can_share = false; @@ -1406,7 +1422,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - gInventory.removeObject(mUUID); + removeObject(model, mUUID); return; } else if ("copy" == action) @@ -1973,7 +1989,7 @@ std::string LLFolderBridge::getLabelSuffix() const } else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { - llinfos << "Merov : in merchant folder and is a stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; + //llinfos << "Merov : getLabelSuffix : stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; std::string stock = llformat("%d", getCategory()->getDescendentCount()); std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")"; return LLInvFVBridge::getLabelSuffix() + suffix; @@ -3026,7 +3042,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - gInventory.removeObject(mUUID); + removeObject(model, mUUID); return; } else if ("copy" == action) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 26c48fdc57..2c0b620395 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -184,6 +184,7 @@ protected: mutable std::string mSearchableName; void purgeItem(LLInventoryModel *model, const LLUUID &uuid); + void removeObject(LLInventoryModel *model, const LLUUID &uuid); virtual void buildDisplayName() const {} }; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8216830336..aef05fead5 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -90,6 +90,14 @@ BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; +// Helper function : callback to update a folder after inventory action happened in the background +void update_folder_cb(const LLUUID& dest_folder) +{ + LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); + gInventory.updateCategory(dest_cat); + gInventory.notifyObservers(); +} + // Generates a string containing the path to the item specified by // item_id. void append_path(const LLUUID& id, std::string& path) @@ -163,13 +171,14 @@ void copy_inventory_category(LLInventoryModel* model, for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) { LLInventoryItem* item = *iter; + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), new_cat_uuid, std::string(), - LLPointer(NULL)); + cb); } // Copy all the folders @@ -746,14 +755,14 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (copy) { // Copy the item + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, dest_folder)); copy_inventory_item( gAgent.getID(), viewer_inv_item->getPermissions().getOwner(), viewer_inv_item->getUUID(), dest_folder, std::string(), - LLPointer(NULL)); - + cb); } else { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index afddde02a4..269542d383 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1056,11 +1056,9 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id)) { - // *TODO : Need some internal analysis to be less brutal with updates mask |= LLInventoryObserver::LABEL; - mask |= LLInventoryObserver::STRUCTURE; - mask |= LLInventoryObserver::INTERNAL; } + llinfos << "Merov : updateCategory : " << cat->getName() << llendl; old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } -- cgit v1.2.3 From 39659f3c034c5cb335e185d1411e808d272f8065 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 3 Apr 2014 15:17:31 -0700 Subject: DD-20 : Handle edge cases a bit more cleanly --- indra/newview/llfloatermarketplacelistings.cpp | 2 +- indra/newview/llinventorybridge.cpp | 3 +-- indra/newview/llinventorymodel.cpp | 1 - indra/newview/llinventorypanel.cpp | 3 ++- 4 files changed, 4 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 814f1b218a..e8257e52c4 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -466,7 +466,7 @@ BOOL LLFloaterMarketplaceListings::handleDragAndDrop(S32 x, S32 y, MASK mask, BO BOOL handled = (handled_view != NULL); // Pass all drag and drop for this floater to the marketplace listings inventory control - if (!handled || !isAccepted(*accept)) + if (!handled && isAccepted(*accept) && !mPanelListings->getVisible() && mRootFolderId.notNull()) { LLFolderView* root_folder = mPanelListings->getRootFolder(); handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 68418063e7..09fd0527b9 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2345,7 +2345,6 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); const BOOL move_is_from_outbox = model->isObjectDescendentOf(cat_id, outbox_id); const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -2633,7 +2632,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { copy_folder_to_outbox(inv_cat, mUUID, cat_id, LLToolDragAndDrop::getOperationId()); } - else if (move_is_into_marketplacelistings && !move_is_from_marketplacelistings) + else if (move_is_into_marketplacelistings) { move_folder_to_marketplacelistings(inv_cat, mUUID); } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 269542d383..96a2db5afb 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1058,7 +1058,6 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { mask |= LLInventoryObserver::LABEL; } - llinfos << "Merov : updateCategory : " << cat->getName() << llendl; old_cat->copyViewerCategory(cat); addChangedMask(mask, cat->getUUID()); } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6305275a08..7d774110bd 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -568,7 +568,8 @@ void LLInventoryPanel::modelChanged(U32 mask) else if (!model_item && view_item && viewmodel_item) { // Remove the item's UI. - removeItemID(viewmodel_item->getUUID()); + const LLUUID& idp = viewmodel_item->getUUID(); + removeItemID(idp); view_item->destroyView(); } } -- cgit v1.2.3 From 0f944702298cc4e7c62b117d5bba1b8cd788a73d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 3 Apr 2014 16:23:01 -0700 Subject: DD-24 : Fix the tests that decide what is resalable and what is a stock item --- indra/newview/llinventoryfunctions.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index aef05fead5..d99193067d 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -730,10 +730,9 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem(); viewer_inv_item = (linked_item != NULL ? linked_item : viewer_inv_item); - // Check that the agent has copy permission on the item: this is required as a resident cannot - // put on sale items she has no right about. Proceed with move if we have permission. - // *TODO : Check that this is adequate (copied from the Merchant Outbox permission check so should be OK...) - if (viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + // Check that the agent has transfer permission on the item: this is required as a resident cannot + // put on sale items she cannot transfer. Proceed with move if we have permission. + if (viewer_inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID())) { // When moving an isolated item directly under the marketplace listings root, we create a new folder with that name if (dest_folder == marketplace_listings_uuid) @@ -743,7 +742,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder); // When moving a no copy item into a first level listing folder, we create a stock folder for it - if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (dest_cat->getParentUUID() == marketplace_listings_uuid)) + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && (dest_cat->getParentUUID() == marketplace_listings_uuid)) { dest_folder = create_folder_for_item(inv_item, dest_folder); } @@ -842,8 +841,9 @@ bool has_correct_permissions_for_sale(LLInventoryCategory* cat) llinfos << "Merov : linked items in this folder -> not allowed to sell!" << llendl; return false; } - // *TODO : Check that this is adequate (copied from the Merchant Outbox permission check so should be OK...) - if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + // Check that the agent has transfer permission on the item: this is required as a resident cannot + // put on sale items she cannot transfer. Proceed with move if we have permission. + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID())) { llinfos << "Merov : wrong permissions on items in this folder -> not allowed to sell!" << llendl; return false; @@ -891,11 +891,11 @@ void validate_marketplacelistings(LLInventoryCategory* cat) { llinfos << "Merov : Validation error: there are linked items in this listing!" << llendl; } - if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID())) { llinfos << "Merov : Validation error: there are items with incorrect permissions in this listing!" << llendl; } - if (!(viewer_inv_item->getPermissions().getMaskEveryone() & PERM_COPY) && (folder_type != LLFolderType::FT_MARKETPLACE_STOCK)) + if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && (folder_type != LLFolderType::FT_MARKETPLACE_STOCK)) { llinfos << "Merov : Validation warning : no copy item found in non stock folder -> reparent to relevant stock folder!" << llendl; if (stock_folder_uuid.isNull()) -- cgit v1.2.3 From c36b7fa963511023866b6518f245d2c6edd1add0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 3 Apr 2014 18:14:59 -0700 Subject: DD-20 : Make drop in the panel when empty work again --- indra/newview/llfloatermarketplacelistings.cpp | 22 +++++++++++++--------- .../xui/en/floater_marketplace_listings.xml | 3 ++- .../default/xui/en/panel_marketplace_listings.xml | 8 ++++---- 3 files changed, 19 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index e8257e52c4..42e49f5d7d 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -446,31 +446,35 @@ void LLFloaterMarketplaceListings::updateView() 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); + 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 there's no panel to accept drops or no existing marketplace listings folder, we refuse all drop if (!mPanelListings || mRootFolderId.isNull()) { return FALSE; } + // Pass to the children LLView * handled_view = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); BOOL handled = (handled_view != NULL); - // Pass all drag and drop for this floater to the marketplace listings inventory control - if (!handled && isAccepted(*accept) && !mPanelListings->getVisible() && mRootFolderId.notNull()) - { - LLFolderView* root_folder = mPanelListings->getRootFolder(); - handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } + // If no one handled it or it was not accepted, we try to accept it at the floater level as if it was dropped on the + // marketplace listings root folder + if (!handled || !isAccepted(*accept)) + { + if (!mPanelListings->getVisible() && mRootFolderId.notNull()) + { + LLFolderView* root_folder = mPanelListings->getRootFolder(); + handled = root_folder->handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + } + } return handled; } 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 0f511c4a66..f5630aeecb 100755 --- a/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/floater_marketplace_listings.xml @@ -15,11 +15,11 @@ reuse_instance="true"> Initializing... Date: Fri, 4 Apr 2014 12:33:40 -0700 Subject: DD-45 : Add Activate right click menu item to marketplace listings folders --- indra/newview/llinventorybridge.cpp | 26 ++++++++++++++++++++++ indra/newview/llinventorybridge.h | 3 +++ .../skins/default/xui/en/menu_inventory.xml | 8 +++++++ 3 files changed, 37 insertions(+) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 09fd0527b9..ceb54b3dcd 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -744,6 +744,10 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -845,6 +849,15 @@ void LLInvFVBridge::addOutboxContextMenuOptions(U32 flags, #endif // ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU } +void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, + menuentry_vec_t &items, + menuentry_vec_t &disabled_items) +{ + items.push_back(std::string("Marketplace Separator")); + items.push_back(std::string("Marketplace Activate")); +} + + // *TODO: remove this BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { @@ -3069,6 +3082,15 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) restoreItem(); return; } + else if ("marketplace_activate" == action) + { + if (!LLMarketplaceData::instance().isListed(mUUID)) + { + LLMarketplaceData::instance().addTestItem(mUUID); + } + LLMarketplaceData::instance().setActivation(mUUID,true); + return; + } #ifndef LL_RELEASE_FOR_DOWNLOAD else if ("delete_system_folder" == action) { @@ -3563,6 +3585,10 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else if(isAgentInventory()) // do not allow creating in library { LLViewerInventoryCategory *cat = getCategory(); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 2c0b620395..72b92b6911 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -146,6 +146,9 @@ protected: virtual void addOutboxContextMenuOptions(U32 flags, menuentry_vec_t &items, menuentry_vec_t &disabled_items); + virtual void addMarketplaceContextMenuOptions(U32 flags, + menuentry_vec_t &items, + menuentry_vec_t &disabled_items); protected: LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid); diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 6fa45d7d66..aa115c1ad1 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -726,6 +726,14 @@ parameter="send_to_marketplace" /> + + + -- cgit v1.2.3 From e1d2f71d348bafe0be783dcb3dfbeb56bc877c12 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 4 Apr 2014 16:56:17 -0700 Subject: DD-14 : Add all right click menu items for marketplace. Make Add, Activate and Deactivate work. Right click fails on non folder items though in marketplace --- indra/newview/llfloatermarketplacelistings.cpp | 23 ----- indra/newview/llinventorybridge.cpp | 113 +++++++++++++++++++-- indra/newview/llinventoryfunctions.cpp | 27 +++++ indra/newview/llinventoryfunctions.h | 1 + .../skins/default/xui/en/menu_inventory.xml | 51 ++++++++-- 5 files changed, 174 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 42e49f5d7d..10c6045f87 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -246,29 +246,6 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key) 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 // diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ceb54b3dcd..cd3e51a0ea 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -744,10 +744,6 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } - else if (isMarketplaceListingsFolder()) - { - addMarketplaceContextMenuOptions(flags, items, disabled_items); - } else { items.push_back(std::string("Share")); @@ -853,8 +849,49 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, menuentry_vec_t &items, menuentry_vec_t &disabled_items) { - items.push_back(std::string("Marketplace Separator")); - items.push_back(std::string("Marketplace Activate")); + S32 depth = depth_nesting_in_marketplace(mUUID); + llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl; + if (depth <= 1) + { + // Options available at the Listing Folder level only + items.push_back(std::string("Marketplace Add Listing")); + items.push_back(std::string("Marketplace Attach Listing")); + if (LLMarketplaceData::instance().isListed(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Add Listing")); + disabled_items.push_back(std::string("Marketplace Attach Listing")); + } + } + if (depth <= 2) + { + // Options available at the Listing Folder and Version Folder levels + items.push_back(std::string("Marketplace Activate")); + items.push_back(std::string("Marketplace Deactivate")); + if (LLMarketplaceData::instance().isListed(mUUID)) + { + if (LLMarketplaceData::instance().getActivationState(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Activate")); + } + else + { + disabled_items.push_back(std::string("Marketplace Deactivate")); + } + } + else + { + disabled_items.push_back(std::string("Marketplace Activate")); + disabled_items.push_back(std::string("Marketplace Deactivate")); + } + } + // Options available at all levels on all items + items.push_back(std::string("Marketplace Show Listing")); + if (!LLMarketplaceData::instance().isListed(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Show Listing")); + } + // Separator + items.push_back(std::string("Marketplace Listings Separator")); } @@ -3084,13 +3121,33 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_activate" == action) { - if (!LLMarketplaceData::instance().isListed(mUUID)) - { - LLMarketplaceData::instance().addTestItem(mUUID); - } LLMarketplaceData::instance().setActivation(mUUID,true); return; } + else if ("marketplace_deactivate" == action) + { + LLMarketplaceData::instance().setActivation(mUUID,false); + return; + } + else if ("marketplace_add_listing" == action) + { + // *TODO : Do something a bit smarter... + LLMarketplaceData::instance().addTestItem(mUUID); + return; + } + else if ("marketplace_attach_listing" == action) + { + // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one + LLMarketplaceData::instance().addTestItem(mUUID); + return; + } + else if ("marketplace_show_listing" == action) + { + // *TODO : Need to show a browser window with the info for the listing + // Get the listing id (i.e. go up the hierarchy to find the listing folder + // Show the listing folder in a browser window + return; + } #ifndef LL_RELEASE_FOR_DOWNLOAD else if ("delete_system_folder" == action) { @@ -4644,6 +4701,10 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -4711,6 +4772,10 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { if (isItemInTrash()) @@ -4769,6 +4834,10 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { if(isItemInTrash()) @@ -5019,6 +5088,10 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -5286,6 +5359,10 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -5340,6 +5417,10 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { if(isItemInTrash()) @@ -5619,6 +5700,10 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Share")); @@ -5841,6 +5926,10 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Delete")); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere BOOL can_open = ((flags & SUPPRESS_OPEN_ITEM) != SUPPRESS_OPEN_ITEM); @@ -6141,6 +6230,10 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { addOutboxContextMenuOptions(flags, items, disabled_items); } + else if (isMarketplaceListingsFolder()) + { + addMarketplaceContextMenuOptions(flags, items, disabled_items); + } else { items.push_back(std::string("Properties")); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index d99193067d..e57519d67a 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -705,6 +705,33 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold // permission checking and listings validation. ///---------------------------------------------------------------------------- +S32 depth_nesting_in_marketplace(LLUUID cur_uuid) +{ + // Get the marketplace listings root, exit with -1 (i.e. not under the marketplace listings root) if none + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + if (marketplace_listings_uuid.isNull()) + { + return -1; + } + // If not a descendent of the marketplace listings root, then the nesting depth is -1 by definition + if (!gInventory.isObjectDescendentOf(cur_uuid, marketplace_listings_uuid)) + { + return -1; + } + + // Iterate through the parents till we hit the marketplace listings root + // Note that the marketplace listings root itself will return 0 + S32 depth = 0; + LLInventoryObject* cur_object = gInventory.getObject(cur_uuid); + while (cur_uuid != marketplace_listings_uuid) + { + depth++; + cur_uuid = cur_object->getParentUUID(); + cur_object = gInventory.getCategory(cur_uuid); + } + return depth; +} + void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index e6f9ef6d89..aab4db8adf 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -76,6 +76,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); +S32 depth_nesting_in_marketplace(LLUUID cur_uuid); /** Miscellaneous global functions ** ** diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index aa115c1ad1..cde14e72f0 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -4,6 +4,49 @@ layout="topleft" name="Popup" visible="false"> + + + + + + + + + + + + + + + + - - - -- cgit v1.2.3 From a38bc63da24994b51cfd3487d4011c8e608cd41d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 6 Apr 2014 22:03:58 -0700 Subject: DD-15 : Allow version folder to be made active/inactive, add new methods to marketplace to make all that a bit more clear and clean --- indra/newview/llinventorybridge.cpp | 74 +++++++++++++------- indra/newview/llinventoryfunctions.cpp | 20 +++++- indra/newview/llinventoryfunctions.h | 1 + indra/newview/llmarketplacefunctions.cpp | 112 ++++++++++++++++++++++++++----- indra/newview/llmarketplacefunctions.h | 26 ++++--- 5 files changed, 179 insertions(+), 54 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index cd3e51a0ea..9c9f195875 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -851,24 +851,17 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, { S32 depth = depth_nesting_in_marketplace(mUUID); llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl; - if (depth <= 1) + if (depth == 1) { - // Options available at the Listing Folder level only + // Options available at the Listing Folder level items.push_back(std::string("Marketplace Add Listing")); items.push_back(std::string("Marketplace Attach Listing")); - if (LLMarketplaceData::instance().isListed(mUUID)) - { - disabled_items.push_back(std::string("Marketplace Add Listing")); - disabled_items.push_back(std::string("Marketplace Attach Listing")); - } - } - if (depth <= 2) - { - // Options available at the Listing Folder and Version Folder levels items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); if (LLMarketplaceData::instance().isListed(mUUID)) { + disabled_items.push_back(std::string("Marketplace Add Listing")); + disabled_items.push_back(std::string("Marketplace Attach Listing")); if (LLMarketplaceData::instance().getActivationState(mUUID)) { disabled_items.push_back(std::string("Marketplace Activate")); @@ -884,9 +877,28 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, disabled_items.push_back(std::string("Marketplace Deactivate")); } } + if (depth == 2) + { + // Options available at the Version Folder levels + LLInventoryObject* object = gInventory.getObject(mUUID); + if (LLMarketplaceData::instance().isListed(object->getParentUUID())) + { + items.push_back(std::string("Marketplace Activate")); + items.push_back(std::string("Marketplace Deactivate")); + if (LLMarketplaceData::instance().getActivationState(mUUID)) + { + disabled_items.push_back(std::string("Marketplace Activate")); + } + else + { + disabled_items.push_back(std::string("Marketplace Deactivate")); + } + } + } // Options available at all levels on all items items.push_back(std::string("Marketplace Show Listing")); - if (!LLMarketplaceData::instance().isListed(mUUID)) + LLUUID listing_folder_id = nested_parent_id(mUUID,depth); + if (!LLMarketplaceData::instance().isListed(listing_folder_id)) { disabled_items.push_back(std::string("Marketplace Show Listing")); } @@ -2011,17 +2023,9 @@ 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) - { - const LLUUID& parent_folder_id = cat->getParentUUID(); - accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); - } - */ if (isMarketplaceListingsFolder()) { + // Listing folder case if (LLMarketplaceData::instance().isListed(getUUID())) { //llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; @@ -2037,6 +2041,17 @@ std::string LLFolderBridge::getLabelSuffix() const } return LLInvFVBridge::getLabelSuffix() + suffix; } + // Version folder case + else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) + { + std::string suffix; + if (LLMarketplaceData::instance().getActivationState(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; + } + return LLInvFVBridge::getLabelSuffix() + suffix; + } + // Stock folder case else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { //llinfos << "Merov : getLabelSuffix : stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; @@ -3121,7 +3136,17 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_activate" == action) { - LLMarketplaceData::instance().setActivation(mUUID,true); + S32 depth = depth_nesting_in_marketplace(mUUID); + if (depth == 2) + { + LLInventoryCategory* category = gInventory.getCategory(mUUID); + LLMarketplaceData::instance().setVersionFolderID(category->getParentUUID(), mUUID); + LLMarketplaceData::instance().setActivation(mUUID,true); + } + else if (depth == 1) + { + LLMarketplaceData::instance().setActivation(mUUID,true); + } return; } else if ("marketplace_deactivate" == action) @@ -3131,14 +3156,13 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_add_listing" == action) { - // *TODO : Do something a bit smarter... - LLMarketplaceData::instance().addTestItem(mUUID); + LLMarketplaceData::instance().addListing(mUUID); return; } else if ("marketplace_attach_listing" == action) { // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one - LLMarketplaceData::instance().addTestItem(mUUID); + LLMarketplaceData::instance().addListing(mUUID); return; } else if ("marketplace_show_listing" == action) diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index e57519d67a..aef3bc9cca 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -125,8 +125,11 @@ void update_marketplace_category(const LLUUID& cat_id) // for all observers of the folder to, possibly, change the display label of said folder. // At least that's the status for the moment so, even if that function seems small, we // prefer to encapsulate that behavior here. - gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); - gInventory.notifyObservers(); + if (cat_id.notNull()) + { + gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.notifyObservers(); + } } void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) @@ -732,6 +735,19 @@ S32 depth_nesting_in_marketplace(LLUUID cur_uuid) return depth; } +LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) +{ + LLInventoryObject* cur_object = gInventory.getObject(cur_uuid); + cur_uuid = (depth < 1 ? LLUUID::null : cur_uuid); + while (depth > 1) + { + depth--; + cur_uuid = cur_object->getParentUUID(); + cur_object = gInventory.getCategory(cur_uuid); + } + return cur_uuid; +} + void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index aab4db8adf..69219c7c42 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -77,6 +77,7 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); +LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth); /** Miscellaneous global functions ** ** diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 6f35cc217d..29ce5361f0 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -535,25 +535,25 @@ void LLMarketplaceInventoryImporter::updateImport() // Tuple == Item LLMarketplaceTuple::LLMarketplaceTuple() : - mFolderListingId(), + mListingFolderId(), mListingId(""), - mActiveVersionFolderId(), + mVersionFolderId(), mIsActive(false) { } LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id) : - mFolderListingId(folder_id), + mListingFolderId(folder_id), mListingId(""), - mActiveVersionFolderId(), + mVersionFolderId(), mIsActive(false) { } LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed) : - mFolderListingId(folder_id), + mListingFolderId(folder_id), mListingId(listing_id), - mActiveVersionFolderId(version_id), + mVersionFolderId(version_id), mIsActive(is_listed) { } @@ -564,28 +564,85 @@ LLMarketplaceData::LLMarketplaceData() { } +// Creation / Deletion +bool LLMarketplaceData::addListing(const LLUUID& folder_id) +{ + if (isListed(folder_id)) + { + // Listing already exists -> exit with error + return false; + } + mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); + update_marketplace_category(folder_id); + return true; +} + +bool LLMarketplaceData::deleteListing(const LLUUID& folder_id) +{ + if (!isListed(folder_id)) + { + // Listing doesn't exist -> exit with error + return false; + } + mMarketplaceItems.erase(folder_id); + update_marketplace_category(folder_id); + return true; +} + // Accessors bool LLMarketplaceData::getActivationState(const LLUUID& folder_id) { - marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); - return (it == mMarketplaceItems.end() ? false : (it->second).mIsActive); + // Listing folder case + if (isListed(folder_id)) + { + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + return (it->second).mIsActive; + } + // We need to iterate through the list to check it's not a version folder + marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); + while (it != mMarketplaceItems.end()) + { + if ((it->second).mVersionFolderId == folder_id) + { + return (it->second).mIsActive; + } + it++; + } + return false; } + std::string LLMarketplaceData::getListingID(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); return (it == mMarketplaceItems.end() ? "" : (it->second).mListingId); } + LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); - return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mActiveVersionFolderId); + return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mVersionFolderId); } + bool LLMarketplaceData::isListed(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); return (it != mMarketplaceItems.end()); } +bool LLMarketplaceData::isVersionFolder(const LLUUID& folder_id) +{ + marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); + while (it != mMarketplaceItems.end()) + { + if ((it->second).mVersionFolderId == folder_id) + { + return true; + } + it++; + } + return false; +} + // Modifiers bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listing_id) { @@ -601,6 +658,7 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listin return true; } } + bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); @@ -610,24 +668,42 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID } else { - (it->second).mActiveVersionFolderId = version_id; - update_marketplace_category(folder_id); + LLUUID old_version_id = (it->second).mVersionFolderId; + if (old_version_id != version_id) + { + (it->second).mVersionFolderId = version_id; + update_marketplace_category(old_version_id); + update_marketplace_category(version_id); + } return true; } } + bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) { - marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); - if (it == mMarketplaceItems.end()) - { - return false; - } - else + // Listing folder case + if (isListed(folder_id)) { + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); (it->second).mIsActive = activate; - update_marketplace_category(folder_id); + update_marketplace_category((it->second).mListingFolderId); + update_marketplace_category((it->second).mVersionFolderId); return true; } + // We need to iterate through the list to check it's not a version folder + marketplace_items_list_t::iterator it = mMarketplaceItems.begin(); + while (it != mMarketplaceItems.end()) + { + if ((it->second).mVersionFolderId == folder_id) + { + (it->second).mIsActive = activate; + update_marketplace_category((it->second).mListingFolderId); + update_marketplace_category((it->second).mVersionFolderId); + return true; + } + it++; + } + return false; } // Test methods diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 00840c6e23..d76072da1f 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -113,7 +113,8 @@ private: // * implement the Marketplace API (TBD) // * cache the current Marketplace data (tuples) // * provide methods to get Marketplace data on any inventory item -// * signal marketplace updates to inventory +// * set Marketplace data +// * signal Marketplace updates to inventory class LLMarketplaceData; // A Marketplace item is known by its tuple @@ -128,15 +129,16 @@ public: private: // Representation of a marketplace item in the Marketplace DB (well, what we know of it...) - LLUUID mFolderListingId; + LLUUID mListingFolderId; std::string mListingId; - LLUUID mActiveVersionFolderId; + LLUUID mVersionFolderId; bool mIsActive; }; -// Note: the folder UUID is used as a key to this map. It could therefore be taken off the object themselves +// Note: The listing folder UUID is used as a key to this map. It could therefore be taken off the LLMarketplaceTuple objects themselves typedef std::map marketplace_items_list_t; -// There's one and only one possible set of Marketplace data per agent and per session +// Session cache of Marketplace tuples +// Note: There's one and only one possible set of Marketplace dataset per agent and per session class LLMarketplaceData : public LLSingleton { @@ -145,14 +147,20 @@ public: bool isEmpty() { return (mMarketplaceItems.size() == 0); } - // Access Marketplace Data : each method returns a default value if the folder_id can't be found + // Probe the Marketplace data set to identify folders + bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder + bool isVersionFolder(const LLUUID& folder_id); // returns true if folder_id is a Version folder + + // Create/Delete Marketplace data set : each method returns true if the function succeeds, false if error + bool addListing(const LLUUID& folder_id); + bool deleteListing(const LLUUID& folder_id); + + // Access Marketplace data set : each method returns a default value if the folder_id can't be found bool getActivationState(const LLUUID& folder_id); std::string getListingID(const LLUUID& folder_id); LLUUID getVersionFolderID(const LLUUID& folder_id); - bool isListed(const LLUUID& folder_id); // returns true if folder_id is in the items map - - // Modify Marketplace Data : each method returns true if the function succeeds, false if error + // Modify Marketplace data set : each method returns true if the function succeeds, false if error bool setListingID(const LLUUID& folder_id, std::string listing_id); bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); -- cgit v1.2.3 From 8d20027ff904a29c9fb573372f89839bcab5a0c0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Apr 2014 14:54:34 -0700 Subject: DD-41 : Clean up and add back into contextual menu the clipboard options, as well as Rename and Properties --- indra/newview/llinventorybridge.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9c9f195875..8d87b40e4e 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -650,8 +650,9 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (!isInboxFolder()) { items.push_back(std::string("Rename")); - if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0) + if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { + llinfos << "Merov : rename disable, renameable = " << isItemRenameable() << ", flags = " << flags << llendl; disabled_items.push_back(std::string("Rename")); } } @@ -688,7 +689,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Cut")); } - if (canListOnMarketplace()) + if (canListOnMarketplace() && !isMarketplaceListingsFolder()) { items.push_back(std::string("Marketplace Separator")); @@ -879,9 +880,9 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, } if (depth == 2) { - // Options available at the Version Folder levels - LLInventoryObject* object = gInventory.getObject(mUUID); - if (LLMarketplaceData::instance().isListed(object->getParentUUID())) + // Options available at the Version Folder levels and only for folders + LLInventoryCategory* cat = gInventory.getCategory(mUUID); + if (cat && LLMarketplaceData::instance().isListed(cat->getParentUUID())) { items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); @@ -3669,6 +3670,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + getClipboardEntries(false, items, disabled_items, flags); } else if(isAgentInventory()) // do not allow creating in library { @@ -3747,7 +3749,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items disabled_items.push_back(std::string("Delete System Folder")); } - if (!isOutboxFolder()) + if (!isOutboxFolder() && !isMarketplaceListingsFolder()) { items.push_back(std::string("Share")); if (!canShare()) @@ -3757,7 +3759,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items } // Add menu items that are dependent on the contents of the folder. LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID); - if (category) + if (category && !isMarketplaceListingsFolder()) { uuid_vec_t folders; folders.push_back(category->getUUID()); @@ -4728,6 +4730,8 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -4799,6 +4803,8 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -4861,6 +4867,8 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5115,6 +5123,8 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5386,6 +5396,8 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5444,6 +5456,8 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5727,6 +5741,8 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { @@ -5953,6 +5969,8 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere @@ -6257,6 +6275,8 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if (isMarketplaceListingsFolder()) { addMarketplaceContextMenuOptions(flags, items, disabled_items); + items.push_back(std::string("Properties")); + getClipboardEntries(false, items, disabled_items, flags); } else { -- cgit v1.2.3 From fc4e9d2572635903449ade6ebf2a45aa9e971023 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 8 Apr 2014 18:12:48 -0700 Subject: DD-18 : Compute stock for all levels, get folders to update more consistently on all actions in the marketplace --- indra/newview/llinventorybridge.cpp | 24 +++---- indra/newview/llinventoryfunctions.cpp | 87 ++++++++++++++++++++------ indra/newview/llinventoryfunctions.h | 1 + indra/newview/llinventorymodel.cpp | 2 +- indra/newview/skins/default/xui/en/strings.xml | 1 + 5 files changed, 78 insertions(+), 37 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 8d87b40e4e..7ff0a445e8 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -652,7 +652,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, items.push_back(std::string("Rename")); if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { - llinfos << "Merov : rename disable, renameable = " << isItemRenameable() << ", flags = " << flags << llendl; disabled_items.push_back(std::string("Rename")); } } @@ -851,7 +850,6 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, menuentry_vec_t &disabled_items) { S32 depth = depth_nesting_in_marketplace(mUUID); - llinfos << "Merov : adding marketplace menu at depth = " << depth << llendl; if (depth == 1) { // Options available at the Listing Folder level @@ -2026,11 +2024,11 @@ std::string LLFolderBridge::getLabelSuffix() const { if (isMarketplaceListingsFolder()) { + std::string suffix = ""; // Listing folder case if (LLMarketplaceData::instance().isListed(getUUID())) { - //llinfos << "Merov : in merchant folder and listed : id = " << getUUID() << llendl; - std::string suffix = LLMarketplaceData::instance().getListingID(getUUID()); + suffix = LLMarketplaceData::instance().getListingID(getUUID()); if (suffix.empty()) { suffix = LLTrans::getString("MarketplaceNoID"); @@ -2040,31 +2038,25 @@ std::string LLFolderBridge::getLabelSuffix() const { suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } - return LLInvFVBridge::getLabelSuffix() + suffix; } // Version folder case else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) { - std::string suffix; if (LLMarketplaceData::instance().getActivationState(getUUID())) { suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } - return LLInvFVBridge::getLabelSuffix() + suffix; } - // Stock folder case - else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + S32 stock_count = compute_stock_count(getUUID()); + if (stock_count == 0) { - //llinfos << "Merov : getLabelSuffix : stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl; - std::string stock = llformat("%d", getCategory()->getDescendentCount()); - std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")"; - return LLInvFVBridge::getLabelSuffix() + suffix; + suffix += " (" + LLTrans::getString("MarketplaceNoStock") + ")"; } - else + else if (stock_count != -1) { - //llinfos << "Merov : in merchant folder but not listed : id = " << getUUID() << llendl; - return LLInvFVBridge::getLabelSuffix(); + suffix += " (" + LLTrans::getString("MarketplaceStock") + "=" + llformat("%d", stock_count) + ")"; } + return LLInvFVBridge::getLabelSuffix() + suffix; } else { diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index aef3bc9cca..20cbb06f07 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -122,14 +122,31 @@ void append_path(const LLUUID& id, std::string& path) void update_marketplace_category(const LLUUID& cat_id) { // When changing the marketplace status of a folder, the only thing that needs to happen is - // for all observers of the folder to, possibly, change the display label of said folder. - // At least that's the status for the moment so, even if that function seems small, we - // prefer to encapsulate that behavior here. - if (cat_id.notNull()) + // for all observers of the folder to, possibly, change the display label of the folder + // as well as, potentially, change the display label of all parent folders up to the marketplace root. + + const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + // No marketplace, likely called in error then... + // Or not a descendent of the marketplace listings root, then just do the regular category update + if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + gInventory.updateCategory(cat); + gInventory.notifyObservers(); + return; + } + // Explore all the hierarchy of folders up to the root to get them to update + // Note: this is not supposed to be deeper than 4 + LLUUID cur_id = cat_id; + LLInventoryCategory* cur_cat = gInventory.getCategory(cur_id); + while (cur_id != marketplace_listings_uuid) { - gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.addChangedMask(LLInventoryObserver::LABEL, cur_id); gInventory.notifyObservers(); + cur_id = cur_cat->getParentUUID(); + cur_cat = gInventory.getCategory(cur_id); } + return; } void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) @@ -748,6 +765,41 @@ LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) return cur_uuid; } +S32 compute_stock_count(LLUUID cat_uuid) +{ + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); + + // "-1" denotes a folder that doesn't countain any stock folders in its descendents + S32 curr_count = -1; + + LLInventoryCategory* cat = gInventory.getCategory(cat_uuid); + + if (cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here + LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); + curr_count = viewer_cat->getDescendentCount(); + } + else + { + // Note: marketplace listings have a maximum depth nesting of 4 + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + S32 count = compute_stock_count(category->getUUID()); + if ((curr_count == -1) || ((count != -1) && (count < curr_count))) + { + curr_count = count; + } + } + } + + return curr_count; +} + void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings, exit with error if none @@ -792,7 +844,6 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = viewer_inv_item->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); if (copy) { @@ -812,13 +863,12 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol gInventory.changeItemParent(viewer_inv_item, dest_folder, false); } - // Update the modified folders - gInventory.updateCategory(src_cat); - gInventory.updateCategory(dest_cat); - gInventory.notifyObservers(); - // Validate the destination : note that this will run the validation code only on one listing folder at most... validate_marketplacelistings(dest_cat); + + // Update the modified folders + update_marketplace_category(src_folder); + update_marketplace_category(dest_folder); } else { @@ -839,7 +889,6 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU // Get the parent folder of the moved item : we may have to update it LLUUID src_folder = inv_cat->getParentUUID(); - LLViewerInventoryCategory* src_cat = gInventory.getCategory(src_folder); LLViewerInventoryCategory * viewer_inv_cat = (LLViewerInventoryCategory *) inv_cat; if (copy) @@ -853,13 +902,12 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false); } - // Update the modified folders - gInventory.updateCategory(src_cat); - gInventory.updateCategory(dest_cat); - gInventory.notifyObservers(); - // Check the destination folder recursively for no copy items and promote the including folders if any validate_marketplacelistings(dest_cat); + + // Update the modified folders + update_marketplace_category(src_folder); + update_marketplace_category(dest_folder); } } @@ -948,9 +996,8 @@ void validate_marketplacelistings(LLInventoryCategory* cat) stock_folder_cat = gInventory.getCategory(stock_folder_uuid); } gInventory.changeItemParent(viewer_inv_item, stock_folder_uuid, false); - gInventory.updateCategory(viewer_cat); - gInventory.updateCategory(stock_folder_cat); - gInventory.notifyObservers(); + update_marketplace_category(viewer_cat->getUUID()); + update_marketplace_category(stock_folder_uuid); } } diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 69219c7c42..66f1c99630 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -78,6 +78,7 @@ bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth); +S32 compute_stock_count(LLUUID cat_uuid); /** Miscellaneous global functions ** ** diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 96a2db5afb..c0aedd3881 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1013,7 +1013,7 @@ LLInventoryModel::item_array_t* LLInventoryModel::getUnlockedItemArray(const LLU // an existing item with the matching id, or it will add the category. void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) { - if(cat->getUUID().isNull()) + if(!cat || cat->getUUID().isNull()) { return; } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index ce9bbbc8d2..55272750e7 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2274,6 +2274,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. no Mkt ID live stock + out of stock Open landmarks -- cgit v1.2.3 From 9b52f19a68eb9ff3e88c9d45c2d799be6eccf44e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 8 Apr 2014 21:26:40 -0700 Subject: DD-18 : Make the stock count take the listing status and version status into account so to be accurate and more resilient --- indra/newview/llinventoryfunctions.cpp | 66 ++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 18 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 20cbb06f07..ad9326965b 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -59,6 +59,7 @@ #include "llinventorypanel.h" #include "lllineeditor.h" #include "llmarketplacenotifications.h" +#include "llmarketplacefunctions.h" #include "llmenugl.h" #include "llnotificationsutil.h" #include "llpanelmaininventory.h" @@ -752,6 +753,7 @@ S32 depth_nesting_in_marketplace(LLUUID cur_uuid) return depth; } +// Returns the UUID of the marketplace listing this object is in LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) { LLInventoryObject* cur_object = gInventory.getObject(cur_uuid); @@ -767,6 +769,45 @@ LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) S32 compute_stock_count(LLUUID cat_uuid) { + // Handle the case of the folder being a stock folder immediately + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_uuid); + if (cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here + // Note: we *always* give a stock count for stock folders, it's useful even if the listing is unassociated + //LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); + return cat->getDescendentCount(); + } + + // Grab marketplace data for this folder + S32 depth = depth_nesting_in_marketplace(cat_uuid); + LLUUID listing_uuid = nested_parent_id(cat_uuid, depth); + if (!LLMarketplaceData::instance().isListed(listing_uuid)) + { + // If not listed, the notion of stock is meaningless so it won't be computed for any level + return -1; + } + + LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolderID(listing_uuid); + // Handle the case of the first 2 levels : listing and version folders + if (depth == 1) + { + if (version_folder_uuid.notNull()) + { + // If there is a version folder, the stock value for the listing is the version folder stock + return compute_stock_count(version_folder_uuid); + } + } + else if (depth == 2) + { + if (version_folder_uuid.notNull() && (version_folder_uuid != cat_uuid)) + { + // If there is a version folder but we're not it, our stock count is meaningless + return -1; + } + } + + // In all other cases, the stock count is the min of stock folders count found in the descendents LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); @@ -774,26 +815,15 @@ S32 compute_stock_count(LLUUID cat_uuid) // "-1" denotes a folder that doesn't countain any stock folders in its descendents S32 curr_count = -1; - LLInventoryCategory* cat = gInventory.getCategory(cat_uuid); - - if (cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) - { - // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here - LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (cat); - curr_count = viewer_cat->getDescendentCount(); - } - else + // Note: marketplace listings have a maximum depth nesting of 4 + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) { - // Note: marketplace listings have a maximum depth nesting of 4 - LLInventoryModel::cat_array_t cat_array_copy = *cat_array; - for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + LLInventoryCategory* category = *iter; + S32 count = compute_stock_count(category->getUUID()); + if ((curr_count == -1) || ((count != -1) && (count < curr_count))) { - LLInventoryCategory* category = *iter; - S32 count = compute_stock_count(category->getUUID()); - if ((curr_count == -1) || ((count != -1) && (count < curr_count))) - { - curr_count = count; - } + curr_count = count; } } -- cgit v1.2.3 From 748bbeaf982c456b120d4b3f4d33aa6dce576908 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Apr 2014 14:19:38 -0700 Subject: DD-13 : Clean up Associate/Disassociate listing. Also clarify the update folder code in marketplace --- indra/newview/llinventorybridge.cpp | 19 ++++++-- indra/newview/llinventoryfunctions.cpp | 55 ++++++++++++++++------ indra/newview/llmarketplacefunctions.cpp | 18 ------- indra/newview/llmarketplacefunctions.h | 5 -- .../skins/default/xui/en/menu_inventory.xml | 14 ++++-- 5 files changed, 67 insertions(+), 44 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7ff0a445e8..3af734ba27 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -65,6 +65,7 @@ #include "llsidepanelappearance.h" #include "lltooldraganddrop.h" #include "lltrans.h" +#include "llurlaction.h" #include "llviewerassettype.h" #include "llviewerfoldertype.h" #include "llviewermenu.h" @@ -853,13 +854,14 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, if (depth == 1) { // Options available at the Listing Folder level - items.push_back(std::string("Marketplace Add Listing")); + items.push_back(std::string("Marketplace Associate Listing")); items.push_back(std::string("Marketplace Attach Listing")); + items.push_back(std::string("Marketplace Disassociate Listing")); items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); if (LLMarketplaceData::instance().isListed(mUUID)) { - disabled_items.push_back(std::string("Marketplace Add Listing")); + disabled_items.push_back(std::string("Marketplace Associate Listing")); disabled_items.push_back(std::string("Marketplace Attach Listing")); if (LLMarketplaceData::instance().getActivationState(mUUID)) { @@ -872,6 +874,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, } else { + disabled_items.push_back(std::string("Marketplace Disassociate Listing")); disabled_items.push_back(std::string("Marketplace Activate")); disabled_items.push_back(std::string("Marketplace Deactivate")); } @@ -3147,11 +3150,16 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLMarketplaceData::instance().setActivation(mUUID,false); return; } - else if ("marketplace_add_listing" == action) + else if ("marketplace_associate_listing" == action) { LLMarketplaceData::instance().addListing(mUUID); return; } + else if ("marketplace_disassociate_listing" == action) + { + LLMarketplaceData::instance().deleteListing(mUUID); + return; + } else if ("marketplace_attach_listing" == action) { // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one @@ -3163,6 +3171,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) // *TODO : Need to show a browser window with the info for the listing // Get the listing id (i.e. go up the hierarchy to find the listing folder // Show the listing folder in a browser window + // https://marketplace.secondlife.com/p/Nounours/4438852 + // https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true + // https://marketplace.secondlife.com/p//?preview=true + std::string url("https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true"); + LLUrlAction::openURL(url); return; } #ifndef LL_RELEASE_FOR_DOWNLOAD diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index ad9326965b..ff38017d6f 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -120,33 +120,58 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } -void update_marketplace_category(const LLUUID& cat_id) +void update_marketplace_folder_hierarchy(const LLUUID cat_id) { // When changing the marketplace status of a folder, the only thing that needs to happen is // for all observers of the folder to, possibly, change the display label of the folder - // as well as, potentially, change the display label of all parent folders up to the marketplace root. + // so that's the only thing we change on the update mask. + gInventory.addChangedMask(LLInventoryObserver::LABEL, cat_id); + gInventory.notifyObservers(); + + // Update all descendent folders down + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); + + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLInventoryCategory* category = *iter; + update_marketplace_folder_hierarchy(category->getUUID()); + } + return; +} + +void update_marketplace_category(const LLUUID& cat_id) +{ + // When changing the marketplace status of a folder, we usually have to change the status of all + // folders in the same listing. This is because the display of each folder is affected by the + // overall status of the whole listing. + // Consequently, the only way to correctly update a folder anywhere in the marketplace is to + // update the whole listing from its listing root. + // This is not as bad as it seems as we only update folders, not items, and the folder nesting depth + // is limited to 4. + // We also take care of degenerated cases so we don't update all folders in the inventory by mistake. const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - // No marketplace, likely called in error then... - // Or not a descendent of the marketplace listings root, then just do the regular category update + // No marketplace -> likely called too early... or + // Not a descendent of the marketplace listings root -> likely called in error then... if (marketplace_listings_uuid.isNull() || !gInventory.isObjectDescendentOf(cat_id, marketplace_listings_uuid)) { + // In those cases, just do the regular category update LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); gInventory.updateCategory(cat); gInventory.notifyObservers(); return; } - // Explore all the hierarchy of folders up to the root to get them to update - // Note: this is not supposed to be deeper than 4 - LLUUID cur_id = cat_id; - LLInventoryCategory* cur_cat = gInventory.getCategory(cur_id); - while (cur_id != marketplace_listings_uuid) - { - gInventory.addChangedMask(LLInventoryObserver::LABEL, cur_id); - gInventory.notifyObservers(); - cur_id = cur_cat->getParentUUID(); - cur_cat = gInventory.getCategory(cur_id); - } + + // Grab marketplace listing data for this folder + S32 depth = depth_nesting_in_marketplace(cat_id); + LLUUID listing_uuid = nested_parent_id(cat_id, depth); + + // Update all descendents starting from the listing root + update_marketplace_folder_hierarchy(listing_uuid); + return; } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 29ce5361f0..b7c84dc714 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -687,7 +687,6 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); - update_marketplace_category((it->second).mVersionFolderId); return true; } // We need to iterate through the list to check it's not a version folder @@ -698,7 +697,6 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) { (it->second).mIsActive = activate; update_marketplace_category((it->second).mListingFolderId); - update_marketplace_category((it->second).mVersionFolderId); return true; } it++; @@ -706,20 +704,4 @@ bool LLMarketplaceData::setActivation(const LLUUID& folder_id, bool activate) return false; } -// Test methods -void LLMarketplaceData::addTestItem(const LLUUID& folder_id) -{ - llinfos << "Merov : addTestItem, id = " << folder_id << llendl; - mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id); - update_marketplace_category(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); - update_marketplace_category(folder_id); - update_marketplace_category(version_id); -} - diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index d76072da1f..0b1066a558 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -165,11 +165,6 @@ public: bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id); bool setActivation(const LLUUID& folder_id, bool activate); - // Merov : DD Development : methods to populate the items list with something usefull using - // inventory IDs and some pseudo random code so we can play with the UI... - void addTestItem(const LLUUID& folder_id); - void addTestItem(const LLUUID& folder_id, const LLUUID& version_id); - private: marketplace_items_list_t mMarketplaceItems; }; diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index cde14e72f0..0be5509333 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -5,12 +5,12 @@ name="Popup" visible="false"> + name="Marketplace Associate Listing"> + parameter="marketplace_associate_listing" /> + + + -- cgit v1.2.3 From a0f5a63a661d3ebc03e82463897c63dd35918749 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Apr 2014 15:51:28 -0700 Subject: DD-16 : WIP : Fix filtering on menu and tabs. Sort still not done --- indra/newview/llinventoryfilter.cpp | 38 +++++++++++++--------- .../skins/default/xui/en/menu_marketplace_view.xml | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 6a800cf5ba..cf5e87c717 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 "llinventoryfunctions.h" #include "llmarketplacefunctions.h" #include "llviewercontrol.h" #include "llfolderview.h" @@ -133,29 +134,34 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const } // Marketplace folder filtering - const U32 filterTypes = mFilterOps.mFilterTypes; - if (filterTypes & FILTERTYPE_MARKETPLACE_ACTIVE) - { - if (!LLMarketplaceData::instance().getActivationState(folder_id)) + S32 depth = depth_nesting_in_marketplace(folder_id); + if (depth > 0) + { + const U32 filterTypes = mFilterOps.mFilterTypes; + LLUUID listing_uuid = nested_parent_id(folder_id, depth); + if (filterTypes & FILTERTYPE_MARKETPLACE_ACTIVE) { - return false; + if (!LLMarketplaceData::instance().getActivationState(listing_uuid)) + { + return false; + } } - } - if (filterTypes & FILTERTYPE_MARKETPLACE_INACTIVE) - { - if (LLMarketplaceData::instance().getActivationState(folder_id)) + else if (filterTypes & FILTERTYPE_MARKETPLACE_INACTIVE) { - return false; + if (!LLMarketplaceData::instance().isListed(listing_uuid) || LLMarketplaceData::instance().getActivationState(listing_uuid)) + { + return false; + } } - } - if (filterTypes & FILTERTYPE_MARKETPLACE_UNASSOCIATED) - { - if (!LLMarketplaceData::instance().getListingID(folder_id).empty()) + else if (filterTypes & FILTERTYPE_MARKETPLACE_UNASSOCIATED) { - return false; + if (LLMarketplaceData::instance().isListed(listing_uuid)) + { + return false; + } } } - + // Always check against the clipboard const BOOL passed_clipboard = checkAgainstClipboard(folder_id); 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 4043c5c93d..d08cb23483 100755 --- a/indra/newview/skins/default/xui/en/menu_marketplace_view.xml +++ b/indra/newview/skins/default/xui/en/menu_marketplace_view.xml @@ -30,7 +30,7 @@ function="Marketplace.ViewSort.CheckItem" parameter="show_unassociated" /> - + -- cgit v1.2.3 From 253781f87c1653ee203ba3e7bf340747b894140d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 10 Apr 2014 18:55:07 -0700 Subject: DD-16 : Implement sort by stock count in merketplace --- indra/newview/llfloatermarketplacelistings.cpp | 2 +- indra/newview/llfolderviewmodelinventory.cpp | 32 +++++++++++++++++++++++++- indra/newview/llfolderviewmodelinventory.h | 2 ++ indra/newview/llinventoryfunctions.cpp | 5 ++++ 4 files changed, 39 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 10c6045f87..9bbe63de72 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -95,7 +95,7 @@ void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata) if (chosen_item == "sort_by_stock_amount") { mSortOrder = (mSortOrder == LLInventoryFilter::SO_FOLDERS_BY_NAME ? LLInventoryFilter::SO_FOLDERS_BY_WEIGHT : LLInventoryFilter::SO_FOLDERS_BY_NAME); - mAllPanel->getFolderViewModel()->setSorter(mSortOrder); + mAllPanel->setSortOrder(mSortOrder); } // View/filter options else if (chosen_item == "show_all") diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index aac3a41b9e..c31b40b179 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llfolderviewmodelinventory.h" #include "llinventorymodelbackgroundfetch.h" +#include "llinventoryfunctions.h" #include "llinventorypanel.h" #include "lltooldraganddrop.h" #include "llfavoritesbar.h" @@ -269,7 +270,7 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, // We sort by name if we aren't sorting by date // OR if these are folders and we are sorting folders by name. - bool by_name = (!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))); + bool by_name = ((!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))) && !mFoldersByWeight); if (a->getSortGroup() != b->getSortGroup()) { @@ -301,6 +302,35 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, return (compare < 0); } } + else if (mFoldersByWeight) + { + S32 weight_a = compute_stock_count(a->getUUID()); + S32 weight_b = compute_stock_count(b->getUUID()); + if ((weight_a != -1) || (weight_b != -1)) + { + llinfos << "Merov : sort by weight, a = " << a->getName() << ", " << weight_a << ", b = " << b->getName() << ", " << weight_b << llendl; + } + if (weight_a == weight_b) + { + // Equal weight -> use alphabetical order + return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0); + } + else if (weight_a == -1) + { + // No weight -> move a at the end of the list + return false; + } + else if (weight_b == -1) + { + // No weight -> move b at the end of the list + return true; + } + else + { + // Lighter is first (sorted in increasing order of weight) + return (weight_a < weight_b); + } + } else { time_t first_create = a->getCreationDate(); diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index 9dcfdfa185..b6d2c8502b 100755 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -89,6 +89,7 @@ public: mByDate = (mSortOrder & LLInventoryFilter::SO_DATE); mSystemToTop = (mSortOrder & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP); mFoldersByName = (mSortOrder & LLInventoryFilter::SO_FOLDERS_BY_NAME); + mFoldersByWeight = (mSortOrder & LLInventoryFilter::SO_FOLDERS_BY_WEIGHT); } bool operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const; @@ -97,6 +98,7 @@ private: bool mByDate; bool mSystemToTop; bool mFoldersByName; + bool mFoldersByWeight; }; class LLFolderViewModelInventory diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index ff38017d6f..57e1b6d9bc 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -796,6 +796,11 @@ S32 compute_stock_count(LLUUID cat_uuid) { // Handle the case of the folder being a stock folder immediately LLViewerInventoryCategory* cat = gInventory.getCategory(cat_uuid); + if (!cat) + { + // Not a category so no stock count to speak of + return -1; + } if (cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { // Note: stock folders are *not* supposed to have nested subfolders so we stop recursion here -- cgit v1.2.3 From 2a031df763ab7ea0f17f263ef9a03f53fbfb1187 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 11 Apr 2014 11:55:57 -0700 Subject: DD-12, DD-19 : Add a button to create a new listing folder. Also added a validate button though it does nothing ATM --- indra/newview/llfloatermarketplacelistings.cpp | 11 ++++++++++ indra/newview/llfloatermarketplacelistings.h | 1 + .../default/xui/en/panel_marketplace_listings.xml | 24 ++++++++++++++++++++++ 3 files changed, 36 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 9bbe63de72..dcf27baae7 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -59,6 +59,7 @@ LLPanelMarketplaceListings::LLPanelMarketplaceListings() BOOL LLPanelMarketplaceListings::postBuild() { mAllPanel = getChild("All Items"); + childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this)); // Set the sort order newest to oldest LLInventoryPanel* panel = getChild("All Items"); @@ -87,6 +88,16 @@ void LLPanelMarketplaceListings::draw() LLPanel::draw(); } +void LLPanelMarketplaceListings::onAddButtonClicked() +{ + LLUUID marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, true); + llassert(marketplacelistings_id.notNull()); + LLFolderType::EType preferred_type = LLFolderType::lookup("category"); + LLUUID category = gInventory.createNewCategory(marketplacelistings_id, preferred_type, LLStringUtil::null); + gInventory.notifyObservers(); + mAllPanel->setSelectionByID(category, TRUE); +} + void LLPanelMarketplaceListings::onViewSortMenuItemClicked(const LLSD& userdata) { std::string chosen_item = userdata.asString(); diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index 0eddd636e8..03c4fa6818 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -54,6 +54,7 @@ private: // UI callbacks void onViewSortMenuItemClicked(const LLSD& userdata); bool onViewSortMenuItemCheck(const LLSD& userdata); + void onAddButtonClicked(); LLInventoryPanel* mAllPanel; LLInventoryFilter::ESortOrderType mSortOrder; diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml index 45e0fe04c0..3b48c2e48c 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml @@ -28,6 +28,30 @@ image_selected="Toolbar_Middle_Selected" image_unselected="Toolbar_Middle_Off" menu_position="bottomleft"/> +