Commits

Anonymous committed bc985fd

Fixed low bug EXT-3684 ("Default" icon is used always for group calls in the voice notifications instead of group icon)
-- implemented LLGroupIconCtrl to show group icon for passed group UUID.
-- added LLGroupIconCtrl to incoming and outgoing dialogs

  • Participants
  • Parent commits 26fa62a
  • Branches product-engine

Comments (0)

Files changed (8)

indra/newview/CMakeLists.txt

     llgesturemgr.cpp
     llglsandbox.cpp
     llgroupactions.cpp
+    llgroupiconctrl.cpp
     llgrouplist.cpp
     llgroupmgr.cpp
     llhomelocationresponder.cpp
     llfriendcard.h
     llgesturemgr.h
     llgroupactions.h
+    llgroupiconctrl.h
     llgrouplist.h
     llgroupmgr.h
     llhomelocationresponder.h

indra/newview/llgroupiconctrl.cpp

+/** 
+ * @file llgroupiconctrl.cpp
+ * @brief LLGroupIconCtrl class implementation
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llgroupiconctrl.h"
+
+#include "llagent.h"
+/*
+#include "llavatarconstants.h"
+#include "llcallingcard.h" // for LLAvatarTracker
+#include "llavataractions.h"
+#include "llmenugl.h"
+#include "lluictrlfactory.h"
+
+#include "llcachename.h"
+#include "llagentdata.h"
+#include "llimfloater.h"
+*/
+
+static LLDefaultChildRegistry::Register<LLGroupIconCtrl> g_i("group_icon");
+
+LLGroupIconCtrl::Params::Params()
+:	group_id("group_id")
+,	draw_tooltip("draw_tooltip", true)
+,	default_icon_name("default_icon_name")
+{
+}
+
+
+LLGroupIconCtrl::LLGroupIconCtrl(const LLGroupIconCtrl::Params& p)
+:	LLIconCtrl(p)
+,	mGroupId(LLUUID::null)
+,	mDrawTooltip(p.draw_tooltip)
+,	mDefaultIconName(p.default_icon_name)
+{
+	mPriority = LLViewerFetchedTexture::BOOST_ICON;
+
+	if (p.group_id.isProvided())
+	{
+		LLSD value(p.group_id);
+		setValue(value);
+	}
+	else
+	{
+		LLIconCtrl::setValue(mDefaultIconName);
+	}
+}
+
+LLGroupIconCtrl::~LLGroupIconCtrl()
+{
+	LLGroupMgr::getInstance()->removeObserver(this);
+}
+
+void LLGroupIconCtrl::setValue(const LLSD& value)
+{
+	if (value.isUUID())
+	{
+		LLGroupMgr* gm = LLGroupMgr::getInstance();
+		if (mGroupId.notNull())
+		{
+			gm->removeObserver(this);
+		}
+
+		if (mGroupId != value.asUUID())
+		{
+			mGroupId = value.asUUID();
+
+			// Check if cache already contains image_id for that group
+			if (!updateFromCache())
+			{
+				LLIconCtrl::setValue(mDefaultIconName);
+				gm->addObserver(this);
+				gm->sendGroupPropertiesRequest(mGroupId);
+			}
+		}
+	}
+	else
+	{
+		LLIconCtrl::setValue(value);
+	}
+}
+
+void LLGroupIconCtrl::changed(LLGroupChange gc)
+{
+	if (GC_PROPERTIES == gc)
+	{
+		updateFromCache();
+	}
+}
+
+bool LLGroupIconCtrl::updateFromCache()
+{
+	LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mGroupId);
+	if (!group_data) return false;
+
+	if (group_data->mInsigniaID.notNull())
+	{
+		LLIconCtrl::setValue(group_data->mInsigniaID);
+	}
+	else
+	{
+		LLIconCtrl::setValue(mDefaultIconName);
+	}
+
+	if (mDrawTooltip && !group_data->mName.empty())
+	{
+		setToolTip(group_data->mName);
+	}
+	else
+	{
+		setToolTip(LLStringUtil::null);
+	}
+	return true;
+}
+

indra/newview/llgroupiconctrl.h

+/** 
+ * @file llgroupiconctrl.h
+ * @brief LLGroupIconCtrl class declaration
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLGROUPICONCTRL_H
+#define LL_LLGROUPICONCTRL_H
+
+#include "lliconctrl.h"
+
+#include "llgroupmgr.h"
+
+/**
+ * Extends IconCtrl to show group icon wherever it is needed.
+ * 
+ * It gets icon id by group id from the LLGroupMgr.
+ * If group data is not loaded yet it subscribes as LLGroupMgr observer and requests necessary data.
+ */
+class LLGroupIconCtrl
+	: public LLIconCtrl, public LLGroupMgrObserver
+{
+public:
+	struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
+	{
+		Optional <LLUUID> group_id;
+		Optional <bool> draw_tooltip;
+		Optional <std::string> default_icon_name;
+		Params();
+	};
+
+protected:
+	LLGroupIconCtrl(const Params&);
+	friend class LLUICtrlFactory;
+
+public:
+	virtual ~LLGroupIconCtrl();
+
+	/**
+	 * Determines group icon id by group id and sets it as icon value.
+	 *
+	 * Icon id is got from the appropriate LLGroupMgrGroupData specified by group UUID.
+	 * If necessary it requests necessary data from the LLGroupMgr.
+	 *
+	 * @params value - if LLUUID - it is processed as group id otherwise base method is called.
+	 */
+	virtual void setValue(const LLSD& value);
+
+	// LLGroupMgrObserver observer trigger
+	virtual void changed(LLGroupChange gc);
+
+	const std::string&	getGroupName() const { return mGroupName; }
+	void setDrawTooltip(bool value) { mDrawTooltip = value;}
+
+	const LLUUID&		getGroupId() const	{ return mGroupId; }
+
+protected:
+	LLUUID				mGroupId;
+	std::string			mGroupName;
+	bool				mDrawTooltip;
+	std::string			mDefaultIconName;
+
+	bool updateFromCache();
+};
+
+#endif  // LL_LLGROUPICONCTRL_H

indra/newview/llimview.cpp

 #include "llhttpnode.h"
 #include "llimfloater.h"
 #include "llimpanel.h"
+#include "llgroupiconctrl.h"
 #include "llresizebar.h"
 #include "lltabcontainer.h"
 #include "llviewercontrol.h"
 	}
 }
 
+void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
+{
+	bool is_group = gAgent.isInGroup(session_id);
+
+	LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
+	LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
+
+	avatar_icon->setVisible(!is_group);
+	group_icon->setVisible(is_group);
+
+	if (is_group)
+	{
+		group_icon->setValue(session_id);
+	}
+	else
+	{
+		avatar_icon->setValue(participant_id);
+	}
+
+}
+
 bool LLOutgoingCallDialog::lifetimeHasExpired()
 {
 	if (mLifetimeTimer.getStarted())
 	LLSD callee_id = mPayload["other_user_id"];
 	childSetTextArg("calling", "[CALLEE_NAME]", callee_name);
 	childSetTextArg("connecting", "[CALLEE_NAME]", callee_name);
-	LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
-	icon->setValue(callee_id);
+
+	// for outgoing group calls callee_id == group id == session id
+	setIcon(callee_id, callee_id);
 
 	// stop timer by default
 	mLifetimeTimer.stop();
 
 	LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name");
 	caller_name_widget->setValue(caller_name + " " + call_type);
-	LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
 	if (is_avatar)
 	{
-		icon->setValue(caller_id);
+		setIcon(session_id, caller_id);
 	}
 	else
 	{
+		LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
 		icon->setValue("Avaline_Icon");
 	}
 

indra/newview/llimview.h

 	virtual void onLifetimeExpired() {};
 
 	virtual void getAllowedRect(LLRect& rect);
+
+	/**
+	 * Sets icon depend on session.
+	 *
+	 * If passed session_id is a group id group icon will be shown, otherwise avatar icon for participant_id
+	 */
+	void setIcon(const LLSD& session_id, const LLSD& participant_id);
+
 	LLSD mPayload;
 };
 

indra/newview/skins/default/xui/en/floater_incoming_call.xml

      left_delta="19"
      top="35"
      width="36" />
+    <group_icon
+     enabled="false"
+     follows="left|top"
+     height="36"
+     layout="topleft"
+     top="35"
+     width="36" />
     <text
      clip_partial="true"
      font="SansSerifLarge"

indra/newview/skins/default/xui/en/floater_outgoing_call.xml

      left_delta="19"
      top="35"
      width="36" />
+    <group_icon
+     enabled="false"
+     follows="left|top"
+     height="36"
+     layout="topleft"
+     top="35"
+     width="36" />
     <text
      font="SansSerifLarge"
      height="20"

indra/newview/skins/default/xui/en/widgets/group_icon.xml

+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<group_icon
+ default_icon_name="Generic_Group"
+ image_name="Generic_Group"
+ name="group_icon" />