diff options
author | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-05-08 23:30:34 +0300 |
---|---|---|
committer | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-05-08 23:30:34 +0300 |
commit | 905e56f8823e7513b35b9de4e5c6f8b0b6cca539 (patch) | |
tree | 8c302e616a275361b1d26ec3236d9547d007bc86 | |
parent | fac210075f4c68db372ae0535e332ffe9765a5d1 (diff) |
CHUI-103 FIXED Implemented switching text view modes from pop-up menu
-rw-r--r-- | indra/newview/app_settings/settings.xml | 1 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 54 | ||||
-rw-r--r-- | indra/newview/llimfloater.h | 6 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_session.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml | 50 |
6 files changed, 110 insertions, 5 deletions
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 @@ <key>Value</key> <integer>1</integer> </map> - <key>CrashHostUrl</key> <map> <key>Comment</key> 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<LLSD>::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"> <menu_button + menu_filename="menu_im_session_showmodes.xml" follows="top|left" height="25" image_hover_unselected="Toolbar_Middle_Over" diff --git a/indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml b/indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml new file mode 100644 index 0000000000..483f24afd0 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<toggleable_menu + name="menu_modes" + left="0" bottom="0" visible="false" + mouse_opaque="false"> + <menu_item_check + label="Compact view" + name="compact_view"> + <menu_item_check.on_click + function="IMSession.Menu.Action" + parameter="compact_view"/> + <menu_item_check.on_check + function="IMSession.Menu.CompactExpandedModes.CheckItem" + parameter="compact_view"/> + </menu_item_check> + <menu_item_check + label="Expanded view" + name="expanded_view"> + <menu_item_check.on_click + function="IMSession.Menu.Action" + parameter="expanded_view"/> + <menu_item_check.on_check + function="IMSession.Menu.CompactExpandedModes.CheckItem" + parameter="expanded_view"/> + </menu_item_check> + <menu_item_separator layout="topleft" /> + <menu_item_check name="IMShowTime" label="Show time"> + <menu_item_check.on_click + function="IMSession.Menu.Action" + parameter="IMShowTime" /> + <menu_item_check.on_check + function="IMSession.Menu.ShowModes.CheckItem" + parameter="IMShowTime" /> + <menu_item_check.on_enable + function="IMSession.Menu.ShowModes.Enable" + parameter="IMShowTime" /> + </menu_item_check> + <menu_item_check name="IMShowNamesForP2PConv" label="Show names in one-to-one conversations"> + <menu_item_check.on_click + function="IMSession.Menu.Action" + parameter="IMShowNamesForP2PConv" /> + <menu_item_check.on_check + function="IMSession.Menu.ShowModes.CheckItem" + parameter="IMShowNamesForP2PConv" /> + <menu_item_check.on_enable + function="IMSession.Menu.ShowModes.Enable" + parameter="IMShowNamesForP2PConv" /> + + </menu_item_check> +</toggleable_menu> |