diff options
| -rw-r--r-- | indra/newview/llfloaterproperties.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llsidepaneliteminfo.cpp | 142 | ||||
| -rw-r--r-- | indra/newview/llsidepaneliteminfo.h | 15 | ||||
| -rw-r--r-- | indra/newview/llsidepaneltaskinfo.cpp | 63 | ||||
| -rw-r--r-- | indra/newview/llsidepaneltaskinfo.h | 1 | 
5 files changed, 154 insertions, 69 deletions
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index fbb7432f71..64ad40f419 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -85,7 +85,7 @@ public:  	}  	virtual void changed(U32 mask);  private: -	LLFloaterProperties* mFloater; +	LLFloaterProperties* mFloater; // Not a handle because LLFloaterProperties is managing LLPropertiesObserver  };  void LLPropertiesObserver::changed(U32 mask) diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 2503e2a5e2..d508621b41 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -49,6 +49,29 @@  #include "llviewerregion.h" +class PropertiesChangedCallback : public LLInventoryCallback +{ +public: +    PropertiesChangedCallback(LLHandle<LLPanel> sidepanel_handle, LLUUID &item_id, S32 id) +        : mHandle(sidepanel_handle), mItemId(item_id), mId(id) +    {} + +    void fire(const LLUUID &inv_item) +    { +        // inv_item can be null for some reason +        LLSidepanelItemInfo* sidepanel = dynamic_cast<LLSidepanelItemInfo*>(mHandle.get()); +        if (sidepanel) +        { +            // sidepanel waits only for most recent update +            sidepanel->onUpdateCallback(mItemId, mId); +        } +    } +private: +    LLHandle<LLPanel> mHandle; +    LLUUID mItemId; +    S32 mId; +}; +  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  // Class LLItemPropertiesObserver  // @@ -68,7 +91,7 @@ public:  	}  	virtual void changed(U32 mask);  private: -	LLSidepanelItemInfo* mFloater; +	LLSidepanelItemInfo* mFloater; // Not a handle because LLSidepanelItemInfo is managing LLItemPropertiesObserver  };  void LLItemPropertiesObserver::changed(U32 mask) @@ -115,7 +138,7 @@ public:  									  S32 serial_num,  									  void* user_data);  private: -	LLSidepanelItemInfo* mFloater; +	LLSidepanelItemInfo* mFloater;  // Not a handle because LLSidepanelItemInfo is managing LLObjectInventoryObserver  };  /*virtual*/ @@ -138,6 +161,7 @@ LLSidepanelItemInfo::LLSidepanelItemInfo(const LLPanel::Params& p)  	: LLSidepanelInventorySubpanel(p)  	, mItemID(LLUUID::null)  	, mObjectInventoryObserver(NULL) +	, mUpdatePendingId(-1)  {  	mPropertiesObserver = new LLItemPropertiesObserver(this);  } @@ -168,19 +192,19 @@ BOOL LLSidepanelItemInfo::postBuild()  	// owner permissions  	// Permissions debug text  	// group permissions -	getChild<LLUICtrl>("CheckShareWithGroup")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); +	getChild<LLUICtrl>("CheckShareWithGroup")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));  	// everyone permissions -	getChild<LLUICtrl>("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); +	getChild<LLUICtrl>("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));  	// next owner permissions -	getChild<LLUICtrl>("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); -	getChild<LLUICtrl>("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); -	getChild<LLUICtrl>("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); +	getChild<LLUICtrl>("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1)); +	getChild<LLUICtrl>("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1)); +	getChild<LLUICtrl>("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this, _1));  	// Mark for sale or not, and sale info -	getChild<LLUICtrl>("CheckPurchase")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this)); +	getChild<LLUICtrl>("CheckPurchase")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));  	// Change sale type, and sale info -	getChild<LLUICtrl>("ComboBoxSaleType")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this)); +	getChild<LLUICtrl>("ComboBoxSaleType")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));  	// "Price" label for edit -	getChild<LLUICtrl>("Edit Cost")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this)); +	getChild<LLUICtrl>("Edit Cost")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this, _1));  	refresh();  	return TRUE;  } @@ -192,11 +216,16 @@ void LLSidepanelItemInfo::setObjectID(const LLUUID& object_id)  	// Start monitoring changes in the object inventory to update  	// selected inventory item properties in Item Profile panel. See STORM-148.  	startObjectInventoryObserver(); +	mUpdatePendingId = -1;  }  void LLSidepanelItemInfo::setItemID(const LLUUID& item_id)  { -	mItemID = item_id; +    if (mItemID != item_id) +    { +        mItemID = item_id; +        mUpdatePendingId = -1; +    }  }  const LLUUID& LLSidepanelItemInfo::getObjectID() const @@ -209,6 +238,15 @@ const LLUUID& LLSidepanelItemInfo::getItemID() const  	return mItemID;  } +void LLSidepanelItemInfo::onUpdateCallback(const LLUUID& item_id, S32 received_update_id) +{ +    if (mItemID == item_id && mUpdatePendingId == received_update_id) +    { +        mUpdatePendingId = -1; +        refresh(); +    } +} +  void LLSidepanelItemInfo::reset()  {  	LLSidepanelInventorySubpanel::reset(); @@ -242,24 +280,16 @@ void LLSidepanelItemInfo::refresh()  			"LabelItemName",  			"LabelItemDesc",  			"LabelCreatorName", -			"LabelOwnerName", -			"CheckOwnerModify", -			"CheckOwnerCopy", -			"CheckOwnerTransfer", -			"CheckShareWithGroup", -			"CheckEveryoneCopy", -			"CheckNextOwnerModify", -			"CheckNextOwnerCopy", -			"CheckNextOwnerTransfer", -			"CheckPurchase", -			"Edit Cost" +			"LabelOwnerName"  		};  		for(size_t t=0; t<LL_ARRAY_SIZE(no_item_names); ++t)  		{  			getChildView(no_item_names[t])->setEnabled(false);  		} -		 + +		setPropertiesFieldsEnabled(false); +  		const std::string hide_names[]={  			"BaseMaskDebug",  			"OwnerMaskDebug", @@ -297,6 +327,11 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)  	llassert(item);  	if (!item) return; +    if (mUpdatePendingId != -1) +    { +        return; +    } +  	// do not enable the UI for incomplete items.  	BOOL is_complete = item->isFinished();  	const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType()); @@ -726,6 +761,26 @@ void LLSidepanelItemInfo::stopObjectInventoryObserver()  	mObjectInventoryObserver = NULL;  } +void LLSidepanelItemInfo::setPropertiesFieldsEnabled(bool enabled) +{ +    const std::string fields[] = { +        "CheckOwnerModify", +        "CheckOwnerCopy", +        "CheckOwnerTransfer", +        "CheckShareWithGroup", +        "CheckEveryoneCopy", +        "CheckNextOwnerModify", +        "CheckNextOwnerCopy", +        "CheckNextOwnerTransfer", +        "CheckPurchase", +        "Edit Cost" +    }; +    for (size_t t = 0; t<LL_ARRAY_SIZE(fields); ++t) +    { +        getChildView(fields[t])->setEnabled(false); +    } +} +  void LLSidepanelItemInfo::onClickCreator()  {  	LLViewerInventoryItem* item = findItem(); @@ -793,10 +848,18 @@ void LLSidepanelItemInfo::onCommitDescription()  	}  } -// static -void LLSidepanelItemInfo::onCommitPermissions() +void LLSidepanelItemInfo::onCommitPermissions(LLUICtrl* ctrl) +{ +    if (ctrl) +    { +        // will be enabled by response from server +        ctrl->setEnabled(false); +    } +    updatePermissions(); +} + +void LLSidepanelItemInfo::updatePermissions()  { -	//LL_INFOS() << "LLSidepanelItemInfo::onCommitPermissions()" << LL_ENDL;  	LLViewerInventoryItem* item = findItem();  	if(!item) return; @@ -884,19 +947,17 @@ void LLSidepanelItemInfo::onCommitPermissions()  }  // static -void LLSidepanelItemInfo::onCommitSaleInfo() +void LLSidepanelItemInfo::onCommitSaleInfo(LLUICtrl* ctrl)  { +    if (ctrl) +    { +        // will be enabled by response from server +        ctrl->setEnabled(false); +    }  	//LL_INFOS() << "LLSidepanelItemInfo::onCommitSaleInfo()" << LL_ENDL;  	updateSaleInfo();  } -// static -void LLSidepanelItemInfo::onCommitSaleType() -{ -	//LL_INFOS() << "LLSidepanelItemInfo::onCommitSaleType()" << LL_ENDL; -	updateSaleInfo(); -} -  void LLSidepanelItemInfo::updateSaleInfo()  {  	LLViewerInventoryItem* item = findItem(); @@ -977,7 +1038,12 @@ void LLSidepanelItemInfo::onCommitChanges(LLPointer<LLViewerInventoryItem> item)      if (mObjectID.isNull())      {          // This is in the agent's inventory. -        item->updateServer(FALSE); +        // Mark update as pending and wait only for most recent one in case user requested for couple +        // Once update arrives or any of ids change drop pending id. +        mUpdatePendingId++; +        LLPointer<LLInventoryCallback> callback = new PropertiesChangedCallback(getHandle(), mItemID, mUpdatePendingId); +        update_inventory_item(item.get(), callback); +        //item->updateServer(FALSE);          gInventory.updateItem(item);          gInventory.notifyObservers();      } @@ -1002,6 +1068,7 @@ void LLSidepanelItemInfo::onCommitChanges(LLPointer<LLViewerInventoryItem> item)                  // prevents flashing in content tab and some duplicated request.                  object->dirtyInventory();              } +            setPropertiesFieldsEnabled(false);          }      }  } @@ -1030,7 +1097,6 @@ void LLSidepanelItemInfo::save()  {  	onCommitName();  	onCommitDescription(); -	onCommitPermissions(); -	onCommitSaleInfo(); -	onCommitSaleType(); +	updatePermissions(); +	updateSaleInfo();  } diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h index 74cf7afe35..5f29254182 100644 --- a/indra/newview/llsidepaneliteminfo.h +++ b/indra/newview/llsidepaneliteminfo.h @@ -57,6 +57,9 @@ public:  	const LLUUID& getObjectID() const;  	const LLUUID& getItemID() const; +	// if received update and item id (from callback) matches internal ones, update UI +	void onUpdateCallback(const LLUUID& item_id, S32 received_update_id); +  protected:  	/*virtual*/ void refresh();  	/*virtual*/ void save(); @@ -71,12 +74,16 @@ private:  	void startObjectInventoryObserver();  	void stopObjectInventoryObserver(); +	void setPropertiesFieldsEnabled(bool enabled);  	LLUUID mItemID; 	// inventory UUID for the inventory item.  	LLUUID mObjectID; 	// in-world task UUID, or null if in agent inventory.  	LLItemPropertiesObserver* mPropertiesObserver; // for syncing changes to item  	LLObjectInventoryObserver* mObjectInventoryObserver; // for syncing changes to items inside an object -	 + +	// We can send multiple properties updates simultaneously, make sure only last response counts and there won't be a race condition. +	S32 mUpdatePendingId; +  	//  	// UI Elements  	//  @@ -85,9 +92,9 @@ protected:  	void 						onClickOwner();  	void 						onCommitName();  	void 						onCommitDescription(); -	void 						onCommitPermissions(); -	void 						onCommitSaleInfo(); -	void 						onCommitSaleType(); +	void 						onCommitPermissions(LLUICtrl* ctrl); +	void 						updatePermissions(); +	void 						onCommitSaleInfo(LLUICtrl* ctrl);  	void 						updateSaleInfo();  	void 						onCommitChanges(LLPointer<LLViewerInventoryItem> item);  }; diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index f03c7abc4d..7fa06f51e3 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -174,9 +174,6 @@ BOOL LLSidepanelTaskInfo::postBuild()  void LLSidepanelTaskInfo::disableAll()  { -	mDAPermModify->setEnabled(FALSE); -	mDAPermModify->setValue(LLStringUtil::null); -  	mDACreatorName->setValue(LLStringUtil::null);  	mDACreatorName->setEnabled(FALSE); @@ -184,18 +181,42 @@ void LLSidepanelTaskInfo::disableAll()  	mDAOwnerName->setValue(LLStringUtil::null);  	mDAOwnerName->setEnabled(FALSE); -	mDAButtonSetGroup->setEnabled(FALSE); -  	mDAObjectName->setValue(LLStringUtil::null);  	mDAObjectName->setEnabled(FALSE);  	mDAName->setEnabled(FALSE);  	mDADescription->setEnabled(FALSE);  	mDAObjectDescription->setValue(LLStringUtil::null);  	mDAObjectDescription->setEnabled(FALSE); -		 + +	mDAPathfindingAttributes->setEnabled(FALSE); +	mDAPathfindingAttributes->setValue(LLStringUtil::null); + +	mDAButtonSetGroup->setEnabled(FALSE); +	mDAButtonDeed->setEnabled(FALSE); + +	mDAPermModify->setEnabled(FALSE); +	mDAPermModify->setValue(LLStringUtil::null); +	mDAEditCost->setValue(LLStringUtil::null); +	mDAComboSaleType->setValue(LLSaleInfo::FS_COPY); + +	disablePermissions(); + +	mDAB->setVisible(FALSE); +	mDAO->setVisible(FALSE); +	mDAG->setVisible(FALSE); +	mDAE->setVisible(FALSE); +	mDAN->setVisible(FALSE); +	mDAF->setVisible(FALSE); + +	mOpenBtn->setEnabled(FALSE); +	mPayBtn->setEnabled(FALSE); +	mBuyBtn->setEnabled(FALSE); +} + +void LLSidepanelTaskInfo::disablePermissions() +{  	mDACheckboxShareWithGroup->setValue(FALSE);  	mDACheckboxShareWithGroup->setEnabled(FALSE); -	mDAButtonDeed->setEnabled(FALSE);  	mDACheckboxAllowEveryoneMove->setValue(FALSE);  	mDACheckboxAllowEveryoneMove->setEnabled(FALSE); @@ -217,33 +238,17 @@ void LLSidepanelTaskInfo::disableAll()  	//checkbox include in search  	mDASearchCheck->setValue(FALSE);  	mDASearchCheck->setEnabled(FALSE); -		 -	mDAComboSaleType->setValue(LLSaleInfo::FS_COPY); +  	mDAComboSaleType->setEnabled(FALSE); -	 -	mDAEditCost->setValue(LLStringUtil::null); +  	mDAEditCost->setEnabled(FALSE); -		 +  	mDALabelClickAction->setEnabled(FALSE);  	if (mDAComboClickAction)  	{  		mDAComboClickAction->setEnabled(FALSE);  		mDAComboClickAction->clear();  	} - -	mDAPathfindingAttributes->setEnabled(FALSE); -	mDAPathfindingAttributes->setValue(LLStringUtil::null); - -	mDAB->setVisible(FALSE); -	mDAO->setVisible(FALSE); -	mDAG->setVisible(FALSE); -	mDAE->setVisible(FALSE); -	mDAN->setVisible(FALSE); -	mDAF->setVisible(FALSE); -	 -	mOpenBtn->setEnabled(FALSE); -	mPayBtn->setEnabled(FALSE); -	mBuyBtn->setEnabled(FALSE);  }  void LLSidepanelTaskInfo::refresh() @@ -972,6 +977,12 @@ void LLSidepanelTaskInfo::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32  	BOOL new_state = check->get();  	LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm); + +    LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; +    if (self) +    { +        self->disablePermissions(); +    }  }  // static diff --git a/indra/newview/llsidepaneltaskinfo.h b/indra/newview/llsidepaneltaskinfo.h index cbfb07874b..dc259cb22d 100644 --- a/indra/newview/llsidepaneltaskinfo.h +++ b/indra/newview/llsidepaneltaskinfo.h @@ -95,6 +95,7 @@ protected:  	static void	doClickAction(U8 click_action);  	void disableAll(); +	void disablePermissions();  private:  	LLNameBox*		mLabelGroupName;		// group name  | 
