PageRenderTime 34ms CodeModel.GetById 10ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llassetuploadresponders.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 162 lines | 110 code | 20 blank | 32 comment | 0 complexity | 5f6424edd96a1746ff03207333a1e9c8 MD5 | raw file
  1/**
  2 * @file llassetuploadresponders.h
  3 * @brief Processes responses received for asset upload requests.
  4 *
  5 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLASSETUPLOADRESPONDER_H
 28#define LL_LLASSETUPLOADRESPONDER_H
 29
 30#include "llhttpclient.h"
 31
 32// Abstract class for supporting asset upload
 33// via capabilities
 34class LLAssetUploadResponder : public LLHTTPClient::Responder
 35{
 36public:
 37	LLAssetUploadResponder(const LLSD& post_data,
 38							const LLUUID& vfile_id,
 39							LLAssetType::EType asset_type);
 40	LLAssetUploadResponder(const LLSD& post_data, 
 41							const std::string& file_name,
 42							LLAssetType::EType asset_type);
 43	~LLAssetUploadResponder();
 44
 45    virtual void error(U32 statusNum, const std::string& reason);
 46	virtual void result(const LLSD& content);
 47	virtual void uploadUpload(const LLSD& content);
 48	virtual void uploadComplete(const LLSD& content);
 49	virtual void uploadFailure(const LLSD& content);
 50
 51protected:
 52	LLSD mPostData;
 53	LLAssetType::EType mAssetType;
 54	LLUUID mVFileID;
 55	std::string mFileName;
 56};
 57
 58// TODO*: Remove this once deprecated
 59class LLNewAgentInventoryResponder : public LLAssetUploadResponder
 60{
 61public:
 62	LLNewAgentInventoryResponder(
 63		const LLSD& post_data,
 64		const LLUUID& vfile_id,
 65		LLAssetType::EType asset_type);
 66	LLNewAgentInventoryResponder(
 67		const LLSD& post_data,
 68		const std::string& file_name,
 69		LLAssetType::EType asset_type);
 70    virtual void error(U32 statusNum, const std::string& reason);
 71	virtual void uploadComplete(const LLSD& content);
 72	virtual void uploadFailure(const LLSD& content);
 73};
 74
 75// A base class which goes through and performs some default
 76// actions for variable price uploads.  If more specific actions
 77// are needed (such as different confirmation messages, etc.)
 78// the functions onApplicationLevelError and showConfirmationDialog.
 79class LLNewAgentInventoryVariablePriceResponder :
 80	public LLHTTPClient::Responder
 81{
 82public:
 83	LLNewAgentInventoryVariablePriceResponder(
 84		const LLUUID& vfile_id,
 85		LLAssetType::EType asset_type,
 86		const LLSD& inventory_info);
 87
 88	LLNewAgentInventoryVariablePriceResponder(
 89		const std::string& file_name,
 90		LLAssetType::EType asset_type,
 91		const LLSD& inventory_info);
 92	virtual ~LLNewAgentInventoryVariablePriceResponder();
 93
 94	void errorWithContent(
 95		U32 statusNum,
 96		const std::string& reason,
 97		const LLSD& content);
 98	void result(const LLSD& content);
 99
100	virtual void onApplicationLevelError(
101		const LLSD& error);
102	virtual void showConfirmationDialog(
103		S32 upload_price,
104		S32 resource_cost,
105		const std::string& confirmation_url);
106
107private:
108	class Impl;
109	Impl* mImpl;
110};
111
112struct LLBakedUploadData;
113class LLSendTexLayerResponder : public LLAssetUploadResponder
114{
115	LOG_CLASS(LLSendTexLayerResponder);
116public:
117	LLSendTexLayerResponder(const LLSD& post_data,
118							const LLUUID& vfile_id,
119							LLAssetType::EType asset_type,
120							LLBakedUploadData * baked_upload_data);
121
122	~LLSendTexLayerResponder();
123
124	virtual void uploadComplete(const LLSD& content);
125	virtual void error(U32 statusNum, const std::string& reason);
126
127	LLBakedUploadData * mBakedUploadData;
128};
129
130class LLUpdateAgentInventoryResponder : public LLAssetUploadResponder
131{
132public:
133	LLUpdateAgentInventoryResponder(const LLSD& post_data,
134								const LLUUID& vfile_id,
135								LLAssetType::EType asset_type);
136	LLUpdateAgentInventoryResponder(const LLSD& post_data,
137								const std::string& file_name,
138											   LLAssetType::EType asset_type);
139	virtual void uploadComplete(const LLSD& content);
140};
141
142class LLUpdateTaskInventoryResponder : public LLAssetUploadResponder
143{
144public:
145	LLUpdateTaskInventoryResponder(const LLSD& post_data,
146								const LLUUID& vfile_id,
147								LLAssetType::EType asset_type);
148	LLUpdateTaskInventoryResponder(const LLSD& post_data,
149								const std::string& file_name,
150								LLAssetType::EType asset_type);
151	LLUpdateTaskInventoryResponder(const LLSD& post_data,
152								const std::string& file_name,
153								const LLUUID& queue_id,
154								LLAssetType::EType asset_type);
155
156	virtual void uploadComplete(const LLSD& content);
157	
158private:
159	LLUUID mQueueId;
160};
161
162#endif // LL_LLASSETUPLOADRESPONDER_H