// public void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) { //llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " " // << last << "'" << llendl; std::string fullname; if (!is_group) { fullname = first + " " + last; } else { fullname = first; } // TODO: scan items for that ID, fix if necessary item_list::iterator iter; for (iter = getItemList().begin(); iter != getItemList().end(); iter++) { LLScrollListItem* item = *iter; if (item->getUUID() == id) { LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(0); cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); ((LLScrollListText*)cell)->setText( fullname ); } } dirtyColumns(); }
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, std::string suffix, LLHandle<LLNameListItem> item) { avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); if (it != mAvatarNameCacheConnections.end()) { if (it->second.connected()) { it->second.disconnect(); } mAvatarNameCacheConnections.erase(it); } std::string name; if (mShortNames) name = av_name.getDisplayName(); else name = av_name.getCompleteName(); // Append optional suffix. if (!suffix.empty()) { name.append(suffix); } LLNameListItem* list_item = item.get(); if (list_item && list_item->getUUID() == agent_id) { LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex); if (cell) { cell->setValue(name); setNeedsSort(); } } ////////////////////////////////////////////////////////////////////////// // BAKER - FIX NameListCtrl //if (mPendingLookupsRemaining <= 0) { // We might get into a state where mPendingLookupsRemaining might // go negative. So just reset it right now and figure out if it's // possible later :) //mPendingLookupsRemaining = 0; mNameListCompleteSignal(true); } //else { // mPendingLookupsRemaining--; } ////////////////////////////////////////////////////////////////////////// dirtyColumns(); }
LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos, void* userdata) { LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata); // use supplied name by default std::string fullname = value["name"].asString(); if (value["target"].asString() == "GROUP") { gCacheName->getGroupName(item->getUUID(), fullname); // fullname will be "nobody" if group not found } else if (value["target"].asString() == "SPECIAL") { // just use supplied name } else // normal resident { std::string name; if (gCacheName->getFullName(item->getUUID(), name)) { fullname = name; } } LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); ((LLScrollListText*)cell)->setText( fullname ); dirtyColumns(); // this column is resizable LLScrollListColumn* columnp = getColumn(mNameColumnIndex); if (columnp && columnp->mHeader) { columnp->mHeader->setHasResizableElement(TRUE); } return item; }
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, LLHandle<LLScrollListItem> item) { std::string name; if (mShortNames) name = av_name.mDisplayName; else name = av_name.getCompleteName(); LLScrollListItem* list_item = item.get(); if (list_item && list_item->getUUID() == agent_id) { LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex); if (cell) { cell->setValue(name); setNeedsSort(); } } dirtyColumns(); }
LLScrollListItem* LLNameListCtrl::addNameItemRow( const LLNameListCtrl::NameItem& name_item, EAddPosition pos, const std::string& suffix) { LLUUID id = name_item.value().asUUID(); LLNameListItem* item = NULL; // Store item type so that we can invoke the proper inspector. // *TODO Vadim: Is there a more proper way of storing additional item data? { LLNameListCtrl::NameItem item_p(name_item); item_p.value = LLSD().with("uuid", id).with("is_group", name_item.target() == GROUP); item = new LLNameListItem(item_p); LLScrollListCtrl::addRow(item, item_p, pos); } if (!item) return NULL; // use supplied name by default std::string fullname = name_item.name; switch(name_item.target) { case GROUP: gCacheName->getGroupName(id, fullname); // fullname will be "nobody" if group not found break; case SPECIAL: // just use supplied name break; case INDIVIDUAL: { LLAvatarName av_name; if (id.isNull()) { fullname = LLTrans::getString("AvatarNameNobody"); } else if (LLAvatarNameCache::get(id, &av_name)) { if (mShortNames) fullname = av_name.mDisplayName; else fullname = av_name.getCompleteName(); } else { // ...schedule a callback // LLAvatarNameCache::get(id, // boost::bind(&LLNameListCtrl::onAvatarNameCache, // this, _1, _2)); // [SL:KB] - Patch: UI-GroupPanel | Checked: 2011-05-30 (Catznip-2.6.0a) | Added: Catznip-2.6.0a LLAvatarNameCache::get(id, boost::bind(&LLNameListItem::onAvatarNameCache, item, mNameColumnIndex, mShortNames, _1, _2)); // [/SL:KB] } break; } default: break; } // Append optional suffix. if (!suffix.empty()) { fullname.append(suffix); } LLScrollListCell* cell = item->getColumn(mNameColumnIndex); if (cell) { cell->setValue(fullname); } dirtyColumns(); // this column is resizable LLScrollListColumn* columnp = getColumn(mNameColumnIndex); if (columnp && columnp->mHeader) { columnp->mHeader->setHasResizableElement(TRUE); } return item; }
LLScrollListItem* LLNameListCtrl::addNameItemRow( const LLNameListCtrl::NameItem& name_item, EAddPosition pos, std::string& suffix) { LLUUID id = name_item.value().asUUID(); LLNameListItem* item = NULL; // Store item type so that we can invoke the proper inspector. // *TODO Vadim: Is there a more proper way of storing additional item data? { LLNameListCtrl::NameItem item_p(name_item); item_p.value = LLSD().with("uuid", id).with("is_group", name_item.target() == GROUP); item = new LLNameListItem(item_p); LLScrollListCtrl::addRow(item, item_p, pos); } if (!item) return NULL; // use supplied name by default std::string fullname = name_item.name; switch(name_item.target) { case GROUP: gCacheName->getGroupName(id, fullname); // fullname will be "nobody" if group not found break; case SPECIAL: // just use supplied name break; case INDIVIDUAL: { std::string name; if (gCacheName->getFullName(id, name)) { fullname = name; } break; } default: break; } // Append optional suffix. if (!suffix.empty()) { fullname.append(suffix); } LLScrollListCell* cell = item->getColumn(mNameColumnIndex); if (cell) { cell->setValue(fullname); } dirtyColumns(); // this column is resizable LLScrollListColumn* columnp = getColumn(mNameColumnIndex); if (columnp && columnp->mHeader) { columnp->mHeader->setHasResizableElement(TRUE); } return item; }
LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLSD& value, EAddPosition pos, void* userdata) { LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata); if (!item) return NULL; LLUUID id = item->getUUID(); // use supplied name by default std::string fullname = value["name"].asString(); switch(value["target"].asInteger()) { case GROUP: gCacheName->getGroupName(id, fullname); // fullname will be "nobody" if group not found break; case SPECIAL: // just use supplied name break; case INDIVIDUAL: { LLAvatarName av_name; if (id.isNull()) { fullname = LLTrans::getString("AvatarNameNobody"); } else if (LLAvatarNameCache::get(id, &av_name)) { if (mShortNames) fullname = av_name.mDisplayName; else fullname = av_name.getCompleteName(); } else { fullname = " ( " + LLTrans::getString("LoadingData") + " ) "; // ...schedule a callback LLAvatarNameCache::get(id, boost::bind(&LLNameListCtrl::onAvatarNameCache, this, _1, _2, item->getHandle())); } break; } default: break; } // Append optional suffix. std::string suffix = value["suffix"]; if(!suffix.empty()) { fullname.append(suffix); } LLScrollListCell* cell = item->getColumn(mNameColumnIndex); if (cell && !fullname.empty() && cell->getValue().asString().empty()) { cell->setValue(fullname); } dirtyColumns(); // this column is resizable LLScrollListColumn* columnp = getColumn(mNameColumnIndex); if (columnp && columnp->mHeader) { columnp->mHeader->setHasResizableElement(TRUE); } return item; }
LLScrollListItem* LLNameListCtrl::addNameItemRow( const LLNameListCtrl::NameItem& name_item, EAddPosition pos, const std::string& suffix, const std::string& prefix) { LLUUID id = name_item.value().asUUID(); LLNameListItem* item = new LLNameListItem(name_item,name_item.target() == GROUP, name_item.target() == EXPERIENCE); if (!item) return NULL; LLScrollListCtrl::addRow(item, name_item, pos); // use supplied name by default std::string fullname = name_item.name; switch(name_item.target) { case GROUP: gCacheName->getGroupName(id, fullname); // fullname will be "nobody" if group not found break; case SPECIAL: // just use supplied name break; case INDIVIDUAL: { LLAvatarName av_name; if (id.isNull()) { fullname = LLTrans::getString("AvatarNameNobody"); } else if (LLAvatarNameCache::get(id, &av_name)) { if (mShortNames) fullname = av_name.getDisplayName(); else fullname = av_name.getCompleteName(); } else { // ...schedule a callback avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); if (it != mAvatarNameCacheConnections.end()) { if (it->second.connected()) { it->second.disconnect(); } mAvatarNameCacheConnections.erase(it); } mAvatarNameCacheConnections[id] = LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, suffix, item->getHandle())); if(mPendingLookupsRemaining <= 0) { // BAKER TODO: // We might get into a state where mPendingLookupsRemaining might // go negative. So just reset it right now and figure out if it's // possible later :) mPendingLookupsRemaining = 0; mNameListCompleteSignal(false); } mPendingLookupsRemaining++; } break; } case EXPERIENCE: // just use supplied name default: break; } // Append optional suffix. if (!suffix.empty()) { fullname.append(suffix); } LLScrollListCell* cell = item->getColumn(mNameColumnIndex); if (cell) { cell->setValue(prefix + fullname); } dirtyColumns(); // this column is resizable LLScrollListColumn* columnp = getColumn(mNameColumnIndex); if (columnp && columnp->mHeader) { columnp->mHeader->setHasResizableElement(TRUE); } return item; }