meow-7.2.2
mberezhnoy 2013-03-27 20:07:39 +02:00
commit d29a2e2977
7 changed files with 167 additions and 130 deletions

View File

@ -3201,7 +3201,23 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin
LLFontGL::EWordWrapStyle word_wrap_style = (line_offset == 0)
? LLFontGL::WORD_BOUNDARY_IF_POSSIBLE
: LLFontGL::ONLY_WORD_BOUNDARIES;
S32 num_chars = mStyle->getFont()->maxDrawableChars(text.c_str() + segment_offset + mStart,
LLWString offsetString(text.c_str() + segment_offset + mStart);
if(getLength() < segment_offset + mStart)
{
llerrs << "getLength() < segment_offset + mStart\t getLength()\t" << getLength() << "\tsegment_offset:\t"
<< segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << "\tmax_chars\t" << max_chars << llendl;
}
if(offsetString.length() + 1 < max_chars)
{
llerrs << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetString.length()
<< getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << llendl;
}
S32 num_chars = mStyle->getFont()->maxDrawableChars(offsetString.c_str(),
(F32)num_pixels,
max_chars,
word_wrap_style);

View File

@ -292,6 +292,17 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>NearbyChatIsNotCollapsed</key>
<map>
<key>Comment</key>
<string>Saving expanded/collapsed state of the nearby chat between sessions</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ShowFavoritesOnLogin</key>
<map>
<key>Comment</key>

View File

@ -174,6 +174,7 @@ void LLNotificationChiclet::onMenuItemClicked(const LLSD& user_data)
if("close all" == action)
{
LLNotificationWellWindow::getInstance()->closeAll();
LLIMWellWindow::getInstance()->closeAll();
}
}

View File

@ -1337,7 +1337,10 @@ void LLFloaterIMContainer::showConversation(const LLUUID& session_id)
selectConversationPair(session_id, true);
LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
session_floater->restoreFloater();
if (session_floater)
{
session_floater->restoreFloater();
}
}
void LLFloaterIMContainer::clearAllFlashStates()

View File

@ -132,6 +132,12 @@ void LLFloaterIMSessionTab::setVisible(BOOL visible)
LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->setVisible(true);
}
LLFloaterIMSessionTab::addToHost(mSessionID);
LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(mSessionID);
if (conversp && conversp->isNearbyChat() && gSavedPerAccountSettings.getBOOL("NearbyChatIsNotCollapsed"))
{
onCollapseToLine(this);
}
mInputButtonPanel->setVisible(isTornOff());
}
@ -356,7 +362,7 @@ void LLFloaterIMSessionTab::draw()
// Restart the refresh timer
mRefreshTimer->setTimerExpirySec(REFRESH_INTERVAL);
}
LLTransientDockableFloater::draw();
}
@ -866,7 +872,7 @@ void LLFloaterIMSessionTab::reshapeFloater(bool collapse)
enableResizeCtrls(true, true, true);
}
saveCollapsedState();
setShape(floater_rect, true);
mBodyStack->updateLayout();
@ -874,8 +880,9 @@ void LLFloaterIMSessionTab::reshapeFloater(bool collapse)
void LLFloaterIMSessionTab::restoreFloater()
{
if(!isMessagePaneExpanded())
if(checkIfTornOff() && !isMessagePaneExpanded())
{
if(isMinimized())
{
setMinimized(false);
@ -888,6 +895,7 @@ void LLFloaterIMSessionTab::restoreFloater()
mBodyStack->updateLayout();
mExpandCollapseLineBtn->setImageOverlay(getString("expandline_icon"));
setMessagePaneExpanded(true);
saveCollapsedState();
enableResizeCtrls(true, true, true);
}
}
@ -1063,6 +1071,14 @@ LLConversationItem* LLFloaterIMSessionTab::getCurSelectedViewModelItem()
return conversationItem;
}
void LLFloaterIMSessionTab::saveCollapsedState()
{
LLFloaterIMSessionTab* conversp = LLFloaterIMSessionTab::getConversation(mSessionID);
if(conversp->isNearbyChat())
{
gSavedPerAccountSettings.setBOOL("NearbyChatIsNotCollapsed", isMessagePaneExpanded());
}
}
BOOL LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask )
{
if(mask == MASK_ALT)

View File

@ -101,6 +101,7 @@ public:
bool isMessagePaneExpanded(){return mMessagePaneExpanded;}
void setMessagePaneExpanded(bool expanded){mMessagePaneExpanded = expanded;}
void restoreFloater();
void saveCollapsedState();
protected:

View File

@ -160,163 +160,152 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id,
void on_new_message(const LLSD& msg)
{
std::string action;
std::string user_preferences;
LLUUID participant_id = msg["from_id"].asUUID();
LLUUID session_id = msg["session_id"].asUUID();
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
// determine action for this session
if (session_id.isNull())
{
action = gSavedSettings.getString("NotificationNearbyChatOptions");
}
else if(session->isP2PSessionType())
{
if (LLAvatarTracker::instance().isBuddy(participant_id))
{
action = gSavedSettings.getString("NotificationFriendIMOptions");
}
else
{
action = gSavedSettings.getString("NotificationNonFriendIMOptions");
}
}
else if(session->isAdHocSessionType())
{
action = gSavedSettings.getString("NotificationConferenceIMOptions");
}
else if(session->isGroupSessionType())
{
action = gSavedSettings.getString("NotificationGroupChatOptions");
}
// do not show notification which goes from agent
if (gAgent.getID() == participant_id)
{
return;
}
// execution of the action
// determine state of conversations floater
enum {CLOSED, NOT_ON_TOP, ON_TOP, ON_TOP_AND_ITEM_IS_SELECTED} conversations_floater_status;
LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
if (im_box->isFrontmost() && im_box->getSelectedSession() == session_id
&& !(session_floater->getHost() ? im_box->isMinimized() : session_floater->isMinimized()))
if (!LLFloater::isVisible(im_box) || im_box->isMinimized())
{
return;
conversations_floater_status = CLOSED;
}
else if (!im_box->isFrontmost() &&
(!session_floater || !LLFloater::isVisible(session_floater)
|| session_floater->isMinimized() || !session_floater->isFrontmost()))
{
conversations_floater_status = NOT_ON_TOP;
}
else if (im_box->getSelectedSession() != session_id)
{
conversations_floater_status = ON_TOP;
}
else
{
conversations_floater_status = ON_TOP_AND_ITEM_IS_SELECTED;
}
//session floater not focused (visible or not)
bool session_floater_not_focused = session_floater && !session_floater->hasFocus();
//conv. floater is closed
bool conversation_floater_is_closed =
!( im_box
&& im_box->isInVisibleChain()
&& !im_box->isMinimized());
//conversation floater not focused (visible or not)
bool conversation_floater_not_focused =
conversation_floater_is_closed || !im_box->hasFocus();
// sess. floater is open
bool session_floater_is_open =
session_floater
&& session_floater->isInVisibleChain()
&& !session_floater->isMinimized()
&& !(session_floater->getHost() && session_floater->getHost()->isMinimized());
bool conversation_floater_collapsed = !session_floater->isMessagePaneExpanded();
if (("toast" == action && !session_floater_is_open) || conversation_floater_collapsed)
// determine user prefs for this session
if (session_id.isNull())
{
//User is not focused on conversation containing the message
if(session_floater_not_focused || conversation_floater_collapsed)
user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions");
}
else if(session->isP2PSessionType())
{
if (LLAvatarTracker::instance().isBuddy(participant_id))
{
if(!LLMuteList::getInstance()->isMuted(participant_id))
{
im_box->flashConversationItemWidget(session_id, true);
}
//The conversation floater isn't focused/open
if(conversation_floater_not_focused || conversation_floater_collapsed)
{
if(!LLMuteList::getInstance()->isMuted(participant_id)
&& !gAgent.isDoNotDisturb())
{
gToolBarView->flashCommand(LLCommandId("chat"), true);
}
//Show IM toasts (upper right toasts)
// Skip toasting for system messages and for nearby chat
if(session_id.notNull() && participant_id.notNull())
{
LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
}
}
}
user_preferences = gSavedSettings.getString("NotificationFriendIMOptions");
}
else
{
user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions");
}
}
else if(session->isAdHocSessionType())
{
user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions");
}
else if(session->isGroupSessionType())
{
user_preferences = gSavedSettings.getString("NotificationGroupChatOptions");
}
else if ("flash" == action)
// actions:
// 0. nothing - exit
if (("none" == user_preferences ||
ON_TOP_AND_ITEM_IS_SELECTED == conversations_floater_status)
&& session_floater->isMessagePaneExpanded())
{
if (!gAgent.isDoNotDisturb())
{
im_box->flashConversationItemWidget(session_id, true);
if(conversation_floater_not_focused)
return;
}
// 1. open floater and [optional] surface it
if ("openconversations" == user_preferences &&
(CLOSED == conversations_floater_status
|| NOT_ON_TOP == conversations_floater_status))
{
if(!gAgent.isDoNotDisturb())
{
// Open conversations floater
LLFloaterReg::showInstance("im_container");
im_box->collapseMessagesPane(false);
if (session_floater)
{
//User is not focused on conversation containing the message
gToolBarView->flashCommand(LLCommandId("chat"), true);
}
}
else if(session_id.notNull() && participant_id.notNull())
{
//If a DND message, allow notification to be stored so upon DND exit
//useMostItrusiveIMNotification will be called to notify user a message exists
LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
}
}
else if("openconversations" == action)
{
//User is not focused on conversation containing the message
if(session_floater_not_focused)
{
//Flash line item
im_box->flashConversationItemWidget(session_id, true);
if(!gAgent.isDoNotDisturb())
{
//Surface conversations floater
LLFloaterReg::showInstance("im_container");
im_box->collapseMessagesPane(false);
if (session_floater)
if (session_floater->getHost())
{
if (session_floater->getHost())
if (NULL != im_box && im_box->isMinimized())
{
if (NULL != im_box && im_box->isMinimized())
{
LLFloater::onClickMinimize(im_box);
}
LLFloater::onClickMinimize(im_box);
}
else
}
else
{
if (session_floater->isMinimized())
{
if (session_floater->isMinimized())
{
LLFloater::onClickMinimize(session_floater);
}
LLFloater::onClickMinimize(session_floater);
}
}
}
//If in DND mode, allow notification to be stored so upon DND exit
}
else
{
//If in DND mode, allow notification to be stored so upon DND exit
//useMostItrusiveIMNotification will be called to notify user a message exists
if(session_id.notNull()
&& participant_id.notNull()
&& gAgent.isDoNotDisturb()
&& !session_floater_is_open)
if(session_id.notNull()
&& participant_id.notNull()
&& !session_floater->isShown())
{
LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
}
}
}
}
}
// 2. Flash line item
if ("openconversations" == user_preferences
|| NOT_ON_TOP == conversations_floater_status)
{
if(!LLMuteList::getInstance()->isMuted(participant_id))
{
im_box->flashConversationItemWidget(session_id, true);
}
}
// 3. Flash FUI button
if ("flash" == user_preferences &&
(CLOSED == conversations_floater_status
|| NOT_ON_TOP == conversations_floater_status))
{
if(!LLMuteList::getInstance()->isMuted(participant_id)
&& !gAgent.isDoNotDisturb())
{
gToolBarView->flashCommand(LLCommandId("chat"), true);
}
}
// 4. Toast
if (("toast" == user_preferences &&
(CLOSED == conversations_floater_status
|| NOT_ON_TOP == conversations_floater_status))
|| !session_floater->isMessagePaneExpanded())
{
//Show IM toasts (upper right toasts)
// Skip toasting for system messages and for nearby chat
if(session_id.notNull() && participant_id.notNull())
{
LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
}
}
}