// 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(); }
// Update controls based on current settings void LLPrefsAscentVan::refresh() { //General -------------------------------------------------------------------------------- //Tags\Colors ---------------------------------------------------------------------------- //Colors --------------------------------------------------------------------------------- LLComboBox* combo = getChild<LLComboBox>("tag_spoofing_combobox"); if(LLVOAvatar::sClientResolutionList.has("isComplete")) { //combo->setColor(LLColor4::black); combo->clear(); for(LLSD::map_iterator itr = LLVOAvatar::sClientResolutionList.beginMap(); itr != LLVOAvatar::sClientResolutionList.endMap(); itr++) { LLSD value = (*itr).second; if(value.has("name")) { std::string name = value.get("name"); std::string uuid = (*itr).first; LLColor4 color = LLColor4(value.get("color")); if(value["multiple"].asReal() != 0) { color *= 1.0/(value["multiple"].asReal()+1.0f); } LLScrollListItem* item = combo->add(name,uuid); //bad practice item->getColumn(0)->setColor(color); } } //add Viewer 2.0 LLScrollListItem* item = combo->add("Viewer 2.0",IMG_DEFAULT_AVATAR); //bad practice item->getColumn(0)->setColor(LLColor4::black); } combo->setCurrentByIndex(mSelectedClient); childSetEnabled("friends_color_textbox", mUseStatusColors); childSetEnabled("friend_color_swatch", mUseStatusColors); childSetEnabled("estate_owner_color_swatch", mUseStatusColors); childSetEnabled("linden_color_swatch", mUseStatusColors); childSetEnabled("muted_color_swatch", mUseStatusColors); childSetEnabled("custom_tag_label_text", mCustomTagOn); childSetEnabled("custom_tag_label_box", mCustomTagOn); childSetValue("custom_tag_label_box", gSavedSettings.getString("AscentCustomTagLabel")); childSetEnabled("custom_tag_color_text", mCustomTagOn); childSetEnabled("custom_tag_color_swatch", mCustomTagOn); //Body Dynamics -------------------------------------------------------------------------- childSetEnabled("EmeraldBoobMass", mBreastPhysicsToggle); childSetEnabled("EmeraldBoobHardness", mBreastPhysicsToggle); childSetEnabled("EmeraldBoobVelMax", mBreastPhysicsToggle); childSetEnabled("EmeraldBoobFriction", mBreastPhysicsToggle); childSetEnabled("EmeraldBoobVelMin", mBreastPhysicsToggle); }
// propagate actual relationship to UI. // Does not resort the UI list because it can be called frequently. JC BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info) { if (!info) return FALSE; LLScrollListItem* itemp = mFriendsList->getItem(agent_id); if (!itemp) return FALSE; bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(itemp->getUUID()); bool isOnline = info->isOnline(); std::string fullname; bool have_name = LLAvatarNameCache::getPNSName(agent_id, fullname, friend_name_system()); if (!have_name) gCacheName->getFullName(agent_id, fullname); // Name of the status icon to use std::string statusIcon; if(isOnline) { mNumOnline++; statusIcon = "icon_avatar_online.tga"; } else if(isOnlineSIP) { mNumOnline++; statusIcon = ONLINE_SIP_ICON_NAME; } else { mNumOnline--; } itemp->getColumn(LIST_ONLINE_STATUS)->setValue(statusIcon); itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text ((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle((isOnline || isOnlineSIP) ? LLFontGL::BOLD : LLFontGL::NORMAL); itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)); //Notes in the original code imply this may not always work. Good to know. -HgB itemp->getColumn(LIST_VISIBLE_ONLINE_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS)); S32 change_generation = have_name ? info->getChangeSerialNum() : -1; itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(change_generation); // enable this item, in case it was disabled after user input itemp->setEnabled(TRUE); mFriendsList->setNeedsSort(); // Do not resort, this function can be called frequently. return have_name; }
void JCFloaterAnimList::RevokeSelected(void *userdata ) { JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; LLDynamicArray<LLUUID> ids; std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected(); for( std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); itr++ ) { LLScrollListItem *item = *itr; const LLUUID &id = item->getColumn(LIST_OBJECT_UUID)->getValue().asUUID(); if( ids.find(id) == LLDynamicArray<LLUUID>::FAIL ) { ids.put(id); } } if( !ids.empty() ) { for(LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr) { LLUUID id = *itr; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RevokePermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Data); msg->addUUIDFast(_PREHASH_ObjectID, id); msg->addU32Fast(_PREHASH_ObjectPermissions, U32_MAX); gAgent.sendReliableMessage(); } } }
void LLFloaterHUD::onList(LLUICtrl* ctrl, void* userdata) { LLFloaterHUD* self = (LLFloaterHUD*)userdata; if (!self) { return; } self->mAvatarIDs.clear(); self->mAvatarNames.clear(); if (!self->mListNames) { return; } std::vector<LLScrollListItem*> items = self->mListNames->getAllSelected(); for ( std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter) { LLScrollListItem* item = *iter; self->mAvatarNames.push_back(item->getColumn(0)->getValue().asString()); self->mAvatarIDs.push_back(item->getUUID()); self->childSetEnabled("Select", TRUE); } }
// virtual LLXMLNodePtr LLComboBox::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_COMBO_BOX_TAG); // Attributes node->createChild("allow_text_entry", TRUE)->setBoolValue(mAllowTextEntry); node->createChild("max_chars", TRUE)->setIntValue(mMaxChars); // Contents std::vector<LLScrollListItem*> data_list = mList->getAllData(); std::vector<LLScrollListItem*>::iterator data_itor; for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor) { LLScrollListItem* item = *data_itor; LLScrollListCell* cell = item->getColumn(0); if (cell) { LLXMLNodePtr item_node = node->createChild("combo_item", FALSE); LLSD value = item->getValue(); item_node->createChild("value", TRUE)->setStringValue(value.asString()); item_node->createChild("enabled", TRUE)->setBoolValue(item->getEnabled()); item_node->setStringValue(cell->getValue().asString()); } } return node; }
void LLFloaterNewIM::onStart(void* userdata) { LLFloaterNewIM* self = (LLFloaterNewIM*) userdata; LLScrollListItem* item = self->mSelectionList->getFirstSelected(); if(item) { const LLScrollListCell* cell = item->getColumn(0); std::string name(cell->getValue()); // *NOTE: Do a live detrmination of what type of session it // should be. If we restrict the new im panel to online users, // then we can remove some of this code. EInstantMessage type; EInstantMessage* t = (EInstantMessage*)item->getUserdata(); if(t) type = (*t); else type = LLIMMgr::defaultIMTypeForAgent(item->getUUID()); gIMMgr->addSession(name, type, item->getUUID()); make_ui_sound("UISndStartIM"); } else { make_ui_sound("UISndInvalidOp"); } }
// callback from the name cache with an owner name to add to the list void LLPanelScriptLimitsRegionMemory::onNameCache( const LLUUID& id, const std::string& first_name, const std::string& last_name) { std::string name = first_name + " " + last_name; LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list"); if(!list) { return; } std::vector<LLSD>::iterator id_itor; for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor) { LLSD element = *id_itor; if(element["owner_id"].asUUID() == id) { LLScrollListItem* item = list->getItem(element["id"].asUUID()); if(item) { item->getColumn(3)->setValue(LLSD(name)); element["columns"][3]["value"] = name; } } } }
// static void HBFloaterGroupTitles::onActivate(void* userdata) { HBFloaterGroupTitles* self = (HBFloaterGroupTitles*) userdata; LLScrollListItem *item = self->mTitlesList->getFirstSelected(); if (!item) return; // Set the group if needed. LLUUID old_group_id = gAgent.getGroupID(); LLUUID group_id = item->getColumn(LIST_GROUP_ID)->getValue().asUUID(); if (group_id != old_group_id) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ActivateGroup); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addUUIDFast(_PREHASH_GroupID, group_id); gAgent.sendReliableMessage(); } // Set the title LLGroupMgr::getInstance()->sendGroupTitleUpdate(group_id, item->getUUID()); // Force a refresh via the observer if (group_id == LLUUID::null) { group_id = old_group_id; } LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id); }
void LLFloaterTopObjects::updateSelectionInfo() { LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list"); if (!list) return; LLUUID object_id = list->getCurrentID(); if (object_id.isNull()) return; std::string object_id_string = object_id.asString(); getChild<LLUICtrl>("id_editor")->setValue(LLSD(object_id_string)); LLScrollListItem* sli = list->getFirstSelected(); llassert(sli); if (sli) { getChild<LLUICtrl>("object_name_editor")->setValue(sli->getColumn(1)->getValue().asString()); getChild<LLUICtrl>("owner_name_editor")->setValue(sli->getColumn(2)->getValue().asString()); } }
// propagate actual relationship to UI. // Does not resort the UI list because it can be called frequently. JC BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info) { if (!info) return FALSE; LLScrollListItem* itemp = mFriendsList->getItem(agent_id); if (!itemp) return FALSE; std::string fullname; BOOL have_name = gCacheName->getFullName(agent_id, fullname); itemp->getColumn(LIST_ONLINE_STATUS)->setValue(info->isOnline() ? std::string("icon_avatar_online.tga") : LLStringUtil::null); itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text ((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle(info->isOnline() ? LLFontGL::BOLD : LLFontGL::NORMAL); itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)); S32 change_generation = have_name ? info->getChangeSerialNum() : -1; itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(change_generation); // enable this item, in case it was disabled after user input itemp->setEnabled(TRUE); // Do not resort, this function can be called frequently. return have_name; }
static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, std::vector<LLUUID>& avatar_ids) { std::vector<LLScrollListItem*> items = from->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter) { LLScrollListItem* item = *iter; if (item->getUUID().notNull()) { avatar_names.push_back(item->getColumn(0)->getValue().asString()); avatar_ids.push_back(item->getUUID()); } } }
// propagate actual relationship to UI. // Does not resort the UI list because it can be called frequently. JC BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info) { if (!info) return FALSE; LLScrollListItem* itemp = mFriendsList->getItem(agent_id); if (!itemp) return FALSE; bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(itemp->getUUID()); bool isOnline = info->isOnline(); std::string fullname; BOOL have_name = gCacheName->getFullName(agent_id, fullname); if (have_name) { if (LLAvatarNameCache::useDisplayNames() && !gSavedSettings.getBOOL("LegacyNamesForFriends")) { LLAvatarName avatar_name; if (LLAvatarNameCache::get(agent_id, &avatar_name)) { if (LLAvatarNameCache::useDisplayNames() == 2) { fullname = avatar_name.mDisplayName; } else { fullname = avatar_name.getNames(); } } } } // Name of the status icon to use std::string statusIcon; if(isOnline) { statusIcon = "icon_avatar_online.tga"; } else if(isOnlineSIP) { statusIcon = ONLINE_SIP_ICON_NAME; } itemp->getColumn(LIST_ONLINE_STATUS)->setValue(statusIcon); itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text ((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle((isOnline || isOnlineSIP) ? LLFontGL::BOLD : LLFontGL::NORMAL); itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)); S32 change_generation = have_name ? info->getChangeSerialNum() : -1; itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(change_generation); // enable this item, in case it was disabled after user input itemp->setEnabled(TRUE); // Do not resort, this function can be called frequently. return have_name; }
void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index ) { S32 cur_index = getHighlightedItemInx(); if (cur_index != target_index) { if(0 <= cur_index && cur_index < (S32)getItemList().size()) { LLScrollListItem* item = getItemList()[cur_index]; LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex)); if(cell) cell->setTextWidth(cell->getTextWidth() + info_icon_size); } if(target_index != -1) { LLScrollListItem* item = getItemList()[target_index]; LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex)); if(cell) cell->setTextWidth(cell->getTextWidth() - info_icon_size); } } LLScrollListCtrl::mouseOverHighlightNthItem(target_index); }
void LLPanelGroups::onGroupList() { enableButtons(); LLScrollListCtrl *group_list = getChild<LLScrollListCtrl>("group list"); if(!group_list) return; LLScrollListItem *item = group_list->getFirstSelected(); if(!item) return; const LLUUID group_id = item->getValue().asUUID(); if(group_id.isNull()) return; LLGroupData group_data; if(!gAgent.getGroupData(group_id,group_data)) return; bool list_in_profile = item->getColumn(1)->getValue().asBoolean(); bool receive_chat = item->getColumn(2)->getValue().asBoolean(); bool recieve_notify = item->getColumn(3)->getValue().asBoolean(); bool update_floaters = false; if(gIMMgr->getIgnoreGroup(group_id) == receive_chat) { gIMMgr->updateIgnoreGroup(group_id, !receive_chat); update_floaters = true; } if( (bool)group_data.mListInProfile != list_in_profile || (bool)group_data.mAcceptNotices != recieve_notify ) { gAgent.setUserGroupFlags(group_id, recieve_notify, list_in_profile); } else if(update_floaters) //gAgent.setUserGroupFlags already calls update_group_floaters update_group_floaters(group_id); }
void JCFloaterAnimList::OpenProfile(void *userdata ) { JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected(); if(!items.empty()) { //LLVOAvatar* avatarp = gAgent.getAvatarObject(); for(std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); ++itr) { LLScrollListItem *item = *itr; const LLUUID &object_id = item->getColumn(LIST_OBJECT_UUID)->getValue().asUUID(); LLFloaterAvatarInfo::showFromDirectory(self->mObjectOwners[object_id].owner_id); } } }
// static void LLFloaterBlacklist::onClickRemove(void* user_data) { LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data; LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list"); if(list->getFirstSelected()) { LLScrollListItem* item = list->getFirstSelected(); LLUUID selected_id = item->getColumn(0)->getValue().asUUID(); if(selected_id.isNull()) return; list->deleteSingleItem(list->getFirstSelectedIndex()); blacklist_entries.erase(selected_id); updateBlacklists(); } }
void JCFloaterAnimList::StopSelected(void *userdata ) { JCFloaterAnimList *self = (JCFloaterAnimList*)userdata; LLDynamicArray<LLUUID> ids; std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected(); for( std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); itr++ ) { LLScrollListItem *item = *itr; const LLUUID &id = item->getColumn(LIST_ANIMATION_UUID)->getValue().asUUID(); if( ids.find(id) == LLDynamicArray<LLUUID>::FAIL ) { ids.put(id); } } gAgent.sendAnimationRequests(ids,ANIM_REQUEST_STOP); }
//static void LLPanelGroupVoting::impl::onClickViewHistoryItem(void *userdata) { impl* self = (impl*)userdata; if ( self && self->mVotesHistory ) { LLScrollListItem * historic = self->mVotesHistory->getFirstSelected(); // Check if it has anything in column 2. If not, assume it's the "There are currently no active proposals" text if (historic && historic->getColumn(2)) { self->setEnableHistoryItem(); } else { gViewerWindow->alertXml("SelectHistoryItemToView"); } } }
//static void LLPanelGroupVoting::impl::onClickViewProposalItem(void *userdata) { impl* self = (LLPanelGroupVoting::impl*)userdata; if ( self && self->mProposals ) { LLScrollListItem * proposal = self->mProposals->getFirstSelected(); // Check if it has anything in column 2. If not, assume it's the "There are currently no active proposals" text if (proposal && proposal->getColumn(2)) { self->setEnableVoteProposal(); } else { gViewerWindow->alertXml("SelectProposalToView"); } } }
void LLFloaterPathfindingObjects::handleObjectNameResponse(const LLPathfindingObject *pObject) { llassert(pObject != NULL); const std::string uuid = pObject->getUUID().asString(); scroll_list_item_map::iterator scrollListItemIter = mMissingNameObjectsScrollListItems.find(uuid); if (scrollListItemIter != mMissingNameObjectsScrollListItems.end()) { LLScrollListItem *scrollListItem = scrollListItemIter->second; llassert(scrollListItem != NULL); LLScrollListCell *scrollListCell = scrollListItem->getColumn(getOwnerNameColumnIndex()); LLSD ownerName = getOwnerName(pObject); scrollListCell->setValue(ownerName); mMissingNameObjectsScrollListItems.erase(scrollListItemIter); } }
void LLPanelGroupLandMoney::impl::onMapButton() { LLScrollListItem* itemp; itemp = mGroupParcelsp->getFirstSelected(); if (!itemp) return; const LLScrollListCell* cellp; cellp = itemp->getColumn(itemp->getNumColumns() - 1); // hidden column is last F32 global_x = 0.f; F32 global_y = 0.f; sscanf(cellp->getValue().asString().c_str(), "%f %f", &global_x, &global_y); // Hack: Use the agent's z-height F64 global_z = gAgent.getPositionGlobal().mdV[VZ]; LLVector3d pos_global(global_x, global_y, global_z); gFloaterWorldMap->trackLocation(pos_global); LLFloaterWorldMap::show(true); }
BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { LLScrollListCtrl* list = getActiveList(); if(list) { LLRect rc_list; LLRect rc_point(x,y,x,y); if (localRectToOtherView(rc_point, &rc_list, list)) { // Keep selected only one item list->deselectAllItems(TRUE); list->selectItemAt(rc_list.mLeft, rc_list.mBottom, mask); LLScrollListItem* selection = list->getFirstSelected(); if (selection) { LLUUID session_id = LLUUID::null; LLUUID dest_agent_id = selection->getUUID(); std::string avatar_name = selection->getColumn(0)->getValue().asString(); if (dest_agent_id.notNull() && dest_agent_id != gAgentID) { // if (drop) // [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h if ( (drop) && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStartIM(dest_agent_id)) ) ) // [/RLVa:KB] { // Start up IM before give the item session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, dest_agent_id); } return LLToolDragAndDrop::handleGiveDragAndDrop(dest_agent_id, session_id, drop, cargo_type, cargo_data, accept, getName()); } } } } *accept = ACCEPT_NO; return TRUE; }
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; }
// static void HBFloaterGroupTitles::onActivate(void* userdata) { HBFloaterGroupTitles* self = (HBFloaterGroupTitles*) userdata; LLScrollListItem *item = self->mTitlesList->getFirstSelected(); if (!item) return; // Set the group if needed. LLUUID old_group_id = gAgent.getGroupID(); LLUUID group_id = item->getColumn(LIST_GROUP_ID)->getValue().asUUID(); if (group_id != old_group_id) { LLGroupActions::activate(group_id); } // Set the title LLGroupMgr::getInstance()->sendGroupTitleUpdate(group_id, item->getUUID()); // Force a refresh via the observer if (group_id.isNull()) { group_id = old_group_id; } LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id); }
void LLPanelGroupVoting::impl::setEnableHistoryItem() { //we make the assumption here that anyone who has the start //or vote powers should also have the view powers /* This power was removed to make group roles simpler if (!gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_VIEW) && !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_VOTE) && !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_START) ) return; */ if (!gAgent.isInGroup(mGroupID)) return; LLScrollListItem *item = mVotesHistory->getFirstSelected(); // Get full text, not stripped version. const LLScrollListCell *cell = item->getColumn(5); if (cell) { mVoteHistoryText->setText(cell->getValue().asString()); } else { // Something's wrong... mVoteHistoryText->setText(LLStringUtil::null); } mVotesHistoryLbl->setVisible(FALSE); mVotesHistory->setVisible(FALSE); mVoteHistoryTextLbl->setVisible(TRUE); mVoteHistoryText->setVisible(TRUE); mVoteHistoryText->setEnabled(FALSE); mBtnViewHistoryList->setVisible(TRUE); mBtnViewHistoryList->setEnabled(TRUE); mBtnViewHistoryItem->setVisible(FALSE); }
// propagate actual relationship to UI. // Does not resort the UI list because it can be called frequently. JC BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info) { if (!info) return FALSE; LLScrollListItem* itemp = mFriendsList->getItem(agent_id); if (!itemp) return FALSE; bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(itemp->getUUID()); bool isOnline = info->isOnline(); std::string fullname; // [Ansariel: Display name support] //BOOL have_name = gCacheName->getFullName(agent_id, fullname); LLAvatarName avatar_name; BOOL have_name; if (LLAvatarNameCache::get(agent_id, &avatar_name)) { static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : fullname = avatar_name.getLegacyName(); break; case 1 : fullname = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; case 2 : fullname = avatar_name.mDisplayName; break; default : fullname = avatar_name.getCompleteName(); break; } have_name = TRUE; } else have_name = FALSE; // [/Ansariel: Display name support] // Name of the status icon to use std::string statusIcon; if(isOnline) { mNumOnline++; statusIcon = "icon_avatar_online.tga"; } else if(isOnlineSIP) { mNumOnline++; statusIcon = ONLINE_SIP_ICON_NAME; } else { mNumOnline--; } itemp->getColumn(LIST_ONLINE_STATUS)->setValue(statusIcon); itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text ((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle((isOnline || isOnlineSIP) ? LLFontGL::BOLD : LLFontGL::NORMAL); itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)); //Notes in the original code imply this may not always work. Good to know. -HgB itemp->getColumn(LIST_VISIBLE_ONLINE_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS)); S32 change_generation = have_name ? info->getChangeSerialNum() : -1; itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(change_generation); // enable this item, in case it was disabled after user input itemp->setEnabled(TRUE); // Do not resort, this function can be called frequently. return have_name; }
void LLToolBar::updateCommunicateList() { LLFlyoutButton* communicate_button = getChild<LLFlyoutButton>("communicate_btn"); LLSD selected = communicate_button->getValue(); communicate_button->removeall(); LLFloater* frontmost_floater = LLFloaterChatterBox::getInstance()->getActiveFloater(); LLScrollListItem* itemp = NULL; itemp = communicate_button->add(LLFloaterMyFriends::getInstance()->getShortTitle(), LLSD("contacts"), ADD_TOP); if (LLFloaterMyFriends::getInstance() == frontmost_floater) { ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); // make sure current tab is selected in list if (selected.isUndefined()) { selected = itemp->getValue(); } } itemp = communicate_button->add(LLFloaterChat::getInstance()->getShortTitle(), LLSD("local chat"), ADD_TOP); if (LLFloaterChat::getInstance() == frontmost_floater) { ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); if (selected.isUndefined()) { selected = itemp->getValue(); } } communicate_button->addSeparator(ADD_TOP); communicate_button->add(getString("Redock Windows"), LLSD("redock"), ADD_TOP); communicate_button->addSeparator(ADD_TOP); communicate_button->add(LLFloaterMute::getInstance()->getShortTitle(), LLSD("mute list"), ADD_TOP); std::set<LLHandle<LLFloater> >::const_iterator floater_handle_it; if (gIMMgr->getIMFloaterHandles().size() > 0) { communicate_button->addSeparator(ADD_TOP); } for(floater_handle_it = gIMMgr->getIMFloaterHandles().begin(); floater_handle_it != gIMMgr->getIMFloaterHandles().end(); ++floater_handle_it) { LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get(); if (im_floaterp) { std::string floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : ""; floater_title.append(im_floaterp->getShortTitle()); itemp = communicate_button->add(floater_title, im_floaterp->getSessionID(), ADD_TOP); if (im_floaterp == frontmost_floater) { ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); if (selected.isUndefined()) { selected = itemp->getValue(); } } } } communicate_button->setToggleState(gSavedSettings.getBOOL("ShowCommunicate")); communicate_button->setValue(selected); }
void LLPanelActiveSpeakers::refreshSpeakers() { // store off current selection and scroll state to preserve across list rebuilds LLUUID selected_id = mSpeakerList->getSelectedValue().asUUID(); S32 scroll_pos = mSpeakerList->getScrollInterface()->getScrollPos(); // decide whether it's ok to resort the list then update the speaker manager appropriately. // rapid resorting by activity makes it hard to interact with speakers in the list // so we freeze the sorting while the user appears to be interacting with the control. // we assume this is the case whenever the mouse pointer is within the active speaker // panel and hasn't been motionless for more than a few seconds. see DEV-6655 -MG LLRect screen_rect; localRectToScreen(getLocalRect(), &screen_rect); BOOL mouse_in_view = screen_rect.pointInRect(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY()); F32 mouses_last_movement = gMouseIdleTimer.getElapsedTimeF32(); BOOL sort_ok = ! (mouse_in_view && mouses_last_movement<RESORT_TIMEOUT); mSpeakerMgr->update(sort_ok); const std::string icon_image_0 = "icn_active-speakers-dot-lvl0.tga"; const std::string icon_image_1 = "icn_active-speakers-dot-lvl1.tga"; const std::string icon_image_2 = "icn_active-speakers-dot-lvl2.tga"; std::vector<LLScrollListItem*> items = mSpeakerList->getAllData(); std::string mute_icon_image = "mute_icon.tga"; LLSpeakerMgr::speaker_list_t speaker_list; mSpeakerMgr->getSpeakerList(&speaker_list, mShowTextChatters); for (std::vector<LLScrollListItem*>::iterator item_it = items.begin(); item_it != items.end(); ++item_it) { LLScrollListItem* itemp = (*item_it); LLUUID speaker_id = itemp->getUUID(); LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(speaker_id); if (!speakerp) { continue; } // since we are forced to sort by text, encode sort order as string std::string speaking_order_sort_string = llformat("%010d", speakerp->mSortIndex); LLScrollListCell* icon_cell = itemp->getColumn(0); if (icon_cell) { std::string icon_image_id; S32 icon_image_idx = llmin(2, llfloor((speakerp->mSpeechVolume / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f)); switch(icon_image_idx) { case 0: icon_image_id = icon_image_0; break; case 1: icon_image_id = icon_image_1; break; case 2: icon_image_id = icon_image_2; break; } LLColor4 icon_color; if (speakerp->mStatus == LLSpeaker::STATUS_MUTED) { icon_cell->setValue(mute_icon_image); if(speakerp->mModeratorMutedVoice) { icon_color.setVec(0.5f, 0.5f, 0.5f, 1.f); } else { icon_color.setVec(1.f, 71.f / 255.f, 71.f / 255.f, 1.f); } } else { icon_cell->setValue(icon_image_id); icon_color = speakerp->mDotColor; if (speakerp->mStatus > LLSpeaker::STATUS_VOICE_ACTIVE) // if voice is disabled for this speaker { // non voice speakers have hidden icons, render as transparent icon_color.setVec(0.f, 0.f, 0.f, 0.f); } } icon_cell->setColor(icon_color); if (speakerp->mStatus > LLSpeaker::STATUS_VOICE_ACTIVE && speakerp->mStatus != LLSpeaker::STATUS_MUTED) // if voice is disabled for this speaker { // non voice speakers have hidden icons, render as transparent icon_cell->setColor(LLColor4::transparent); } } // update name column LLScrollListCell* name_cell = itemp->getColumn(1); if (name_cell) { //FIXME: remove hard coding of font colors if (speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL) { // draw inactive speakers in gray name_cell->setColor(LLColor4::grey4); } else { name_cell->setColor(gColors.getColor("DefaultListText")); } std::string speaker_name; if (speakerp->mDisplayName.empty()) { speaker_name = LLCacheName::getDefaultName(); } else { speaker_name = speakerp->mDisplayName; } if (speakerp->mIsModerator) { speaker_name += std::string(" ") + getString("moderator_label"); } name_cell->setValue(speaker_name); ((LLScrollListText*)name_cell)->setFontStyle(speakerp->mIsModerator ? LLFontGL::BOLD : LLFontGL::NORMAL); } // update speaking order column LLScrollListCell* speaking_status_cell = itemp->getColumn(2); if (speaking_status_cell) { // print speaking ordinal in a text-sorting friendly manner speaking_status_cell->setValue(speaking_order_sort_string); } } // we potentially modified the sort order by touching the list items mSpeakerList->setSorted(FALSE); LLPointer<LLSpeaker> selected_speakerp = mSpeakerMgr->findSpeaker(selected_id); // update UI for selected participant if (mMuteVoiceCtrl) { mMuteVoiceCtrl->setValue(LLMuteList::getInstance()->isMuted(selected_id, LLMute::flagVoiceChat)); mMuteVoiceCtrl->setEnabled(LLVoiceClient::voiceEnabled() && gVoiceClient->getVoiceEnabled(selected_id) && selected_id.notNull() && selected_id != gAgent.getID() && (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL))); } if (mMuteTextCtrl) { mMuteTextCtrl->setValue(LLMuteList::getInstance()->isMuted(selected_id, LLMute::flagTextChat)); mMuteTextCtrl->setEnabled(selected_id.notNull() && selected_id != gAgent.getID() && selected_speakerp.notNull() && selected_speakerp->mType != LLSpeaker::SPEAKER_EXTERNAL && !LLMuteList::getInstance()->isLinden(selected_speakerp->mDisplayName)); } childSetValue("speaker_volume", gVoiceClient->getUserVolume(selected_id)); childSetEnabled("speaker_volume", LLVoiceClient::voiceEnabled() && gVoiceClient->getVoiceEnabled(selected_id) && selected_id.notNull() && selected_id != gAgent.getID() && (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL))); childSetEnabled( "moderator_controls_label", selected_id.notNull()); childSetEnabled( "moderator_allow_voice", selected_id.notNull() && mSpeakerMgr->isVoiceActive() && gVoiceClient->getVoiceEnabled(selected_id)); childSetEnabled( "moderator_allow_text", selected_id.notNull()); if (mProfileBtn) { mProfileBtn->setEnabled(selected_id.notNull() && (selected_speakerp.notNull() && selected_speakerp->mType != LLSpeaker::SPEAKER_EXTERNAL) ); } // show selected user name in large font if (mNameText) { if (selected_speakerp) { mNameText->setValue(selected_speakerp->mDisplayName); } else { mNameText->setValue(LLStringUtil::null); } } //update moderator capabilities LLPointer<LLSpeaker> self_speakerp = mSpeakerMgr->findSpeaker(gAgent.getID()); if(self_speakerp) { childSetVisible("moderation_mode_panel", self_speakerp->mIsModerator && mSpeakerMgr->isVoiceActive()); childSetVisible("moderator_controls", self_speakerp->mIsModerator); } // keep scroll value stable mSpeakerList->getScrollInterface()->setScrollPos(scroll_pos); }
void LLParticipantList::refreshSpeakers() { // store off current selection and scroll state to preserve across list rebuilds const S32 scroll_pos = mAvatarList->getScrollInterface()->getScrollPos(); // decide whether it's ok to resort the list then update the speaker manager appropriately. // rapid resorting by activity makes it hard to interact with speakers in the list // so we freeze the sorting while the user appears to be interacting with the control. // we assume this is the case whenever the mouse pointer is within the active speaker // panel and hasn't been motionless for more than a few seconds. see DEV-6655 -MG LLRect screen_rect; localRectToScreen(getLocalRect(), &screen_rect); mSpeakerMgr->update(!(screen_rect.pointInRect(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY()) && gMouseIdleTimer.getElapsedTimeF32() < 5.f)); std::vector<LLScrollListItem*> items = mAvatarList->getAllData(); for (std::vector<LLScrollListItem*>::iterator item_it = items.begin(); item_it != items.end(); ++item_it) { LLScrollListItem* itemp = (*item_it); LLPointer<LLSpeaker> speakerp = mSpeakerMgr->findSpeaker(itemp->getUUID()); if (speakerp.isNull()) continue; if (LLScrollListCell* icon_cell = itemp->getColumn(0)) { if (speakerp->mStatus == LLSpeaker::STATUS_MUTED) { icon_cell->setValue("mute_icon.tga"); static const LLCachedControl<LLColor4> sAscentMutedColor("AscentMutedColor"); icon_cell->setColor(speakerp->mModeratorMutedVoice ? /*LLColor4::grey*/sAscentMutedColor : LLColor4(1.f, 71.f / 255.f, 71.f / 255.f, 1.f)); } else { switch(llmin(2, llfloor((speakerp->mSpeechVolume / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f))) { case 0: icon_cell->setValue("icn_active-speakers-dot-lvl0.tga"); break; case 1: icon_cell->setValue("icn_active-speakers-dot-lvl1.tga"); break; case 2: icon_cell->setValue("icn_active-speakers-dot-lvl2.tga"); break; } // non voice speakers have hidden icons, render as transparent icon_cell->setColor(speakerp->mStatus > LLSpeaker::STATUS_VOICE_ACTIVE ? LLColor4::transparent : speakerp->mDotColor); } } // update name column if (LLScrollListCell* name_cell = itemp->getColumn(1)) { if (speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL) { // draw inactive speakers in different color static const LLCachedControl<LLColor4> sSpeakersInactive(gColors, "SpeakersInactive"); name_cell->setColor(sSpeakersInactive); } else { bool found = mShowTextChatters || speakerp->mID == gAgentID; const LLWorld::region_list_t& regions = LLWorld::getInstance()->getRegionList(); for (LLWorld::region_list_t::const_iterator iter = regions.begin(); !found && iter != regions.end(); ++iter) { // Are they in this sim? if (const LLViewerRegion* regionp = *iter) if (std::find(regionp->mMapAvatarIDs.begin(), regionp->mMapAvatarIDs.end(), speakerp->mID) != regionp->mMapAvatarIDs.end()) found = true; } if (!found) { static const LLCachedControl<LLColor4> sSpeakersGhost(gColors, "SpeakersGhost"); name_cell->setColor(sSpeakersGhost); } else { static const LLCachedControl<LLColor4> sDefaultListText(gColors, "DefaultListText"); name_cell->setColor(sDefaultListText); } } std::string speaker_name = speakerp->mDisplayName.empty() ? LLCacheName::getDefaultName() : speakerp->mDisplayName; if (speakerp->mIsModerator) speaker_name += " " + getString("moderator_label"); name_cell->setValue(speaker_name); static_cast<LLScrollListText*>(name_cell)->setFontStyle(speakerp->mIsModerator ? LLFontGL::BOLD : LLFontGL::NORMAL); } // update speaking order column if (LLScrollListCell* speaking_status_cell = itemp->getColumn(2)) { // since we are forced to sort by text, encode sort order as string // print speaking ordinal in a text-sorting friendly manner speaking_status_cell->setValue(llformat("%010d", speakerp->mSortIndex)); } } // we potentially modified the sort order by touching the list items mAvatarList->setNeedsSort(); // keep scroll value stable mAvatarList->getScrollInterface()->setScrollPos(scroll_pos); }