Update LLNameListCtrl, mostly to use Params for its elements
This commit is contained in:
@@ -28,8 +28,6 @@
|
|||||||
#ifndef LLSCROLLLISTITEM_H
|
#ifndef LLSCROLLLISTITEM_H
|
||||||
#define LLSCROLLLISTITEM_H
|
#define LLSCROLLLISTITEM_H
|
||||||
|
|
||||||
#include "llrefcount.h"
|
|
||||||
#include "llhandle.h"
|
|
||||||
#include "llsd.h"
|
#include "llsd.h"
|
||||||
#include "llscrolllistcell.h"
|
#include "llscrolllistcell.h"
|
||||||
|
|
||||||
@@ -37,7 +35,6 @@
|
|||||||
// LLScrollListItem
|
// LLScrollListItem
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
class LLScrollListItem
|
class LLScrollListItem
|
||||||
: public LLHandleProvider<LLScrollListItem> // Singu TODO: Break out into LLNameListItem
|
|
||||||
{
|
{
|
||||||
friend class LLScrollListCtrl;
|
friend class LLScrollListCtrl;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -238,46 +238,48 @@ void LLFloaterMute::refreshMuteList()
|
|||||||
for (it = mutes.begin(); it != mutes.end(); ++it)
|
for (it = mutes.begin(); it != mutes.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string display_name = it->mName;
|
std::string display_name = it->mName;
|
||||||
LLSD element;
|
LLNameListCtrl::NameItem element;
|
||||||
LLUUID entry_id;
|
LLUUID entry_id;
|
||||||
if(it->mType == LLMute::GROUP || it->mType == LLMute::AGENT)
|
if(it->mType == LLMute::GROUP || it->mType == LLMute::AGENT)
|
||||||
entry_id = it->mID;
|
entry_id = it->mID;
|
||||||
else
|
else
|
||||||
entry_id.generate(boost::lexical_cast<std::string>( count++ ));
|
entry_id.generate(boost::lexical_cast<std::string>( count++ ));
|
||||||
mMuteDict.insert(std::make_pair(entry_id,*it));
|
mMuteDict.insert(std::make_pair(entry_id,*it));
|
||||||
element["id"] = entry_id;
|
element.value = entry_id;
|
||||||
element["name"] = display_name;
|
element.name = display_name;
|
||||||
|
|
||||||
LLSD& name_column = element["columns"][1];
|
LLScrollListCell::Params name_column;
|
||||||
name_column["column"] = "name";
|
name_column.column = "name";
|
||||||
name_column["type"] = "text";
|
name_column.type = "text";
|
||||||
name_column["value"] = "";
|
name_column.value = "";
|
||||||
|
|
||||||
LLSD& icon_column = element["columns"][0];
|
LLScrollListCell::Params icon_column;
|
||||||
icon_column["column"] = "icon";
|
icon_column.column = "icon";
|
||||||
icon_column["type"] = "icon";
|
icon_column.type = "icon";
|
||||||
|
|
||||||
switch(it->mType)
|
switch(it->mType)
|
||||||
{
|
{
|
||||||
case LLMute::GROUP:
|
case LLMute::GROUP:
|
||||||
icon_column["value"] = mGroupIcon->getName();
|
icon_column.value = mGroupIcon->getName();
|
||||||
element["target"] = LLNameListCtrl::GROUP;
|
element.target = LLNameListCtrl::GROUP;
|
||||||
break;
|
break;
|
||||||
case LLMute::AGENT:
|
case LLMute::AGENT:
|
||||||
icon_column["value"] = mAvatarIcon->getName();
|
icon_column.value = mAvatarIcon->getName();
|
||||||
element["target"] = LLNameListCtrl::INDIVIDUAL;
|
element.target = LLNameListCtrl::INDIVIDUAL;
|
||||||
break;
|
break;
|
||||||
case LLMute::OBJECT:
|
case LLMute::OBJECT:
|
||||||
icon_column["value"] = mObjectIcon->getName();
|
icon_column.value = mObjectIcon->getName();
|
||||||
element["target"] = LLNameListCtrl::SPECIAL;
|
element.target = LLNameListCtrl::SPECIAL;
|
||||||
break;
|
break;
|
||||||
case LLMute::BY_NAME:
|
case LLMute::BY_NAME:
|
||||||
default:
|
default:
|
||||||
icon_column["value"] = mNameIcon->getName();
|
icon_column.value = mNameIcon->getName();
|
||||||
element["target"] = LLNameListCtrl::SPECIAL;
|
element.target = LLNameListCtrl::SPECIAL;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
element.columns.add(icon_column);
|
||||||
|
element.columns.add(name_column);
|
||||||
mMuteList->addNameItemRow(element);
|
mMuteList->addNameItemRow(element);
|
||||||
}
|
}
|
||||||
mMuteList->updateSort();
|
mMuteList->updateSort();
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file llnamelistctrl.cpp
|
* @file llnamelistctrl.cpp
|
||||||
* @brief A list of names, automatically refreshed from name cache.
|
* @brief A list of names, automatically refreshed from name cache.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2003-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* to you under the terms of the GNU General Public License, version 2.0
|
|
||||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
|
||||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
|
||||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
|
||||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -42,55 +36,41 @@
|
|||||||
#include "llinventory.h"
|
#include "llinventory.h"
|
||||||
#include "llscrolllistitem.h"
|
#include "llscrolllistitem.h"
|
||||||
#include "llscrolllistcolumn.h"
|
#include "llscrolllistcolumn.h"
|
||||||
|
#include "llsdparam.h"
|
||||||
#include "lltrans.h"
|
#include "lltrans.h"
|
||||||
|
|
||||||
static LLRegisterWidget<LLNameListCtrl> r("name_list");
|
static LLRegisterWidget<LLNameListCtrl> r("name_list");
|
||||||
|
|
||||||
// statics
|
|
||||||
std::set<LLNameListCtrl*> LLNameListCtrl::sInstances;
|
|
||||||
|
|
||||||
LLNameListCtrl::LLNameListCtrl(const std::string& name,
|
void LLNameListCtrl::NameTypeNames::declareValues()
|
||||||
const LLRect& rect,
|
{
|
||||||
BOOL allow_multiple_selection,
|
declare("INDIVIDUAL", LLNameListCtrl::INDIVIDUAL);
|
||||||
BOOL draw_border,
|
declare("GROUP", LLNameListCtrl::GROUP);
|
||||||
bool draw_heading,
|
declare("SPECIAL", LLNameListCtrl::SPECIAL);
|
||||||
S32 name_column_index,
|
}
|
||||||
const std::string& tooltip)
|
|
||||||
: LLScrollListCtrl(name, rect, NULL, allow_multiple_selection,
|
LLNameListCtrl::LLNameListCtrl(const std::string& name, const LLRect& rect, BOOL allow_multiple_selection, BOOL draw_border, bool draw_heading, S32 name_column_index, const std::string& tooltip)
|
||||||
draw_border,draw_heading),
|
: LLScrollListCtrl(name, rect, NULL, allow_multiple_selection, draw_border,draw_heading),
|
||||||
mNameColumnIndex(name_column_index),
|
mNameColumnIndex(name_column_index),
|
||||||
mAllowCallingCardDrop(FALSE),
|
mAllowCallingCardDrop(false),
|
||||||
mShortNames(FALSE)
|
mShortNames(false),
|
||||||
|
mAvatarNameCacheConnection()
|
||||||
{
|
{
|
||||||
setToolTip(tooltip);
|
setToolTip(tooltip);
|
||||||
LLNameListCtrl::sInstances.insert(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// virtual
|
|
||||||
LLNameListCtrl::~LLNameListCtrl()
|
|
||||||
{
|
|
||||||
LLNameListCtrl::sInstances.erase(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// public
|
// public
|
||||||
LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
|
LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
|
||||||
BOOL enabled, const std::string& suffix)
|
BOOL enabled, const std::string& suffix)
|
||||||
{
|
{
|
||||||
//llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl;
|
//llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl;
|
||||||
|
|
||||||
LLSD item;
|
NameItem item;
|
||||||
item["id"] = agent_id;
|
item.value = agent_id;
|
||||||
item["enabled"] = enabled;
|
item.enabled = enabled;
|
||||||
item["target"] = INDIVIDUAL;
|
item.target = INDIVIDUAL;
|
||||||
item["suffix"] = suffix;
|
|
||||||
LLSD& column = item["columns"][0];
|
|
||||||
column["value"] = "";
|
|
||||||
column["font"] = "SANSSERIF";
|
|
||||||
column["column"] = "name";
|
|
||||||
|
|
||||||
return addNameItemRow(item, pos);
|
return addNameItemRow(item, pos, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual, public
|
// virtual, public
|
||||||
@@ -146,50 +126,52 @@ BOOL LLNameListCtrl::handleDragAndDrop(
|
|||||||
void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos,
|
void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos,
|
||||||
BOOL enabled)
|
BOOL enabled)
|
||||||
{
|
{
|
||||||
LLSD item;
|
NameItem item;
|
||||||
item["id"] = group_id;
|
item.value = group_id;
|
||||||
item["enabled"] = enabled;
|
item.enabled = enabled;
|
||||||
item["target"] = GROUP;
|
item.target = GROUP;
|
||||||
LLSD& column = item["columns"][0];
|
|
||||||
column["value"] = "";
|
|
||||||
column["font"] = "SANSSERIF";
|
|
||||||
column["column"] = "name";
|
|
||||||
|
|
||||||
addNameItemRow(item, pos);
|
addNameItemRow(item, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public
|
// public
|
||||||
void LLNameListCtrl::addGroupNameItem(LLSD& item, EAddPosition pos)
|
void LLNameListCtrl::addGroupNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos)
|
||||||
{
|
{
|
||||||
item["target"] = GROUP;
|
item.target = GROUP;
|
||||||
addNameItemRow(item, pos);
|
addNameItemRow(item, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLScrollListItem* LLNameListCtrl::addNameItem(LLSD& item, EAddPosition pos)
|
LLScrollListItem* LLNameListCtrl::addNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos)
|
||||||
{
|
{
|
||||||
item["target"] = INDIVIDUAL;
|
item.target = INDIVIDUAL;
|
||||||
return addNameItemRow(item, pos);
|
return addNameItemRow(item, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos, void* userdata)
|
LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata)
|
||||||
{
|
{
|
||||||
return addNameItemRow(value, pos, userdata);
|
LLNameListCtrl::NameItem item_params;
|
||||||
|
LLParamSDParser parser;
|
||||||
|
parser.readSD(element, item_params);
|
||||||
|
item_params.userdata = userdata;
|
||||||
|
return addNameItemRow(item_params, pos);
|
||||||
}
|
}
|
||||||
LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLSD& value, EAddPosition pos, void* userdata)
|
|
||||||
{
|
|
||||||
// Singu Note: ScrollLists don't use "target" or "suffix", for now, just remove them
|
|
||||||
LLSD scroll_value = value;
|
|
||||||
scroll_value.erase("target");
|
|
||||||
scroll_value.erase("suffix");
|
|
||||||
|
|
||||||
LLScrollListItem* item = LLScrollListCtrl::addElement(scroll_value, pos, userdata);
|
|
||||||
|
LLScrollListItem* LLNameListCtrl::addNameItemRow(
|
||||||
|
const LLNameListCtrl::NameItem& name_item,
|
||||||
|
EAddPosition pos,
|
||||||
|
const std::string& suffix)
|
||||||
|
{
|
||||||
|
LLUUID id = name_item.value().asUUID();
|
||||||
|
LLNameListItem* item = new LLNameListItem(name_item,name_item.target() == GROUP);
|
||||||
|
|
||||||
if (!item) return NULL;
|
if (!item) return NULL;
|
||||||
|
|
||||||
LLUUID id = item->getUUID();
|
LLScrollListCtrl::addRow(item, name_item, pos);
|
||||||
|
|
||||||
// use supplied name by default
|
// use supplied name by default
|
||||||
std::string fullname = value["name"].asString();
|
std::string fullname = name_item.name;
|
||||||
switch(value["target"].asInteger())
|
switch(name_item.target)
|
||||||
{
|
{
|
||||||
case GROUP:
|
case GROUP:
|
||||||
gCacheName->getGroupName(id, fullname);
|
gCacheName->getGroupName(id, fullname);
|
||||||
@@ -214,11 +196,14 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLSD& value, EAddPosition
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fullname = " ( " + LLTrans::getString("LoadingData") + " ) ";
|
|
||||||
// ...schedule a callback
|
// ...schedule a callback
|
||||||
LLAvatarNameCache::get(id,
|
// This is not correct and will likely lead to partially populated lists in cases where avatar names are not cached.
|
||||||
boost::bind(&LLNameListCtrl::onAvatarNameCache,
|
// *TODO : Change this to have 2 callbacks : one callback per list item and one for the whole list.
|
||||||
this, _1, _2, item->getHandle()));
|
if (mAvatarNameCacheConnection.connected())
|
||||||
|
{
|
||||||
|
mAvatarNameCacheConnection.disconnect();
|
||||||
|
}
|
||||||
|
mAvatarNameCacheConnection = LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, item->getHandle()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -227,14 +212,13 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLSD& value, EAddPosition
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Append optional suffix.
|
// Append optional suffix.
|
||||||
std::string suffix = value["suffix"];
|
|
||||||
if(!suffix.empty())
|
if(!suffix.empty())
|
||||||
{
|
{
|
||||||
fullname.append(suffix);
|
fullname.append(suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
|
LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
|
||||||
if (cell && !fullname.empty() && cell->getValue().asString().empty())
|
if (cell)
|
||||||
{
|
{
|
||||||
cell->setValue(fullname);
|
cell->setValue(fullname);
|
||||||
}
|
}
|
||||||
@@ -276,15 +260,17 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
|
|||||||
|
|
||||||
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
|
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
|
||||||
const LLAvatarName& av_name,
|
const LLAvatarName& av_name,
|
||||||
LLHandle<LLScrollListItem> item)
|
LLHandle<LLNameListItem> item)
|
||||||
{
|
{
|
||||||
|
mAvatarNameCacheConnection.disconnect();
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
if (mShortNames)
|
if (mShortNames)
|
||||||
name = av_name.mDisplayName;
|
name = av_name.mDisplayName;
|
||||||
else
|
else
|
||||||
name = av_name.getCompleteName();
|
name = av_name.getCompleteName();
|
||||||
|
|
||||||
LLScrollListItem* list_item = item.get();
|
LLNameListItem* list_item = item.get();
|
||||||
if (list_item && list_item->getUUID() == agent_id)
|
if (list_item && list_item->getUUID() == agent_id)
|
||||||
{
|
{
|
||||||
LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
|
LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
|
||||||
@@ -339,13 +325,7 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
|
|||||||
S32 name_column_index = 0;
|
S32 name_column_index = 0;
|
||||||
node->getAttributeS32("name_column_index", name_column_index);
|
node->getAttributeS32("name_column_index", name_column_index);
|
||||||
|
|
||||||
LLNameListCtrl* name_list = new LLNameListCtrl("name_list",
|
LLNameListCtrl* name_list = new LLNameListCtrl("name_list", rect, multi_select, draw_border, draw_heading, name_column_index);
|
||||||
rect,
|
|
||||||
multi_select,
|
|
||||||
draw_border,
|
|
||||||
draw_heading,
|
|
||||||
name_column_index
|
|
||||||
);
|
|
||||||
if (node->hasAttribute("heading_height"))
|
if (node->hasAttribute("heading_height"))
|
||||||
{
|
{
|
||||||
S32 heading_height;
|
S32 heading_height;
|
||||||
@@ -376,7 +356,6 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
|
|||||||
std::string columnname(labelname);
|
std::string columnname(labelname);
|
||||||
child->getAttributeString("name", columnname);
|
child->getAttributeString("name", columnname);
|
||||||
|
|
||||||
|
|
||||||
std::string sortname(columnname);
|
std::string sortname(columnname);
|
||||||
child->getAttributeString("sort", sortname);
|
child->getAttributeString("sort", sortname);
|
||||||
|
|
||||||
@@ -457,6 +436,3 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
|
|||||||
|
|
||||||
return name_list;
|
return name_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file llnamelistctrl.h
|
* @file llnamelistctrl.h
|
||||||
* @brief A list of names, automatically refreshing from the name cache.
|
* @brief A list of names, automatically refreshing from the name cache.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2003-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* to you under the terms of the GNU General Public License, version 2.0
|
|
||||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
|
||||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
|
||||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
|
||||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -39,6 +33,36 @@
|
|||||||
|
|
||||||
class LLAvatarName;
|
class LLAvatarName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LLNameListCtrl item
|
||||||
|
*
|
||||||
|
* We don't use LLScrollListItem to be able to override getUUID(), which is needed
|
||||||
|
* because the name list item value is not simply an UUID but a map (uuid, is_group).
|
||||||
|
*/
|
||||||
|
class LLNameListItem : public LLScrollListItem, public LLHandleProvider<LLNameListItem>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool isGroup() const { return mIsGroup; }
|
||||||
|
void setIsGroup(bool is_group) { mIsGroup = is_group; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class LLNameListCtrl;
|
||||||
|
|
||||||
|
LLNameListItem( const LLScrollListItem::Params& p )
|
||||||
|
: LLScrollListItem(p), mIsGroup(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LLNameListItem( const LLScrollListItem::Params& p, bool is_group )
|
||||||
|
: LLScrollListItem(p), mIsGroup(is_group)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool mIsGroup;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class LLNameListCtrl
|
class LLNameListCtrl
|
||||||
: public LLScrollListCtrl, public LLInstanceTracker<LLNameListCtrl>
|
: public LLScrollListCtrl, public LLInstanceTracker<LLNameListCtrl>
|
||||||
{
|
{
|
||||||
@@ -50,33 +74,61 @@ public:
|
|||||||
SPECIAL
|
SPECIAL
|
||||||
} ENameType;
|
} ENameType;
|
||||||
|
|
||||||
LLNameListCtrl(const std::string& name,
|
// provide names for enums
|
||||||
const LLRect& rect,
|
struct NameTypeNames : public LLInitParam::TypeValuesHelper<LLNameListCtrl::ENameType, NameTypeNames>
|
||||||
BOOL allow_multiple_selection,
|
{
|
||||||
BOOL draw_border = TRUE,
|
static void declareValues();
|
||||||
bool draw_heading = false,
|
};
|
||||||
S32 name_column_index = 0,
|
|
||||||
const std::string& tooltip = LLStringUtil::null);
|
|
||||||
virtual ~LLNameListCtrl();
|
|
||||||
|
|
||||||
|
struct NameItem : public LLInitParam::Block<NameItem, LLScrollListItem::Params>
|
||||||
|
{
|
||||||
|
Optional<std::string> name;
|
||||||
|
Optional<ENameType, NameTypeNames> target;
|
||||||
|
|
||||||
|
NameItem()
|
||||||
|
: name("name"),
|
||||||
|
target("target", INDIVIDUAL)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NameColumn : public LLInitParam::ChoiceBlock<NameColumn>
|
||||||
|
{
|
||||||
|
Alternative<S32> column_index;
|
||||||
|
Alternative<std::string> column_name;
|
||||||
|
NameColumn()
|
||||||
|
: column_name("name_column"),
|
||||||
|
column_index("name_column_index", 0)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
LLNameListCtrl(const std::string& name, const LLRect& rect, BOOL allow_multiple_selection, BOOL draw_border = TRUE, bool draw_heading = false, S32 name_column_index = 0, const std::string& tooltip = LLStringUtil::null);
|
||||||
|
virtual ~LLNameListCtrl()
|
||||||
|
{
|
||||||
|
if (mAvatarNameCacheConnection.connected())
|
||||||
|
{
|
||||||
|
mAvatarNameCacheConnection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
friend class LLUICtrlFactory;
|
||||||
|
public:
|
||||||
virtual LLXMLNodePtr getXML(bool save_children = true) const;
|
virtual LLXMLNodePtr getXML(bool save_children = true) const;
|
||||||
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
|
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
|
||||||
|
|
||||||
// Add a user to the list by name. It will be added, the name
|
// Add a user to the list by name. It will be added, the name
|
||||||
// requested from the cache, and updated as necessary.
|
// requested from the cache, and updated as necessary.
|
||||||
LLScrollListItem* addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM,
|
LLScrollListItem* addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM,
|
||||||
BOOL enabled = TRUE, std::string const& suffix = LLStringUtil::null);
|
BOOL enabled = TRUE, const std::string& suffix = LLStringUtil::null);
|
||||||
LLScrollListItem* addNameItem(LLSD& item, EAddPosition pos = ADD_BOTTOM);
|
LLScrollListItem* addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
|
||||||
|
|
||||||
/*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
|
/*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
|
||||||
LLScrollListItem* addNameItemRow(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
|
LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM, const std::string& suffix = LLStringUtil::null);
|
||||||
|
|
||||||
// Add a user to the list by name. It will be added, the name
|
// Add a user to the list by name. It will be added, the name
|
||||||
// requested from the cache, and updated as necessary.
|
// requested from the cache, and updated as necessary.
|
||||||
void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM,
|
void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM,
|
||||||
BOOL enabled = TRUE);
|
BOOL enabled = TRUE);
|
||||||
|
void addGroupNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
|
||||||
void addGroupNameItem(LLSD& item, EAddPosition pos = ADD_BOTTOM);
|
|
||||||
|
|
||||||
|
|
||||||
void removeNameItem(const LLUUID& agent_id);
|
void removeNameItem(const LLUUID& agent_id);
|
||||||
@@ -91,11 +143,14 @@ public:
|
|||||||
|
|
||||||
void sortByName(BOOL ascending);
|
void sortByName(BOOL ascending);
|
||||||
private:
|
private:
|
||||||
static std::set<LLNameListCtrl*> sInstances;
|
void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, LLHandle<LLNameListItem> item);
|
||||||
void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, LLHandle<LLScrollListItem> item);
|
|
||||||
|
private:
|
||||||
S32 mNameColumnIndex;
|
S32 mNameColumnIndex;
|
||||||
BOOL mAllowCallingCardDrop;
|
BOOL mAllowCallingCardDrop;
|
||||||
bool mShortNames; // display name only, no SLID
|
bool mShortNames; // display name only, no SLID
|
||||||
|
boost::signals2::connection mAvatarNameCacheConnection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,11 +34,8 @@
|
|||||||
|
|
||||||
#include "llpanelgroupgeneral.h"
|
#include "llpanelgroupgeneral.h"
|
||||||
|
|
||||||
#include "lluictrlfactory.h"
|
|
||||||
#include "llagent.h"
|
#include "llagent.h"
|
||||||
#include "llavataractions.h"
|
#include "lluictrlfactory.h"
|
||||||
#include "llfloatergroups.h"
|
|
||||||
#include "llgroupactions.h"
|
|
||||||
#include "roles_constants.h"
|
#include "roles_constants.h"
|
||||||
|
|
||||||
// UI elements
|
// UI elements
|
||||||
@@ -46,6 +43,8 @@
|
|||||||
#include "llcheckboxctrl.h"
|
#include "llcheckboxctrl.h"
|
||||||
#include "llcombobox.h"
|
#include "llcombobox.h"
|
||||||
#include "lldbstrings.h"
|
#include "lldbstrings.h"
|
||||||
|
#include "llavataractions.h"
|
||||||
|
#include "llgroupactions.h"
|
||||||
#include "llimview.h"
|
#include "llimview.h"
|
||||||
#include "lllineeditor.h"
|
#include "lllineeditor.h"
|
||||||
#include "llnamebox.h"
|
#include "llnamebox.h"
|
||||||
@@ -837,23 +836,17 @@ void LLPanelGroupGeneral::addMember(LLGroupMemberData* member)
|
|||||||
{
|
{
|
||||||
style = "BOLD";
|
style = "BOLD";
|
||||||
}
|
}
|
||||||
LLSD row;
|
LLNameListCtrl::NameItem item_params;
|
||||||
row["id"] = member->getID();
|
item_params.value = member->getID();
|
||||||
|
|
||||||
row["columns"][0]["column"] = "name";
|
LLScrollListCell::Params column;
|
||||||
row["columns"][0]["font-style"] = style;
|
item_params.columns.add().column("name").font/*.name*/("SANSSERIF_SMALL").font_style(style);
|
||||||
row["columns"][0]["font"] = "SANSSERIF_SMALL";
|
|
||||||
row["columns"][1]["column"] = "title";
|
|
||||||
row["columns"][1]["value"] = member->getTitle();
|
|
||||||
row["columns"][1]["font-style"] = style;
|
|
||||||
row["columns"][1]["font"] = "SANSSERIF_SMALL";
|
|
||||||
|
|
||||||
row["columns"][2]["column"] = "online";
|
item_params.columns.add().column("title").value(member->getTitle()).font/*.name*/("SANSSERIF_SMALL").font_style(style);
|
||||||
row["columns"][2]["value"] = member->getOnlineStatus();
|
|
||||||
row["columns"][2]["font-style"] = style;
|
|
||||||
row["columns"][1]["font"] = "SANSSERIF_SMALL";
|
|
||||||
|
|
||||||
mListVisibleMembers->addNameItemRow(row);
|
item_params.columns.add().column("online").value(member->getOnlineStatus()).font/*.name*/("SANSSERIF_SMALL").font_style(style);
|
||||||
|
|
||||||
|
/*LLScrollListItem* member_row =*/ mListVisibleMembers->addNameItemRow(item_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name)
|
void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name)
|
||||||
|
|||||||
@@ -1528,19 +1528,17 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data)
|
|||||||
LLUIString donated = getString("donation_area");
|
LLUIString donated = getString("donation_area");
|
||||||
donated.setArg("[AREA]", llformat("%d", data->getContribution()));
|
donated.setArg("[AREA]", llformat("%d", data->getContribution()));
|
||||||
|
|
||||||
LLSD row;
|
LLNameListCtrl::NameItem item_params;
|
||||||
row["id"] = data->getID();
|
item_params.value = data->getID();
|
||||||
|
|
||||||
row["columns"][0]["column"] = "name";
|
item_params.columns.add().column("name").font/*.name*/("SANSSERIF_SMALL")/*.style("NORMAL")*/;
|
||||||
row["columns"][0]["font"] = "SANSSERIF_SMALL";
|
|
||||||
|
|
||||||
row["columns"][1]["column"] = "donated";
|
item_params.columns.add().column("donated").value(donated.getString())
|
||||||
row["columns"][1]["value"] = donated.getString();
|
.font/*.name*/("SANSSERIF_SMALL")/*.style("NORMAL")*/;
|
||||||
|
|
||||||
row["columns"][2]["column"] = "online";
|
item_params.columns.add().column("online").value(data->getOnlineStatus())
|
||||||
row["columns"][2]["value"] = data->getOnlineStatus();
|
.font/*.name*/("SANSSERIF_SMALL")/*.style("NORMAL")*/;
|
||||||
row["columns"][2]["font"] = "SANSSERIF_SMALL";
|
mMembersList->addNameItemRow(item_params);
|
||||||
mMembersList->addNameItemRow(row);
|
|
||||||
|
|
||||||
mHasMatch = TRUE;
|
mHasMatch = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1976,7 +1976,9 @@ Where tag = tag string to match. Removes bot's matching the tag.
|
|||||||
keine
|
keine
|
||||||
</string>
|
</string>
|
||||||
<string name="Unknown">(unbekannt)</string>
|
<string name="Unknown">(unbekannt)</string>
|
||||||
|
<string name="NoGroupDataFound">
|
||||||
|
Für Gruppe wurden keine Gruppendaten gefunden
|
||||||
|
</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user