BOOL LLFloaterLandHoldings::postBuild() { childSetAction("Teleport", onClickTeleport, this); childSetAction("Show on Map", onClickMap, this); // Grant list childSetDoubleClickCallback("grant list", onGrantList); childSetUserData("grant list", this); LLCtrlListInterface *list = childGetListInterface("grant list"); if (!list) return TRUE; S32 count = gAgent.mGroups.count(); for(S32 i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.get(i).mID); LLSD element; element["id"] = id; element["columns"][0]["column"] = "group"; element["columns"][0]["value"] = gAgent.mGroups.get(i).mName; element["columns"][0]["font"] = "SANSSERIF"; LLUIString areastr = getString("area_string"); areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.get(i).mContribution)); element["columns"][1]["column"] = "area"; element["columns"][1]["value"] = areastr; element["columns"][1]["font"] = "SANSSERIF"; list->addElement(element, ADD_SORTED); } return TRUE; }
void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { if (!sInstance) { new LLFloaterBump(); } if (mcd->mFirstName.empty() || list->getItemCount() >= 20) { return; } // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); std::string time = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); std::string action; switch(mcd->mType) { case MEAN_BUMP: action = "bump"; break; case MEAN_LLPUSHOBJECT: action = "llpushobject"; break; case MEAN_SELECTED_OBJECT_COLLIDE: action = "selected_object_collide"; break; case MEAN_SCRIPTED_OBJECT_COLLIDE: action = "scripted_object_collide"; break; case MEAN_PHYSICAL_OBJECT_COLLIDE: action = "physical_object_collide"; break; default: llinfos << "LLFloaterBump::add unknown mean collision type " << mcd->mType << llendl; return; } // All above action strings are in XML file LLUIString text = sInstance->getString(action); text.setArg("[TIME]", time); text.setArg("[FIRST]", mcd->mFirstName); text.setArg("[LAST]", mcd->mLastName); LLSD row; row["id"] = mcd->mPerp; row["columns"][0]["value"] = text; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); //@hook OnBump(action,time,firstname,lastname) You were bumped by something LUA_CALL("OnBump") << action << time << mcd->mFirstName << mcd->mLastName << LUA_END; }
void LLIMMgr::noteOfflineUsers( LLFloaterIMPanel* floater, const LLDynamicArray<LLUUID>& ids) { S32 count = ids.count(); if(count == 0) { floater->addHistoryLine(sOnlyUserMessage, gSavedSettings.getColor4("SystemChatColor")); } else { const LLRelationship* info = NULL; LLAvatarTracker& at = LLAvatarTracker::instance(); for(S32 i = 0; i < count; ++i) { info = at.getBuddyInfo(ids.get(i)); std::string full_name; if(info && !info->isOnline() && gCacheName->getFullName(ids.get(i), full_name)) { LLUIString offline = sOfflineMessage; offline.setArg("[NAME]", full_name); floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor")); } } } }
void LLIMMgr::noteOfflineUsers( LLFloaterIMPanel* floater, const std::vector<LLUUID>& ids) { S32 count = ids.size(); if(count == 0) { const std::string& only_user = LLTrans::getString("only_user_message"); floater->addHistoryLine(only_user, gSavedSettings.getColor4("SystemChatColor")); } else { const LLRelationship* info = NULL; LLAvatarTracker& at = LLAvatarTracker::instance(); for(S32 i = 0; i < count; ++i) { info = at.getBuddyInfo(ids.at(i)); std::string full_name; if (info && !info->isOnline() && LLAvatarNameCache::getNSName(ids.at(i), full_name)) { LLUIString offline = LLTrans::getString("offline_message"); offline.setArg("[NAME]", full_name); floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor")); } } } }
BOOL LLFloaterLandHoldings::postBuild() { childSetAction("Teleport", onClickTeleport, this); childSetAction("Show on Map", onClickMap, this); // Grant list LLScrollListCtrl* grant_list = getChild<LLScrollListCtrl>("grant list"); grant_list->sortByColumnIndex(0, TRUE); grant_list->setDoubleClickCallback(onGrantList, this); S32 count = gAgent.mGroups.count(); for(S32 i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.get(i).mID); LLSD element; element["id"] = id; element["columns"][0]["column"] = "group"; element["columns"][0]["value"] = gAgent.mGroups.get(i).mName; element["columns"][0]["font"] = "SANSSERIF"; LLUIString areastr = getString("area_string"); areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.get(i).mContribution)); element["columns"][1]["column"] = "area"; element["columns"][1]["value"] = areastr; element["columns"][1]["font"] = "SANSSERIF"; grant_list->addElement(element); } center(); return TRUE; }
void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args) { LLUIString message; // null session id means near me (chat history) if (session_id.isNull()) { LLFloaterChat* floaterp = LLFloaterChat::getInstance(); message = floaterp->getString(message_name); message.setArgs(args); LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::getInstance()->addChatHistory(chat); } else // going to IM session { LLFloaterIMPanel* floaterp = findFloaterBySession(session_id); if (floaterp) { message = floaterp->getString(message_name); message.setArgs(args); gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString()); } } }
void LLFloaterNewIM::addAgent(const LLUUID& uuid, void* data, BOOL online) { std::string first, last; gCacheName->getName(uuid, first, last); LLUIString fullname = sNameFormat; fullname.setArg("[FIRST]", first); fullname.setArg("[LAST]", last); LLSD row; row["id"] = uuid; row["columns"][0]["value"] = fullname; row["columns"][0]["width"] = COL_1_WIDTH; row["columns"][0]["font"] = "SANSSERIF"; row["columns"][0]["font-style"] = online ? "BOLD" : "NORMAL"; row["columns"][1]["value"] = online ? sOnlineDescriptor : ""; row["columns"][1]["font"] = "SANSSERIF"; row["columns"][1]["font-style"] = "BOLD"; LLScrollListItem* itemp = mSelectionList->addElement(row); itemp->setUserdata(data); if (mSelectionList->getFirstSelectedIndex() == -1) { mSelectionList->selectFirstItem(); } }
std::string LLIMMgr::getOfflineMessage(const LLUUID& id) { std::string full_name; if (LLAvatarNameCache::getNSName(id, full_name)) { LLUIString offline = LLTrans::getString("offline_message"); offline.setArg("[NAME]", full_name); return offline; } return LLStringUtil::null; }
BOOL LLFloaterJoystick::postBuild() { F32 range = gSavedSettings.getBOOL("Cursor3D") ? 1024.f : 2.f; LLUIString axis = getString("Axis"); LLUIString joystick = getString("JoystickMonitor"); // use this child to get relative positioning info; we'll place the // joystick monitor on its right, vertically aligned to it. LLView* child = getChild<LLView>("FlycamAxisScale1"); LLRect rect; if (child) { LLRect r = child->getRect(); rect = LLRect(350, r.mTop, r.mRight + 200, 0); } LLStatView::Params params; params.name("axis values"); params.rect(rect); params.show_label(true); params.label(joystick); mAxisStatsView = LLUICtrlFactory::create<LLStatView>(params); for (U32 i = 0; i < 6; i++) { axis.setArg("[NUM]", llformat("%d", i)); std::string stat_name(llformat("Joystick axis %d", i)); mAxisStats[i] = new LLStat(stat_name,4); mAxisStatsBar[i] = mAxisStatsView->addStat(axis, mAxisStats[i]); mAxisStatsBar[i]->mMinBar = -range; mAxisStatsBar[i]->mMaxBar = range; mAxisStatsBar[i]->mLabelSpacing = range * 0.5f; mAxisStatsBar[i]->mTickSpacing = range * 0.25f; } addChild(mAxisStatsView); mCheckJoystickEnabled = getChild<LLCheckBoxCtrl>("enable_joystick"); childSetCommitCallback("enable_joystick",onCommitJoystickEnabled,this); mCheckFlycamEnabled = getChild<LLCheckBoxCtrl>("JoystickFlycamEnabled"); childSetCommitCallback("JoystickFlycamEnabled",onCommitJoystickEnabled,this); getChild<LLUICtrl>("Default")->setCommitCallback(boost::bind(&LLFloaterJoystick::onClickDefault, this, _2)); childSetAction("cancel_btn", onClickCancel, this); childSetAction("ok_btn", onClickOK, this); refresh(); return TRUE; }
void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { if (mcd->mFullName.empty() || list->getItemCount() >= 20) { return; } // There's only one internal tm buffer. // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. tm* timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); std::string timeStr = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); std::string action; switch(mcd->mType) { case MEAN_BUMP: action = "bump"; break; case MEAN_LLPUSHOBJECT: action = "llpushobject"; break; case MEAN_SELECTED_OBJECT_COLLIDE: action = "selected_object_collide"; break; case MEAN_SCRIPTED_OBJECT_COLLIDE: action = "scripted_object_collide"; break; case MEAN_PHYSICAL_OBJECT_COLLIDE: action = "physical_object_collide"; break; default: LL_INFOS() << "LLFloaterBump::add unknown mean collision type " << mcd->mType << LL_ENDL; return; } // All above action strings are in XML file LLUIString text = getString(action); text.setArg("[TIME]", timeStr); text.setArg("[NAME]", mcd->mFullName); LLSD row; row["id"] = mcd->mPerp; row["columns"][0]["value"] = text; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); }
void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { if (mcd->mFirstName.empty() || list->getItemCount() >= 20) { return; } std::string timeStr = getString ("timeStr"); LLSD substitution; substitution["datetime"] = (S32) mcd->mTime; LLStringUtil::format (timeStr, substitution); std::string action; switch(mcd->mType) { case MEAN_BUMP: action = "bump"; break; case MEAN_LLPUSHOBJECT: action = "llpushobject"; break; case MEAN_SELECTED_OBJECT_COLLIDE: action = "selected_object_collide"; break; case MEAN_SCRIPTED_OBJECT_COLLIDE: action = "scripted_object_collide"; break; case MEAN_PHYSICAL_OBJECT_COLLIDE: action = "physical_object_collide"; break; default: llinfos << "LLFloaterBump::add unknown mean collision type " << mcd->mType << llendl; return; } // All above action strings are in XML file LLUIString text = getString(action); text.setArg("[TIME]", timeStr); text.setArg("[FIRST]", mcd->mFirstName); text.setArg("[LAST]", mcd->mLastName); LLSD row; row["id"] = mcd->mPerp; row["columns"][0]["value"] = text; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); }
void LLCurrencyUIManager::buy(const std::string& buy_msg) { if (!canBuy()) { return; } LLUIString msg = buy_msg; msg.setArg("[LINDENS]", llformat("%d", impl.mUserCurrencyBuy)); msg.setArg("[LOCALAMOUNT]", getLocalEstimate()); LLConfirmationManager::confirm(impl.mSiteConfirm, msg, impl, &LLCurrencyUIManager::Impl::startCurrencyBuy); }
void LLCurrencyUIManager::buy(const std::string& buy_msg) { if (!canBuy()) { return; } LLUIString msg = buy_msg; msg.setArg("[LINDENS]", llformat("%d", impl.mUserCurrencyBuy)); msg.setArg("[USD]", llformat("%#.2f", impl.mSiteCurrencyEstimatedCost / 100.0)); LLConfirmationManager::confirm(impl.mSiteConfirm, msg, impl, &LLCurrencyUIManager::Impl::startCurrencyBuy); }
void LLCurrencyUIManager::buy(const std::string& buy_msg) { if (!canBuy()) { return; } LLUIString msg = buy_msg; msg.setArg("[LINDENS]", llformat("%d", impl.mUserCurrencyBuy)); msg.setArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); msg.setArg("[USD]", llformat("%#.2f", impl.mSiteCurrencyEstimatedCost / 100.0)); msg.setArg("[REALCURRENCY]", gHippoGridManager->getConnectedGrid()->getRealCurrencySymbol()); LLConfirmationManager::confirm(impl.mSiteConfirm, msg, impl, &LLCurrencyUIManager::Impl::startCurrencyBuy); }
// static void LLFloaterJoystick::show(void*) { if (sInstance) { sInstance->open(); /*Flawfinder: ignore*/ } else { LLFloaterJoystick* floater = new LLFloaterJoystick(); gUICtrlFactory->buildFloater(floater, "floater_joystick.xml"); F32 range = gSavedSettings.getBOOL("FlycamAbsolute") ? 1024.f : 2.f; LLUIString axis = floater->childGetText("Axis"); LLUIString joystick = floater->childGetText("JoystickMonitor"); LLView* child = floater->getChildByName("ZoomLabel"); LLRect rect; if (child) { LLRect r = child->getRect(); LLRect f = floater->getRect(); rect = LLRect(150, r.mTop, r.mRight, 0); } floater->mAxisStats = new LLStatView("axis values", joystick, "", rect); floater->mAxisStats->setDisplayChildren(TRUE); for (U32 i = 0; i < 6; i++) { axis.setArg("[NUM]", llformat("%d", i)); floater->mAxis[i] = new LLStat(4); floater->mAxisBar[i] = floater->mAxisStats->addStat(axis, floater->mAxis[i]); floater->mAxisBar[i]->mMinBar = -range; floater->mAxisBar[i]->mMaxBar = range; floater->mAxisBar[i]->mLabelSpacing = range * 0.5f; floater->mAxisBar[i]->mTickSpacing = range * 0.25f; } floater->addChild(floater->mAxisStats); floater->open(); /*Flawfinder: ignore*/ } }
void LLPreview::refreshFromItem() { const LLInventoryItem* item = getItem(); if (!item) { return; } if (hasString("Title")) { LLStringUtil::format_map_t args; args["[NAME]"] = item->getName(); LLUIString title = getString("Title", args); setTitle(title.getString()); } getChild<LLUICtrl>("desc")->setValue(item->getDescription()); getChildView("desc")->setEnabled(canModify(mObjectUUID, item)); }
void LLPreview::refreshFromItem() { const LLInventoryItem* item = getItem(); if (!item) { return; } if (hasString("Title")) { LLStringUtil::format_map_t args; args["[NAME]"] = item->getName(); LLUIString title = getString("Title", args); setTitle(title.getString()); } getChild<LLUICtrl>("desc")->setValue(item->getDescription()); BOOL can_agent_manipulate = item->getPermissions().allowModifyBy(gAgent.getID()); getChildView("desc")->setEnabled(can_agent_manipulate); }
void LLAutoReplace::autoreplaceCallback(LLUIString& inputText, S32& cursorPos) { static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace"); if(perform_autoreplace) { S32 wordEnd = cursorPos-1; LLWString text = inputText.getWString(); bool atSpace = (text[wordEnd] == ' '); bool haveWord = (LLWStringUtil::isPartOfWord(text[wordEnd])); if (atSpace || haveWord) { if (atSpace && wordEnd > 0) { // find out if this space immediately follows a word wordEnd--; haveWord = (LLWStringUtil::isPartOfWord(text[wordEnd])); } if (haveWord) { // wordEnd points to the end of a word, now find the start of the word std::string word; S32 wordStart = wordEnd; for ( S32 backOne = wordStart - 1; backOne >= 0 && LLWStringUtil::isPartOfWord(text[backOne]); backOne-- ) { wordStart--; // walk wordStart back to the beginning of the word } LL_DEBUGS("AutoReplace")<<"wordStart: "<<wordStart<<" wordEnd: "<<wordEnd<<LL_ENDL; std::string strText = std::string(text.begin(), text.end()); std::string lastWord = strText.substr(wordStart, wordEnd-wordStart+1); std::string replacementWord( mSettings.replaceWord( lastWord ) ); if ( replacementWord != lastWord ) { // The last word is one for which we have a replacement if (atSpace) { // replace the last word in the input LLWString strNew = utf8str_to_wstring(replacementWord); LLWString strOld = utf8str_to_wstring(lastWord); int size_change = strNew.size() - strOld.size(); text.replace(wordStart,lastWord.length(),strNew); inputText = wstring_to_utf8str(text); cursorPos+=size_change; } } } } } }
void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType type) { if(APT_CLASSIFIED_INFO == type) { LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data); if(c_info && getClassifiedId() == c_info->classified_id) { setClassifiedName(c_info->name); setDescription(c_info->description); setSnapshotId(c_info->snapshot_id); setParcelId(c_info->parcel_id); setPosGlobal(c_info->pos_global); setSimName(c_info->sim_name); setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); getChild<LLUICtrl>("category")->setValue(LLClassifiedInfo::sCategories[c_info->category]); static std::string mature_str = getString("type_mature"); static std::string pg_str = getString("type_pg"); static LLUIString price_str = getString("l$_price"); static std::string date_fmt = getString("date_fmt"); bool mature = is_cf_mature(c_info->flags); getChild<LLUICtrl>("content_type")->setValue(mature ? mature_str : pg_str); getChild<LLIconCtrl>("content_type_moderate")->setVisible(mature); getChild<LLIconCtrl>("content_type_general")->setVisible(!mature); std::string auto_renew_str = is_cf_auto_renew(c_info->flags) ? getString("auto_renew_on") : getString("auto_renew_off"); getChild<LLUICtrl>("auto_renew")->setValue(auto_renew_str); price_str.setArg("[PRICE]", llformat("%d", c_info->price_for_listing)); getChild<LLUICtrl>("price_for_listing")->setValue(LLSD(price_str)); std::string date_str = date_fmt; LLStringUtil::format(date_str, LLSD().with("datetime", (S32) c_info->creation_date)); getChild<LLUICtrl>("creation_date")->setValue(date_str); setInfoLoaded(true); } } }
void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item, llwchar wc ) { // *NOTE: Just for embedded Texture , we should use getAssetUUID(), // not getUUID(), because LLPreviewTexture pass in AssetUUID into // LLPreview constructor ItemUUID parameter. if (!item) return; LLPreviewTexture* preview = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item->getAssetUUID()), TAKE_FOCUS_YES); if (preview) { preview->setAuxItem( item ); preview->setNotecardInfo(mNotecardInventoryID, mObjectID); if (preview->hasString("Title")) { LLStringUtil::format_map_t args; args["[NAME]"] = item->getName(); LLUIString title = preview->getString("Title", args); preview->setTitle(title.getString()); } preview->getChild<LLUICtrl>("desc")->setValue(item->getDescription()); } }
BOOL LLFloaterLandHoldings::postBuild() { childSetAction("Teleport", onClickTeleport, this); childSetAction("Show on Map", onClickMap, this); // Grant list LLScrollListCtrl *grant_list = getChild<LLScrollListCtrl>("grant list"); grant_list->setDoubleClickCallback(boost::bind(LLGroupActions::show, boost::bind(&LLScrollListCtrl::getCurrentID, grant_list))); LLCtrlListInterface *list = grant_list->getListInterface(); if (!list) return TRUE; S32 count = gAgent.mGroups.size(); for(S32 i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.at(i).mID); LLSD element; element["id"] = id; element["columns"][0]["column"] = "group"; element["columns"][0]["value"] = gAgent.mGroups.at(i).mName; element["columns"][0]["font"] = "SANSSERIF"; LLUIString areastr = getString("area_string"); areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.at(i).mContribution)); element["columns"][1]["column"] = "area"; element["columns"][1]["value"] = areastr; element["columns"][1]["font"] = "SANSSERIF"; list->addElement(element, ADD_SORTED); } center(); return TRUE; }
void LLButton::resize(LLUIString label) { // get label length S32 label_width = mGLFont->getWidth(label.getString()); // get current btn length S32 btn_width =getRect().getWidth(); // check if it need resize if (mAutoResize == TRUE) { if (btn_width - (mRightHPad + mLeftHPad) < label_width) { setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mLeft + label_width + mLeftHPad + mRightHPad , getRect().mBottom)); } } }
void LLButton::resize(LLUIString label) { // get label length S32 label_width = mGLFont->getWidth(label.getString()); // get current btn length S32 btn_width =getRect().getWidth(); // check if it need resize if (mAutoResize) { S32 min_width = label_width + mLeftHPad + mRightHPad; if (mImageOverlay) { S32 overlay_width = mImageOverlay->getWidth(); F32 scale_factor = (getRect().getHeight() - (mImageOverlayBottomPad + mImageOverlayTopPad)) / (F32)mImageOverlay->getHeight(); overlay_width = ll_round((F32)overlay_width * scale_factor); switch(mImageOverlayAlignment) { case LLFontGL::LEFT: case LLFontGL::RIGHT: min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: min_width = llmax(min_width, overlay_width + mLeftHPad + mRightHPad); break; default: // draw nothing break; } } if (btn_width < min_width) { reshape(min_width, getRect().getHeight()); } } }
//virtual void LLPanelPlace::processParcelInfo(const LLParcelData& parcel_data) { mAuctionID = parcel_data.auction_id; if(parcel_data.snapshot_id.notNull()) { mSnapshotCtrl->setImageAssetID(parcel_data.snapshot_id); } if( !parcel_data.name.empty() && mNameEditor && mNameEditor->getText().empty()) { mNameEditor->setText(parcel_data.name); } if( !parcel_data.desc.empty() && mDescEditor && mDescEditor->getText().empty()) { mDescEditor->setText(parcel_data.desc); } std::string info_text; LLUIString traffic = getString("traffic_text"); traffic.setArg("[TRAFFIC]", llformat("%d ", (int)parcel_data.dwell)); info_text = traffic; LLUIString area = getString("area_text"); area.setArg("[AREA]", llformat("%d", parcel_data.actual_area)); info_text += area; if (parcel_data.flags & DFQ_FOR_SALE) { LLUIString forsale = getString("forsale_text"); forsale.setArg("[PRICE]", llformat("%d", parcel_data.sale_price)); info_text += forsale; } if (parcel_data.auction_id != 0) { LLUIString auction = getString("auction_text"); auction.setArg("[ID]", llformat("%010d ", parcel_data.auction_id)); info_text += auction; } if (mInfoEditor) { mInfoEditor->setText(info_text); } // HACK: Flag 0x2 == adult region, // Flag 0x1 == mature region, otherwise assume PG std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); if (parcel_data.flags & 0x2) { rating = LLViewerRegion::accessToString(SIM_ACCESS_ADULT); } else if (parcel_data.flags & 0x1) { rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE); } // Just use given region position for display S32 region_x = llround(mPosRegion.mV[0]); S32 region_y = llround(mPosRegion.mV[1]); S32 region_z = llround(mPosRegion.mV[2]); // If the region position is zero, grab position from the global if(mPosRegion.isExactlyZero()) { region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS; region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS; region_z = llround(parcel_data.global_z); } if(mPosGlobal.isExactlyZero()) { mPosGlobal.setVec(parcel_data.global_x, parcel_data.global_y, parcel_data.global_z); } std::string location = llformat("%s %d, %d, %d (%s)", parcel_data.sim_name.c_str(), region_x, region_y, region_z, rating.c_str()); if (mLocationDisplay) { mLocationDisplay->setText(location); } BOOL show_auction = (parcel_data.auction_id > 0); mAuctionBtn->setVisible(show_auction); }
void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) { U32 request_flags; U32 total_count; msg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags); msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count); msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode); LLScrollListCtrl *list = getChild<LLScrollListCtrl>("objects_list"); S32 block_count = msg->getNumberOfBlocks("ReportData"); for (S32 block = 0; block < block_count; ++block) { U32 task_local_id; U32 time_stamp = 0; LLUUID task_id; F32 location_x, location_y, location_z; F32 score; std::string name_buf; std::string owner_buf; F32 mono_score = 0.f; bool have_extended_data = false; S32 public_urls = 0; msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block); msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block); if(msg->has("DataExtended")) { have_extended_data = true; msg->getU32("DataExtended", "TimeStamp", time_stamp, block); msg->getF32("DataExtended", "MonoScore", mono_score, block); msg->getS32(_PREHASH_ReportData,"PublicURLs",public_urls,block); } LLSD element; element["id"] = task_id; LLSD columns; columns[0]["column"] = "score"; columns[0]["value"] = llformat("%0.3f", score); columns[0]["font"] = "SANSSERIF"; columns[1]["column"] = "name"; columns[1]["value"] = name_buf; columns[1]["font"] = "SANSSERIF"; // Owner names can have trailing spaces sent from server LLStringUtil::trim(owner_buf); if (LLAvatarNameCache::useDisplayNames()) { // ...convert hard-coded name from server to a username // *TODO: Send owner_id from server and look up display name owner_buf = LLCacheName::buildUsername(owner_buf); } else { // ...just strip out legacy "Resident" name owner_buf = LLCacheName::cleanFullName(owner_buf); } columns[2]["column"] = "owner"; columns[2]["value"] = owner_buf; columns[2]["font"] = "SANSSERIF"; columns[3]["column"] = "location"; columns[3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z); columns[3]["font"] = "SANSSERIF"; columns[4]["column"] = "time"; columns[4]["value"] = formatted_time((time_t)time_stamp); columns[4]["font"] = "SANSSERIF"; if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS && have_extended_data) { columns[5]["column"] = "mono_time"; columns[5]["value"] = llformat("%0.3f", mono_score); columns[5]["font"] = "SANSSERIF"; columns[6]["column"] = "URLs"; columns[6]["value"] = llformat("%d", public_urls); columns[6]["font"] = "SANSSERIF"; } element["columns"] = columns; list->addElement(element); mObjectListData.append(element); mObjectListIDs.push_back(task_id); mtotalScore += score; } if (total_count == 0 && list->getItemCount() == 0) { list->setCommentText(getString("none_descriptor")); } else { list->selectFirstItem(); } if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS) { setTitle(getString("top_scripts_title")); list->setColumnLabel("score", getString("scripts_score_label")); list->setColumnLabel("mono_time", getString("scripts_mono_time_label")); LLUIString format = getString("top_scripts_text"); format.setArg("[COUNT]", llformat("%d", total_count)); format.setArg("[TIME]", llformat("%0.1f", mtotalScore)); getChild<LLUICtrl>("title_text")->setValue(LLSD(format)); } else { setTitle(getString("top_colliders_title")); list->setColumnLabel("score", getString("colliders_score_label")); list->setColumnLabel("mono_time", ""); LLUIString format = getString("top_colliders_text"); format.setArg("[COUNT]", llformat("%d", total_count)); getChild<LLUICtrl>("title_text")->setValue(LLSD(format)); } }
// static void LLFloaterBuy::show(const LLSaleInfo& sale_info) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getRootObjectCount() != 1) { LLNotifications::instance().add("BuyOneObjectOnly"); return; } // Create a new instance only if one doesn't exist if (sInstance) { // Clean up the lists... sInstance->reset(); } else { sInstance = new LLFloaterBuy(); } sInstance->open(); /*Flawfinder: ignore*/ sInstance->setFocus(TRUE); sInstance->mSaleInfo = sale_info; sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); // Always center the dialog. User can change the size, // but purchases are important and should be center screen. // This also avoids problems where the user resizes the application window // mid-session and the saved rect is off-center. sInstance->center(); LLSelectNode* node = selection->getFirstRootNode(); if (!node) return; // Set title based on sale type LLUIString title; switch (sale_info.getSaleType()) { case LLSaleInfo::FS_ORIGINAL: title = sInstance->getString("title_buy_text"); break; case LLSaleInfo::FS_COPY: default: title = sInstance->getString("title_buy_copy_text"); break; } title.setArg("[NAME]", node->mName); sInstance->setTitle(title); LLUUID owner_id; std::string owner_name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotifications::instance().add("BuyObjectOneOwner"); return; } LLCtrlListInterface *object_list = sInstance->childGetListInterface("object_list"); if (!object_list) { return; } // Update the display // Display next owner permissions LLSD row; // Compute icon for this item std::string icon_name = get_item_icon_name(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT, 0x0, FALSE); row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["color"] = gColors.getColor("DefaultListIcon").getValue(); row["columns"][0]["value"] = icon_name; // Append the permissions that you will acquire (not the current // permissions). U32 next_owner_mask = node->mPermissions->getMaskNextOwner(); std::string text = node->mName; if (!(next_owner_mask & PERM_COPY)) { text.append(sInstance->getString("no_copy_text")); } if (!(next_owner_mask & PERM_MODIFY)) { text.append(sInstance->getString("no_modify_text")); } if (!(next_owner_mask & PERM_TRANSFER)) { text.append(sInstance->getString("no_transfer_text")); } row["columns"][1]["column"] = "text"; row["columns"][1]["color"] = gColors.getColor("DefaultListText").getValue(); row["columns"][1]["value"] = text; row["columns"][1]["font"] = "SANSSERIF"; // Add after columns added so appropriate heights are correct. object_list->addElement(row); sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice())); sInstance->childSetTextArg("buy_text", "[NAME]", owner_name); // Must do this after the floater is created, because // sometimes the inventory is already there and // the callback is called immediately. LLViewerObject* obj = selection->getFirstRootObject(); sInstance->registerVOInventoryListener(obj,NULL); sInstance->requestVOInventory(); }
// static void LLPanelClassifiedInfo::setClickThrough( const LLUUID& classified_id, S32 teleport, S32 map, S32 profile, bool from_new_table) { LL_INFOS() << "Click-through data for classified " << classified_id << " arrived: [" << teleport << ", " << map << ", " << profile << "] (" << (from_new_table ? "new" : "old") << ")" << LL_ENDL; for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { LLPanelClassifiedInfo* self = *iter; if (self->getClassifiedId() != classified_id) { continue; } // *HACK: Skip LLPanelClassifiedEdit instances: they don't display clicks data. // Those instances should not be in the list at all. if (typeid(*self) != typeid(LLPanelClassifiedInfo)) { continue; } LL_INFOS() << "Updating classified info panel" << LL_ENDL; // We need to check to see if the data came from the new stat_table // or the old classified table. We also need to cache the data from // the two separate sources so as to display the aggregate totals. if (from_new_table) { self->mTeleportClicksNew = teleport; self->mMapClicksNew = map; self->mProfileClicksNew = profile; } else { self->mTeleportClicksOld = teleport; self->mMapClicksOld = map; self->mProfileClicksOld = profile; } static LLUIString ct_str = self->getString("click_through_text_fmt"); ct_str.setArg("[TELEPORT]", llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld)); ct_str.setArg("[MAP]", llformat("%d", self->mMapClicksNew + self->mMapClicksOld)); ct_str.setArg("[PROFILE]", llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld)); self->getChild<LLUICtrl>("click_through_text")->setValue(ct_str.getString()); // *HACK: remove this when there is enough room for click stats in the info panel self->getChildView("click_through_text")->setToolTip(ct_str.getString()); LL_INFOS() << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld) << ", map: " << llformat("%d", self->mMapClicksNew + self->mMapClicksOld) << ", profile: " << llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld) << LL_ENDL; } }
void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) { U32 request_flags; U32 total_count; msg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags); msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count); msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode); LLScrollListCtrl *list = getChild<LLScrollListCtrl>("objects_list"); S32 block_count = msg->getNumberOfBlocks("ReportData"); for (S32 block = 0; block < block_count; ++block) { U32 task_local_id; U32 time_stamp = 0; LLUUID task_id; F32 location_x, location_y, location_z; F32 score; std::string name_buf; std::string owner_buf; F32 mono_score = 0.f; bool have_extended_data = false; S32 public_urls = 0; msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block); msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block); msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block); if(msg->has("DataExtended")) { have_extended_data = true; msg->getU32("DataExtended", "TimeStamp", time_stamp, block); msg->getF32("DataExtended", "MonoScore", mono_score, block); msg->getS32(_PREHASH_ReportData,"PublicURLs",public_urls,block); } LLSD element; element["id"] = task_id; element["object_name"] = name_buf; element["owner_name"] = owner_buf; element["columns"][0]["column"] = "score"; element["columns"][0]["value"] = llformat("%0.3f", score); element["columns"][0]["font"] = "SANSSERIF"; element["columns"][1]["column"] = "name"; element["columns"][1]["value"] = name_buf; element["columns"][1]["font"] = "SANSSERIF"; element["columns"][2]["column"] = "owner"; element["columns"][2]["value"] = owner_buf; element["columns"][2]["font"] = "SANSSERIF"; element["columns"][3]["column"] = "location"; element["columns"][3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z); element["columns"][3]["font"] = "SANSSERIF"; element["columns"][4]["column"] = "time"; element["columns"][4]["value"] = formatted_time((time_t)time_stamp); element["columns"][4]["font"] = "SANSSERIF"; if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS && have_extended_data) { element["columns"][5]["column"] = "mono_time"; element["columns"][5]["value"] = llformat("%0.3f", mono_score); element["columns"][5]["font"] = "SANSSERIF"; element["columns"][6]["column"] = "URLs"; element["columns"][6]["value"] = llformat("%d", public_urls); element["columns"][6]["font"] = "SANSSERIF"; } list->addElement(element); mObjectListData.append(element); mObjectListIDs.push_back(task_id); mtotalScore += score; } if (total_count == 0 && list->getItemCount() == 0) { list->addCommentText(getString("none_descriptor")); } else { list->selectFirstItem(); } if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS) { setTitle(getString("top_scripts_title")); list->setColumnLabel("score", getString("scripts_score_label")); list->setColumnLabel("mono_time", getString("scripts_mono_time_label")); LLUIString format = getString("top_scripts_text"); format.setArg("[COUNT]", llformat("%d", total_count)); format.setArg("[TIME]", llformat("%0.1f", mtotalScore)); childSetValue("title_text", LLSD(format)); } else { setTitle(getString("top_colliders_title")); list->setColumnLabel("score", getString("colliders_score_label")); list->setColumnLabel("mono_time", ""); LLUIString format = getString("top_colliders_text"); format.setArg("[COUNT]", llformat("%d", total_count)); childSetValue("title_text", LLSD(format)); } }
// static void LLFloaterBuy::show(const LLSaleInfo& sale_info) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getRootObjectCount() != 1) { LLNotificationsUtil::add("BuyOneObjectOnly"); return; } LLFloaterBuy* floater = LLFloaterReg::showTypedInstance<LLFloaterBuy>("buy_object"); if (!floater) return; // Clean up the lists... floater->reset(); floater->mSaleInfo = sale_info; floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); LLSelectNode* node = selection->getFirstRootNode(); if (!node) return; // Set title based on sale type LLUIString title; switch (sale_info.getSaleType()) { case LLSaleInfo::FS_ORIGINAL: title = floater->getString("title_buy_text"); break; case LLSaleInfo::FS_COPY: default: title = floater->getString("title_buy_copy_text"); break; } title.setArg("[NAME]", node->mName); floater->setTitle(title); LLUUID owner_id; std::string owner_name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotificationsUtil::add("BuyObjectOneOwner"); return; } LLCtrlListInterface *object_list = floater->childGetListInterface("object_list"); if (!object_list) { return; } // Update the display // Display next owner permissions LLSD row; // Compute icon for this item std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT, LLInventoryType::IT_OBJECT); row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = icon_name; // Append the permissions that you will acquire (not the current // permissions). U32 next_owner_mask = node->mPermissions->getMaskNextOwner(); std::string text = node->mName; if (!(next_owner_mask & PERM_COPY)) { text.append(floater->getString("no_copy_text")); } if (!(next_owner_mask & PERM_MODIFY)) { text.append(floater->getString("no_modify_text")); } if (!(next_owner_mask & PERM_TRANSFER)) { text.append(floater->getString("no_transfer_text")); } row["columns"][1]["column"] = "text"; row["columns"][1]["value"] = text; row["columns"][1]["font"] = "SANSSERIF"; // Add after columns added so appropriate heights are correct. object_list->addElement(row); floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice())); floater->getChild<LLUICtrl>("buy_name_text")->setTextArg("[NAME]", owner_name); // Must do this after the floater is created, because // sometimes the inventory is already there and // the callback is called immediately. LLViewerObject* obj = selection->getFirstRootObject(); floater->registerVOInventoryListener(obj,NULL); floater->requestVOInventory(); }
void PanelRadar::updateRadarDisplay() { if (visibleItemsSelected()) { mSelectedAvatar = mRadarList->getFirstSelected()->getUUID(); //TODO: as we expand columns, make these numbers enums mSelectedDistance = mRadarList->getFirstSelected()->getColumn(1)->getValue().asReal(); } else { mSelectedAvatar.setNull(); mSelectedDistance = -1.0f; } S32 scroll_pos = mRadarList->getScrollPos(); LLSD element; // Zap all the avie names. Zap zap zap! mRadarList->deleteAllItems(); U32 chat_distance = gSavedSettings.getU32("ChatDistance"); F32 range = gSavedSettings.getF32("NearMeRange"); bool notify_chat = gSavedSettings.getBOOL("MiniMapNotifyChatRange"); bool notify_sim = gSavedSettings.getBOOL("MiniMapNotifySimRange"); // [RLVa:KB] - Alternate: Imprudence-1.2.0 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { notify_chat = false; notify_sim = false; } // [/RLVa:KB] std::map<LLUUID, PanelRadarEntry>::iterator mIt; for (mIt = mAvatars.begin(); mIt != mAvatars.end(); ++mIt) { PanelRadarEntry* entry = &mIt->second; LL_DEBUGS("Radar") << "Avatar :" << entry->getName() << " Position: " << entry->getPosition() << " Your Position: " << gAgent.getPositionGlobal() << " Distance: " << entry->getDistance() << " Status: " << entry->getStatus() << " Notified: " << entry->getNotified() << " Timer Seconds: " << entry->getStatusTimer().getElapsedTimeF32() << LL_ENDL; // Check if they're in certain ranges and notify user if we've enabled that, starting with chat range // We round for accuracy when avs tp in std::string dist_string = llformat("%.1f", llround(entry->getDistance(), 0.1f)); // Don't notify if we don't know their name. It takes a few seconds for names to load on OpenSim, anyway if (entry->getName() != getString("unknown_avatar")) { if (notify_sim && (entry->getNotified() < RADAR_NOTIFIED_SIM)) { LLViewerObject *av_obj = gObjectList.findObject(entry->getID()); if (av_obj != NULL && av_obj->isAvatar()) { LLVOAvatar* avatarp = (LLVOAvatar*)av_obj; if (avatarp != NULL) { if (avatarp->getRegion() == gAgent.getRegion()) { LLChat chat; LLUIString notify = getString("entering_sim_range"); notify.setArg("[NAME]", entry->getName()); notify.setArg("[DISTANCE]", dist_string); chat.mText = notify; chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChat(chat, FALSE, FALSE); entry->setNotified(RADAR_NOTIFIED_SIM); } } } } else if (notify_chat && (entry->getDistance() < chat_distance) && (entry->getNotified() < RADAR_NOTIFIED_CHAT)) { LLChat chat; LLUIString notify = getString("entering_chat_range"); notify.setArg("[NAME]", entry->getName()); notify.setArg("[DISTANCE]", dist_string); chat.mText = notify; chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChat(chat, FALSE, FALSE); entry->setNotified(RADAR_NOTIFIED_CHAT); } } // Only display avatars in range if (entry->getDistance() <= range) { // Append typing string std::string typing = ""; if (entry->getStatus() == RADAR_STATUS_TYPING) { typing = getString("is_typing")+ " "; } std::string mute_text = LLMuteList::getInstance()->isMuted(entry->getID()) ? getString("is_muted") : ""; element["id"] = entry->getID(); element["columns"][0]["column"] = "avatar_name"; element["columns"][0]["type"] = "text"; // element["columns"][0]["value"] = typing + entry->getName() + " " + mute_text; // [RLVa:KB] - Alternate: Imprudence-1.2.0 element["columns"][0]["value"] = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? gRlvHandler.getAnonym(entry->getName()) : typing + entry->getName() + " " + mute_text; // [/RLVa:KB] element["columns"][1]["column"] = "avatar_distance"; element["columns"][1]["type"] = "text"; element["columns"][1]["value"] = dist_string+"m"; mRadarList->addElement(element, ADD_BOTTOM); } } mRadarList->sortItems(); mRadarList->setScrollPos(scroll_pos); if (mSelectedAvatar.notNull()) { mRadarList->selectByID(mSelectedAvatar); } LLUIString av_count_string = (mRadarList->getItemCount() == 1) ? getString("avatars_in_singular") : getString("avatars_in_plural"); av_count_string.setArg("[COUNT]", llformat("%d", mRadarList->getItemCount())); childSetText("avatar_count", av_count_string.getString()); updateButtonStates(); LL_DEBUGS("Radar") << "mSelectedAvatar: " << mSelectedAvatar.asString() << LL_ENDL; }