summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpostcard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterpostcard.cpp')
-rw-r--r--indra/newview/llfloaterpostcard.cpp85
1 files changed, 29 insertions, 56 deletions
diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp
index b0ab0f9625..a27070de39 100644
--- a/indra/newview/llfloaterpostcard.cpp
+++ b/indra/newview/llfloaterpostcard.cpp
@@ -43,8 +43,9 @@
#include "llagent.h"
#include "llui.h"
#include "lllineeditor.h"
-#include "llviewertexteditor.h"
#include "llbutton.h"
+#include "lltexteditor.h"
+#include "llfloaterreg.h"
#include "llviewercontrol.h"
#include "llviewernetwork.h"
#include "lluictrlfactory.h"
@@ -61,8 +62,9 @@
#include "llimagej2c.h"
#include "llvfile.h"
#include "llvfs.h"
-
+#include "llviewertexture.h"
#include "llassetuploadresponders.h"
+#include "llagentui.h"
#include <boost/regex.hpp> //boost.regex lib
@@ -70,89 +72,59 @@
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
-//static
-LLFloaterPostcard::instance_list_t LLFloaterPostcard::sInstances;
-
///----------------------------------------------------------------------------
/// Class LLFloaterPostcard
///----------------------------------------------------------------------------
-LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global)
-: LLFloater(std::string("Postcard Floater")),
- mJPEGImage(jpeg),
- mViewerImage(img),
- mImageScale(img_scale),
- mPosTakenGlobal(pos_taken_global),
+LLFloaterPostcard::LLFloaterPostcard(const LLSD& key)
+: LLFloater(key),
+ mJPEGImage(NULL),
+ mViewerImage(NULL),
mHasFirstMsgFocus(false)
{
- init();
-}
-
-void LLFloaterPostcard::init()
-{
- // pick up the user's up-to-date email address
- if(!gAgent.getID().isNull())
- {
- // we're logged in, so we can get this info.
- gMessageSystem->newMessageFast(_PREHASH_UserInfoRequest);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gAgent.sendReliableMessage();
- }
-
- sInstances.insert(this);
+ //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_postcard.xml");
}
// Destroys the object
LLFloaterPostcard::~LLFloaterPostcard()
{
- sInstances.erase(this);
mJPEGImage = NULL; // deletes image
}
BOOL LLFloaterPostcard::postBuild()
{
+ // pick up the user's up-to-date email address
+ gAgent.sendAgentUserInfoRequest();
+
childSetAction("cancel_btn", onClickCancel, this);
childSetAction("send_btn", onClickSend, this);
childDisable("from_form");
std::string name_string;
- gAgent.buildFullname(name_string);
+ LLAgentUI::buildFullname(name_string);
childSetValue("name_form", LLSD(name_string));
- LLTextEditor* MsgField = getChild<LLTextEditor>("msg_form");
- if (MsgField)
- {
- MsgField->setWordWrap(TRUE);
-
- // For the first time a user focusess to .the msg box, all text will be selected.
- MsgField->setFocusChangedCallback(onMsgFormFocusRecieved, this);
- }
+ // For the first time a user focusess to .the msg box, all text will be selected.
+ getChild<LLUICtrl>("msg_form")->setFocusChangedCallback(onMsgFormFocusRecieved, this);
childSetFocus("to_form", TRUE);
return TRUE;
}
-
-
// static
-LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLImageGL *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global)
+LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global)
{
// Take the images from the caller
// It's now our job to clean them up
- LLFloaterPostcard *instance = new LLFloaterPostcard(jpeg, img, image_scale, pos_taken_global);
-
- LLUICtrlFactory::getInstance()->buildFloater(instance, "floater_postcard.xml");
-
- S32 left, top;
- gFloaterView->getNewFloaterPosition(&left, &top);
- instance->setOrigin(left, top - instance->getRect().getHeight());
+ LLFloaterPostcard* instance = LLFloaterReg::showTypedInstance<LLFloaterPostcard>("postcard", LLSD(img->getID()));
+
+ instance->mJPEGImage = jpeg;
+ instance->mViewerImage = img;
+ instance->mImageScale = image_scale;
+ instance->mPosTakenGlobal = pos_taken_global;
- instance->open(); /*Flawfinder: ignore*/
-
return instance;
}
@@ -198,7 +170,7 @@ void LLFloaterPostcard::draw()
rect.mBottom,
rect.getWidth(),
rect.getHeight(),
- mViewerImage,
+ mViewerImage.get(),
LLColor4::white);
}
glMatrixMode(GL_TEXTURE);
@@ -215,7 +187,7 @@ void LLFloaterPostcard::onClickCancel(void* data)
{
LLFloaterPostcard *self = (LLFloaterPostcard *)data;
- self->close(false);
+ self->closeFloater(false);
}
}
@@ -313,16 +285,17 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data,
gAgent.sendReliableMessage();
}
- self->close();
+ self->closeFloater();
}
// static
void LLFloaterPostcard::updateUserInfo(const std::string& email)
{
- for (instance_list_t::iterator iter = sInstances.begin();
- iter != sInstances.end(); ++iter)
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
+ iter != inst_list.end(); ++iter)
{
- LLFloaterPostcard *instance = *iter;
+ LLFloater* instance = *iter;
const std::string& text = instance->childGetValue("from_form").asString();
if (text.empty())
{