summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterflickr.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-02-27 13:04:23 -0800
committerMerov Linden <merov@lindenlab.com>2014-02-27 13:04:23 -0800
commit279e9b0743dfd86f9b40f693349aae9fc1268d35 (patch)
tree5bade6c6d943d07ffbf785d7ddd300e597c47a0e /indra/newview/llfloaterflickr.cpp
parented38a0aede09f42c4fe7eb4dd53ecd6490d12ca0 (diff)
ACME-1327 : Implemented preview in all SL Share panels, switch ownership of preview to focused SL Share photo panel
Diffstat (limited to 'indra/newview/llfloaterflickr.cpp')
-rw-r--r--indra/newview/llfloaterflickr.cpp44
1 files changed, 29 insertions, 15 deletions
diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp
index e93adf1570..16aab09396 100644
--- a/indra/newview/llfloaterflickr.cpp
+++ b/indra/newview/llfloaterflickr.cpp
@@ -74,6 +74,7 @@ mDescriptionTextBox(NULL),
mLocationCheckbox(NULL),
mTagsTextBox(NULL),
mRatingComboBox(NULL),
+mBigPreviewFloater(NULL),
mPostButton(NULL)
{
mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFlickrPhotoPanel::onSend, this));
@@ -110,6 +111,7 @@ BOOL LLFlickrPhotoPanel::postBuild()
mRatingComboBox = getChild<LLUICtrl>("rating_combobox");
mPostButton = getChild<LLUICtrl>("post_photo_btn");
mCancelButton = getChild<LLUICtrl>("cancel_photo_btn");
+ mBigPreviewFloater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
// Update filter list
std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
@@ -167,9 +169,14 @@ void LLFlickrPhotoPanel::draw()
mBtnPreview->setEnabled(no_ongoing_connection);
mLocationCheckbox->setEnabled(no_ongoing_connection);
+ // Reassign the preview floater if we have the focus and the preview exists
+ if (hasFocus() && isPreviewVisible())
+ {
+ attachPreview();
+ }
+
// Toggle the button state as appropriate
- LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
- bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType<LLFloater>()));
+ bool preview_active = (isPreviewVisible() && mBigPreviewFloater->isFloaterOwner(getParentByType<LLFloater>()));
mBtnPreview->setToggleState(preview_active);
// Display the preview if one is available
@@ -263,25 +270,33 @@ void LLFlickrPhotoPanel::onClickNewSnapshot()
void LLFlickrPhotoPanel::onClickBigPreview()
{
- LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
- bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType<LLFloater>()));
// Toggle the preview
- if (preview_active)
+ if (isPreviewVisible())
{
LLFloaterReg::hideInstance("big_preview");
}
else
{
- if (big_preview_floater)
- {
- LLSnapshotLivePreview* previewp = getPreviewView();
- big_preview_floater->setPreview(previewp);
- big_preview_floater->setFloaterOwner(getParentByType<LLFloater>());
- }
+ attachPreview();
LLFloaterReg::showInstance("big_preview");
}
}
+bool LLFlickrPhotoPanel::isPreviewVisible()
+{
+ return (mBigPreviewFloater && mBigPreviewFloater->getVisible());
+}
+
+void LLFlickrPhotoPanel::attachPreview()
+{
+ if (mBigPreviewFloater)
+ {
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ mBigPreviewFloater->setPreview(previewp);
+ mBigPreviewFloater->setFloaterOwner(getParentByType<LLFloater>());
+ }
+}
+
void LLFlickrPhotoPanel::onSend()
{
LLEventPumps::instance().obtain("FlickrConnectState").stopListening("LLFlickrPhotoPanel"); // just in case it is already listening
@@ -371,12 +386,11 @@ void LLFlickrPhotoPanel::clearAndClose()
LLFloater* floater = getParentByType<LLFloater>();
if (floater)
{
- LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
- if (big_preview_floater)
+ floater->closeFloater();
+ if (mBigPreviewFloater)
{
- big_preview_floater->closeOnFloaterOwnerClosing(floater);
+ mBigPreviewFloater->closeOnFloaterOwnerClosing(floater);
}
- floater->closeFloater();
}
}