added title, descriptions, tags, and safety level to panel_flickr_photo.xml for ACME-1142

master
Cho 2013-11-07 01:30:36 +00:00
parent 1a1826a4f7
commit be23aaefe5
6 changed files with 126 additions and 27 deletions

View File

@ -63,8 +63,11 @@ mResolutionComboBox(NULL),
mRefreshBtn(NULL),
mWorkingLabel(NULL),
mThumbnailPlaceholder(NULL),
mCaptionTextBox(NULL),
mTitleTextBox(NULL),
mDescriptionTextBox(NULL),
mLocationCheckbox(NULL),
mTagsTextBox(NULL),
mRatingComboBox(NULL),
mPostButton(NULL)
{
mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFlickrPhotoPanel::onSend, this));
@ -89,8 +92,11 @@ BOOL LLFlickrPhotoPanel::postBuild()
mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
mWorkingLabel = getChild<LLUICtrl>("working_lbl");
mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
mCaptionTextBox = getChild<LLUICtrl>("photo_caption");
mTitleTextBox = getChild<LLUICtrl>("photo_title");
mDescriptionTextBox = getChild<LLUICtrl>("photo_description");
mLocationCheckbox = getChild<LLUICtrl>("add_location_cb");
mTagsTextBox = getChild<LLUICtrl>("photo_tags");
mRatingComboBox = getChild<LLUICtrl>("rating_combobox");
mPostButton = getChild<LLUICtrl>("post_photo_btn");
mCancelButton = getChild<LLUICtrl>("cancel_photo_btn");
@ -104,7 +110,10 @@ void LLFlickrPhotoPanel::draw()
// Enable interaction only if no transaction with the service is on-going (prevent duplicated posts)
bool no_ongoing_connection = !(LLFlickrConnect::instance().isTransactionOngoing());
mCancelButton->setEnabled(no_ongoing_connection);
mCaptionTextBox->setEnabled(no_ongoing_connection);
mTitleTextBox->setEnabled(no_ongoing_connection);
mDescriptionTextBox->setEnabled(no_ongoing_connection);
mTagsTextBox->setEnabled(no_ongoing_connection);
mRatingComboBox->setEnabled(no_ongoing_connection);
mResolutionComboBox->setEnabled(no_ongoing_connection);
mRefreshBtn->setEnabled(no_ongoing_connection);
mLocationCheckbox->setEnabled(no_ongoing_connection);
@ -144,7 +153,7 @@ void LLFlickrPhotoPanel::draw()
mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate()));
// Enable Post if we have a preview to send and no on going connection being processed
mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate()));
mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate()) && (mRatingComboBox && mRatingComboBox->getValue().isDefined()));
// Draw the rest of the panel on top of it
LLPanel::draw();
@ -234,8 +243,10 @@ bool LLFlickrPhotoPanel::onFlickrConnectStateChange(const LLSD& data)
void LLFlickrPhotoPanel::sendPhoto()
{
// Get the caption
std::string caption = mCaptionTextBox->getValue().asString();
// Get the title, description, and tags
std::string title = mTitleTextBox->getValue().asString();
std::string description = mDescriptionTextBox->getValue().asString();
std::string tags = mTagsTextBox->getValue().asString();
// Add the location if required
bool add_location = mLocationCheckbox->getValue().asBoolean();
@ -249,25 +260,30 @@ void LLFlickrPhotoPanel::sendPhoto()
// Add query parameters so Google Analytics can track incoming clicks!
slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS;
// Add it to the caption (pretty crude, but we don't have a better option with photos)
if (caption.empty())
caption = slurl_string;
// Add it to the description (pretty crude, but we don't have a better option with photos)
if (description.empty())
description = slurl_string;
else
caption = caption + " " + slurl_string;
description = description + " " + slurl_string;
}
// Get the content rating
int content_rating = mRatingComboBox->getValue().asInteger();
// Get the image
LLSnapshotLivePreview* previewp = getPreviewView();
// Post to Flickr
LLFlickrConnect::instance().uploadPhoto(previewp->getFormattedImage(), "", caption, "", 1);
LLFlickrConnect::instance().uploadPhoto(previewp->getFormattedImage(), title, description, tags, content_rating);
updateControls();
}
void LLFlickrPhotoPanel::clearAndClose()
{
mCaptionTextBox->setValue("");
mTitleTextBox->setValue("");
mDescriptionTextBox->setValue("");
mTagsTextBox->setValue("");
LLFloater* floater = getParentByType<LLFloater>();
if (floater)

View File

@ -66,8 +66,11 @@ private:
LLUICtrl * mRefreshBtn;
LLUICtrl * mWorkingLabel;
LLUICtrl * mThumbnailPlaceholder;
LLUICtrl * mCaptionTextBox;
LLUICtrl * mTitleTextBox;
LLUICtrl * mDescriptionTextBox;
LLUICtrl * mLocationCheckbox;
LLUICtrl * mTagsTextBox;
LLUICtrl * mRatingComboBox;
LLUICtrl * mPostButton;
LLUICtrl* mCancelButton;
};

View File

@ -10,10 +10,10 @@
single_instance="true"
reuse_instance="true"
title="UPLOAD TO FLICKR"
height="482"
height="622"
width="304">
<panel
height="482"
height="622"
width="304"
visible="true"
name="background"
@ -27,7 +27,7 @@
tab_height="30"
tab_position="top"
top="7"
height="437"
height="577"
halign="center">
<panel
filename="panel_flickr_photo.xml"

View File

@ -1,5 +1,5 @@
<panel
height="400"
height="540"
width="304"
layout="topleft"
name="panel_flickr_account">

View File

@ -1,19 +1,19 @@
<panel
height="400"
height="540"
width="304"
layout="topleft"
name="panel_flickr_photo">
<layout_stack
layout="topleft"
border_size="0"
height="392"
height="532"
follows="all"
orientation="vertical"
name="stack_photo"
top="8">
<layout_panel
name="snapshot_panel"
height="367">
height="507">
<combo_box
control_name="SocialPhotoResolution"
follows="left|top"
@ -97,30 +97,110 @@
font="SansSerif"
height="16"
left="9"
name="caption_label"
name="title_label"
top_pad="20"
type="string">
Comment (optional):
Title:
</text>
<text_editor
follows="left|top"
height="87"
height="20"
width="250"
left="9"
length="1"
max_length="256"
name="photo_title"
type="string"
word_wrap="true">
</text_editor>
<text
length="1"
follows="top|left|right"
font="SansSerif"
height="16"
left="9"
name="description_label"
top_pad="10"
type="string">
Description:
</text>
<text_editor
follows="left|top"
height="50"
width="250"
left="9"
length="1"
max_length="700"
name="photo_caption"
name="photo_description"
type="string"
word_wrap="true">
</text_editor>
<check_box
follows="left|top"
initial_value="true"
label="Include location in posting"
label="Include SL location at end of description"
name="add_location_cb"
left="9"
height="16"
top_pad="8"/>
<text
length="1"
follows="top|left|right"
font="SansSerif"
height="16"
left="9"
name="tags_label"
top_pad="10"
type="string">
Tags:
</text>
<text
length="1"
follows="top|left"
font="SansSerifSmall"
text_color="White_50"
height="30"
name="tags_help_label"
left="50"
top_pad="-16"
type="string">
Separate tags with spaces
Use "" for multi-word tags
</text>
<text_editor
follows="left|top"
height="50"
width="250"
left="9"
length="1"
max_length="700"
name="photo_tags"
type="string"
word_wrap="true">
</text_editor>
<combo_box
control_name="FlickrPhotoRating"
follows="left|top"
top_pad="16"
left="9"
label="Choose Flickr rating (required)..."
name="rating_combobox"
tool_tip="Flickr content rating"
height="21"
width="250">
<combo_box.item
label="Safe"
name="SafeRating"
value="1" />
<combo_box.item
label="Moderate"
name="ModerateRating"
value="2" />
<combo_box.item
label="Restricted"
name="RestrictedRating"
value="3" />
</combo_box>
</layout_panel>
<layout_panel
name="photo_button_panel"
@ -130,7 +210,7 @@
top="0"
left="9"
height="23"
label="Post"
label="Upload"
name="post_photo_btn"
width="100">
<button.commit_callback

View File

@ -130,7 +130,7 @@
top="0"
left="9"
height="23"
label="Post"
label="Tweet"
name="post_photo_btn"
width="100">
<button.commit_callback