Upload code cleansing

I found our upload classes were in need of a tune up while researching Issue 896: Animation upload setting causes viewer crash
So I started working to clean up llfloaterbvhpreview which lead me to llfloaternamedesc and the rest of our upload floaters
I ended up pulling the sound upload hack out of LLFloaterNameDesc and into LLFloaterSoundPreview and moving LLFloaterAnimPreview into llfloaternamedesc.*
Updated llviewermenufile.cpp a bit
Removed setUploadAmount from LLFloaterImagePreview and LLFloaterBvhPreview as its purpose is served by LLGlobalEconomy::getPriceUpload and the hippogridmanager too.
Fixed an issue with floater_animation_anim_preview.xml using [AMOUNT] instead of [UPLOADFEE] for its label.

I'd say this might fix Issue 896, I certainly can't reproduce the crash I was having when testing for it anymore.
This commit is contained in:
Lirusaito
2013-06-26 03:51:27 -04:00
parent 5aaea47a81
commit 5a9a0e0b1b
12 changed files with 421 additions and 671 deletions

View File

@@ -172,7 +172,6 @@ set(viewer_SOURCE_FILES
llflexibleobject.cpp llflexibleobject.cpp
llfloaterabout.cpp llfloaterabout.cpp
llfloateractivespeakers.cpp llfloateractivespeakers.cpp
llfloateranimpreview.cpp
llfloaterauction.cpp llfloaterauction.cpp
llfloateravatarinfo.cpp llfloateravatarinfo.cpp
llfloateravatarlist.cpp llfloateravatarlist.cpp
@@ -677,7 +676,6 @@ set(viewer_HEADER_FILES
llflexibleobject.h llflexibleobject.h
llfloaterabout.h llfloaterabout.h
llfloateractivespeakers.h llfloateractivespeakers.h
llfloateranimpreview.h
llfloaterauction.h llfloaterauction.h
llfloateravatarinfo.h llfloateravatarinfo.h
llfloateravatarlist.h llfloateravatarlist.h

View File

@@ -1,46 +0,0 @@
/**
* @file llfloateranimpreview.cpp
* @brief LLFloaterAnimPreview class implementation
*
* Copyright (c) 2012, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloateranimpreview.h"
LLFloaterAnimPreview::LLFloaterAnimPreview(LLSD const& filename) : LLFloaterNameDesc(filename)
{
}
BOOL LLFloaterAnimPreview::postBuild()
{
if (!LLFloaterNameDesc::postBuild())
{
return FALSE;
}
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
}

View File

@@ -1,42 +0,0 @@
/**
* @file llfloateranimpreview.h
* @brief LLFloaterAnimPreview class definition
*
* Copyright (c) 2012, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERANIMPREVIEW_H
#define LL_LLFLOATERANIMPREVIEW_H
#include "llfloaternamedesc.h"
class LLFloaterAnimPreview : public LLFloaterNameDesc {
public:
LLFloaterAnimPreview(LLSD const& filename);
virtual BOOL postBuild(void);
};
#endif // LL_LLFLOATERANIMPREVIEW_H

File diff suppressed because it is too large Load Diff

View File

@@ -3,10 +3,9 @@
* @brief LLFloaterBvhPreview class definition * @brief LLFloaterBvhPreview class definition
* *
* $LicenseInfo:firstyear=2004&license=viewergpl$ * $LicenseInfo:firstyear=2004&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2004-2009, Linden Research, Inc. * Copyright (c) 2004-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -92,22 +91,21 @@ public:
void onBtnPlay(); void onBtnPlay();
void onBtnStop(); void onBtnStop();
static void setUploadAmount(S32 amount) { sUploadAmount = amount; } void onSliderMove();
static void onSliderMove(LLUICtrl*, void*); void onCommitBaseAnim();
static void onCommitBaseAnim(LLUICtrl*, void*); void onCommitLoop();
static void onCommitLoop(LLUICtrl*, void*); void onCommitLoopIn();
static void onCommitLoopIn(LLUICtrl*, void*); void onCommitLoopOut();
static void onCommitLoopOut(LLUICtrl*, void*); bool validateLoopIn(const LLSD& data);
static BOOL validateLoopIn(LLUICtrl*, void*); bool validateLoopOut(const LLSD& data);
static BOOL validateLoopOut(LLUICtrl*, void*); void onCommitName();
static void onCommitName(LLUICtrl*, void*); void onCommitHandPose();
static void onCommitHandPose(LLUICtrl*, void*); void onCommitEmote();
static void onCommitEmote(LLUICtrl*, void*); void onCommitPriority();
static void onCommitPriority(LLUICtrl*, void*); void onCommitEaseIn();
static void onCommitEaseIn(LLUICtrl*, void*); void onCommitEaseOut();
static void onCommitEaseOut(LLUICtrl*, void*); bool validateEaseIn(const LLSD& data);
static BOOL validateEaseIn(LLUICtrl*, void*); bool validateEaseOut(const LLSD& data);
static BOOL validateEaseOut(LLUICtrl*, void*);
static void onBtnOK(void*); static void onBtnOK(void*);
static void onSaveComplete(const LLUUID& asset_uuid, static void onSaveComplete(const LLUUID& asset_uuid,
LLAssetType::EType type, LLAssetType::EType type,
@@ -129,14 +127,10 @@ protected:
LLRectf mPreviewImageRect; LLRectf mPreviewImageRect;
LLAssetID mMotionID; LLAssetID mMotionID;
LLTransactionID mTransactionID; LLTransactionID mTransactionID;
BOOL mEnabled;
BOOL mInWorld; BOOL mInWorld;
LLAnimPauseRequest mPauseRequest; LLAnimPauseRequest mPauseRequest;
std::map<std::string, LLUUID> mIDList; std::map<std::string, LLUUID> mIDList;
static S32 sUploadAmount;
//<edit> //<edit>
void* mItem; void* mItem;
//</edit> //</edit>

View File

@@ -3,10 +3,9 @@
* @brief LLFloaterImagePreview class implementation * @brief LLFloaterImagePreview class implementation
* *
* $LicenseInfo:firstyear=2004&license=viewergpl$ * $LicenseInfo:firstyear=2004&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2004-2009, Linden Research, Inc. * Copyright (c) 2004-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -60,15 +59,9 @@
#include "llviewershadermgr.h" #include "llviewershadermgr.h"
#include "llviewertexturelist.h" #include "llviewertexturelist.h"
#include "llstring.h" #include "llstring.h"
// <edit>
#include "llviewercontrol.h"
// </edit>
#include "hippogridmanager.h" #include "hippogridmanager.h"
//static
S32 LLFloaterImagePreview::sUploadAmount = 10;
const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_BORDER_WIDTH = 2;
const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
@@ -79,20 +72,11 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLFloaterImagePreview() // LLFloaterImagePreview()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
LLFloaterNameDesc(filename),
mAvatarPreview(NULL),
mSculptedPreview(NULL),
mLastMouseX(0),
mLastMouseY(0),
mImagep(NULL)
{
loadImage(mFilenameAndPath);
}
// <edit> // <edit>
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) : LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) :
LLFloaterNameDesc(filename, item), LLFloaterNameDesc(filename, item),
// </edit>
mAvatarPreview(NULL), mAvatarPreview(NULL),
mSculptedPreview(NULL), mSculptedPreview(NULL),
mLastMouseX(0), mLastMouseX(0),
@@ -101,7 +85,6 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void*
{ {
loadImage(mFilenameAndPath); loadImage(mFilenameAndPath);
} }
// </edit>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// postBuild() // postBuild()
@@ -114,7 +97,6 @@ BOOL LLFloaterImagePreview::postBuild()
} }
childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee());
childSetAction("ok_btn", onBtnOK, this);
LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
if (iface) if (iface)
@@ -129,7 +111,7 @@ BOOL LLFloaterImagePreview::postBuild()
PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
childHide("bad_image_text"); getChildView("bad_image_text")->setVisible(FALSE);
if (mRawImagep.notNull() && gAgent.getRegion() != NULL) if (mRawImagep.notNull() && gAgent.getRegion() != NULL)
{ {
@@ -140,7 +122,7 @@ BOOL LLFloaterImagePreview::postBuild()
mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f);
if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF)
childEnable("lossless_check"); getChildView("lossless_check")->setEnabled(TRUE);
// <edit> // <edit>
gSavedSettings.setBOOL("TemporaryUpload",FALSE); gSavedSettings.setBOOL("TemporaryUpload",FALSE);
@@ -151,11 +133,13 @@ BOOL LLFloaterImagePreview::postBuild()
{ {
mAvatarPreview = NULL; mAvatarPreview = NULL;
mSculptedPreview = NULL; mSculptedPreview = NULL;
childShow("bad_image_text"); getChildView("bad_image_text")->setVisible(TRUE);
childDisable("clothing_type_combo"); getChildView("clothing_type_combo")->setEnabled(FALSE);
childDisable("ok_btn"); getChildView("ok_btn")->setEnabled(FALSE);
} }
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE; return TRUE;
} }
@@ -169,7 +153,6 @@ LLFloaterImagePreview::~LLFloaterImagePreview()
mRawImagep = NULL; mRawImagep = NULL;
mAvatarPreview = NULL; mAvatarPreview = NULL;
mSculptedPreview = NULL; mSculptedPreview = NULL;
mImagep = NULL ; mImagep = NULL ;
} }
@@ -352,7 +335,6 @@ void LLFloaterImagePreview::draw()
bool LLFloaterImagePreview::loadImage(const std::string& src_filename) bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
{ {
std::string exten = gDirUtilp->getExtension(src_filename); std::string exten = gDirUtilp->getExtension(src_filename);
U32 codec = LLImageBase::getCodecFromExtension(exten); U32 codec = LLImageBase::getCodecFromExtension(exten);
LLPointer<LLImageRaw> raw_image = new LLImageRaw; LLPointer<LLImageRaw> raw_image = new LLImageRaw;
@@ -771,7 +753,6 @@ BOOL LLImagePreviewAvatar::render()
LLVertexBuffer::unbind(); LLVertexBuffer::unbind();
avatarp->updateLOD(); avatarp->updateLOD();
if (avatarp->mDrawable.notNull()) if (avatarp->mDrawable.notNull())
{ {
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
@@ -918,7 +899,6 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
BOOL LLImagePreviewSculpted::render() BOOL LLImagePreviewSculpted::render()
{ {
mNeedsUpdate = FALSE; mNeedsUpdate = FALSE;
LLGLSUIDefault def; LLGLSUIDefault def;
LLGLDisable no_blend(GL_BLEND); LLGLDisable no_blend(GL_BLEND);
LLGLEnable cull(GL_CULL_FACE); LLGLEnable cull(GL_CULL_FACE);

View File

@@ -3,10 +3,9 @@
* @brief LLFloaterImagePreview class definition * @brief LLFloaterImagePreview class definition
* *
* $LicenseInfo:firstyear=2004&license=viewergpl$ * $LicenseInfo:firstyear=2004&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2004-2009, Linden Research, Inc. * Copyright (c) 2004-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -115,9 +114,8 @@ protected:
class LLFloaterImagePreview : public LLFloaterNameDesc class LLFloaterImagePreview : public LLFloaterNameDesc
{ {
public: public:
LLFloaterImagePreview(const std::string& filename);
// <edit> // <edit>
LLFloaterImagePreview(const std::string& filename, void* item); LLFloaterImagePreview(const std::string& filename, void* item = NULL);
// </edit> // </edit>
virtual ~LLFloaterImagePreview(); virtual ~LLFloaterImagePreview();
@@ -129,7 +127,6 @@ public:
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
static void onMouseCaptureLostImagePreview(LLMouseHandler*); static void onMouseCaptureLostImagePreview(LLMouseHandler*);
static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
void clearAllPreviewTextures(); void clearAllPreviewTextures();
@@ -146,8 +143,6 @@ protected:
LLRect mPreviewRect; LLRect mPreviewRect;
LLRectf mPreviewImageRect; LLRectf mPreviewImageRect;
LLPointer<LLViewerTexture> mImagep ; LLPointer<LLViewerTexture> mImagep ;
static S32 sUploadAmount;
}; };
#endif // LL_LLFLOATERIMAGEPREVIEW_H #endif // LL_LLFLOATERIMAGEPREVIEW_H

View File

@@ -3,10 +3,9 @@
* @brief LLFloaterNameDesc class implementation * @brief LLFloaterNameDesc class implementation
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2002-2009, Linden Research, Inc. * Copyright (c) 2002-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -70,31 +69,16 @@ const S32 PREF_BUTTON_HEIGHT = 16;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLFloaterNameDesc() // LLFloaterNameDesc()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename ) LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename, void* item )
: LLFloater(std::string("Name/Description Floater")) : LLFloater(std::string("Name/Description Floater")),
{
// <edit> // <edit>
mItem = NULL; mItem(item),
// </edit> // </edit>
mFilenameAndPath = filename; mIsAudio(FALSE)
mFilename = gDirUtilp->getBaseFileName(filename, false);
// SL-5521 Maintain capitalization of filename when making the inventory item. JC
//LLStringUtil::toLower(mFilename);
mIsAudio = FALSE;
}
// <edit>
LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename, void* item )
: LLFloater(std::string("Name/Description Floater"))
{ {
mItem = item; mFilenameAndPath = filename.asString();
mFilenameAndPath = filename; mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false);
mFilename = gDirUtilp->getBaseFileName(filename, false);
// SL-5521 Maintain capitalization of filename when making the inventory item. JC
//LLStringUtil::toLower(mFilename);
mIsAudio = FALSE;
} }
// </edit>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// postBuild() // postBuild()
@@ -109,11 +93,6 @@ BOOL LLFloaterNameDesc::postBuild()
LLStringUtil::stripNonprintable(asset_name); LLStringUtil::stripNonprintable(asset_name);
LLStringUtil::trim(asset_name); LLStringUtil::trim(asset_name);
std::string exten = gDirUtilp->getExtension(asset_name);
if (exten == "wav")
{
mIsAudio = TRUE;
}
asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion
setTitle(mFilename); setTitle(mFilename);
@@ -128,8 +107,8 @@ BOOL LLFloaterNameDesc::postBuild()
r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
childSetCommitCallback("name_form", doCommit, this); getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
childSetValue("name_form", LLSD(asset_name)); getChild<LLUICtrl>("name_form")->setValue(LLSD(asset_name));
LLLineEditor *NameEditor = getChild<LLLineEditor>("name_form"); LLLineEditor *NameEditor = getChild<LLLineEditor>("name_form");
if (NameEditor) if (NameEditor)
@@ -142,7 +121,7 @@ BOOL LLFloaterNameDesc::postBuild()
y -= PREVIEW_LINE_HEIGHT; y -= PREVIEW_LINE_HEIGHT;
r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
childSetCommitCallback("description_form", doCommit, this); getChild<LLUICtrl>("description_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
LLLineEditor *DescEditor = getChild<LLLineEditor>("description_form"); LLLineEditor *DescEditor = getChild<LLLineEditor>("description_form");
if (DescEditor) if (DescEditor)
{ {
@@ -153,14 +132,10 @@ BOOL LLFloaterNameDesc::postBuild()
y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f); y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
// Cancel button // Cancel button
childSetAction("cancel_btn", onBtnCancel, this); getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this));
getChild<LLUICtrl>("ok_btn")->setLabelArg("[UPLOADFEE]", llformat("%s%d", gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()));
// OK button
childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee());
if (exten == "wav")
{
childSetAction("ok_btn", onBtnOK, this);
}
setDefaultBtn("ok_btn"); setDefaultBtn("ok_btn");
return TRUE; return TRUE;
@@ -182,45 +157,99 @@ void LLFloaterNameDesc::onCommit()
{ {
} }
// static
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// onCommit() // onCommit()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLFloaterNameDesc::doCommit( class LLUICtrl *, void* userdata ) void LLFloaterNameDesc::doCommit()
{ {
LLFloaterNameDesc* self = (LLFloaterNameDesc*) userdata; onCommit();
self->onCommit();
} }
// static
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// onBtnOK() // onBtnOK()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLFloaterNameDesc::onBtnOK( void* userdata ) void LLFloaterNameDesc::onBtnOK()
{ {
LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata; getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads
fp->childDisable("ok_btn"); // don't allow inadvertent extra uploads
LLAssetStorage::LLStoreAssetCallback callback = NULL; LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass).
void *nruserdata = NULL; void *nruserdata = NULL;
std::string display_name = LLStringUtil::null; std::string display_name = LLStringUtil::null;
upload_new_resource(fp->mFilenameAndPath, // file upload_new_resource(mFilenameAndPath, // file
fp->childGetValue("name_form").asString(), getChild<LLUICtrl>("name_form")->getValue().asString(),
fp->childGetValue("description_form").asString(), getChild<LLUICtrl>("description_form")->getValue().asString(),
0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
display_name, callback, expected_upload_cost, nruserdata); display_name, callback, expected_upload_cost, nruserdata);
fp->close(false); close(false);
} }
// static
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// onBtnCancel() // onBtnCancel()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLFloaterNameDesc::onBtnCancel( void* userdata ) void LLFloaterNameDesc::onBtnCancel()
{ {
LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata; close(false);
fp->close(false); }
//-----------------------------------------------------------------------------
// LLFloaterSoundPreview()
//-----------------------------------------------------------------------------
LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& filename, void* item )
: LLFloaterNameDesc(filename, item)
{
mIsAudio = TRUE;
}
BOOL LLFloaterSoundPreview::postBuild()
{
if (!LLFloaterNameDesc::postBuild())
{
return FALSE;
}
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
}
//-----------------------------------------------------------------------------
// LLFloaterAnimPreview()
//-----------------------------------------------------------------------------
LLFloaterAnimPreview::LLFloaterAnimPreview(const LLSD& filename, void* item )
: LLFloaterNameDesc(filename, item)
{
}
BOOL LLFloaterAnimPreview::postBuild()
{
if (!LLFloaterNameDesc::postBuild())
{
return FALSE;
}
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
}
//-----------------------------------------------------------------------------
// LLFloaterScriptPreview()
//-----------------------------------------------------------------------------
LLFloaterScriptPreview::LLFloaterScriptPreview(const LLSD& filename, void* item )
: LLFloaterNameDesc(filename, item)
{
mIsText = TRUE;
}
BOOL LLFloaterScriptPreview::postBuild()
{
if (!LLFloaterNameDesc::postBuild())
{
return FALSE;
}
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
} }

View File

@@ -3,10 +3,9 @@
* @brief LLFloaterNameDesc class definition * @brief LLFloaterNameDesc class definition
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2002-2009, Linden Research, Inc. * Copyright (c) 2002-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -44,29 +43,49 @@ class LLRadioGroup;
class LLFloaterNameDesc : public LLFloater class LLFloaterNameDesc : public LLFloater
{ {
public: public:
LLFloaterNameDesc(const std::string& filename);
// <edit> // <edit>
LLFloaterNameDesc(const std::string& filename, void* item); LLFloaterNameDesc(const LLSD& filename, void* item = NULL);
// </edit> // </edit>
virtual ~LLFloaterNameDesc(); virtual ~LLFloaterNameDesc();
virtual BOOL postBuild(); virtual BOOL postBuild();
static void doCommit(class LLUICtrl *, void* userdata); void onBtnOK();
void onBtnCancel();
void doCommit();
protected: protected:
virtual void onCommit(); virtual void onCommit();
protected: protected:
BOOL mIsAudio; BOOL mIsAudio;
bool mIsText;
std::string mFilenameAndPath; std::string mFilenameAndPath;
std::string mFilename; std::string mFilename;
// <edit> // <edit>
void* mItem; void* mItem;
// </edit> // </edit>
};
static void onBtnOK(void*); class LLFloaterSoundPreview : public LLFloaterNameDesc
static void onBtnCancel(void*); {
public:
LLFloaterSoundPreview(const LLSD& filename, void* item = NULL );
virtual BOOL postBuild();
};
class LLFloaterAnimPreview : public LLFloaterNameDesc
{
public:
LLFloaterAnimPreview(const LLSD& filename, void* item = NULL );
virtual BOOL postBuild();
};
class LLFloaterScriptPreview : public LLFloaterNameDesc
{
public:
LLFloaterScriptPreview(const LLSD& filename, void* item = NULL );
virtual BOOL postBuild();
}; };
#endif // LL_LLFLOATERNAMEDESC_H #endif // LL_LLFLOATERNAMEDESC_H

View File

@@ -37,7 +37,6 @@
#include "llagent.h" #include "llagent.h"
#include "llagentcamera.h" #include "llagentcamera.h"
#include "statemachine/aifilepicker.h" #include "statemachine/aifilepicker.h"
#include "llfloateranimpreview.h"
#include "llfloaterbvhpreview.h" #include "llfloaterbvhpreview.h"
#include "llfloaterimagepreview.h" #include "llfloaterimagepreview.h"
#include "llfloatermodelpreview.h" #include "llfloatermodelpreview.h"
@@ -217,7 +216,7 @@ bool AIFileUpload::is_valid(std::string const& filename, ELoadFilter type)
// No extension // No extension
LLSD args; LLSD args;
args["FILE"] = short_name; args["FILE"] = short_name;
LLNotifications::instance().add("NoFileExtension", args); LLNotificationsUtil::add("NoFileExtension", args);
return false; return false;
} }
else else
@@ -260,7 +259,7 @@ bool AIFileUpload::is_valid(std::string const& filename, ELoadFilter type)
LLSD args; LLSD args;
args["EXTENSION"] = ext; args["EXTENSION"] = ext;
args["VALIDS"] = valid_extensions; args["VALIDS"] = valid_extensions;
LLNotifications::instance().add("InvalidFileExtension", args); LLNotificationsUtil::add("InvalidFileExtension", args);
return false; return false;
} }
}//end else (non-null extension) }//end else (non-null extension)
@@ -279,7 +278,7 @@ bool AIFileUpload::is_valid(std::string const& filename, ELoadFilter type)
llinfos << error_msg << ": " << filename << llendl; llinfos << error_msg << ": " << filename << llendl;
LLSD args; LLSD args;
args["FILE"] = filename; args["FILE"] = filename;
LLNotifications::instance().add( error_msg, args ); LLNotificationsUtil::add( error_msg, args );
return false; return false;
} }
}//end if a wave/sound file }//end if a wave/sound file
@@ -331,9 +330,7 @@ class LLFileUploadSound : public view_listener_t, public AIFileUpload
// Inherited from AIFileUpload. // Inherited from AIFileUpload.
/*virtual*/ void handle_event(std::string const& filename) /*virtual*/ void handle_event(std::string const& filename)
{ {
LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterSoundPreview(LLSD(filename)), "floater_sound_preview.xml");
LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_sound_preview.xml");
floaterp->childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() ));
} }
}; };
@@ -349,20 +346,34 @@ class LLFileUploadAnim : public view_listener_t, public AIFileUpload
// Inherited from AIFileUpload. // Inherited from AIFileUpload.
/*virtual*/ void handle_event(std::string const& filename) /*virtual*/ void handle_event(std::string const& filename)
{ {
int len = filename.size(); if (filename.rfind(".anim") != std::string::npos)
if (len >= 5 && filename.substr(len - 5, 5) == ".anim")
{ {
LLFloaterAnimPreview* floaterp = new LLFloaterAnimPreview(filename); LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterAnimPreview(LLSD(filename)), "floater_animation_anim_preview.xml");
LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_animation_anim_preview.xml");
floaterp->childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%s%d", gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()));
} }
else else
{ {
LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterBvhPreview(filename), "floater_animation_bvh_preview.xml"); LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterBvhPreview(LLSD(filename)), "floater_animation_bvh_preview.xml");
} }
} }
}; };
/* Singu TODO? LL made a class to upload scripts, but never actually hooked everything up, it'd be nice for us to offer such a thing.
class LLFileUploadScript : public view_listener_t, public AIFileUpload
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
start_filepicker(FFLOAD_SCRIPT, "script");
return true;
}
protected:
// Inherited from AIFileUpload.
virtual void handle_event(std::string const& filename)
{
LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterScriptPreview(LLSD(filename)), "floater_script_preview.xml");
}
};*/
class LLFileUploadBulk : public view_listener_t class LLFileUploadBulk : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -386,13 +397,13 @@ class LLFileUploadBulk : public view_listener_t
const char* notification_type = expected_upload_cost ? "BulkTemporaryUpload" : "BulkTemporaryUploadFree"; const char* notification_type = expected_upload_cost ? "BulkTemporaryUpload" : "BulkTemporaryUploadFree";
LLSD args; LLSD args;
args["UPLOADCOST"] = gHippoGridManager->getConnectedGrid()->getUploadFee(); args["UPLOADCOST"] = gHippoGridManager->getConnectedGrid()->getUploadFee();
LLNotifications::instance().add(notification_type, args, LLSD(), onConfirmBulkUploadTemp); LLNotificationsUtil::add(notification_type, args, LLSD(), onConfirmBulkUploadTemp);
return true; return true;
} }
static bool onConfirmBulkUploadTemp(const LLSD& notification, const LLSD& response ) static bool onConfirmBulkUploadTemp(const LLSD& notification, const LLSD& response )
{ {
S32 option = LLNotification::getSelectedOption(notification, response); S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
bool enabled; bool enabled;
if (option == 0) // yes if (option == 0) // yes
enabled = true; enabled = true;
@@ -446,7 +457,7 @@ class LLFileUploadBulk : public view_listener_t
void upload_error(const std::string& error_message, const std::string& label, const std::string& filename, const LLSD& args) void upload_error(const std::string& error_message, const std::string& label, const std::string& filename, const LLSD& args)
{ {
llwarns << error_message << llendl; llwarns << error_message << llendl;
LLNotifications::instance().add(label, args); LLNotificationsUtil::add(label, args);
if(LLFile::remove(filename) == -1) if(LLFile::remove(filename) == -1)
{ {
lldebugs << "unable to remove temp file" << llendl; lldebugs << "unable to remove temp file" << llendl;
@@ -1361,6 +1372,7 @@ void init_menu_file()
(new LLFileUploadImage())->registerListener(gMenuHolder, "File.UploadImage"); (new LLFileUploadImage())->registerListener(gMenuHolder, "File.UploadImage");
(new LLFileUploadSound())->registerListener(gMenuHolder, "File.UploadSound"); (new LLFileUploadSound())->registerListener(gMenuHolder, "File.UploadSound");
(new LLFileUploadAnim())->registerListener(gMenuHolder, "File.UploadAnim"); (new LLFileUploadAnim())->registerListener(gMenuHolder, "File.UploadAnim");
//(new LLFileUploadScript())->registerListener(gMenuHolder, "File.UploadScript"); // Singu TODO?
(new LLFileUploadModel())->registerListener(gMenuHolder, "File.UploadModel"); (new LLFileUploadModel())->registerListener(gMenuHolder, "File.UploadModel");
(new LLFileUploadBulk())->registerListener(gMenuHolder, "File.UploadBulk"); (new LLFileUploadBulk())->registerListener(gMenuHolder, "File.UploadBulk");
(new LLFileCloseWindow())->registerListener(gMenuHolder, "File.CloseWindow"); (new LLFileCloseWindow())->registerListener(gMenuHolder, "File.CloseWindow");

View File

@@ -55,12 +55,10 @@
#include "llagentcamera.h" #include "llagentcamera.h"
#include "llcallingcard.h" #include "llcallingcard.h"
#include "llfirstuse.h" #include "llfirstuse.h"
#include "llfloaterbvhpreview.h"
#include "llfloaterbump.h" #include "llfloaterbump.h"
#include "llfloaterbuycurrency.h" #include "llfloaterbuycurrency.h"
#include "llfloaterbuyland.h" #include "llfloaterbuyland.h"
#include "llfloaterchat.h" #include "llfloaterchat.h"
#include "llfloaterimagepreview.h"
#include "llfloaterland.h" #include "llfloaterland.h"
#include "llfloaterregioninfo.h" #include "llfloaterregioninfo.h"
#include "llfloaterlandholdings.h" #include "llfloaterlandholdings.h"
@@ -6522,9 +6520,6 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/)
LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL; LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL;
LLFloaterImagePreview::setUploadAmount(upload_cost);
LLFloaterBvhPreview::setUploadAmount(upload_cost);
std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee(); std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee();
gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", fee); gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", fee);
gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", fee); gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", fee);

View File

@@ -58,7 +58,7 @@
<button <button
follows="left|bottom" follows="left|bottom"
height="22" height="22"
label="Upload ([AMOUNT])" label="Upload ([UPLOADFEE])"
layout="topleft" layout="topleft"
left="45" left="45"
name="ok_btn" name="ok_btn"