Let's do participants lists treating them as actual name lists

Adding items to these lists should be somewhat faster now, and that's good
because we usually add a bunch at a time with large groups.
This commit is contained in:
Liru Færs
2019-10-14 22:00:04 -04:00
parent 2b955eb00d
commit 610d592f5a
2 changed files with 21 additions and 26 deletions

View File

@@ -30,8 +30,7 @@
#include "llagent.h" #include "llagent.h"
#include "llmutelist.h" #include "llmutelist.h"
#include "llparticipantlist.h" #include "llparticipantlist.h"
#include "llscrolllistctrl.h" #include "llnamelistctrl.h"
#include "llscrolllistitem.h"
#include "llspeakers.h" #include "llspeakers.h"
#include "lluictrlfactory.h" // Edit: For menu duality #include "lluictrlfactory.h" // Edit: For menu duality
#include "llviewermenu.h" // Edit: For menu duality #include "llviewermenu.h" // Edit: For menu duality
@@ -45,7 +44,7 @@
LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source,
bool show_text_chatters) : bool show_text_chatters) :
mSpeakerMgr(data_source), mSpeakerMgr(data_source),
mAvatarList(NULL), mAvatarList(nullptr),
mShowTextChatters(show_text_chatters), mShowTextChatters(show_text_chatters),
mValidateSpeakerCallback(NULL) mValidateSpeakerCallback(NULL)
{ {
@@ -84,7 +83,7 @@ void LLParticipantList::setupContextMenu()
BOOL LLParticipantList::postBuild() BOOL LLParticipantList::postBuild()
{ {
mAvatarList = getChild<LLScrollListCtrl>("speakers_list"); mAvatarList = getChild<LLNameListCtrl>("speakers_list");
mAvatarList->sortByColumn(gSavedSettings.getString("FloaterActiveSpeakersSortColumn"), gSavedSettings.getBOOL("FloaterActiveSpeakersSortAscending")); mAvatarList->sortByColumn(gSavedSettings.getString("FloaterActiveSpeakersSortColumn"), gSavedSettings.getBOOL("FloaterActiveSpeakersSortAscending"));
mAvatarList->setDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this)); mAvatarList->setDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this));
@@ -322,13 +321,15 @@ void LLParticipantList::refreshSpeakers()
{ {
// <edit> // <edit>
bool found = mShowTextChatters || speakerp->mID == gAgentID; bool found = mShowTextChatters || speakerp->mID == gAgentID;
const LLWorld::region_list_t& regions = LLWorld::getInstance()->getRegionList(); if (!found)
for (LLWorld::region_list_t::const_iterator iter = regions.begin(); !found && iter != regions.end(); ++iter) for (const LLViewerRegion* regionp : LLWorld::getInstance()->getRegionList())
{ {
// Are they in this sim? // Are they in this sim?
if (const LLViewerRegion* regionp = *iter) if (std::find(regionp->mMapAvatarIDs.begin(), regionp->mMapAvatarIDs.end(), speakerp->mID) != regionp->mMapAvatarIDs.end())
if (std::find(regionp->mMapAvatarIDs.begin(), regionp->mMapAvatarIDs.end(), speakerp->mID) != regionp->mMapAvatarIDs.end()) {
found = true; found = true;
break;
}
} }
if (!found) if (!found)
{ {
@@ -349,7 +350,7 @@ void LLParticipantList::refreshSpeakers()
{ {
std::string speaker_name = speakerp->mDisplayName.empty() ? LLCacheName::getDefaultName() : speakerp->mDisplayName; std::string speaker_name = speakerp->mDisplayName.empty() ? LLCacheName::getDefaultName() : speakerp->mDisplayName;
if (speakerp->mIsModerator) if (speakerp->mIsModerator)
speaker_name += " " + getString("moderator_label"); speaker_name += ' ' + getString("moderator_label");
if (name_cell->getValue().asString() != speaker_name) if (name_cell->getValue().asString() != speaker_name)
{ {
re_sort = true; re_sort = true;
@@ -486,22 +487,16 @@ void LLParticipantList::adjustParticipant(const LLUUID& speaker_id)
LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(speaker_id); LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(speaker_id);
if (speakerp.isNull()) return; if (speakerp.isNull()) return;
LLSD row; LLNameListItem::Params name_item;
row["id"] = speaker_id; name_item.value = speaker_id;
LLSD& columns = row["columns"]; name_item.columns.add(LLScrollListCell::Params().column("icon_speaking_status").type("icon").value("icn_active-speakers-dot-lvl0.tga"));
columns[0]["column"] = "icon_speaking_status";
columns[0]["type"] = "icon";
columns[0]["value"] = "icn_active-speakers-dot-lvl0.tga";
const std::string& display_name = LLVoiceClient::getInstance()->getDisplayName(speaker_id); const std::string& display_name = LLVoiceClient::getInstance()->getDisplayName(speaker_id);
columns[1]["column"] = "speaker_name"; name_item.name = display_name;
columns[1]["type"] = "text"; name_item.columns.add(LLScrollListCell::Params().column("speaker_name").type("text").value(display_name));
columns[1]["value"] = display_name.empty() ? LLCacheName::getDefaultName() : display_name; name_item.columns.add(LLScrollListCell::Params().column("speaking_status").type("text")
.value(llformat("%010d", speakerp->mSortIndex))); // print speaking ordinal in a text-sorting friendly manner
columns[2]["column"] = "speaking_status"; mAvatarList->addNameItemRow(name_item);
columns[2]["type"] = "text";
columns[2]["value"] = llformat("%010d", speakerp->mSortIndex); // print speaking ordinal in a text-sorting friendly manner
mAvatarList->addElement(row);
// add listener to process moderation changes // add listener to process moderation changes
speakerp->addListener(mSpeakerMuteListener); speakerp->addListener(mSpeakerMuteListener);

View File

@@ -30,7 +30,7 @@
#include "lllayoutstack.h" #include "lllayoutstack.h"
class LLSpeakerMgr; class LLSpeakerMgr;
class LLScrollListCtrl; class LLNameListCtrl;
class LLUICtrl; class LLUICtrl;
class LLParticipantList : public LLLayoutPanel class LLParticipantList : public LLLayoutPanel
@@ -219,7 +219,7 @@ private:
void onVolumeChange(const LLSD& param); void onVolumeChange(const LLSD& param);
LLSpeakerMgr* mSpeakerMgr; LLSpeakerMgr* mSpeakerMgr;
LLScrollListCtrl* mAvatarList; LLNameListCtrl* mAvatarList;
bool mShowTextChatters; bool mShowTextChatters;
LLFrameTimer mUpdateTimer; LLFrameTimer mUpdateTimer;