Implemented task EXT-7156 (Appearance panel: "Wear" button should become disabled and a loading indicator should appear next to the outfit name).

When user presses the "Wear" button in the outfits list, we disable the button and display a perpetual loading indicator until all wearables of the outfit being worn get loaded.

Reviewed by Sergey Litovchuk at https://codereview.productengine.com/secondlife/r/347/

--HG--
branch : product-engine
meow-7.2.2
Vadim Savchuk 2010-05-05 13:19:24 +03:00
parent c4070bd672
commit d39ef5ce6f
7 changed files with 57 additions and 0 deletions

View File

@ -1164,6 +1164,7 @@ void LLAgentWearables::createStandardWearablesAllDone()
mWearablesLoaded = TRUE;
checkWearablesLoaded();
mLoadedSignal();
updateServer();
@ -1567,6 +1568,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// Start rendering & update the server
mWearablesLoaded = TRUE;
checkWearablesLoaded();
mLoadedSignal();
queryWearableCache();
updateServer();
@ -2012,6 +2014,10 @@ BOOL LLAgentWearables::areWearablesLoaded() const
void LLAgentWearables::updateWearablesLoaded()
{
mWearablesLoaded = (itemUpdatePendingCount()==0);
if (mWearablesLoaded)
{
mLoadedSignal();
}
}
bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
@ -2091,3 +2097,8 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
outfits->done();
}
}
boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_t cb)
{
return mLoadedSignal.connect(cb);
}

View File

@ -208,6 +208,17 @@ public:
BOOL itemUpdatePending(const LLUUID& item_id) const;
U32 itemUpdatePendingCount() const;
//--------------------------------------------------------------------
// Signals
//--------------------------------------------------------------------
public:
typedef boost::function<void()> loaded_callback_t;
typedef boost::signals2::signal<void()> loaded_signal_t;
boost::signals2::connection addLoadedCallback(loaded_callback_t cb);
private:
loaded_signal_t mLoadedSignal; // emitted when all agent wearables get loaded
//--------------------------------------------------------------------
// Member variables
//--------------------------------------------------------------------

View File

@ -77,6 +77,7 @@ LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(FALSE);
gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoaded, this));
}
LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
@ -190,6 +191,7 @@ void LLPanelOutfitsInventory::onWearButtonClick()
if (!isCOFPanelActive())
{
mMyOutfitsPanel->performAction("replaceoutfit");
setWearablesLoading(true);
}
else
{
@ -642,3 +644,19 @@ BOOL LLPanelOutfitsInventory::isCOFPanelActive() const
{
return (childGetVisibleTab("appearance_tabs")->getName() == COF_TAB_NAME);
}
void LLPanelOutfitsInventory::setWearablesLoading(bool val)
{
mListCommands->childSetEnabled("wear_btn", !val);
llassert(mParent);
if (mParent)
{
mParent->setWearablesLoading(val);
}
}
void LLPanelOutfitsInventory::onWearablesLoaded()
{
setWearablesLoading(false);
}

View File

@ -123,6 +123,8 @@ protected:
void onCustomAction(const LLSD& command_name);
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
bool hasItemsSelected();
void setWearablesLoading(bool val);
void onWearablesLoaded();
private:
LLPanel* mListCommands;
LLMenuGL* mMenuGearDefault;

View File

@ -439,3 +439,9 @@ void LLSidepanelAppearance::inventoryFetched()
{
mNewOutfitBtn->setEnabled(true);
}
void LLSidepanelAppearance::setWearablesLoading(bool val)
{
childSetVisible("wearables_loading_indicator", val);
childSetVisible("edit_outfit_btn", !val);
}

View File

@ -65,6 +65,7 @@ public:
void showOutfitsInventoryPanel();
void showOutfitEditPanel();
void setWearablesLoading(bool val);
private:
void onFilterEdit(const std::string& search_string);

View File

@ -94,6 +94,14 @@ width="333">
name="edit_outfit_btn"
top="7"
width="30" />
<loading_indicator
follows="left|top"
height="24"
layout="topleft"
left="268"
name="wearables_loading_indicator"
top="6"
width="24" />
</panel>
<filter_editor
height="23"