Fixed crash reported by Naudia Nadezda, crash when closing a texture multipreview.

Also updated LLPreviewTexture to be closer to upstream and better for translation,
added lltrans for FileSaved and Receiving,
and floater_preview_texture.xml now uses No Alpha, Has Alpha, Unknown as strings.
This commit is contained in:
Lirusaito
2012-08-23 23:53:36 -04:00
parent 064f0216b4
commit 07f52c463e
3 changed files with 27 additions and 18 deletions

View File

@@ -44,6 +44,7 @@
#include "llinventory.h"
#include "llnotificationsutil.h"
#include "llresmgr.h"
#include "lltrans.h"
#include "lltextbox.h"
#include "lltextureview.h"
#include "llui.h"
@@ -56,13 +57,13 @@
const S32 PREVIEW_TEXTURE_MIN_WIDTH = 300;
const S32 PREVIEW_TEXTURE_MIN_HEIGHT = 120;
const F32 PREVIEW_TEXTURE_MAX_ASPECT = 200.f;
const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f;
const S32 CLIENT_RECT_VPAD = 4;
const F32 SECONDS_TO_SHOW_FILE_SAVED_MSG = 8.f;
const F32 PREVIEW_TEXTURE_MAX_ASPECT = 200.f;
const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f;
LLPreviewTexture * LLPreviewTexture::sInstance;
LLPreviewTexture::LLPreviewTexture(const std::string& name,
const LLRect& rect,
@@ -163,8 +164,11 @@ LLPreviewTexture::~LLPreviewTexture()
{
getWindow()->decBusyCount();
}
mImage->setBoostLevel(mImageOldBoostLevel);
mImage = NULL;
if(mImage)
{
mImage->setBoostLevel(mImageOldBoostLevel);
mImage = NULL;
}
sInstance = NULL;
}
@@ -185,14 +189,12 @@ void LLPreviewTexture::init()
{
childSetAction("Copy To Inventory",LLPreview::onBtnCopyToInv,this);
}
else if (mShowKeepDiscard)
{
childSetAction("Keep",onKeepBtn,this);
childSetAction("Discard",onDiscardBtn,this);
}
else
else
{
// If the buttons are hidden move stuff down to use the space.
@@ -233,7 +235,7 @@ void LLPreviewTexture::init()
childSetText("uuid", getItemID().asString());
childSetText("uploader", getItemCreatorName());
childSetText("uploadtime", getItemCreationDate());
childSetText("alphanote", std::string("Loading..."));
childSetText("alphanote", LLTrans::getString("LoadingData"));
}
}
@@ -287,12 +289,12 @@ void LLPreviewTexture::draw()
if (!mImage->getIsAlphaMask())
{
childSetColor("alphanote", LLColor4::green);
childSetText("alphanote", std::string("No Alpha"));
childSetText("alphanote", getString("No Alpha"));
}
else
{
childSetColor("alphanote", LLColor4::red);
childSetText("alphanote", std::string("Has Alpha"));
childSetText("alphanote", getString("Has Alpha"));
}
mAlphaMaskResult = mImage->getIsAlphaMask();
}
@@ -320,8 +322,7 @@ void LLPreviewTexture::draw()
if( mLoadingFullImage )
{
// *TODO: Translate
LLFontGL::getFontSansSerif()->renderUTF8(std::string("Receiving:"), 0,
LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving"), 0,
interior.mLeft + 4,
interior.mBottom + 4,
LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
@@ -357,8 +358,7 @@ void LLPreviewTexture::draw()
}
else if(!mSavedFileTimer.hasExpired())
{
// *TODO: Translate
LLFontGL::getFontSansSerif()->renderUTF8(std::string("File Saved"), 0,
LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("FileSaved"), 0,
interior.mLeft + 4,
interior.mBottom + 4,
LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
@@ -367,6 +367,7 @@ void LLPreviewTexture::draw()
}
}
}
}
@@ -408,6 +409,7 @@ void LLPreviewTexture::saveAs_continued(LLViewerInventoryItem const* item, AIFil
mSaveFileName = filepicker->getFilename();
mLoadingFullImage = TRUE;
getWindow()->incBusyCount();
mImage->forceToSaveRawImage(0) ;//re-fetch the raw image if the old one is removed.
mImage->setLoadedCallback( LLPreviewTexture::onFileLoadedForSave,
0, TRUE, FALSE, new LLUUID( mItemUUID ), &mCallbackTextureList );
@@ -497,7 +499,7 @@ std::string LLPreviewTexture::getItemCreationDate()
timeToFormattedString(item->getCreationDate(), gSavedSettings.getString("TimestampFormat"), time);
return time;
}
return "Unknown";
return getString("Unknown");
}
std::string LLPreviewTexture::getItemCreatorName()
@@ -510,7 +512,7 @@ std::string LLPreviewTexture::getItemCreatorName()
mCreatorKey = item->getCreatorUUID();
return name;
}
return "Unknown";
return getString("Unknown");
}

View File

@@ -43,6 +43,8 @@
h_pad="50" halign="left" height="16" right="345" mouse_opaque="true" name="alphanote" v_pad="0" width="80">
Loading...
</text>
<string name="No Alpha">No Alpha</string>
<string name="Has Alpha">Has Alpha</string>
<button bottom="8" enabled="true" follows="left|bottom" font="SansSerif" halign="center" height="20"
label="Keep" label_selected="Keep" left="9" mouse_opaque="true" name="Keep" scale_image="true" width="100" />
<button bottom="8" enabled="true" follows="left|bottom" font="SansSerif" halign="center" height="20"
@@ -86,4 +88,5 @@
2:1
</combo_item>
</combo_box>
</floater>
<string name="Unknown">Unknown</string>
</floater>

View File

@@ -2916,6 +2916,10 @@ Expected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh
<string name="accel-win-alt">Alt-</string>
<string name="accel-win-shift">Shift-</string>
<!-- Previews -->
<string name="FileSaved">File Saved</string>
<string name="Receiving">Receiving</string>
<!-- Directions, HUD -->
<string name="Direction_Forward">Forward</string>
<string name="Direction_Left">Left</string>