summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewsound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewsound.cpp')
-rw-r--r--indra/newview/llpreviewsound.cpp40
1 files changed, 17 insertions, 23 deletions
diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp
index 26d8da5a6b..7659c50ed3 100644
--- a/indra/newview/llpreviewsound.cpp
+++ b/indra/newview/llpreviewsound.cpp
@@ -32,11 +32,10 @@
#include "llviewerprecompiledheaders.h"
-#include "audioengine.h"
+#include "llaudioengine.h"
#include "llagent.h" // gAgent
#include "llbutton.h"
#include "llinventory.h"
-#include "llinventoryview.h"
#include "lllineeditor.h"
#include "llpreviewsound.h"
#include "llresmgr.h"
@@ -49,12 +48,23 @@ extern LLAgent gAgent;
const F32 SOUND_GAIN = 1.0f;
-LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid) :
- LLPreview( name, rect, title, item_uuid, object_uuid)
+LLPreviewSound::LLPreviewSound(const LLSD& key)
+ : LLPreview( key )
{
-
- LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml");
+ //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml", FALSE);
+}
+// virtual
+BOOL LLPreviewSound::postBuild()
+{
+ const LLInventoryItem* item = getItem();
+ if (item)
+ {
+ childSetText("desc", item->getDescription());
+ if (gAudiop)
+ gAudiop->preloadSound(item->getAssetUUID()); // preload the sound
+ }
+
childSetAction("Sound play btn",&LLPreviewSound::playSound,this);
childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this);
@@ -64,26 +74,10 @@ LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, cons
button = getChild<LLButton>("Sound audition btn");
button->setSoundFlags(LLView::SILENT);
- const LLInventoryItem* item = getItem();
-
childSetCommitCallback("desc", LLPreview::onText, this);
- childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
-
- // preload the sound
- if(item && gAudiop)
- {
- gAudiop->preloadSound(item->getAssetUUID());
- }
-
- setTitle(title);
-
- if (!getHost())
- {
- LLRect curRect = getRect();
- translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
- }
+ return LLPreview::postBuild();
}
// static