diff options
Diffstat (limited to 'indra/newview/llfloatersnapshot.cpp')
-rw-r--r-- | indra/newview/llfloatersnapshot.cpp | 102 |
1 files changed, 13 insertions, 89 deletions
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 ///---------------------------------------------------------------------------- |