Pull and merge from ssh://stinson@hg.lindenlab.com/richard/viewer-chui.

master
William Todd Stinson 2012-12-18 19:15:53 -08:00
commit accad65d6a
9 changed files with 276 additions and 17 deletions

View File

@ -73,8 +73,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id)
mTypingTimer(),
mTypingTimeoutTimer(),
mPositioned(false),
mSessionInitialized(false),
mStartConferenceInSameFloater(false)
mSessionInitialized(false)
{
mIsNearbyChat = false;
@ -83,6 +82,9 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id)
setOverlapsScreenChannel(true);
LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this);
mEnableCallbackRegistrar.add("Avatar.EnableGearItem", boost::bind(&LLFloaterIMSession::enableGearMenuItem, this, _2));
mCommitCallbackRegistrar.add("Avatar.GearDoToSelected", boost::bind(&LLFloaterIMSession::GearDoToSelected, this, _2));
mEnableCallbackRegistrar.add("Avatar.CheckGearItem", boost::bind(&LLFloaterIMSession::checkGearMenuItem, this, _2));
setDocked(true);
}
@ -190,6 +192,36 @@ void LLFloaterIMSession::onSendMsg( LLUICtrl* ctrl, void* userdata )
self->setTyping(false);
}
bool LLFloaterIMSession::enableGearMenuItem(const LLSD& userdata)
{
std::string command = userdata.asString();
uuid_vec_t selected_uuids;
selected_uuids.push_back(mOtherParticipantUUID);
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
return floater_container->enableContextMenuItem(command, selected_uuids);
}
void LLFloaterIMSession::GearDoToSelected(const LLSD& userdata)
{
std::string command = userdata.asString();
uuid_vec_t selected_uuids;
selected_uuids.push_back(mOtherParticipantUUID);
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
floater_container->doToParticipants(command, selected_uuids);
}
bool LLFloaterIMSession::checkGearMenuItem(const LLSD& userdata)
{
std::string command = userdata.asString();
uuid_vec_t selected_uuids;
selected_uuids.push_back(mOtherParticipantUUID);
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
return floater_container->checkContextMenuItem(command, selected_uuids);
}
void LLFloaterIMSession::sendMsgFromInputEditor()
{
if (gAgent.isGodlike()
@ -429,8 +461,6 @@ void LLFloaterIMSession::addP2PSessionParticipants(const LLSD& notification, con
return;
}
mStartConferenceInSameFloater = true;
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
// first check whether this is a voice session

View File

@ -99,6 +99,9 @@ public:
void setPositioned(bool b) { mPositioned = b; };
void onVisibilityChange(const LLSD& new_visibility);
bool enableGearMenuItem(const LLSD& userdata);
void GearDoToSelected(const LLSD& userdata);
bool checkGearMenuItem(const LLSD& userdata);
// Implements LLVoiceClientStatusObserver::onChange() to enable the call
// button when voice is available
@ -124,8 +127,6 @@ public:
//used as a callback on receiving new IM message
static void sRemoveTypingIndicator(const LLSD& data);
static void onIMChicletCreated(const LLUUID& session_id);
bool getStartConferenceInSameFloater() const { return mStartConferenceInSameFloater; }
const LLUUID& getOtherParticipantUUID() {return mOtherParticipantUUID;}
static boost::signals2::connection setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb);
@ -185,8 +186,6 @@ private:
bool mSessionInitialized;
LLSD mQueuedMsgsForInit;
bool mStartConferenceInSameFloater;
uuid_vec_t mInvitedParticipants;
// connection to voice channel state change signal

View File

@ -177,6 +177,7 @@ void LLFloaterIMSessionTab::addToHost(const LLUUID& session_id)
// LLFloater::mLastHostHandle = floater_container (a "future" host)
conversp->setHost(floater_container);
conversp->setHost(NULL);
conversp->forceReshape();
}
// Added floaters share some state (like sort order) with their host
conversp->setSortOrder(floater_container->getSortOrder());
@ -197,6 +198,8 @@ BOOL LLFloaterIMSessionTab::postBuild()
mTearOffBtn = getChild<LLButton>("tear_off_btn");
mTearOffBtn->setCommitCallback(boost::bind(&LLFloaterIMSessionTab::onTearOffClicked, this));
mGearBtn = getChild<LLButton>("gear_btn");
mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
// Add a scroller for the folder (participant) view
@ -224,7 +227,8 @@ BOOL LLFloaterIMSessionTab::postBuild()
setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
mSaveRect = isTornOff();
mSaveRect = isNearbyChat()
&& !gSavedSettings.getBOOL("NearbyChatIsNotTornOff");
initRectControl();
if (isChatMultiTab())
@ -239,11 +243,11 @@ BOOL LLFloaterIMSessionTab::postBuild()
// Now ready to build the conversation and participants list
buildConversationViewParticipant();
refreshConversation();
// Zero expiry time is set only once to allow initial update.
mRefreshTimer->setTimerExpirySec(0);
mRefreshTimer->start();
initBtns();
return result;
}
@ -649,6 +653,15 @@ void LLFloaterIMSessionTab::updateHeaderAndToolbar()
showTranslationCheckbox();
}
void LLFloaterIMSessionTab::forceReshape()
{
LLRect floater_rect = getRect();
reshape(llmax(floater_rect.getWidth(), this->getMinWidth()),
llmax(floater_rect.getHeight(), this->getMinHeight()),
true);
}
void LLFloaterIMSessionTab::reshapeChatHistory()
{
@ -755,7 +768,58 @@ void LLFloaterIMSessionTab::onTearOffClicked()
mSaveRect = isTornOff();
initRectControl();
LLFloater::onClickTearOff(this);
if (isTornOff())
{
forceReshape();
}
refreshConversation();
updateGearBtn();
}
void LLFloaterIMSessionTab::updateGearBtn()
{
BOOL prevVisibility = mGearBtn->getVisible();
mGearBtn->setVisible(checkIfTornOff() && mIsP2PChat);
// Move buttons if Gear button changed visibility
if(prevVisibility != mGearBtn->getVisible())
{
LLRect gear_btn_rect = mGearBtn->getRect();
LLRect add_btn_rect = getChild<LLButton>("add_btn")->getRect();
LLRect call_btn_rect = getChild<LLButton>("voice_call_btn")->getRect();
S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight;
S32 right_shift = gear_btn_rect.getWidth() + gap_width;
if(mGearBtn->getVisible())
{
// Move buttons to the right to give space for Gear button
add_btn_rect.translate(right_shift,0);
call_btn_rect.translate(right_shift,0);
}
else
{
add_btn_rect.translate(-right_shift,0);
call_btn_rect.translate(-right_shift,0);
}
getChild<LLButton>("add_btn")->setRect(add_btn_rect);
getChild<LLButton>("voice_call_btn")->setRect(call_btn_rect);
}
}
void LLFloaterIMSessionTab::initBtns()
{
LLRect gear_btn_rect = mGearBtn->getRect();
LLRect add_btn_rect = getChild<LLButton>("add_btn")->getRect();
LLRect call_btn_rect = getChild<LLButton>("voice_call_btn")->getRect();
S32 gap_width = call_btn_rect.mLeft - add_btn_rect.mRight;
S32 right_shift = gear_btn_rect.getWidth() + gap_width;
add_btn_rect.translate(-right_shift,0);
call_btn_rect.translate(-right_shift,0);
getChild<LLButton>("add_btn")->setRect(add_btn_rect);
getChild<LLButton>("voice_call_btn")->setRect(call_btn_rect);
}
// static

View File

@ -92,10 +92,13 @@ public:
void setSortOrder(const LLConversationSort& order);
virtual void onTearOffClicked();
void updateGearBtn();
void initBtns();
virtual void updateMessages() {}
LLConversationItem* getCurSelectedViewModelItem();
void forceReshape();
protected:
// callback for click on any items of the visual states menu
@ -157,6 +160,8 @@ protected:
LLButton* mExpandCollapseBtn;
LLButton* mTearOffBtn;
LLButton* mCloseBtn;
LLButton* mGearBtn;
private:
// Handling selection and contextual menu

View File

@ -2699,12 +2699,13 @@ LLUUID LLIMMgr::addSession(
{
LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(floater_id);
if (im_floater && im_floater->getStartConferenceInSameFloater())
if (im_floater)
{
// The IM floater should be initialized with a new session_id
// so that it is found by that id when creating a chiclet in LLFloaterIMSession::onIMChicletCreated,
// and a new floater is not created.
im_floater->initIMSession(session_id);
im_floater->reloadMessages();
}
}

View File

@ -38,7 +38,7 @@
name="conversations_layout_panel"
min_dim="38"
width="225"
expanded_min_dim="200">
expanded_min_dim="156">
<layout_stack
animate="false"
follows="left|top|right"
@ -108,7 +108,7 @@
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left="5"
left="1"
name="expand_collapse_btn"
tool_tip="Collapse/Expand this list"
width="31" />
@ -128,7 +128,7 @@
auto_resize="true"
user_resize="true"
name="messages_layout_panel"
expanded_min_dim="225">
expanded_min_dim="222">
<panel_container
bottom="-1"
follows="all"

View File

@ -79,6 +79,21 @@
tool_tip="View/sort options"
top="5"
width="31" />
<menu_button
menu_filename="menu_im_conversation.xml"
follows="top|left"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="OptionsMenu_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_pad="4"
name="gear_btn"
visible="false"
tool_tip="Actions on selected person"
width="31"/>
<button
enabled="false"
follows="top|left"

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<toggleable_menu
layout="topleft"
name="Conversation Gear Menu">
<menu_item_call
label="View Profile"
layout="topleft"
name="View Profile">
<on_click function="Avatar.GearDoToSelected" parameter="view_profile" />
<on_enable function="Avatar.EnableGearItem" parameter="can_view_profile" />
</menu_item_call>
<menu_item_call
label="Add Friend"
layout="topleft"
name="Add Friend">
<on_click function="Avatar.GearDoToSelected" parameter="add_friend" />
<on_enable function="Avatar.EnableGearItem" parameter="can_add" />
</menu_item_call>
<menu_item_call
label="Remove friend"
layout="topleft"
name="remove_friend">
<on_click function="Avatar.GearDoToSelected" parameter="remove_friend" />
<on_enable function="Avatar.EnableGearItem" parameter="can_delete" />
</menu_item_call>
<menu_item_call
label="Offer teleport"
layout="topleft"
name="offer_teleport">
<on_click function="Avatar.GearDoToSelected" parameter="offer_teleport"/>
<on_enable function="Avatar.EnableGearItem" parameter="can_offer_teleport"/>
</menu_item_call>
<menu_item_call
label="Invite to group..."
layout="topleft"
name="invite_to_group">
<on_click function="Avatar.GearDoToSelected" parameter="invite_to_group" />
<on_enable function="Avatar.EnableGearItem" parameter="can_invite" />
</menu_item_call>
<menu_item_separator
layout="topleft"
name="View Icons Separator" />
<menu_item_call
label="Chat history..."
layout="topleft"
name="chat_history">
<on_click function="Avatar.GearDoToSelected" parameter="chat_history"/>
<on_enable function="Avatar.EnableGearItem" parameter="can_chat_history"/>
</menu_item_call>
<menu_item_separator
layout="topleft"/>
<menu_item_call
label="Map"
layout="topleft"
name="map">
<on_click function="Avatar.GearDoToSelected" parameter="map" />
<on_enable function="Avatar.EnableGearItem" parameter="can_show_on_map" />
</menu_item_call>
<menu_item_call
label="Share"
layout="topleft"
name="Share">
<on_click function="Avatar.GearDoToSelected" parameter="share" />
<on_enable function="Avatar.EnableGearItem" parameter="can_share" />
</menu_item_call>
<menu_item_call
label="Pay"
layout="topleft"
name="Pay">
<on_click function="Avatar.GearDoToSelected" parameter="pay" />
<on_enable function="Avatar.EnableGearItem" parameter="can_pay" />
</menu_item_call>
<menu_item_separator
layout="topleft"/>
<menu_item_check
label="Block Voice"
layout="topleft"
name="Block/Unblock">
<on_check function="Avatar.CheckGearItem" parameter="is_blocked" />
<on_click function="Avatar.GearDoToSelected" parameter="block_unblock" />
<on_enable function="Avatar.EnableGearItem" parameter="can_block" />
</menu_item_check>
<menu_item_check
label="Block Text"
layout="topleft"
name="MuteText">
<on_check function="Avatar.CheckGearItem" parameter="is_muted" />
<on_click function="Avatar.GearDoToSelected" parameter="mute_unmute" />
<on_enable function="Avatar.EnableGearItem" parameter="can_block" />
</menu_item_check>
<menu_item_separator
layout="topleft"/>
</toggleable_menu>

View File

@ -1267,7 +1267,58 @@
function="Floater.Show"
parameter="hud" />
</menu_item_call>-->
<menu_item_separator/>
<menu_item_call
label="Users guide"
name="Users guide">
<menu_item_call.on_click
function="Advanced.WebBrowserTest"
parameter="http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-User-s-Guide/ta-p/1244857"/>
</menu_item_call>
<menu_item_call
label="Knowledge Base"
name="Knowledge Base">
<menu_item_call.on_click
function="Advanced.WebBrowserTest"
parameter="http://community.secondlife.com/t5/tkb/communitypage"/>
</menu_item_call>
<menu_item_call
label="Wiki"
name="Wiki">
<menu_item_call.on_click
function="Advanced.WebBrowserTest"
parameter="http://wiki.secondlife.com"/>
</menu_item_call>
<menu_item_call
label="Community Forums"
name="Community Forums">
<menu_item_call.on_click
function="Advanced.WebBrowserTest"
parameter="http://community.secondlife.com/t5/Forums/ct-p/Forums"/>
</menu_item_call>
<menu_item_call
label="Support portal"
name="Support portal">
<menu_item_call.on_click
function="Advanced.WebBrowserTest"
parameter="https://support.secondlife.com/"/>
</menu_item_call>
<menu_item_separator/>
<menu_item_call
label="[SECOND_LIFE] News"
name="Second Life News">
<menu_item_call.on_click
function="Advanced.WebBrowserTest"
parameter="http://community.secondlife.com/t5/Featured-News/bg-p/blog_feature_news"/>
</menu_item_call>
<menu_item_call
label="[SECOND_LIFE] Blogs"
name="Second Life Blogs">
<menu_item_call.on_click
function="Advanced.WebBrowserTest"
parameter="http://community.secondlife.com/t5/Blogs/ct-p/Blogs"/>
</menu_item_call>
<menu_item_separator/>
<menu_item_call