From 905e56f8823e7513b35b9de4e5c6f8b0b6cca539 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 8 May 2012 23:30:34 +0300 Subject: CHUI-103 FIXED Implemented switching text view modes from pop-up menu --- indra/newview/app_settings/settings.xml | 1 - indra/newview/llimfloater.cpp | 54 ++++++++++++++++++++-- indra/newview/llimfloater.h | 6 ++- indra/newview/llnearbychat.cpp | 3 ++ .../skins/default/xui/en/floater_im_session.xml | 1 + .../default/xui/en/menu_im_session_showmodes.xml | 50 ++++++++++++++++++++ 6 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e6d0ed7dfa..d1fc8bdb7e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -24,7 +24,6 @@ Value 1 - CrashHostUrl Comment diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index df3521ecb0..d02db458b4 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -94,7 +94,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) case IM_SESSION_GROUP_START: mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); break; - case IM_SESSION_INVITE: + case IM_SESSION_INVITE: if (gAgent.isInGroup(mSessionID)) { mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); @@ -104,7 +104,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); } break; - default: break; + default: + break; } } setOverlapsScreenChannel(true); @@ -112,6 +113,52 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); setDocked(true); + mCommitCallbackRegistrar.add("IMSession.Menu.Action", + boost::bind(&LLIMFloater::onIMSessionMenuItemClicked, this, _2)); + mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem", + boost::bind(&LLIMFloater::onIMCompactExpandedMenuItemCheck, this, _2)); + mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem", + boost::bind(&LLIMFloater::onIMShowModesMenuItemCheck, this, _2)); + mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable", + boost::bind(&LLIMFloater::onIMShowModesMenuItemEnable, this, _2)); +} + +bool LLIMFloater::onIMCompactExpandedMenuItemCheck(const LLSD& userdata) +{ + std::string item = userdata.asString(); + bool is_plain_text_mode = gSavedSettings.getBOOL("PlainTextChatHistory"); + + return is_plain_text_mode? item == "compact_view" : item == "expanded_view"; +} + +bool LLIMFloater::onIMShowModesMenuItemCheck(const LLSD& userdata) +{ + return gSavedSettings.getBOOL(userdata.asString()); +} + +bool LLIMFloater::onIMShowModesMenuItemEnable(const LLSD& userdata) +{ + std::string item = userdata.asString(); + bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory"); + bool is_not_names = (item != "IMShowNamesForP2PConv"); + bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL); + return (plain_text && (is_not_names || is_p2p_chat)); +} + +void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata) +{ + std::string item = userdata.asString(); + + if (item == "compact_view" || item == "expanded_view") + { + gSavedSettings.setBOOL("PlainTextChatHistory", item == "compact_view"); + } + else + { bool prev_value = gSavedSettings.getBOOL(item); + gSavedSettings.setBOOL(item, !prev_value); + } + + reloadMessages(); } void LLIMFloater::onFocusLost() @@ -635,11 +682,12 @@ void LLIMFloater::updateMessages() if (messages.size()) { + bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL); LLSD chat_args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); chat_args["show_names_for_p2p_conv"] = - gSavedSettings.getBOOL("IMShowNamesForP2PConv"); + (!is_p2p_chat) || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); std::ostringstream message; std::list::const_reverse_iterator iter = messages.rbegin(); diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 95aa214ff6..ff4eaed0b9 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -87,7 +87,6 @@ public: // called when docked floater's position has been set by chiclet void setPositioned(bool b) { mPositioned = b; }; - void onVisibilityChange(const LLSD& new_visibility); void processIMTyping(const LLIMInfo* im_info, BOOL typing); void processAgentListUpdates(const LLSD& body); @@ -148,6 +147,11 @@ private: static void* createPanelGroupControl(void* userdata); static void* createPanelAdHocControl(void* userdata); + bool onIMCompactExpandedMenuItemCheck(const LLSD& userdata); + bool onIMShowModesMenuItemCheck(const LLSD& userdata); + bool onIMShowModesMenuItemEnable(const LLSD& userdata); + void onIMSessionMenuItemClicked(const LLSD& userdata); + // Add the "User is typing..." indicator. void addTypingIndicator(const LLIMInfo* im_info); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index a7303ad035..3a43750408 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -120,6 +120,9 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args) tmp_chat.mFromName = chat.mFromName; LLSD chat_args = args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; + chat_args["show_time"] = true; + chat_args["show_names_for_p2p_conv"] = true; + mChatHistory->appendMessage(chat, chat_args); } 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 3c3f4ad0e2..d90947a80a 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -31,6 +31,7 @@ height="35" width="394"> + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3