diff options
author | Mike Antipov <mantipov@productengine.com> | 2009-12-26 18:56:19 +0200 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2009-12-26 18:56:19 +0200 |
commit | 70e6b5a7f7027b7f9c005ca1ce43601f953dc951 (patch) | |
tree | 561a4c63ee5f5199af74000a13b53f5622e1b256 /indra/newview | |
parent | c3f2859c9f91d0c26c256b498c29da624afb8fb9 (diff) |
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
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llgroupiconctrl.cpp | 145 | ||||
-rw-r--r-- | indra/newview/llgroupiconctrl.h | 92 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llimview.h | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_incoming_call.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_outgoing_call.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/group_icon.xml | 5 |
8 files changed, 293 insertions, 4 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a26aae3590..648e582e94 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -227,6 +227,7 @@ set(viewer_SOURCE_FILES llgesturemgr.cpp llglsandbox.cpp llgroupactions.cpp + llgroupiconctrl.cpp llgrouplist.cpp llgroupmgr.cpp llhomelocationresponder.cpp @@ -736,6 +737,7 @@ set(viewer_HEADER_FILES llfriendcard.h llgesturemgr.h llgroupactions.h + llgroupiconctrl.h llgrouplist.h llgroupmgr.h llhomelocationresponder.h diff --git a/indra/newview/llgroupiconctrl.cpp b/indra/newview/llgroupiconctrl.cpp new file mode 100644 index 0000000000..0b03d49cbc --- /dev/null +++ b/indra/newview/llgroupiconctrl.cpp @@ -0,0 +1,145 @@ +/** + * @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; +} + diff --git a/indra/newview/llgroupiconctrl.h b/indra/newview/llgroupiconctrl.h new file mode 100644 index 0000000000..7ac2ca0219 --- /dev/null +++ b/indra/newview/llgroupiconctrl.h @@ -0,0 +1,92 @@ +/** + * @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 diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 37ab144934..d34bab8c4d 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -57,6 +57,7 @@ #include "llhttpnode.h" #include "llimfloater.h" #include "llimpanel.h" +#include "llgroupiconctrl.h" #include "llresizebar.h" #include "lltabcontainer.h" #include "llviewercontrol.h" @@ -1495,6 +1496,27 @@ void LLCallDialog::draw() } } +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()) @@ -1556,8 +1578,9 @@ void LLOutgoingCallDialog::show(const LLSD& key) 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(); @@ -1711,13 +1734,13 @@ BOOL LLIncomingCallDialog::postBuild() 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"); } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index cec9d1642f..b0f5f3d813 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -501,6 +501,14 @@ protected: 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; }; diff --git a/indra/newview/skins/default/xui/en/floater_incoming_call.xml b/indra/newview/skins/default/xui/en/floater_incoming_call.xml index b9ce11600f..1d67123726 100644 --- a/indra/newview/skins/default/xui/en/floater_incoming_call.xml +++ b/indra/newview/skins/default/xui/en/floater_incoming_call.xml @@ -43,6 +43,13 @@ 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" diff --git a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml index 104ac2143f..eb772cc0bd 100644 --- a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml +++ b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml @@ -39,6 +39,13 @@ 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" diff --git a/indra/newview/skins/default/xui/en/widgets/group_icon.xml b/indra/newview/skins/default/xui/en/widgets/group_icon.xml new file mode 100644 index 0000000000..58d5e19fcc --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/group_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<group_icon + default_icon_name="Generic_Group" + image_name="Generic_Group" + name="group_icon" /> |