summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-02-25 21:54:09 -0800
committerMerov Linden <merov@lindenlab.com>2014-02-25 21:54:09 -0800
commitd220657d8525ccfa246e0f49904e18cc36458b28 (patch)
tree2405915c3d04247d3a66f52d071d43684ad9d7e9
parent3fbaff17bf65a826dd8b9bd50dc460aacaa3cb00 (diff)
ACME-1327 : WIP : Added big preview to the Flickr photo panel, uses the thumbnail for the moment
-rwxr-xr-xindra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llfloaterbigpreview.cpp109
-rw-r--r--indra/newview/llfloaterbigpreview.h56
-rw-r--r--indra/newview/llfloaterflickr.cpp36
-rw-r--r--indra/newview/llfloaterflickr.h2
-rw-r--r--indra/newview/llsnapshotlivepreview.h2
-rwxr-xr-xindra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_big_preview.xml25
-rw-r--r--indra/newview/skins/default/xui/en/panel_flickr_photo.xml17
9 files changed, 247 insertions, 4 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 793d972e1c..6d8d6b75a2 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -208,6 +208,7 @@ set(viewer_SOURCE_FILES
llfloateravatarpicker.cpp
llfloateravatartextures.cpp
llfloaterbeacons.cpp
+ llfloaterbigpreview.cpp
llfloaterbuildoptions.cpp
llfloaterbulkpermission.cpp
llfloaterbump.cpp
@@ -802,6 +803,7 @@ set(viewer_HEADER_FILES
llfloateravatarpicker.h
llfloateravatartextures.h
llfloaterbeacons.h
+ llfloaterbigpreview.h
llfloaterbuildoptions.h
llfloaterbulkpermission.h
llfloaterbump.h
diff --git a/indra/newview/llfloaterbigpreview.cpp b/indra/newview/llfloaterbigpreview.cpp
new file mode 100644
index 0000000000..84a1523e7c
--- /dev/null
+++ b/indra/newview/llfloaterbigpreview.cpp
@@ -0,0 +1,109 @@
+/**
+* @file llfloaterbigpreview.cpp
+* @brief Display of extended (big) preview for snapshots and SL Share
+* @author merov@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 "llfloaterbigpreview.h"
+
+#include "llfloaterreg.h"
+#include "llsnapshotlivepreview.h"
+
+///////////////////////
+//LLFloaterBigPreview//
+///////////////////////
+
+LLFloaterBigPreview::LLFloaterBigPreview(const LLSD& key) : LLFloater(key),
+ mPreviewPlaceholder(NULL),
+ mFloaterOwner(NULL)
+{
+}
+
+LLFloaterBigPreview::~LLFloaterBigPreview()
+{
+ if (mPreviewHandle.get())
+ {
+ mPreviewHandle.get()->die();
+ }
+}
+
+void LLFloaterBigPreview::onCancel()
+{
+ closeFloater();
+}
+
+void LLFloaterBigPreview::closeOnFloaterOwnerClosing(LLFloater* floaterp)
+{
+ if (floaterp == mFloaterOwner)
+ {
+ closeFloater();
+ }
+}
+
+BOOL LLFloaterBigPreview::postBuild()
+{
+ mPreviewPlaceholder = getChild<LLUICtrl>("big_preview_placeholder");
+ return LLFloater::postBuild();
+}
+
+void LLFloaterBigPreview::draw()
+{
+ LLFloater::draw();
+
+ LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());
+
+ // Display the preview if one is available
+ // HACK!!! We use the puny thumbnail image for the moment
+ // *TODO : Use the real large preview
+ if (previewp && previewp->getThumbnailImage())
+ {
+ const LLRect& preview_rect = mPreviewPlaceholder->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 = (preview_rect.getWidth() - thumbnail_w) / 2 ;
+// const S32 local_offset_y = (preview_rect.getHeight() - thumbnail_h) / 2 ;
+ const S32 local_offset_x = 0 ;
+ const S32 local_offset_y = 0 ;
+
+ // calc preview offset within the floater rect
+ S32 offset_x = preview_rect.mLeft + local_offset_x;
+ S32 offset_y = preview_rect.mBottom + local_offset_y;
+
+ //llinfos << "Merov : draw, offset x = " << offset_x << ", y = " << offset_y << ", thumbnail w = " << thumbnail_w << ", h = " << thumbnail_h << ", rect w = " << preview_rect.getWidth() << ", h = " << preview_rect.getHeight() << llendl;
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // Apply floater transparency to the texture unless the floater is focused.
+ F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ LLColor4 color = LLColor4::white;
+ gl_draw_scaled_image(offset_x, offset_y,
+ //thumbnail_w, thumbnail_h,
+ preview_rect.getWidth(), preview_rect.getHeight(),
+ previewp->getThumbnailImage(), color % alpha);
+ }
+}
+
diff --git a/indra/newview/llfloaterbigpreview.h b/indra/newview/llfloaterbigpreview.h
new file mode 100644
index 0000000000..91b0968e88
--- /dev/null
+++ b/indra/newview/llfloaterbigpreview.h
@@ -0,0 +1,56 @@
+/**
+* @file llfloaterbigpreview.h
+* @brief Display of extended (big) preview for snapshots and SL Share
+* @author merov@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_LLFLOATERBIGPREVIEW_H
+#define LL_LLFLOATERBIGPREVIEW_H
+
+#include "llfloater.h"
+#include "llviewertexture.h"
+
+//class LLSnapshotLivePreview;
+
+class LLFloaterBigPreview : public LLFloater
+{
+public:
+ LLFloaterBigPreview(const LLSD& key);
+ ~LLFloaterBigPreview();
+
+ BOOL postBuild();
+ void draw();
+ void onCancel();
+
+ void setPreview(LLView* previewp) { mPreviewHandle = previewp->getHandle(); }
+ void setFloaterOwner(LLFloater* floaterp) { mFloaterOwner = floaterp; }
+ void closeOnFloaterOwnerClosing(LLFloater* floaterp);
+
+private:
+ LLHandle<LLView> mPreviewHandle;
+ LLUICtrl* mPreviewPlaceholder;
+ LLFloater* mFloaterOwner;
+};
+
+#endif // LL_LLFLOATERBIGPREVIEW_H
+
diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp
index 61f1487d4b..21c619730c 100644
--- a/indra/newview/llfloaterflickr.cpp
+++ b/indra/newview/llfloaterflickr.cpp
@@ -44,6 +44,7 @@
#include "llslurl.h"
#include "lltrans.h"
#include "llsnapshotlivepreview.h"
+#include "llfloaterbigpreview.h"
#include "llviewerregion.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
@@ -76,6 +77,7 @@ mPostButton(NULL)
{
mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFlickrPhotoPanel::onSend, this));
mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLFlickrPhotoPanel::onClickNewSnapshot, this));
+ mCommitCallbackRegistrar.add("SocialSharing.BigPreview", boost::bind(&LLFlickrPhotoPanel::onClickBigPreview, this));
}
LLFlickrPhotoPanel::~LLFlickrPhotoPanel()
@@ -227,7 +229,7 @@ void LLFlickrPhotoPanel::onVisibilityChange(const LLSD& new_visibility)
LLSnapshotLivePreview::Params p;
p.rect(full_screen_rect);
LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
- mPreviewHandle = previewp->getHandle();
+ mPreviewHandle = previewp->getHandle();
previewp->setContainer(this);
previewp->setSnapshotType(previewp->SNAPSHOT_WEB);
@@ -251,6 +253,18 @@ void LLFlickrPhotoPanel::onClickNewSnapshot()
}
}
+void LLFlickrPhotoPanel::onClickBigPreview()
+{
+ LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
+ if (big_preview_floater)
+ {
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ big_preview_floater->setPreview(previewp);
+ big_preview_floater->setFloaterOwner(getParentByType<LLFloater>());
+ }
+ LLFloaterReg::showInstance("big_preview");
+}
+
void LLFlickrPhotoPanel::onSend()
{
LLEventPumps::instance().obtain("FlickrConnectState").stopListening("LLFlickrPhotoPanel"); // just in case it is already listening
@@ -340,6 +354,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)
+ {
+ big_preview_floater->closeOnFloaterOwnerClosing(floater);
+ }
floater->closeFloater();
}
}
@@ -615,8 +634,23 @@ LLFloaterFlickr::LLFloaterFlickr(const LLSD& key) : LLFloater(key),
mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterFlickr::onCancel, this));
}
+void LLFloaterFlickr::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 LLFloaterFlickr::onCancel()
{
+ LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
+ if (big_preview_floater)
+ {
+ big_preview_floater->closeOnFloaterOwnerClosing(this);
+ }
closeFloater();
}
diff --git a/indra/newview/llfloaterflickr.h b/indra/newview/llfloaterflickr.h
index 319ab1278f..9fa4a258e2 100644
--- a/indra/newview/llfloaterflickr.h
+++ b/indra/newview/llfloaterflickr.h
@@ -48,6 +48,7 @@ public:
LLSnapshotLivePreview* getPreviewView();
void onVisibilityChange(const LLSD& new_visibility);
void onClickNewSnapshot();
+ void onClickBigPreview();
void onSend();
bool onFlickrConnectStateChange(const LLSD& data);
@@ -111,6 +112,7 @@ public:
LLFloaterFlickr(const LLSD& key);
BOOL postBuild();
void draw();
+ void onClose(bool app_quitting);
void onCancel();
void showPhotoPanel();
diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h
index 7f3e7a080b..1b7b5290f8 100644
--- a/indra/newview/llsnapshotlivepreview.h
+++ b/indra/newview/llsnapshotlivepreview.h
@@ -113,7 +113,7 @@ public:
LLPointer<LLImageFormatted> getFormattedImage();
LLPointer<LLImageRaw> getEncodedImage();
- /// Sets size of preview thumbnail image and thhe surrounding rect.
+ /// Sets size of preview thumbnail image and the surrounding rect.
void setThumbnailPlaceholderRect(const LLRect& rect) {mThumbnailPlaceholderRect = rect; }
BOOL setThumbnailImageSize() ;
void generateThumbnailImage(BOOL force_update = FALSE) ;
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 1f25110aa3..982522955c 100755
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -38,6 +38,7 @@
#include "llfloateravatar.h"
#include "llfloateravatarpicker.h"
#include "llfloateravatartextures.h"
+#include "llfloaterbigpreview.h"
#include "llfloaterbeacons.h"
#include "llfloaterbuildoptions.h"
#include "llfloaterbuy.h"
@@ -324,6 +325,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("facebook", "floater_facebook.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFacebook>);
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();
LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBvhPreview>, "upload");
diff --git a/indra/newview/skins/default/xui/en/floater_big_preview.xml b/indra/newview/skins/default/xui/en/floater_big_preview.xml
new file mode 100644
index 0000000000..23698ccc40
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_big_preview.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<floater
+ positioning="cascading"
+ can_close="true"
+ can_resize="false"
+ can_minimize="false"
+ help_topic="floater_big_preview"
+ layout="topleft"
+ name="floater_big_preview"
+ save_rect="true"
+ single_instance="true"
+ reuse_instance="true"
+ title="PREVIEW"
+ height="465"
+ width="770">
+ <panel
+ height="450"
+ width="750"
+ visible="true"
+ name="big_preview_placeholder"
+ top="5"
+ follows="all"
+ left="10">
+ </panel>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml
index 4516c01670..350c385cc3 100644
--- a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml
+++ b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml
@@ -82,7 +82,7 @@
text_color="EmphasisColor"
height="14"
top_pad="-19"
- left_pad="-20"
+ left_pad="-30"
length="1"
halign="center"
name="working_lbl"
@@ -92,6 +92,19 @@
width="150">
Refreshing...
</text>
+ <button
+ follows="right|top"
+ height="23"
+ label="Big Preview"
+ left="200"
+ top_pad="-19"
+ name="big_preview_btn"
+ tool_tip="Click to open big preview"
+ visible="true"
+ width="100" >
+ <button.commit_callback
+ function="SocialSharing.BigPreview" />
+ </button>
<text
length="1"
follows="top|left|right"
@@ -99,7 +112,7 @@
height="16"
left="9"
name="title_label"
- top_pad="20"
+ top_pad="15"
type="string">
Title:
</text>