Pull merge from richard/viewer-chui

meow-7.2.2
Merov Linden 2012-09-10 10:48:45 -07:00
commit 5b72a2d7fb
11 changed files with 70 additions and 86 deletions

View File

@ -148,7 +148,7 @@ BOOL LLIMConversation::postBuild()
updateHeaderAndToolbar();
mSaveRect = !getHost();
mSaveRect = isTornOff();
initRectControl();
if (isChatMultiTab())
@ -223,6 +223,46 @@ void LLIMConversation::onFocusLost()
LLTransientDockableFloater::onFocusLost();
}
std::string LLIMConversation::appendTime()
{
time_t utc_time;
utc_time = time_corrected();
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
+LLTrans::getString("TimeMin")+"]";
LLSD substitution;
substitution["datetime"] = (S32) utc_time;
LLStringUtil::format (timeStr, substitution);
return timeStr;
}
void LLIMConversation::appendMessage(const LLChat& chat, const LLSD &args)
{
LLChat& tmp_chat = const_cast<LLChat&>(chat);
if(tmp_chat.mTimeStr.empty())
tmp_chat.mTimeStr = appendTime();
if (!chat.mMuted)
{
tmp_chat.mFromName = chat.mFromName;
LLSD chat_args;
if (args) chat_args = args;
chat_args["use_plain_text_chat_history"] =
gSavedSettings.getBOOL("PlainTextChatHistory");
chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
chat_args["show_names_for_p2p_conv"] =
!mIsP2PChat || gSavedSettings.getBOOL("IMShowNamesForP2PConv");
if (mChatHistory)
{
mChatHistory->appendMessage(chat, chat_args);
}
}
}
void LLIMConversation::buildParticipantList()
{
@ -309,11 +349,11 @@ void LLIMConversation::hideOrShowTitle()
LLView* floater_contents = getChild<LLView>("contents_view");
LLRect floater_rect = getLocalRect();
S32 top_border_of_contents = floater_rect.mTop - (getHost()? 0 : floater_header_size);
S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0);
LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents);
LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom);
mDragHandle->setShape(handle_rect);
mDragHandle->setVisible(!getHost());
mDragHandle->setVisible(isTornOff());
floater_contents->setShape(contents_rect);
}
@ -331,8 +371,8 @@ void LLIMConversation::hideAllStandardButtons()
void LLIMConversation::updateHeaderAndToolbar()
{
bool is_hosted = !!getHost();
if (is_hosted)
bool is_torn_off = !getHost();
if (!is_torn_off)
{
hideAllStandardButtons();
}
@ -341,7 +381,7 @@ void LLIMConversation::updateHeaderAndToolbar()
// Participant list should be visible only in torn off floaters.
bool is_participant_list_visible =
!is_hosted
is_torn_off
&& gSavedSettings.getBOOL("IMShowControlPanel")
&& !mIsP2PChat;
@ -349,21 +389,21 @@ void LLIMConversation::updateHeaderAndToolbar()
// Display collapse image (<<) if the floater is hosted
// or if it is torn off but has an open control panel.
bool is_expanded = is_hosted || is_participant_list_visible;
bool is_expanded = !is_torn_off || is_participant_list_visible;
mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon"));
// toggle floater's drag handle and title visibility
if (mDragHandle)
{
mDragHandle->setTitleVisible(!is_hosted);
mDragHandle->setTitleVisible(is_torn_off);
}
// The button (>>) should be disabled for torn off P2P conversations.
mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat);
mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat);
mTearOffBtn->setImageOverlay(getString(is_hosted? "tear_off_icon" : "return_icon"));
mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon"));
mCloseBtn->setVisible(is_hosted && !mIsNearbyChat);
mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat);
enableDisableCallBtn();
@ -400,7 +440,7 @@ void LLIMConversation::processChatHistoryStyleUpdate()
}
}
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChat>("nearby_chat");
if (nearby_chat)
{
nearby_chat->reloadMessages();
@ -470,8 +510,8 @@ void LLIMConversation::onClose(bool app_quitting)
void LLIMConversation::onTearOffClicked()
{
setFollows(getHost()? FOLLOWS_NONE : FOLLOWS_ALL);
mSaveRect = !getHost();
setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE);
mSaveRect = isTornOff();
initRectControl();
LLFloater::onClickTearOff(this);
updateHeaderAndToolbar();

View File

@ -104,6 +104,11 @@ protected:
/* virtual */ void onFocusLost();
/* virtual */ void onFocusReceived();
// prepare chat's params and out one message to chatHistory
void appendMessage(const LLChat& chat, const LLSD &args = 0);
std::string appendTime();
bool mIsNearbyChat;
bool mIsP2PChat;

View File

@ -848,25 +848,6 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id)
}
}
void LLIMFloater::appendMessage(const LLChat& chat, const LLSD &args)
{
LLChat& tmp_chat = const_cast<LLChat&>(chat);
if (!chat.mMuted)
{
tmp_chat.mFromName = chat.mFromName;
LLSD chat_args;
if (args) chat_args = args;
chat_args["use_plain_text_chat_history"] =
gSavedSettings.getBOOL("PlainTextChatHistory");
chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
chat_args["show_names_for_p2p_conv"] = !mIsP2PChat
|| gSavedSettings.getBOOL("IMShowNamesForP2PConv");
mChatHistory->appendMessage(chat, chat_args);
}
}
void LLIMFloater::updateMessages()
{
std::list<LLSD> messages;

View File

@ -152,7 +152,6 @@ private:
BOOL isInviteAllowed() const;
BOOL inviteToSession(const uuid_vec_t& agent_ids);
void appendMessage(const LLChat& chat, const LLSD &args = 0);
static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata );
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);

View File

@ -69,7 +69,7 @@
S32 LLNearbyChat::sLastSpecialChatChannel = 0;
// --- 2 functions in the global namespace :( ---
// --- function in the global namespace :( ---
bool isWordsName(const std::string& name)
{
// checking to see if it's display name plus username in parentheses
@ -89,22 +89,6 @@ bool isWordsName(const std::string& name)
}
}
std::string appendTime()
{
time_t utc_time;
utc_time = time_corrected();
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
+LLTrans::getString("TimeMin")+"]";
LLSD substitution;
substitution["datetime"] = (S32) utc_time;
LLStringUtil::format (timeStr, substitution);
return timeStr;
}
const S32 EXPANDED_HEIGHT = 266;
const S32 COLLAPSED_HEIGHT = 60;
const S32 EXPANDED_MIN_HEIGHT = 150;
@ -129,6 +113,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd)
mSpeakerMgr(NULL),
mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
{
mIsP2PChat = false;
mIsNearbyChat = true;
setIsChrome(TRUE);
mKey = LLSD();
@ -604,31 +589,6 @@ void LLNearbyChat::sendChat( EChatType type )
}
}
void LLNearbyChat::appendMessage(const LLChat& chat, const LLSD &args)
{
LLChat& tmp_chat = const_cast<LLChat&>(chat);
if(tmp_chat.mTimeStr.empty())
tmp_chat.mTimeStr = appendTime();
if (!chat.mMuted)
{
tmp_chat.mFromName = chat.mFromName;
LLSD chat_args;
if (args) chat_args = args;
chat_args["use_plain_text_chat_history"] =
gSavedSettings.getBOOL("PlainTextChatHistory");
chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
chat_args["show_names_for_p2p_conv"] = true;
if (mChatHistory)
{
mChatHistory->appendMessage(chat, chat_args);
}
}
}
void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
{
appendMessage(chat, args);

View File

@ -108,8 +108,6 @@ protected:
private:
// prepare chat's params and out one message to chatHistory
void appendMessage(const LLChat& chat, const LLSD &args = 0);
void onNearbySpeakers ();
/*virtual*/ void refresh();

View File

@ -487,6 +487,8 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
if(chat_msg.mText.empty())
return;//don't process empty messages
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
// Build notification data
LLSD chat;
chat["message"] = chat_msg.mText;
@ -537,7 +539,6 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
}
}
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
nearby_chat->addMessage(chat_msg, true, args);
if(chat_msg.mSourceType == CHAT_SOURCE_AGENT

View File

@ -181,7 +181,7 @@ void LLHandlerUtil::logGroupNoticeToIMGroup(
// static
void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type)
{
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChat>("nearby_chat");
if (nearby_chat)
{
LLChat chat_msg(notification->getMessage());

View File

@ -86,7 +86,7 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification)
// don't show toast if Nearby Chat is opened
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
if (nearby_chat && nearby_chat->isChatVisible())
if (nearby_chat->isChatVisible())
{
return false;
}

View File

@ -2493,7 +2493,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat");
LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChat>("nearby_chat");
// Traverses up the hierarchy
if( keyboard_focus )
@ -2561,10 +2561,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
// If "Pressing letter keys starts local chat" option is selected, we are not in mouselook,
// no view has keyboard focus, this is a printable character key (and no modifier key is
// pressed except shift), then give focus to nearby chat (STORM-560)
if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
if ( nearby_chat && gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
!keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
{
LLChatEntry* chat_editor = nearby_chat->getChatBox();
LLChatEntry* chat_editor = LLFloaterReg::findTypedInstance<LLNearbyChat>("nearby_chat")->getChatBox();
if (chat_editor)
{
// passing NULL here, character will be added later when it is handled by character handler.

View File

@ -36,7 +36,7 @@
name="conversations_layout_panel"
min_dim="38"
width="268"
expanded_min_dim="120">
expanded_min_dim="165">
<layout_stack
animate="false"
follows="left|top|right"
@ -113,7 +113,7 @@
height="430"
name="messages_layout_panel"
width="412"
expanded_min_dim="205">
expanded_min_dim="225">
<panel_container
follows="all"
height="430"