Remove dead code
This commit is contained in:
@@ -30,7 +30,6 @@ set(llui_SOURCE_FILES
|
||||
llclipboard.cpp
|
||||
llcombobox.cpp
|
||||
llctrlselectioninterface.cpp
|
||||
lldelayeduidelete.cpp
|
||||
lldraghandle.cpp
|
||||
lleditmenuhandler.cpp
|
||||
llfloater.cpp
|
||||
@@ -90,7 +89,6 @@ set(llui_HEADER_FILES
|
||||
llclipboard.h
|
||||
llcombobox.h
|
||||
llctrlselectioninterface.h
|
||||
lldelayeduidelete.h
|
||||
lldraghandle.h
|
||||
lleditmenuhandler.h
|
||||
llfloater.h
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
// <edit>
|
||||
#include "linden_common.h"
|
||||
#include "lldelayeduidelete.h"
|
||||
#define DELETE_DELAY 0.1f
|
||||
#define DELETES_PER_DELAY 512
|
||||
|
||||
LLDeleteScheduler* gDeleteScheduler;
|
||||
|
||||
std::list<LLDeleteJob*> LLDeleteScheduler::sJobs;
|
||||
LLDeleteScheduler::LLDeleteScheduler() : LLEventTimer(DELETE_DELAY)
|
||||
{
|
||||
}
|
||||
void LLDeleteScheduler::addViewDeleteJob(std::list<LLView*> views)
|
||||
{
|
||||
if(!views.empty())
|
||||
{
|
||||
LLViewDeleteJob* job = new LLViewDeleteJob(views);
|
||||
sJobs.push_back(job);
|
||||
}
|
||||
}
|
||||
BOOL LLDeleteScheduler::tick() // IMPORTANT: never return TRUE
|
||||
{
|
||||
if(!sJobs.empty())
|
||||
{
|
||||
U32 completed = 0;
|
||||
do
|
||||
{
|
||||
LLDeleteJob* job = sJobs.front();
|
||||
if(job->work(completed))
|
||||
{
|
||||
delete job;
|
||||
sJobs.pop_front();
|
||||
}
|
||||
} while((completed < DELETES_PER_DELAY) && !sJobs.empty());
|
||||
}
|
||||
return FALSE; // EVER
|
||||
}
|
||||
BOOL LLDeleteJob::work(U32& completed)
|
||||
{
|
||||
llwarns << "THIS IS SPOSED TO BE OVERRIDDEN" << llendl;
|
||||
return TRUE;
|
||||
}
|
||||
LLViewDeleteJob::LLViewDeleteJob(std::list<LLView*> views)
|
||||
: mList(views)
|
||||
{
|
||||
}
|
||||
LLViewDeleteJob::~LLViewDeleteJob()
|
||||
{
|
||||
}
|
||||
BOOL LLViewDeleteJob::work(U32& completed)
|
||||
{
|
||||
do
|
||||
{
|
||||
if(!mList.empty())
|
||||
{
|
||||
LLView* view = mList.front();
|
||||
delete view;
|
||||
mList.pop_front();
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE; // job done
|
||||
}
|
||||
} while(++completed < DELETES_PER_DELAY);
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
@@ -1,32 +0,0 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLDELAYEDUIDELETE_H
|
||||
#define LL_LLDELAYEDUIDELETE_H
|
||||
#include "lleventtimer.h"
|
||||
#include "llview.h"
|
||||
class LLDeleteJob
|
||||
{
|
||||
public:
|
||||
virtual BOOL work(U32& completed);
|
||||
virtual ~LLDeleteJob() {}
|
||||
};
|
||||
class LLViewDeleteJob : public LLDeleteJob
|
||||
{
|
||||
public:
|
||||
LLViewDeleteJob(std::list<LLView*> views);
|
||||
virtual ~LLViewDeleteJob();
|
||||
virtual BOOL work(U32& completed);
|
||||
private:
|
||||
std::list<LLView*> mList;
|
||||
};
|
||||
class LLDeleteScheduler : public LLEventTimer
|
||||
{
|
||||
public:
|
||||
LLDeleteScheduler();
|
||||
void addViewDeleteJob(std::list<LLView*> views);
|
||||
BOOL tick();
|
||||
private:
|
||||
static std::list<LLDeleteJob*> sJobs;
|
||||
};
|
||||
extern LLDeleteScheduler* gDeleteScheduler;
|
||||
#endif
|
||||
// </edit>
|
||||
@@ -59,10 +59,6 @@
|
||||
#include "lltextbox.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
// <edit>
|
||||
#include "lldelayeduidelete.h"
|
||||
// </edit>
|
||||
|
||||
using namespace LLOldEvents;
|
||||
|
||||
//HACK: this allows you to instantiate LLView from xml with "<view/>" which we don't want
|
||||
|
||||
@@ -93,7 +93,6 @@ set(viewer_SOURCE_FILES
|
||||
floaterlocalassetbrowse.cpp
|
||||
floatervoicelicense.cpp
|
||||
hbfloatergrouptitles.cpp
|
||||
hgfloatertexteditor.cpp
|
||||
hippofloaterxml.cpp
|
||||
hippogridmanager.cpp
|
||||
hippolimits.cpp
|
||||
@@ -122,7 +121,6 @@ set(viewer_SOURCE_FILES
|
||||
llaudiosourcevo.cpp
|
||||
llavatarpropertiesprocessor.cpp
|
||||
llbox.cpp
|
||||
llbuildnewviewsscheduler.cpp
|
||||
llcallbacklist.cpp
|
||||
llcallingcard.cpp
|
||||
llcapabilitylistener.cpp
|
||||
@@ -293,7 +291,6 @@ set(viewer_SOURCE_FILES
|
||||
llimpanel.cpp
|
||||
llimview.cpp
|
||||
llinventoryactions.cpp
|
||||
llinventorybackup.cpp
|
||||
llinventorybridge.cpp
|
||||
llinventoryclipboard.cpp
|
||||
llinventoryfilter.cpp
|
||||
@@ -595,7 +592,6 @@ set(viewer_HEADER_FILES
|
||||
floaterlocalassetbrowse.h
|
||||
floatervoicelicense.h
|
||||
hbfloatergrouptitles.h
|
||||
hgfloatertexteditor.h
|
||||
hippofloaterxml.h
|
||||
hippogridmanager.h
|
||||
hippolimits.h
|
||||
@@ -625,7 +621,6 @@ set(viewer_HEADER_FILES
|
||||
llaudiosourcevo.h
|
||||
llavatarpropertiesprocessor.h
|
||||
llbox.h
|
||||
llbuildnewviewsscheduler.h
|
||||
llcallbacklist.h
|
||||
llcallingcard.h
|
||||
llcapabilitylistener.h
|
||||
@@ -795,7 +790,6 @@ set(viewer_HEADER_FILES
|
||||
llhudview.h
|
||||
llimpanel.h
|
||||
llimview.h
|
||||
llinventorybackup.h
|
||||
llinventorybridge.h
|
||||
llinventoryclipboard.h
|
||||
llinventoryfilter.h
|
||||
|
||||
@@ -1,399 +0,0 @@
|
||||
/**
|
||||
* @file hgfloatertexteditor.cpp
|
||||
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
|
||||
* @author Hazim Gazov
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "hgfloatertexteditor.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llinventorybackup.h" // for downloading
|
||||
#include "llviewercontrol.h" // gSavedSettings
|
||||
#include "llviewerwindow.h" // alertXML
|
||||
#include "llagent.h" // gAgent getID
|
||||
#include "llviewermenufile.h"
|
||||
#include "llviewerregion.h" // getCapability
|
||||
#include "llassetuploadresponders.h" // LLUpdateAgentInventoryResponder
|
||||
#include "llinventorymodel.h" // gInventory.updateItem
|
||||
#include "llappviewer.h" // System Folders
|
||||
#include "llfloaterperms.h" //get default perms
|
||||
#include "lllocalinventory.h"
|
||||
#include "llnotificationsutil.h"
|
||||
|
||||
std::list<HGFloaterTextEditor*> HGFloaterTextEditor::sInstances;
|
||||
S32 HGFloaterTextEditor::sUploadAmount = 10;
|
||||
|
||||
HGFloaterTextEditor::HGFloaterTextEditor(LLInventoryItem* item)
|
||||
: LLFloater()
|
||||
{
|
||||
sInstances.push_back(this);
|
||||
mItem = item;
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_asset_text_editor.xml");
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::show(LLUUID item_id)
|
||||
{
|
||||
LLInventoryItem* item = (LLInventoryItem*)gInventory.getItem(item_id);
|
||||
if(item)
|
||||
{
|
||||
S32 left, top;
|
||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||
LLRect rect = gSavedSettings.getRect("FloaterAssetTextEditorRect");
|
||||
rect.translate(left - rect.mLeft, top - rect.mTop);
|
||||
HGFloaterTextEditor* floaterp = new HGFloaterTextEditor(item);
|
||||
floaterp->setRect(rect);
|
||||
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
HGFloaterTextEditor::~HGFloaterTextEditor()
|
||||
{
|
||||
sInstances.remove(this);
|
||||
}
|
||||
|
||||
void HGFloaterTextEditor::close(bool app_quitting)
|
||||
{
|
||||
LLFloater::close(app_quitting);
|
||||
}
|
||||
|
||||
BOOL HGFloaterTextEditor::postBuild(void)
|
||||
{
|
||||
LLTextEditor* editor = getChild<LLTextEditor>("text_editor");
|
||||
mEditor = editor;
|
||||
|
||||
childSetEnabled("upload_btn", false);
|
||||
childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload"));
|
||||
childSetAction("upload_btn", onClickUpload, this);
|
||||
childSetEnabled("save_btn", false);
|
||||
childSetAction("save_btn", onClickSave, this);
|
||||
|
||||
if(mItem)
|
||||
{
|
||||
std::string title = "Text editor: " + mItem->getName();
|
||||
const char* asset_type_name = LLAssetType::lookup(mItem->getType());
|
||||
if(asset_type_name)
|
||||
{
|
||||
title.append(" (" + std::string(asset_type_name) + ")");
|
||||
}
|
||||
setTitle(title);
|
||||
}
|
||||
#if OPENSIM_RULES!=1
|
||||
if(mItem->getCreatorUUID() == gAgentID)
|
||||
{
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
// Load the asset
|
||||
editor->setVisible(FALSE);
|
||||
childSetText("status_text", std::string("Loading..."));
|
||||
LLInventoryBackup::download(mItem, this, imageCallback, assetCallback);
|
||||
#if OPENSIM_RULES!=1
|
||||
} else {
|
||||
this->close(false);
|
||||
}
|
||||
#endif /* OPENSIM_RULES!=1 */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::imageCallback(BOOL success,
|
||||
LLViewerFetchedTexture *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata)
|
||||
{
|
||||
if(final)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
//LLInventoryItem* item = data->item;
|
||||
|
||||
if(!success)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
U8* src_data = src->getData();
|
||||
S32 size = src->getDataSize();
|
||||
std::string new_data;
|
||||
for(S32 i = 0; i < size; i++)
|
||||
new_data += (char)src_data[i];
|
||||
|
||||
delete[] src_data;
|
||||
|
||||
floater->mEditor->setValue(new_data);
|
||||
floater->mEditor->setVisible(TRUE);
|
||||
floater->childSetText("status_text", std::string("Note: Image data shown isn't the actual asset data, yet"));
|
||||
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
src_vi->setBoostLevel(LLGLTexture::BOOST_UI);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)(data->floater);
|
||||
if(!floater) return;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(status != 0 && item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
floater->childSetText("status_text", std::string("Unable to download asset."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: this doesn't work for static vfs shit
|
||||
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
|
||||
S32 size = file.getSize();
|
||||
|
||||
std::string new_data("");
|
||||
if(size > 0)
|
||||
{
|
||||
char* buffer = new char[size + 1];
|
||||
if (buffer == NULL)
|
||||
{
|
||||
llerrs << "Memory Allocation Failed" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
file.read((U8*)buffer, size);
|
||||
buffer[size - 1] = 0;
|
||||
|
||||
new_data = std::string(buffer);
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
|
||||
floater->mEditor->setText(LLStringExplicit(new_data));
|
||||
floater->mEditor->setVisible(TRUE);
|
||||
floater->childSetText("status_text", llformat("File Size: %d", size));
|
||||
|
||||
floater->childSetEnabled("upload_btn", true);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
if(item->getPermissions().allowModifyBy(gAgent.getID()))
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
case LLAssetType::AT_LANDMARK:
|
||||
case LLAssetType::AT_CALLINGCARD:
|
||||
floater->childSetEnabled("upload_btn", false);
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
break;
|
||||
default:
|
||||
floater->childSetEnabled("save_btn", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_SOUND:
|
||||
floater->childSetLabelArg("upload_btn", "[UPLOAD]", std::string("Upload (L$10)"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Never enable save if it's a pretend item
|
||||
if(gInventory.isObjectDescendentOf(item->getUUID(), gSystemFolderRoot))
|
||||
{
|
||||
floater->childSetEnabled("save_btn", false);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::onClickUpload(void* user_data)
|
||||
{
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
const char* value = floater->mEditor->getText().c_str();
|
||||
int size = strlen(value);
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = (U8)value[i];
|
||||
|
||||
delete[] value;
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
void *fake_user_data = NULL;
|
||||
|
||||
if(item->getType() != LLAssetType::AT_GESTURE && item->getType() != LLAssetType::AT_LSL_TEXT
|
||||
&& item->getType() != LLAssetType::AT_NOTECARD)
|
||||
{
|
||||
upload_new_resource(transaction_id,
|
||||
item->getType(),
|
||||
item->getName(),
|
||||
item->getDescription(),
|
||||
0,
|
||||
LLFolderType::assetTypeToFolderType(item->getType()),
|
||||
item->getInventoryType(),
|
||||
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
|
||||
item->getName(),
|
||||
callback,
|
||||
sUploadAmount,
|
||||
fake_user_data);
|
||||
}
|
||||
else // gestures and scripts, create an item first
|
||||
{ // AND notecards
|
||||
//if(item->getType() == LLAssetType::AT_NOTECARD) gDontOpenNextNotecard = true;
|
||||
create_inventory_item( gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
item->getParentUUID(), //gInventory.findCategoryUUIDForType(item->getType()),
|
||||
LLTransactionID::tnull,
|
||||
item->getName(),
|
||||
fake_asset_id.asString(),
|
||||
item->getType(),
|
||||
item->getInventoryType(),
|
||||
(LLWearableType::EType)item->getFlags(),
|
||||
PERM_ITEM_UNRESTRICTED,
|
||||
new NewResourceItemCallback);
|
||||
}
|
||||
}
|
||||
|
||||
struct LLSaveInfo
|
||||
{
|
||||
LLSaveInfo(HGFloaterTextEditor* floater, LLTransactionID transaction_id)
|
||||
: mFloater(floater), mTransactionID(transaction_id)
|
||||
{
|
||||
}
|
||||
|
||||
HGFloaterTextEditor* mFloater;
|
||||
LLTransactionID mTransactionID;
|
||||
};
|
||||
|
||||
// static
|
||||
void HGFloaterTextEditor::onClickSave(void* user_data)
|
||||
{
|
||||
HGFloaterTextEditor* floater = (HGFloaterTextEditor*)user_data;
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
LLTransactionID transaction_id;
|
||||
transaction_id.generate();
|
||||
LLUUID fake_asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
const char* value = floater->mEditor->getText().c_str();
|
||||
int size = strlen(value);
|
||||
U8* buffer = new U8[size];
|
||||
for(int i = 0; i < size; i++)
|
||||
buffer[i] = (U8)value[i];
|
||||
|
||||
LLVFile file(gVFS, fake_asset_id, item->getType(), LLVFile::APPEND);
|
||||
file.setMaxSize(size);
|
||||
if (!file.write(buffer, size))
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write data to file";
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
bool caps = false;
|
||||
std::string url;
|
||||
LLSD body;
|
||||
body["item_id"] = item->getUUID();
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_GESTURE:
|
||||
url = gAgent.getRegion()->getCapability("UpdateGestureAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_LSL_TEXT:
|
||||
url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
|
||||
body["target"] = "mono";
|
||||
caps = true;
|
||||
break;
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
|
||||
caps = true;
|
||||
break;
|
||||
default: // wearables & notecards, Oct 12 2009
|
||||
// ONLY WEARABLES, Oct 15 2009
|
||||
floater->childSetText("status_text", std::string("Saving..."));
|
||||
LLSaveInfo* info = new LLSaveInfo(floater, transaction_id);
|
||||
gAssetStorage->storeAssetData(transaction_id, item->getType(), onSaveComplete, info);
|
||||
caps = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(caps)
|
||||
{
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
void HGFloaterTextEditor::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLSaveInfo* info = (LLSaveInfo*)user_data;
|
||||
HGFloaterTextEditor* floater = info->mFloater;
|
||||
if(std::find(sInstances.begin(), sInstances.end(), floater) == sInstances.end()) return; // no more crash
|
||||
LLInventoryItem* item = floater->mItem;
|
||||
|
||||
floater->childSetText("status_text", std::string(""));
|
||||
|
||||
if(item && (status == 0))
|
||||
{
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
|
||||
new_item->setDescription(item->getDescription());
|
||||
new_item->setTransactionID(info->mTransactionID);
|
||||
new_item->setAssetUUID(asset_uuid);
|
||||
new_item->updateServer(FALSE);
|
||||
gInventory.updateItem(new_item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = llformat("Upload failed with status %d, also %d", status, ext_status);
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
}
|
||||
}
|
||||
|
||||
// </edit>
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* @file hgfloatertexteditor.h
|
||||
* @brief Asset Text Editor floater made by Hazim Gazov (based on hex editor floater by Day Oh)
|
||||
* @author Hazim Gazov
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=WTFPLV2$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HG_HGFLOATERTEXT_H
|
||||
#define HG_HGFLOATERTEXT_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "lltexteditor.h"
|
||||
#include "llinventory.h"
|
||||
#include "llviewertexture.h"
|
||||
|
||||
class HGFloaterTextEditor
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
HGFloaterTextEditor(LLInventoryItem* item);
|
||||
static void show(LLUUID item_id);
|
||||
BOOL postBuild(void);
|
||||
void close(bool app_quitting);
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerFetchedTexture *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void onClickSave(void* user_data);
|
||||
static void onClickUpload(void* user_data);
|
||||
static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status);
|
||||
LLInventoryItem* mItem;
|
||||
LLTextEditor* mEditor;
|
||||
static std::list<HGFloaterTextEditor*> sInstances;
|
||||
private:
|
||||
virtual ~HGFloaterTextEditor();
|
||||
protected:
|
||||
static S32 sUploadAmount;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -117,8 +117,6 @@
|
||||
#include "llimageworker.h"
|
||||
|
||||
// <edit>
|
||||
#include "lldelayeduidelete.h"
|
||||
#include "llbuildnewviewsscheduler.h"
|
||||
#include "aicurleasyrequeststatemachine.h"
|
||||
#include "aihttptimeoutpolicy.h"
|
||||
// </edit>
|
||||
@@ -641,9 +639,6 @@ bool LLAppViewer::init()
|
||||
// Logging is initialized. Now it's safe to start the error thread.
|
||||
startErrorThread();
|
||||
|
||||
gDeleteScheduler = new LLDeleteScheduler();
|
||||
gBuildNewViewsScheduler = new LLBuildNewViewsScheduler();
|
||||
// </edit>
|
||||
//
|
||||
// OK to write stuff to logs now, we've now crash reported if necessary
|
||||
//
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
// <edit>
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llbuildnewviewsscheduler.h"
|
||||
#include "llinventorybridge.h"
|
||||
#define BUILD_DELAY 0.1f
|
||||
#define BUILD_PER_DELAY 512
|
||||
|
||||
LLBuildNewViewsScheduler* gBuildNewViewsScheduler;
|
||||
|
||||
std::list<LLBuildNewViewsScheduler::job> LLBuildNewViewsScheduler::sJobs;
|
||||
LLBuildNewViewsScheduler::LLBuildNewViewsScheduler() : LLEventTimer(BUILD_DELAY)
|
||||
{
|
||||
}
|
||||
void LLBuildNewViewsScheduler::addJob(LLInventoryPanel* inventory_panel, LLInventoryObject* inventory_object)
|
||||
{
|
||||
LLBuildNewViewsScheduler::job j;
|
||||
j.mInventoryPanel = inventory_panel;
|
||||
j.mInventoryObject = inventory_object;
|
||||
sJobs.push_back(j);
|
||||
}
|
||||
void LLBuildNewViewsScheduler::cancel(LLInventoryPanel* inventory_panel)
|
||||
{
|
||||
for(std::list<LLBuildNewViewsScheduler::job>::iterator iter = sJobs.begin();
|
||||
iter != sJobs.end(); )
|
||||
{
|
||||
LLInventoryPanel* job_panel = (*iter).mInventoryPanel;
|
||||
if(job_panel == inventory_panel)
|
||||
{
|
||||
iter = sJobs.erase(iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
BOOL LLBuildNewViewsScheduler::tick()
|
||||
{
|
||||
U32 i = 0;
|
||||
while(!sJobs.empty() && (i < BUILD_PER_DELAY))
|
||||
{
|
||||
LLBuildNewViewsScheduler::job j = sJobs.front();
|
||||
buildNewViews(j.mInventoryPanel, j.mInventoryObject);
|
||||
sJobs.pop_front();
|
||||
++i;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
void LLBuildNewViewsScheduler::buildNewViews(LLInventoryPanel* panelp, LLInventoryObject* objectp)
|
||||
{
|
||||
LLFolderViewItem* itemp = NULL;
|
||||
|
||||
if (objectp)
|
||||
{
|
||||
if (objectp->getType() <= LLAssetType::AT_NONE ||
|
||||
objectp->getType() >= LLAssetType::AT_COUNT)
|
||||
{
|
||||
llwarns << "called with objectp->mType == "
|
||||
<< ((S32) objectp->getType())
|
||||
<< " (shouldn't happen)" << llendl;
|
||||
}
|
||||
else if (objectp->getType() == LLAssetType::AT_CATEGORY) // build new view for category
|
||||
{
|
||||
LLInvFVBridge* new_listener = LLInvFVBridge::createBridge(objectp->getType(),
|
||||
objectp->getType(),
|
||||
LLInventoryType::IT_CATEGORY,
|
||||
panelp,
|
||||
panelp->getRootFolder(),
|
||||
objectp->getUUID());
|
||||
|
||||
if (new_listener)
|
||||
{
|
||||
LLFolderViewFolder* folderp = new LLFolderViewFolder(new_listener->getDisplayName(),
|
||||
new_listener->getIcon(),
|
||||
new_listener->getIcon(),
|
||||
NULL,
|
||||
panelp->getRootFolder(),
|
||||
new_listener);
|
||||
|
||||
folderp->setItemSortOrder(panelp->getSortOrder());
|
||||
itemp = folderp;
|
||||
}
|
||||
}
|
||||
else // build new view for item
|
||||
{
|
||||
LLInventoryItem* item = (LLInventoryItem*)objectp;
|
||||
LLInvFVBridge* new_listener = LLInvFVBridge::createBridge(
|
||||
item->getType(),
|
||||
item->getActualType(),
|
||||
item->getInventoryType(),
|
||||
panelp,
|
||||
panelp->getRootFolder(),
|
||||
item->getUUID(),
|
||||
item->getFlags());
|
||||
if (new_listener)
|
||||
{
|
||||
itemp = new LLFolderViewItem(new_listener->getDisplayName(),
|
||||
new_listener->getIcon(),
|
||||
NULL,
|
||||
NULL,
|
||||
new_listener->getCreationDate(),
|
||||
panelp->getRootFolder(),
|
||||
new_listener);
|
||||
}
|
||||
}
|
||||
|
||||
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)panelp->getRootFolder()->getItemByID(objectp->getParentUUID());
|
||||
|
||||
if (itemp)
|
||||
{
|
||||
//itemp->mDelayedDelete = TRUE;
|
||||
if (parent_folder)
|
||||
{
|
||||
itemp->addToFolder(parent_folder, panelp->getRootFolder());
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Couldn't find parent folder for child " << itemp->getLabel() << llendl;
|
||||
delete itemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!objectp || (objectp && (objectp->getType() == LLAssetType::AT_CATEGORY)))
|
||||
{
|
||||
LLViewerInventoryCategory::cat_array_t* categories;
|
||||
LLViewerInventoryItem::item_array_t* items;
|
||||
|
||||
panelp->getModel()->lockDirectDescendentArrays((objectp != NULL) ? objectp->getUUID() : LLUUID::null, categories, items);
|
||||
if(categories)
|
||||
{
|
||||
S32 count = categories->count();
|
||||
for(S32 i = 0; i < count; ++i)
|
||||
{
|
||||
LLInventoryCategory* cat = categories->get(i);
|
||||
addJob(panelp, cat);
|
||||
}
|
||||
}
|
||||
if(items)
|
||||
{
|
||||
S32 count = items->count();
|
||||
for(S32 i = 0; i < count; ++i)
|
||||
{
|
||||
LLInventoryItem* item = items->get(i);
|
||||
addJob(panelp, item);
|
||||
}
|
||||
}
|
||||
panelp->getModel()->unlockDirectDescendentArrays(objectp->getUUID());
|
||||
}
|
||||
}
|
||||
// </edit>
|
||||
@@ -1,22 +0,0 @@
|
||||
// <edit>
|
||||
#include "llinventorypanel.h"
|
||||
#include "llinventory.h"
|
||||
#include "lleventtimer.h"
|
||||
class LLBuildNewViewsScheduler : public LLEventTimer
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
LLInventoryPanel* mInventoryPanel;
|
||||
LLInventoryObject* mInventoryObject;
|
||||
} job;
|
||||
public:
|
||||
LLBuildNewViewsScheduler();
|
||||
void addJob(LLInventoryPanel* inventory_panel, LLInventoryObject* inventory_object);
|
||||
void cancel(LLInventoryPanel* inventory_panel);
|
||||
BOOL tick();
|
||||
private:
|
||||
static std::list<job> sJobs;
|
||||
void buildNewViews(LLInventoryPanel* panelp, LLInventoryObject* objectp);
|
||||
};
|
||||
extern LLBuildNewViewsScheduler* gBuildNewViewsScheduler;
|
||||
// </edit>
|
||||
@@ -95,9 +95,6 @@
|
||||
|
||||
// <edit>
|
||||
#include "lllocalinventory.h"
|
||||
#include "llinventorybackup.h"
|
||||
//#include "llcheats.h"
|
||||
//#include "llnotecardmagic.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
// </edit>
|
||||
|
||||
|
||||
@@ -1,790 +0,0 @@
|
||||
// <edit>
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llinventorybackup.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "llviewerinventory.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
#include "statemachine/aidirpicker.h"
|
||||
#include "llviewertexturelist.h" // gTextureList
|
||||
#include "llagent.h" // gAgent
|
||||
#include "llviewerwindow.h" // gViewerWindow
|
||||
#include "llfloater.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llimagetga.h"
|
||||
#include "llnotificationsutil.h"
|
||||
|
||||
std::list<LLFloaterInventoryBackup*> LLFloaterInventoryBackup::sInstances;
|
||||
|
||||
LLInventoryBackupOrder::LLInventoryBackupOrder()
|
||||
{
|
||||
// My personal defaults based on what is assumed to not work
|
||||
mDownloadTextures = true;
|
||||
mDownloadSounds = true;
|
||||
mDownloadCallingCards = false;
|
||||
mDownloadLandmarks = true;
|
||||
mDownloadScripts = true;
|
||||
mDownloadWearables = true;
|
||||
mDownloadObjects = false;
|
||||
mDownloadNotecards = true;
|
||||
mDownloadAnimations = true;
|
||||
mDownloadGestures = true;
|
||||
//mDownloadOthers = true;
|
||||
}
|
||||
|
||||
LLFloaterInventoryBackupSettings::LLFloaterInventoryBackupSettings(LLInventoryBackupOrder* order)
|
||||
: LLFloater(),
|
||||
mOrder(order)
|
||||
{
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_backup_settings.xml");
|
||||
}
|
||||
|
||||
LLFloaterInventoryBackupSettings::~LLFloaterInventoryBackupSettings()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLFloaterInventoryBackupSettings::postBuild(void)
|
||||
{
|
||||
childSetValue("chk_textures", mOrder->mDownloadTextures);
|
||||
childSetValue("chk_sounds", mOrder->mDownloadSounds);
|
||||
childSetValue("chk_callingcards", mOrder->mDownloadCallingCards);
|
||||
childSetValue("chk_landmarks", mOrder->mDownloadLandmarks);
|
||||
childSetValue("chk_scripts", mOrder->mDownloadScripts);
|
||||
childSetValue("chk_wearables", mOrder->mDownloadWearables);
|
||||
childSetValue("chk_objects", mOrder->mDownloadObjects);
|
||||
childSetValue("chk_notecards", mOrder->mDownloadNotecards);
|
||||
childSetValue("chk_animations", mOrder->mDownloadAnimations);
|
||||
childSetValue("chk_gestures", mOrder->mDownloadGestures);
|
||||
//childSetValue("chk_others", mOrder->mDownloadOthers);
|
||||
|
||||
childSetAction("next_btn", LLFloaterInventoryBackupSettings::onClickNext, this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterInventoryBackupSettings::onClickNext(void* userdata)
|
||||
{
|
||||
LLFloaterInventoryBackupSettings* floater = (LLFloaterInventoryBackupSettings*)userdata;
|
||||
LLInventoryBackupOrder* order = floater->mOrder;
|
||||
|
||||
// Apply changes to filters
|
||||
order->mDownloadAnimations = floater->childGetValue("chk_animations");
|
||||
order->mDownloadCallingCards = floater->childGetValue("chk_callingcards");
|
||||
order->mDownloadGestures = floater->childGetValue("chk_gestures");
|
||||
order->mDownloadLandmarks = floater->childGetValue("chk_landmarks");
|
||||
order->mDownloadNotecards = floater->childGetValue("chk_notecards");
|
||||
order->mDownloadObjects = floater->childGetValue("chk_objects");
|
||||
//order->mDownloadOthers = floater->childGetValue("chk_others");
|
||||
order->mDownloadScripts = floater->childGetValue("chk_scripts");
|
||||
order->mDownloadSounds = floater->childGetValue("chk_sounds");
|
||||
order->mDownloadTextures = floater->childGetValue("chk_textures");
|
||||
order->mDownloadWearables = floater->childGetValue("chk_wearables");
|
||||
|
||||
// Make filters
|
||||
std::map<LLAssetType::EType, bool> type_remove;
|
||||
type_remove[LLAssetType::AT_ANIMATION] = !order->mDownloadAnimations;
|
||||
type_remove[LLAssetType::AT_BODYPART] = !order->mDownloadWearables;
|
||||
type_remove[LLAssetType::AT_CALLINGCARD] = !order->mDownloadCallingCards;
|
||||
type_remove[LLAssetType::AT_CLOTHING] = !order->mDownloadWearables;
|
||||
type_remove[LLAssetType::AT_GESTURE] = !order->mDownloadGestures;
|
||||
type_remove[LLAssetType::AT_IMAGE_JPEG] = !order->mDownloadTextures;
|
||||
type_remove[LLAssetType::AT_IMAGE_TGA] = !order->mDownloadTextures;
|
||||
type_remove[LLAssetType::AT_LANDMARK] = !order->mDownloadLandmarks;
|
||||
type_remove[LLAssetType::AT_LSL_TEXT] = !order->mDownloadScripts;
|
||||
type_remove[LLAssetType::AT_NOTECARD] = !order->mDownloadNotecards;
|
||||
type_remove[LLAssetType::AT_OBJECT] = !order->mDownloadObjects;
|
||||
type_remove[LLAssetType::AT_SCRIPT] = !order->mDownloadScripts;
|
||||
type_remove[LLAssetType::AT_SOUND] = !order->mDownloadSounds;
|
||||
type_remove[LLAssetType::AT_SOUND_WAV] = !order->mDownloadSounds;
|
||||
type_remove[LLAssetType::AT_TEXTURE] = !order->mDownloadTextures;
|
||||
type_remove[LLAssetType::AT_TEXTURE_TGA] = !order->mDownloadTextures;
|
||||
|
||||
// Apply filters
|
||||
std::vector<LLInventoryItem*>::iterator item_iter = order->mItems.begin();
|
||||
for( ; item_iter != order->mItems.end(); )
|
||||
{
|
||||
if(type_remove[(*item_iter)->getType()])
|
||||
item_iter = order->mItems.erase(item_iter);
|
||||
else
|
||||
++item_iter;
|
||||
}
|
||||
|
||||
if(order->mItems.size() < 1)
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "No items passed the filter \\o/";
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get dir name
|
||||
AIDirPicker* dirpicker = new AIDirPicker("New Folder");
|
||||
dirpicker->run(boost::bind(&LLFloaterInventoryBackupSettings::onClickNext_continued, userdata, dirpicker));
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterInventoryBackupSettings::onClickNext_continued(void* userdata, AIDirPicker* dirpicker)
|
||||
{
|
||||
LLFloaterInventoryBackupSettings* floater = (LLFloaterInventoryBackupSettings*)userdata;
|
||||
LLInventoryBackupOrder* order = floater->mOrder;
|
||||
|
||||
if (!dirpicker->hasDirname())
|
||||
{
|
||||
floater->close();
|
||||
return;
|
||||
}
|
||||
std::string dirname = dirpicker->getDirname();
|
||||
|
||||
// Make local directory tree
|
||||
LLFile::mkdir(dirname);
|
||||
std::vector<LLInventoryCategory*>::iterator _cat_iter = order->mCats.begin();
|
||||
std::vector<LLInventoryCategory*>::iterator _cat_end = order->mCats.end();
|
||||
for( ; _cat_iter != _cat_end; ++_cat_iter)
|
||||
{
|
||||
std::string path = dirname + OS_SEP + LLInventoryBackup::getPath(*_cat_iter, order->mCats);
|
||||
LLFile::mkdir(path);
|
||||
}
|
||||
|
||||
// Go go backup floater
|
||||
LLFloaterInventoryBackup* backup_floater = new LLFloaterInventoryBackup(dirname, order->mCats, order->mItems);
|
||||
backup_floater->center();
|
||||
|
||||
// Close myself
|
||||
floater->close();
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLInventoryBackup::itemIsFolder(LLInventoryItem* item)
|
||||
{
|
||||
return ((item->getInventoryType() == LLInventoryType::IT_CATEGORY)
|
||||
|| (item->getInventoryType() == LLInventoryType::IT_ROOT_CATEGORY));
|
||||
}
|
||||
|
||||
// static
|
||||
ESaveFilter LLInventoryBackup::getSaveFilter(LLInventoryItem* item)
|
||||
{
|
||||
LLAssetType::EType type = item->getType();
|
||||
LLWearableType::EType wear = (LLWearableType::EType)(item->getFlags() & 0xFF);
|
||||
switch(type)
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
return FFSAVE_TGA;
|
||||
case LLAssetType::AT_SOUND:
|
||||
return FFSAVE_OGG;
|
||||
case LLAssetType::AT_SCRIPT:
|
||||
case LLAssetType::AT_LSL_TEXT:
|
||||
return FFSAVE_SCRIPT;
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
return FFSAVE_ANIMATN;
|
||||
case LLAssetType::AT_GESTURE:
|
||||
return FFSAVE_GESTURE;
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
return FFSAVE_NOTECARD;
|
||||
case LLAssetType::AT_LANDMARK:
|
||||
return FFSAVE_LANDMARK;
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
switch(wear)
|
||||
{
|
||||
case LLWearableType::WT_EYES:
|
||||
return FFSAVE_EYES;
|
||||
case LLWearableType::WT_GLOVES:
|
||||
return FFSAVE_GLOVES;
|
||||
case LLWearableType::WT_HAIR:
|
||||
return FFSAVE_HAIR;
|
||||
case LLWearableType::WT_JACKET:
|
||||
return FFSAVE_JACKET;
|
||||
case LLWearableType::WT_PANTS:
|
||||
return FFSAVE_PANTS;
|
||||
case LLWearableType::WT_SHAPE:
|
||||
return FFSAVE_SHAPE;
|
||||
case LLWearableType::WT_SHIRT:
|
||||
return FFSAVE_SHIRT;
|
||||
case LLWearableType::WT_SHOES:
|
||||
return FFSAVE_SHOES;
|
||||
case LLWearableType::WT_SKIN:
|
||||
return FFSAVE_SKIN;
|
||||
case LLWearableType::WT_SKIRT:
|
||||
return FFSAVE_SKIRT;
|
||||
case LLWearableType::WT_SOCKS:
|
||||
return FFSAVE_SOCKS;
|
||||
case LLWearableType::WT_UNDERPANTS:
|
||||
return FFSAVE_UNDERPANTS;
|
||||
case LLWearableType::WT_UNDERSHIRT:
|
||||
return FFSAVE_UNDERSHIRT;
|
||||
case LLWearableType::WT_PHYSICS:
|
||||
return FFSAVE_PHYSICS;
|
||||
default:
|
||||
return FFSAVE_ALL;
|
||||
}
|
||||
default:
|
||||
return FFSAVE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
std::string LLInventoryBackup::getExtension(LLInventoryItem* item)
|
||||
{
|
||||
LLAssetType::EType type = item->getType();
|
||||
LLWearableType::EType wear = (LLWearableType::EType)(item->getFlags() & 0xFF);
|
||||
std::string scratch;
|
||||
switch(type)
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
return ".tga";
|
||||
case LLAssetType::AT_SOUND:
|
||||
return ".ogg";
|
||||
case LLAssetType::AT_SCRIPT:
|
||||
case LLAssetType::AT_LSL_TEXT:
|
||||
return ".lsl";
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
return ".animatn";
|
||||
case LLAssetType::AT_GESTURE:
|
||||
return ".gesture";
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
return ".notecard";
|
||||
case LLAssetType::AT_LANDMARK:
|
||||
return ".landmark";
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
scratch = LLWearableType::getTypeName(wear);
|
||||
if(scratch == "invalid")
|
||||
{
|
||||
if(type == LLAssetType::AT_BODYPART)
|
||||
scratch = "bodypart";
|
||||
else
|
||||
scratch = "clothing";
|
||||
}
|
||||
return "." + scratch;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
std::string LLInventoryBackup::getUniqueFilename(std::string filename, std::string extension)
|
||||
{
|
||||
if(LLFile::isfile( (filename + extension).c_str() ))
|
||||
{
|
||||
int i = 1;
|
||||
while(LLFile::isfile( (filename + llformat(" %d", i) + extension).c_str() ))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
return filename + llformat(" %d", i) + extension;
|
||||
}
|
||||
return filename + extension;
|
||||
}
|
||||
|
||||
// static
|
||||
std::string LLInventoryBackup::getUniqueDirname(std::string dirname)
|
||||
{
|
||||
if(LLFile::isdir(dirname.c_str()))
|
||||
{
|
||||
int i = 1;
|
||||
while(LLFile::isdir( (dirname + llformat(" %d", i)).c_str() ))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
return dirname + llformat(" %d", i);
|
||||
}
|
||||
return dirname;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
void LLInventoryBackup::download(LLInventoryItem* item, LLFloater* floater, loaded_callback_func onImage, LLGetAssetCallback onAsset)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* userdata = new LLInventoryBackup::callbackdata();
|
||||
userdata->floater = floater;
|
||||
userdata->item = item;
|
||||
LLViewerFetchedTexture* imagep;
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_TEXTURE:
|
||||
imagep = LLViewerTextureManager::getFetchedTexture(item->getAssetUUID(), MIPMAP_TRUE, LLGLTexture::BOOST_UI);
|
||||
imagep->setLoadedCallback( onImage, 0, TRUE, FALSE, userdata, NULL ); // was setLoadedCallbackNoAuth
|
||||
break;
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
case LLAssetType::AT_SCRIPT:
|
||||
case LLAssetType::AT_LSL_TEXT: // normal script download
|
||||
case LLAssetType::AT_LSL_BYTECODE:
|
||||
gAssetStorage->getInvItemAsset(LLHost::invalid,
|
||||
gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
item->getPermissions().getOwner(),
|
||||
LLUUID::null,
|
||||
item->getUUID(),
|
||||
item->getAssetUUID(),
|
||||
item->getType(),
|
||||
onAsset,
|
||||
userdata, // user_data
|
||||
TRUE);
|
||||
break;
|
||||
case LLAssetType::AT_SOUND:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_ANIMATION:
|
||||
case LLAssetType::AT_GESTURE:
|
||||
default:
|
||||
gAssetStorage->getAssetData(item->getAssetUUID(), item->getType(), onAsset, userdata, TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLInventoryBackup::imageCallback(BOOL success,
|
||||
LLViewerFetchedTexture *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata)
|
||||
{
|
||||
if(final)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(!success)
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Download didn't work on " + item->getName() + ".";
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
AIFilePicker* filepicker = AIFilePicker::create();
|
||||
filepicker->open(LLDir::getScrubbedFileName(item->getName()), getSaveFilter(item));
|
||||
filepicker->run(boost::bind(&LLInventoryBackup::imageCallback_continued, src, filepicker));
|
||||
}
|
||||
else
|
||||
{
|
||||
src_vi->setBoostLevel(LLGLTexture::BOOST_UI);
|
||||
}
|
||||
}
|
||||
|
||||
void LLInventoryBackup::imageCallback_continued(LLImageRaw* src, AIFilePicker* filepicker)
|
||||
{
|
||||
if (!filepicker->hasFilename())
|
||||
return;
|
||||
|
||||
std::string filename = filepicker->getFilename();
|
||||
|
||||
LLPointer<LLImageTGA> image_tga = new LLImageTGA;
|
||||
if( !image_tga->encode( src ) )
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't encode file.";
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
}
|
||||
else if( !image_tga->save( filename ) )
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Couldn't write file.";
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLInventoryBackup::assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(status != 0)
|
||||
{
|
||||
LLSD args;
|
||||
args["ERROR_MESSAGE"] = "Download didn't work on " + item->getName() + ".";
|
||||
LLNotificationsUtil::add("ErrorMessage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: this doesn't work for static vfs shit
|
||||
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
|
||||
S32 size = file.getSize();
|
||||
|
||||
char* buffer = new char[size]; // Deleted in assetCallback_continued.
|
||||
if (buffer == NULL)
|
||||
{
|
||||
llerrs << "Memory Allocation Failed" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
file.read((U8*)buffer, size);
|
||||
|
||||
// Write it back out...
|
||||
|
||||
AIFilePicker* filepicker = AIFilePicker::create();
|
||||
filepicker->open(LLDir::getScrubbedFileName(item->getName()), getSaveFilter(item));
|
||||
filepicker->run(boost::bind(&LLInventoryBackup::assetCallback_continued, buffer, size, filepicker));
|
||||
}
|
||||
|
||||
// static
|
||||
void LLInventoryBackup::assetCallback_continued(char* buffer, S32 size, AIFilePicker* filepicker)
|
||||
{
|
||||
if (filepicker->hasFilename())
|
||||
{
|
||||
std::string filename = filepicker->getFilename();
|
||||
std::ofstream export_file(filename.c_str(), std::ofstream::binary);
|
||||
export_file.write(buffer, size);
|
||||
export_file.close();
|
||||
}
|
||||
delete [] buffer;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLInventoryBackup::climb(LLInventoryCategory* cat,
|
||||
std::vector<LLInventoryCategory*>& cats,
|
||||
std::vector<LLInventoryItem*>& items)
|
||||
{
|
||||
LLInventoryModel* model = &gInventory;
|
||||
|
||||
// Add this category
|
||||
cats.push_back(cat);
|
||||
|
||||
LLInventoryModel::cat_array_t *direct_cats;
|
||||
LLInventoryModel::item_array_t *direct_items;
|
||||
model->getDirectDescendentsOf(cat->getUUID(), direct_cats, direct_items);
|
||||
|
||||
// Add items
|
||||
LLInventoryModel::item_array_t::iterator item_iter = direct_items->begin();
|
||||
LLInventoryModel::item_array_t::iterator item_end = direct_items->end();
|
||||
for( ; item_iter != item_end; ++item_iter)
|
||||
{
|
||||
items.push_back(*item_iter);
|
||||
}
|
||||
|
||||
// Do subcategories
|
||||
LLInventoryModel::cat_array_t::iterator cat_iter = direct_cats->begin();
|
||||
LLInventoryModel::cat_array_t::iterator cat_end = direct_cats->end();
|
||||
for( ; cat_iter != cat_end; ++cat_iter)
|
||||
{
|
||||
climb(*cat_iter, cats, items);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
std::string LLInventoryBackup::getPath(LLInventoryCategory* cat, std::vector<LLInventoryCategory*> cats)
|
||||
{
|
||||
LLInventoryModel* model = &gInventory;
|
||||
std::string path = LLDir::getScrubbedFileName(cat->getName());
|
||||
LLInventoryCategory* parent = model->getCategory(cat->getParentUUID());
|
||||
while(parent && (std::find(cats.begin(), cats.end(), parent) != cats.end()))
|
||||
{
|
||||
path = LLDir::getScrubbedFileName(parent->getName()) + OS_SEP + path;
|
||||
parent = model->getCategory(parent->getParentUUID());
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLInventoryBackup::save(LLFolderView* folder)
|
||||
{
|
||||
LLInventoryModel* model = &gInventory;
|
||||
|
||||
std::set<LLUUID> selected_items = folder->getSelectionList();
|
||||
|
||||
if(selected_items.size() < 1)
|
||||
{
|
||||
// No items selected? Omg
|
||||
return;
|
||||
}
|
||||
else if(selected_items.size() == 1)
|
||||
{
|
||||
// One item. See if it's a folder
|
||||
LLUUID id = *(selected_items.begin());
|
||||
LLInventoryItem* item = model->getItem(id);
|
||||
if(item)
|
||||
{
|
||||
if(!itemIsFolder(item))
|
||||
{
|
||||
// Single item, save it now
|
||||
LLInventoryBackup::download((LLViewerInventoryItem*)item, NULL, imageCallback, assetCallback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We got here? We need to save multiple items or at least make a folder
|
||||
|
||||
std::vector<LLInventoryCategory*> cats;
|
||||
std::vector<LLInventoryItem*> items;
|
||||
|
||||
// Make complete lists of child categories and items
|
||||
std::set<LLUUID>::iterator sel_iter = selected_items.begin();
|
||||
std::set<LLUUID>::iterator sel_end = selected_items.end();
|
||||
for( ; sel_iter != sel_end; ++sel_iter)
|
||||
{
|
||||
LLInventoryCategory* cat = model->getCategory(*sel_iter);
|
||||
if(cat)
|
||||
{
|
||||
climb(cat, cats, items);
|
||||
}
|
||||
}
|
||||
|
||||
// And what about items inside a folder that wasn't selected?
|
||||
// I guess I will just add selected items, so long as they aren't already added
|
||||
for(sel_iter = selected_items.begin(); sel_iter != sel_end; ++sel_iter)
|
||||
{
|
||||
LLInventoryItem* item = model->getItem(*sel_iter);
|
||||
if(item)
|
||||
{
|
||||
if(std::find(items.begin(), items.end(), item) == items.end())
|
||||
{
|
||||
items.push_back(item);
|
||||
LLInventoryCategory* parent = model->getCategory(item->getParentUUID());
|
||||
if(std::find(cats.begin(), cats.end(), parent) == cats.end())
|
||||
{
|
||||
cats.push_back(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLInventoryBackupOrder* order = new LLInventoryBackupOrder();
|
||||
order->mCats = cats;
|
||||
order->mItems = items;
|
||||
LLFloaterInventoryBackupSettings* floater = new LLFloaterInventoryBackupSettings(order);
|
||||
floater->center();
|
||||
}
|
||||
|
||||
|
||||
|
||||
LLFloaterInventoryBackup::LLFloaterInventoryBackup(std::string path, std::vector<LLInventoryCategory*> cats, std::vector<LLInventoryItem*> items)
|
||||
: LLFloater(),
|
||||
mPath(path),
|
||||
mCats(cats),
|
||||
mItems(items),
|
||||
mBusy(0)
|
||||
{
|
||||
mItemsTotal = mItems.size();
|
||||
mItemsCompleted = 0;
|
||||
|
||||
LLFloaterInventoryBackup::sInstances.push_back(this);
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_backup.xml");
|
||||
}
|
||||
|
||||
|
||||
LLFloaterInventoryBackup::~LLFloaterInventoryBackup()
|
||||
{
|
||||
LLFloaterInventoryBackup::sInstances.remove(this);
|
||||
}
|
||||
|
||||
BOOL LLFloaterInventoryBackup::postBuild(void)
|
||||
{
|
||||
// Make progress bar
|
||||
|
||||
/*
|
||||
LLLineEditor* line = new LLLineEditor(
|
||||
std::string("progress_line"),
|
||||
LLRect(4, 80, 396, 60),
|
||||
std::string("Progress"));
|
||||
line->setEnabled(FALSE);
|
||||
addChild(line);
|
||||
|
||||
LLViewBorder* border = new LLViewBorder(
|
||||
"progress_border",
|
||||
LLRect(4, 79, 395, 60));
|
||||
addChild(border);
|
||||
*/
|
||||
|
||||
// Add all items to the list
|
||||
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("item_list");
|
||||
|
||||
std::vector<LLInventoryItem*>::iterator item_iter = mItems.begin();
|
||||
std::vector<LLInventoryItem*>::iterator item_end = mItems.end();
|
||||
for( ; item_iter != item_end; ++item_iter)
|
||||
{
|
||||
LLSD element;
|
||||
element["id"] = (*item_iter)->getUUID();
|
||||
|
||||
LLSD& type_column = element["columns"][LIST_TYPE];
|
||||
type_column["column"] = "type";
|
||||
type_column["type"] = "icon";
|
||||
type_column["value"] = "move_down_in.tga"; // FIXME
|
||||
|
||||
LLSD& name_column = element["columns"][LIST_NAME];
|
||||
name_column["column"] = "name";
|
||||
name_column["value"] = (*item_iter)->getName();
|
||||
|
||||
LLSD& status_column = element["columns"][LIST_STATUS];
|
||||
status_column["column"] = "status";
|
||||
status_column["value"] = "Pending";
|
||||
|
||||
/*LLScrollListItem* scroll_itemp = */list->addElement(element, ADD_BOTTOM);
|
||||
|
||||
//hack to stop crashing
|
||||
//LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(LIST_TYPE);
|
||||
//icon->setClickCallback(NULL);
|
||||
}
|
||||
|
||||
// Setup and go!
|
||||
mBusy = 1;
|
||||
mItemIter = mItems.begin();
|
||||
setStatus((*mItemIter)->getUUID(), "Downloading");
|
||||
LLInventoryBackup::download(*mItemIter, this, LLFloaterInventoryBackup::imageCallback, LLFloaterInventoryBackup::assetCallback);
|
||||
advance();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLFloaterInventoryBackup::advance()
|
||||
{
|
||||
while((mItemIter != mItems.end()) && (mBusy < 4))
|
||||
{
|
||||
mBusy++;
|
||||
mItemIter++;
|
||||
if(mItemIter >= mItems.end()) break;
|
||||
setStatus((*mItemIter)->getUUID(), "Downloading");
|
||||
LLInventoryBackup::download(*mItemIter, this, LLFloaterInventoryBackup::imageCallback, LLFloaterInventoryBackup::assetCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterInventoryBackup::setStatus(LLUUID itemid, std::string status)
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("item_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
std::vector<LLScrollListItem*>::iterator iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator end = items.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
if((*iter)->getUUID() == itemid)
|
||||
{
|
||||
(*iter)->getColumn(LIST_STATUS)->setValue(status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterInventoryBackup::finishItem(LLUUID itemid, std::string status)
|
||||
{
|
||||
// Update big happy progress bar
|
||||
mItemsCompleted++;
|
||||
LLView* progress_background = getChildView("progress_background", TRUE, TRUE);
|
||||
LLRect rect = progress_background->getRect();
|
||||
float item_count = (float)mItemsTotal;
|
||||
float item_pos = (float)mItemsCompleted;
|
||||
float rect_width = (float)rect.getWidth();
|
||||
float incr = rect_width / item_count;
|
||||
incr *= item_pos;
|
||||
rect.mRight = rect.mLeft + (S32)incr;
|
||||
LLView* progress_foreground = getChildView("progress_foreground", TRUE, TRUE);
|
||||
progress_foreground->setRect(rect);
|
||||
|
||||
if(mItemsCompleted >= mItemsTotal)
|
||||
{
|
||||
childSetText("progress_background", llformat("Completed %d items.", mItemsTotal));
|
||||
childSetVisible("progress_foreground", false);
|
||||
}
|
||||
|
||||
// Update item status
|
||||
setStatus(itemid, status);
|
||||
|
||||
// And advance
|
||||
mBusy--;
|
||||
advance();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterInventoryBackup::imageCallback(BOOL success,
|
||||
LLViewerFetchedTexture *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata)
|
||||
{
|
||||
if(final)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||
LLFloaterInventoryBackup* floater = (LLFloaterInventoryBackup*)(data->floater);
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(std::find(LLFloaterInventoryBackup::sInstances.begin(), LLFloaterInventoryBackup::sInstances.end(), floater) == LLFloaterInventoryBackup::sInstances.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!success)
|
||||
{
|
||||
floater->finishItem(item->getUUID(), "Failed download");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string filename = floater->mPath + OS_SEP + LLInventoryBackup::getPath(gInventory.getCategory(item->getParentUUID()), floater->mCats) + OS_SEP + LLDir::getScrubbedFileName(item->getName());
|
||||
filename = LLInventoryBackup::getUniqueFilename(filename, LLInventoryBackup::getExtension(item));
|
||||
|
||||
LLPointer<LLImageTGA> image_tga = new LLImageTGA;
|
||||
if( !image_tga->encode( src ) )
|
||||
{
|
||||
floater->finishItem(item->getUUID(), "Failed tga encode");
|
||||
}
|
||||
else if( !image_tga->save( filename ) )
|
||||
{
|
||||
floater->finishItem(item->getUUID(), "Failed save");
|
||||
}
|
||||
else
|
||||
{
|
||||
floater->finishItem(item->getUUID(), "Done");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
src_vi->setBoostLevel(LLGLTexture::BOOST_UI);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterInventoryBackup::assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||
LLFloaterInventoryBackup* floater = (LLFloaterInventoryBackup*)(data->floater);
|
||||
LLInventoryItem* item = data->item;
|
||||
|
||||
if(std::find(LLFloaterInventoryBackup::sInstances.begin(), LLFloaterInventoryBackup::sInstances.end(), floater) == LLFloaterInventoryBackup::sInstances.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(status != 0)
|
||||
{
|
||||
floater->finishItem(item->getUUID(), "Failed download");
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: this doesn't work for static vfs shit
|
||||
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
|
||||
S32 size = file.getSize();
|
||||
|
||||
char* buffer = new char[size];
|
||||
if (buffer == NULL)
|
||||
{
|
||||
//llerrs << "Memory Allocation Failed" << llendl;
|
||||
floater->finishItem(item->getUUID(), "Failed memory allocation");
|
||||
return;
|
||||
}
|
||||
|
||||
file.read((U8*)buffer, size);
|
||||
|
||||
// Write it back out...
|
||||
std::string filename = floater->mPath + OS_SEP + LLInventoryBackup::getPath(gInventory.getCategory(item->getParentUUID()), floater->mCats) + OS_SEP + LLDir::getScrubbedFileName(item->getName());
|
||||
filename = LLInventoryBackup::getUniqueFilename(filename, LLInventoryBackup::getExtension(item));
|
||||
|
||||
std::ofstream export_file(filename.c_str(), std::ofstream::binary);
|
||||
export_file.write(buffer, size);
|
||||
export_file.close();
|
||||
|
||||
floater->finishItem(item->getUUID(), "Done");
|
||||
}
|
||||
// </edit>
|
||||
@@ -1,141 +0,0 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLINVENTORYBACKUP_H
|
||||
#define LL_LLINVENTORYBACKUP_H
|
||||
|
||||
#if LL_WINDOWS
|
||||
#define OS_SEP "\\"
|
||||
#else
|
||||
#define OS_SEP "/"
|
||||
#endif
|
||||
|
||||
|
||||
#include "llviewerinventory.h"
|
||||
#include "llfolderview.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
#include "llviewertexture.h"
|
||||
#include "llfloater.h"
|
||||
|
||||
class AIDirPicker;
|
||||
|
||||
class LLInventoryBackupOrder
|
||||
{
|
||||
public:
|
||||
LLInventoryBackupOrder();
|
||||
|
||||
std::string mPath;
|
||||
std::vector<LLInventoryCategory*> mCats;
|
||||
std::vector<LLInventoryItem*> mItems;
|
||||
|
||||
bool mDownloadTextures;
|
||||
bool mDownloadSounds;
|
||||
bool mDownloadCallingCards;
|
||||
bool mDownloadLandmarks;
|
||||
bool mDownloadScripts;
|
||||
bool mDownloadWearables;
|
||||
bool mDownloadObjects;
|
||||
bool mDownloadNotecards;
|
||||
bool mDownloadAnimations;
|
||||
bool mDownloadGestures;
|
||||
//bool mDownloadOthers;
|
||||
};
|
||||
|
||||
class LLFloaterInventoryBackupSettings
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterInventoryBackupSettings(LLInventoryBackupOrder* order);
|
||||
BOOL postBuild(void);
|
||||
static void onClickNext(void* userdata);
|
||||
static void onClickNext_continued(void* userdata, AIDirPicker* dirpicker);
|
||||
|
||||
LLInventoryBackupOrder* mOrder;
|
||||
virtual ~LLFloaterInventoryBackupSettings();
|
||||
};
|
||||
|
||||
class LLFloaterInventoryBackup
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterInventoryBackup(std::string path, std::vector<LLInventoryCategory*> cats, std::vector<LLInventoryItem*> items);
|
||||
BOOL postBuild(void);
|
||||
|
||||
std::string mPath;
|
||||
std::vector<LLInventoryCategory*> mCats;
|
||||
std::vector<LLInventoryItem*> mItems;
|
||||
std::vector<LLInventoryItem*>::iterator mItemIter;
|
||||
int mBusy;
|
||||
|
||||
static std::list<LLFloaterInventoryBackup*> sInstances;
|
||||
|
||||
private:
|
||||
virtual ~LLFloaterInventoryBackup();
|
||||
void setStatus(LLUUID itemid, std::string status);
|
||||
void finishItem(LLUUID itemid, std::string status);
|
||||
void advance();
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerFetchedTexture *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
|
||||
int mItemsTotal;
|
||||
int mItemsCompleted;
|
||||
|
||||
enum LIST_COLUMN_ORDER
|
||||
{
|
||||
LIST_TYPE,
|
||||
LIST_NAME,
|
||||
LIST_STATUS
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class AIFilePicker;
|
||||
|
||||
class LLInventoryBackup
|
||||
{
|
||||
public:
|
||||
static ESaveFilter getSaveFilter(LLInventoryItem* item);
|
||||
static std::string getExtension(LLInventoryItem* item);
|
||||
static std::string getUniqueFilename(std::string filename, std::string extension);
|
||||
static std::string getUniqueDirname(std::string dirname);
|
||||
static bool itemIsFolder(LLInventoryItem* item);
|
||||
static void save(LLFolderView* folder);
|
||||
static void download(LLInventoryItem* item, LLFloater* floater, loaded_callback_func onImage, LLGetAssetCallback onAsset);
|
||||
static std::string getPath(LLInventoryCategory* cat, std::vector<LLInventoryCategory*> cats);
|
||||
|
||||
struct callbackdata
|
||||
{
|
||||
LLFloater* floater;
|
||||
LLInventoryItem* item;
|
||||
};
|
||||
|
||||
private:
|
||||
static void imageCallback(BOOL success,
|
||||
LLViewerFetchedTexture *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
static void imageCallback_continued(LLImageRaw* src, AIFilePicker* filepicker);
|
||||
static void assetCallback(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
static void assetCallback_continued(char* buffer, S32 size, AIFilePicker* filepicker);
|
||||
static void climb(LLInventoryCategory* cat,
|
||||
std::vector<LLInventoryCategory*>& cats,
|
||||
std::vector<LLInventoryItem*>& items);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
@@ -108,8 +108,6 @@
|
||||
#include "llappviewer.h" // System Folders
|
||||
#include "llfloateranimpreview.h" // for reuploads
|
||||
#include "llfloaterimagepreview.h" // for reuploads
|
||||
//#include "llcheats.h"
|
||||
#include "hgfloatertexteditor.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
// </edit>
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "llpreviewtexture.h"
|
||||
#include "llpreviewgesture.h"
|
||||
#include "llpreviewlandmark.h"
|
||||
#include "hgfloatertexteditor.h"
|
||||
|
||||
#include "llappviewer.h"
|
||||
|
||||
|
||||
@@ -250,7 +250,6 @@
|
||||
#include "lltexlayer.h"
|
||||
|
||||
// <edit>
|
||||
#include "hgfloatertexteditor.h"
|
||||
#include "llfloatervfs.h"
|
||||
#include "llfloatervfsexplorer.h"
|
||||
#include "llfloatermessagelog.h"
|
||||
|
||||
@@ -1,9 +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="true" height="200" width="580" min_width="580" min_height="128"
|
||||
name="floater_asset_text_editor" title="Text Editor" rect_control="FloaterAssetTextEditorRect">
|
||||
<text name="status_text" follows="left|top" left="10" top="-25" height="20">Loading...</text>
|
||||
<button name="upload_btn" follows="right|top" top="-25" right="-120" width="100" bottom="155" label="[UPLOAD]" enabled="false"/>
|
||||
<button name="save_btn" follows="right|top" top="-25" right="-10" width="100" bottom="155" label="Save" enabled="false"/>
|
||||
<simple_text_editor name="text_editor" follows="left|top|right|bottom" left="10" top="-50" right="-10" bottom="10" max_length="2147483647" embedded_items="true" visible="false"/>
|
||||
</floater>
|
||||
@@ -1,18 +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="true" height="500" width="400" min_width="310" min_height="200"
|
||||
name="floater_inventory_backup" title="Inventory Backup">
|
||||
<scroll_list bottom="60" can_resize="true" column_padding="0" draw_heading="true"
|
||||
follows="left|top|bottom|right" left="10" multi_select="true"
|
||||
name="item_list" right="-10" search_column="1" top="-25">
|
||||
<column name="type" width="20" />
|
||||
<column dynamicwidth="true" label="Name" name="name" />
|
||||
<column dynamicwidth="true" name="status" label="Status" />
|
||||
</scroll_list>
|
||||
|
||||
<line_editor name="progress_background" bottom="10" top="50" height="20" left="10" right="-10"
|
||||
can_resize="true" follows="left|bottom|right" enabled="false" />
|
||||
<line_editor name="progress_foreground" bottom="10" top="50" height="20" left="10" width="0"
|
||||
can_resize="true" follows="left|bottom|right" enabled="false"
|
||||
bg_readonly_color="0.5 0.5 0.5" />
|
||||
</floater>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<floater can_close="true" can_drag_on_left="false" can_minimize="false" can_resize="false"
|
||||
width="200" height="300" name="inventory_backup_settings" title="Download Options">
|
||||
<check_box bottom_delta="-50" follows="left|top" left="10" name="chk_textures" label="Textures" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_sounds" label="Sounds" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_callingcards" label="Calling Cards" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_landmarks" label="Landmarks" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_scripts" label="Scripts" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_wearables" label="Wearables" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_objects" label="Objects" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_notecards" label="Notecards" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_animations" label="Animations" />
|
||||
<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_gestures" label="Gestures" />
|
||||
<!--<check_box bottom_delta="-20" follows="left|top" left="10" name="chk_others" label="Others" />-->
|
||||
<button bottom="10" follows="bottom|left" height="20" label="Next >>"
|
||||
left="110" width="80" name="next_btn" />
|
||||
</floater>
|
||||
Reference in New Issue
Block a user