Added default message for feed uploads.
By default show 'Type your message here...' and if the text editor never got focus, replace that with a default message.
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwebprofile.h"
|
||||
#include "lluploaddialog.h"
|
||||
#include "lltexteditor.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
@@ -52,7 +53,7 @@
|
||||
|
||||
LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index) :
|
||||
LLFloater(std::string("Feed Floater")),
|
||||
mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mSnapshotIndex(index)
|
||||
mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mSnapshotIndex(index), mHasFirstMsgFocus(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -66,10 +67,26 @@ BOOL LLFloaterFeed::postBuild()
|
||||
{
|
||||
getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickCancel, this));
|
||||
getChild<LLUICtrl>("post_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickPost, this));
|
||||
LLTextEditor* caption = getChild<LLTextEditor>("caption");
|
||||
if (caption)
|
||||
{
|
||||
// For the first time a user focusess to the msg box, all text will be selected.
|
||||
caption->setFocusChangedCallback(boost::bind(&LLFloaterFeed::onMsgFormFocusRecieved, this, _1, caption));
|
||||
}
|
||||
childSetFocus("cancel_btn", TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LLFloaterFeed::onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption)
|
||||
{
|
||||
if (caption && caption == receiver && caption->hasFocus() && !mHasFirstMsgFocus)
|
||||
{
|
||||
mHasFirstMsgFocus = true;
|
||||
caption->setText(LLStringUtil::null);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale, int index)
|
||||
{
|
||||
@@ -148,6 +165,12 @@ void LLFloaterFeed::onClose(bool app_quitting)
|
||||
|
||||
void LLFloaterFeed::onClickPost()
|
||||
{
|
||||
if (!mHasFirstMsgFocus)
|
||||
{
|
||||
// The user never switched focus to the messagee window.
|
||||
// Using the default string.
|
||||
childSetValue("caption", getString("default_message"));
|
||||
}
|
||||
if (mPNGImage.notNull())
|
||||
{
|
||||
static LLCachedControl<bool> add_location("SnapshotFeedAddLocation");
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
class LLImagePNG;
|
||||
class LLViewerTexture;
|
||||
class LLFocusableElement;
|
||||
class LLTextEditor;
|
||||
|
||||
class LLFloaterFeed : public LLFloater
|
||||
{
|
||||
@@ -53,12 +55,14 @@ public:
|
||||
|
||||
void onClickCancel();
|
||||
void onClickPost();
|
||||
void onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption);
|
||||
|
||||
protected:
|
||||
LLPointer<LLImagePNG> mPNGImage;
|
||||
LLPointer<LLViewerTexture> mViewerImage;
|
||||
LLVector2 const mImageScale;
|
||||
int mSnapshotIndex;
|
||||
bool mHasFirstMsgFocus;
|
||||
};
|
||||
|
||||
#endif // LL_LLFLOATERFEED_H
|
||||
|
||||
@@ -343,7 +343,7 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data,
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
|
||||
self->close();
|
||||
self->destroy();
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
left="10"
|
||||
right="-10"
|
||||
type="string"
|
||||
word_wrap="true"/>
|
||||
word_wrap="true">
|
||||
Type your message here.
|
||||
</text_editor>
|
||||
<check_box
|
||||
follows="left|bottom"
|
||||
initial_value="true"
|
||||
@@ -46,6 +48,9 @@
|
||||
name="post_btn"
|
||||
bottom_delta="0"
|
||||
width="100"/>
|
||||
<string name="default_message">
|
||||
Click on the 'snapshot' link above to see the larger original.
|
||||
</string>
|
||||
<string name="upload_message">
|
||||
"Uploading..."
|
||||
</string>
|
||||
|
||||
Reference in New Issue
Block a user