summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-06-15 14:48:14 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-06-15 14:48:14 +0100
commitf4b7164752ad8a2ec99b7e30b88661520b74569d (patch)
tree2c1fcac6827dab21481b70d37d1f0f83efea8adb /indra/newview
parent7480e069349e2b3a7581267d13f52c63e459af64 (diff)
Backed out changeset 1c66b34b7fbe
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llassetuploadresponders.cpp26
-rw-r--r--indra/newview/llassetuploadresponders.h12
-rw-r--r--indra/newview/llfloateranimpreview.cpp9
-rw-r--r--indra/newview/llfloaternamedesc.cpp6
-rw-r--r--indra/newview/llfloatersnapshot.cpp102
-rw-r--r--indra/newview/llfloatersnapshot.h2
-rw-r--r--indra/newview/llviewermenufile.cpp121
-rw-r--r--indra/newview/llviewermenufile.h14
8 files changed, 131 insertions, 161 deletions
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 1d92c396b4..80cf8f1d61 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -199,19 +199,13 @@ void LLAssetUploadResponder::uploadComplete(const LLSD& content)
LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data,
const LLUUID& vfile_id,
- LLAssetType::EType asset_type,
- boost::function<void(const LLUUID& uuid)> callback)
-: LLAssetUploadResponder(post_data, vfile_id, asset_type),
- mCallback(callback)
+ LLAssetType::EType asset_type)
+: LLAssetUploadResponder(post_data, vfile_id, asset_type)
{
}
-LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data,
- const std::string& file_name,
- LLAssetType::EType asset_type,
- boost::function<void(const LLUUID& uuid)> callback)
-: LLAssetUploadResponder(post_data, file_name, asset_type),
- mCallback(callback)
+LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type)
+: LLAssetUploadResponder(post_data, file_name, asset_type)
{
}
@@ -289,12 +283,6 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
creation_date_now);
gInventory.updateItem(item);
gInventory.notifyObservers();
-
- if (mCallback)
- {
- // call the callback with the new Asset UUID
- mCallback(item->getAssetUUID());
- }
// Show the preview panel for textures and sounds to let
// user know that the image (or snapshot) arrived intact.
@@ -342,11 +330,13 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
U32 group_perms = mPostData.has("group_mask") ? mPostData.get("group_mask" ).asInteger() : PERM_NONE;
U32 next_owner_perms = mPostData.has("next_owner_mask") ? mPostData.get("next_owner_mask").asInteger() : PERM_NONE;
std::string display_name = LLStringUtil::null;
+ LLAssetStorage::LLStoreAssetCallback callback = NULL;
+ void *userdata = NULL;
upload_new_resource(next_file, asset_name, asset_name,
- LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
+ 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
next_owner_perms, group_perms,
everyone_perms, display_name,
- NULL, expected_upload_cost);
+ callback, expected_upload_cost, userdata);
}
}
diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h
index ade9c96758..e656351305 100644
--- a/indra/newview/llassetuploadresponders.h
+++ b/indra/newview/llassetuploadresponders.h
@@ -33,7 +33,6 @@
#ifndef LL_LLASSETUPLOADRESPONDER_H
#define LL_LLASSETUPLOADRESPONDER_H
-#include "llassetstorage.h"
#include "llhttpclient.h"
// Abstract class for supporting asset upload
@@ -67,15 +66,10 @@ class LLNewAgentInventoryResponder : public LLAssetUploadResponder
public:
LLNewAgentInventoryResponder(const LLSD& post_data,
const LLUUID& vfile_id,
- LLAssetType::EType asset_type,
- boost::function<void(const LLUUID& uuid)> callback = NULL);
- LLNewAgentInventoryResponder(const LLSD& post_data,
- const std::string& file_name,
- LLAssetType::EType asset_type,
- boost::function<void(const LLUUID& uuid)> callback = NULL);
+ LLAssetType::EType asset_type);
+ LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name,
+ LLAssetType::EType asset_type);
virtual void uploadComplete(const LLSD& content);
-
- boost::function<void(const LLUUID& uuid)> mCallback;
};
class LLBakedUploadData;
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index feb18fe393..5ec58c8dd6 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -1001,18 +1001,19 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata)
{
std::string name = floaterp->childGetValue("name_form").asString();
std::string desc = floaterp->childGetValue("description_form").asString();
+ LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+ void *userdata = NULL;
upload_new_resource(floaterp->mTransactionID, // tid
LLAssetType::AT_ANIMATION,
name,
desc,
+ 0,
LLFolderType::FT_NONE,
LLInventoryType::IT_ANIMATION,
- LLFloaterPerms::getNextOwnerPerms(),
- LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
+ LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
name,
- NULL,
- expected_upload_cost);
+ callback, expected_upload_cost, userdata);
}
else
{
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index 5c343ecb22..159ce41b79 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -169,14 +169,16 @@ void LLFloaterNameDesc::onBtnOK( )
{
childDisable("ok_btn"); // don't allow inadvertent extra uploads
+ LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass).
+ void *nruserdata = NULL;
std::string display_name = LLStringUtil::null;
upload_new_resource(mFilenameAndPath, // file
childGetValue("name_form").asString(),
childGetValue("description_form").asString(),
- LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
+ 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
- display_name, NULL, expected_upload_cost);
+ display_name, callback, expected_upload_cost, nruserdata);
closeFloater(false);
}
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 9ce6230d5c..2df297fc42 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -39,7 +39,6 @@
// Viewer includes
#include "llagent.h"
#include "llagentui.h"
-#include "llavatarpropertiesprocessor.h"
#include "llbottomtray.h"
#include "llbutton.h"
#include "llcallbacklist.h"
@@ -167,7 +166,7 @@ public:
void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; }
void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
LLFloaterPostcard* savePostcard();
- void saveTexture(bool set_as_profile_pic = false);
+ void saveTexture();
BOOL saveLocal();
void saveWeb(std::string url);
@@ -975,21 +974,13 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
return floater;
}
-// Callback for asset upload
-void profile_pic_upload_callback(const LLUUID& uuid)
-{
- LLFloaterSnapshot* floater = LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot");
- floater->setAsProfilePic(uuid);
-}
-
-
-void LLSnapshotLivePreview::saveTexture(bool set_as_profile_pic)
+void LLSnapshotLivePreview::saveTexture()
{
// gen a new uuid for this asset
LLTransactionID tid;
tid.generate();
LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-
+
LLPointer<LLImageJ2C> formatted = new LLImageJ2C;
LLPointer<LLImageRaw> scaled = new LLImageRaw(mPreviewImage->getData(),
mPreviewImage->getWidth(),
@@ -1000,30 +991,26 @@ void LLSnapshotLivePreview::saveTexture(bool set_as_profile_pic)
if (formatted->encode(scaled, 0.0f))
{
- boost::function<void(const LLUUID& uuid)> callback = NULL;
-
- if (set_as_profile_pic)
- {
- callback = profile_pic_upload_callback;
- }
-
LLVFile::writeFile(formatted->getData(), formatted->getDataSize(), gVFS, new_asset_id, LLAssetType::AT_TEXTURE);
std::string pos_string;
LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL);
std::string who_took_it;
LLAgentUI::buildFullname(who_took_it);
+ LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+ void *userdata = NULL;
upload_new_resource(tid, // tid
LLAssetType::AT_TEXTURE,
"Snapshot : " + pos_string,
"Taken by " + who_took_it + " at " + pos_string,
+ 0,
LLFolderType::FT_SNAPSHOT_CATEGORY,
LLInventoryType::IT_SNAPSHOT,
PERM_ALL, // Note: Snapshots to inventory is a special case of content upload
PERM_NONE, // that ignores the user's premissions preferences and continues to
PERM_NONE, // always use these fairly permissive hard-coded initial perms. - MG
"Snapshot : " + pos_string,
- callback, expected_upload_cost);
+ callback, expected_upload_cost, userdata);
gViewerWindow->playSnapshotAnimAndSound();
}
else
@@ -1164,7 +1151,6 @@ public:
static void onCommitSnapshotFormat(LLUICtrl* ctrl, void* data);
static void onCommitCustomResolution(LLUICtrl *ctrl, void* data);
static void onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type);
- static void onCommitProfilePic(LLFloaterSnapshot* view);
static void onToggleAdvanced(LLUICtrl *ctrl, void* data);
static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ;
static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
@@ -1675,60 +1661,6 @@ void LLFloaterSnapshot::Impl::onToggleAdvanced(LLUICtrl* ctrl, void* data)
}
}
-// This object represents a pending request for avatar properties information
-class LLAvatarDataRequest : public LLAvatarPropertiesObserver
-{
-public:
- LLAvatarDataRequest(const LLUUID& avatar_id, const LLUUID& image_id, LLFloaterSnapshot* floater)
- : mAvatarID(avatar_id),
- mImageID(image_id),
- mSnapshotFloater(floater)
-
- {
- }
-
- ~LLAvatarDataRequest()
- {
- // remove ourselves as an observer
- LLAvatarPropertiesProcessor::getInstance()->
- removeObserver(mAvatarID, this);
- }
-
- void processProperties(void* data, EAvatarProcessorType type)
- {
- // route the data to the inspector
- if (data
- && type == APT_PROPERTIES)
- {
-
- LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
-
- LLAvatarData new_data(*avatar_data);
- new_data.image_id = mImageID;
-
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&new_data);
-
- delete this;
- }
- }
-
- // Store avatar ID so we can un-register the observer on destruction
- LLUUID mAvatarID;
- LLUUID mImageID;
- LLFloaterSnapshot* mSnapshotFloater;
-};
-
-void LLFloaterSnapshot::Impl::onCommitProfilePic(LLFloaterSnapshot* view)
-{
- //first save to harddrive
- LLSnapshotLivePreview* previewp = getPreviewView(view);
-
- if(previewp)
- {
- previewp->saveTexture(true);
- }
-}
-
void LLFloaterSnapshot::Impl::onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type)
{
LLSnapshotLivePreview* previewp = getPreviewView(view);
@@ -1785,6 +1717,8 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data)
}
}
+
+
// Sets the named size combo to "custom" mode.
// static
void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname)
@@ -1798,6 +1732,8 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const s
checkAspectRatio(floater, -1); // -1 means custom
}
+
+
//static
BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
{
@@ -1989,8 +1925,7 @@ BOOL LLFloaterSnapshot::postBuild()
getChild<LLButton>("share_to_email")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_POSTCARD));
getChild<LLButton>("save_to_inventory")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_TEXTURE));
getChild<LLButton>("save_to_computer")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_LOCAL));
- getChild<LLButton>("set_profile_pic")->setCommitCallback(boost::bind(&Impl::onCommitProfilePic, this));
-
+
childSetCommitCallback("show_advanced", Impl::onToggleAdvanced, this);
childSetCommitCallback("hide_advanced", Impl::onToggleAdvanced, this);
@@ -2147,6 +2082,7 @@ void LLFloaterSnapshot::update()
}
}
+
bool LLFloaterSnapshot::updateButtons(ESnapshotMode mode)
{
childSetVisible("share", mode == SNAPSHOT_MAIN);
@@ -2163,18 +2099,6 @@ bool LLFloaterSnapshot::updateButtons(ESnapshotMode mode)
return true;
}
-
-void LLFloaterSnapshot::setAsProfilePic(const LLUUID& image_id)
-{
- LLAvatarDataRequest* avatar_data_request = new LLAvatarDataRequest(gAgent.getID(), image_id, this);
-
- LLAvatarPropertiesProcessor* processor =
- LLAvatarPropertiesProcessor::getInstance();
-
- processor->addObserver(gAgent.getID(), avatar_data_request);
- processor->sendAvatarPropertiesRequest(gAgent.getID());
-}
-
///----------------------------------------------------------------------------
/// Class LLSnapshotFloaterView
///----------------------------------------------------------------------------
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 931d355748..d876fc4781 100644
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -64,8 +64,6 @@ public:
static void update();
- void setAsProfilePic(const LLUUID& image_id);
-
bool updateButtons(ESnapshotMode mode);
static S32 getUIWinHeightLong() {return sUIWinHeightLong ;}
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 0d855c17a9..00762894cd 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -317,11 +317,13 @@ class LLFileUploadBulk : public view_listener_t
LLStringUtil::trim(asset_name);
std::string display_name = LLStringUtil::null;
+ LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
- upload_new_resource(filename, asset_name, asset_name, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
+ void *userdata = NULL;
+ upload_new_resource(filename, asset_name, asset_name, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
display_name,
- NULL, expected_upload_cost);
+ callback, expected_upload_cost, userdata);
// *NOTE: Ew, we don't iterate over the file list here,
// we handle the next files in upload_done_callback()
@@ -478,15 +480,16 @@ void handle_compress_image(void*)
}
void upload_new_resource(const std::string& src_filename, std::string name,
- std::string desc,
+ std::string desc, S32 compression_info,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms,
const std::string& display_name,
- boost::function<void(const LLUUID& uuid)> callback,
- S32 expected_upload_cost)
+ LLAssetStorage::LLStoreAssetCallback callback,
+ S32 expected_upload_cost,
+ void *userdata)
{
// Generate the temporary UUID.
std::string filename = gDirUtilp->getTempFilename();
@@ -768,9 +771,9 @@ void upload_new_resource(const std::string& src_filename, std::string name,
{
t_disp_name = src_filename;
}
- upload_new_resource(tid, asset_type, name, desc,
+ upload_new_resource(tid, asset_type, name, desc, compression_info, // tid
destination_folder_type, inv_type, next_owner_perms, group_perms, everyone_perms,
- display_name, callback, expected_upload_cost);
+ display_name, callback, expected_upload_cost, userdata);
}
else
{
@@ -889,28 +892,30 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
LLStringUtil::trim(asset_name);
std::string display_name = LLStringUtil::null;
+ LLAssetStorage::LLStoreAssetCallback callback = NULL;
+ void *userdata = NULL;
upload_new_resource(next_file, asset_name, asset_name, // file
- LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
+ 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
PERM_NONE, PERM_NONE, PERM_NONE,
display_name,
- NULL,
- expected_upload_cost); // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost
-
+ callback,
+ expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost
+ userdata);
}
}
-void upload_new_resource(const LLTransactionID &tid,
- LLAssetType::EType asset_type,
+void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type,
std::string name,
- std::string desc,
+ std::string desc, S32 compression_info,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms,
const std::string& display_name,
- boost::function<void(const LLUUID& uuid)> callback,
- S32 expected_upload_cost)
+ LLAssetStorage::LLStoreAssetCallback callback,
+ S32 expected_upload_cost,
+ void *userdata)
{
if(gDisconnected)
{
@@ -954,26 +959,76 @@ void upload_new_resource(const LLTransactionID &tid,
upload_message.append(display_name);
LLUploadDialog::modalUploadDialog(upload_message);
+ llinfos << "*** Uploading: " << llendl;
+ llinfos << "Type: " << LLAssetType::lookup(asset_type) << llendl;
+ llinfos << "UUID: " << uuid << llendl;
+ llinfos << "Name: " << name << llendl;
+ llinfos << "Desc: " << desc << llendl;
+ llinfos << "Expected Upload Cost: " << expected_upload_cost << llendl;
+ lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << llendl;
+ lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl;
std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory");
-
- if (url.empty()) {
- llwarns << "Could not get NewFileAgentInventory capability" << llendl;
- return;
- }
+ if (!url.empty())
+ {
+ llinfos << "New Agent Inventory via capability" << llendl;
+ LLSD body;
+ body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type);
+ body["asset_type"] = LLAssetType::lookup(asset_type);
+ body["inventory_type"] = LLInventoryType::lookup(inv_type);
+ body["name"] = name;
+ body["description"] = desc;
+ body["next_owner_mask"] = LLSD::Integer(next_owner_perms);
+ body["group_mask"] = LLSD::Integer(group_perms);
+ body["everyone_mask"] = LLSD::Integer(everyone_perms);
+ body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
+
+ //std::ostringstream llsdxml;
+ //LLSDSerialize::toPrettyXML(body, llsdxml);
+ //llinfos << "posting body to capability: " << llsdxml.str() << llendl;
- llinfos << "New Agent Inventory via capability" << llendl;
- LLSD body;
- body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type);
- body["asset_type"] = LLAssetType::lookup(asset_type);
- body["inventory_type"] = LLInventoryType::lookup(inv_type);
- body["name"] = name;
- body["description"] = desc;
- body["next_owner_mask"] = LLSD::Integer(next_owner_perms);
- body["group_mask"] = LLSD::Integer(group_perms);
- body["everyone_mask"] = LLSD::Integer(everyone_perms);
- body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
+ LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type));
+ }
+ else
+ {
+ llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl;
+ // check for adequate funds
+ // TODO: do this check on the sim
+ if (LLAssetType::AT_SOUND == asset_type ||
+ LLAssetType::AT_TEXTURE == asset_type ||
+ LLAssetType::AT_ANIMATION == asset_type)
+ {
+ S32 balance = gStatusBar->getBalance();
+ if (balance < expected_upload_cost)
+ {
+ // insufficient funds, bail on this upload
+ LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs"), expected_upload_cost);
+ return;
+ }
+ }
- LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type, callback));
+ LLResourceData* data = new LLResourceData;
+ data->mAssetInfo.mTransactionID = tid;
+ data->mAssetInfo.mUuid = uuid;
+ data->mAssetInfo.mType = asset_type;
+ data->mAssetInfo.mCreatorID = gAgentID;
+ data->mInventoryType = inv_type;
+ data->mNextOwnerPerm = next_owner_perms;
+ data->mExpectedUploadCost = expected_upload_cost;
+ data->mUserData = userdata;
+ data->mAssetInfo.setName(name);
+ data->mAssetInfo.setDescription(desc);
+ data->mPreferredLocation = destination_folder_type;
+
+ LLAssetStorage::LLStoreAssetCallback asset_callback = &upload_done_callback;
+ if (callback)
+ {
+ asset_callback = callback;
+ }
+ gAssetStorage->storeAssetData(data->mAssetInfo.mTransactionID, data->mAssetInfo.mType,
+ asset_callback,
+ (void*)data,
+ FALSE);
+ }
}
void init_menu_file()
diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h
index 33f8243ac0..1e6d13f1c6 100644
--- a/indra/newview/llviewermenufile.h
+++ b/indra/newview/llviewermenufile.h
@@ -34,35 +34,41 @@
#define LLVIEWERMENUFILE_H
#include "llfoldertype.h"
+#include "llassetstorage.h"
#include "llinventorytype.h"
class LLTransactionID;
+
void init_menu_file();
void upload_new_resource(const std::string& src_filename,
std::string name,
std::string desc,
+ S32 compression_info,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms,
const std::string& display_name,
- boost::function<void(const LLUUID& uuid)> callback,
- S32 expected_upload_cost);
+ LLAssetStorage::LLStoreAssetCallback callback,
+ S32 expected_upload_cost,
+ void *userdata);
void upload_new_resource(const LLTransactionID &tid,
LLAssetType::EType type,
std::string name,
std::string desc,
+ S32 compression_info,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms,
const std::string& display_name,
- boost::function<void(const LLUUID& uuid)> callback,
- S32 expected_upload_cost);
+ LLAssetStorage::LLStoreAssetCallback callback,
+ S32 expected_upload_cost,
+ void *userdata);
#endif