CHUI-268 (Transfer the common functionality from LLNearbyChat and LLIMFloater to LLIMConversation): moved focusLost(), focusReceived and enable/disable of the call button to base class
parent
681406427f
commit
3cf624b371
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "llchatentry.h"
|
||||
#include "llchathistory.h"
|
||||
#include "llchiclet.h"
|
||||
#include "llchicletbar.h"
|
||||
#include "lldraghandle.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llimfloater.h"
|
||||
|
|
@ -53,6 +55,8 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id)
|
|||
, mInputEditorTopPad(0)
|
||||
, mRefreshTimer(new LLTimer())
|
||||
{
|
||||
mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
|
||||
|
||||
mCommitCallbackRegistrar.add("IMSession.Menu.Action",
|
||||
boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2));
|
||||
mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem",
|
||||
|
|
@ -182,6 +186,44 @@ void LLIMConversation::draw()
|
|||
}
|
||||
}
|
||||
|
||||
void LLIMConversation::enableDisableCallBtn()
|
||||
{
|
||||
getChildView("voice_call_btn")->setEnabled(
|
||||
mSessionID.notNull()
|
||||
&& mSession
|
||||
&& mSession->mSessionInitialized
|
||||
&& LLVoiceClient::getInstance()->voiceEnabled()
|
||||
&& LLVoiceClient::getInstance()->isVoiceWorking()
|
||||
&& mSession->mCallBackEnabled);
|
||||
}
|
||||
|
||||
|
||||
void LLIMConversation::onFocusReceived()
|
||||
{
|
||||
setBackgroundOpaque(true);
|
||||
|
||||
if (mSessionID.notNull())
|
||||
{
|
||||
LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true);
|
||||
|
||||
if (getVisible())
|
||||
{
|
||||
// suppress corresponding toast only if this floater is visible and have focus
|
||||
LLIMModel::getInstance()->setActiveSessionID(mSessionID);
|
||||
LLIMModel::instance().sendNoUnreadMessages(mSessionID);
|
||||
}
|
||||
}
|
||||
|
||||
LLTransientDockableFloater::onFocusReceived();
|
||||
}
|
||||
|
||||
void LLIMConversation::onFocusLost()
|
||||
{
|
||||
setBackgroundOpaque(false);
|
||||
LLTransientDockableFloater::onFocusLost();
|
||||
}
|
||||
|
||||
|
||||
void LLIMConversation::buildParticipantList()
|
||||
{
|
||||
if (mIsNearbyChat)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "lltransientdockablefloater.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "lleventtimer.h"
|
||||
#include "llimview.h"
|
||||
#include "llconversationmodel.h"
|
||||
|
||||
class LLPanelChatControlPanel;
|
||||
|
|
@ -87,9 +88,6 @@ protected:
|
|||
// refresh a visual state of the Call button
|
||||
void updateCallBtnState(bool callIsActive);
|
||||
|
||||
// set the enable/disable state for the Call button
|
||||
virtual void enableDisableCallBtn() = 0;
|
||||
|
||||
void buildParticipantList();
|
||||
void onSortMenuItemClicked(const LLSD& userdata);
|
||||
|
||||
|
|
@ -99,9 +97,18 @@ protected:
|
|||
/// Update floater header and toolbar buttons when hosted/torn off state is toggled.
|
||||
void updateHeaderAndToolbar();
|
||||
|
||||
// set the enable/disable state for the Call button
|
||||
virtual void enableDisableCallBtn();
|
||||
|
||||
// process focus events to set a currently active session
|
||||
/* virtual */ void onFocusLost();
|
||||
/* virtual */ void onFocusReceived();
|
||||
|
||||
bool mIsNearbyChat;
|
||||
bool mIsP2PChat;
|
||||
|
||||
LLIMModel::LLIMSession* mSession;
|
||||
|
||||
LLLayoutPanel* mParticipantListPanel;
|
||||
LLParticipantList* mParticipantList;
|
||||
LLUUID mSessionID;
|
||||
|
|
@ -119,7 +126,6 @@ private:
|
|||
/// Refreshes the floater at a constant rate.
|
||||
virtual void refresh() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Adjusts chat history height to fit vertically with input chat field
|
||||
* and avoid overlapping, since input chat field can be vertically expanded.
|
||||
|
|
|
|||
|
|
@ -92,24 +92,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
|
|||
setDocked(true);
|
||||
}
|
||||
|
||||
void LLIMFloater::onFocusLost()
|
||||
{
|
||||
LLIMModel::getInstance()->resetActiveSessionID();
|
||||
|
||||
LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false);
|
||||
}
|
||||
|
||||
void LLIMFloater::onFocusReceived()
|
||||
{
|
||||
LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true);
|
||||
|
||||
if (getVisible())
|
||||
{
|
||||
// suppress corresponding toast only if this floater is visible and have focus
|
||||
LLIMModel::getInstance()->setActiveSessionID(mSessionID);
|
||||
LLIMModel::instance().sendNoUnreadMessages(mSessionID);
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLIMFloater::refresh()
|
||||
|
|
@ -513,27 +495,6 @@ void LLIMFloater::boundVoiceChannel()
|
|||
}
|
||||
}
|
||||
|
||||
void LLIMFloater::enableDisableCallBtn()
|
||||
{
|
||||
bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled()
|
||||
&& LLVoiceClient::getInstance()->isVoiceWorking();
|
||||
|
||||
if (mSession)
|
||||
{
|
||||
bool session_initialized = mSession->mSessionInitialized;
|
||||
bool callback_enabled = mSession->mCallBackEnabled;
|
||||
|
||||
BOOL enable_connect =
|
||||
session_initialized && voice_enabled && callback_enabled;
|
||||
getChildView("voice_call_btn")->setEnabled(enable_connect);
|
||||
}
|
||||
else
|
||||
{
|
||||
getChildView("voice_call_btn")->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLIMFloater::onCallButtonClicked()
|
||||
{
|
||||
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
|
||||
|
|
|
|||
|
|
@ -134,10 +134,6 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
// process focus events to set a currently active session
|
||||
/* virtual */ void onFocusLost();
|
||||
/* virtual */ void onFocusReceived();
|
||||
|
||||
/*virtual*/ void refresh();
|
||||
|
||||
/*virtual*/ void onClickCloseBtn();
|
||||
|
|
@ -169,9 +165,6 @@ private:
|
|||
|
||||
void onCallButtonClicked();
|
||||
|
||||
// set the enable/disable state for the Call button
|
||||
virtual void enableDisableCallBtn();
|
||||
|
||||
void boundVoiceChannel();
|
||||
|
||||
// Add the "User is typing..." indicator.
|
||||
|
|
@ -184,8 +177,6 @@ private:
|
|||
|
||||
static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
|
||||
|
||||
|
||||
LLIMModel::LLIMSession* mSession;
|
||||
S32 mLastMessageIndex;
|
||||
|
||||
EInstantMessage mDialog;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd)
|
|||
setIsChrome(TRUE);
|
||||
mKey = LLSD();
|
||||
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
|
||||
mSessionID = LLUUID();
|
||||
setName("nearby_chat");
|
||||
setIsSingleInstance(TRUE);
|
||||
}
|
||||
|
|
@ -216,21 +217,6 @@ bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void LLNearbyChat::onFocusReceived()
|
||||
{
|
||||
setBackgroundOpaque(true);
|
||||
LLIMConversation::onFocusReceived();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void LLNearbyChat::onFocusLost()
|
||||
{
|
||||
setBackgroundOpaque(false);
|
||||
LLIMConversation::onFocusLost();
|
||||
}
|
||||
|
||||
BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
|
|
@ -326,13 +312,6 @@ void LLNearbyChat::setVisible(BOOL visible)
|
|||
}
|
||||
|
||||
|
||||
void LLNearbyChat::enableDisableCallBtn()
|
||||
{
|
||||
// bool btn_enabled = LLAgent::isActionAllowed("speak");
|
||||
|
||||
getChildView("voice_call_btn")->setEnabled(false /*btn_enabled*/);
|
||||
}
|
||||
|
||||
void LLNearbyChat::onTearOffClicked()
|
||||
{
|
||||
LLIMConversation::onTearOffClicked();
|
||||
|
|
|
|||
|
|
@ -51,10 +51,6 @@ public:
|
|||
/*virtual*/ BOOL postBuild();
|
||||
/*virtual*/ void onOpen(const LLSD& key);
|
||||
|
||||
// focus overrides
|
||||
/*virtual*/ void onFocusLost();
|
||||
/*virtual*/ void onFocusReceived();
|
||||
|
||||
/*virtual*/ void setVisible(BOOL visible);
|
||||
|
||||
void loadHistory();
|
||||
|
|
@ -102,9 +98,6 @@ protected:
|
|||
|
||||
void displaySpeakingIndicator();
|
||||
|
||||
// set the enable/disable state for the Call button
|
||||
virtual void enableDisableCallBtn();
|
||||
|
||||
// Which non-zero channel did we last chat on?
|
||||
static S32 sLastSpecialChatChannel;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue