CHUI-562 FIXED Gear button is added for p2p torn-off floater.

meow-7.2.2
maxim@mnikolenko 2012-12-18 15:09:50 +02:00
parent 138d4f5fcd
commit 6b165ce2ad
6 changed files with 200 additions and 3 deletions

View File

@ -83,6 +83,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 +193,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()

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

View File

@ -197,6 +197,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
@ -239,11 +241,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;
}
@ -756,6 +758,53 @@ void LLFloaterIMSessionTab::onTearOffClicked()
initRectControl();
LLFloater::onClickTearOff(this);
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,7 +92,8 @@ public:
void setSortOrder(const LLConversationSort& order);
virtual void onTearOffClicked();
void updateGearBtn();
void initBtns();
virtual void updateMessages() {}
LLConversationItem* getCurSelectedViewModelItem();
@ -157,6 +158,8 @@ protected:
LLButton* mExpandCollapseBtn;
LLButton* mTearOffBtn;
LLButton* mCloseBtn;
LLButton* mGearBtn;
private:
// Handling selection and contextual menu

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>