СHUI-818 FIXED For group toasts: show name of the group in Titlebar; add [From User_DisplayName] before text of the message.

meow-7.2.2
Mnikolenko ProductEngine 2013-04-04 16:12:29 +03:00
parent b9a96474e3
commit c081d4e249
2 changed files with 26 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "lltoastimpanel.h"
#include "llagent.h"
#include "llavatarnamecache.h"
#include "llfloaterreg.h"
#include "llgroupactions.h"
#include "llgroupiconctrl.h"
@ -61,6 +62,15 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif
style_params.font.name(font_name);
style_params.font.size(font_size);
LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(p.session_id);
mIsGroupMsg = (im_session->mSessionType == LLIMModel::LLIMSession::GROUP_SESSION);
if(mIsGroupMsg)
{
mAvatarName->setValue(im_session->mName);
LLAvatarName avatar_name;
LLAvatarNameCache::get(p.avatar_id, &avatar_name);
p.message = "[From " + avatar_name.getDisplayName() + "]\n" + p.message;
}
//Handle IRC styled /me messages.
std::string prefix = p.message.substr(0, 4);
@ -81,12 +91,17 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif
mMessage->setText(p.message, style_params);
}
mAvatarName->setValue(p.from);
if(!mIsGroupMsg)
{
mAvatarName->setValue(p.from);
}
mTime->setValue(p.time);
mSessionID = p.session_id;
mAvatarID = p.avatar_id;
mNotification = p.notification;
initIcon();
S32 maxLinesCount;
@ -147,7 +162,14 @@ void LLToastIMPanel::spawnNameToolTip()
LLToolTip::Params params;
params.background_visible(false);
params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_avatar", LLSD().with("avatar_id", mAvatarID), FALSE));
if(!mIsGroupMsg)
{
params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_avatar", LLSD().with("avatar_id", mAvatarID), FALSE));
}
else
{
params.click_callback(boost::bind(&LLFloaterReg::showInstance, "inspect_group", LLSD().with("group_id", mSessionID), FALSE));
}
params.delay_time(0.0f); // spawn instantly on hover
params.image(LLUI::getUIImage("Info_Small"));
params.message("");

View File

@ -73,6 +73,8 @@ private:
LLTextBox* mAvatarName;
LLTextBox* mTime;
LLTextBox* mMessage;
bool mIsGroupMsg;
};
#endif // LLTOASTIMPANEL_H_