From 155072934832baf42a0dd01f1d898ccad4782a11 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 18 Mar 2010 18:13:39 +0200 Subject: Done normal task EXT-6290 ([TRUNCATION] Block List - type shown after name is truncated when the name is long. need 'en' xui rework) * Changed the way blocked items are shown in the list. For now they are separated on two columns: Name & Type. If Name is too long it is shown truncated (with ...) * As result remove deprecated methods from LLMute to concatenate its name & type and to extract name & type from the such concatenated string. * reduce include dependence from llmutelist.h --HG-- branch : product-engine --- indra/newview/llinventoryobserver.cpp | 1 - indra/newview/llmutelist.cpp | 52 +++------------------- indra/newview/llmutelist.h | 10 +---- indra/newview/llpanelblockedlist.cpp | 13 +++--- indra/newview/llspeakers.cpp | 1 - .../default/xui/en/panel_block_list_sidetray.xml | 8 +++- 6 files changed, 22 insertions(+), 63 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 2fb8aea4e9..62c2d80609 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -54,7 +54,6 @@ #include "llappviewer.h" #include "lldbstrings.h" #include "llviewerstats.h" -#include "llmutelist.h" #include "llnotificationsutil.h" #include "llcallbacklist.h" #include "llpreview.h" diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 2d3c4b187e..95094f6b52 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -128,68 +128,26 @@ LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags) } -std::string LLMute::getDisplayName() const +std::string LLMute::getDisplayType() const { - std::string name_with_suffix = mName; switch (mType) { case BY_NAME: default: - name_with_suffix += " " + LLTrans::getString("MuteByName"); + return LLTrans::getString("MuteByName"); break; case AGENT: - name_with_suffix += " " + LLTrans::getString("MuteAgent"); + return LLTrans::getString("MuteAgent"); break; case OBJECT: - name_with_suffix += " " + LLTrans::getString("MuteObject"); + return LLTrans::getString("MuteObject"); break; case GROUP: - name_with_suffix += " " + LLTrans::getString("MuteGroup"); + return LLTrans::getString("MuteGroup"); break; } - return name_with_suffix; } -void LLMute::setFromDisplayName(const std::string& display_name) -{ - size_t pos = 0; - mName = display_name; - - pos = mName.rfind(" " + LLTrans::getString("MuteGroup")); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = GROUP; - return; - } - - pos = mName.rfind(" " + LLTrans::getString("MuteObject")); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = OBJECT; - return; - } - - pos = mName.rfind(" " + LLTrans::getString("MuteAgent")); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = AGENT; - return; - } - - pos = mName.rfind(" " + LLTrans::getString("MuteByName")); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = BY_NAME; - return; - } - - llwarns << "Unable to set mute from display name " << display_name << llendl; - return; -} /* static */ LLMuteList* LLMuteList::getInstance() diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index e1e81a24b4..7cb11e6031 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -63,14 +63,8 @@ public: LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0); - // Returns name + suffix based on type - // For example: "James Tester (resident)" - std::string getDisplayName() const; - - // Converts a UI name into just the agent or object name - // For example: "James Tester (resident)" sets the name to "James Tester" - // and the type to AGENT. - void setFromDisplayName(const std::string& display_name); + // Returns localized type name of muted item + std::string getDisplayType() const; public: LLUUID mID; // agent or object id diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 362657a458..a186bc926c 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -119,8 +119,13 @@ void LLPanelBlockedList::refreshBlockedList() std::vector::iterator it; for (it = mutes.begin(); it != mutes.end(); ++it) { - std::string display_name = it->getDisplayName(); - mBlockedList->addStringUUIDItem(display_name, it->mID, ADD_BOTTOM, TRUE); + LLScrollListItem::Params item_p; + item_p.enabled(TRUE); + item_p.value(it->mID); // link UUID of blocked item with ScrollListItem + item_p.columns.add().column("item_name").value(it->mName);//.type("text"); + item_p.columns.add().column("item_type").value(it->getDisplayType());//.type("text").width(111); + + mBlockedList->addRow(item_p, ADD_BOTTOM); } } @@ -145,9 +150,7 @@ void LLPanelBlockedList::onRemoveBtnClick() { std::string name = mBlockedList->getSelectedItemLabel(); LLUUID id = mBlockedList->getStringUUIDSelectedItem(); - LLMute mute(id); - mute.setFromDisplayName(name); - // now mute.mName has the suffix trimmed off + LLMute mute(id, name); S32 last_selected = mBlockedList->getFirstSelectedIndex(); if (LLMuteList::getInstance()->remove(mute)) diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 717a8bda1e..6cf9c6b95d 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -37,7 +37,6 @@ #include "llagent.h" #include "llappviewer.h" #include "llimview.h" -#include "llmutelist.h" #include "llsdutil.h" #include "lluicolortable.h" #include "llviewerobjectlist.h" diff --git a/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml b/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml index 072ea882e6..d3f6695375 100644 --- a/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml +++ b/indra/newview/skins/default/xui/en/panel_block_list_sidetray.xml @@ -39,7 +39,13 @@ name="blocked" tool_tip="List of currently blocked Residents" top="30" - width="270" /> + width="270"> + + +