From 355e7a061311df30f019fd722df6072b745b0ef6 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Tue, 18 Dec 2012 12:25:19 +0200 Subject: CHUI-586 (Scroll bar only partially shown initially on torn off conversations) --- indra/newview/llfloaterimsessiontab.cpp | 17 ++++++++++++++++- indra/newview/llfloaterimsessiontab.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index ea99a1c5bf..07907095f8 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -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()); @@ -224,7 +225,8 @@ BOOL LLFloaterIMSessionTab::postBuild() setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE); - mSaveRect = isTornOff(); + mSaveRect = isNearbyChat() + && !gSavedSettings.getBOOL("NearbyChatIsNotTornOff"); initRectControl(); if (isChatMultiTab()) @@ -649,6 +651,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,6 +766,10 @@ void LLFloaterIMSessionTab::onTearOffClicked() mSaveRect = isTornOff(); initRectControl(); LLFloater::onClickTearOff(this); + if (isTornOff()) + { + forceReshape(); + } refreshConversation(); } diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index cd0bcd481c..9aeda9ddf9 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -96,6 +96,8 @@ public: virtual void updateMessages() {} LLConversationItem* getCurSelectedViewModelItem(); + void forceReshape(); + protected: // callback for click on any items of the visual states menu -- cgit v1.2.3 From 6b165ce2ade6db7d5e6cb23e039e4949dc71e617 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Tue, 18 Dec 2012 15:09:50 +0200 Subject: CHUI-562 FIXED Gear button is added for p2p torn-off floater. --- indra/newview/llfloaterimsession.cpp | 33 ++++++++ indra/newview/llfloaterimsession.h | 3 + indra/newview/llfloaterimsessiontab.cpp | 53 +++++++++++- indra/newview/llfloaterimsessiontab.h | 5 +- .../skins/default/xui/en/floater_im_session.xml | 15 ++++ .../skins/default/xui/en/menu_im_conversation.xml | 94 ++++++++++++++++++++++ 6 files changed, 200 insertions(+), 3 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_im_conversation.xml (limited to 'indra') diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index a0ca7286f1..f2afe9d7bb 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -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() diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index 1d8957b1d9..43d84eb8c0 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -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 diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index ea99a1c5bf..267dba562c 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -197,6 +197,8 @@ BOOL LLFloaterIMSessionTab::postBuild() mTearOffBtn = getChild("tear_off_btn"); mTearOffBtn->setCommitCallback(boost::bind(&LLFloaterIMSessionTab::onTearOffClicked, this)); + mGearBtn = getChild("gear_btn"); + mParticipantListPanel = getChild("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("add_btn")->getRect(); + LLRect call_btn_rect = getChild("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("add_btn")->setRect(add_btn_rect); + getChild("voice_call_btn")->setRect(call_btn_rect); + } +} + +void LLFloaterIMSessionTab::initBtns() +{ + LLRect gear_btn_rect = mGearBtn->getRect(); + LLRect add_btn_rect = getChild("add_btn")->getRect(); + LLRect call_btn_rect = getChild("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("add_btn")->setRect(add_btn_rect); + getChild("voice_call_btn")->setRect(call_btn_rect); } // static diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index cd0bcd481c..b05708059a 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -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 diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index e4b127b7b9..4dbd52d05e 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -79,6 +79,21 @@ tool_tip="View/sort options" top="5" width="31" /> +