diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f7a907759..511641635 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -196,8 +196,9 @@ set(viewer_SOURCE_FILES llfloaterevent.cpp llfloaterexploreanimations.cpp llfloaterexploresounds.cpp - llfloaterfriends.cpp + llfloaterfeed.cpp llfloaterfonttest.cpp + llfloaterfriends.cpp llfloatergesture.cpp llfloatergodtools.cpp llfloatergroupinfo.cpp @@ -241,7 +242,6 @@ set(viewer_SOURCE_FILES llfloatersellland.cpp llfloatersettingsdebug.cpp llfloatersnapshot.cpp - llfloaterfeed.cpp llfloaterstats.cpp llfloatertelehub.cpp llfloaterteleporthistory.cpp @@ -704,6 +704,7 @@ set(viewer_HEADER_FILES llfloaterexploreanimations.h llfloaterexploresounds.h llfloaterevent.h + llfloaterfeed.h llfloaterfonttest.h llfloaterfriends.h llfloatergesture.h @@ -749,7 +750,6 @@ set(viewer_HEADER_FILES llfloatersellland.h llfloatersettingsdebug.h llfloatersnapshot.h - llfloaterfeed.h llfloaterstats.h llfloatertelehub.h llfloaterteleporthistory.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 908099ae3..bdbad4b53 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8222,6 +8222,17 @@ This should be as low as possible, but too low may break functionality Value 0 + SnapshotFeedAddLocation + + Comment + Include your location in your uploads to profile feed. + Persist + 1 + Type + Boolean + Value + 0 + LeftClickShowMenu Comment diff --git a/indra/newview/llfloaterfeed.cpp b/indra/newview/llfloaterfeed.cpp index 3b6babf06..c160dacdc 100644 --- a/indra/newview/llfloaterfeed.cpp +++ b/indra/newview/llfloaterfeed.cpp @@ -35,87 +35,46 @@ #include "llfloaterfeed.h" -#include "llfontgl.h" -#include "llsys.h" -#include "llgl.h" -#include "v3dmath.h" -#include "lldir.h" - -#include "llagent.h" -#include "llui.h" -#include "lllineeditor.h" -#include "llviewertexteditor.h" -#include "llbutton.h" -#include "llnotificationsutil.h" -#include "llviewercontrol.h" -#include "llviewernetwork.h" -#include "lluictrlfactory.h" -#include "lluploaddialog.h" -#include "llviewerstats.h" -#include "llviewerwindow.h" -#include "llstatusbar.h" -#include "llviewerregion.h" -#include "lleconomy.h" -#include "lltrans.h" - -#include "llgl.h" -#include "llglheaders.h" +#include "llfloatersnapshot.h" #include "llimagepng.h" -#include "llimagej2c.h" -#include "llvfile.h" -#include "llvfs.h" +#include "llnotificationsutil.h" +#include "lluictrlfactory.h" +#include "llviewertexture.h" +#include "llviewerwindow.h" +#include "llwebprofile.h" -#include "llassetuploadresponders.h" - -#include "hippogridmanager.h" +#include ///---------------------------------------------------------------------------- /// Class LLFloaterFeed ///---------------------------------------------------------------------------- -LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, LLVector3d const& pos_taken_global) : - LLFloater(std::string("Feed Floater")), - mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mPosTakenGlobal(pos_taken_global), mHasFirstMsgFocus(false) +LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale) : + LLFloater(std::string("Feed Floater")), + mPNGImage(png), mViewerImage(img), mImageScale(img_scale) { } // Destroys the object LLFloaterFeed::~LLFloaterFeed() { - mPNGImage = NULL; + mPNGImage = NULL; } BOOL LLFloaterFeed::postBuild() { - childSetAction("cancel_btn", onClickCancel, this); - childSetAction("send_btn", onClickSend, this); + getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickCancel, this)); + getChild("post_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickPost, this)); - childDisable("from_form"); - - std::string name_string; - gAgent.buildFullname(name_string); - childSetValue("name_form", LLSD(name_string)); - - LLTextEditor* MsgField = getChild("msg_form"); - if (MsgField) - { - MsgField->setWordWrap(TRUE); - - // For the first time a user focusess to .the msg box, all text will be selected. - MsgField->setFocusChangedCallback(boost::bind(&LLFloaterFeed::onMsgFormFocusRecieved, this, _1, MsgField)); - } - - childSetFocus("to_form", TRUE); - - return TRUE; + return true; } // static -LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale, LLVector3d const& pos_taken_global) +LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale) { // Take the images from the caller // It's now our job to clean them up - LLFloaterFeed* instance = new LLFloaterFeed(png, img, image_scale, pos_taken_global); + LLFloaterFeed* instance = new LLFloaterFeed(png, img, image_scale); LLUICtrlFactory::getInstance()->buildFloater(instance, "floater_snapshot_feed.xml"); @@ -174,66 +133,37 @@ void LLFloaterFeed::draw(void) } } -// static -void LLFloaterFeed::onClickCancel(void* data) +void LLFloaterFeed::onClickCancel() { - if (data) - { - LLFloaterFeed* self = (LLFloaterFeed*)data; - - self->close(false); - } + close(false); } -// static -void LLFloaterFeed::onClickSend(void* data) +void LLFloaterFeed::onClickPost() { - if (data) - { - LLFloaterFeed* self = (LLFloaterFeed*)data; - - std::string from(self->childGetValue("from_form").asString()); - std::string to(self->childGetValue("to_form").asString()); - - if (self->mPNGImage.notNull()) + if (mPNGImage.notNull()) { - self->sendFeed(); + static LLCachedControl add_location("SnapshotFeedAddLocation"); + const std::string caption = childGetValue("caption").asString(); + LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::saveFeedDone, _1, mPNGImage)); + LLWebProfile::uploadImage(mPNGImage, caption, add_location); + + // give user feedback of the event + gViewerWindow->playSnapshotAnimAndSound(); + + // don't destroy the window until the upload is done + // this way we keep the information in the form + setVisible(FALSE); + + // remove any dependency on snapshot floater + // so we outlive it during the upload. + LLFloater* dependee = getDependee(); + if (dependee) + { + dependee->removeDependentFloater(this); + } } else { - LLNotificationsUtil::add("ErrorProcessingSnapshot"); + LLNotificationsUtil::add("ErrorProcessingSnapshot"); } - } -} - -void LLFloaterFeed::onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* msg_form) -{ - if (msg_form && msg_form == receiver && msg_form->hasFocus() && !(mHasFirstMsgFocus)) - { - mHasFirstMsgFocus = true; - msg_form->setText(LLStringUtil::null); - } -} - -void LLFloaterFeed::sendFeed(void) -{ - // upload the image - // DO THE UPLOAD HERE - - // give user feedback of the event - gViewerWindow->playSnapshotAnimAndSound(); - LLUploadDialog::modalUploadDialog(getString("upload_message")); - - // don't destroy the window until the upload is done - // this way we keep the information in the form - setVisible(FALSE); - - // also remove any dependency on another floater - // so that we can be sure to outlive it while we - // need to. - LLFloater* dependee = getDependee(); - if (dependee) - { - dependee->removeDependentFloater(this); - } } diff --git a/indra/newview/llfloaterfeed.h b/indra/newview/llfloaterfeed.h index ec2d7825c..8a6c43482 100644 --- a/indra/newview/llfloaterfeed.h +++ b/indra/newview/llfloaterfeed.h @@ -34,45 +34,29 @@ #include "llfloater.h" // LLFloater #include "v2math.h" // LLVector2 -#include "v3dmath.h" // LLVector3d #include "llpointer.h" // LLPointer -#include "llextendedstatus.h" // LLExtStat class LLImagePNG; class LLViewerTexture; -class LLUUID; -class LLFocusableElement; -class LLTextEditor; -class LLSD; class LLFloaterFeed : public LLFloater { public: - LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, LLVector3d const& pos_taken_global); + LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale); virtual ~LLFloaterFeed(); - virtual BOOL postBuild(void); - virtual void draw(void); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); - static LLFloaterFeed* showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, LLVector3d const& pos_taken_global); + static LLFloaterFeed* showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale); - static void onClickCancel(void* data); - static void onClickSend(void* data); - - static void uploadCallback(LLUUID const& asset_id, void* user_data, S32 result, LLExtStat ext_status); - - void onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* msg_form); - bool missingSubjMsgAlertCallback(LLSD const& notification, LLSD const& response); - - void sendFeed(void); + void onClickCancel(); + void onClickPost(); protected: - LLPointer mPNGImage; LLPointer mViewerImage; - LLVector2 mImageScale; - LLVector3d mPosTakenGlobal; - bool mHasFirstMsgFocus; + const LLVector2 mImageScale; }; #endif // LL_LLFLOATERFEED_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index cc866a301..513833e9c 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -83,7 +83,6 @@ #include "llnotificationsutil.h" #include "llvfile.h" #include "llvfs.h" -#include "llwebprofile.h" #include "hippogridmanager.h" @@ -177,7 +176,6 @@ public: void showFreezeFrameSnapshot(bool show); void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f); LLFloaterFeed* getCaptionAndSaveFeed(); - void saveFeed(std::string const& caption, bool add_location); LLFloaterPostcard* savePostcard(); void saveTexture(); void saveTextureDone(bool success, LLPointer const& formatted_image); @@ -969,6 +967,9 @@ void LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(bool delayed) case SNAPSHOT_LOCAL: format = mSnapshotFormat; break; + default: + format = mSnapshotFormat; + break; } if (mFormattedImage && @@ -1211,20 +1212,13 @@ LLFloaterFeed* LLSnapshotLivePreview::getCaptionAndSaveFeed() return NULL; } - LLFloaterFeed* floater = LLFloaterFeed::showFromSnapshot(png, mFullScreenPreviewTexture, image_scale, mPosTakenGlobal); + LLFloaterFeed* floater = LLFloaterFeed::showFromSnapshot(png, mFullScreenPreviewTexture, image_scale); //updateSnapshot(FALSE, FALSE); return floater; } -void LLSnapshotLivePreview::saveFeed(std::string const& caption, bool add_location) -{ - DoutEntering(dc::notice, "LLSnapshotLivePreview::saveFeed()"); - LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::saveFeedDone, _1, mFormattedImage)); - LLWebProfile::uploadImage(mFormattedImage, caption, add_location); -} - LLFloaterPostcard* LLSnapshotLivePreview::savePostcard() { if(mFullScreenPreviewTexture.isNull()) @@ -2694,6 +2688,9 @@ char const* LLSnapshotLivePreview::aspectComboName() const case SNAPSHOT_LOCAL: result = "local_aspect_combo"; break; + default: + result= ""; + break; } return result; } diff --git a/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml b/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml index d6c58b145..564248b8d 100644 --- a/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml +++ b/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml @@ -3,32 +3,20 @@ can_minimize="false" title="Post to My Profile Feed" height="380" - width="480" + width="370" layout="topleft" name="floater_snapshot_profile" rect_control="FloaterSnapshotFeedRect"> - - Enter text to post below: -