[LLIMMgr/LLIMPanel Revision] Clean up construction of IM Floaters, so much redundant code!!

Removes mProfileButtonEnabled and lookupName()
This commit is contained in:
Inusaito Sayori
2013-10-10 04:14:09 -04:00
parent 0a874b0768
commit b049353178
2 changed files with 20 additions and 59 deletions

View File

@@ -318,70 +318,47 @@ LLFloaterIMPanel::LLFloaterIMPanel(
} }
// set P2P type by default // set P2P type by default
// [Ansariel: Display name support]
mProfileButtonEnabled = FALSE;
// [/Ansariel: Display name support]
static LLCachedControl<bool> concise_im("UseConciseIMButtons"); static LLCachedControl<bool> concise_im("UseConciseIMButtons");
static LLCachedControl<bool> concise_group("UseConciseGroupChatButtons"); std::string xml_filename = concise_im ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml";
static LLCachedControl<bool> concise_conf("UseConciseConferenceButtons");
std::string xml_filename;
switch(mDialog) switch(mDialog)
{ {
case IM_SESSION_GROUP_START: case IM_SESSION_GROUP_START:
mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
xml_filename = concise_group ? "floater_instant_message_group_concisebuttons.xml" : "floater_instant_message_group.xml";
mVoiceChannel = new LLVoiceChannelGroup(mSessionUUID, mSessionLabel);
break;
case IM_SESSION_INVITE: case IM_SESSION_INVITE:
mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); case IM_SESSION_CONFERENCE_START:
// determine whether it is group or conference session
if (gAgent.isInGroup(mSessionUUID)) if (gAgent.isInGroup(mSessionUUID))
{ {
xml_filename = concise_group ? "floater_instant_message_group_concisebuttons.xml" : "floater_instant_message_group.xml"; static LLCachedControl<bool> concise("UseConciseGroupChatButtons");
xml_filename = concise ? "floater_instant_message_group_concisebuttons.xml" : "floater_instant_message_group.xml";
mSessionType = GROUP_SESSION;
} }
else // must be invite to ad hoc IM else
{ {
xml_filename = concise_conf ? "floater_instant_message_ad_hoc_concisebuttons.xml" : "floater_instant_message_ad_hoc.xml"; static LLCachedControl<bool> concise("UseConciseConferenceButtons");
xml_filename = concise ? "floater_instant_message_ad_hoc_concisebuttons.xml" : "floater_instant_message_ad_hoc.xml";
mSessionType = ADHOC_SESSION;
} }
mVoiceChannel = new LLVoiceChannelGroup(mSessionUUID, mSessionLabel);
break;
case IM_SESSION_P2P_INVITE:
xml_filename = concise_im ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml";
mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mSessionLabel, mOtherParticipantUUID);
break;
case IM_SESSION_CONFERENCE_START:
mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
xml_filename = concise_conf ? "floater_instant_message_ad_hoc_concisebuttons.xml" : "floater_instant_message_ad_hoc.xml"; mVoiceChannel = new LLVoiceChannelGroup(mSessionUUID, mLogLabel);
mVoiceChannel = new LLVoiceChannelGroup(mSessionUUID, mSessionLabel);
break; break;
// just received text from another user // just received text from another user
case IM_NOTHING_SPECIAL: case IM_NOTHING_SPECIAL:
xml_filename = concise_im ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml";
mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID); mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID);
mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID);
mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID); mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID);
// fallthrough
mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mSessionLabel, mOtherParticipantUUID); case IM_SESSION_P2P_INVITE:
if (LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID))
LLAvatarNameCache::get(mOtherParticipantUUID, boost::bind(&LLFloaterIMPanel::onAvatarNameLookup, this, _2));
mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mLogLabel, mOtherParticipantUUID);
LLAvatarTracker::instance().addParticularFriendObserver(mOtherParticipantUUID, this); LLAvatarTracker::instance().addParticularFriendObserver(mOtherParticipantUUID, this);
break; break;
default: default:
llwarns << "Unknown session type" << llendl; llwarns << "Unknown session type" << llendl;
xml_filename = concise_im ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml";
break; break;
} }
if ( (IM_NOTHING_SPECIAL != mDialog) && (IM_SESSION_P2P_INVITE != mDialog) )
{
// determine whether it is group or conference session
if (gAgent.isInGroup(mSessionUUID))
mSessionType = GROUP_SESSION;
else
mSessionType = ADHOC_SESSION;
}
mSpeakers = new LLIMSpeakerMgr(mVoiceChannel); mSpeakers = new LLIMSpeakerMgr(mVoiceChannel);
LLUICtrlFactory::getInstance()->buildFloater(this, LLUICtrlFactory::getInstance()->buildFloater(this,
@@ -391,14 +368,6 @@ LLFloaterIMPanel::LLFloaterIMPanel(
setTitle(mLogLabel); setTitle(mLogLabel);
// [Ansariel: Display name support]
if (mProfileButtonEnabled)
{
lookupName();
}
// [/Ansariel: Display name support]
// enable line history support for instant message bar // enable line history support for instant message bar
mInputEditor->setEnableLineHistory(TRUE); mInputEditor->setEnableLineHistory(TRUE);
@@ -437,12 +406,7 @@ LLFloaterIMPanel::LLFloaterIMPanel(
} }
} }
void LLFloaterIMPanel::lookupName() void LLFloaterIMPanel::onAvatarNameLookup(const LLAvatarName& avatar_name)
{
LLAvatarNameCache::get(mOtherParticipantUUID, boost::bind(&LLFloaterIMPanel::onAvatarNameLookup, this, _1, _2));
}
void LLFloaterIMPanel::onAvatarNameLookup(const LLUUID&, const LLAvatarName& avatar_name)
{ {
std::string title; std::string title;
LLAvatarNameCache::getPNSName(avatar_name, title); LLAvatarNameCache::getPNSName(avatar_name, title);

View File

@@ -63,8 +63,7 @@ public:
const LLDynamicArray<LLUUID>& ids = LLDynamicArray<LLUUID>()); const LLDynamicArray<LLUUID>& ids = LLDynamicArray<LLUUID>());
virtual ~LLFloaterIMPanel(); virtual ~LLFloaterIMPanel();
void lookupName(); void onAvatarNameLookup(const LLAvatarName& avatar_name);
void onAvatarNameLookup(const LLUUID&, const LLAvatarName& avatar_name);
/*virtual*/ void changed(U32 mask); // From LLFriendObserver, check friend status /*virtual*/ void changed(U32 mask); // From LLFriendObserver, check friend status
/*virtual*/ BOOL postBuild(); /*virtual*/ BOOL postBuild();
@@ -224,8 +223,6 @@ private:
bool mShowSpeakersOnConnect; bool mShowSpeakersOnConnect;
BOOL mProfileButtonEnabled;
bool mDing; // Whether or not to play a ding on new messages bool mDing; // Whether or not to play a ding on new messages
bool mRPMode; bool mRPMode;