Mute list, now with 100% more text-appearing-ness, and 20% new shinies (mute-type icons, multi-select unmute, and displayname support).

This commit is contained in:
Shyotl
2012-12-14 16:24:51 -06:00
parent 7a2f572eaa
commit 2b582b169b
7 changed files with 104 additions and 25 deletions

View File

@@ -48,14 +48,16 @@
#include "llbutton.h"
#include "lllineeditor.h"
#include "llmutelist.h"
#include "llnamelistctrl.h"
#include "llresizehandle.h"
#include "llscrolllistctrl.h"
#include "lltextbox.h"
#include "llviewertexteditor.h"
#include "llviewerwindow.h"
#include "lluictrlfactory.h"
#include "llfocusmgr.h"
#include <boost/lexical_cast.hpp>
//
// Constants
//
@@ -209,7 +211,12 @@ BOOL LLFloaterMute::postBuild()
childSetAction("Mute object by name...", onClickMuteByName, this);
childSetAction("Unmute", onClickRemove, this);
mMuteList = getChild<LLScrollListCtrl>("mutes");
mAvatarIcon = LLUI::getUIImage("icon_avatar_offline.tga");
mObjectIcon = LLUI::getUIImage("inv_item_object.tga");
mGroupIcon = LLUI::getUIImage("icon_group.tga");
mNameIcon = LLUI::getUIImage("icon_name.tga");
mMuteList = getChild<LLNameListCtrl>("mutes");
mMuteList->setCommitOnSelectionChange(TRUE);
LLMuteList::getInstance()->addObserver(this);
@@ -231,16 +238,63 @@ LLFloaterMute::~LLFloaterMute()
//-----------------------------------------------------------------------------
void LLFloaterMute::refreshMuteList()
{
uuid_vec_t selected = mMuteList->getSelectedIDs();
S32 scrollpos = mMuteList->getScrollPos();
mMuteList->deleteAllItems();
mMuteDict.clear();
std::vector<LLMute> mutes = LLMuteList::getInstance()->getMutes();
std::vector<LLMute>::iterator it;
U32 count = 0;
for (it = mutes.begin(); it != mutes.end(); ++it)
{
std::string display_name = it->getDisplayName();
mMuteList->addStringUUIDItem(display_name, it->mID);
}
std::string display_name = it->mName;
LLSD element;
LLUUID entry_id;
if(it->mType == LLMute::GROUP || it->mType == LLMute::AGENT)
entry_id = it->mID;
else
entry_id.generate(boost::lexical_cast<std::string>( count++ ));
mMuteDict.insert(std::make_pair(entry_id,*it));
element["id"] = entry_id;
element["name"] = display_name;
LLSD& name_column = element["columns"][1];
name_column["column"] = "name";
name_column["type"] = "text";
name_column["value"] = "";
LLSD& icon_column = element["columns"][0];
icon_column["column"] = "icon";
icon_column["type"] = "icon";
switch(it->mType)
{
case LLMute::GROUP:
icon_column["value"] = mGroupIcon->getName();
element["target"] = LLNameListCtrl::GROUP;
break;
case LLMute::AGENT:
icon_column["value"] = mAvatarIcon->getName();
element["target"] = LLNameListCtrl::INDIVIDUAL;
break;
case LLMute::OBJECT:
icon_column["value"] = mObjectIcon->getName();
element["target"] = LLNameListCtrl::SPECIAL;
break;
case LLMute::BY_NAME:
default:
icon_column["value"] = mNameIcon->getName();
element["target"] = LLNameListCtrl::SPECIAL;
break;
}
mMuteList->addNameItemRow(element);
}
mMuteList->updateSort();
mMuteList->selectMultiple(selected);
mMuteList->setScrollPos(scrollpos);
updateButtons();
}
@@ -282,17 +336,22 @@ void LLFloaterMute::onClickRemove(void *data)
{
LLFloaterMute* floater = (LLFloaterMute *)data;
std::string name = floater->mMuteList->getSelectedItemLabel();
LLUUID id = floater->mMuteList->getStringUUIDSelectedItem();
LLMute mute(id);
mute.setFromDisplayName(name);
// now mute.mName has the suffix trimmed off
S32 last_selected = floater->mMuteList->getFirstSelectedIndex();
if (LLMuteList::getInstance()->remove(mute))
bool removed = false;
const std::vector<LLScrollListItem*> items = floater->mMuteList->getAllSelected();
for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); ++it)
{
std::map<LLUUID,LLMute>::iterator mute_it = floater->mMuteDict.find((*it)->getUUID());
if(mute_it != floater->mMuteDict.end() && LLMuteList::getInstance()->remove(mute_it->second))
{
floater->mMuteDict.erase(mute_it);
removed = true;
}
}
if (removed)
{
// Above removals may rebuild this dialog.
if (last_selected == floater->mMuteList->getItemCount())
{
// we were on the last item, so select the last item again
@@ -303,8 +362,12 @@ void LLFloaterMute::onClickRemove(void *data)
// else select the item after the last item previously selected
floater->mMuteList->selectNthItem(last_selected);
}
floater->mMuteList->setNeedsSort();
floater->mMuteList->updateSort();
floater->updateButtons();
}
floater->updateButtons();
}
//-----------------------------------------------------------------------------

View File

@@ -42,7 +42,8 @@ class LLButton;
class LLLineEditor;
class LLMessageSystem;
class LLUUID;
class LLScrollListCtrl;
class LLNameListCtrl;
class LLMute;
class LLFloaterMute
: public LLFloater, public LLMuteListObserver, public LLFloaterSingleton<LLFloaterMute>
@@ -74,7 +75,14 @@ private:
static void callbackMuteByName(const std::string& text, void*);
private:
LLScrollListCtrl* mMuteList;
LLNameListCtrl* mMuteList;
LLPointer<LLUIImage> mAvatarIcon; //icon_avatar_offline.tga
LLPointer<LLUIImage> mObjectIcon; //inv_item_object.tga
LLPointer<LLUIImage> mGroupIcon; //icon_group.tga
LLPointer<LLUIImage> mNameIcon; //icon_name.tga
std::map<LLUUID, LLMute> mMuteDict; //Easiest way to associate listitems with LLMute instances without hacking in, say, a hidden column.
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -100,7 +100,8 @@
<texture name="icon_place.tga"/>
<texture name="icon_popular.tga"/>
<texture name="icon_top_pick.tga"/>
<texture name="icon_name.tga"/>
<texture name="inv_folder_animation.tga"/>
<texture name="inv_folder_bodypart.tga"/>
<texture name="inv_folder_callingcard.tga"/>

View File

@@ -1,14 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater bottom="-384" can_close="true" can_drag_on_left="false" can_minimize="true"
can_resize="true" can_tear_off="true" enabled="true" height="300" left="45"
min_height="140" min_width="220" mouse_opaque="true" name="mute floater"
min_height="152" min_width="220" mouse_opaque="true" name="mute floater"
rect_control="FloaterMuteRect3" short_title="Mute List"
title="Muted Residents &amp; Objects" width="300">
<scroll_list background_visible="true" bottom="-220" column_padding="5" draw_border="true"
draw_heading="false" draw_stripes="true" enabled="true"
follows="left|top|right|bottom" height="200"
left="4" mouse_opaque="true" multi_select="false" name="mutes"
tool_tip="List of currently muted residents" width="292" />
<name_list name="mutes"
left="10" right="-10" top="-20" bottom="90" can_resize="true"
column_padding="0" follows="left|top|bottom|right"
draw_heading="true" multi_select="true" name_column_index="1"
tool_tip="Names of muted objects/avatars">
<column name="icon" label="" width="18"/>
<column dynamicwidth="true" label="Name" name="name" tool_tip="Name" />
</name_list>
<button bottom="-244" enabled="true" follows="left|bottom" font="SansSerif"
halign="center" height="20" label="Mute Resident..."
label_selected="Mute Resident..." left="4" mouse_opaque="true"

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="mute floater" short_title="Lista de Ignorados" title="Residentes y Objetos Ignorados">
<scroll_list name="mutes" tool_tip="Lista de residentes ignorados actualmente" />
<name_list name="mutes" tool_tip="Lista de residentes ignorados actualmente">
<column label="Nombre" name="name" tool_tip="Nombre"/>
</name_list>
<button label="Residente Ignorado..." label_selected="Residente Ignorado..." name="Mute resident..." tool_tip="Selecciona un residente para ignorar" />
<button label="Ignorar objeto por su nombre..." label_selected="Ignorar objeto por su nombre..." name="Mute object by name..."/>
<button label="No Ignorar" label_selected="No Ignorar" name="Unmute" tool_tip="Quitar un residente u objeto de la lista de ignorados" />

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="mute floater" title="Résidents et objets ignorés(mute)" short_title="Liste des ignorés(mute)">
<scroll_list name="mutes" tool_tip="Liste des résidents ignorés(mute)actuellement" />
<name_list name="mutes" tool_tip="Liste des résidents ignorés(mute)actuellement">
<column label="Nom" name="name" tool_tip="Nom"/>
</name_list>
<button label="Ignorer le résident(mute)" label_selected="Ignorer le résident(mute)"
name="Mute resident"
tool_tip="Choisir le résident à ignorer (mute)" />