Bug fix: circumvent using LLs notify system.

Can't use LLs LLFolderViewItem::rename from
LLInventoryPanel::modelChanged because it's nonrobust spaghetti code
and causes randomly sized loops.

Also cleaned up the number of unused nameOrDescriptionChanged functions
introduced in a previous commit.
This commit is contained in:
Aleric Inglewood
2013-07-20 18:28:52 +02:00
parent 7162214c01
commit 85ff52be30
10 changed files with 33 additions and 63 deletions

View File

@@ -598,21 +598,29 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
}
}
void LLAgentWearables::descriptionChanged(LLUUID const& item_id)
void LLAgentWearables::nameOrDescriptionChanged(LLUUID const& item_id)
{
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
for (int i = 0; i < LLWearableType::WT_COUNT; ++i)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
LLWearableType::EType type = (LLWearableType::EType)i;
for (U32 j = 0; j < getWearableCount(type); ++j)
{
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
LLUUID curr_item_id = getWearableItemID(type, j);
if (curr_item_id == item_id)
{
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
LLViewerWearable* wearable = getViewerWearable(type, j);
llassert(wearable);
if (!wearable) continue;
wearable->refreshNameAndDescription();
break;
// Update the name in the appearance editor.
if (LLFloaterCustomize::instanceExists())
{
LLFloaterCustomize::getInstance()->wearablesChanged(type);
}
return;
}
}
}

View File

@@ -116,7 +116,7 @@ public:
// void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove);
void setWearableName(const LLUUID& item_id, const std::string& new_name);
void descriptionChanged(LLUUID const& item_id);
void nameOrDescriptionChanged(LLUUID const& item_id);
// *TODO: Move this into llappearance/LLWearableData ?
void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);

View File

@@ -67,7 +67,7 @@ public:
virtual void showProperties(void) = 0;
virtual BOOL isItemRenameable() const = 0;
virtual BOOL renameItem(const std::string& new_name) = 0;
virtual void descriptionChanged(void) const = 0;
virtual void nameOrDescriptionChanged(void) const { } // Singu note: Currently only used by LLWearableBridge.
virtual BOOL isItemMovable( void ) const = 0; // Can be moved to another folder
virtual BOOL isItemRemovable( void ) const = 0; // Can be destroyed
virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.

View File

@@ -615,12 +615,12 @@ void LLFolderViewItem::rename(const std::string& new_name)
}
}
void LLFolderViewItem::descriptionChanged(void) const
void LLFolderViewItem::nameOrDescriptionChanged(void) const
{
// We don't have a description, but the listener does!
// Inform the listeners. Our name was already updated (and we don't have a description).
if( mListener )
{
mListener->descriptionChanged();
mListener->nameOrDescriptionChanged();
}
}

View File

@@ -277,8 +277,8 @@ public:
// just rename the object.
void rename(const std::string& new_name);
// Alert mListener that the description of this item changed.
void descriptionChanged(void) const;
// Alert mListener that the name or description of this item changed.
void nameOrDescriptionChanged(void) const;
// open
virtual void openItem( void );

View File

@@ -1724,11 +1724,6 @@ BOOL LLItemBridge::renameItem(const std::string& new_name)
return FALSE;
}
void LLItemBridge::descriptionChanged(void) const
{
// Nothing to do.
}
BOOL LLItemBridge::removeItem()
{
if(!isItemRemovable())
@@ -2970,12 +2965,6 @@ BOOL LLFolderBridge::renameItem(const std::string& new_name)
return FALSE;
}
void LLFolderBridge::descriptionChanged(void) const
{
// A folder has no description.
llerrs << "Calling LLFolderBridge::descriptionChanged" << llendl;
}
BOOL LLFolderBridge::removeItem()
{
if(!isItemRemovable())
@@ -5480,11 +5469,6 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
return FALSE;
}
void LLObjectBridge::descriptionChanged(void) const
{
// Nothing to do.
}
// +=================================================+
// | LLLSLTextBridge |
// +=================================================+
@@ -5643,11 +5627,11 @@ BOOL LLWearableBridge::renameItem(const std::string& new_name)
return LLItemBridge::renameItem(new_name);
}
void LLWearableBridge::descriptionChanged(void) const
void LLWearableBridge::nameOrDescriptionChanged(void) const
{
if (get_is_item_worn(mUUID))
{
gAgentWearables.descriptionChanged(mUUID);
gAgentWearables.nameOrDescriptionChanged(mUUID);
}
}

View File

@@ -211,7 +211,6 @@ public:
virtual time_t getCreationDate() const;
virtual BOOL isItemRenameable() const;
virtual BOOL renameItem(const std::string& new_name);
virtual void descriptionChanged(void) const;
virtual BOOL removeItem();
virtual BOOL isItemCopyable() const;
virtual BOOL hasChildren() const { return FALSE; }
@@ -258,7 +257,6 @@ public:
static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
virtual BOOL renameItem(const std::string& new_name);
virtual void descriptionChanged(void) const;
virtual BOOL removeItem();
BOOL removeSystemFolder();
@@ -468,7 +466,6 @@ public:
virtual std::string getLabelSuffix() const;
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual BOOL renameItem(const std::string& new_name);
virtual void descriptionChanged(void) const;
LLInventoryObject* getObject() const;
protected:
static LLUUID sContextMenuItemID; // Only valid while the context menu is open.
@@ -502,7 +499,7 @@ public:
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual std::string getLabelSuffix() const;
virtual BOOL renameItem(const std::string& new_name);
virtual void descriptionChanged(void) const;
virtual void nameOrDescriptionChanged(void) const;
virtual LLWearableType::EType getWearableType() const { return mWearableType; }
static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu

View File

@@ -479,8 +479,8 @@ void LLInventoryPanel::modelChanged(U32 mask)
view_item->refresh();
}
// Singu note: let listeners know it was renamed.
view_item->rename(view_item->getLabel());
// Singu note: Needed to propagate name change to wearables.
view_item->nameOrDescriptionChanged();
}
}
@@ -491,7 +491,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
{
if (view_item)
{
view_item->descriptionChanged();
view_item->nameOrDescriptionChanged();
}
}

View File

@@ -933,12 +933,7 @@ void LLPanelEditWearable::setWearableIndex(S32 index)
LLViewerWearable* wearable = gAgentWearables.getViewerWearable(mType,mCurrentIndex);
if(wearable == getWearable())
return;
mCurrentWearable = wearable;
// Singu note: Set title even if the wearable didn't change: the name might have changed (when renamed).
if(wearable)
{
childSetTextArg("title", "[DESC]", wearable->getName() );
@@ -950,6 +945,11 @@ void LLPanelEditWearable::setWearableIndex(S32 index)
childSetTextArg("title_no_modify", "[DESC]", std::string(LLWearableType::getTypeLabel( mType )));
}
if(wearable == getWearable())
return;
mCurrentWearable = wearable;
if(mActiveModal)
mActiveModal->close();

View File

@@ -123,7 +123,6 @@ public:
virtual void selectItem() {}
virtual BOOL isItemRenameable() const;
virtual BOOL renameItem(const std::string& new_name);
virtual void descriptionChanged(void) const;
virtual BOOL isItemMovable() const;
virtual BOOL isItemRemovable() const;
virtual BOOL removeItem();
@@ -431,11 +430,6 @@ BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name)
return TRUE;
}
void LLTaskInvFVBridge::descriptionChanged(void) const
{
// Nothing to do.
}
BOOL LLTaskInvFVBridge::isItemMovable() const
{
//LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
@@ -820,7 +814,6 @@ public:
virtual BOOL isItemRenameable() const;
// virtual BOOL isItemCopyable() const { return FALSE; }
virtual BOOL renameItem(const std::string& new_name);
virtual void descriptionChanged(void) const;
virtual BOOL isItemRemovable() const;
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual BOOL hasChildren() const;
@@ -861,12 +854,6 @@ BOOL LLTaskCategoryBridge::renameItem(const std::string& new_name)
return FALSE;
}
void LLTaskCategoryBridge::descriptionChanged(void) const
{
// A category has no description.
llerrs << "Calling LLTaskCategoryBridge::descriptionChanged" << llendl;
}
BOOL LLTaskCategoryBridge::isItemRemovable() const
{
return FALSE;
@@ -1182,7 +1169,6 @@ public:
virtual BOOL isItemRenameable() const;
virtual BOOL renameItem(const std::string& new_name);
virtual void descriptionChanged(void) const;
};
BOOL LLTaskCallingCardBridge::isItemRenameable() const
@@ -1195,11 +1181,6 @@ BOOL LLTaskCallingCardBridge::renameItem(const std::string& new_name)
return FALSE;
}
void LLTaskCallingCardBridge::descriptionChanged(void) const
{
// Nothing to do.
}
///----------------------------------------------------------------------------
/// Class LLTaskScriptBridge
///----------------------------------------------------------------------------