From 89825da530f0f5bb4ed2f5260c213174a34f28d8 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 18 Jun 2010 17:28:32 +0300 Subject: EXT-7777 WIP Implemented loading indicator for "Save" and "Save As" actions in "My Outfits" & "Edit Outfit" Panels. EXT-7929 FIXED Updated functionality of attaching object: loading indicator gets hidden when attaching is completed. - Fixed crash when accessing singleton on application exit. - Updated functionality of attaching object: loading indicator was not hidden. * Reason: link to attachment was created without next appearance updating. * Fix: passed "true" into LLAppearanceMgr::addCOFItemLink to call LLAppearanceMgr::updateAppearanceFromCOF when attachments is completed. (Like for clothing). Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/611/ --HG-- branch : product-engine --- indra/newview/llagentwearables.cpp | 9 ++++++++ indra/newview/llagentwearables.h | 9 +++++++- indra/newview/llagentwearablesfetch.cpp | 1 + indra/newview/llappearancemgr.cpp | 19 +++++++++++++--- indra/newview/llpaneloutfitedit.cpp | 25 ++++++++++++++++++++++ indra/newview/llpaneloutfitedit.h | 1 + .../skins/default/xui/en/panel_outfit_edit.xml | 16 ++++++++++---- 7 files changed, 72 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 3923749e64..66866618e1 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -47,6 +47,7 @@ #include "llinventorypanel.h" #include "llmd5.h" #include "llnotificationsutil.h" +#include "lloutfitobserver.h" #include "llpaneloutfitsinventory.h" #include "llsidepanelappearance.h" #include "llsidetray.h" @@ -179,6 +180,13 @@ void LLAgentWearables::cleanup() { } +// static +void LLAgentWearables::initClass() +{ + // this can not be called from constructor because its instance is global and is created too early. + LLOutfitObserver::instance().addCOFSavedCallback(boost::bind(&LLAgentWearables::notifyLoadingFinished, &gAgentWearables)); +} + void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar) { if (avatar) @@ -931,6 +939,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs // notify subscribers that wearables started loading. See EXT-7777 // *TODO: find more proper place to not be called from deprecated method. + // Seems such place is found: LLInitialWearablesFetch::processContents() gAgentWearables.notifyLoadingStarted(); mInitialWearablesUpdateReceived = true; diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 05913825dd..8122971db6 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -33,9 +33,13 @@ #ifndef LL_LLAGENTWEARABLES_H #define LL_LLAGENTWEARABLES_H +// libraries #include "llmemory.h" +#include "llui.h" #include "lluuid.h" #include "llinventory.h" + +// newview #include "llinventorymodel.h" #include "llviewerinventory.h" #include "llvoavatardefines.h" @@ -47,7 +51,7 @@ class LLInitialWearablesFetch; class LLViewerObject; class LLTexLayerTemplate; -class LLAgentWearables +class LLAgentWearables : public LLInitClass { //-------------------------------------------------------------------- // Constructors / destructors / Initializers @@ -61,6 +65,9 @@ public: void createStandardWearables(BOOL female); void cleanup(); void dump(); + + // LLInitClass interface + static void initClass(); protected: void createStandardWearablesDone(S32 type, U32 index/* = 0*/); void createStandardWearablesAllDone(); diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index ef0b97d376..931aba1d41 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -121,6 +121,7 @@ void LLInitialWearablesFetch::processContents() LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); if (wearable_array.count() > 0) { + gAgentWearables.notifyLoadingStarted(); LLAppearanceMgr::instance().updateAppearanceFromCOF(); } else diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4e96372da9..405cc5b282 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -177,7 +177,13 @@ class LLUpdateDirtyState: public LLInventoryCallback { public: LLUpdateDirtyState() {} - virtual ~LLUpdateDirtyState(){ LLAppearanceMgr::getInstance()->updateIsDirty(); } + virtual ~LLUpdateDirtyState() + { + if (LLAppearanceMgr::instanceExists()) + { + LLAppearanceMgr::getInstance()->updateIsDirty(); + } + } virtual void fire(const LLUUID&) {} }; @@ -2150,6 +2156,8 @@ bool LLAppearanceMgr::updateBaseOutfit() } setOutfitLocked(true); + gAgentWearables.notifyLoadingStarted(); + const LLUUID base_outfit_id = getBaseOutfitUUID(); if (base_outfit_id.isNull()) return false; @@ -2309,6 +2317,7 @@ public: } LLAppearanceMgr::getInstance()->updateIsDirty(); + gAgentWearables.notifyLoadingFinished(); // New outfit is saved. LLAppearanceMgr::getInstance()->updatePanelOutfitName(""); } @@ -2324,6 +2333,8 @@ LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, b { if (!isAgentAvatarValid()) return LLUUID::null; + gAgentWearables.notifyLoadingStarted(); + // First, make a folder in the My Outfits directory. const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); LLUUID folder_id = gInventory.createNewCategory( @@ -2530,7 +2541,9 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id) if (mAttachmentInvLinkEnabled) { - LLAppearanceMgr::addCOFItemLink(item_id, false); // Add COF link for item. + // we have to pass do_update = true to call LLAppearanceMgr::updateAppearanceFromCOF. + // it will trigger gAgentWariables.notifyLoadingFinished() + LLAppearanceMgr::addCOFItemLink(item_id, true); // Add COF link for item. } else { @@ -2560,7 +2573,7 @@ void LLAppearanceMgr::linkRegisteredAttachments() ++it) { LLUUID item_id = *it; - addCOFItemLink(item_id, false); + addCOFItemLink(item_id, true); } mRegisteredAttachments.clear(); } diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 8da7432e0a..5fac7efb84 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -60,6 +60,7 @@ #include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" +#include "llloadingindicator.h" #include "llpaneloutfitsinventory.h" #include "lluiconstants.h" #include "llsaveoutfitcombobtn.h" @@ -262,6 +263,9 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this)); observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this)); observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::update, this)); + + gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true)); + gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false)); mFolderViewItemTypes.reserve(NUM_FOLDER_VIEW_ITEM_TYPES); for (U32 i = 0; i < NUM_FOLDER_VIEW_ITEM_TYPES; i++) @@ -902,6 +906,27 @@ void LLPanelOutfitEdit::showFilteredWearablesListView(LLWearableType::EType type applyListViewFilter((EListViewItemType) (LVIT_SHAPE + type)); } +static void update_status_widget_rect(LLView * widget, S32 right_border) +{ + LLRect rect = widget->getRect(); + rect.mRight = right_border; + widget->setShape(rect); +} + +void LLPanelOutfitEdit::onOutfitChanging(bool started) +{ + static LLLoadingIndicator* indicator = getChild("edit_outfit_loading_indicator"); + static LLView* status_panel = getChild("outfit_name_and_status"); + static S32 indicator_delta = status_panel->getRect().getWidth() - indicator->getRect().mLeft; + + S32 delta = started ? indicator_delta : 0; + S32 right_border = status_panel->getRect().getWidth() - delta; + + update_status_widget_rect(mCurrentOutfitName, right_border); + update_status_widget_rect(mStatus, right_border); + + indicator->setVisible(started); +} // EOF diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 1705e3043b..484f3fcb9f 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -191,6 +191,7 @@ private: void onGearButtonClick(LLUICtrl* clicked_button); void onAddMoreButtonClicked(); void showFilteredWearablesListView(LLWearableType::EType type); + void onOutfitChanging(bool started); LLTextBox* mCurrentOutfitName; diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index 03a0c464d2..1ed73e6c15 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -106,7 +106,7 @@ + width="245" /> + width="245" /> + -- cgit v1.2.3