//static
void LLFloaterBlacklist::addEntry(LLUUID key, LLSD data)
{
	if(key.notNull())
	{
		if(!data.has("entry_type")) 
			LL_WARNS("FloaterBlacklistAdd") << "addEntry called with no entry type, specify LLAssetType::Etype" << LL_ENDL;
		else if(!data.has("entry_name"))
			LL_WARNS("FloaterBlacklistAdd") << "addEntry called with no entry name, specify the name that should appear in the listing for this entry." << LL_ENDL;
		else
		{
			if(!data.has("entry_date"))
			{
				LLDate* curdate = new LLDate(time_corrected());
				std::string input_date = curdate->asString();
				input_date.replace(input_date.find("T"),1," ");
				input_date.resize(input_date.size() - 1);
				data["entry_date"] = input_date;
			}
			if(data["entry_type"].asString() == "1")
			{
			  //remove sounds
			  LLUUID sound_id=LLUUID(key);
			  gVFS->removeFile(sound_id,LLAssetType::AT_SOUND);
			  std::string wav_path= gDirUtilp->getExpandedFilename(LL_PATH_CACHE,sound_id.asString()) + ".dsf";
			  if(LLAPRFile::isExist(wav_path, LL_APR_RPB))
				LLAPRFile::remove(wav_path);
			  gAudiop->removeAudioData(sound_id);
			}
			blacklist_entries.insert(std::pair<LLUUID,LLSD>(key,data));
			updateBlacklists();
		}
	}
	else
		LL_WARNS("FloaterBlacklistAdd") << "addEntry called with a null entry key, please specify LLUUID of asset." << LL_ENDL;
}
// 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();
		
	}
}
// static
void LLFloaterBlacklist::loadFromSave()
{
	std::string file_name = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "blacklist_sg1.xml");
	llifstream xml_file(file_name);
	if(!xml_file.is_open()) return;
	LLSD data;
	if(LLSDSerialize::fromXML(data, xml_file) >= 1)
	{
		for(LLSD::map_iterator iter = data.beginMap(); iter != data.endMap(); ++iter)
		{
			blacklist_entries.insert(std::pair<LLUUID,LLSD>(LLUUID(iter->first),iter->second));
		}
		updateBlacklists();
	}
	xml_file.close();
}
void LLFloaterBlacklist::onClickLoad_continued(AIFilePicker* filepicker)
{
	if (filepicker->hasFilename())
	{
		std::string file_name = filepicker->getFilename();
		llifstream xml_file(file_name);
		if(!xml_file.is_open()) return;
		LLSD data;
		if(LLSDSerialize::fromXML(data, xml_file) >= 1)
		{
			for(LLSD::map_iterator iter = data.beginMap(); iter != data.endMap(); ++iter)
			{
				blacklist_entries.insert(std::pair<LLUUID,LLSD>(LLUUID(iter->first),iter->second));
			}
			updateBlacklists();
		}
		xml_file.close();
	}
}
Exemple #5
0
// static
void LLFloaterBlacklist::onClickRemove(void* user_data)
{
	LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
	LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list");
	if(list->getFirstSelected())
	{
		uuid_vec_t selectedIDs = list->getSelectedIDs();
		typename uuid_vec_t::const_iterator iterator;
		for(iterator  = selectedIDs.begin();
		    iterator != selectedIDs.end();
		    ++iterator)
		{
			LLUUID selectedID = *iterator;
			blacklist_entries.erase(selectedID);
		}
		list->deleteSelectedItems();
		updateBlacklists();
	}
}
// static
void LLFloaterBlacklist::onClickClear(void* user_data)
{
	blacklist_entries.clear();
	updateBlacklists();
}