summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersocial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersocial.cpp')
-rw-r--r--indra/newview/llfloatersocial.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index e305bfd10a..9198d9a07b 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -128,6 +128,8 @@ LLSocialPhotoPanel::~LLSocialPhotoPanel()
BOOL LLSocialPhotoPanel::postBuild()
{
+ setVisibleCallback(boost::bind(&LLSocialPhotoPanel::onVisibilityChange, this, _2));
+
mPostButton = getChild<LLUICtrl>("post_btn");
mResolutionComboBox = getChild<LLUICtrl>("resolution_combobox");
mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::onResolutionComboCommit, this));
@@ -138,17 +140,6 @@ BOOL LLSocialPhotoPanel::postBuild()
mFailureLblPanel = getChild<LLUICtrl>("failed_panel");
mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
- LLRect full_screen_rect = getRootView()->getRect();
- LLSnapshotLivePreview::Params p;
- p.rect(full_screen_rect);
- LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
- mPreviewHandle = previewp->getHandle();
-
- previewp->setSnapshotType(previewp->SNAPSHOT_WEB);
- previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG);
- //previewp->setSnapshotQuality(98);
- previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
-
return LLPanel::postBuild();
}
@@ -293,6 +284,26 @@ void LLSocialPhotoPanel::updateControls()
updateResolution(combo, instance, FALSE);
}
+void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility)
+{
+ bool visible = new_visibility.asBoolean();
+ if (visible && !mPreviewHandle.get())
+ {
+ LLRect full_screen_rect = getRootView()->getRect();
+ LLSnapshotLivePreview::Params p;
+ p.rect(full_screen_rect);
+ LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
+ mPreviewHandle = previewp->getHandle();
+
+ previewp->setSnapshotType(previewp->SNAPSHOT_WEB);
+ previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG);
+ //previewp->setSnapshotQuality(98);
+ previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
+
+ updateControls();
+ }
+}
+
void LLSocialPhotoPanel::draw()
{
LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());