summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersnapshot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersnapshot.cpp')
-rwxr-xr-xindra/newview/llfloatersnapshot.cpp129
1 files changed, 81 insertions, 48 deletions
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 3d5b297fbe..960d3f35dd 100755
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -31,7 +31,10 @@
#include "llagent.h"
#include "llfacebookconnect.h"
#include "llfloaterreg.h"
-#include "llfloatersocial.h"
+#include "llfloaterfacebook.h"
+#include "llfloaterflickr.h"
+#include "llfloatertwitter.h"
+#include "llimagefiltersmanager.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "llpostcard.h"
@@ -91,6 +94,7 @@ public:
}
static void onClickNewSnapshot(void* data);
static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
+ static void onClickFilter(LLUICtrl *ctrl, void* data);
//static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data);
static void onClickMore(void* data) ;
static void onClickUICheck(LLUICtrl *ctrl, void* data);
@@ -429,9 +433,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
image_res_tb->setVisible(got_snap);
if (got_snap)
{
- LLPointer<LLImageRaw> img = previewp->getEncodedImage();
- image_res_tb->setTextArg("[WIDTH]", llformat("%d", img->getWidth()));
- image_res_tb->setTextArg("[HEIGHT]", llformat("%d", img->getHeight()));
+ image_res_tb->setTextArg("[WIDTH]", llformat("%d", previewp->getEncodedImageWidth()));
+ image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight()));
}
floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
@@ -464,8 +467,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
default:
break;
}
-
- if (previewp)
+
+ if (previewp)
{
previewp->setSnapshotType(shot_type);
previewp->setSnapshotFormat(shot_format);
@@ -558,6 +561,26 @@ void LLFloaterSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data)
}
}
+// static
+void LLFloaterSnapshot::Impl::onClickFilter(LLUICtrl *ctrl, void* data)
+{
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+ if (view)
+ {
+ updateControls(view);
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if (previewp)
+ {
+ checkAutoSnapshot(previewp);
+ // Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale
+ LLComboBox* filterbox = static_cast<LLComboBox *>(view->getChild<LLComboBox>("filters_combobox"));
+ std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : "");
+ previewp->setFilter(filter_name);
+ previewp->updateSnapshot(FALSE, TRUE);
+ }
+ }
+}
+
void LLFloaterSnapshot::Impl::onClickMore(void* data)
{
BOOL visible = gSavedSettings.getBOOL("AdvanceSnapshot");
@@ -618,7 +641,7 @@ void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL
LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
previewp->setSize(w, h) ;
- previewp->updateSnapshot(FALSE, TRUE);
+ previewp->updateSnapshot(TRUE);
checkAutoSnapshot(previewp, TRUE);
}
}
@@ -853,7 +876,6 @@ void LLFloaterSnapshot::Impl::onImageQualityChange(LLFloaterSnapshot* view, S32
{
previewp->setSnapshotQuality(quality_val);
}
- checkAutoSnapshot(previewp, TRUE);
}
// static
@@ -1052,7 +1074,26 @@ BOOL LLFloaterSnapshot::postBuild()
getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this);
-
+
+ // Filters
+ LLComboBox* filterbox = getChild<LLComboBox>("filters_combobox");
+ if (gSavedSettings.getBOOL("SnapshotFiltersEnabled"))
+ {
+ // Update filter list if setting is on (experimental)
+ std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
+ for (U32 i = 0; i < filter_list.size(); i++)
+ {
+ filterbox->add(filter_list[i]);
+ }
+ childSetCommitCallback("filters_combobox", Impl::onClickFilter, this);
+ }
+ else
+ {
+ // Hide Filter UI if setting is off (default)
+ getChild<LLUICtrl>("filter_list_label")->setVisible(FALSE);
+ filterbox->setVisible(FALSE);
+ }
+
LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSnapshotUploadFinished, _1));
LLPostCard::setPostResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSendingPostcardFinished, _1));
@@ -1082,6 +1123,7 @@ BOOL LLFloaterSnapshot::postBuild()
getChild<LLComboBox>("local_format_combo")->selectNthItem(0);
impl.mPreviewHandle = previewp->getHandle();
+ previewp->setContainer(this);
impl.updateControls(this);
impl.updateLayout(this);
@@ -1246,6 +1288,32 @@ S32 LLFloaterSnapshot::notify(const LLSD& info)
impl.setStatus(Impl::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString());
return 1;
}
+
+ if (info.has("snapshot-updating"))
+ {
+ // Disable the send/post/save buttons until snapshot is ready.
+ impl.updateControls(this);
+ // Force hiding the "Refresh to save" hint because we know we've just started refresh.
+ impl.setNeedRefresh(this, false);
+ return 1;
+ }
+
+ if (info.has("snapshot-updated"))
+ {
+ // Enable the send/post/save buttons.
+ impl.updateControls(this);
+ // We've just done refresh.
+ impl.setNeedRefresh(this, false);
+
+ // The refresh button is initially hidden. We show it after the first update,
+ // i.e. when preview appears.
+ if (!mRefreshBtn->getVisible())
+ {
+ mRefreshBtn->setVisible(true);
+ }
+ return 1;
+ }
+
return 0;
}
@@ -1253,9 +1321,11 @@ S32 LLFloaterSnapshot::notify(const LLSD& info)
void LLFloaterSnapshot::update()
{
LLFloaterSnapshot* inst = findInstance();
- LLFloaterSocial* floater_social = LLFloaterReg::findTypedInstance<LLFloaterSocial>("social");
+ LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance<LLFloaterFacebook>("facebook");
+ LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance<LLFloaterFlickr>("flickr");
+ LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance<LLFloaterTwitter>("twitter");
- if (!inst && !floater_social)
+ if (!inst && !floater_facebook && !floater_flickr && !floater_twitter)
return;
BOOL changed = FALSE;
@@ -1329,43 +1399,6 @@ BOOL LLFloaterSnapshot::saveLocal()
}
// static
-void LLFloaterSnapshot::preUpdate()
-{
- // FIXME: duplicated code
- LLFloaterSnapshot* instance = findInstance();
- if (instance)
- {
- // Disable the send/post/save buttons until snapshot is ready.
- Impl::updateControls(instance);
-
- // Force hiding the "Refresh to save" hint because we know we've just started refresh.
- Impl::setNeedRefresh(instance, false);
- }
-}
-
-// static
-void LLFloaterSnapshot::postUpdate()
-{
- // FIXME: duplicated code
- LLFloaterSnapshot* instance = findInstance();
- if (instance)
- {
- // Enable the send/post/save buttons.
- Impl::updateControls(instance);
-
- // We've just done refresh.
- Impl::setNeedRefresh(instance, false);
-
- // The refresh button is initially hidden. We show it after the first update,
- // i.e. when preview appears.
- if (!instance->mRefreshBtn->getVisible())
- {
- instance->mRefreshBtn->setVisible(true);
- }
- }
-}
-
-// static
void LLFloaterSnapshot::postSave()
{
LLFloaterSnapshot* instance = findInstance();