summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llfloaterbvhpreview.cpp28
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp7
-rw-r--r--indra/newview/llviewerassetupload.cpp147
-rw-r--r--indra/newview/llviewerassetupload.h3
-rwxr-xr-xindra/newview/llviewermenufile.cpp267
-rwxr-xr-xindra/newview/llviewermenufile.h105
6 files changed, 249 insertions, 308 deletions
diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp
index edc1421588..39b5a40efc 100755
--- a/indra/newview/llfloaterbvhpreview.cpp
+++ b/indra/newview/llfloaterbvhpreview.cpp
@@ -993,29 +993,15 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata)
std::string name = floaterp->getChild<LLUICtrl>("name_form")->getValue().asString();
std::string desc = floaterp->getChild<LLUICtrl>("description_form")->getValue().asString();
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-#if 1
- NewResourceUploadInfo::ptr_t assetUpdloadInfo(new NewResourceUploadInfo(name, desc, 0,
+
+ NewResourceUploadInfo::ptr_t assetUpdloadInfo(new NewResourceUploadInfo(
+ floaterp->mTransactionID, LLAssetType::AT_ANIMATION,
+ name, desc, 0,
LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION,
LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"),
- name, expected_upload_cost));
-
- upload_new_resource(floaterp->mTransactionID, LLAssetType::AT_ANIMATION,
- assetUpdloadInfo);
-#else
- LLAssetStorage::LLStoreAssetCallback callback = NULL;
- void *userdata = NULL;
-
- upload_new_resource(floaterp->mTransactionID, // tid
- LLAssetType::AT_ANIMATION,
- name,
- desc,
- 0,
- LLFolderType::FT_NONE,
- LLInventoryType::IT_ANIMATION,
- LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"),
- name,
- callback, expected_upload_cost, userdata);
-#endif
+ expected_upload_cost));
+
+ upload_new_resource(assetUpdloadInfo);
}
else
{
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index bbf560f3fa..bbb5db4a0a 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -1009,12 +1009,13 @@ void LLSnapshotLivePreview::saveTexture()
std::string name = "Snapshot: " + pos_string;
std::string desc = "Taken by " + who_took_it + " at " + pos_string;
- NewResourceUploadInfo::ptr_t assetUploadInfo(new NewResourceUploadInfo(name, desc, 0,
+ NewResourceUploadInfo::ptr_t assetUploadInfo(new NewResourceUploadInfo(
+ tid, LLAssetType::AT_TEXTURE, name, desc, 0,
LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT,
PERM_ALL, LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"),
- name, expected_upload_cost));
+ expected_upload_cost));
- upload_new_resource(tid, LLAssetType::AT_TEXTURE, assetUploadInfo);
+ upload_new_resource(assetUploadInfo);
#else
LLAssetStorage::LLStoreAssetCallback callback = NULL;
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index b6bc17c6c9..cd4e7c33ef 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -35,7 +35,14 @@
#include "lluuid.h"
#include "llvorbisencode.h"
#include "lluploaddialog.h"
+#include "llpreviewscript.h"
+#include "llnotificationsutil.h"
#include "lleconomy.h"
+#include "llagent.h"
+#include "llfloaterreg.h"
+#include "llstatusbar.h"
+#include "llinventorypanel.h"
+#include "llsdutil.h"
//=========================================================================
/*static*/
@@ -44,35 +51,49 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
{
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- uploadInfo->prepareUpload();
+ LLSD result = uploadInfo->prepareUpload();
uploadInfo->logPreparedUpload();
+ if (result.has("error"))
+ {
+ HandleUploadError(LLCore::HttpStatus(499), result, uploadInfo);
+ return;
+ }
+
+ //self.yield();
+
std::string uploadMessage = "Uploading...\n\n";
uploadMessage.append(uploadInfo->getDisplayName());
LLUploadDialog::modalUploadDialog(uploadMessage);
LLSD body = uploadInfo->generatePostBody();
- LLSD result = httpAdapter->postAndYield(httpRequest, url, body);
+ result = httpAdapter->postAndYield(httpRequest, url, body);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
- if (!status)
+ if ((!status) || (result.has("error")))
{
-
+ HandleUploadError(status, result, uploadInfo);
+ LLUploadDialog::modalUploadFinished();
+ return;
}
std::string uploader = result["uploader"].asString();
result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
+ httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
-
+ HandleUploadError(status, result, uploadInfo);
+ LLUploadDialog::modalUploadFinished();
+ return;
}
- S32 expected_upload_cost = 0;
+ S32 uploadPrice = 0;
// Update L$ and ownership credit information
// since it probably changed on the server
@@ -81,58 +102,104 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
uploadInfo->getAssetType() == LLAssetType::AT_ANIMATION ||
uploadInfo->getAssetType() == LLAssetType::AT_MESH)
{
- expected_upload_cost =
- LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+ uploadPrice = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
}
- on_new_single_inventory_upload_complete(
- uploadInfo->getAssetType(),
- uploadInfo->getInventoryType(),
- uploadInfo->getAssetTypeString(), // note the paramert calls for inv_type string...
- uploadInfo->getFolderId(),
- uploadInfo->getName(),
- uploadInfo->getDescription(),
- result,
- expected_upload_cost);
-
-#if 0
-
- LLSD initalBody = generate_new_resource_upload_capability_body();
-
+ bool success = false;
+ if (uploadPrice > 0)
+ {
+ // this upload costed us L$, update our balance
+ // and display something saying that it cost L$
+ LLStatusBar::sendMoneyBalanceRequest();
- LLSD result = httpAdapter->postAndYield(httpRequest, url, initalBody);
+ LLSD args;
+ args["AMOUNT"] = llformat("%d", uploadPrice);
+ LLNotificationsUtil::add("UploadPayment", args);
+ }
- LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ LLUUID serverInventoryItem = uploadInfo->finishUpload(result);
- if (!status)
+ if (serverInventoryItem.notNull())
{
-
+ success = true;
+
+ // Show the preview panel for textures and sounds to let
+ // user know that the image (or snapshot) arrived intact.
+ LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel();
+ if (panel)
+ {
+ LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
+ panel->setSelection(serverInventoryItem, TAKE_FOCUS_NO);
+
+ // restore keyboard focus
+ gFocusMgr.setKeyboardFocus(focus);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
}
- std::string state = result["state"].asString();
+ // remove the "Uploading..." message
+ LLUploadDialog::modalUploadFinished();
- if (state == "upload")
+ // Let the Snapshot floater know we have finished uploading a snapshot to inventory.
+ LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot");
+ if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_snapshot)
{
-// Upload the file...
- result = httpAdapter->postFileAndYield(httpRequest, url, initalBody);
+ floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));
+ }
+}
- httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+//=========================================================================
+/*static*/
+void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &result, NewResourceUploadInfo::ptr_t &uploadInfo)
+{
+ std::string reason;
+ std::string label("CannotUploadReason");
- state = result["state"].asString();
+ LL_WARNS() << ll_pretty_print_sd(result) << LL_ENDL;
+
+ if (result.has("label"))
+ {
+ label = result["label"];
}
- if (state == "complete")
+ if (result.has("message"))
{
- // done with the upload.
+ reason = result["message"];
}
else
{
- // an error occurred
+ if (status.getType() == 499)
+ {
+ reason = "The server is experiencing unexpected difficulties.";
+ }
+ else
+ {
+ reason = "Error in upload request. Please visit "
+ "http://secondlife.com/support for help fixing this problem.";
+ }
}
-#endif
-}
-//=========================================================================
+ LLSD args;
+ args["FILE"] = uploadInfo->getDisplayName();
+ args["REASON"] = reason;
+
+ LLNotificationsUtil::add(label, args);
+
+ // unfreeze script preview
+ if (uploadInfo->getAssetType() == LLAssetType::AT_LSL_TEXT)
+ {
+ LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script",
+ uploadInfo->getItemId());
+ if (preview)
+ {
+ LLSD errors;
+ errors.append(LLTrans::getString("UploadFailed") + reason);
+ preview->callbackLSLCompileFailed(errors);
+ }
+ }
+
+}
diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h
index ab766e1d7d..38167fc0c7 100644
--- a/indra/newview/llviewerassetupload.h
+++ b/indra/newview/llviewerassetupload.h
@@ -44,7 +44,8 @@ public:
static void AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id,
std::string url, NewResourceUploadInfo::ptr_t uploadInfo);
-
+private:
+ static void HandleUploadError(LLCore::HttpStatus status, LLSD &result, NewResourceUploadInfo::ptr_t &uploadInfo);
};
#endif // !VIEWER_ASSET_UPLOAD_H
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index c9c670aaff..e9eb0e807a 100755
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -85,8 +85,9 @@ class LLFileEnableUpload : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
- return new_value;
+ return true;
+// bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
+// return new_value;
}
};
@@ -757,38 +758,15 @@ LLUUID upload_new_resource(
if (!error)
{
- std::string t_disp_name = display_name;
- if (t_disp_name.empty())
- {
- t_disp_name = src_filename;
- }
-
-#if 1
NewResourceUploadInfo::ptr_t uploadInfo(new NewResourceUploadInfo(
+ tid, asset_type,
name, desc, compression_info,
destination_folder_type, inv_type,
next_owner_perms, group_perms, everyone_perms,
- display_name, expected_upload_cost));
+ expected_upload_cost));
- upload_new_resource(tid, asset_type, uploadInfo,
+ upload_new_resource(uploadInfo,
callback, userdata);
-#else
- 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,
- userdata);
-#endif
}
else
{
@@ -933,63 +911,7 @@ void upload_done_callback(
}
}
-#if 0
-static LLAssetID upload_new_resource_prep(
- const LLTransactionID& tid,
- LLAssetType::EType asset_type,
- LLInventoryType::EType& inventory_type,
- std::string& name,
- const std::string& display_name,
- std::string& description)
-{
- LLAssetID uuid = generate_asset_id_for_new_upload(tid);
-
- increase_new_upload_stats(asset_type);
-
- assign_defaults_and_show_upload_message(
- asset_type,
- inventory_type,
- name,
- display_name,
- description);
-
- return uuid;
-}
-#endif
-
-#if 0
-LLSD generate_new_resource_upload_capability_body(
- LLAssetType::EType asset_type,
- const std::string& name,
- const std::string& desc,
- LLFolderType::EType destination_folder_type,
- LLInventoryType::EType inv_type,
- U32 next_owner_perms,
- U32 group_perms,
- U32 everyone_perms)
-{
- LLSD body;
-
- body["folder_id"] = gInventory.findCategoryUUIDForType(
- (destination_folder_type == LLFolderType::FT_NONE) ?
- (LLFolderType::EType) 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);
-
- return body;
-}
-#endif
-
void upload_new_resource(
- const LLTransactionID &tid,
- LLAssetType::EType assetType,
NewResourceUploadInfo::ptr_t &uploadInfo,
LLAssetStorage::LLStoreAssetCallback callback,
void *userdata)
@@ -999,8 +921,8 @@ void upload_new_resource(
return ;
}
- uploadInfo->setAssetType(assetType);
- uploadInfo->setTransactionId(tid);
+// uploadInfo->setAssetType(assetType);
+// uploadInfo->setTransactionId(tid);
std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory");
@@ -1010,19 +932,6 @@ void upload_new_resource(
LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, url, uploadInfo);
LLCoprocedureManager::getInstance()->enqueueCoprocedure("LLViewerAssetUpload::AssetInventoryUploadCoproc", proc);
-// LL_INFOS() << "New Agent Inventory via capability" << LL_ENDL;
-// uploadInfo->prepareUpload();
-// uploadInfo->logPreparedUpload();
-//
-// LLSD body = uploadInfo->generatePostBody();
-//
-// LLHTTPClient::post(
-// url,
-// body,
-// new LLNewAgentInventoryResponder(
-// body,
-// uploadInfo->getAssetId(),
-// assetType));
}
else
{
@@ -1032,9 +941,9 @@ void upload_new_resource(
LL_INFOS() << "NewAgentInventory capability not found, new agent inventory via asset system." << LL_ENDL;
// check for adequate funds
// TODO: do this check on the sim
- if (LLAssetType::AT_SOUND == assetType ||
- LLAssetType::AT_TEXTURE == assetType ||
- LLAssetType::AT_ANIMATION == assetType)
+ if (LLAssetType::AT_SOUND == uploadInfo->getAssetType() ||
+ LLAssetType::AT_TEXTURE == uploadInfo->getAssetType() ||
+ LLAssetType::AT_ANIMATION == uploadInfo->getAssetType())
{
S32 balance = gStatusBar->getBalance();
if (balance < uploadInfo->getExpectedUploadCost())
@@ -1049,9 +958,9 @@ void upload_new_resource(
}
LLResourceData* data = new LLResourceData;
- data->mAssetInfo.mTransactionID = tid;
+ data->mAssetInfo.mTransactionID = uploadInfo->getTransactionId();
data->mAssetInfo.mUuid = uploadInfo->getAssetId();
- data->mAssetInfo.mType = assetType;
+ data->mAssetInfo.mType = uploadInfo->getAssetType();
data->mAssetInfo.mCreatorID = gAgentID;
data->mInventoryType = uploadInfo->getInventoryType();
data->mNextOwnerPerm = uploadInfo->getNextOwnerPerms();
@@ -1075,68 +984,6 @@ void upload_new_resource(
}
}
-#if 0
-LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid)
-{
- if ( gDisconnected )
- {
- LLAssetID rv;
-
- rv.setNull();
- return rv;
- }
-
- LLAssetID uuid = tid.makeAssetID(gAgent.getSecureSessionID());
-
- return uuid;
-}
-
-void increase_new_upload_stats(LLAssetType::EType asset_type)
-{
- if ( LLAssetType::AT_SOUND == asset_type )
- {
- add(LLStatViewer::UPLOAD_SOUND, 1);
- }
- else if ( LLAssetType::AT_TEXTURE == asset_type )
- {
- add(LLStatViewer::UPLOAD_TEXTURE, 1);
- }
- else if ( LLAssetType::AT_ANIMATION == asset_type )
- {
- add(LLStatViewer::ANIMATION_UPLOADS, 1);
- }
-}
-
-void assign_defaults_and_show_upload_message(
- LLAssetType::EType asset_type,
- LLInventoryType::EType& inventory_type,
- std::string& name,
- const std::string& display_name,
- std::string& description)
-{
- if ( LLInventoryType::IT_NONE == inventory_type )
- {
- inventory_type = LLInventoryType::defaultForAssetType(asset_type);
- }
- LLStringUtil::stripNonprintable(name);
- LLStringUtil::stripNonprintable(description);
-
- if ( name.empty() )
- {
- name = "(No Name)";
- }
- if ( description.empty() )
- {
- description = "(No Description)";
- }
-
- // At this point, we're ready for the upload.
- std::string upload_message = "Uploading...\n\n";
- upload_message.append(display_name);
- LLUploadDialog::modalUploadDialog(upload_message);
-}
-#endif
-
void init_menu_file()
{
@@ -1160,14 +1007,14 @@ void init_menu_file()
// "File.SaveTexture" moved to llpanelmaininventory so that it can be properly handled.
}
-LLAssetID NewResourceUploadInfo::prepareUpload()
+LLSD NewResourceUploadInfo::prepareUpload()
{
- LLAssetID uuid = generateNewAssetId();
+ generateNewAssetId();
incrementUploadStats();
assignDefaults();
- return uuid;
+ return LLSD().with("success", LLSD::Boolean(true));
}
std::string NewResourceUploadInfo::getAssetTypeString() const
@@ -1209,6 +1056,84 @@ void NewResourceUploadInfo::logPreparedUpload()
"Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL;
}
+LLUUID NewResourceUploadInfo::finishUpload(LLSD &result)
+{
+ if (getFolderId().isNull())
+ {
+ return LLUUID::null;
+ }
+
+ U32 permsEveryone = PERM_NONE;
+ U32 permsGroup = PERM_NONE;
+ U32 permsNextOwner = PERM_ALL;
+
+ if (result.has("new_next_owner_mask"))
+ {
+ // The server provided creation perms so use them.
+ // Do not assume we got the perms we asked for in
+ // since the server may not have granted them all.
+ permsEveryone = result["new_everyone_mask"].asInteger();
+ permsGroup = result["new_group_mask"].asInteger();
+ permsNextOwner = result["new_next_owner_mask"].asInteger();
+ }
+ else
+ {
+ // The server doesn't provide creation perms
+ // so use old assumption-based perms.
+ if (getAssetTypeString() != "snapshot")
+ {
+ permsNextOwner = PERM_MOVE | PERM_TRANSFER;
+ }
+ }
+
+ LLPermissions new_perms;
+ new_perms.init(
+ gAgent.getID(),
+ gAgent.getID(),
+ LLUUID::null,
+ LLUUID::null);
+
+ new_perms.initMasks(
+ PERM_ALL,
+ PERM_ALL,
+ permsEveryone,
+ permsGroup,
+ permsNextOwner);
+
+ U32 flagsInventoryItem = 0;
+ if (result.has("inventory_flags"))
+ {
+ flagsInventoryItem = static_cast<U32>(result["inventory_flags"].asInteger());
+ if (flagsInventoryItem != 0)
+ {
+ LL_INFOS() << "inventory_item_flags " << flagsInventoryItem << LL_ENDL;
+ }
+ }
+ S32 creationDate = time_corrected();
+
+ LLUUID serverInventoryItem = result["new_inventory_item"].asUUID();
+ LLUUID serverAssetId = result["new_asset"].asUUID();
+
+ LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(
+ serverInventoryItem,
+ getFolderId(),
+ new_perms,
+ serverAssetId,
+ getAssetType(),
+ getInventoryType(),
+ getName(),
+ getDescription(),
+ LLSaleInfo::DEFAULT,
+ flagsInventoryItem,
+ creationDate);
+
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+
+ return serverInventoryItem;
+}
+
+
LLAssetID NewResourceUploadInfo::generateNewAssetId()
{
if (gDisconnected)
@@ -1263,3 +1188,7 @@ void NewResourceUploadInfo::assignDefaults()
}
+std::string NewResourceUploadInfo::getDisplayName() const
+{
+ return (mName.empty()) ? mAssetId.asString() : mName;
+};
diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h
index 297895cbf0..9bc4d5b041 100755
--- a/indra/newview/llviewermenufile.h
+++ b/indra/newview/llviewermenufile.h
@@ -39,13 +39,15 @@ class LLTransactionID;
void init_menu_file();
-#if 1
class NewResourceUploadInfo
{
public:
typedef boost::shared_ptr<NewResourceUploadInfo> ptr_t;
- NewResourceUploadInfo(std::string name,
+ NewResourceUploadInfo(
+ LLTransactionID transactId,
+ LLAssetType::EType assetType,
+ std::string name,
std::string description,
S32 compressionInfo,
LLFolderType::EType destinationType,
@@ -53,48 +55,53 @@ public:
U32 nextOWnerPerms,
U32 groupPerms,
U32 everyonePerms,
- std::string displayName,
S32 expectedCost) :
+ mTransactionId(transactId),
+ mAssetType(assetType),
mName(name),
mDescription(description),
- mDisplayName(displayName),
mCompressionInfo(compressionInfo),
+ mDestinationFolderType(destinationType),
+ mInventoryType(inventoryType),
mNextOwnerPerms(nextOWnerPerms),
mGroupPerms(groupPerms),
mEveryonePerms(everyonePerms),
mExpectedUploadCost(expectedCost),
- mInventoryType(inventoryType),
- mDestinationFolderType(destinationType)
+ mFolderId(LLUUID::null),
+ mItemId(LLUUID::null),
+ mAssetId(LLAssetID::null)
{ }
virtual ~NewResourceUploadInfo()
{ }
- virtual LLAssetID prepareUpload();
+ virtual LLSD prepareUpload();
virtual LLSD generatePostBody();
virtual void logPreparedUpload();
+ virtual LLUUID finishUpload(LLSD &result);
+
+ //void setAssetType(LLAssetType::EType assetType) { mAssetType = assetType; }
+ //void setTransactionId(LLTransactionID transactionId) { mTransactionId = transactionId; }
- void setAssetType(LLAssetType::EType assetType) { mAssetType = assetType; }
+ LLTransactionID getTransactionId() const { return mTransactionId; }
LLAssetType::EType getAssetType() const { return mAssetType; }
std::string getAssetTypeString() const;
- void setTransactionId(LLTransactionID transactionId) { mTransactionId = transactionId; }
- LLTransactionID getTransactionId() const { return mTransactionId; }
- LLUUID getFolderId() const { return mFolderId; }
-
- LLAssetID getAssetId() const { return mAssetId; }
-
std::string getName() const { return mName; };
std::string getDescription() const { return mDescription; };
- std::string getDisplayName() const { return mDisplayName; };
S32 getCompressionInfo() const { return mCompressionInfo; };
+ LLFolderType::EType getDestinationFolderType() const { return mDestinationFolderType; };
+ LLInventoryType::EType getInventoryType() const { return mInventoryType; };
+ std::string getInventoryTypeString() const;
U32 getNextOwnerPerms() const { return mNextOwnerPerms; };
U32 getGroupPerms() const { return mGroupPerms; };
U32 getEveryonePerms() const { return mEveryonePerms; };
S32 getExpectedUploadCost() const { return mExpectedUploadCost; };
- LLInventoryType::EType getInventoryType() const { return mInventoryType; };
- std::string getInventoryTypeString() const;
-
- LLFolderType::EType getDestinationFolderType() const { return mDestinationFolderType; };
+
+ std::string getDisplayName() const;
+
+ LLUUID getFolderId() const { return mFolderId; }
+ LLUUID getItemId() const { return mItemId; }
+ LLAssetID getAssetId() const { return mAssetId; }
protected:
LLAssetID generateNewAssetId();
@@ -102,22 +109,21 @@ protected:
virtual void assignDefaults();
private:
+ LLTransactionID mTransactionId;
LLAssetType::EType mAssetType;
std::string mName;
std::string mDescription;
- std::string mDisplayName;
S32 mCompressionInfo;
+ LLFolderType::EType mDestinationFolderType;
+ LLInventoryType::EType mInventoryType;
U32 mNextOwnerPerms;
U32 mGroupPerms;
U32 mEveryonePerms;
S32 mExpectedUploadCost;
- LLUUID mFolderId;
-
- LLInventoryType::EType mInventoryType;
- LLFolderType::EType mDestinationFolderType;
+ LLUUID mFolderId;
+ LLUUID mItemId;
LLAssetID mAssetId;
- LLTransactionID mTransactionId;
};
@@ -137,48 +143,11 @@ LLUUID upload_new_resource(
void *userdata);
void upload_new_resource(
- const LLTransactionID &tid,
- LLAssetType::EType type,
NewResourceUploadInfo::ptr_t &uploadInfo,
LLAssetStorage::LLStoreAssetCallback callback = NULL,
void *userdata = NULL);
-#else
-LLUUID 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,
- 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,
- LLAssetStorage::LLStoreAssetCallback callback,
- S32 expected_upload_cost,
- void *userdata);
-
-LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid);
-void increase_new_upload_stats(LLAssetType::EType asset_type);
-#endif
void assign_defaults_and_show_upload_message(
LLAssetType::EType asset_type,
LLInventoryType::EType& inventory_type,
@@ -186,18 +155,6 @@ void assign_defaults_and_show_upload_message(
const std::string& display_name,
std::string& description);
-#if 0
-LLSD generate_new_resource_upload_capability_body(
- LLAssetType::EType asset_type,
- const std::string& name,
- const std::string& desc,
- LLFolderType::EType destination_folder_type,
- LLInventoryType::EType inv_type,
- U32 next_owner_perms,
- U32 group_perms,
- U32 everyone_perms);
-#endif
-
void on_new_single_inventory_upload_complete(
LLAssetType::EType asset_type,
LLInventoryType::EType inventory_type,