diff options
author | Ychebotarev ProductEngine <ychebotarev@productengine.com> | 2010-02-05 13:03:26 +0200 |
---|---|---|
committer | Ychebotarev ProductEngine <ychebotarev@productengine.com> | 2010-02-05 13:03:26 +0200 |
commit | b79b8f87a37888decd3f82e9e255cce641a3955f (patch) | |
tree | 0e72cecd20f15ea200a84a72979e4f7b8beea436 | |
parent | bc5ad04d6164d186cf504212ea559405b8608811 (diff) |
finished with EXT-2753 - Implement Avatar icons on IM multifloater tabs
add floater flashing, fix group icon sizes, fix click,some code cleanup, ect.
also I remove mIconCtrlWidth/Height since its kinda useless - mIconCtrlPad do the same thing...
IconSize will be btn_height-2*mIconCtrlPad - simple and good enough.
--HG--
branch : product-engine
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 65 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.h | 8 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 50 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_container.xml | 2 |
5 files changed, 37 insertions, 89 deletions
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 52fc2adb25..d959d3099c 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -109,12 +109,8 @@ public: // LEFT, RIGHT, TOP, BOTTOM paddings of LLIconCtrl in this class has same value Optional<S32> icon_ctrl_pad; - Optional<S32> icon_ctrl_width, - icon_ctrl_height; Params(): - icon_ctrl_pad("icon_ctrl_pad", 0), - icon_ctrl_width("icon_ctrl_width", 16), - icon_ctrl_height("icon_ctrl_height", 16) + icon_ctrl_pad("icon_ctrl_pad", 1) {} }; @@ -123,9 +119,7 @@ protected: LLCustomButtonIconCtrl(const Params& p): LLButton(p), mIcon(NULL), - mIconCtrlPad(p.icon_ctrl_pad), - mIconCtrlWidht(p.icon_ctrl_width), - mIconCtrlHeight(p.icon_ctrl_height) + mIconCtrlPad(p.icon_ctrl_pad) {} public: @@ -134,19 +128,23 @@ public: { LLRect button_rect = getRect(); LLRect icon_rect = mIcon->getRect(); - S32 pad = mIconCtrlPad * 2; + + S32 icon_size = button_rect.getHeight() - 2*mIconCtrlPad; switch(mIconAlignment) { case LLFontGL::LEFT: - icon_rect.setLeftTopAndSize(button_rect.mLeft + mIconCtrlPad, button_rect.mTop - mIconCtrlPad, mIconCtrlWidht - pad, mIconCtrlHeight - pad); - setLeftHPad(mIconCtrlWidht + pad); + icon_rect.setLeftTopAndSize(button_rect.mLeft + mIconCtrlPad, button_rect.mTop - mIconCtrlPad, + icon_size, icon_size); + setLeftHPad(icon_size + mIconCtrlPad * 2); break; case LLFontGL::HCENTER: //*TODO implement for HCENTER icon alignment break; case LLFontGL::RIGHT: - //*TODO implement for RIGHT icon alignment + icon_rect.setLeftTopAndSize(button_rect.mRight - mIconCtrlPad - icon_size, button_rect.mTop - mIconCtrlPad, + icon_size, icon_size); + setRightHPad(icon_size + mIconCtrlPad * 2); break; default: break; @@ -176,8 +174,6 @@ private: LLIconCtrl* mIcon; LLFontGL::HAlign mIconAlignment; S32 mIconCtrlPad; - S32 mIconCtrlWidht; - S32 mIconCtrlHeight; }; //============================================================================ @@ -214,10 +210,7 @@ LLTabContainer::Params::Params() middle_tab("middle_tab"), last_tab("last_tab"), use_custom_icon_ctrl("use_custom_icon_ctrl", false), - tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), - tab_icon_ctrl_width("tab_icon_ctrl_width"), - tab_icon_ctrl_height("tab_icon_ctrl_height") - + tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0) { name(std::string("tab_container")); mouse_opaque = false; @@ -254,9 +247,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mMiddleTabParams(p.middle_tab), mLastTabParams(p.last_tab), mCustomIconCtrlUsed(p.use_custom_icon_ctrl), - mTabIconCtrlPad(p.tab_icon_ctrl_pad), - mTabIconCtrlWidth(p.tab_icon_ctrl_width), - mTabIconCtrlHeight(p.tab_icon_ctrl_height) + mTabIconCtrlPad(p.tab_icon_ctrl_pad) { static LLUICachedControl<S32> tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0); @@ -999,6 +990,11 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) LLTextBox* textbox = NULL; LLButton* btn = NULL; + LLCustomButtonIconCtrl::Params custom_btn_params; + { + custom_btn_params.icon_ctrl_pad(mTabIconCtrlPad); + } + LLButton::Params normal_btn_params; if (placeholder) { @@ -1018,7 +1014,9 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) { if (mIsVertical) { - LLButton::Params p; + LLButton::Params& p = (mCustomIconCtrlUsed)? + custom_btn_params:normal_btn_params; + p.name(std::string("vert tab button")); p.rect(btn_rect); p.follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); @@ -1036,9 +1034,12 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) { p.pad_left(indent); } + + if(mCustomIconCtrlUsed) { - btn = createCustomButton(p); + btn = LLUICtrlFactory::create<LLCustomButtonIconCtrl>(custom_btn_params); + } else { @@ -1047,7 +1048,8 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) } else { - LLButton::Params p; + LLButton::Params& p = (mCustomIconCtrlUsed)? + custom_btn_params:normal_btn_params; p.name(std::string(child->getName()) + " tab"); p.rect(btn_rect); p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child)); @@ -1083,7 +1085,7 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) if(mCustomIconCtrlUsed) { - btn = createCustomButton(p); + btn = LLUICtrlFactory::create<LLCustomButtonIconCtrl>(custom_btn_params); } else { @@ -1151,19 +1153,6 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) updateMaxScrollPos(); } -LLButton* LLTabContainer::createCustomButton(const LLButton::Params& p) -{ - LLCustomButtonIconCtrl::Params custom_btn_params; - LLButton::Params* btn_params_p = dynamic_cast<LLButton::Params*>(&custom_btn_params); - - btn_params_p->overwriteFrom(p); - custom_btn_params.icon_ctrl_pad(mTabIconCtrlPad); - custom_btn_params.icon_ctrl_width(mTabIconCtrlWidth); - custom_btn_params.icon_ctrl_height(mTabIconCtrlHeight); - - return LLUICtrlFactory::create<LLCustomButtonIconCtrl>(custom_btn_params); -} - void LLTabContainer::addPlaceholder(LLPanel* child, const std::string& label) { addTabPanel(TabPanelParams().panel(child).label(label).is_placeholder(true)); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 278cf01375..4b5d45fb73 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -101,11 +101,6 @@ public: * Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true) */ Optional<S32> tab_icon_ctrl_pad; - /** - * LLIconCtrl size - */ - Optional<S32> tab_icon_ctrl_width, - tab_icon_ctrl_height; Params(); }; @@ -247,7 +242,6 @@ private: // updates tab button images given the tuple, tab position and the corresponding params void update_images(LLTabTuple* tuple, TabParams params, LLTabContainer::TabPosition pos); void reshapeTuple(LLTabTuple* tuple); - LLButton* createCustomButton(const LLButton::Params& p); // Variables @@ -300,8 +294,6 @@ private: bool mCustomIconCtrlUsed; S32 mTabIconCtrlPad; - S32 mTabIconCtrlHeight; - S32 mTabIconCtrlWidth; }; #endif // LL_TABCONTAINER_H diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 7c7a4222d4..9539553121 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -37,6 +37,7 @@ #include "llfloaterreg.h" #include "llimview.h" #include "llavatariconctrl.h" +#include "llgroupiconctrl.h" #include "llagent.h" // @@ -90,23 +91,15 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLUUID session_id = floaterp->getKey(); + LLIconCtrl* icon = 0; + if(gAgent.isInGroup(session_id)) { - mSessions[session_id] = floaterp; - LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(session_id); - LLGroupMgr* gm = LLGroupMgr::getInstance(); - gm->addObserver(session_id, this); - floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); + LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>(); + icon_params.group_id = session_id; + icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); - if (group_data && group_data->mInsigniaID.notNull()) - { - mTabContainer->setTabImage(get_ptr_in_map(mSessions, session_id), group_data->mInsigniaID); - } - else - { - mTabContainer->setTabImage(floaterp, "Generic_Group"); - gm->sendGroupPropertiesRequest(session_id); - } + mSessions[session_id] = floaterp; } else { @@ -114,27 +107,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>(); icon_params.avatar_id = avatar_id; - LLAvatarIconCtrl* icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); - icon->setValue(avatar_id); - mTabContainer->setTabImage(floaterp, icon); - - /* - LLAvatarPropertiesProcessor& app = LLAvatarPropertiesProcessor::instance(); - app.addObserver(avatar_id, this); - floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, avatar_id)); - mSessions[avatar_id] = floaterp; + icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); - LLUUID* icon_id_ptr = LLAvatarIconIDCache::getInstance()->get(avatar_id); - if(icon_id_ptr && icon_id_ptr->notNull()) - { - mTabContainer->setTabImage(floaterp, *icon_id_ptr); - } - else - { - mTabContainer->setTabImage(floaterp, "Generic_Person"); - app.sendAvatarPropertiesRequest(avatar_id); - }*/ + mSessions[avatar_id] = floaterp; } + mTabContainer->setTabImage(floaterp, icon); } void LLIMFloaterContainer::processProperties(void* data, enum EAvatarProcessorType type) @@ -167,13 +144,6 @@ void LLIMFloaterContainer::changed(const LLUUID& group_id, LLGroupChange gc) } } -void LLIMFloaterContainer::onCloseFloater(LLUUID id) -{ - LLAvatarPropertiesProcessor::instance().removeObserver(id, this); - LLGroupMgr::instance().removeObserver(id, this); - -} - void LLIMFloaterContainer::onNewMessageReceived(const LLSD& data) { LLUUID session_id = data["from_id"].asUUID(); diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index bc06f0cbd3..daf367da11 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -69,7 +69,6 @@ private: typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t; avatarID_panel_map_t mSessions; - void onCloseFloater(LLUUID avatar_id); void onNewMessageReceived(const LLSD& data); }; diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 0d1a4a831d..978b40da77 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -21,8 +21,6 @@ tab_position="bottom" tab_width="64" tab_max_width = "134" - tab_icon_ctrl_width = "16" - tab_icon_ctrl_height = "16" tab_height="16" use_custom_icon_ctrl="true" tab_icon_ctrl_pad="2" |