Merge 494-maint-wassail

master
Ansariel 2019-11-19 21:51:54 +01:00
commit a154630ecd
36 changed files with 95 additions and 2352 deletions

View File

@ -583,7 +583,7 @@ static void bilinear_scale(const U8 *src, U32 srcW, U32 srcH, U32 srcCh, U32 src
// LLImage
//---------------------------------------------------------------------------
LLImage::LLImage(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent)
LLImage::LLImage(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent)
{
mMutex = new LLMutex();
mUseNewByteRange = use_new_byte_range;
@ -611,8 +611,8 @@ void LLImage::setLastErrorMessage(const std::string& message)
//---------------------------------------------------------------------------
// LLImageBase
//---------------------------------------------------------------------------
// <FS:ND> Report amount of failed buffer allocations
// <FS:ND> Report amount of failed buffer allocations
U32 LLImageBase::sAllocationErrors;
LLImageBase::LLImageBase()

View File

@ -928,7 +928,7 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
: LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" );
// Even if we don't show tooltips, consume the event, nothing below should show tooltip
bool allow_ui_tooltips = LLUI::getInstance()->mSettingGroups["config"]->getBOOL( "BasicUITooltips" );
bool allow_ui_tooltips = LLUI::getInstance()->mSettingGroups["config"]->getBOOL("BasicUITooltips");
if (allow_ui_tooltips)
{
LLToolTipMgr::instance().show(LLToolTip::Params()

View File

@ -219,6 +219,8 @@ set(viewer_SOURCE_FILES
lggbeamscolors.cpp
lggcontactsets.cpp
lfsimfeaturehandler.cpp
llflickrconnect.cpp
llfloaterflickr.cpp
llpanelopenregionsettings.cpp
# <FS:Ansariel> [Legacy Bake]
llagentwearablesfetch.cpp
@ -320,7 +322,6 @@ set(viewer_SOURCE_FILES
llfilteredwearablelist.cpp
llfirstuse.cpp
llflexibleobject.cpp
llflickrconnect.cpp
llfloaterabout.cpp
llfloaterbvhpreview.cpp
llfloaterauction.cpp
@ -357,7 +358,6 @@ set(viewer_SOURCE_FILES
llfloaterexperiencepicker.cpp
llfloaterexperienceprofile.cpp
llfloaterexperiences.cpp
llfloaterflickr.cpp
llfloaterfonttest.cpp
llfloaterforgetuser.cpp
llfloatergesture.cpp
@ -433,7 +433,6 @@ set(viewer_SOURCE_FILES
llfloatertos.cpp
llfloatertoybox.cpp
llfloatertranslationsettings.cpp
llfloatertwitter.cpp
llfloateruipreview.cpp
llfloaterurlentry.cpp
llfloatervoiceeffect.cpp
@ -731,7 +730,6 @@ set(viewer_SOURCE_FILES
lltransientdockablefloater.cpp
lltransientfloatermgr.cpp
lltranslate.cpp
lltwitterconnect.cpp
lluiavatar.cpp
lluilistener.cpp
lluploaddialog.cpp
@ -979,6 +977,8 @@ set(viewer_HEADER_FILES
lggbeamscolors.h
lggcontactsets.h
lfsimfeaturehandler.h
llflickrconnect.h
llfloaterflickr.h
# <FS:Ansariel> [Legacy Bake]
llagentwearablesfetch.h
@ -1080,7 +1080,6 @@ set(viewer_HEADER_FILES
llfilteredwearablelist.h
llfirstuse.h
llflexibleobject.h
llflickrconnect.h
llfloaterabout.h
llfloaterbvhpreview.h
llfloaterauction.h
@ -1117,7 +1116,6 @@ set(viewer_HEADER_FILES
llfloaterexperiencepicker.h
llfloaterexperienceprofile.h
llfloaterexperiences.h
llfloaterflickr.h
llfloaterfonttest.h
llfloaterforgetuser.h
llfloatergesture.h
@ -1196,7 +1194,6 @@ set(viewer_HEADER_FILES
llfloatertos.h
llfloatertoybox.h
llfloatertranslationsettings.h
llfloatertwitter.h
llfloateruipreview.h
llfloaterurlentry.h
llfloatervoiceeffect.h
@ -1484,7 +1481,6 @@ set(viewer_HEADER_FILES
lltransientdockablefloater.h
lltransientfloatermgr.h
lltranslate.h
lltwitterconnect.h
lluiconstants.h
lluiavatar.h
lluilistener.h

View File

@ -240,16 +240,6 @@
is_running_function="Floater.IsOpen"
is_running_parameters="flickr"
/>
<command name="twitter"
available_in_toybox="true"
icon="Command_Twitter_Icon"
label_ref="Command_Twitter_Label"
tooltip_ref="Command_Twitter_Tooltip"
execute_function="Floater.Toggle"
execute_parameters="twitter"
is_running_function="Floater.IsOpen"
is_running_parameters="twitter"
/>
<command name="speak"
available_in_toybox="true"
icon="Command_Speak_Icon"

View File

@ -1530,7 +1530,7 @@ void LLAgentCamera::updateCamera()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *attached_object = (*attachment_iter);
LLViewerObject *attached_object = attachment_iter->get();
if (attached_object && !attached_object->isDead() && attached_object->mDrawable.notNull())
{
// clear any existing "early" movements of attachment

View File

@ -1448,7 +1448,7 @@ void LLAgentWearables::findAttachmentsAddRemoveInfo(LLInventoryModel::item_array
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *objectp = (*attachment_iter);
LLViewerObject *objectp = attachment_iter->get();
if (objectp)
{
LLUUID object_item_id = objectp->getAttachmentItemID();
@ -1512,7 +1512,7 @@ std::vector<LLViewerObject*> LLAgentWearables::getTempAttachments()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *objectp = (*attachment_iter);
LLViewerObject *objectp = attachment_iter->get();
if (objectp && objectp->isTempAttachment())
{
temp_attachs.push_back(objectp);

View File

@ -3287,7 +3287,7 @@ void LLAppearanceMgr::removeAllAttachmentsFromAvatar()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *attached_object = (*attachment_iter);
LLViewerObject *attached_object = attachment_iter->get();
if (attached_object)
{
objects_to_remove.push_back(attached_object);

View File

@ -1,6 +1,6 @@
/**
* @file llfloaterbigpreview.h
* @brief Display of extended (big) preview for snapshots and SL Share
* @brief Display of extended (big) preview for snapshots
* @author merov@lindenlab.com
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$

View File

@ -31,8 +31,7 @@
#include "llagent.h"
#include "llfloaterreg.h"
#include "llfloaterflickr.h"
#include "llfloatertwitter.h"
#include "llfloaterflickr.h" // <FS:Ansariel> Share to Flickr
#include "llimagefiltersmanager.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"

View File

@ -29,8 +29,7 @@
#include "llfloatersnapshot.h"
#include "llfloaterreg.h"
#include "llfloaterflickr.h"
#include "llfloatertwitter.h"
#include "llfloaterflickr.h" // <FS:Ansariel> Share to Flickr
#include "llimagefiltersmanager.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
@ -1426,10 +1425,11 @@ BOOL LLFloaterSnapshot::isWaitingState()
BOOL LLFloaterSnapshotBase::ImplBase::updatePreviewList(bool initialized)
{
// <FS:Ansariel> Share to Flickr
//if (!initialized)
LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance<LLFloaterFlickr>("flickr");
LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance<LLFloaterTwitter>("twitter");
if (!initialized && !floater_flickr && !floater_twitter)
if (!initialized && !floater_flickr)
// </FS:Ansariel>
return FALSE;
BOOL changed = FALSE;

View File

@ -1,909 +0,0 @@
/**
* @file llfloatertwitter.cpp
* @brief Implementation of llfloatertwitter
* @author cho@lindenlab.com
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloatertwitter.h"
#include "llagent.h"
#include "llagentui.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "lltwitterconnect.h"
#include "llfloaterbigpreview.h"
#include "llfloaterreg.h"
#include "lliconctrl.h"
#include "llimagefiltersmanager.h"
#include "llresmgr.h" // LLLocale
#include "llsdserialize.h"
#include "llloadingindicator.h"
#include "llslurl.h"
#include "lltrans.h"
#include "llsnapshotlivepreview.h"
#include "llviewerregion.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
#include "lltabcontainer.h"
#include "lltexteditor.h"
#include "llspinctrl.h"
static LLPanelInjector<LLTwitterPhotoPanel> t_panel_photo("lltwitterphotopanel");
static LLPanelInjector<LLTwitterAccountPanel> t_panel_account("lltwitteraccountpanel");
const std::string DEFAULT_PHOTO_LOCATION_URL = "http://maps.secondlife.com/";
const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=twitter&utm_medium=photo&utm_campaign=slshare";
const std::string DEFAULT_STATUS_TEXT = " #SecondLife";
///////////////////////////
//LLTwitterPhotoPanel///////
///////////////////////////
LLTwitterPhotoPanel::LLTwitterPhotoPanel() :
mResolutionComboBox(NULL),
mRefreshBtn(NULL),
mBtnPreview(NULL),
mWorkingLabel(NULL),
mThumbnailPlaceholder(NULL),
mStatusCounterLabel(NULL),
mStatusTextBox(NULL),
mLocationCheckbox(NULL),
mPhotoCheckbox(NULL),
mBigPreviewFloater(NULL),
mPostButton(NULL)
{
mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLTwitterPhotoPanel::onSend, this));
mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLTwitterPhotoPanel::onClickNewSnapshot, this));
mCommitCallbackRegistrar.add("SocialSharing.BigPreview", boost::bind(&LLTwitterPhotoPanel::onClickBigPreview, this));
}
LLTwitterPhotoPanel::~LLTwitterPhotoPanel()
{
if(mPreviewHandle.get())
{
mPreviewHandle.get()->die();
}
// <FS:Ansariel> Store settings at logout
gSavedSettings.setS32("FSLastSnapshotToTwitterResolution", getChild<LLComboBox>("resolution_combobox")->getCurrentIndex());
gSavedSettings.setS32("FSLastSnapshotToTwitterWidth", getChild<LLSpinCtrl>("custom_snapshot_width")->getValue().asInteger());
gSavedSettings.setS32("FSLastSnapshotToTwitterHeight", getChild<LLSpinCtrl>("custom_snapshot_height")->getValue().asInteger());
// </FS:Ansariel>
}
BOOL LLTwitterPhotoPanel::postBuild()
{
setVisibleCallback(boost::bind(&LLTwitterPhotoPanel::onVisibilityChange, this, _2));
mResolutionComboBox = getChild<LLUICtrl>("resolution_combobox");
// <FS:Ansariel> Store settings at logout; Nonsense!
//mResolutionComboBox->setValue("[i800,i600]"); // hardcoded defaults ftw!
mResolutionComboBox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE));
mFilterComboBox = getChild<LLUICtrl>("filters_combobox");
mFilterComboBox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE));
mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
mBtnPreview = getChild<LLButton>("big_preview_btn");
mWorkingLabel = getChild<LLUICtrl>("working_lbl");
mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
mStatusCounterLabel = getChild<LLUICtrl>("status_counter_label");
mStatusTextBox = getChild<LLUICtrl>("photo_status");
mStatusTextBox->setValue(DEFAULT_STATUS_TEXT);
mLocationCheckbox = getChild<LLUICtrl>("add_location_cb");
mLocationCheckbox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::onAddLocationToggled, this));
mPhotoCheckbox = getChild<LLUICtrl>("add_photo_cb");
mPhotoCheckbox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::onAddPhotoToggled, this));
mPostButton = getChild<LLUICtrl>("post_photo_btn");
mCancelButton = getChild<LLUICtrl>("cancel_photo_btn");
mBigPreviewFloater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
getChild<LLSpinCtrl>("custom_snapshot_width")->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE));
getChild<LLSpinCtrl>("custom_snapshot_height")->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE));
getChild<LLCheckBoxCtrl>("keep_aspect_ratio")->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE));
getChild<LLComboBox>("resolution_combobox")->setCurrentByIndex(gSavedSettings.getS32("FSLastSnapshotToTwitterResolution"));
getChild<LLSpinCtrl>("custom_snapshot_width")->setValue(gSavedSettings.getS32("FSLastSnapshotToTwitterWidth"));
getChild<LLSpinCtrl>("custom_snapshot_height")->setValue(gSavedSettings.getS32("FSLastSnapshotToTwitterHeight"));
// </FS:Ansariel>
// Update filter list
std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox);
for (U32 i = 0; i < filter_list.size(); i++)
{
filterbox->add(filter_list[i]);
}
return LLPanel::postBuild();
}
// virtual
S32 LLTwitterPhotoPanel::notify(const LLSD& info)
{
if (info.has("snapshot-updating"))
{
// Disable the Post button and whatever else while the snapshot is not updated
// updateControls();
return 1;
}
if (info.has("snapshot-updated"))
{
// Enable the send/post/save buttons.
updateControls();
// The refresh button is initially hidden. We show it after the first update,
// i.e. after snapshot is taken
LLUICtrl * refresh_button = getRefreshBtn();
if (!refresh_button->getVisible())
{
refresh_button->setVisible(true);
}
return 1;
}
return 0;
}
void LLTwitterPhotoPanel::draw()
{
LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());
// Enable interaction only if no transaction with the service is on-going (prevent duplicated posts)
bool no_ongoing_connection = !(LLTwitterConnect::instance().isTransactionOngoing());
bool photo_checked = mPhotoCheckbox->getValue().asBoolean();
mCancelButton->setEnabled(no_ongoing_connection);
mStatusTextBox->setEnabled(no_ongoing_connection);
mResolutionComboBox->setEnabled(no_ongoing_connection && photo_checked);
mFilterComboBox->setEnabled(no_ongoing_connection && photo_checked);
mRefreshBtn->setEnabled(no_ongoing_connection && photo_checked);
mBtnPreview->setEnabled(no_ongoing_connection);
mLocationCheckbox->setEnabled(no_ongoing_connection);
mPhotoCheckbox->setEnabled(no_ongoing_connection);
bool add_location = mLocationCheckbox->getValue().asBoolean();
bool add_photo = mPhotoCheckbox->getValue().asBoolean();
updateStatusTextLength(false);
// Reassign the preview floater if we have the focus and the preview exists
if (hasFocus() && isPreviewVisible())
{
attachPreview();
}
// Toggle the button state as appropriate
bool preview_active = (isPreviewVisible() && mBigPreviewFloater->isFloaterOwner(getParentByType<LLFloater>()));
mBtnPreview->setToggleState(preview_active);
// Display the preview if one is available
if (previewp && previewp->getThumbnailImage())
{
const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect();
const S32 thumbnail_w = previewp->getThumbnailWidth();
const S32 thumbnail_h = previewp->getThumbnailHeight();
// calc preview offset within the preview rect
const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ;
const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ;
S32 offset_x = thumbnail_rect.mLeft + local_offset_x;
S32 offset_y = thumbnail_rect.mBottom + local_offset_y;
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Apply floater transparency to the texture unless the floater is focused.
F32 alpha = (add_photo ? (getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency()) : 0.5f);
LLColor4 color = LLColor4::white;
gl_draw_scaled_image(offset_x, offset_y,
thumbnail_w, thumbnail_h,
previewp->getThumbnailImage(), color % alpha);
}
// Update the visibility of the working (computing preview) label
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()) && (add_photo || add_location || !mStatusTextBox->getValue().asString().empty()));
// Draw the rest of the panel on top of it
LLPanel::draw();
}
LLSnapshotLivePreview* LLTwitterPhotoPanel::getPreviewView()
{
LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get();
return previewp;
}
void LLTwitterPhotoPanel::onVisibilityChange(BOOL visible)
{
if (visible)
{
if (mPreviewHandle.get())
{
LLSnapshotLivePreview* preview = getPreviewView();
if(preview)
{
LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL;
preview->updateSnapshot(TRUE);
}
}
else
{
LLRect full_screen_rect = getRootView()->getRect();
LLSnapshotLivePreview::Params p;
p.rect(full_screen_rect);
LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
mPreviewHandle = previewp->getHandle();
previewp->setContainer(this);
previewp->setSnapshotType(LLSnapshotModel::SNAPSHOT_WEB);
previewp->setSnapshotFormat(LLSnapshotModel::SNAPSHOT_FORMAT_JPEG);
previewp->setThumbnailSubsampled(TRUE); // We want the preview to reflect the *saved* image
previewp->setAllowRenderUI(FALSE); // We do not want the rendered UI in our snapshots
previewp->setAllowFullScreenPreview(FALSE); // No full screen preview in SL Share mode
previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect());
updateControls();
}
}
}
void LLTwitterPhotoPanel::onAddLocationToggled()
{
bool add_location = mLocationCheckbox->getValue().asBoolean();
updateStatusTextLength(!add_location);
}
void LLTwitterPhotoPanel::onAddPhotoToggled()
{
bool add_photo = mPhotoCheckbox->getValue().asBoolean();
updateStatusTextLength(!add_photo);
}
void LLTwitterPhotoPanel::onClickNewSnapshot()
{
LLSnapshotLivePreview* previewp = getPreviewView();
if (previewp)
{
previewp->updateSnapshot(TRUE);
}
}
void LLTwitterPhotoPanel::onClickBigPreview()
{
// Toggle the preview
if (isPreviewVisible())
{
LLFloaterReg::hideInstance("big_preview");
}
else
{
attachPreview();
LLFloaterReg::showInstance("big_preview");
}
}
bool LLTwitterPhotoPanel::isPreviewVisible()
{
return (mBigPreviewFloater && mBigPreviewFloater->getVisible());
}
void LLTwitterPhotoPanel::attachPreview()
{
if (mBigPreviewFloater)
{
LLSnapshotLivePreview* previewp = getPreviewView();
mBigPreviewFloater->setPreview(previewp);
mBigPreviewFloater->setFloaterOwner(getParentByType<LLFloater>());
}
}
void LLTwitterPhotoPanel::onSend()
{
LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterPhotoPanel"); // just in case it is already listening
LLEventPumps::instance().obtain("TwitterConnectState").listen("LLTwitterPhotoPanel", boost::bind(&LLTwitterPhotoPanel::onTwitterConnectStateChange, this, _1));
// Connect to Twitter if necessary and then post
if (LLTwitterConnect::instance().isConnected())
{
sendPhoto();
}
else
{
LLTwitterConnect::instance().checkConnectionToTwitter(true);
}
}
bool LLTwitterPhotoPanel::onTwitterConnectStateChange(const LLSD& data)
{
switch (data.get("enum").asInteger())
{
case LLTwitterConnect::TWITTER_CONNECTED:
sendPhoto();
break;
case LLTwitterConnect::TWITTER_POSTED:
LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterPhotoPanel");
clearAndClose();
break;
}
return false;
}
void LLTwitterPhotoPanel::sendPhoto()
{
// Get the status text
std::string status = mStatusTextBox->getValue().asString();
// Add the location if required
bool add_location = mLocationCheckbox->getValue().asBoolean();
if (add_location)
{
// Get the SLURL for the location
LLSLURL slurl;
LLAgentUI::buildSLURL(slurl);
std::string slurl_string = slurl.getSLURLString();
// Use a valid http:// URL if the scheme is secondlife://
LLURI slurl_uri(slurl_string);
if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
{
slurl_string = DEFAULT_PHOTO_LOCATION_URL;
}
// Add query parameters so Google Analytics can track incoming clicks!
slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS;
// Add it to the status (pretty crude, but we don't have a better option with photos)
if (status.empty())
status = slurl_string;
else
status = status + " " + slurl_string;
}
// Add the photo if required
bool add_photo = mPhotoCheckbox->getValue().asBoolean();
if (add_photo)
{
// Get the image
LLSnapshotLivePreview* previewp = getPreviewView();
// Post to Twitter
LLTwitterConnect::instance().uploadPhoto(previewp->getFormattedImage(), status);
}
else
{
// Just post the status to Twitter
LLTwitterConnect::instance().updateStatus(status);
}
updateControls();
}
void LLTwitterPhotoPanel::clearAndClose()
{
mStatusTextBox->setValue(DEFAULT_STATUS_TEXT);
LLFloater* floater = getParentByType<LLFloater>();
if (floater)
{
floater->closeFloater();
if (mBigPreviewFloater)
{
mBigPreviewFloater->closeOnFloaterOwnerClosing(floater);
}
}
}
void LLTwitterPhotoPanel::updateStatusTextLength(BOOL restore_old_status_text)
{
bool add_location = mLocationCheckbox->getValue().asBoolean();
// Restrict the status text length to Twitter's character limit
LLTextEditor* status_text_box = dynamic_cast<LLTextEditor*>(mStatusTextBox);
if (status_text_box)
{
int max_status_length = 280 - (add_location ? 40 : 0);
status_text_box->setMaxTextLength(max_status_length);
if (restore_old_status_text)
{
if (mOldStatusText.length() > status_text_box->getText().length() && status_text_box->getText() == mOldStatusText.substr(0, status_text_box->getText().length()))
{
status_text_box->setText(mOldStatusText);
}
if (mOldStatusText.length() <= max_status_length)
{
mOldStatusText = "";
}
}
if (status_text_box->getText().length() > max_status_length)
{
if (mOldStatusText.length() < status_text_box->getText().length() || status_text_box->getText() != mOldStatusText.substr(0, status_text_box->getText().length()))
{
mOldStatusText = status_text_box->getText();
}
status_text_box->setText(mOldStatusText.substr(0, max_status_length));
}
// Update the status character counter
int characters_remaining = max_status_length - status_text_box->getText().length();
mStatusCounterLabel->setValue(characters_remaining);
}
}
void LLTwitterPhotoPanel::updateControls()
{
LLSnapshotLivePreview* previewp = getPreviewView();
BOOL got_snap = previewp && previewp->getSnapshotUpToDate();
// *TODO: Separate maximum size for Web images from postcards
LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL;
updateResolution(FALSE);
}
void LLTwitterPhotoPanel::updateResolution(BOOL do_update)
{
LLComboBox* combobox = static_cast<LLComboBox *>(mResolutionComboBox);
LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox);
std::string sdstring = combobox->getSelectedValue();
LLSD sdres;
std::stringstream sstream(sdstring);
LLSDSerialize::fromNotation(sdres, sstream, sdstring.size());
S32 width = sdres[0];
S32 height = sdres[1];
// Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale
std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : "");
LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());
if (previewp && combobox->getCurrentIndex() >= 0)
{
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare; moved up
checkAspectRatio(width);
S32 original_width = 0 , original_height = 0 ;
previewp->getSize(original_width, original_height) ;
if (width == 0 || height == 0)
{
// take resolution from current window size
LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
}
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
else if (width == -1 || height == -1)
{
// take resolution from custom size
LLSpinCtrl* width_spinner = getChild<LLSpinCtrl>("custom_snapshot_width");
LLSpinCtrl* height_spinner = getChild<LLSpinCtrl>("custom_snapshot_height");
S32 custom_width = width_spinner->getValue().asInteger();
S32 custom_height = height_spinner->getValue().asInteger();
if (checkImageSize(previewp, custom_width, custom_height, TRUE, previewp->getMaxImageSize()))
{
width_spinner->set(custom_width);
height_spinner->set(custom_height);
}
LL_DEBUGS() << "Setting preview res from custom: " << custom_width << "x" << custom_height << LL_ENDL;
previewp->setSize(custom_width, custom_height);
}
// </FS:Ansariel>
else
{
// use the resolution from the selected pre-canned drop-down choice
LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL;
previewp->setSize(width, height);
}
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare; moved up
//checkAspectRatio(width);
previewp->getSize(width, height);
if (original_width != width || original_height != height)
{
previewp->setSize(width, height);
if (do_update)
{
previewp->updateSnapshot(TRUE);
updateControls();
}
}
// Get the old filter, compare to the current one "filter_name" and set if changed
std::string original_filter = previewp->getFilter();
if (original_filter != filter_name)
{
previewp->setFilter(filter_name);
if (do_update)
{
previewp->updateSnapshot(FALSE, TRUE);
updateControls();
}
}
}
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
BOOL custom_resolution = static_cast<LLComboBox *>(mResolutionComboBox)->getSelectedValue().asString() == "[i-1,i-1]";
getChild<LLSpinCtrl>("custom_snapshot_width")->setEnabled(custom_resolution);
getChild<LLSpinCtrl>("custom_snapshot_height")->setEnabled(custom_resolution);
getChild<LLCheckBoxCtrl>("keep_aspect_ratio")->setEnabled(custom_resolution);
// </FS:Ansariel>
}
void LLTwitterPhotoPanel::checkAspectRatio(S32 index)
{
LLSnapshotLivePreview *previewp = getPreviewView() ;
BOOL keep_aspect = FALSE;
if (0 == index) // current window size
{
keep_aspect = TRUE;
}
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
else if (-1 == index)
{
keep_aspect = getChild<LLCheckBoxCtrl>("keep_aspect_ratio")->get();
}
// </FS:Ansariel>
else // predefined resolution
{
keep_aspect = FALSE;
}
if (previewp)
{
previewp->mKeepAspectRatio = keep_aspect;
}
}
LLUICtrl* LLTwitterPhotoPanel::getRefreshBtn()
{
return mRefreshBtn;
}
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
BOOL LLTwitterPhotoPanel::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
{
S32 w = width ;
S32 h = height ;
if(previewp && previewp->mKeepAspectRatio)
{
if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1)
{
return FALSE ;
}
//aspect ratio of the current window
F32 aspect_ratio = (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw() ;
//change another value proportionally
if(isWidthChanged)
{
height = ll_round(width / aspect_ratio) ;
}
else
{
width = ll_round(height * aspect_ratio) ;
}
//bound w/h by the max_value
if(width > max_value || height > max_value)
{
if(width > height)
{
width = max_value ;
height = (S32)(width / aspect_ratio) ;
}
else
{
height = max_value ;
width = (S32)(height * aspect_ratio) ;
}
}
}
return (w != width || h != height) ;
}
// </FS:Ansariel>
///////////////////////////
//LLTwitterAccountPanel//////
///////////////////////////
LLTwitterAccountPanel::LLTwitterAccountPanel() :
mAccountCaptionLabel(NULL),
mAccountNameLabel(NULL),
mPanelButtons(NULL),
mConnectButton(NULL),
mDisconnectButton(NULL)
{
mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLTwitterAccountPanel::onConnect, this));
mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLTwitterAccountPanel::onDisconnect, this));
setVisibleCallback(boost::bind(&LLTwitterAccountPanel::onVisibilityChange, this, _2));
}
BOOL LLTwitterAccountPanel::postBuild()
{
mAccountCaptionLabel = getChild<LLTextBox>("account_caption_label");
mAccountNameLabel = getChild<LLTextBox>("account_name_label");
mPanelButtons = getChild<LLUICtrl>("panel_buttons");
mConnectButton = getChild<LLUICtrl>("connect_btn");
mDisconnectButton = getChild<LLUICtrl>("disconnect_btn");
return LLPanel::postBuild();
}
void LLTwitterAccountPanel::draw()
{
LLTwitterConnect::EConnectionState connection_state = LLTwitterConnect::instance().getConnectionState();
//Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress
bool disconnecting = connection_state == LLTwitterConnect::TWITTER_DISCONNECTING;
mDisconnectButton->setEnabled(!disconnecting);
//Disable the 'connect' button when a connection is in progress
bool connecting = connection_state == LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS;
mConnectButton->setEnabled(!connecting);
LLPanel::draw();
}
void LLTwitterAccountPanel::onVisibilityChange(BOOL visible)
{
if(visible)
{
LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterAccountPanel");
LLEventPumps::instance().obtain("TwitterConnectState").listen("LLTwitterAccountPanel", boost::bind(&LLTwitterAccountPanel::onTwitterConnectStateChange, this, _1));
LLEventPumps::instance().obtain("TwitterConnectInfo").stopListening("LLTwitterAccountPanel");
LLEventPumps::instance().obtain("TwitterConnectInfo").listen("LLTwitterAccountPanel", boost::bind(&LLTwitterAccountPanel::onTwitterConnectInfoChange, this));
//Connected
if(LLTwitterConnect::instance().isConnected())
{
showConnectedLayout();
}
//Check if connected (show disconnected layout in meantime)
else
{
showDisconnectedLayout();
}
if ((LLTwitterConnect::instance().getConnectionState() == LLTwitterConnect::TWITTER_NOT_CONNECTED) ||
(LLTwitterConnect::instance().getConnectionState() == LLTwitterConnect::TWITTER_CONNECTION_FAILED))
{
LLTwitterConnect::instance().checkConnectionToTwitter();
}
}
else
{
LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterAccountPanel");
LLEventPumps::instance().obtain("TwitterConnectInfo").stopListening("LLTwitterAccountPanel");
}
}
bool LLTwitterAccountPanel::onTwitterConnectStateChange(const LLSD& data)
{
if(LLTwitterConnect::instance().isConnected())
{
//In process of disconnecting so leave the layout as is
if(data.get("enum").asInteger() != LLTwitterConnect::TWITTER_DISCONNECTING)
{
showConnectedLayout();
}
}
else
{
showDisconnectedLayout();
}
return false;
}
bool LLTwitterAccountPanel::onTwitterConnectInfoChange()
{
LLSD info = LLTwitterConnect::instance().getInfo();
std::string clickable_name;
//Strings of format [http://www.somewebsite.com Click Me] become clickable text
if(info.has("link") && info.has("name"))
{
clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]";
}
mAccountNameLabel->setText(clickable_name);
return false;
}
void LLTwitterAccountPanel::showConnectButton()
{
if(!mConnectButton->getVisible())
{
mConnectButton->setVisible(TRUE);
mDisconnectButton->setVisible(FALSE);
}
}
void LLTwitterAccountPanel::hideConnectButton()
{
if(mConnectButton->getVisible())
{
mConnectButton->setVisible(FALSE);
mDisconnectButton->setVisible(TRUE);
}
}
void LLTwitterAccountPanel::showDisconnectedLayout()
{
mAccountCaptionLabel->setText(getString("twitter_disconnected"));
mAccountNameLabel->setText(std::string(""));
showConnectButton();
}
void LLTwitterAccountPanel::showConnectedLayout()
{
LLTwitterConnect::instance().loadTwitterInfo();
mAccountCaptionLabel->setText(getString("twitter_connected"));
hideConnectButton();
}
void LLTwitterAccountPanel::onConnect()
{
LLTwitterConnect::instance().checkConnectionToTwitter(true);
}
void LLTwitterAccountPanel::onDisconnect()
{
LLTwitterConnect::instance().disconnectFromTwitter();
}
////////////////////////
//LLFloaterTwitter///////
////////////////////////
LLFloaterTwitter::LLFloaterTwitter(const LLSD& key) : LLFloater(key),
mTwitterPhotoPanel(NULL),
mStatusErrorText(NULL),
mStatusLoadingText(NULL),
mStatusLoadingIndicator(NULL)
{
mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterTwitter::onCancel, this));
}
void LLFloaterTwitter::onClose(bool app_quitting)
{
LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
if (big_preview_floater)
{
big_preview_floater->closeOnFloaterOwnerClosing(this);
}
LLFloater::onClose(app_quitting);
}
void LLFloaterTwitter::onCancel()
{
LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
if (big_preview_floater)
{
big_preview_floater->closeOnFloaterOwnerClosing(this);
}
closeFloater();
}
BOOL LLFloaterTwitter::postBuild()
{
// Keep tab of the Photo Panel
mTwitterPhotoPanel = static_cast<LLTwitterPhotoPanel*>(getChild<LLUICtrl>("panel_twitter_photo"));
// Connection status widgets
mStatusErrorText = getChild<LLTextBox>("connection_error_text");
mStatusLoadingText = getChild<LLTextBox>("connection_loading_text");
mStatusLoadingIndicator = getChild<LLUICtrl>("connection_loading_indicator");
return LLFloater::postBuild();
}
void LLFloaterTwitter::showPhotoPanel()
{
LLTabContainer* parent = dynamic_cast<LLTabContainer*>(mTwitterPhotoPanel->getParent());
if (!parent)
{
LL_WARNS() << "Cannot find panel container" << LL_ENDL;
return;
}
parent->selectTabPanel(mTwitterPhotoPanel);
}
void LLFloaterTwitter::draw()
{
if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator)
{
mStatusErrorText->setVisible(false);
mStatusLoadingText->setVisible(false);
mStatusLoadingIndicator->setVisible(false);
LLTwitterConnect::EConnectionState connection_state = LLTwitterConnect::instance().getConnectionState();
std::string status_text;
switch (connection_state)
{
case LLTwitterConnect::TWITTER_NOT_CONNECTED:
// No status displayed when first opening the panel and no connection done
case LLTwitterConnect::TWITTER_CONNECTED:
// When successfully connected, no message is displayed
case LLTwitterConnect::TWITTER_POSTED:
// No success message to show since we actually close the floater after successful posting completion
break;
case LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS:
// Connection loading indicator
mStatusLoadingText->setVisible(true);
status_text = LLTrans::getString("SocialTwitterConnecting");
mStatusLoadingText->setValue(status_text);
mStatusLoadingIndicator->setVisible(true);
break;
case LLTwitterConnect::TWITTER_POSTING:
// Posting indicator
mStatusLoadingText->setVisible(true);
status_text = LLTrans::getString("SocialTwitterPosting");
mStatusLoadingText->setValue(status_text);
mStatusLoadingIndicator->setVisible(true);
break;
case LLTwitterConnect::TWITTER_CONNECTION_FAILED:
// Error connecting to the service
mStatusErrorText->setVisible(true);
status_text = LLTrans::getString("SocialTwitterErrorConnecting");
mStatusErrorText->setValue(status_text);
break;
case LLTwitterConnect::TWITTER_POST_FAILED:
// Error posting to the service
mStatusErrorText->setVisible(true);
status_text = LLTrans::getString("SocialTwitterErrorPosting");
mStatusErrorText->setValue(status_text);
break;
case LLTwitterConnect::TWITTER_DISCONNECTING:
// Disconnecting loading indicator
mStatusLoadingText->setVisible(true);
status_text = LLTrans::getString("SocialTwitterDisconnecting");
mStatusLoadingText->setValue(status_text);
mStatusLoadingIndicator->setVisible(true);
break;
case LLTwitterConnect::TWITTER_DISCONNECT_FAILED:
// Error disconnecting from the service
mStatusErrorText->setVisible(true);
status_text = LLTrans::getString("SocialTwitterErrorDisconnecting");
mStatusErrorText->setValue(status_text);
break;
}
}
LLFloater::draw();
}

View File

@ -1,141 +0,0 @@
/**
* @file llfloatertwitter.h
* @brief Header file for llfloatertwitter
* @author cho@lindenlab.com
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERTWITTER_H
#define LL_LLFLOATERTWITTER_H
#include "llfloater.h"
#include "lltextbox.h"
#include "llviewertexture.h"
class LLIconCtrl;
class LLCheckBoxCtrl;
class LLSnapshotLivePreview;
class LLFloaterBigPreview;
class LLTwitterPhotoPanel : public LLPanel
{
public:
LLTwitterPhotoPanel();
~LLTwitterPhotoPanel();
BOOL postBuild();
void draw();
LLSnapshotLivePreview* getPreviewView();
void onVisibilityChange(BOOL new_visibility);
void onAddLocationToggled();
void onAddPhotoToggled();
void onClickBigPreview();
void onClickNewSnapshot();
void onSend();
S32 notify(const LLSD& info);
bool onTwitterConnectStateChange(const LLSD& data);
void sendPhoto();
void clearAndClose();
void updateStatusTextLength(BOOL restore_old_status_text);
void updateControls();
void updateResolution(BOOL do_update);
void checkAspectRatio(S32 index);
LLUICtrl* getRefreshBtn();
private:
bool isPreviewVisible();
void attachPreview();
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
LLHandle<LLView> mPreviewHandle;
LLUICtrl * mResolutionComboBox;
LLUICtrl * mFilterComboBox;
LLUICtrl * mRefreshBtn;
LLUICtrl * mWorkingLabel;
LLUICtrl * mThumbnailPlaceholder;
LLUICtrl * mStatusCounterLabel;
LLUICtrl * mStatusTextBox;
LLUICtrl * mLocationCheckbox;
LLUICtrl * mPhotoCheckbox;
LLUICtrl * mPostButton;
LLUICtrl * mCancelButton;
LLButton * mBtnPreview;
LLFloaterBigPreview * mBigPreviewFloater;
std::string mOldStatusText;
};
class LLTwitterAccountPanel : public LLPanel
{
public:
LLTwitterAccountPanel();
BOOL postBuild();
void draw();
private:
void onVisibilityChange(BOOL new_visibility);
bool onTwitterConnectStateChange(const LLSD& data);
bool onTwitterConnectInfoChange();
void onConnect();
void onUseAnotherAccount();
void onDisconnect();
void showConnectButton();
void hideConnectButton();
void showDisconnectedLayout();
void showConnectedLayout();
LLTextBox * mAccountCaptionLabel;
LLTextBox * mAccountNameLabel;
LLUICtrl * mPanelButtons;
LLUICtrl * mConnectButton;
LLUICtrl * mDisconnectButton;
};
class LLFloaterTwitter : public LLFloater
{
public:
LLFloaterTwitter(const LLSD& key);
BOOL postBuild();
void draw();
void onClose(bool app_quitting);
void onCancel();
void showPhotoPanel();
private:
LLTwitterPhotoPanel* mTwitterPhotoPanel;
LLTextBox* mStatusErrorText;
LLTextBox* mStatusLoadingText;
LLUICtrl* mStatusLoadingIndicator;
};
#endif // LL_LLFLOATERTWITTER_H

View File

@ -30,8 +30,6 @@
#include "lliconctrl.h"
#include "llfloaterreg.h"
#include "llhttpconstants.h"
#include "llflickrconnect.h"
#include "lltwitterconnect.h"
#include "lllayoutstack.h"
#include "llpluginclassmedia.h"
#include "llprogressbar.h"
@ -297,27 +295,6 @@ void LLFloaterWebContent::onOpen(const LLSD& key)
//virtual
void LLFloaterWebContent::onClose(bool app_quitting)
{
// If we close the web browsing window showing the Flickr login, we need to signal to this object that the connection will not happen
// MAINT-3440 note change here to use findInstance and not getInstance - latter creates an instance if it's not there which is bad.
LLFloater* flickr_web = LLFloaterReg::findInstance("flickr_web");
if (flickr_web == this)
{
if (!LLFlickrConnect::instance().isConnected())
{
LLFlickrConnect::instance().setConnectionState(LLFlickrConnect::FLICKR_CONNECTION_FAILED);
}
}
// Same with Twitter
// MAINT-3440 note change here to use findInstance and not getInstance - latter creates an instance if it's not there which is bad.
LLFloater* twitter_web = LLFloaterReg::findInstance("twitter_web");
if (twitter_web == this)
{
if (!LLTwitterConnect::instance().isConnected())
{
LLTwitterConnect::instance().setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_FAILED);
}
}
LLViewerMedia::getInstance()->proxyWindowClosed(mUUID);
destroy();
}

View File

@ -1,6 +1,6 @@
/**
* @file llimagefiltersmanager.cpp
* @brief Load image filters list and retrieve their path. Mostly used for Flickr UI at the moment.
* @brief Load image filters list and retrieve their path.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code

View File

@ -1,6 +1,6 @@
/**
* @file llimagefiltersmanager.h
* @brief Load image filters list and retrieve their path. Mostly used for Flickr UI at the moment.
* @brief Load image filters list and retrieve their path.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code

View File

@ -32,8 +32,7 @@
#include "llfloatersnapshot.h" // FIXME: create a snapshot model
#include "llfloaterreg.h"
#include "llfloaterflickr.h"
#include "llfloatertwitter.h"
#include "llfloaterflickr.h" // <FS:Ansariel> Share to Flickr
/**
* Provides several ways to save a snapshot.
@ -58,8 +57,7 @@ private:
void onSaveToEmail();
void onSaveToInventory();
void onSaveToComputer();
void onSendToTwitter();
void onSendToFlickr();
void onSendToFlickr(); // <FS:Ansariel> Share to Flickr
LLFloaterSnapshotBase* mSnapshotFloater;
};
@ -72,8 +70,8 @@ LLPanelSnapshotOptions::LLPanelSnapshotOptions()
mCommitCallbackRegistrar.add("Snapshot.SaveToEmail", boost::bind(&LLPanelSnapshotOptions::onSaveToEmail, this));
mCommitCallbackRegistrar.add("Snapshot.SaveToInventory", boost::bind(&LLPanelSnapshotOptions::onSaveToInventory, this));
mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this));
mCommitCallbackRegistrar.add("Snapshot.SendToTwitter", boost::bind(&LLPanelSnapshotOptions::onSendToTwitter, this));
mCommitCallbackRegistrar.add("Snapshot.SendToFlickr", boost::bind(&LLPanelSnapshotOptions::onSendToFlickr, this));
mCommitCallbackRegistrar.add("Snapshot.SendToFlickr", boost::bind(&LLPanelSnapshotOptions::onSendToFlickr, this)); // <FS:Ansariel> Share to Flickr
LLGlobalEconomy::getInstance()->addObserver(this);
}
@ -135,26 +133,16 @@ void LLPanelSnapshotOptions::onSaveToComputer()
openPanel("panel_snapshot_local");
}
void LLPanelSnapshotOptions::onSendToTwitter()
{
LLFloaterReg::hideInstance("snapshot");
LLFloaterTwitter* twitter_floater = dynamic_cast<LLFloaterTwitter*>(LLFloaterReg::getInstance("twitter"));
if (twitter_floater)
{
twitter_floater->showPhotoPanel();
}
LLFloaterReg::showInstance("twitter");
}
void LLPanelSnapshotOptions::onSendToFlickr()
{
LLFloaterReg::hideInstance("snapshot");
LLFloaterFlickr* flickr_floater = dynamic_cast<LLFloaterFlickr*>(LLFloaterReg::getInstance("flickr"));
if (flickr_floater)
{
flickr_floater->showPhotoPanel();
}
LLFloaterReg::showInstance("flickr");
}
// <FS:Ansariel> Share to Flickr
void LLPanelSnapshotOptions::onSendToFlickr()
{
LLFloaterReg::hideInstance("snapshot");
LLFloaterFlickr* flickr_floater = dynamic_cast<LLFloaterFlickr*>(LLFloaterReg::getInstance("flickr"));
if (flickr_floater)
{
flickr_floater->showPhotoPanel();
}
LLFloaterReg::showInstance("flickr");
}
// </FS:Ansariel>

View File

@ -487,7 +487,7 @@ void LLSidepanelAppearance::fetchInventory()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
LLViewerObject* attached_object = attachment_iter->get();
if (!attached_object) continue;
const LLUUID& item_id = attached_object->getAttachmentItemID();
if (item_id.isNull()) continue;

View File

@ -34,8 +34,7 @@
#include "lleconomy.h"
#include "llfloaterperms.h"
#include "llfloaterreg.h"
#include "llfloaterflickr.h"
#include "llfloatertwitter.h"
#include "llfloaterflickr.h" // <FS:Ansariel> Share to Flickr
#include "llimagefilter.h"
#include "llimagefiltersmanager.h"
#include "llimagebmp.h"

View File

@ -1,576 +0,0 @@
/**
* @file lltwitterconnect.h
* @author Merov, Cho
* @brief Connection to Twitter Service
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "lltwitterconnect.h"
#include "llflickrconnect.h"
#include "llagent.h"
#include "llcallingcard.h" // for LLAvatarTracker
#include "llcommandhandler.h"
#include "llnotificationsutil.h"
#include "llurlaction.h"
#include "llimagepng.h"
#include "llimagejpeg.h"
#include "lltrans.h"
#include "llevents.h"
#include "llviewerregion.h"
#include "llfloaterwebcontent.h"
#include "llfloaterreg.h"
#include "llcorehttputil.h"
boost::scoped_ptr<LLEventPump> LLTwitterConnect::sStateWatcher(new LLEventStream("TwitterConnectState"));
boost::scoped_ptr<LLEventPump> LLTwitterConnect::sInfoWatcher(new LLEventStream("TwitterConnectInfo"));
boost::scoped_ptr<LLEventPump> LLTwitterConnect::sContentWatcher(new LLEventStream("TwitterConnectContent"));
// Local functions
void log_twitter_connect_error(const std::string& request, U32 status, const std::string& reason, const std::string& code, const std::string& description)
{
// Note: 302 (redirect) is *not* an error that warrants logging
if (status != 302)
{
LL_WARNS("TwitterConnect") << request << " request failed with a " << status << " " << reason << ". Reason: " << code << " (" << description << ")" << LL_ENDL;
}
}
void toast_user_for_twitter_success()
{
LLSD args;
args["MESSAGE"] = LLTrans::getString("twitter_post_success");
LLNotificationsUtil::add("TwitterConnect", args);
}
class LLTwitterConnectHandler : public LLCommandHandler
{
public:
LLTwitterConnectHandler() : LLCommandHandler("fbc", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
{
if (tokens.size() >= 1)
{
if (tokens[0].asString() == "connect")
{
if (tokens.size() >= 2 && tokens[1].asString() == "twitter")
{
// this command probably came from the twitter_web browser, so close it
LLFloaterReg::hideInstance("twitter_web");
// connect to twitter
if (query_map.has("oauth_token"))
{
LLTwitterConnect::instance().connectToTwitter(query_map["oauth_token"], query_map.get("oauth_verifier"));
}
return true;
}
else if (tokens.size() >= 2 && tokens[1].asString() == "flickr")
{
// this command probably came from the flickr_web browser, so close it
LLFloaterReg::hideInstance("flickr_web");
// connect to flickr
if (query_map.has("oauth_token"))
{
LLFlickrConnect::instance().connectToFlickr(query_map["oauth_token"], query_map.get("oauth_verifier"));
}
return true;
}
}
}
return false;
}
};
LLTwitterConnectHandler gTwitterConnectHandler;
///////////////////////////////////////////////////////////////////////////////
//
void LLTwitterConnect::twitterConnectCoro(std::string requestToken, std::string oauthVerifier)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setWantHeaders(true);
httpOpts->setFollowRedirects(false);
LLSD body;
if (!requestToken.empty())
body["request_token"] = requestToken;
if (!oauthVerifier.empty())
body["oauth_verifier"] = oauthVerifier;
LLSD result = httpAdapter->putAndSuspend(httpRequest, getTwitterConnectURL("/connection"), body, httpOpts);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
if ( status == LLCore::HttpStatus(HTTP_FOUND) )
{
std::string location = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS][HTTP_IN_HEADER_LOCATION];
if (location.empty())
{
LL_WARNS("TwitterConnect") << "Missing Location header " << LL_ENDL;
}
else
{
openTwitterWeb(location);
}
}
else
{
LL_WARNS("TwitterConnect") << "Connection failed " << status.toString() << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_FAILED);
log_twitter_connect_error("Connect", status.getStatus(), status.toString(),
result.get("error_code"), result.get("error_description"));
}
}
else
{
LL_DEBUGS("TwitterConnect") << "Connect successful. " << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_CONNECTED);
}
}
///////////////////////////////////////////////////////////////////////////////
//
bool LLTwitterConnect::testShareStatus(LLSD &result)
{
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (status)
return true;
if (status == LLCore::HttpStatus(HTTP_FOUND))
{
std::string location = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS][HTTP_IN_HEADER_LOCATION];
if (location.empty())
{
LL_WARNS("TwitterConnect") << "Missing Location header " << LL_ENDL;
}
else
{
openTwitterWeb(location);
}
}
if (status == LLCore::HttpStatus(HTTP_NOT_FOUND))
{
LL_DEBUGS("TwitterConnect") << "Not connected. " << LL_ENDL;
connectToTwitter();
}
else
{
LL_WARNS("TwitterConnect") << "HTTP Status error " << status.toString() << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_POST_FAILED);
log_twitter_connect_error("Share", status.getStatus(), status.toString(),
result.get("error_code"), result.get("error_description"));
}
return false;
}
void LLTwitterConnect::twitterShareCoro(std::string route, LLSD share)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setWantHeaders(true);
httpOpts->setFollowRedirects(false);
LLSD result = httpAdapter->postAndSuspend(httpRequest, getTwitterConnectURL(route, true), share, httpOpts);
if (testShareStatus(result))
{
toast_user_for_twitter_success();
LL_DEBUGS("TwitterConnect") << "Post successful. " << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_POSTED);
}
}
void LLTwitterConnect::twitterShareImageCoro(LLPointer<LLImageFormatted> image, std::string status)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setWantHeaders(true);
httpOpts->setFollowRedirects(false);
std::string imageFormat;
if (dynamic_cast<LLImagePNG*>(image.get()))
{
imageFormat = "png";
}
else if (dynamic_cast<LLImageJPEG*>(image.get()))
{
imageFormat = "jpg";
}
else
{
LL_WARNS() << "Image to upload is not a PNG or JPEG" << LL_ENDL;
return;
}
// All this code is mostly copied from LLWebProfile::post()
const std::string boundary = "----------------------------0123abcdefab";
std::string contentType = "multipart/form-data; boundary=" + boundary;
httpHeaders->append("Content-Type", contentType.c_str());
LLCore::BufferArray::ptr_t raw = LLCore::BufferArray::ptr_t(new LLCore::BufferArray()); //
LLCore::BufferArrayStream body(raw.get());
// *NOTE: The order seems to matter.
body << "--" << boundary << "\r\n"
<< "Content-Disposition: form-data; name=\"status\"\r\n\r\n"
<< status << "\r\n";
body << "--" << boundary << "\r\n"
<< "Content-Disposition: form-data; name=\"image\"; filename=\"Untitled." << imageFormat << "\"\r\n"
<< "Content-Type: image/" << imageFormat << "\r\n\r\n";
// Insert the image data.
// *FIX: Treating this as a string will probably screw it up ...
U8* image_data = image->getData();
for (S32 i = 0; i < image->getDataSize(); ++i)
{
body << image_data[i];
}
body << "\r\n--" << boundary << "--\r\n";
LLSD result = httpAdapter->postAndSuspend(httpRequest, getTwitterConnectURL("/share/photo", true), raw, httpOpts, httpHeaders);
if (testShareStatus(result))
{
toast_user_for_twitter_success();
LL_DEBUGS("TwitterConnect") << "Post successful. " << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_POSTED);
}
}
///////////////////////////////////////////////////////////////////////////////
//
void LLTwitterConnect::twitterDisconnectCoro()
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setFollowRedirects(false);
LLSD result = httpAdapter->deleteAndSuspend(httpRequest, getTwitterConnectURL("/connection"), httpOpts);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status && (status != LLCore::HttpStatus(HTTP_NOT_FOUND)))
{
LL_WARNS("TwitterConnect") << "Disconnect failed!" << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_DISCONNECT_FAILED);
log_twitter_connect_error("Disconnect", status.getStatus(), status.toString(),
result.get("error_code"), result.get("error_description"));
}
else
{
LL_DEBUGS("TwitterConnect") << "Disconnect successful. " << LL_ENDL;
clearInfo();
setConnectionState(LLTwitterConnect::TWITTER_NOT_CONNECTED);
}
}
///////////////////////////////////////////////////////////////////////////////
//
void LLTwitterConnect::twitterConnectedCoro(bool autoConnect)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setFollowRedirects(false);
setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS);
LLSD result = httpAdapter->getAndSuspend(httpRequest, getTwitterConnectURL("/connection", true), httpOpts);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
if (status == LLCore::HttpStatus(HTTP_NOT_FOUND))
{
LL_DEBUGS("TwitterConnect") << "Not connected. " << LL_ENDL;
if (autoConnect)
{
connectToTwitter();
}
else
{
setConnectionState(LLTwitterConnect::TWITTER_NOT_CONNECTED);
}
}
else
{
LL_WARNS("TwitterConnect") << "Failed to test connection:" << status.toTerseString() << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_FAILED);
log_twitter_connect_error("Connected", status.getStatus(), status.toString(),
result.get("error_code"), result.get("error_description"));
}
}
else
{
LL_DEBUGS("TwitterConnect") << "Connect successful. " << LL_ENDL;
setConnectionState(LLTwitterConnect::TWITTER_CONNECTED);
}
}
///////////////////////////////////////////////////////////////////////////////
//
void LLTwitterConnect::twitterInfoCoro()
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
httpOpts->setWantHeaders(true);
httpOpts->setFollowRedirects(false);
LLSD result = httpAdapter->getAndSuspend(httpRequest, getTwitterConnectURL("/info", true), httpOpts);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (status == LLCore::HttpStatus(HTTP_FOUND))
{
std::string location = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS][HTTP_IN_HEADER_LOCATION];
if (location.empty())
{
LL_WARNS("TwitterConnect") << "Missing Location header " << LL_ENDL;
}
else
{
openTwitterWeb(location);
}
}
else if (!status)
{
LL_WARNS("TwitterConnect") << "Twitter Info failed: " << status.toString() << LL_ENDL;
log_twitter_connect_error("Info", status.getStatus(), status.toString(),
result.get("error_code"), result.get("error_description"));
}
else
{
LL_INFOS("TwitterConnect") << "Twitter: Info received" << LL_ENDL;
result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
storeInfo(result);
}
}
///////////////////////////////////////////////////////////////////////////////
//
LLTwitterConnect::LLTwitterConnect()
: mConnectionState(TWITTER_NOT_CONNECTED),
mConnected(false),
mInfo(),
mRefreshInfo(false),
mReadFromMaster(false)
{
}
void LLTwitterConnect::openTwitterWeb(std::string url)
{
LLFloaterWebContent::Params p;
p.url(url);
p.show_chrome(true);
p.allow_back_forward_navigation(false);
p.clean_browser(true);
LLFloater *floater = LLFloaterReg::showInstance("twitter_web", p);
//the internal web browser has a bug that prevents it from gaining focus unless a mouse event occurs first (it seems).
//So when showing the internal web browser, set focus to it's containing floater "twitter_web". When a mouse event
//occurs on the "webbrowser" panel part of the floater, a mouse cursor will properly show and the "webbrowser" will gain focus.
//twitter_web floater contains the "webbrowser" panel. JIRA: ACME-744
gFocusMgr.setKeyboardFocus( floater );
//LLUrlAction::openURLExternal(url);
}
std::string LLTwitterConnect::getTwitterConnectURL(const std::string& route, bool include_read_from_master)
{
std::string url("");
LLViewerRegion *regionp = gAgent.getRegion();
if (regionp)
{
//url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO
url = regionp->getCapability("TwitterConnect");
url += route;
if (include_read_from_master && mReadFromMaster)
{
url += "?read_from_master=true";
}
}
return url;
}
void LLTwitterConnect::connectToTwitter(const std::string& request_token, const std::string& oauth_verifier)
{
setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS);
LLCoros::instance().launch("LLTwitterConnect::twitterConnectCoro",
boost::bind(&LLTwitterConnect::twitterConnectCoro, this, request_token, oauth_verifier));
}
void LLTwitterConnect::disconnectFromTwitter()
{
setConnectionState(LLTwitterConnect::TWITTER_DISCONNECTING);
LLCoros::instance().launch("LLTwitterConnect::twitterDisconnectCoro",
boost::bind(&LLTwitterConnect::twitterDisconnectCoro, this));
}
void LLTwitterConnect::checkConnectionToTwitter(bool auto_connect)
{
LLCoros::instance().launch("LLTwitterConnect::twitterConnectedCoro",
boost::bind(&LLTwitterConnect::twitterConnectedCoro, this, auto_connect));
}
void LLTwitterConnect::loadTwitterInfo()
{
if(mRefreshInfo)
{
LLCoros::instance().launch("LLTwitterConnect::twitterInfoCoro",
boost::bind(&LLTwitterConnect::twitterInfoCoro, this));
}
}
void LLTwitterConnect::uploadPhoto(const std::string& image_url, const std::string& status)
{
LLSD body;
body["image"] = image_url;
body["status"] = status;
setConnectionState(LLTwitterConnect::TWITTER_POSTING);
LLCoros::instance().launch("LLTwitterConnect::twitterShareCoro",
boost::bind(&LLTwitterConnect::twitterShareCoro, this, "/share/photo", body));
}
void LLTwitterConnect::uploadPhoto(LLPointer<LLImageFormatted> image, const std::string& status)
{
setConnectionState(LLTwitterConnect::TWITTER_POSTING);
LLCoros::instance().launch("LLTwitterConnect::twitterShareImageCoro",
boost::bind(&LLTwitterConnect::twitterShareImageCoro, this, image, status));
}
void LLTwitterConnect::updateStatus(const std::string& status)
{
LLSD body;
body["status"] = status;
setConnectionState(LLTwitterConnect::TWITTER_POSTING);
LLCoros::instance().launch("LLTwitterConnect::twitterShareCoro",
boost::bind(&LLTwitterConnect::twitterShareCoro, this, "/share/status", body));
}
void LLTwitterConnect::storeInfo(const LLSD& info)
{
mInfo = info;
mRefreshInfo = false;
sInfoWatcher->post(info);
}
const LLSD& LLTwitterConnect::getInfo() const
{
return mInfo;
}
void LLTwitterConnect::clearInfo()
{
mInfo = LLSD();
}
void LLTwitterConnect::setDataDirty()
{
mRefreshInfo = true;
}
void LLTwitterConnect::setConnectionState(LLTwitterConnect::EConnectionState connection_state)
{
if(connection_state == TWITTER_CONNECTED)
{
mReadFromMaster = true;
setConnected(true);
setDataDirty();
}
else if(connection_state == TWITTER_NOT_CONNECTED)
{
setConnected(false);
}
else if(connection_state == TWITTER_POSTED)
{
mReadFromMaster = false;
}
if (mConnectionState != connection_state)
{
// set the connection state before notifying watchers
mConnectionState = connection_state;
LLSD state_info;
state_info["enum"] = connection_state;
sStateWatcher->post(state_info);
}
}
void LLTwitterConnect::setConnected(bool connected)
{
mConnected = connected;
}

View File

@ -1,107 +0,0 @@
/**
* @file lltwitterconnect.h
* @author Merov, Cho
* @brief Connection to Twitter Service
*
* $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLTWITTERCONNECT_H
#define LL_LLTWITTERCONNECT_H
#include "llsingleton.h"
#include "llimage.h"
#include "llcoros.h"
#include "lleventcoro.h"
class LLEventPump;
/**
* @class LLTwitterConnect
*
* Manages authentication to, and interaction with, a web service allowing the
* the viewer to post status updates and upload photos to Twitter.
*/
class LLTwitterConnect : public LLSingleton<LLTwitterConnect>
{
LLSINGLETON(LLTwitterConnect);
LOG_CLASS(LLTwitterConnect);
public:
enum EConnectionState
{
TWITTER_NOT_CONNECTED = 0,
TWITTER_CONNECTION_IN_PROGRESS = 1,
TWITTER_CONNECTED = 2,
TWITTER_CONNECTION_FAILED = 3,
TWITTER_POSTING = 4,
TWITTER_POSTED = 5,
TWITTER_POST_FAILED = 6,
TWITTER_DISCONNECTING = 7,
TWITTER_DISCONNECT_FAILED = 8
};
void connectToTwitter(const std::string& request_token = "", const std::string& oauth_verifier = ""); // Initiate the complete Twitter connection. Please use checkConnectionToTwitter() in normal use.
void disconnectFromTwitter(); // Disconnect from the Twitter service.
void checkConnectionToTwitter(bool auto_connect = false); // Check if an access token is available on the Twitter service. If not, call connectToTwitter().
void loadTwitterInfo();
void uploadPhoto(const std::string& image_url, const std::string& status);
void uploadPhoto(LLPointer<LLImageFormatted> image, const std::string& status);
void updateStatus(const std::string& status);
void storeInfo(const LLSD& info);
const LLSD& getInfo() const;
void clearInfo();
void setDataDirty();
void setConnectionState(EConnectionState connection_state);
void setConnected(bool connected);
bool isConnected() { return mConnected; }
bool isTransactionOngoing() { return ((mConnectionState == TWITTER_CONNECTION_IN_PROGRESS) || (mConnectionState == TWITTER_POSTING) || (mConnectionState == TWITTER_DISCONNECTING)); }
EConnectionState getConnectionState() { return mConnectionState; }
void openTwitterWeb(std::string url);
private:
std::string getTwitterConnectURL(const std::string& route = "", bool include_read_from_master = false);
EConnectionState mConnectionState;
BOOL mConnected;
LLSD mInfo;
bool mRefreshInfo;
bool mReadFromMaster;
static boost::scoped_ptr<LLEventPump> sStateWatcher;
static boost::scoped_ptr<LLEventPump> sInfoWatcher;
static boost::scoped_ptr<LLEventPump> sContentWatcher;
bool testShareStatus(LLSD &result);
void twitterConnectCoro(std::string requestToken, std::string oauthVerifier);
void twitterDisconnectCoro();
void twitterConnectedCoro(bool autoConnect);
void twitterInfoCoro();
void twitterShareCoro(std::string route, LLSD share);
void twitterShareImageCoro(LLPointer<LLImageFormatted> image, std::string status);
};
#endif // LL_LLTWITTERCONNECT_H

View File

@ -67,7 +67,6 @@
#include "llfloaterexperiences.h"
#include "llfloaterexperiencepicker.h"
#include "llfloaterevent.h"
#include "llfloaterflickr.h"
#include "llfloaterfonttest.h"
#include "llfloaterforgetuser.h"
#include "llfloatergesture.h"
@ -133,7 +132,6 @@
#include "llfloatertos.h"
#include "llfloatertoybox.h"
#include "llfloatertranslationsettings.h"
#include "llfloatertwitter.h"
#include "llfloateruipreview.h"
#include "llfloatervoiceeffect.h"
#include "llfloaterwebcontent.h"
@ -204,6 +202,7 @@
#include "lggbeamcolormapfloater.h"
#include "lggbeammapfloater.h"
#include "llfloaterdisplayname.h"
#include "llfloaterflickr.h"
#include "llfloaterscriptrecover.h"
#include "llfloatersearchreplace.h"
#include "llpanelgroup.h"
@ -430,11 +429,6 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFlickr>);
LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTwitter>);
LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBigPreview>);
LLFloaterUIPreviewUtil::registerFloater();
@ -459,6 +453,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("area_search", "floater_fs_area_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSAreaSearch>);
LLFloaterReg::add("export_collada", "floater_export_collada.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<ColladaExportFloater>);
LLFloaterReg::add("delete_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeleteQueue>);
LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFlickr>);
LLFloaterReg::add("fs_floater_profile", "floater_fs_profile_view.xml", &LLFloaterReg::build<FSFloaterProfile>);
LLFloaterReg::add("fs_asset_blacklist", "floater_fs_asset_blacklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterAssetBlacklist>);
LLFloaterReg::add("fs_avatar_render_settings", "floater_fs_avatar_render_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterAvatarRenderSettings>);

View File

@ -264,7 +264,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object)
iter != mAttachedObjects.end();
++iter)
{
LLViewerObject *attached_object = (*iter);
LLViewerObject *attached_object = iter->get();
if (attached_object == object)
{
break;
@ -366,7 +366,7 @@ void LLViewerJointAttachment::setAttachmentVisibility(BOOL visible)
iter != mAttachedObjects.end();
++iter)
{
LLViewerObject *attached_obj = (*iter);
LLViewerObject *attached_obj = iter->get();
if (!attached_obj || attached_obj->mDrawable.isNull() ||
!(attached_obj->mDrawable->getSpatialBridge()))
continue;
@ -405,7 +405,7 @@ S32 LLViewerJointAttachment::getNumAnimatedObjects() const
iter != mAttachedObjects.end();
++iter)
{
const LLViewerObject *attached_object = *iter;
const LLViewerObject *attached_object = iter->get();
if (attached_object->isAnimatedObject())
{
count++;
@ -423,7 +423,7 @@ void LLViewerJointAttachment::clampObjectPosition()
iter != mAttachedObjects.end();
++iter)
{
if (LLViewerObject *attached_object = (*iter))
if (LLViewerObject *attached_object = iter->get())
{
// *NOTE: object can drift when hitting maximum radius
LLVector3 attachmentPos = attached_object->getPosition();
@ -445,7 +445,7 @@ void LLViewerJointAttachment::calcLOD()
iter != mAttachedObjects.end();
++iter)
{
if (LLViewerObject *attached_object = (*iter))
if (LLViewerObject *attached_object = iter->get())
{
maxarea = llmax(maxarea,attached_object->getMaxScale() * attached_object->getMidScale());
LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
@ -484,7 +484,7 @@ BOOL LLViewerJointAttachment::isObjectAttached(const LLViewerObject *viewer_obje
iter != mAttachedObjects.end();
++iter)
{
const LLViewerObject* attached_object = (*iter);
const LLViewerObject* attached_object = iter->get();
if (attached_object == viewer_object)
{
return TRUE;
@ -499,7 +499,7 @@ const LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &o
iter != mAttachedObjects.end();
++iter)
{
const LLViewerObject* attached_object = (*iter);
const LLViewerObject* attached_object = iter->get();
// if (attached_object->getAttachmentItemID() == object_id)
// [SL:KB] - Patch: Appearance-PhantomAttach | Checked: Catznip-5.0
if ( (attached_object->getAttachmentItemID() == object_id) && (!attached_object->isDead()) )
@ -517,7 +517,7 @@ LLViewerObject *LLViewerJointAttachment::getAttachedObject(const LLUUID &object_
iter != mAttachedObjects.end();
++iter)
{
LLViewerObject* attached_object = (*iter);
LLViewerObject* attached_object = iter->get();
if (attached_object->getAttachmentItemID() == object_id)
{
return attached_object;

View File

@ -98,7 +98,7 @@ public:
LLViewerObject *getAttachedObject(const LLUUID &object_id);
// list of attachments for this joint
typedef std::vector<LLViewerObject *> attachedobjs_vec_t;
typedef std::vector<LLPointer<LLViewerObject> > attachedobjs_vec_t;
attachedobjs_vec_t mAttachedObjects;
protected:

View File

@ -8478,7 +8478,7 @@ class LLAttachmentDetachFromPoint : public view_listener_t
iter != attachment->mAttachedObjects.end();
iter++)
{
LLViewerObject *attached_object = (*iter);
LLViewerObject *attached_object = iter->get();
// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.isLockedAttachment(attached_object)) )
continue;
@ -8512,7 +8512,7 @@ static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data)
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
const LLViewerObject* attached_object = (*attachment_iter);
const LLViewerObject* attached_object = attachment_iter->get();
if (attached_object)
{
LLViewerInventoryItem* itemp = gInventory.getItem(attached_object->getAttachmentItemID());
@ -8648,7 +8648,7 @@ class LLAttachmentEnableDrop : public view_listener_t
{
// make sure item is in your inventory (it could be a delayed attach message being sent from the sim)
// so check to see if the item is in the inventory already
item = gInventory.getItem((*attachment_iter)->getAttachmentItemID());
item = gInventory.getItem(attachment_iter->get()->getAttachmentItemID());
if (!item)
{
// Item does not exist, make an observer to enable the pie menu
@ -9139,7 +9139,7 @@ void handle_dump_attachments(void*)
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *attached_object = (*attachment_iter);
LLViewerObject *attached_object = attachment_iter->get();
BOOL visible = (attached_object != NULL &&
attached_object->mDrawable.notNull() &&
!attached_object->mDrawable->isRenderType(0));

View File

@ -2151,7 +2151,7 @@ void LLViewerObjectList::generatePickList(LLCamera &camera)
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
if (LLViewerObject* attached_object = (*attachment_iter))
if (LLViewerObject* attached_object = attachment_iter->get())
{
mSelectPickList.insert(attached_object);
LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();

View File

@ -3085,8 +3085,6 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
// </FS:CR> Aurora Sim
capabilityNames.append("EstateChangeInfo");
capabilityNames.append("EventQueueGet");
capabilityNames.append("FlickrConnect");
capabilityNames.append("TwitterConnect");
// <FS:Ansariel> Force HTTP features on SL
if (use_http_inventory()) {

View File

@ -1465,7 +1465,7 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
++attachment_iter)
{
// Don't we need to look at children of attached_object as well?
const LLViewerObject* attached_object = (*attachment_iter);
const LLViewerObject* attached_object = attachment_iter->get();
if (attached_object && !attached_object->isHUDAttachment())
{
const LLVOVolume *vol = dynamic_cast<const LLVOVolume*>(attached_object);
@ -1895,7 +1895,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
LLViewerObject* attached_object = attachment_iter->get();
if (attached_object && !attached_object->isDead() && attachment->getValid())
{
@ -1966,7 +1966,7 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
LLViewerObject* attached_object = attachment_iter->get();
if (attached_object->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, face_hit, &local_intersection, tex_coord, normal, tangent))
{
@ -2854,7 +2854,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
LLViewerObject* attached_object = attachment_iter->get();
BOOL visibleAttachment = visible || (attached_object &&
!(attached_object->mDrawable->getSpatialBridge() &&
attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0f));
@ -5216,7 +5216,7 @@ void LLVOAvatar::updateVisibility()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
if (LLViewerObject *attached_object = (*attachment_iter))
if (LLViewerObject *attached_object = attachment_iter->get())
{
if(attached_object->mDrawable->isVisible())
{
@ -6769,7 +6769,7 @@ void LLVOAvatar::rebuildAttachmentOverrides()
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator at_it = attachment_pt->mAttachedObjects.begin();
at_it != attachment_pt->mAttachedObjects.end(); ++at_it)
{
LLViewerObject *vo = *at_it;
LLViewerObject *vo = at_it->get();
// Attached animated objects affect joints in their control
// avs, not the avs to which they are attached.
if (vo && !vo->isAnimatedObject())
@ -6820,7 +6820,7 @@ void LLVOAvatar::updateAttachmentOverrides()
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator at_it = attachment_pt->mAttachedObjects.begin();
at_it != attachment_pt->mAttachedObjects.end(); ++at_it)
{
LLViewerObject *vo = *at_it;
LLViewerObject *vo = at_it->get();
// Attached animated objects affect joints in their control
// avs, not the avs to which they are attached.
if (vo && !vo->isAnimatedObject())
@ -7955,29 +7955,33 @@ void LLVOAvatar::lazyAttach()
for (U32 i = 0; i < mPendingAttachment.size(); i++)
{
LLPointer<LLViewerObject> cur_attachment = mPendingAttachment[i];
if (cur_attachment->mDrawable)
// Object might have died while we were waiting for drawable
if (!cur_attachment->isDead())
{
if (isSelf())
if (cur_attachment->mDrawable)
{
const LLUUID& item_id = cur_attachment->getAttachmentItemID();
LLViewerInventoryItem *item = gInventory.getItem(item_id);
LL_DEBUGS("Avatar") << "ATT attaching object "
<< (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
if (isSelf())
{
const LLUUID& item_id = cur_attachment->getAttachmentItemID();
LLViewerInventoryItem *item = gInventory.getItem(item_id);
LL_DEBUGS("Avatar") << "ATT attaching object "
<< (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
}
if (!attachObject(cur_attachment))
{ // Drop it
LL_WARNS() << "attachObject() failed for "
<< cur_attachment->getID()
<< " item " << cur_attachment->getAttachmentItemID()
<< LL_ENDL;
// MAINT-3312 backout
//still_pending.push_back(cur_attachment);
}
}
if (!attachObject(cur_attachment))
{ // Drop it
LL_WARNS() << "attachObject() failed for "
<< cur_attachment->getID()
<< " item " << cur_attachment->getAttachmentItemID()
<< LL_ENDL;
// MAINT-3312 backout
//still_pending.push_back(cur_attachment);
else
{
still_pending.push_back(cur_attachment);
}
}
else
{
still_pending.push_back(cur_attachment);
}
}
mPendingAttachment = still_pending;
@ -8000,7 +8004,7 @@ void LLVOAvatar::resetHUDAttachments()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
const LLViewerObject* attached_object = (*attachment_iter);
const LLViewerObject* attached_object = attachment_iter->get();
if (attached_object && attached_object->mDrawable.notNull())
{
gPipeline.markMoved(attached_object->mDrawable);
@ -8397,7 +8401,7 @@ LLViewerObject * LLVOAvatar::findAttachmentByID( const LLUUID & target_id ) cons
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *attached_object = (*attachment_iter);
LLViewerObject *attached_object = attachment_iter->get();
if (attached_object &&
attached_object->getID() == target_id)
{
@ -8857,7 +8861,7 @@ void LLVOAvatar::updateMeshVisibility()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject *objectp = (*attachment_iter);
LLViewerObject *objectp = attachment_iter->get();
if (objectp)
{
for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++)
@ -9180,7 +9184,7 @@ void LLVOAvatar::updateMeshTextures()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
LLViewerObject* attached_object = attachment_iter->get();
if (attached_object && !attached_object->isDead())
{
attached_object->refreshBakeTexture();
@ -9429,7 +9433,7 @@ LLBBox LLVOAvatar::getHUDBBox() const
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
const LLViewerObject* attached_object = (*attachment_iter);
const LLViewerObject* attached_object = attachment_iter->get();
if (attached_object == NULL)
{
LL_WARNS() << "HUD attached object is NULL!" << LL_ENDL;
@ -10872,7 +10876,7 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_iter = attachment->mAttachedObjects.begin();
attach_iter != attach_end; ++attach_iter)
{
LLViewerObject* attached_object = *attach_iter;
LLViewerObject* attached_object = attach_iter->get();
LLVOVolume *volume = dynamic_cast<LLVOVolume*>(attached_object);
if (volume)
{
@ -11461,7 +11465,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
const LLViewerObject* attached_object = (*attachment_iter);
const LLViewerObject* attached_object = attachment_iter->get();
accountRenderComplexityForObject(attached_object, max_attachment_complexity,
// <FS:Ansariel> Show per-item complexity in COF
//textures, cost, hud_complexity_list);

View File

@ -11630,7 +11630,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
if (LLViewerObject* attached_object = (*attachment_iter))
if (LLViewerObject* attached_object = attachment_iter->get())
{
markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera);
}

View File

@ -162,7 +162,6 @@ with the same filename but different name
<!-- FS:Beq FIRE-20977 -->
<texture name="Command_RFO_Icon" file_name="toolbar_icons/RFO_ON.png" preload="true" />
<!-- /RFO Changes -->
<texture name="Command_Twitter_Icon" file_name="toolbar_icons/twitter.png" preload="true" />
<texture name="Command_View_Icon" file_name="toolbar_icons/view.png" preload="true" />
<texture name="Command_Voice_Icon" file_name="toolbar_icons/nearbyvoice.png" preload="true" />
<texture name="Command_RegionTracker_Icon" file_name="toolbar_icons/regiontracker.png" preload="true" />

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<floater
positioning="cascading"
can_close="true"
can_resize="false"
help_topic="floater_twitter"
layout="topleft"
name="floater_twitter"
save_rect="true"
single_instance="true"
reuse_instance="true"
title="Twitter"
height="462"
width="272">
<tab_container
name="tabs"
tab_group="1"
tab_min_width="70"
tab_height="21"
tab_position="top"
top="7"
height="457"
halign="center">
<panel
filename="panel_twitter_photo.xml"
class="lltwitterphotopanel"
follows="all"
label="Compose"
name="panel_twitter_photo"/>
<panel
filename="panel_twitter_account.xml"
class="lltwitteraccountpanel"
follows="all"
label="Account"
name="panel_twitter_account"/>
</tab_container>
<text
name="connection_error_text"
type="string"
follows="left|bottom|right"
bottom="-5"
left="10"
width="252"
height="20"
wrap="true"
halign="left"
valign="center"
text_color="DrYellow"
font="SansSerif">
Error
</text>
<loading_indicator
follows="left|bottom|right"
height="24"
width="24"
name="connection_loading_indicator"
top_delta="-2"
left="10"
visible="true"/>
<text
name="connection_loading_text"
type="string"
follows="left|bottom|right"
top_delta="2"
left_pad="5"
width="223"
height="20"
wrap="true"
halign="left"
valign="center"
text_color="EmphasisColor"
font="SansSerif">
Loading...
</text>
</floater>

View File

@ -584,13 +584,6 @@
parameter="gestures" />
</menu_item_check>
<menu_item_separator/>
<menu_item_call
label="Twitter..."
name="Twitter">
<menu_item_call.on_click
function="Floater.Toggle"
parameter="twitter"/>
</menu_item_call>
<menu_item_call
label="Flickr..."
name="Flickr">

View File

@ -7313,14 +7313,7 @@ Please select at least one type of content to search (General, Moderate, or Adul
icon="notify.tga"
name="FlickrConnect"
type="notifytip">
[MESSAGE]
</notification>
<notification
icon="notify.tga"
name="TwitterConnect"
type="notifytip">
[MESSAGE]
[MESSAGE]
</notification>
<notification

View File

@ -87,30 +87,6 @@
function="Snapshot.SaveToProfile" />
</button>
</layout_panel>
<layout_panel
auto_resize="false"
user_resize="false"
top_pad="0"
height="22"
name="lp_twitter">
<button
follows="left|top"
font="SansSerif"
halign="left"
height="22"
image_overlay="Command_Twitter_Icon"
image_overlay_alignment="left"
image_top_pad="0"
imgoverlay_label_space="10"
label="Share to Twitter"
layout="topleft"
left="9"
name="send_to_twitter_btn"
top_pad="0">
<button.commit_callback
function="Snapshot.SendToTwitter"/>
</button>
</layout_panel>
<layout_panel
auto_resize="false"
user_resize="false"

View File

@ -1,81 +0,0 @@
<panel
height="400"
width="272"
layout="topleft"
name="panel_twitter_account">
<string
name="twitter_connected"
value="You are connected to Twitter as:" />
<string
name="twitter_disconnected"
value="Not connected to Twitter" />
<text
layout="topleft"
length="1"
follows="top|left"
font="SansSerif"
height="16"
left="10"
name="account_caption_label"
top="5"
type="string">
Not connected to Twitter.
</text>
<text
layout="topleft"
top_pad="2"
length="1"
follows="top|left"
font="SansSerif"
height="16"
left="10"
name="account_name_label"
parse_urls="true"
type="string"/>
<panel
layout="topleft"
follows="top|left"
name="panel_buttons"
height="345"
top_pad="3"
left="0">
<button
layout="topleft"
follows="left|top|right"
top_pad="9"
left="10"
right="-10"
visible="true"
height="23"
label="Connect..."
name="connect_btn"
width="210">
<commit_callback function="SocialSharing.Connect"/>
</button>
<button
layout="topleft"
follows="left|top|right"
top_delta="0"
left="10"
right="-10"
height="23"
label="Disconnect"
name="disconnect_btn"
width="210"
visible="false">
<commit_callback function="SocialSharing.Disconnect"/>
</button>
<text
layout="topleft"
length="1"
follows="top|left"
height="16"
left="10"
name="account_learn_more_label"
top_pad="5"
type="string">
[http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Share-Twitter/ta-p/2435453 Learn about posting to Twitter]
</text>
</panel>
</panel>

View File

@ -1,261 +0,0 @@
<panel
height="420"
width="304"
layout="topleft"
name="panel_twitter_photo">
<text
length="1"
layout="topleft"
follows="top|left|right"
font="SansSerif"
height="16"
left="10"
name="status_label"
top="3"
type="string">
What's happening?
</text>
<text
length="1"
follows="top|left"
layout="topleft"
font="SansSerif"
text_color="EmphasisColor"
halign="right"
height="16"
width="30"
left="227"
name="status_counter_label"
top="5"
type="string">
280
</text>
<text_editor
follows="left|top"
layout="topleft"
height="75"
width="250"
left="10"
length="1"
max_length="280"
name="photo_status"
spellcheck="true"
top_pad="0"
type="string"
word_wrap="true">
</text_editor>
<check_box
follows="left|top"
layout="topleft"
initial_value="true"
label="Include SL location"
name="add_location_cb"
left="10"
height="16"
top_pad="5"/>
<check_box
follows="left|top"
layout="topleft"
initial_value="true"
label="Include a photo"
name="add_photo_cb"
left="10"
height="16"
top_pad="1"/>
<combo_box
control_name="TwitterPhotoResolution"
follows="left|top"
layout="topleft"
top_pad="3"
left="10"
name="resolution_combobox"
tool_tip="Image resolution"
height="21"
width="124">
<combo_box.item
label="Current Window"
name="CurrentWindow"
value="[i0,i0]" />
<combo_box.item
label="320x240"
name="320x240"
value="[i320,i240]" />
<combo_box.item
label="640x480"
name="640x480"
value="[i640,i480]" />
<combo_box.item
label="800x600"
name="800x600"
value="[i800,i600]" />
<combo_box.item
label="1024x768"
name="1024x768"
value="[i1024,i768]" />
<combo_box.item
label="1280x1024"
name="1280x1024"
value="[i1280,i1024]" />
<combo_box.item
label="1600x1200"
name="1600x1200"
value="[i1600,i1200]" />
<combo_box.item
label="Custom"
name="Custom"
value="[i-1,i-1]" />
</combo_box>
<combo_box
control_name="TwitterPhotoFilters"
follows="right|top"
layout="topleft"
name="filters_combobox"
tool_tip="Image filters"
top_delta="0"
right="-10"
height="21"
width="124">
<combo_box.item
label="No Filter"
name="NoFilter"
value="NoFilter" />
</combo_box>
<spinner
allow_text_entry="false"
decimal_digits="0"
follows="left|top"
height="20"
increment="32"
layout="topleft"
left="10"
max_val="6016"
min_val="32"
name="custom_snapshot_width"
top_pad="7"
width="54" />
<text
length="1"
follows="top|left|right"
layout="topleft"
height="16"
left_pad="3"
name="spinner_x_lbl"
top_delta="3"
width="8"
type="string">
x
</text>
<spinner
allow_text_entry="false"
decimal_digits="0"
follows="left|top"
height="20"
increment="32"
label=""
label_width="0"
layout="topleft"
left_pad="0"
max_val="6016"
min_val="32"
name="custom_snapshot_height"
top_delta="-3"
width="54" />
<check_box
follows="left|top"
layout="topleft"
initial_value="true"
label="Keep Aspect ratio"
name="keep_aspect_ratio"
left_pad="4"
height="16"
top_delta="4"/>
<panel
layout="topleft"
height="150"
width="250"
visible="true"
name="thumbnail_placeholder"
top_pad="3"
right="-10"
follows="left|top|right"
left="10">
</panel>
<text
follows="left|top"
layout="topleft"
font="SansSerif"
text_color="EmphasisColor"
height="14"
top_pad="2"
left="10"
length="1"
halign="center"
name="working_lbl"
type="string"
visible="true"
width="251">
Refreshing...
</text>
<view_border
bevel_style="in"
follows="left|top"
layout="topleft"
height="1"
left="10"
name="refresh_border"
width="250"
top_pad="0"/>
<button
follows="left|top"
layout="topleft"
height="23"
label="Refresh"
left="10"
top_pad="5"
name="new_snapshot_btn"
tool_tip="Click to refresh"
visible="true"
width="100" >
<button.commit_callback
function="SocialSharing.RefreshPhoto" />
</button>
<button
follows="right|top"
layout="topleft"
height="23"
label="Preview"
right="-10"
top_delta="0"
name="big_preview_btn"
tool_tip="Click to toggle preview"
is_toggle="true"
visible="true"
width="100" >
<button.commit_callback
function="SocialSharing.BigPreview" />
</button>
<button
follows="left|top"
layout="topleft"
top_pad="3"
left="10"
height="23"
label="Tweet"
name="post_photo_btn"
width="100">
<button.commit_callback
function="SocialSharing.SendPhoto" />
</button>
<button
follows="right|top"
layout="topleft"
height="23"
label="Cancel"
name="cancel_photo_btn"
right="-10"
top_delta="0"
width="100">
<button.commit_callback
function="SocialSharing.Cancel" />
</button>
</panel>

View File

@ -218,20 +218,13 @@ Please try logging in again in a minute.</string>
<string name="SentToInvalidRegion">You were sent to an invalid region.</string>
<string name="TestingDisconnect">Testing viewer disconnect</string>
<!-- SLShare: Flickr and Twitter -->
<string name="SocialFlickrConnecting">Connecting to Flickr...</string>
<string name="SocialFlickrPosting">Posting...</string>
<string name="SocialFlickrDisconnecting">Disconnecting from Flickr...</string>
<string name="SocialFlickrErrorConnecting">Problem connecting to Flickr</string>
<string name="SocialFlickrErrorPosting">Problem posting to Flickr</string>
<string name="SocialFlickrErrorDisconnecting">Problem disconnecting from Flickr</string>
<string name="SocialTwitterConnecting">Connecting to Twitter...</string>
<string name="SocialTwitterPosting">Posting...</string>
<string name="SocialTwitterDisconnecting">Disconnecting from Twitter...</string>
<string name="SocialTwitterErrorConnecting">Problem connecting to Twitter</string>
<string name="SocialTwitterErrorPosting">Problem posting to Twitter</string>
<string name="SocialTwitterErrorDisconnecting">Problem disconnecting from Twitter</string>
<!-- SLShare: User Friendly Filter Names Translation -->
<string name="BlackAndWhite">Black &amp; White</string>
<string name="Colors1970">1970&apos;s Colors</string>
@ -2144,14 +2137,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
<string name="share_alert">
Drag items from inventory here
</string>
<string name="flickr_post_success">
You posted to Flickr.
</string>
<string name="twitter_post_success">
You posted to Twitter.
</string>
<string name="no_session_message">
(IM Session Doesn't Exist)
</string>
@ -2601,7 +2589,6 @@ Try enclosing path to the editor with double quotes.
<string name="Command_Search_Label">Search</string>
<string name="Command_Snapshot_Label">Snapshot</string>
<string name="Command_Speak_Label">Speak</string>
<string name="Command_Twitter_Label">Twitter</string>
<string name="Command_View_Label">Camera controls</string>
<!-- Ansariel: Renamed for FS (FIRE-5019)
<string name="Command_Voice_Label">Voice settings</string>-->
@ -2666,7 +2653,6 @@ Try enclosing path to the editor with double quotes.
<string name="Command_Search_Tooltip">Find places, events, people (CTRL+F)</string>
<string name="Command_Snapshot_Tooltip">Take a picture (CTRL+SHIFT+S)</string>
<string name="Command_Speak_Tooltip">Speak with people nearby using your microphone</string>
<string name="Command_Twitter_Tooltip">Twitter</string>
<string name="Command_View_Tooltip">Changing camera angle</string>
<string name="Command_Voice_Tooltip">Volume controls for calls and people near you in world</string>
<!-- Firestorm commands -->