Merge branch 'master' of github.com:HazimGazov/Inertia

This commit is contained in:
phr0z3nt04st
2010-06-21 16:13:07 -05:00
10 changed files with 343 additions and 12 deletions

View File

@@ -2062,6 +2062,16 @@ void LLVFS::listFiles()
unlockData();
}
std::map<LLVFSFileSpecifier, LLVFSFileBlock*> LLVFS::getFileList()
{
//have to do this so as not to mess with the gods of threading
lockData();
fileblock_map mFileList = mFileBlocks;
unlockData();
return mFileList;
}
#include "llapr.h"
void LLVFS::dumpFiles()
{

View File

@@ -143,10 +143,14 @@ protected:
void lockData() { mDataMutex->lock(); }
void unlockData() { mDataMutex->unlock(); }
protected:
LLMutex* mDataMutex;
//<edit>
public:
typedef std::map<LLVFSFileSpecifier, LLVFSFileBlock*> fileblock_map;
std::map<LLVFSFileSpecifier, LLVFSFileBlock*> getFileList();
//</edit>
protected:
fileblock_map mFileBlocks;
typedef std::multimap<S32, LLVFSBlock*> blocks_length_map_t;

View File

@@ -215,6 +215,7 @@ set(viewer_SOURCE_FILES
llfloaterurldisplay.cpp
llfloaterurlentry.cpp
llfloatervfs.cpp
llfloatervfsexplorer.cpp
llfloatervoicedevicesettings.cpp
llfloaterwater.cpp
llfloaterwindlight.cpp
@@ -653,6 +654,7 @@ set(viewer_HEADER_FILES
llfloaterurldisplay.h
llfloaterurlentry.h
llfloatervfs.h
llfloatervfsexplorer.h
llfloatervoicedevicesettings.h
llfloaterwater.h
llfloaterwindlight.h

View File

@@ -3,6 +3,7 @@
#include "llfloatervfs.h"
#include "lluictrlfactory.h"
#include "llscrolllistctrl.h"
#include "llcheckboxctrl.h"
#include "llfilepicker.h"
#include "lllocalinventory.h"
#include "llviewerwindow.h"
@@ -94,6 +95,8 @@ void LLFloaterVFS::reloadAll()
}
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;
@@ -101,7 +104,7 @@ void LLFloaterVFS::reloadEntry(entry file)
fp.open(file_name, LL_APR_RB, LLAPRFile::global, &file_size);
if(fp.getFileHandle())
{
LLVFile file(gVFS, file.mFileID, file.mFileType, LLVFile::WRITE);
LLVFile file(gVFS, asset_id, asset_type, LLVFile::WRITE);
file.setMaxSize(file_size);
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
@@ -188,6 +191,7 @@ void LLFloaterVFS::commitEdit()
gVFS->renameFile(file.mID, file.mType, edited_file.mID, edited_file.mType);
mEditID = edited_file.mID;
}
(*iter) = edited_file;
refresh();
}
@@ -207,7 +211,7 @@ void LLFloaterVFS::removeEntry()
void LLFloaterVFS::setMassEnabled(bool enabled)
{
childSetEnabled("clear_btn", enabled);
childSetEnabled("reload_all_btn", false); // DOESN'T WORK
childSetEnabled("reload_all_btn", enabled); // SHOULD WORK NOW!
}
void LLFloaterVFS::setEditEnabled(bool enabled)
{
@@ -216,7 +220,7 @@ void LLFloaterVFS::setEditEnabled(bool enabled)
childSetEnabled("type_combo", false); // DOESN'T WORK
childSetEnabled("copy_uuid_btn", enabled);
childSetEnabled("item_btn", enabled);
childSetEnabled("reload_btn", false); // DOESN'T WORK
childSetEnabled("reload_btn", enabled); // WORKS!
childSetEnabled("remove_btn", enabled);
}
// static
@@ -270,6 +274,10 @@ void LLFloaterVFS::onClickAdd(void* user_data)
file.mType = asset_type;
file.mName = gDirUtilp->getBaseFileName(file_name, true);
floaterp->add(file);
if(floaterp->getChild<LLCheckBoxCtrl>("create_pretend_item")->get())
{
LLLocalInventory::addItem(file.mName, (int)file.mType, file.mID, true);
}
}
}
// static

View File

@@ -0,0 +1,172 @@
// <edit>
#include "llviewerprecompiledheaders.h"
#include "llfloatervfsexplorer.h"
#include "lluictrlfactory.h"
#include "llscrolllistctrl.h"
#include "llcheckboxctrl.h"
#include "llfilepicker.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);
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
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("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();
}
// </edit>

View File

@@ -0,0 +1,39 @@
// <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);
private:
static LLFloaterVFSExplorer* sInstance;
static std::map<LLVFSFileSpecifier, LLVFSFileBlock*> sVFSFileMap;
LLUUID mEditID;
void setEditEnabled(bool enabled);
};
#endif
// </edit>

View File

@@ -235,6 +235,7 @@
#include "llfloatermessagebuilder.h"
#include "llao.h"
#include "llfloatervfs.h"
#include "llfloatervfsexplorer.h"
#include "llfloaterexportregion.h"
// </edit>
@@ -404,6 +405,7 @@ void handle_open_message_log(void*);
void handle_open_message_builder(void*);
void handle_edit_ao(void*);
void handle_local_assets(void*);
void handle_vfs_explorer(void*);
// </edit>
BOOL is_inventory_visible( void* user_data );
@@ -757,6 +759,8 @@ void init_client_menu(LLMenuGL* menu)
sub->append(new LLMenuItemCallGL( "Local Assets...",
&handle_local_assets, NULL));
sub->append(new LLMenuItemCallGL( "VFS Explorer",
&handle_vfs_explorer, NULL));
sub->append(new LLMenuItemCheckGL( "Enable AO",
&menu_toggle_control,
@@ -2478,8 +2482,8 @@ class LLAvatarEnableDebug : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
bool new_value = gAgent.isGodlike();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
//bool new_value = gAgent.isGodlike();
//gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
};
@@ -3094,6 +3098,11 @@ void handle_local_assets(void*)
LLFloaterVFS::show();
}
void handle_vfs_explorer(void*)
{
LLFloaterVFSExplorer::show();
}
void handle_close_all_notifications(void*)
{
LLView::child_list_t child_list(*(gNotifyBoxView->getChildList()));

View File

@@ -1,13 +1,14 @@
<?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="300" min_height="300"
can_resize="false" width="320" min_width="320" height="320" min_height="320"
name="floater_vfs" title="Local Assets" rect_control="FloaterVFSRect">
<button name="add_btn" follows="left|top" width="100" bottom="-45" left="10" height="20" label="Add..."/>
<button name="clear_btn" follows="left|top" width="100" left_delta="100" bottom_delta="0" height="20" label="Clear"/>
<button name="reload_all_btn" follows="left|top" width="100" left_delta="100" bottom_delta="0" height="20" label="Reload All"/>
<check_box name="create_pretend_item" follows="left|top|bottom" width="100" bottom_delta="-20" left="10" label="Create Pretend Inventory Item" initial_value="true" enabled="true"/>
<scroll_list bottom="75" can_resize="true" column_padding="0" draw_heading="true"
follows="left|top|bottom|right" left="10" multi_select="true"
name="file_list" right="-10" search_column="0" top="-50">
name="file_list" right="-10" search_column="0" top="-70">
<column dynamicwidth="true" name="name" label="name" />
<column name="type" label="type" width="100" />
</scroll_list>

View File

@@ -0,0 +1,88 @@
<?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">
<button name="reload_all_btn" follows="left|top" width="100" left="10" bottom_delta="-43" height="20" label="Reload All"/>
<scroll_list bottom="75" can_resize="true" column_padding="0" draw_heading="true"
follows="left|top|bottom|right" left="10" multi_select="true"
name="file_list" right="-10" search_column="0" top="-50">
<column dynamicwidth="true" name="name" label="name" />
<column name="type" label="type" width="100" />
</scroll_list>
<line_editor name="name_edit" follows="left|bottom|right" bottom="53" left="10" width="300" height="20"/>
<line_editor name="id_edit" follows="left|bottom|right" bottom_delta="-23" left="10" width="200" height="20"/>
<combo_box allow_text_entry="false" bottom_delta="-1" follows="left|bottom|right" height="20"
left="210" max_chars="20" mouse_opaque="true" name="type_combo" width="100">
<combo_item name="texture" value="texture">
texture
</combo_item>
<combo_item name="sound" value="sound">
sound
</combo_item>
<combo_item name="callcard" value="callcard">
callcard
</combo_item>
<combo_item name="landmark" value="landmark">
landmark
</combo_item>
<combo_item name="script" value="script">
script
</combo_item>
<combo_item name="clothing" value="clothing">
clothing
</combo_item>
<combo_item name="object" value="object">
object
</combo_item>
<combo_item name="notecard" value="notecard">
notecard
</combo_item>
<combo_item name="category" value="category">
category
</combo_item>
<combo_item name="root" value="root">
root
</combo_item>
<combo_item name="lsltext" value="lsltext">
lsltext
</combo_item>
<combo_item name="lslbyte" value="lslbyte">
lslbyte
</combo_item>
<combo_item name="txtr_tga" value="txtr_tga">
txtr_tga
</combo_item>
<combo_item name="bodypart" value="bodypart">
bodypart
</combo_item>
<combo_item name="trash" value="trash">
trash
</combo_item>
<combo_item name="snapshot" value="snapshot">
snapshot
</combo_item>
<combo_item name="lstndfnd" value="lstndfnd">
lstndfnd
</combo_item>
<combo_item name="snd_wav" value="snd_wav">
snd_wav
</combo_item>
<combo_item name="img_tga" value="img_tga">
img_tga
</combo_item>
<combo_item name="jpeg" value="jpeg">
jpeg
</combo_item>
<combo_item name="animatn" value="animatn">
animatn
</combo_item>
<combo_item name="gesture" value="gesture">
gesture
</combo_item>
<combo_item name="simstate" value="simstate">
simstate
</combo_item>
</combo_box>
<button name="copy_uuid_btn" follows="left|bottom" width="75" bottom="7" left="10" height="20" label="Copy UUID"/>
<button name="remove_btn" follows="left|bottom" width="75" bottom_delta="0" left_delta="75" height="20" label="Remove"/>
</floater>

View File

@@ -41,10 +41,8 @@
<on_click function="Avatar.Eject" />
<on_enable function="Avatar.EnableFreezeEject" />
</menu_item_call>
<menu_item_call enabled="false" label="Debug..." mouse_opaque="true" name="Debug...">
<menu_item_call enabled="true" label="Debug..." mouse_opaque="true" name="Debug Layers">
<on_click function="Avatar.Debug" />
<on_visible function="Avatar.VisibleDebug" />
<on_enable function="Avatar.EnableDebug" />
</menu_item_call>
<menu_item_call enabled="true" label="Inspect" mouse_opaque="true" name="Object Inspect">
<on_click function="Object.Inspect" />