summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorSeth ProductEngine <slitovchuk@productengine.com>2012-06-08 01:08:58 +0300
committerSeth ProductEngine <slitovchuk@productengine.com>2012-06-08 01:08:58 +0300
commit9b92235291382deac15b860efa281f625d2173dd (patch)
treeeec4900a7ea58dfba6b7e4ade12ac1508ebf17e9 /indra/newview
parent8353a1ab4d9dab891535b766329c5d92323fe3b6 (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/newview')
-rw-r--r--indra/newview/llavatarlistitem.cpp58
-rw-r--r--indra/newview/llavatarlistitem.h3
-rw-r--r--indra/newview/llimconversation.cpp12
-rw-r--r--indra/newview/llimfloater.cpp97
-rw-r--r--indra/newview/llimfloater.h12
-rw-r--r--indra/newview/lltoolbarview.cpp2
-rw-r--r--indra/newview/lltooldraganddrop.cpp2
-rw-r--r--indra/newview/lltooldraganddrop.h3
-rw-r--r--indra/newview/llviewerassettype.cpp2
9 files changed, 110 insertions, 81 deletions
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));
};