diff options
| author | Seth ProductEngine <slitovchuk@productengine.com> | 2012-06-08 01:08:58 +0300 | 
|---|---|---|
| committer | Seth ProductEngine <slitovchuk@productengine.com> | 2012-06-08 01:08:58 +0300 | 
| commit | 9b92235291382deac15b860efa281f625d2173dd (patch) | |
| tree | eec4900a7ea58dfba6b7e4ade12ac1508ebf17e9 /indra | |
| parent | 8353a1ab4d9dab891535b766329c5d92323fe3b6 (diff) | |
CHUI-120 WIP Added conversations participants drag and drop from avatar lists to IM floaters.
- Added new drag and drop type DAD_PERSON and source SOURCE_PEOPLE to avoid highliting the toolbars when using SOURCE_VIEWER.
- Disabled calling card drop support as it is considered obsolete.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llcommon/llassettype.cpp | 1 | ||||
| -rw-r--r-- | indra/llcommon/llassettype.h | 3 | ||||
| -rw-r--r-- | indra/llcommon/stdenums.h | 3 | ||||
| -rw-r--r-- | indra/llinventory/llinventorytype.cpp | 3 | ||||
| -rw-r--r-- | indra/llinventory/llinventorytype.h | 3 | ||||
| -rw-r--r-- | indra/newview/llavatarlistitem.cpp | 58 | ||||
| -rw-r--r-- | indra/newview/llavatarlistitem.h | 3 | ||||
| -rw-r--r-- | indra/newview/llimconversation.cpp | 12 | ||||
| -rw-r--r-- | indra/newview/llimfloater.cpp | 97 | ||||
| -rw-r--r-- | indra/newview/llimfloater.h | 12 | ||||
| -rw-r--r-- | indra/newview/lltoolbarview.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/lltooldraganddrop.h | 3 | ||||
| -rw-r--r-- | indra/newview/llviewerassettype.cpp | 2 | 
14 files changed, 120 insertions, 84 deletions
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 5e566d6c7c..5ae2df3994 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -95,6 +95,7 @@ LLAssetDictionary::LLAssetDictionary()  	addEntry(LLAssetType::AT_LINK_FOLDER, 		new AssetEntry("FOLDER_LINK",		"link_f", 	"sym folder link",	false,		false,		true));  	addEntry(LLAssetType::AT_MESH,              new AssetEntry("MESH",              "mesh",     "mesh",             false,      false,      false));  	addEntry(LLAssetType::AT_WIDGET,            new AssetEntry("WIDGET",            "widget",   "widget",           false,      false,      false)); +	addEntry(LLAssetType::AT_PERSON,            new AssetEntry("PERSON",            "person",   "person",           false,      false,      false));  	addEntry(LLAssetType::AT_NONE, 				new AssetEntry("NONE",				"-1",		NULL,		  		FALSE,		FALSE,		FALSE));  }; diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index d538accbf7..69b01731e5 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -112,6 +112,9 @@ public:  		AT_WIDGET = 40,  			// UI Widget: this is *not* an inventory asset type, only a viewer side asset (e.g. button, other ui items...) +		AT_PERSON = 45, +			// A user uuid  which is not an inventory asset type, used in viewer only for adding a person to a chat via drag and drop. +  		AT_MESH = 49,  			// Mesh data in our proprietary SLM format diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h index 40b3364b36..efcbe76795 100644 --- a/indra/llcommon/stdenums.h +++ b/indra/llcommon/stdenums.h @@ -51,7 +51,8 @@ enum EDragAndDropType  	DAD_LINK			= 14,  	DAD_MESH            = 15,  	DAD_WIDGET          = 16, -	DAD_COUNT           = 17,   // number of types in this enum +	DAD_PERSON          = 17, +	DAD_COUNT           = 18,   // number of types in this enum  };  // Reasons for drags to be denied. diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 8282d79b67..8807b36117 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -85,6 +85,7 @@ LLInventoryDictionary::LLInventoryDictionary()  	addEntry(LLInventoryType::IT_GESTURE,             new InventoryEntry("gesture",   "gesture",       1, LLAssetType::AT_GESTURE));   	addEntry(LLInventoryType::IT_MESH,                new InventoryEntry("mesh",      "mesh",          1, LLAssetType::AT_MESH));  	addEntry(LLInventoryType::IT_WIDGET,              new InventoryEntry("widget",    "widget",        1, LLAssetType::AT_WIDGET)); +	addEntry(LLInventoryType::IT_PERSON,              new InventoryEntry("person",    "person",        1, LLAssetType::AT_PERSON));  } @@ -140,7 +141,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =  	LLInventoryType::IT_NONE,			// 42	AT_NONE  	LLInventoryType::IT_NONE,			// 43	AT_NONE  	LLInventoryType::IT_NONE,			// 44	AT_NONE -	LLInventoryType::IT_NONE,			// 45	AT_NONE +	LLInventoryType::IT_PERSON,			// 45	AT_PERSON  	LLInventoryType::IT_NONE,			// 46	AT_NONE  	LLInventoryType::IT_NONE,			// 47	AT_NONE  	LLInventoryType::IT_NONE,			// 48	AT_NONE diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index 4d1e0db040..645ebab234 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -63,7 +63,8 @@ public:  		IT_GESTURE = 20,  		IT_MESH = 22,  		IT_WIDGET = 23, -		IT_COUNT = 24, +		IT_PERSON = 24, +		IT_COUNT = 25,  		IT_NONE = -1  	}; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 30eecfe323..e670d3ea04 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -31,6 +31,7 @@  #include "llavatarlistitem.h"  #include "llbutton.h" +#include "llclipboard.h"  #include "llfloaterreg.h"  #include "lltextutil.h" @@ -38,6 +39,7 @@  #include "llavatarnamecache.h"  #include "llavatariconctrl.h"  #include "lloutputmonitorctrl.h" +#include "lltooldraganddrop.h"  bool LLAvatarListItem::sStaticInitialized = false;  S32 LLAvatarListItem::sLeftPadding = 0; @@ -334,6 +336,62 @@ BOOL LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask)  	return LLPanel::handleDoubleClick(x, y, mask);  } +BOOL LLAvatarListItem::handleMouseDown(S32 x, S32 y, MASK mask) +{ +	if (LLUICtrl::handleMouseDown(x, y, mask)) +	{ +		return TRUE; +	} + +	gFocusMgr.setMouseCapture(this); + +	S32 screen_x; +	S32 screen_y; +	localPointToScreen(x, y, &screen_x, &screen_y); +	LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); + +	return TRUE; +} + +BOOL LLAvatarListItem::handleMouseUp( S32 x, S32 y, MASK mask ) +{ +	if (LLUICtrl::childrenHandleMouseUp(x, y, mask)) +	{ +		return TRUE; +	} + +	if(hasMouseCapture()) +	{ +		gFocusMgr.setMouseCapture(NULL); +	} +	return TRUE; +} + +BOOL LLAvatarListItem::handleHover(S32 x, S32 y, MASK mask) +{ +	bool handled = hasMouseCapture(); +	if(handled) +	{ +		S32 screen_x; +		S32 screen_y; +		localPointToScreen(x, y, &screen_x, &screen_y); + +		if(LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y)) +		{ +			// First, create the global drag and drop object +			std::vector<EDragAndDropType> types; +			uuid_vec_t cargo_ids; +			types.push_back(DAD_PERSON); +			cargo_ids.push_back(mAvatarId); +			gClipboard.setSourceObject(mAvatarId, LLAssetType::AT_PERSON); +			LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_PEOPLE; +			LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src); +		} +	} + +	return handled; +} +  void LLAvatarListItem::setValue( const LLSD& value )  {  	if (!value.isMap()) return;; diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index c95ac39696..28a50870d4 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -112,6 +112,9 @@ public:  	void onProfileBtnClick();  	/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); +	/*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); +	/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); +	/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);  protected:  	/** diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index d8c7c63e9e..ec2a9196d4 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -83,8 +83,10 @@ BOOL LLIMConversation::postBuild()  	mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMConversation::onSlide, this));  	mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel"); -	mParticipantListPanel->setVisible( -			mIsNearbyChat? false : gSavedSettings.getBOOL("IMShowControlPanel")); + +	// Show the participants list in torn off floaters only. +	mParticipantListPanel->setVisible(gSavedSettings.getBOOL("IMShowControlPanel") +									  && !mIsNearbyChat); // *TODO: temporarily disabled for Nearby chat  	mExpandCollapseBtn->setImageOverlay(  				getString(mParticipantListPanel->getVisible() ? "collapse_icon" : "expand_icon"));  	mExpandCollapseBtn->setEnabled(!mIsP2PChat); @@ -209,12 +211,10 @@ void LLIMConversation::updateHeaderAndToolbar()  	}  	bool is_control_panel_visible = false; -	if (!mIsP2PChat) -	{  		// Control panel should be visible only in torn off floaters.  		is_control_panel_visible = !is_hosted && gSavedSettings.getBOOL("IMShowControlPanel"); -		mParticipantListPanel->setVisible(is_control_panel_visible); -	} +		mParticipantListPanel->setVisible(!mIsP2PChat && is_control_panel_visible +				&& !mIsNearbyChat); // *TODO: temporarily disabled for Nearby chat  	// Display collapse image (<<) if the floater is hosted  	// or if it is torn off but has an open control panel. diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f49375798d..6a510c4df1 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -986,90 +986,55 @@ void LLIMFloater::processSessionUpdate(const LLSD& session_update)  	}  } -BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, -		BOOL drop, EDragAndDropType cargo_type, -		void *cargo_data, EAcceptance *accept, -		std::string& tooltip_msg) +// virtual +BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +									EDragAndDropType cargo_type, +									void* cargo_data, +									EAcceptance* accept, +									std::string& tooltip_msg)  { -	if (mDialog == IM_NOTHING_SPECIAL) -	{ -		LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, -				cargo_type, cargo_data, accept); -	} - -	// handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites -	else if (isInviteAllowed()) +	if (cargo_type == DAD_PERSON)  	{ -		*accept = ACCEPT_NO; - -		if (cargo_type == DAD_CALLINGCARD) +		if (dropPerson(static_cast<LLInventoryObject*>(cargo_data), drop))  		{ -			if (dropCallingCard((LLInventoryItem*) cargo_data, drop)) -			{ -				*accept = ACCEPT_YES_MULTI; -			} +			*accept = ACCEPT_YES_MULTI;  		} -		else if (cargo_type == DAD_CATEGORY) +		else  		{ -			if (dropCategory((LLInventoryCategory*) cargo_data, drop)) -			{ -				*accept = ACCEPT_YES_MULTI; -			} +			*accept = ACCEPT_NO;  		}  	}  	return TRUE;  } -BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) +bool LLIMFloater::dropPerson(LLInventoryObject* item, bool drop)  { -	BOOL rv = isInviteAllowed(); -	if (rv && item && item->getCreatorUUID().notNull()) +	bool res = item && item->getUUID().notNull(); +	if(res)  	{ -		if (drop) -		{ -			uuid_vec_t ids; -			ids.push_back(item->getCreatorUUID()); -			inviteToSession(ids); -		} -	} -	else -	{ -		// set to false if creator uuid is null. -		rv = FALSE; -	} -	return rv; -} +		uuid_vec_t ids; +		ids.push_back(item->getUUID()); -BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) -{ -	BOOL rv = isInviteAllowed(); -	if (rv && category) -	{ -		LLInventoryModel::cat_array_t cats; -		LLInventoryModel::item_array_t items; -		LLUniqueBuddyCollector buddies; -		gInventory.collectDescendentsIf(category->getUUID(), -				cats, -				items, -				LLInventoryModel::EXCLUDE_TRASH, -				buddies); -		S32 count = items.count(); -		if (count == 0) -		{ -			rv = FALSE; -		} -		else if (drop) +		res = canAddSelectedToChat(ids); +		if(res && drop)  		{ -			uuid_vec_t ids; -			ids.reserve(count); -			for (S32 i = 0; i < count; ++i) +			if (mIsP2PChat)  			{ -				ids.push_back(items.get(i)->getCreatorUUID()); +				mStartConferenceInSameFloater = true; +				onClose(false); + +				ids.push_back(mOtherParticipantUUID); + +				LLAvatarActions::startConference(ids, mSessionID); +			} +			else +			{ +				inviteToSession(ids);  			} -			inviteToSession(ids);  		}  	} -	return rv; + +	return res;  }  BOOL LLIMFloater::isInviteAllowed() const diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index b5822db8dd..b02f779637 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -114,10 +114,11 @@ public:  	void processAgentListUpdates(const LLSD& body);  	void processSessionUpdate(const LLSD& session_update); -	BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, -			BOOL drop, EDragAndDropType cargo_type, -			void *cargo_data, EAcceptance *accept, -			std::string& tooltip_msg); +	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +									   EDragAndDropType cargo_type, +									   void* cargo_data, +									   EAcceptance* accept, +									   std::string& tooltip_msg);  	//used as a callback on receiving new IM message @@ -137,8 +138,7 @@ private:  	// For display name lookups for IM window titles  	void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); -	BOOL dropCallingCard(LLInventoryItem* item, BOOL drop); -	BOOL dropCategory(LLInventoryCategory* category, BOOL drop); +	bool dropPerson(LLInventoryObject* item, bool drop);  	BOOL isInviteAllowed() const;  	BOOL inviteToSession(const uuid_vec_t& agent_ids); diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index eccb2cf2f1..e71cf66a96 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -603,7 +603,7 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp  BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar)  {  	BOOL handled = FALSE; -	LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; +	LLInventoryObject* inv_item = static_cast<LLInventoryObject*>(cargo_data);  	LLAssetType::EType type = inv_item->getType();  	if (type == LLAssetType::AT_WIDGET) diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index c7ab934f9e..ee79a53f43 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -2526,7 +2526,7 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(  			item = (LLViewerInventoryItem*)preview->getDragItem();  		}  	} -	else if(mSource == SOURCE_VIEWER) +	else if(mSource == SOURCE_VIEWER || mSource == SOURCE_PEOPLE)  	{  		item = (LLViewerInventoryItem*)gClipboard.getSourceObject();  	} diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 245c2a23e6..44980ffdb3 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -67,7 +67,8 @@ public:  		SOURCE_WORLD,  		SOURCE_NOTECARD,  		SOURCE_LIBRARY, -		SOURCE_VIEWER +		SOURCE_VIEWER, +		SOURCE_PEOPLE  	};  	void beginDrag(EDragAndDropType type, diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp index a4b1c2155f..08ba5a5f25 100644 --- a/indra/newview/llviewerassettype.cpp +++ b/indra/newview/llviewerassettype.cpp @@ -83,6 +83,8 @@ LLViewerAssetDictionary::LLViewerAssetDictionary()  	addEntry(LLViewerAssetType::AT_WIDGET, 				new ViewerAssetEntry(DAD_WIDGET)); +	addEntry(LLViewerAssetType::AT_PERSON, 				new ViewerAssetEntry(DAD_PERSON)); +  	addEntry(LLViewerAssetType::AT_NONE, 				new ViewerAssetEntry(DAD_NONE));  };  | 
