diff options
author | Merov Linden <merov@lindenlab.com> | 2015-01-02 17:35:50 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2015-01-02 17:35:50 -0800 |
commit | 618e13a2d6c5bd632892865fc3b88051c13a7658 (patch) | |
tree | 854bde9aa1945e1ebee479c832d450ef100b8727 /indra/newview | |
parent | 37feae82998ad7373a354d9b8c295001b9befc9a (diff) |
DD-297 : Performance on login : Refactored the code so that we have a new LLMarketplaceFolderBridge class in the bridge model. Only the panels with the use_marketplace_folders param flag will use that one.
Diffstat (limited to 'indra/newview')
8 files changed, 136 insertions, 73 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4e3895ea9d..2dafbccd96 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1274,11 +1274,18 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_CATEGORY: if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) { - // Create a link folder handler instead. + // Create a link folder handler instead new_listener = new LLLinkFolderBridge(inventory, root, uuid); - break; } - new_listener = new LLFolderBridge(inventory, root, uuid); + else if (actual_asset_type == LLAssetType::AT_MARKETPLACE_FOLDER) + { + // Create a marketplace folder handler + new_listener = new LLMarketplaceFolderBridge(inventory, root, uuid); + } + else + { + new_listener = new LLFolderBridge(inventory, root, uuid); + } break; case LLAssetType::AT_LINK: case LLAssetType::AT_LINK_FOLDER: @@ -2090,71 +2097,14 @@ std::string LLFolderBridge::getLabelSuffix() const return llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str()); } - if (isMarketplaceListingsFolder()) - { - std::string suffix = ""; - // Listing folder case - if (LLMarketplaceData::instance().isListed(getUUID())) - { - suffix = llformat("%d",LLMarketplaceData::instance().getListingID(getUUID())); - if (suffix.empty()) - { - suffix = LLTrans::getString("MarketplaceNoID"); - } - suffix = " (" + suffix + ")"; - if (LLMarketplaceData::instance().getActivationState(getUUID())) - { - suffix += " (" + LLTrans::getString("MarketplaceLive") + ")"; - } - } - // Version folder case - else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) - { - suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; - } - // Add stock amount - S32 stock_count = compute_stock_count(getUUID()); - if (stock_count == 0) - { - suffix += " (" + LLTrans::getString("MarketplaceNoStock") + ")"; - } - else if (stock_count != -1) - { - if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) - { - suffix += " (" + LLTrans::getString("MarketplaceStock") + "=" + llformat("%d", stock_count) + ")"; - } - else - { - suffix += " (" + LLTrans::getString("MarketplaceMax") + "=" + llformat("%d", stock_count) + ")"; - } - } - // Add updating suffix - if (LLMarketplaceData::instance().isUpdating(getUUID())) - { - suffix += " (" + LLTrans::getString("MarketplaceUpdating") + ")"; - } - return LLInvFVBridge::getLabelSuffix() + suffix; - } - else - { - return LLInvFVBridge::getLabelSuffix(); - } + return LLInvFVBridge::getLabelSuffix(); } LLFontGL::StyleFlags LLFolderBridge::getLabelStyle() const { - if (isMarketplaceListingsFolder() && LLMarketplaceData::instance().getActivationState(getUUID())) - { - return LLFontGL::BOLD; - } - else - { - return LLFontGL::NORMAL; - } + return LLFontGL::NORMAL; } - void LLFolderBridge::update() { // we know we have children but haven't fetched them (doesn't obey filter) @@ -3283,12 +3233,6 @@ LLUIImagePtr LLFolderBridge::getIconOpen() const LLUIImagePtr LLFolderBridge::getFolderIcon(BOOL is_open) const { LLFolderType::EType preferred_type = getPreferredType(); - S32 depth = depth_nesting_in_marketplace(mUUID); - if ((preferred_type == LLFolderType::FT_NONE) && (depth == 2)) - { - // We override the type when in the marketplace listings folder and only for version folder - preferred_type = LLFolderType::FT_MARKETPLACE_VERSION; - } return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open)); } @@ -4184,6 +4128,96 @@ void LLFolderBridge::modifyOutfit(BOOL append) LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append ); } +// +=================================================+ +// | LLMarketplaceFolderBridge | +// +=================================================+ + +// LLMarketplaceFolderBridge is a specialized LLFolderBridge for use in Marketplace Inventory panels + +LLUIImagePtr LLMarketplaceFolderBridge::getIcon() const +{ + return getMarketplaceFolderIcon(FALSE); +} + +LLUIImagePtr LLMarketplaceFolderBridge::getIconOpen() const +{ + return getMarketplaceFolderIcon(TRUE); +} + +LLUIImagePtr LLMarketplaceFolderBridge::getMarketplaceFolderIcon(BOOL is_open) const +{ + LLFolderType::EType preferred_type = getPreferredType(); + S32 depth = depth_nesting_in_marketplace(mUUID); + if ((preferred_type == LLFolderType::FT_NONE) && (depth == 2)) + { + // We override the type when in the marketplace listings folder and only for version folder + preferred_type = LLFolderType::FT_MARKETPLACE_VERSION; + } + return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, is_open)); +} + +std::string LLMarketplaceFolderBridge::getLabelSuffix() const +{ + static LLCachedControl<F32> folder_loading_message_delay(gSavedSettings, "FolderLoadingMessageWaitTime", 0.5f); + + if (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= folder_loading_message_delay()) + { + return llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str()); + } + + std::string suffix = ""; + // Listing folder case + if (LLMarketplaceData::instance().isListed(getUUID())) + { + suffix = llformat("%d",LLMarketplaceData::instance().getListingID(getUUID())); + if (suffix.empty()) + { + suffix = LLTrans::getString("MarketplaceNoID"); + } + suffix = " (" + suffix + ")"; + if (LLMarketplaceData::instance().getActivationState(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceLive") + ")"; + } + } + // Version folder case + else if (LLMarketplaceData::instance().isVersionFolder(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; + } + // Add stock amount + S32 stock_count = compute_stock_count(getUUID()); + if (stock_count == 0) + { + suffix += " (" + LLTrans::getString("MarketplaceNoStock") + ")"; + } + else if (stock_count != -1) + { + if (getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) + { + suffix += " (" + LLTrans::getString("MarketplaceStock") + "=" + llformat("%d", stock_count) + ")"; + } + else + { + suffix += " (" + LLTrans::getString("MarketplaceMax") + "=" + llformat("%d", stock_count) + ")"; + } + } + // Add updating suffix + if (LLMarketplaceData::instance().isUpdating(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceUpdating") + ")"; + } + return LLInvFVBridge::getLabelSuffix() + suffix; +} + +LLFontGL::StyleFlags LLMarketplaceFolderBridge::getLabelStyle() const +{ + return (LLMarketplaceData::instance().getActivationState(getUUID()) ? LLFontGL::BOLD : LLFontGL::NORMAL); +} + + + + // helper stuff bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv* move_inv) { diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 2757f5c884..641d30040b 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -362,7 +362,7 @@ public: static LLHandle<LLFolderBridge> sSelf; static void staticFolderOptionsMenu(); -private: +protected: void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response); void perform_pasteFromClipboard(); void gatherMessage(std::string& message, LLError::ELevel log_level); @@ -683,6 +683,29 @@ public: U32 flags = 0x00) const; }; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Marketplace Inventory Panel related classes +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLMarketplaceFolderBridge : public LLFolderBridge +{ +public: + // Overloads some display related methods specific to folders in a marketplace floater context + LLMarketplaceFolderBridge(LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) : + LLFolderBridge(inventory, root, uuid) { } + + virtual LLUIImagePtr getIcon() const; + virtual LLUIImagePtr getIconOpen() const; + virtual std::string getLabelSuffix() const; + virtual LLFontGL::StyleFlags getLabelStyle() const; + +private: + LLUIImagePtr getMarketplaceFolderIcon(BOOL is_open) const; +}; + + void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment, bool replace = false); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 86ff1aed1b..a2e5e1e5d8 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -839,16 +839,16 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) if ((objectp->getType() == LLAssetType::AT_CATEGORY) && (objectp->getActualType() != LLAssetType::AT_LINK_FOLDER)) { - LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(objectp->getType(), - objectp->getType(), + LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_CATEGORY, + (mParams.use_marketplace_folders ? LLAssetType::AT_MARKETPLACE_FOLDER : LLAssetType::AT_CATEGORY), LLInventoryType::IT_CATEGORY, this, - &mInventoryViewModel, + &mInventoryViewModel, mFolderRoot.get(), objectp->getUUID()); if (new_listener) { - folder_view_item = createFolderViewFolder(new_listener,allow_drop); + folder_view_item = createFolderViewFolder(new_listener,allow_drop); } } else diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 822c7c2fe7..5edb244af6 100755 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -98,6 +98,7 @@ public: Optional<bool> show_empty_message; Optional<bool> show_root_folder; Optional<bool> allow_drop_on_root; + Optional<bool> use_marketplace_folders; Optional<LLScrollContainer::Params> scroll; Optional<bool> accepts_drag_and_drop; Optional<LLFolderView::Params> folder_view; @@ -115,6 +116,7 @@ public: show_empty_message("show_empty_message", true), show_root_folder("show_root_folder", false), allow_drop_on_root("allow_drop_on_root", true), + use_marketplace_folders("use_marketplace_folders", false), scroll("scroll"), accepts_drag_and_drop("accepts_drag_and_drop"), folder_view("folder_view"), 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 67988f3153..567e5e2724 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 @@ -12,6 +12,7 @@ start_folder.name="Marketplace listings" show_empty_message="true" show_root_folder="true" + use_marketplace_folders="true" start_folder.type="merchant" tool_tip="Drag and drop items here to list them" bg_opaque_color="DkGray2" diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml index 181eee70e2..668be27bdc 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml @@ -11,6 +11,7 @@ start_folder.name="Marketplace listings" show_empty_message="true" show_root_folder="true" + use_marketplace_folders="true" allow_drop_on_root="false" start_folder.type="merchant" bg_opaque_color="DkGray2" diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml index 6ea4784c4c..0015c85aa2 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml @@ -11,6 +11,7 @@ start_folder.name="Marketplace listings" show_empty_message="true" show_root_folder="true" + use_marketplace_folders="true" start_folder.type="merchant" bg_opaque_color="DkGray2" bg_alpha_color="DkGray2" diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml index 0d19d09918..ec9c176811 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml @@ -11,6 +11,7 @@ start_folder.name="Marketplace listings" show_empty_message="true" show_root_folder="true" + use_marketplace_folders="true" allow_drop_on_root="false" start_folder.type="merchant" bg_opaque_color="DkGray2" |