From 885442eb54e25f6947fe721d6e38f684f1dac995 Mon Sep 17 00:00:00 2001 From: Andrew Polunin Date: Tue, 13 Jul 2010 17:31:15 +0300 Subject: EXT-7639 FIXED (Make shop button open different URLs depending on what is selected in outfit editor) - Fixed old market place URL to the new one in the settings.xml. - Implemented the following feature: \"When Add More panel in focus selection inside it should supersede selection in accordions\". To achieve this: -- LLPanelOutfitEdit::getCOFWearablesSelectionType() function was implemented. -- LLPanelOutfitEdit::getAddMorePanelSelectionType() function was implemented. -- LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) function was implemented. -- LLPanelOutfitEdit::onShopButtonClicked() was rewritten to use those functions. - Fixed the problem with shop button and gender: now shop button for male leads to male links. Reviewed by Vadim Savchuk and Neal Orman at https://codereview.productengine.com/secondlife/r/725/ --HG-- branch : product-engine --- indra/newview/app_settings/settings.xml | 6 +-- indra/newview/llpaneloutfitedit.cpp | 85 ++++++++++++++++++++++++++++----- indra/newview/llpaneloutfitedit.h | 4 ++ 3 files changed, 81 insertions(+), 14 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1c32f33290..af296f918e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4666,7 +4666,7 @@ Type String Value - https://www.xstreetsl.com/modules.php?name=Marketplace + http://marketplace.secondlife.com/ MarketplaceURL_objectFemale @@ -4721,7 +4721,7 @@ Type String Value - https://www.xstreetsl.com/modules.php?name=Marketplace + http://marketplace.secondlife.com MarketplaceURL_bodypartMale @@ -4732,7 +4732,7 @@ Type String Value - https://www.xstreetsl.com/modules.php?name=Marketplace + http://marketplace.secondlife.com/ MarketplaceURL_glovesMale diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 6935fe03c8..8b3c5b6e93 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -71,6 +71,7 @@ #include "llsdutil.h" #include "llsidepanelappearance.h" #include "lltoggleablemenu.h" +#include "llvoavatarself.h" #include "llwearablelist.h" #include "llwearableitemslist.h" #include "llwearabletype.h" @@ -622,15 +623,52 @@ void LLPanelOutfitEdit::onShopButtonClicked() { static LLShopURLDispatcher url_resolver; + // will contain the resultant URL std::string url; + + if (isAgentAvatarValid()) + { + // try to get wearable type from 'Add More' panel first (EXT-7639) + LLWearableType::EType type = getAddMorePanelSelectionType(); + + if (type == LLWearableType::WT_NONE) + { + type = getCOFWearablesSelectionType(); + } + + ESex sex = gAgentAvatarp->getSex(); + + // WT_INVALID comes for attachments + if (type != LLWearableType::WT_INVALID && type != LLWearableType::WT_NONE) + { + url = url_resolver.resolveURL(type, sex); + } + + if (url.empty()) + { + url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex); + } + } + else + { + llwarns << "Agent avatar is invalid" << llendl; + + // the second argument is not important in this case: generic market place will be opened + url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE); + } + + LLWeb::loadURLExternal(url); +} + +LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const +{ std::vector selected_items; - mCOFWearables->getSelectedItems(selected_items); + LLWearableType::EType type = LLWearableType::WT_NONE; - ESex sex = gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE; + mCOFWearables->getSelectedItems(selected_items); if (selected_items.size() == 1) { - LLWearableType::EType type = LLWearableType::WT_NONE; LLPanel* item = selected_items.front(); // LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree @@ -642,20 +680,45 @@ void LLPanelOutfitEdit::onShopButtonClicked() { type = real_item->getWearableType(); } + } - // WT_INVALID comes for attachments - if (type != LLWearableType::WT_INVALID) + return type; +} + +LLWearableType::EType LLPanelOutfitEdit::getAddMorePanelSelectionType() const +{ + LLWearableType::EType type = LLWearableType::WT_NONE; + + if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible()) + { + if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible()) { - url = url_resolver.resolveURL(type, sex); + std::set selected_uuids = mInventoryItemsPanel->getRootFolder()->getSelectionList(); + + if (selected_uuids.size() == 1) + { + type = getWearableTypeByItemUUID(*(selected_uuids.begin())); + } } - } + else if (mWearableItemsList != NULL && mWearableItemsList->getVisible()) + { + std::vector selected_uuids; + mWearableItemsList->getSelectedUUIDs(selected_uuids); - if (url.empty()) - { - url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex); + if (selected_uuids.size() == 1) + { + type = getWearableTypeByItemUUID(selected_uuids.front()); + } + } } - LLWeb::loadURLExternal(url); + return type; +} + +LLWearableType::EType LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) const +{ + LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid); + return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE; } void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 1eef211276..7cf51b285d 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -198,6 +198,10 @@ private: void getCurrentItemUUID(LLUUID& selected_id); void onCOFChanged(); + LLWearableType::EType getCOFWearablesSelectionType() const; + LLWearableType::EType getAddMorePanelSelectionType() const; + LLWearableType::EType getWearableTypeByItemUUID(const LLUUID& item_uuid) const; + LLTextBox* mCurrentOutfitName; LLTextBox* mStatus; LLInventoryPanel* mInventoryItemsPanel; -- cgit v1.2.3