From 22303da8a61e60dd061b5a63f6d023fd1345b59c Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 3 Dec 2009 13:48:07 +0200 Subject: Work on task EXT-3081 (Separate Message Well on Notifications Well and IM Well) Initial commit -- added two floater classes derived from LLSysWellWindow to work with Notification Well & IM Well -- register two floaters in place of previous sys_well (but with the same xml file) -- replace using of LLSysWellWindow with LLNotificationWellWindow in the out code (except of in LLScreenChannel::updateShowToastsState) -- rename member variable in bottom tray used for Notification Well --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 539536b527..6852cd78f9 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -33,6 +33,7 @@ #include "llviewerprecompiledheaders.h" // must be first include #include "llflatlistview.h" +#include "llfloaterreg.h" #include "llsyswellwindow.h" @@ -566,4 +567,44 @@ BOOL LLSysWellWindow::RowPanel::handleMouseDown(S32 x, S32 y, MASK mask) return LLPanel::handleMouseDown(x, y, mask); } + + +/************************************************************************/ +/* LLNotificationWellWindow implementation */ +/************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// PUBLIC METHODS +LLNotificationWellWindow::LLNotificationWellWindow(const LLSD& key) +: LLSysWellWindow(key) +{ + +} + +// static +LLNotificationWellWindow* LLNotificationWellWindow::getInstance(const LLSD& key /*= LLSD()*/) +{ + return LLFloaterReg::getTypedInstance("notification_well_window", key); +} + + + +/************************************************************************/ +/* LLIMWellWindow implementation */ +/************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// PUBLIC METHODS +LLIMWellWindow::LLIMWellWindow(const LLSD& key) +: LLSysWellWindow(key) +{ + +} + +// static +LLIMWellWindow* LLIMWellWindow::getInstance(const LLSD& key /*= LLSD()*/) +{ + return LLFloaterReg::getTypedInstance("im_well_window", key); +} + // EOF -- cgit v1.2.3 From 653ebfbe7ca53515d6c83f6ba72cbb1d3e2d9daf Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 4 Dec 2009 12:48:08 +0200 Subject: Work on normal task EXT-3081 (Separate Message Well on Notifications Well and IM Well) Refactored toggle interaction between Notification Well and Notification Well Window: -- set "Button.SetDockableFloaterToggle" init callback to Notification Well -- remove deprecated functionality in code -- update interaction with screen channels to work properly. --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 70 +++++++++++---------------------------- 1 file changed, 19 insertions(+), 51 deletions(-) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 6852cd78f9..6b7c4049f4 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -90,12 +90,6 @@ BOOL LLSysWellWindow::postBuild() //--------------------------------------------------------------------------------- void LLSysWellWindow::setMinimized(BOOL minimize) { - // we don't show empty Message Well window - if (!minimize && isWindowEmpty()) - { - return; - } - LLDockableFloater::setMinimized(minimize); } @@ -117,11 +111,12 @@ void LLSysWellWindow::connectListUpdaterToSignal(std::string notification_type) //--------------------------------------------------------------------------------- void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask) { - onChicletClick(); + // just set floater visible. Screen channels will be cleared. + setVisible(TRUE); } //--------------------------------------------------------------------------------- -void LLSysWellWindow::onChicletClick() +void LLSysWellWindow::clearScreenChannels() { // 1 - remove StartUp toast and channel if present if(!LLNotificationsUI::LLScreenChannel::getStartUpToastShown()) @@ -129,8 +124,11 @@ void LLSysWellWindow::onChicletClick() LLNotificationsUI::LLChannelManager::getInstance()->onStartUpToastClose(); } - // 2 - toggle instance of SysWell's chiclet-window - toggleWindow(); + // 2 - remove toasts in Notification channel + if(mChannel) + { + mChannel->removeAndStoreAllStorableToasts(); + } } //--------------------------------------------------------------------------------- @@ -243,57 +241,27 @@ void LLSysWellWindow::getAllowedRect(LLRect& rect) } //--------------------------------------------------------------------------------- -void LLSysWellWindow::toggleWindow() -{ - if (getDockControl() == NULL) - { - setDockControl(new LLDockControl( - LLBottomTray::getInstance()->getSysWell(), this, - getDockTongue(), LLDockControl::TOP, boost::bind(&LLSysWellWindow::getAllowedRect, this, _1))); - } - - if(!getVisible() || isMinimized()) - { - if(mChannel) - { - mChannel->removeAndStoreAllStorableToasts(); - } - if(isWindowEmpty()) - { - return; - } - setVisible(TRUE); - } - else if (isDocked()) - { - setVisible(FALSE); - } - else if(!isDocked()) - { - // bring to front undocked floater - setVisible(TRUE); - } -} //--------------------------------------------------------------------------------- void LLSysWellWindow::setVisible(BOOL visible) { - if(visible) + if (visible) { - if (LLBottomTray::instanceExists()) + if (NULL == getDockControl() && getDockTongue().notNull()) { - LLBottomTray::getInstance()->getSysWell()->setToggleState(TRUE); - } - } - else - { - if (LLBottomTray::instanceExists()) - { - LLBottomTray::getInstance()->getSysWell()->setToggleState(FALSE); + setDockControl(new LLDockControl( + LLBottomTray::getInstance()->getSysWell(), this, + getDockTongue(), LLDockControl::TOP, boost::bind(&LLSysWellWindow::getAllowedRect, this, _1))); } + + // when Notification channel is cleared, storable toasts will be added into the list. + clearScreenChannels(); } + // do not show empty window + if (NULL == mMessageList || isWindowEmpty()) visible = FALSE; + LLDockableFloater::setVisible(visible); // update notification channel state -- cgit v1.2.3 From 1acc52a7e781a7931d1fc6bfc2313c49eb6be2a2 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 4 Dec 2009 14:00:52 +0200 Subject: Work on normal task EXT-3081 (Separate Message Well on Notifications Well and IM Well) -- removed member pointer to Notification Well Icon from the LLBottomTray -- placed Well counter over the Icon, made center-aligned --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 6b7c4049f4..a64c200b92 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -46,6 +46,8 @@ #include "llnotificationmanager.h" +static std::string NOTIFICATION_WELL_ANCHOR_NAME = "notification_well_panel"; + //--------------------------------------------------------------------------------- LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLDockableFloater(NULL, key), mChannel(NULL), @@ -251,7 +253,7 @@ void LLSysWellWindow::setVisible(BOOL visible) if (NULL == getDockControl() && getDockTongue().notNull()) { setDockControl(new LLDockControl( - LLBottomTray::getInstance()->getSysWell(), this, + LLBottomTray::getInstance()->getChild(NOTIFICATION_WELL_ANCHOR_NAME), this, getDockTongue(), LLDockControl::TOP, boost::bind(&LLSysWellWindow::getAllowedRect, this, _1))); } -- cgit v1.2.3 From 69cd9ac98bde4d602a8bdb785ac576df958ea1f5 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 4 Dec 2009 18:31:57 +0200 Subject: Completed normal task EXT-3081 (Separate Message Well on Notifications Well and IM Well) -- created IM Wel icon -- functionality is moved from the base class into appropriate classes (for Notification & IM Well windows) --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 418 ++++++++++++++++++++------------------ 1 file changed, 217 insertions(+), 201 deletions(-) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index a64c200b92..c288301923 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -54,9 +54,6 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLDockableFloater(NULL, key) mMessageList(NULL), mSeparator(NULL) { - LLIMMgr::getInstance()->addSessionObserver(this); - LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLSysWellWindow::findIMChiclet, this, _1)); - mTypedItemsCount[IT_NOTIFICATION] = 0; mTypedItemsCount[IT_INSTANT_MESSAGE] = 0; } @@ -66,11 +63,6 @@ BOOL LLSysWellWindow::postBuild() { mMessageList = getChild("notification_list"); - // init connections to the list's update events - connectListUpdaterToSignal("notify"); - connectListUpdaterToSignal("groupnotify"); - connectListUpdaterToSignal("offer"); - // get a corresponding channel initChannel(); @@ -95,21 +87,6 @@ void LLSysWellWindow::setMinimized(BOOL minimize) LLDockableFloater::setMinimized(minimize); } -//--------------------------------------------------------------------------------- -void LLSysWellWindow::connectListUpdaterToSignal(std::string notification_type) -{ - LLNotificationsUI::LLNotificationManager* manager = LLNotificationsUI::LLNotificationManager::getInstance(); - LLNotificationsUI::LLEventHandler* n_handler = manager->getHandlerForNotification(notification_type); - if(n_handler) - { - n_handler->setNotificationIDCallback(boost::bind(&LLSysWellWindow::removeItemByID, this, _1)); - } - else - { - llwarns << "LLSysWellWindow::connectListUpdaterToSignal() - could not get a handler for '" << notification_type <<"' type of notifications" << llendl; - } -} - //--------------------------------------------------------------------------------- void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask) { @@ -117,54 +94,9 @@ void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask) setVisible(TRUE); } -//--------------------------------------------------------------------------------- -void LLSysWellWindow::clearScreenChannels() -{ - // 1 - remove StartUp toast and channel if present - if(!LLNotificationsUI::LLScreenChannel::getStartUpToastShown()) - { - LLNotificationsUI::LLChannelManager::getInstance()->onStartUpToastClose(); - } - - // 2 - remove toasts in Notification channel - if(mChannel) - { - mChannel->removeAndStoreAllStorableToasts(); - } -} - //--------------------------------------------------------------------------------- LLSysWellWindow::~LLSysWellWindow() { - LLIMMgr::getInstance()->removeSessionObserver(this); -} - -//--------------------------------------------------------------------------------- -void LLSysWellWindow::addItem(LLSysWellItem::Params p) -{ - LLSD value = p.notification_id; - // do not add clones - if( mMessageList->getItemByValue(value)) - return; - - LLSysWellItem* new_item = new LLSysWellItem(p); - if (mMessageList->addItem(new_item, value, ADD_TOP)) - { - handleItemAdded(IT_NOTIFICATION); - - reshapeWindow(); - - new_item->setOnItemCloseCallback(boost::bind(&LLSysWellWindow::onItemClose, this, _1)); - new_item->setOnItemClickCallback(boost::bind(&LLSysWellWindow::onItemClick, this, _1)); - } - else - { - llwarns << "Unable to add Notification into the list, notification ID: " << p.notification_id - << ", title: " << p.title - << llendl; - - new_item->die(); - } } //--------------------------------------------------------------------------------- @@ -195,42 +127,13 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id) } //--------------------------------------------------------------------------------- -void LLSysWellWindow::onItemClick(LLSysWellItem* item) -{ - LLUUID id = item->getID(); - if(mChannel) - mChannel->loadStoredToastByNotificationIDToChannel(id); -} - -//--------------------------------------------------------------------------------- -void LLSysWellWindow::onItemClose(LLSysWellItem* item) -{ - LLUUID id = item->getID(); - removeItemByID(id); - if(mChannel) - mChannel->killToastByNotificationID(id); -} - -//-------------------------------------------------------------------------- -void LLSysWellWindow::onStoreToast(LLPanel* info_panel, LLUUID id) -{ - LLSysWellItem::Params p; - p.notification_id = id; - p.title = static_cast(info_panel)->getTitle(); - addItem(p); -} - //--------------------------------------------------------------------------------- void LLSysWellWindow::initChannel() { LLNotificationsUI::LLScreenChannelBase* channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID( LLUUID(gSavedSettings.getString("NotificationChannelUUID"))); mChannel = dynamic_cast(channel); - if(mChannel) - { - mChannel->setOnStoreToastCallback(boost::bind(&LLSysWellWindow::onStoreToast, this, _1, _2)); - } - else + if(NULL == mChannel) { llwarns << "LLSysWellWindow::initChannel() - could not get a requested screen channel" << llendl; } @@ -256,9 +159,6 @@ void LLSysWellWindow::setVisible(BOOL visible) LLBottomTray::getInstance()->getChild(NOTIFICATION_WELL_ANCHOR_NAME), this, getDockTongue(), LLDockControl::TOP, boost::bind(&LLSysWellWindow::getAllowedRect, this, _1))); } - - // when Notification channel is cleared, storable toasts will be added into the list. - clearScreenChannels(); } // do not show empty window @@ -317,63 +217,6 @@ void LLSysWellWindow::reshapeWindow() } } -//--------------------------------------------------------------------------------- -LLChiclet* LLSysWellWindow::findIMChiclet(const LLUUID& sessionId) -{ - LLChiclet* res = NULL; - RowPanel* panel = mMessageList->getTypedItemByValue(sessionId); - if (panel != NULL) - { - res = panel->mChiclet; - } - - return res; -} - -//--------------------------------------------------------------------------------- -void LLSysWellWindow::addIMRow(const LLUUID& sessionId, S32 chicletCounter, - const std::string& name, const LLUUID& otherParticipantId) -{ - RowPanel* item = new RowPanel(this, sessionId, chicletCounter, name, otherParticipantId); - if (mMessageList->insertItemAfter(mSeparator, item, sessionId)) - { - handleItemAdded(IT_INSTANT_MESSAGE); - } - else - { - llwarns << "Unable to add IM Row into the list, sessionID: " << sessionId - << ", name: " << name - << ", other participant ID: " << otherParticipantId - << llendl; - - item->die(); - } -} - -//--------------------------------------------------------------------------------- -void LLSysWellWindow::delIMRow(const LLUUID& sessionId) -{ - if (mMessageList->removeItemByValue(sessionId)) - { - handleItemRemoved(IT_INSTANT_MESSAGE); - } - else - { - llwarns << "Unable to remove IM Row from the list, sessionID: " << sessionId - << llendl; - } - - // remove all toasts that belong to this session from a screen - if(mChannel) - mChannel->removeToastsBySessionID(sessionId); - - // hide chiclet window if there are no items left - if(isWindowEmpty()) - { - setVisible(FALSE); - } -} - //--------------------------------------------------------------------------------- bool LLSysWellWindow::isWindowEmpty() { @@ -381,41 +224,7 @@ bool LLSysWellWindow::isWindowEmpty() return mMessageList->size() == 1; } -//--------------------------------------------------------------------------------- -//virtual -void LLSysWellWindow::sessionAdded(const LLUUID& session_id, - const std::string& name, const LLUUID& other_participant_id) -{ - if (mMessageList->getItemByValue(session_id) == NULL) - { - S32 chicletCounter = LLIMModel::getInstance()->getNumUnread(session_id); - if (chicletCounter > -1) - { - addIMRow(session_id, chicletCounter, name, other_participant_id); - reshapeWindow(); - } - } -} - -//--------------------------------------------------------------------------------- -//virtual -void LLSysWellWindow::sessionRemoved(const LLUUID& sessionId) -{ - delIMRow(sessionId); - reshapeWindow(); -} - -void LLSysWellWindow::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) -{ - //for outgoing ad-hoc and group im sessions only - LLChiclet* chiclet = findIMChiclet(old_session_id); - if (chiclet) - { - chiclet->setSessionId(new_session_id); - mMessageList->updateValue(old_session_id, new_session_id); - } -} - +// *TODO: mantipov: probably is deprecated void LLSysWellWindow::handleItemAdded(EItemType added_item_type) { bool should_be_shown = ++mTypedItemsCount[added_item_type] == 1 && anotherTypeExists(added_item_type); @@ -463,8 +272,12 @@ bool LLSysWellWindow::anotherTypeExists(EItemType item_type) return exists; } +/************************************************************************/ +/* RowPanel implementation */ +/************************************************************************/ + //--------------------------------------------------------------------------------- -LLSysWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& sessionId, +LLIMWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& sessionId, S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) : LLPanel(LLPanel::Params()), mChiclet(NULL), mParent(parent) { @@ -499,36 +312,36 @@ LLSysWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& contactName->setValue(name); mCloseBtn = getChild("hide_btn"); - mCloseBtn->setCommitCallback(boost::bind(&LLSysWellWindow::RowPanel::onClosePanel, this)); + mCloseBtn->setCommitCallback(boost::bind(&LLIMWellWindow::RowPanel::onClosePanel, this)); } //--------------------------------------------------------------------------------- -LLSysWellWindow::RowPanel::~RowPanel() +LLIMWellWindow::RowPanel::~RowPanel() { } //--------------------------------------------------------------------------------- -void LLSysWellWindow::RowPanel::onClosePanel() +void LLIMWellWindow::RowPanel::onClosePanel() { gIMMgr->leaveSession(mChiclet->getSessionId()); // This row panel will be removed from the list in LLSysWellWindow::sessionRemoved(). } //--------------------------------------------------------------------------------- -void LLSysWellWindow::RowPanel::onMouseEnter(S32 x, S32 y, MASK mask) +void LLIMWellWindow::RowPanel::onMouseEnter(S32 x, S32 y, MASK mask) { setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemSelected")); } //--------------------------------------------------------------------------------- -void LLSysWellWindow::RowPanel::onMouseLeave(S32 x, S32 y, MASK mask) +void LLIMWellWindow::RowPanel::onMouseLeave(S32 x, S32 y, MASK mask) { setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemUnselected")); } //--------------------------------------------------------------------------------- // virtual -BOOL LLSysWellWindow::RowPanel::handleMouseDown(S32 x, S32 y, MASK mask) +BOOL LLIMWellWindow::RowPanel::handleMouseDown(S32 x, S32 y, MASK mask) { // Pass the mouse down event to the chiclet (EXT-596). if (!mChiclet->pointInView(x, y) && !mCloseBtn->getRect().pointInRect(x, y)) // prevent double call of LLIMChiclet::onMouseDown() @@ -548,7 +361,10 @@ BOOL LLSysWellWindow::RowPanel::handleMouseDown(S32 x, S32 y, MASK mask) LLNotificationWellWindow::LLNotificationWellWindow(const LLSD& key) : LLSysWellWindow(key) { - + // init connections to the list's update events + connectListUpdaterToSignal("notify"); + connectListUpdaterToSignal("groupnotify"); + connectListUpdaterToSignal("offer"); } // static @@ -557,6 +373,108 @@ LLNotificationWellWindow* LLNotificationWellWindow::getInstance(const LLSD& key return LLFloaterReg::getTypedInstance("notification_well_window", key); } +void LLNotificationWellWindow::setVisible(BOOL visible) +{ + if (visible) + { + // when Notification channel is cleared, storable toasts will be added into the list. + clearScreenChannels(); + } + + LLSysWellWindow::setVisible(visible); +} + +//--------------------------------------------------------------------------------- +void LLNotificationWellWindow::addItem(LLSysWellItem::Params p) +{ + LLSD value = p.notification_id; + // do not add clones + if( mMessageList->getItemByValue(value)) + return; + + LLSysWellItem* new_item = new LLSysWellItem(p); + if (mMessageList->addItem(new_item, value, ADD_TOP)) + { + handleItemAdded(IT_NOTIFICATION); + + reshapeWindow(); + + new_item->setOnItemCloseCallback(boost::bind(&LLNotificationWellWindow::onItemClose, this, _1)); + new_item->setOnItemClickCallback(boost::bind(&LLNotificationWellWindow::onItemClick, this, _1)); + } + else + { + llwarns << "Unable to add Notification into the list, notification ID: " << p.notification_id + << ", title: " << p.title + << llendl; + + new_item->die(); + } +} + +////////////////////////////////////////////////////////////////////////// +// PRIVATE METHODS +void LLNotificationWellWindow::initChannel() +{ + LLSysWellWindow::initChannel(); + if(mChannel) + { + mChannel->setOnStoreToastCallback(boost::bind(&LLNotificationWellWindow::onStoreToast, this, _1, _2)); + } +} + +void LLNotificationWellWindow::clearScreenChannels() +{ + // 1 - remove StartUp toast and channel if present + if(!LLNotificationsUI::LLScreenChannel::getStartUpToastShown()) + { + LLNotificationsUI::LLChannelManager::getInstance()->onStartUpToastClose(); + } + + // 2 - remove toasts in Notification channel + if(mChannel) + { + mChannel->removeAndStoreAllStorableToasts(); + } +} + +void LLNotificationWellWindow::onStoreToast(LLPanel* info_panel, LLUUID id) +{ + LLSysWellItem::Params p; + p.notification_id = id; + p.title = static_cast(info_panel)->getTitle(); + addItem(p); +} + +void LLNotificationWellWindow::connectListUpdaterToSignal(std::string notification_type) +{ + LLNotificationsUI::LLNotificationManager* manager = LLNotificationsUI::LLNotificationManager::getInstance(); + LLNotificationsUI::LLEventHandler* n_handler = manager->getHandlerForNotification(notification_type); + if(n_handler) + { + n_handler->setNotificationIDCallback(boost::bind(&LLNotificationWellWindow::removeItemByID, this, _1)); + } + else + { + llwarns << "LLSysWellWindow::connectListUpdaterToSignal() - could not get a handler for '" << notification_type <<"' type of notifications" << llendl; + } +} + +void LLNotificationWellWindow::onItemClick(LLSysWellItem* item) +{ + LLUUID id = item->getID(); + if(mChannel) + mChannel->loadStoredToastByNotificationIDToChannel(id); +} + +void LLNotificationWellWindow::onItemClose(LLSysWellItem* item) +{ + LLUUID id = item->getID(); + removeItemByID(id); + if(mChannel) + mChannel->killToastByNotificationID(id); +} + /************************************************************************/ @@ -568,7 +486,13 @@ LLNotificationWellWindow* LLNotificationWellWindow::getInstance(const LLSD& key LLIMWellWindow::LLIMWellWindow(const LLSD& key) : LLSysWellWindow(key) { + LLIMMgr::getInstance()->addSessionObserver(this); + LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findIMChiclet, this, _1)); +} +LLIMWellWindow::~LLIMWellWindow() +{ + LLIMMgr::getInstance()->removeSessionObserver(this); } // static @@ -577,4 +501,96 @@ LLIMWellWindow* LLIMWellWindow::getInstance(const LLSD& key /*= LLSD()*/) return LLFloaterReg::getTypedInstance("im_well_window", key); } +//virtual +void LLIMWellWindow::sessionAdded(const LLUUID& session_id, + const std::string& name, const LLUUID& other_participant_id) +{ + if (mMessageList->getItemByValue(session_id) == NULL) + { + S32 chicletCounter = LLIMModel::getInstance()->getNumUnread(session_id); + if (chicletCounter > -1) + { + addIMRow(session_id, chicletCounter, name, other_participant_id); + reshapeWindow(); + } + } +} + +//virtual +void LLIMWellWindow::sessionRemoved(const LLUUID& sessionId) +{ + delIMRow(sessionId); + reshapeWindow(); +} + +//virtual +void LLIMWellWindow::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) +{ + //for outgoing ad-hoc and group im sessions only + LLChiclet* chiclet = findIMChiclet(old_session_id); + if (chiclet) + { + chiclet->setSessionId(new_session_id); + mMessageList->updateValue(old_session_id, new_session_id); + } +} + +////////////////////////////////////////////////////////////////////////// +// PRIVATE METHODS +LLChiclet* LLIMWellWindow::findIMChiclet(const LLUUID& sessionId) +{ + LLChiclet* res = NULL; + RowPanel* panel = mMessageList->getTypedItemByValue(sessionId); + if (panel != NULL) + { + res = panel->mChiclet; + } + + return res; +} + +//--------------------------------------------------------------------------------- +void LLIMWellWindow::addIMRow(const LLUUID& sessionId, S32 chicletCounter, + const std::string& name, const LLUUID& otherParticipantId) +{ + RowPanel* item = new RowPanel(this, sessionId, chicletCounter, name, otherParticipantId); + if (mMessageList->insertItemAfter(mSeparator, item, sessionId)) + { + handleItemAdded(IT_INSTANT_MESSAGE); + } + else + { + llwarns << "Unable to add IM Row into the list, sessionID: " << sessionId + << ", name: " << name + << ", other participant ID: " << otherParticipantId + << llendl; + + item->die(); + } +} + +//--------------------------------------------------------------------------------- +void LLIMWellWindow::delIMRow(const LLUUID& sessionId) +{ + if (mMessageList->removeItemByValue(sessionId)) + { + handleItemRemoved(IT_INSTANT_MESSAGE); + } + else + { + llwarns << "Unable to remove IM Row from the list, sessionID: " << sessionId + << llendl; + } + + // remove all toasts that belong to this session from a screen + if(mChannel) + mChannel->removeToastsBySessionID(sessionId); + + // hide chiclet window if there are no items left + if(isWindowEmpty()) + { + setVisible(FALSE); + } +} + // EOF -- cgit v1.2.3 From fdb25e5add7305d8b92067f610eff1b5c18482de Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Mon, 7 Dec 2009 14:20:33 +0200 Subject: Aditional changes for normal task EXT-3081 (Separate Message Well on Notifications Well and IM Well) -- set different titles for IM & Notification Well windows -- set different anchors for IM & Notification Well windows --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index c288301923..e5a4b456a0 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -47,6 +47,7 @@ static std::string NOTIFICATION_WELL_ANCHOR_NAME = "notification_well_panel"; +static std::string IM_WELL_ANCHOR_NAME = "im_well_panel"; //--------------------------------------------------------------------------------- LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLDockableFloater(NULL, key), @@ -156,7 +157,7 @@ void LLSysWellWindow::setVisible(BOOL visible) if (NULL == getDockControl() && getDockTongue().notNull()) { setDockControl(new LLDockControl( - LLBottomTray::getInstance()->getChild(NOTIFICATION_WELL_ANCHOR_NAME), this, + LLBottomTray::getInstance()->getChild(getAnchorViewName()), this, getDockTongue(), LLDockControl::TOP, boost::bind(&LLSysWellWindow::getAllowedRect, this, _1))); } } @@ -373,6 +374,15 @@ LLNotificationWellWindow* LLNotificationWellWindow::getInstance(const LLSD& key return LLFloaterReg::getTypedInstance("notification_well_window", key); } +// virtual +BOOL LLNotificationWellWindow::postBuild() +{ + BOOL rv = LLSysWellWindow::postBuild(); + setTitle(getString("title_notification_well_window")); + return rv; +} + +// virtual void LLNotificationWellWindow::setVisible(BOOL visible) { if (visible) @@ -501,6 +511,13 @@ LLIMWellWindow* LLIMWellWindow::getInstance(const LLSD& key /*= LLSD()*/) return LLFloaterReg::getTypedInstance("im_well_window", key); } +BOOL LLIMWellWindow::postBuild() +{ + BOOL rv = LLSysWellWindow::postBuild(); + setTitle(getString("title_im_well_window")); + return rv; +} + //virtual void LLIMWellWindow::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) -- cgit v1.2.3 From 13dd7431a350fc2515a6b7f30995fbc47f1bc77b Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Mon, 7 Dec 2009 15:44:44 +0200 Subject: Implemented normal task EXT-3084 (Update Notifications window behavior). - Added hiding window when focus is lost. --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index e5a4b456a0..18877e3895 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -174,6 +174,12 @@ void LLSysWellWindow::setVisible(BOOL visible) } } +//--------------------------------------------------------------------------------- +void LLSysWellWindow::onFocusLost() +{ + setVisible(false); +} + //--------------------------------------------------------------------------------- void LLSysWellWindow::setDocked(bool docked, bool pop_on_undock) { -- cgit v1.2.3 From d5bc38ae2db2d482db3e3fb83a0d9b917c6d4eb4 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Mon, 7 Dec 2009 15:59:49 +0200 Subject: Work on normal task EXT-3148 (Implement updating of the IM Well message counter). Fixed Linux build -- move constats into class --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 18877e3895..f64cd4727b 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -45,10 +45,6 @@ #include "lltoastpanel.h" #include "llnotificationmanager.h" - -static std::string NOTIFICATION_WELL_ANCHOR_NAME = "notification_well_panel"; -static std::string IM_WELL_ANCHOR_NAME = "im_well_panel"; - //--------------------------------------------------------------------------------- LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLDockableFloater(NULL, key), mChannel(NULL), -- cgit v1.2.3 From 4a1bb89faffae4b1d87013dba104545c1b9952e0 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Mon, 7 Dec 2009 18:11:33 +0200 Subject: Completed normal task EXT-3148 (Implement updating of the IM Well message counter). -- added broken constants' initialization (in Changeset: f0931dcb0481) --HG-- branch : product-engine --- indra/newview/llsyswellwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llsyswellwindow.cpp') diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index f64cd4727b..bef7f5d6aa 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -49,7 +49,10 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLDockableFloater(NULL, key), mChannel(NULL), mMessageList(NULL), - mSeparator(NULL) + mSeparator(NULL), + NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"), + IM_WELL_ANCHOR_NAME("im_well_panel") + { mTypedItemsCount[IT_NOTIFICATION] = 0; mTypedItemsCount[IT_INSTANT_MESSAGE] = 0; -- cgit v1.2.3