void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. LLDynamicArray<const char*> names; InventoryObjectList::const_iterator it = inv->begin(); InventoryObjectList::const_iterator end = inv->end(); for ( ; it != end; ++it) { if((*it)->getType() == LLAssetType::AT_LSL_TEXT) { LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); std::string buffer; buffer = std::string("Not running: ") +item->getName(); // *TODO: Translate list->addCommentText(buffer); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_SetScriptRunning); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Script); msg->addUUIDFast(_PREHASH_ObjectID, viewer_obj->getID()); msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID()); msg->addBOOLFast(_PREHASH_Running, FALSE); msg->sendReliable(object->getRegion()->getHost()); } } } nextObject(); }
void LLPanelDirBrowser::setupNewSearch() { LLScrollListCtrl* list = getChild<LLScrollListCtrl>("results"); gDirBrowserInstances.removeData(mSearchID); // Make a new query ID mSearchID.generate(); gDirBrowserInstances.addData(mSearchID, this); // ready the list for results list->operateOnAll(LLCtrlListInterface::OP_DELETE); list->addCommentText(std::string("Searching...")); // *TODO: Translate childDisable("results"); mResultsReceived = 0; mHaveSearchResults = FALSE; // Set all panels to be invisible mFloaterDirectory->hideAllDetailPanels(); updateResultCount(); }
BOOL LLFloaterScriptQueue::start() { //llinfos << "LLFloaterCompileQueue::start()" << llendl; std::string buffer; LLSelectMgr *mgr = LLSelectMgr::getInstance(); LLObjectSelectionHandle selectHandle = mgr->getSelection(); U32 n_objects = 0; if (gSavedSettings.getBOOL("EditLinkedParts")) { n_objects = selectHandle->getObjectCount(); } else { n_objects = selectHandle->getRootObjectCount(); } buffer = llformat("Starting %s of %d items.", mStartString.c_str(), n_objects); // *TODO: Translate LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); list->addCommentText(buffer); return nextObject(); }
// protected void LLPanelDirBrowser::updateResultCount() { LLScrollListCtrl* list = getChild<LLScrollListCtrl>("results"); S32 result_count = list->getItemCount(); std::string result_text; if (!mHaveSearchResults) result_count = 0; if (childIsVisible("Next >")) { // Item count be off by a few if bogus items sent from database // Just use the number of results per page. JC result_text = llformat(">%d found", mResultsPerPage); } else { result_text = llformat("%d found", result_count); } childSetValue("result_text", result_text); if (result_count == 0) { // add none found response if (list->getItemCount() == 0) { list->addCommentText(std::string("None found.")); // *TODO: Translate list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } } else { childEnable("results"); } }
void LLFloaterWorldMap::updateSims(bool found_null_sim) { if (mCompletingRegionName == "") { return; } LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLSD selected_value = list->getSelectedValue(); S32 name_length = mCompletingRegionName.length(); BOOL match_found = FALSE; S32 num_results = 0; std::map<U64, LLSimInfo*>::const_iterator it; for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { LLSimInfo* info = (*it).second; std::string sim_name = info->mName; std::string sim_name_lower = sim_name; LLStringUtil::toLower(sim_name_lower); if (sim_name_lower.substr(0, name_length) == mCompletingRegionName) { if (LLWorldMap::getInstance()->mIsTrackingCommit) { if (sim_name_lower == mCompletingRegionName) { selected_value = sim_name; match_found = TRUE; } } LLSD value; value["id"] = sim_name; value["columns"][0]["column"] = "sim_name"; value["columns"][0]["value"] = sim_name; list->addElement(value); num_results++; } } list->selectByValue(selected_value); if (found_null_sim) { mCompletingRegionName = ""; } if (match_found) { mExactMatch = TRUE; childSetFocus("search_results"); onCommitSearchResult(NULL, this); } else if (!mExactMatch && num_results > 0) { list->selectFirstItem(); // select first item by default childSetFocus("search_results"); onCommitSearchResult(NULL, this); } else { list->addCommentText(std::string("None found.")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } }
// This is the callback for when each script arrives // static void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { llinfos << "LLFloaterCompileQueue::scriptArrived()" << llendl; LLScriptQueueData* data = (LLScriptQueueData*)user_data; if(!data) return; LLFloaterCompileQueue* queue = static_cast<LLFloaterCompileQueue*> (LLFloaterScriptQueue::findInstance(data->mQueueID)); std::string buffer; if(queue && (0 == status)) { //llinfos << "ITEM NAME 3: " << data->mScriptName << llendl; // Dump this into a file on the local disk so we can compile it. std::string filename; LLVFile file(vfs, asset_id, type); std::string uuid_str; asset_id.toString(uuid_str); filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + llformat(".%s",LLAssetType::lookup(type)); const bool is_running = true; LLViewerObject* object = gObjectList.findObject(data->mTaskId); if (object) { std::string url = object->getRegion()->getCapability("UpdateScriptTask"); if(!url.empty()) { // Read script source in to buffer. U32 script_size = file.getSize(); U8* script_data = new U8[script_size]; file.read(script_data, script_size); queue->mUploadQueue->queue(filename, data->mTaskId, data->mItemId, is_running, queue->mMono, queue->getID(), script_data, script_size, data->mScriptName); } else { // It's now in the file, now compile it. buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate // Write script to local file for compilation. LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (fp) { const S32 buf_size = 65536; U8 copy_buf[buf_size]; while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/ { if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1) { // return a bad file error if we can't write the whole thing status = LL_ERR_CANNOT_OPEN_FILE; } } fclose(fp); } else { llwarns << "Unable to find object to compile" << llendl; // why an error? KL } // TODO: babbage: No compile if no cap. queue->compile(filename, data->mItemId); // Delete it after we're done compiling? LLFile::remove(filename); } } } else { LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { LLChat chat(std::string("Script not found on server.")); // *TODO: Translate LLFloaterChat::addChat(chat); buffer = std::string("Problem downloading: ") + data->mScriptName; // *TODO: Translate } else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) { LLChat chat(std::string("Insufficient permissions to download a script.")); // *TODO: Translate LLFloaterChat::addChat(chat); buffer = std::string("Insufficient permissions for: ") + data->mScriptName; // *TODO: Translate } else { buffer = std::string("Unknown failure to download ") + data->mScriptName; // *TODO: Translate } llwarns << "Problem downloading script asset." << llendl; if(queue) queue->removeItemByItemID(data->mItemId); } if(queue && (buffer.size() > 0)) { LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output"); list->addCommentText(buffer); } delete data; }
void LLFloaterClothing::buildClothingList() { //llinfos << "buildClothingList" << llendl; LLScrollListCtrl* list = gUICtrlFactory->getScrollListByName(this, "clothing_list"); if (!list) return; list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLIsClothing is_clothing; gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_clothing); S32 count = items.count(); for(S32 i = 0; i < count; ++i) { LLInventoryItem* item = items.get(i); LLSD row; row["id"] = item->getUUID(); BOOL item_is_multi = FALSE; if ( item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) { item_is_multi = TRUE; } LLUUID image_id = get_item_icon_uuid(item->getType(), item->getInventoryType(), item->getFlags(), item_is_multi); // flags = wearable type row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = image_id; LLString text = item->getName(); LLString style = "NORMAL"; if( gAgent.isWearingItem( item->getUUID() ) ) { text.append(" (worn)"); style = "BOLD"; } row["columns"][1]["column"] = "name"; row["columns"][1]["value"] = text; row["columns"][1]["font"] = "SANSSERIFSMALL"; row["columns"][1]["font-style"] = style; // hidden column for sorting U32 flags = item->getFlags(); // flags = wearable type enum EWearableType wearable_type = (enum EWearableType)flags; const char* wearable_label = LLWearable::typeToTypeLabel(wearable_type); //line->addColumn(wearable_label, FONT, -1); // invisible row["columns"][2]["column"] = "sort"; row["columns"][2]["value"] = wearable_label; list->addElement(row); } if (count > 0) { mAllowSelection = TRUE; } else if (LLInventoryModel::backgroundFetchActive()) { // We're loading list->addCommentText(LOADING_STRING); mAllowSelection = FALSE; } else { // Weird case, we're done loading but have no clothing list->addCommentText("No clothing found."); mAllowSelection = FALSE; } }
void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. llinfos<<"handleInventory"<<llendl; char buffer[MAX_STRING]; /*Flawfinder: ignore*/ LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); InventoryObjectList::const_iterator it = inv->begin(); InventoryObjectList::const_iterator end = inv->end(); for ( ; it != end; ++it) { llinfos<<"Doing iterator of inventory"<<llendl; if( ( (*it)->getType() == LLAssetType::AT_LSL_TEXT && processScript) || ( (*it)->getType() == LLAssetType::AT_TEXTURE && processTexture) || ( (*it)->getType() == LLAssetType::AT_SOUND && processSound) || ( (*it)->getType() == LLAssetType::AT_LANDMARK && processLandmark) || ( (*it)->getType() == LLAssetType::AT_CLOTHING && processClothing) || ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject) || ( (*it)->getType() == LLAssetType::AT_NOTECARD && processNotecard) || ( (*it)->getType() == LLAssetType::AT_BODYPART && processBodypart) || ( (*it)->getType() == LLAssetType::AT_ANIMATION && processAnimation) || ( (*it)->getType() == LLAssetType::AT_GESTURE && processGesture)) { LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)item; LLPermissions perm(new_item->getPermissions()); // chomp the inventory name so it fits in the scroll window nicely // and the user can see the [OK] std::string invname; invname=item->getName().substr(0,item->getName().size() < 30 ? item->getName().size() : 30 ); // My attempt at checking valid permissions, CHECK ME // note its not actually bad to try to set permissions that are not allowed as the // server will protect against this, but it will piss the user off if its wrong if( (perm.getCreator()==gAgentID) || (perm.getMaskOwner() & PERM_TRANSFER) && (perm.getMaskOwner() & PERM_MODIFY) || (gAgent.getGroupID()==perm.getGroup() && (perm.getMaskGroup() & PERM_TRANSFER) && (perm.getMaskGroup() & PERM_MODIFY)) ){ llinfos<<"Setting perms"<<llendl; perm.setMaskNext(req_perm_mask); new_item->setPermissions(perm); updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE); snprintf(buffer, sizeof(buffer), "Setting perms on '%s' [OK]", invname.c_str()); /* Flawfinder: ignore */ } else { llinfos<<"NOT setting perms"<<llendl; snprintf(buffer, sizeof(buffer), "Setting perms on '%s' [FAILED]", invname.c_str()); /* Flawfinder: ignore */ } list->addCommentText(buffer); if(recurse && ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject)) { //Add this object back to the queue to be processed as it has inventory snprintf(buffer, sizeof(buffer), "Queueing object '%s' for open", invname.c_str()); llwarns << "Queueing object "<< invname.c_str() << " ID "<< (*it)->getUUID()<<llendl; mObjectIDs.put((*it)->getUUID()); // This will not YET work. as this is not a viewer object the unpack will fail } } } } nextObject(); }
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)); } }
void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv) { LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); InventoryObjectList::const_iterator it = inv->begin(); InventoryObjectList::const_iterator end = inv->end(); for ( ; it != end; ++it) { LLAssetType::EType asstype = (*it)->getType(); if( ( asstype == LLAssetType::AT_ANIMATION && gSavedSettings.getBOOL("BulkChangeIncludeAnimations")) || ( asstype == LLAssetType::AT_BODYPART && gSavedSettings.getBOOL("BulkChangeIncludeBodyParts" )) || ( asstype == LLAssetType::AT_CLOTHING && gSavedSettings.getBOOL("BulkChangeIncludeClothing" )) || ( asstype == LLAssetType::AT_GESTURE && gSavedSettings.getBOOL("BulkChangeIncludeGestures" )) || ( asstype == LLAssetType::AT_LANDMARK && gSavedSettings.getBOOL("BulkChangeIncludeLandmarks" )) || ( asstype == LLAssetType::AT_NOTECARD && gSavedSettings.getBOOL("BulkChangeIncludeNotecards" )) || ( asstype == LLAssetType::AT_OBJECT && gSavedSettings.getBOOL("BulkChangeIncludeObjects" )) || ( asstype == LLAssetType::AT_LSL_TEXT && gSavedSettings.getBOOL("BulkChangeIncludeScripts" )) || ( asstype == LLAssetType::AT_SOUND && gSavedSettings.getBOOL("BulkChangeIncludeSounds" )) || ( asstype == LLAssetType::AT_TEXTURE && gSavedSettings.getBOOL("BulkChangeIncludeTextures" ))) { LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLViewerInventoryItem* new_item = (LLViewerInventoryItem*)item; LLPermissions perm(new_item->getPermissions()); U32 flags = new_item->getFlags(); U32 desired_next_owner_perms = LLFloaterPerms::getNextOwnerPerms("BulkChange"); U32 desired_everyone_perms = LLFloaterPerms::getEveryonePerms("BulkChange"); U32 desired_group_perms = LLFloaterPerms::getGroupPerms("BulkChange"); // If next owner permissions have changed (and this is an object) // then set the slam permissions flag so that they are applied on rez. if((perm.getMaskNextOwner() != desired_next_owner_perms) && (new_item->getType() == LLAssetType::AT_OBJECT)) { flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; } // If everyone permissions have changed (and this is an object) // then set the overwrite everyone permissions flag so they // are applied on rez. if ((perm.getMaskEveryone() != desired_everyone_perms) && (new_item->getType() == LLAssetType::AT_OBJECT)) { flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; } // If group permissions have changed (and this is an object) // then set the overwrite group permissions flag so they // are applied on rez. if ((perm.getMaskGroup() != desired_group_perms) && (new_item->getType() == LLAssetType::AT_OBJECT)) { flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } // chomp the inventory name so it fits in the scroll window nicely // and the user can see the [OK] std::string invname; invname=item->getName().substr(0,item->getName().size() < 30 ? item->getName().size() : 30 ); LLUIString status_text = getString("status_text"); status_text.setArg("[NAME]", invname.c_str()); // Check whether we appear to have the appropriate permissions to change permission on this item. // Although the server will disallow any forbidden changes, it is a good idea to guess correctly // so that we can warn the user. The risk of getting this check wrong is therefore the possibility // of incorrectly choosing to not attempt to make a valid change. // // Trouble is this is extremely difficult to do and even when we know the results // it is difficult to design the best messaging. Therefore in this initial implementation // we'll always try to set the requested permissions and consider all cases successful // and perhaps later try to implement a smarter, friendlier solution. -MG if(true //gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE) // for group and everyone masks //|| something else // for next owner perms ) { perm.setMaskNext(desired_next_owner_perms); perm.setMaskEveryone(desired_everyone_perms); perm.setMaskGroup(desired_group_perms); new_item->setPermissions(perm); // here's the beef new_item->setFlags(flags); // and the tofu updateInventory(object,new_item,TASK_INVENTORY_ITEM_KEY,FALSE); //status_text.setArg("[STATUS]", getString("status_ok_text")); status_text.setArg("[STATUS]", ""); } else { //status_text.setArg("[STATUS]", getString("status_bad_text")); status_text.setArg("[STATUS]", ""); } list->addCommentText(status_text.getString()); //TODO if we are an object inside an object we should check a recuse flag and if set //open the inventory of the object and recurse - Michelle2 Zenovka // if(recurse && ( (*it)->getType() == LLAssetType::AT_OBJECT && processObject)) // { // I think we need to get the UUID of the object inside the inventory // call item->fetchFromServer(); // we need a call back to say item has arrived *sigh* // we then need to do something like // LLUUID* id = new LLUUID(mID); // registerVOInventoryListener(obj,id); // requestVOInventory(); // } } } } nextObject(); }