Feature Request: Repair Uploaded by functionality

Clean up llviewertexture a bit while doing so.
Sync LLImage

Thanks to Cinder and the Alchemy Team for this buncha code.
This commit is contained in:
Lirusaito
2018-05-02 19:30:22 -04:00
parent dd49033a08
commit 1014841e2c
8 changed files with 237 additions and 330 deletions

View File

@@ -36,6 +36,7 @@
#include "llagent.h"
#include "llavataractions.h"
#include "llavatarnamecache.h"
#include "llbutton.h"
#include "llcombobox.h"
#include "statemachine/aifilepicker.h"
@@ -229,25 +230,17 @@ void LLPreviewTexture::init()
childSetText("desc", item->getDescription());
getChild<LLLineEditor>("desc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
childSetText("uuid", getItemID().asString());
childSetText("uploader", getItemCreatorName());
childSetText("uploadtime", getItemCreationDate());
childSetText("alphanote", LLTrans::getString("LoadingData"));
}
}
childSetText("uploader", getItemCreatorName());
childSetText("uploadtime", getItemCreationDate());
childSetCommitCallback("combo_aspect_ratio", onAspectRatioCommit, this);
LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
combo->setCurrentByIndex(0);
}
void LLPreviewTexture::callbackLoadAvatarName(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data)
{
if (!sInstance) return;
std::ostringstream fullname;
fullname << first << " " << last;
sInstance->childSetText("uploader", fullname.str());
}
void LLPreviewTexture::draw()
{
if (mUpdateDimensions)
@@ -486,17 +479,20 @@ std::string LLPreviewTexture::getItemCreationDate()
timeToFormattedString(item->getCreationDate(), gSavedSettings.getString("TimestampFormat"), time);
return time;
}
return getString("Unknown");
const LLDate date = mImage->getUploadTime();
return date.notNull() ? date.toHTTPDateString(gSavedSettings.getString("TimestampFormat"))
: getString("Unknown");
}
std::string LLPreviewTexture::getItemCreatorName()
{
const LLViewerInventoryItem* item = getItem();
if(item)
const LLUUID& id = item ? item->getCreatorUUID() : mImage->getUploader();
if (id.notNull())
{
std::string name;
gCacheName->getFullName(item->getCreatorUUID(), name);
mCreatorKey = item->getCreatorUUID();
LLAvatarNameCache::getNSName(id, name);
mCreatorKey = id;
return name;
}
return getString("Unknown");
@@ -577,6 +573,14 @@ void LLPreviewTexture::updateDimensions()
}
// Update the width/height display every time
if (mImage->getUploader().notNull())
{
// Singu Note: This is what Alchemy does, we may need it, but it might help if it didn't load in init.
childSetText("uploader", getItemCreatorName());
childSetText("uploadtime", getItemCreationDate());
}
if (!mUserResized)
{
// clamp texture size to fit within actual size of floater after attempting resize