Cleanup unused things
This commit is contained in:
@@ -256,8 +256,6 @@ set(viewer_SOURCE_FILES
|
||||
llfloatertos.cpp
|
||||
llfloaterurldisplay.cpp
|
||||
llfloaterurlentry.cpp
|
||||
llfloatervfs.cpp
|
||||
llfloatervfsexplorer.cpp
|
||||
llfloatervoicedevicesettings.cpp
|
||||
llfloaterwater.cpp
|
||||
llfloaterwindlight.cpp
|
||||
@@ -757,8 +755,6 @@ set(viewer_HEADER_FILES
|
||||
llfloatertos.h
|
||||
llfloaterurldisplay.h
|
||||
llfloaterurlentry.h
|
||||
llfloatervfs.h
|
||||
llfloatervfsexplorer.h
|
||||
llfloatervoicedevicesettings.h
|
||||
llfloaterwater.h
|
||||
llfloaterwindlight.h
|
||||
|
||||
@@ -1,374 +0,0 @@
|
||||
// <edit>
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llfloatervfs.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
#include "lllocalinventory.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llassetconverter.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llimagej2c.h"
|
||||
|
||||
LLFloaterVFS* LLFloaterVFS::sInstance;
|
||||
std::list<LLFloaterVFS::entry> LLFloaterVFS::mFiles;
|
||||
LLFloaterVFS::LLFloaterVFS()
|
||||
: LLFloater(),
|
||||
mEditID(LLUUID::null)
|
||||
{
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_vfs.xml");
|
||||
}
|
||||
LLFloaterVFS::~LLFloaterVFS()
|
||||
{
|
||||
sInstance = NULL;
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::show()
|
||||
{
|
||||
if(sInstance)
|
||||
sInstance->open();
|
||||
else
|
||||
{
|
||||
sInstance = new LLFloaterVFS();
|
||||
sInstance->open();
|
||||
}
|
||||
}
|
||||
BOOL LLFloaterVFS::postBuild()
|
||||
{
|
||||
childSetAction("add_btn", onClickAdd, this);
|
||||
childSetAction("clear_btn", onClickClear, this);
|
||||
childSetAction("reload_all_btn", onClickReloadAll, this);
|
||||
childSetCommitCallback("file_list", onCommitFileList, this);
|
||||
childSetCommitCallback("name_edit", onCommitEdit, this);
|
||||
childSetCommitCallback("id_edit", onCommitEdit, this);
|
||||
childSetCommitCallback("type_combo", onCommitEdit, this);
|
||||
childSetAction("copy_uuid_btn", onClickCopyUUID, this);
|
||||
childSetAction("item_btn", onClickItem, this);
|
||||
childSetAction("reload_btn", onClickReload, this);
|
||||
childSetAction("remove_btn", onClickRemove, this);
|
||||
refresh();
|
||||
return TRUE;
|
||||
}
|
||||
void LLFloaterVFS::refresh()
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
|
||||
list->clearRows();
|
||||
std::list<entry>::iterator end = mFiles.end();
|
||||
for(std::list<entry>::iterator iter = mFiles.begin(); iter != end; ++iter)
|
||||
{
|
||||
entry file = (*iter);
|
||||
LLSD element;
|
||||
element["id"] = file.mID;
|
||||
LLSD& name_column = element["columns"][0];
|
||||
name_column["column"] = "name";
|
||||
name_column["value"] = file.mName.empty() ? file.mID.asString() : file.mName;
|
||||
LLSD& type_column = element["columns"][1];
|
||||
type_column["column"] = "type";
|
||||
type_column["value"] = std::string(LLAssetType::lookup(file.mType));
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
}
|
||||
setMassEnabled(!mFiles.empty());
|
||||
setEditID(mEditID);
|
||||
}
|
||||
void LLFloaterVFS::add(entry file)
|
||||
{
|
||||
mFiles.push_back(file);
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFS::clear()
|
||||
{
|
||||
std::list<entry>::iterator end = mFiles.end();
|
||||
for(std::list<entry>::iterator iter = mFiles.begin(); iter != end; ++iter)
|
||||
{
|
||||
gVFS->removeFile((*iter).mID, (*iter).mType);
|
||||
}
|
||||
mFiles.clear();
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFS::reloadAll()
|
||||
{
|
||||
std::list<entry>::iterator end = mFiles.end();
|
||||
for(std::list<entry>::iterator iter = mFiles.begin(); iter != end; ++iter)
|
||||
{
|
||||
entry file = (*iter);
|
||||
reloadEntry(file);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFS::reloadEntry(entry file)
|
||||
{
|
||||
LLUUID asset_id = file.mID;
|
||||
LLAssetType::EType asset_type = file.mType;
|
||||
gVFS->removeFile(file.mID, file.mType);
|
||||
std::string file_name = file.mFilename;
|
||||
S32 file_size;
|
||||
LLAPRFile fp(file_name, LL_APR_RB, &file_size);
|
||||
if(fp.getFileHandle())
|
||||
{
|
||||
LLVFile file(gVFS, asset_id, asset_type, LLVFile::WRITE);
|
||||
file.setMaxSize(file_size);
|
||||
const S32 buf_size = 65536;
|
||||
U8 copy_buf[buf_size];
|
||||
while ((file_size = fp.read(copy_buf, buf_size)))
|
||||
file.write(copy_buf, file_size);
|
||||
fp.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// todo: show a warning, couldn't open the original file
|
||||
return;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFS::setEditID(LLUUID edit_id)
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
|
||||
bool found_in_list = (list->getItemIndex(edit_id) != -1);
|
||||
bool found_in_files = false;
|
||||
entry file;
|
||||
std::list<entry>::iterator end = mFiles.end();
|
||||
for(std::list<entry>::iterator iter = mFiles.begin(); iter != end; ++iter)
|
||||
{
|
||||
if((*iter).mID == edit_id)
|
||||
{
|
||||
found_in_files = true;
|
||||
file = (*iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found_in_files && found_in_list)
|
||||
{
|
||||
mEditID = edit_id;
|
||||
list->selectByID(edit_id);
|
||||
setEditEnabled(true);
|
||||
childSetText("name_edit", file.mName);
|
||||
childSetText("id_edit", file.mID.asString());
|
||||
childSetValue("type_combo", std::string(LLAssetType::lookup(file.mType)));
|
||||
}
|
||||
else
|
||||
{
|
||||
mEditID = LLUUID::null;
|
||||
list->deselectAllItems(TRUE);
|
||||
setEditEnabled(false);
|
||||
childSetText("name_edit", std::string(""));
|
||||
childSetText("id_edit", std::string(""));
|
||||
childSetValue("type_combo", std::string("animatn"));
|
||||
}
|
||||
}
|
||||
LLFloaterVFS::entry LLFloaterVFS::getEditEntry()
|
||||
{
|
||||
std::list<entry>::iterator end = mFiles.end();
|
||||
for(std::list<entry>::iterator iter = mFiles.begin(); iter != end; ++iter)
|
||||
{
|
||||
if((*iter).mID == mEditID)
|
||||
return (*iter);
|
||||
}
|
||||
entry file;
|
||||
file.mID = LLUUID::null;
|
||||
return file;
|
||||
}
|
||||
void LLFloaterVFS::commitEdit()
|
||||
{
|
||||
bool found = false;
|
||||
entry file;
|
||||
std::list<entry>::iterator iter;
|
||||
std::list<entry>::iterator end = mFiles.end();
|
||||
for(iter = mFiles.begin(); iter != end; ++iter)
|
||||
{
|
||||
if((*iter).mID == mEditID)
|
||||
{
|
||||
found = true;
|
||||
file = (*iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) return;
|
||||
entry edited_file;
|
||||
edited_file.mName = childGetValue("name_edit").asString();
|
||||
edited_file.mID = LLUUID(childGetValue("id_edit").asString());
|
||||
edited_file.mType = LLAssetType::lookup(getChild<LLComboBox>("type_combo")->getValue().asString());
|
||||
if((edited_file.mID != file.mID) || (edited_file.mType != file.mType))
|
||||
{
|
||||
gVFS->renameFile(file.mID, file.mType, edited_file.mID, edited_file.mType);
|
||||
mEditID = edited_file.mID;
|
||||
}
|
||||
|
||||
(*iter) = edited_file;
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFS::removeEntry()
|
||||
{
|
||||
for(std::list<entry>::iterator iter = mFiles.begin(); iter != mFiles.end(); )
|
||||
{
|
||||
if((*iter).mID == mEditID)
|
||||
{
|
||||
if((*iter).mType == LLAssetType::AT_TEXTURE)
|
||||
gTextureList.deleteImage(gTextureList.findImage( (*iter).mID ));
|
||||
else
|
||||
gVFS->removeFile((*iter).mID, (*iter).mType);
|
||||
iter = mFiles.erase(iter);
|
||||
}
|
||||
else ++iter;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFS::setMassEnabled(bool enabled)
|
||||
{
|
||||
childSetEnabled("clear_btn", enabled);
|
||||
childSetEnabled("reload_all_btn", enabled); // SHOULD WORK NOW!
|
||||
}
|
||||
void LLFloaterVFS::setEditEnabled(bool enabled)
|
||||
{
|
||||
childSetEnabled("name_edit", enabled);
|
||||
childSetEnabled("id_edit", false); // DOESN'T WORK
|
||||
childSetEnabled("type_combo", false); // DOESN'T WORK
|
||||
childSetEnabled("copy_uuid_btn", enabled);
|
||||
childSetEnabled("item_btn", enabled);
|
||||
childSetEnabled("reload_btn", enabled); // WORKS!
|
||||
childSetEnabled("remove_btn", enabled);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterVFS::onClickAdd(void* user_data)
|
||||
{
|
||||
if(!user_data) return;
|
||||
AIFilePicker* filepicker = AIFilePicker::create();
|
||||
filepicker->open();
|
||||
filepicker->run(boost::bind(&LLFloaterVFS::onClickAdd_continued, user_data, filepicker));
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterVFS::onClickAdd_continued(void* user_data, AIFilePicker* filepicker)
|
||||
{
|
||||
LLFloaterVFS* self = (LLFloaterVFS*)user_data;
|
||||
if (filepicker->hasFilename())
|
||||
{
|
||||
std::string file_name = filepicker->getFilename();
|
||||
std::string temp_filename = file_name + ".tmp";
|
||||
LLAssetType::EType asset_type = LLAssetConverter::convert(file_name, temp_filename);
|
||||
if(asset_type == LLAssetType::AT_NONE)
|
||||
{
|
||||
// todo: show a warning
|
||||
return;
|
||||
}
|
||||
LLUUID asset_id;
|
||||
asset_id.generate();
|
||||
S32 file_size;
|
||||
LLAPRFile fp(temp_filename, LL_APR_RB, &file_size);
|
||||
if(fp.getFileHandle())
|
||||
{
|
||||
if(asset_type == LLAssetType::AT_TEXTURE)
|
||||
{
|
||||
fp.close();
|
||||
//load the texture using built in functions
|
||||
LLPointer<LLImageJ2C> image_j2c = new LLImageJ2C;
|
||||
if( !image_j2c->loadAndValidate( temp_filename ) )
|
||||
{
|
||||
llinfos << "Image: " << file_name << " is corrupt." << llendl;
|
||||
return;
|
||||
}
|
||||
LLPointer<LLImageRaw> image_raw = new LLImageRaw;
|
||||
if( !image_j2c->decode(image_raw,0.0f) )
|
||||
{
|
||||
llinfos << "Image: " << file_name << " is corrupt." << llendl;
|
||||
return;
|
||||
}
|
||||
LLPointer<LLViewerFetchedTexture> imagep = new LLViewerFetchedTexture(asset_id);
|
||||
imagep->createGLTexture(0, image_raw, 0, TRUE, LLGLTexture::BOOST_NONE);
|
||||
gTextureList.addImage(imagep);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLVFile file(gVFS, asset_id, asset_type, LLVFile::WRITE);
|
||||
file.setMaxSize(file_size);
|
||||
const S32 buf_size = 65536;
|
||||
U8 copy_buf[buf_size];
|
||||
while ((file_size = fp.read(copy_buf, buf_size)))
|
||||
file.write(copy_buf, file_size);
|
||||
fp.close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(temp_filename != file_name)
|
||||
{
|
||||
LLFile::remove(temp_filename);
|
||||
}
|
||||
// todo: show a warning, couldn't open the selected file
|
||||
return;
|
||||
}
|
||||
if(temp_filename != file_name)
|
||||
{
|
||||
LLFile::remove(temp_filename);
|
||||
}
|
||||
entry file;
|
||||
file.mFilename = file_name;
|
||||
file.mID = asset_id;
|
||||
file.mType = asset_type;
|
||||
file.mName = gDirUtilp->getBaseFileName(file_name, true);
|
||||
self->add(file);
|
||||
/*if(self->getChild<LLCheckBoxCtrl>("create_pretend_item")->get())
|
||||
{
|
||||
LLLocalInventory::addItem(file.mName, (int)file.mType, file.mID, true);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onClickClear(void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
if(!floaterp) return;
|
||||
floaterp->clear();
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onClickReloadAll(void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
if(!floaterp) return;
|
||||
floaterp->reloadAll();
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onCommitFileList(LLUICtrl* ctrl, void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list");
|
||||
LLUUID selected_id(LLUUID::null);
|
||||
if(list->getFirstSelected())
|
||||
selected_id = list->getFirstSelected()->getUUID();
|
||||
floaterp->setEditID(selected_id);
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onCommitEdit(LLUICtrl* ctrl, void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
floaterp->commitEdit();
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onClickCopyUUID(void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
entry file = floaterp->getEditEntry();
|
||||
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(file.mID.asString()));
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onClickItem(void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
entry file = floaterp->getEditEntry();
|
||||
LLLocalInventory::addItem(file.mName, (int)file.mType, file.mID, true);
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onClickReload(void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
entry file = floaterp->getEditEntry();
|
||||
floaterp->reloadEntry(file);
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFS::onClickRemove(void* user_data)
|
||||
{
|
||||
LLFloaterVFS* floaterp = (LLFloaterVFS*)user_data;
|
||||
floaterp->removeEntry();
|
||||
}
|
||||
// </edit>
|
||||
@@ -1,50 +0,0 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLFLOATERVFS_H
|
||||
#define LL_LLFLOATERVFS_H
|
||||
#include "llfloater.h"
|
||||
#include "llassettype.h"
|
||||
|
||||
class AIFilePicker;
|
||||
|
||||
class LLFloaterVFS : LLFloater
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
std::string mFilename;
|
||||
std::string mName;
|
||||
LLUUID mID;
|
||||
LLAssetType::EType mType;
|
||||
} entry;
|
||||
public:
|
||||
LLFloaterVFS();
|
||||
~LLFloaterVFS();
|
||||
static void show();
|
||||
BOOL postBuild();
|
||||
void refresh();
|
||||
void add(entry file);
|
||||
void clear();
|
||||
void reloadAll();
|
||||
void setEditID(LLUUID edit_id);
|
||||
entry getEditEntry();
|
||||
void commitEdit();
|
||||
void reloadEntry(entry file);
|
||||
void removeEntry();
|
||||
static void onClickAdd(void* user_data);
|
||||
static void onClickAdd_continued(void* user_data, AIFilePicker* filepicker);
|
||||
static void onClickClear(void* user_data);
|
||||
static void onClickReloadAll(void* user_data);
|
||||
static void onCommitFileList(LLUICtrl* ctrl, void* user_data);
|
||||
static void onCommitEdit(LLUICtrl* ctrl, void* user_data);
|
||||
static void onClickCopyUUID(void* user_data);
|
||||
static void onClickItem(void* user_data);
|
||||
static void onClickReload(void* user_data);
|
||||
static void onClickRemove(void* user_data);
|
||||
private:
|
||||
static LLFloaterVFS* sInstance;
|
||||
static std::list<entry> mFiles;
|
||||
LLUUID mEditID;
|
||||
void setMassEnabled(bool enabled);
|
||||
void setEditEnabled(bool enabled);
|
||||
};
|
||||
#endif
|
||||
// </edit>
|
||||
@@ -1,182 +0,0 @@
|
||||
// <edit>
|
||||
//A lot of bad things going on in here, needs a rewrite.
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llfloatervfsexplorer.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "llvfs.h"
|
||||
#include "lllocalinventory.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llassetconverter.h"
|
||||
|
||||
LLFloaterVFSExplorer* LLFloaterVFSExplorer::sInstance;
|
||||
std::map<LLVFSFileSpecifier, LLVFSFileBlock*> LLFloaterVFSExplorer::sVFSFileMap;
|
||||
|
||||
LLFloaterVFSExplorer::LLFloaterVFSExplorer()
|
||||
: LLFloater(),
|
||||
mEditID(LLUUID::null)
|
||||
{
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_vfs_explorer.xml");
|
||||
}
|
||||
LLFloaterVFSExplorer::~LLFloaterVFSExplorer()
|
||||
{
|
||||
sInstance = NULL;
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFSExplorer::show()
|
||||
{
|
||||
if(sInstance)
|
||||
sInstance->open();
|
||||
else
|
||||
{
|
||||
sInstance = new LLFloaterVFSExplorer();
|
||||
sInstance->open();
|
||||
}
|
||||
}
|
||||
BOOL LLFloaterVFSExplorer::postBuild()
|
||||
{
|
||||
childSetCommitCallback("file_list", onCommitFileList, this);
|
||||
childSetAction("remove_btn", onClickRemove, this);
|
||||
childSetAction("reload_all_btn", onClickReload, this);
|
||||
childSetAction("copy_uuid_btn", onClickCopyUUID, this);
|
||||
childSetAction("item_btn", onClickItem, this);
|
||||
refresh();
|
||||
return TRUE;
|
||||
}
|
||||
void LLFloaterVFSExplorer::refresh()
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
|
||||
list->clearRows();
|
||||
sVFSFileMap = gVFS->getFileList();
|
||||
std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator end = sVFSFileMap.end();
|
||||
for(std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = sVFSFileMap.begin(); iter != end; ++iter)
|
||||
{
|
||||
LLVFSFileSpecifier file_spec = iter->first;
|
||||
LLSD element;
|
||||
element["id"] = file_spec.mFileID;
|
||||
LLSD& name_column = element["columns"][0];
|
||||
name_column["column"] = "name";
|
||||
name_column["value"] = file_spec.mFileID.asString();
|
||||
LLSD& type_column = element["columns"][1];
|
||||
type_column["column"] = "type";
|
||||
type_column["value"] = std::string(LLAssetType::lookup(file_spec.mFileType));
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
}
|
||||
setEditID(mEditID);
|
||||
}
|
||||
void LLFloaterVFSExplorer::reloadAll()
|
||||
{
|
||||
//get our magic from gvfs here
|
||||
//this should re-request all assets from the server if possible.
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFSExplorer::setEditID(LLUUID edit_id)
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
|
||||
bool found_in_list = (list->getItemIndex(edit_id) != -1);
|
||||
bool found_in_files = false;
|
||||
LLVFSFileSpecifier file;
|
||||
std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator end = sVFSFileMap.end();
|
||||
for(std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = sVFSFileMap.begin(); iter != end; ++iter)
|
||||
{
|
||||
if((*iter).first.mFileID == edit_id)
|
||||
{
|
||||
found_in_files = true;
|
||||
file = (*iter).first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found_in_files && found_in_list)
|
||||
{
|
||||
mEditID = edit_id;
|
||||
list->selectByID(edit_id);
|
||||
setEditEnabled(true);
|
||||
childSetText("name_edit", file.mFileID.asString());
|
||||
childSetText("id_edit", file.mFileID.asString());
|
||||
childSetValue("type_combo", std::string(LLAssetType::lookup(file.mFileType)));
|
||||
}
|
||||
else
|
||||
{
|
||||
mEditID = LLUUID::null;
|
||||
list->deselectAllItems(TRUE);
|
||||
setEditEnabled(false);
|
||||
childSetText("name_edit", std::string(""));
|
||||
childSetText("id_edit", std::string(""));
|
||||
childSetValue("type_combo", std::string("animatn"));
|
||||
}
|
||||
}
|
||||
LLVFSFileSpecifier LLFloaterVFSExplorer::getEditEntry()
|
||||
{
|
||||
LLVFSFileSpecifier file;
|
||||
std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator end = sVFSFileMap.end();
|
||||
for(std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = sVFSFileMap.begin(); iter != end; ++iter)
|
||||
{
|
||||
if((*iter).first.mFileID == mEditID)
|
||||
return (*iter).first;
|
||||
}
|
||||
file.mFileID = LLUUID::null;
|
||||
return file;
|
||||
}
|
||||
|
||||
void LLFloaterVFSExplorer::removeEntry()
|
||||
{
|
||||
std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator end = sVFSFileMap.end();
|
||||
for(std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = sVFSFileMap.begin(); iter != end; ++iter)
|
||||
{
|
||||
if((*iter).first.mFileID == mEditID)
|
||||
{
|
||||
gVFS->removeFile((*iter).first.mFileID, (*iter).first.mFileType);
|
||||
sVFSFileMap.erase(iter);
|
||||
break;
|
||||
}
|
||||
else ++iter;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
void LLFloaterVFSExplorer::setEditEnabled(bool enabled)
|
||||
{
|
||||
childSetEnabled("name_edit", false);
|
||||
childSetEnabled("id_edit", false);
|
||||
childSetEnabled("type_combo", false);
|
||||
childSetEnabled("edit_data_btn", enabled);
|
||||
childSetEnabled("remove_btn", enabled);
|
||||
childSetEnabled("copy_uuid_btn", enabled);
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFSExplorer::onCommitFileList(LLUICtrl* ctrl, void* user_data)
|
||||
{
|
||||
LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data;
|
||||
LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list");
|
||||
LLUUID selected_id(LLUUID::null);
|
||||
if(list->getFirstSelected())
|
||||
selected_id = list->getFirstSelected()->getUUID();
|
||||
floaterp->setEditID(selected_id);
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFSExplorer::onClickCopyUUID(void* user_data)
|
||||
{
|
||||
LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data;
|
||||
LLVFSFileSpecifier file = floaterp->getEditEntry();
|
||||
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(file.mFileID.asString()));
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFSExplorer::onClickRemove(void* user_data)
|
||||
{
|
||||
LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data;
|
||||
floaterp->removeEntry();
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFSExplorer::onClickReload(void* user_data)
|
||||
{
|
||||
LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data;
|
||||
floaterp->reloadAll();
|
||||
}
|
||||
// static
|
||||
void LLFloaterVFSExplorer::onClickItem(void* user_data)
|
||||
{
|
||||
LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data;
|
||||
LLVFSFileSpecifier file = floaterp->getEditEntry();
|
||||
LLLocalInventory::addItem(file.mFileID.asString(),file.mFileType,file.mFileID,true);
|
||||
}
|
||||
// </edit>
|
||||
@@ -1,41 +0,0 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLFLOATERVFSEXPLORER_H
|
||||
#define LL_LLFLOATERVFSEXPLORER_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llassettype.h"
|
||||
#include "llvfs.h"
|
||||
|
||||
class LLFloaterVFSExplorer : LLFloater
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
std::string mFilename;
|
||||
std::string mName;
|
||||
LLUUID mID;
|
||||
LLAssetType::EType mType;
|
||||
} entry;
|
||||
public:
|
||||
LLFloaterVFSExplorer();
|
||||
~LLFloaterVFSExplorer();
|
||||
static void show();
|
||||
BOOL postBuild();
|
||||
void refresh();
|
||||
void reloadAll();
|
||||
void removeEntry();
|
||||
void setEditID(LLUUID edit_id);
|
||||
LLVFSFileSpecifier getEditEntry();
|
||||
static void onCommitFileList(LLUICtrl* ctrl, void* user_data);
|
||||
static void onClickCopyUUID(void* user_data);
|
||||
static void onClickRemove(void* user_data);
|
||||
static void onClickReload(void* user_data);
|
||||
static void onClickEditData(void* user_data);
|
||||
static void onClickItem(void* user_data);
|
||||
private:
|
||||
static LLFloaterVFSExplorer* sInstance;
|
||||
static std::map<LLVFSFileSpecifier, LLVFSFileBlock*> sVFSFileMap;
|
||||
LLUUID mEditID;
|
||||
void setEditEnabled(bool enabled);
|
||||
};
|
||||
#endif
|
||||
// </edit>
|
||||
@@ -250,8 +250,6 @@
|
||||
#include "lltexlayer.h"
|
||||
|
||||
// <edit>
|
||||
#include "llfloatervfs.h"
|
||||
#include "llfloatervfsexplorer.h"
|
||||
#include "llfloatermessagelog.h"
|
||||
#include "shfloatermediaticker.h"
|
||||
#include "llpacketring.h"
|
||||
@@ -501,8 +499,6 @@ void handle_hide_typing_notification(void*);
|
||||
void handle_close_all_notifications(void*);
|
||||
void handle_open_message_log(void*);
|
||||
void handle_edit_ao(void*);
|
||||
void handle_local_assets(void*);
|
||||
void handle_vfs_explorer(void*);
|
||||
void handle_sounds_explorer(void*);
|
||||
void handle_blacklist(void*);
|
||||
// </edit>
|
||||
@@ -3801,16 +3797,6 @@ void handle_edit_ao(void*)
|
||||
LLFloaterAO::show(NULL);
|
||||
}
|
||||
|
||||
void handle_local_assets(void*)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void handle_vfs_explorer(void*)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void handle_sounds_explorer(void*)
|
||||
{
|
||||
LLFloaterExploreSounds::toggle();
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
|
||||
can_resize="false" width="320" min_width="320" height="320" min_height="320"
|
||||
name="floater_vfs" title="Local Assets" rect_control="FloaterVFSRect">
|
||||
|
||||
</floater>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
|
||||
can_resize="false" width="320" min_width="320" height="320" min_height="320"
|
||||
name="floater_vfs" title="VFS Explorer" rect_control="FloaterVFSRect">
|
||||
|
||||
</floater>
|
||||
Reference in New Issue
Block a user