summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterprofiletexture.cpp284
-rw-r--r--indra/newview/llfloaterprofiletexture.h62
-rw-r--r--indra/newview/llpanelprofile.cpp161
-rw-r--r--indra/newview/llpanelprofile.h18
-rw-r--r--indra/newview/skins/default/xui/en/floater_profile_texture.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_firstlife.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_secondlife.xml2
7 files changed, 248 insertions, 283 deletions
diff --git a/indra/newview/llfloaterprofiletexture.cpp b/indra/newview/llfloaterprofiletexture.cpp
index a78df1015a..a46548f29a 100644
--- a/indra/newview/llfloaterprofiletexture.cpp
+++ b/indra/newview/llfloaterprofiletexture.cpp
@@ -33,37 +33,173 @@
#include "llpreview.h" // fors constants
#include "lltrans.h"
#include "llviewercontrol.h"
-#include "lltextureview.h"
#include "llviewertexture.h"
#include "llviewertexturelist.h"
+ //////////////////////////////////////////////////////////////////////////
+ // LLProfileImageCtrl
+ //////////////////////////////////////////////////////////////////////////
-LLFloaterProfileTexture::LLFloaterProfileTexture(LLView* owner)
- : LLFloater(LLSD())
- , mUpdateDimensions(TRUE)
- , mLastHeight(0)
- , mLastWidth(0)
+static LLDefaultChildRegistry::Register<LLProfileImageCtrl> r("profile_image");
+
+LLProfileImageCtrl::LLProfileImageCtrl(const LLProfileImageCtrl::Params& p)
+ : LLIconCtrl(p)
, mImage(NULL)
, mImageOldBoostLevel(LLGLTexture::BOOST_NONE)
- , mOwnerHandle(owner->getHandle())
+ , mWasNoDelete(false)
+ , mImageLoadedSignal(NULL)
{
- buildFromFile("floater_profile_texture.xml");
}
-LLFloaterProfileTexture::~LLFloaterProfileTexture()
+LLProfileImageCtrl::~LLProfileImageCtrl()
+{
+ LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList);
+ releaseTexture();
+
+ delete mImageLoadedSignal;
+}
+
+void LLProfileImageCtrl::releaseTexture()
{
if (mImage.notNull())
{
mImage->setBoostLevel(mImageOldBoostLevel);
+ if (!mWasNoDelete)
+ {
+ // In most cases setBoostLevel marks images as NO_DELETE
+ mImage->forceActive();
+ }
mImage = NULL;
}
}
+void LLProfileImageCtrl::setValue(const LLSD& value)
+{
+ LLUUID id = value.asUUID();
+ setImageAssetId(id);
+ if (id.isNull())
+ {
+ LLIconCtrl::setValue("Generic_Person_Large", LLGLTexture::BOOST_UI);
+ }
+ else
+ {
+ // called second to not change priority before it gets saved to mImageOldBoostLevel
+ LLIconCtrl::setValue(value, LLGLTexture::BOOST_PREVIEW);
+ }
+}
+
+void LLProfileImageCtrl::draw()
+{
+ if (mImage.notNull())
+ {
+ // Pump the texture priority
+ mImage->addTextureStats(MAX_IMAGE_AREA);
+ mImage->setKnownDrawSize(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT, LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
+ }
+ LLIconCtrl::draw();
+}
+
+boost::signals2::connection LLProfileImageCtrl::setImageLoadedCallback(const image_loaded_signal_t::slot_type& cb)
+{
+ if (!mImageLoadedSignal) mImageLoadedSignal = new image_loaded_signal_t();
+
+ return mImageLoadedSignal->connect(cb);
+}
+
+void LLProfileImageCtrl::setImageAssetId(const LLUUID& asset_id)
+{
+ if (mImageID == asset_id)
+ {
+ return;
+ }
+
+ releaseTexture();
+
+ mImageID = asset_id;
+ if (mImageID.notNull())
+ {
+ mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ mWasNoDelete = mImage->getTextureState() == LLGLTexture::NO_DELETE;
+ mImageOldBoostLevel = mImage->getBoostLevel();
+ mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
+ mImage->setKnownDrawSize(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT, LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
+ mImage->forceToSaveRawImage(0);
+
+ if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0)
+ {
+ mImage->setLoadedCallback(LLProfileImageCtrl::onImageLoaded,
+ 0, TRUE, FALSE, new LLHandle<LLUICtrl>(getHandle()), &mCallbackTextureList);
+ }
+ else
+ {
+ onImageLoaded(true, mImage);
+ }
+ }
+}
+
+void LLProfileImageCtrl::onImageLoaded(bool success, LLViewerFetchedTexture* img)
+{
+ if (mImageLoadedSignal)
+ {
+ (*mImageLoadedSignal)(success, img);
+ }
+}
+
+// static
+void LLProfileImageCtrl::onImageLoaded(BOOL success,
+ LLViewerFetchedTexture* src_vi,
+ LLImageRaw* src,
+ LLImageRaw* aux_src,
+ S32 discard_level,
+ BOOL final,
+ void* userdata)
+{
+ if (!userdata) return;
+
+ LLHandle<LLUICtrl>* handle = (LLHandle<LLUICtrl>*)userdata;
+
+ if (!handle->isDead())
+ {
+ LLProfileImageCtrl* caller = static_cast<LLProfileImageCtrl*>(handle->get());
+ if (caller && caller->mImageLoadedSignal)
+ {
+ (*caller->mImageLoadedSignal)(success, src_vi);
+ }
+ }
+
+ if (final || !success)
+ {
+ delete handle;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// LLFloaterProfileTexture
+ //////////////////////////////////////////////////////////////////////////
+
+LLFloaterProfileTexture::LLFloaterProfileTexture(LLView* owner)
+ : LLFloater(LLSD())
+ , mLastHeight(0)
+ , mLastWidth(0)
+ , mOwnerHandle(owner->getHandle())
+ , mContextConeOpacity(0.f)
+ , mCloseButton(NULL)
+ , mProfileIcon(NULL)
+{
+ buildFromFile("floater_profile_texture.xml");
+}
+
+LLFloaterProfileTexture::~LLFloaterProfileTexture()
+{
+}
+
// virtual
BOOL LLFloaterProfileTexture::postBuild()
{
- mProfileIcon = getChild<LLIconCtrl>("profile_pic");
+ mProfileIcon = getChild<LLProfileImageCtrl>("profile_pic");
+ mProfileIcon->setImageLoadedCallback([this](BOOL success, LLViewerFetchedTexture* imagep) {onImageLoaded(success, imagep); });
mCloseButton = getChild<LLButton>("close_btn");
mCloseButton->setCommitCallback([this](LLUICtrl*, void*) { closeFloater(); }, nullptr);
@@ -81,55 +217,41 @@ void LLFloaterProfileTexture::reshape(S32 width, S32 height, BOOL called_from_pa
// When we receive it, reshape the window accordingly.
void LLFloaterProfileTexture::updateDimensions()
{
- if (mImage.isNull())
+ LLPointer<LLViewerFetchedTexture> image = mProfileIcon->getImage();
+ if (image.isNull())
{
return;
}
- if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0)
+ if ((image->getFullWidth() * image->getFullHeight()) == 0)
{
return;
}
- S32 img_width = mImage->getFullWidth();
- S32 img_height = mImage->getFullHeight();
-
- if (mAssetStatus != LLPreview::PREVIEW_ASSET_LOADED
- || mLastWidth != img_width
- || mLastHeight != img_height)
- {
- mAssetStatus = LLPreview::PREVIEW_ASSET_LOADED;
- // Asset has been fully loaded
- mUpdateDimensions = TRUE;
- }
+ S32 img_width = image->getFullWidth();
+ S32 img_height = image->getFullHeight();
mLastHeight = img_height;
mLastWidth = img_width;
- // Reshape the floater only when required
- if (mUpdateDimensions)
- {
- mUpdateDimensions = FALSE;
+ LLRect old_floater_rect = getRect();
+ LLRect old_image_rect = mProfileIcon->getRect();
+ S32 width = old_floater_rect.getWidth() - old_image_rect.getWidth() + mLastWidth;
+ S32 height = old_floater_rect.getHeight() - old_image_rect.getHeight() + mLastHeight;
- LLRect old_floater_rect = getRect();
- LLRect old_image_rect = mProfileIcon->getRect();
- S32 width = old_floater_rect.getWidth() - old_image_rect.getWidth() + mLastWidth;
- S32 height = old_floater_rect.getHeight() - old_image_rect.getHeight() + mLastHeight;
+ const F32 MAX_DIMENTIONS = 512; // most profiles are supposed to be 256x256
- const F32 MAX_DIMENTIONS = 512; // most profiles are supposed to be 256x256
-
- S32 biggest_dim = llmax(width, height);
- if (biggest_dim > MAX_DIMENTIONS)
- {
- F32 scale_down = MAX_DIMENTIONS / (F32)biggest_dim;
- width *= scale_down;
- height *= scale_down;
- }
+ S32 biggest_dim = llmax(width, height);
+ if (biggest_dim > MAX_DIMENTIONS)
+ {
+ F32 scale_down = MAX_DIMENTIONS / (F32)biggest_dim;
+ width *= scale_down;
+ height *= scale_down;
+ }
- //reshape floater
- reshape(width, height);
+ //reshape floater
+ reshape(width, height);
- gFloaterView->adjustToFitScreen(this, FALSE);
- }
+ gFloaterView->adjustToFitScreen(this, FALSE);
}
void LLFloaterProfileTexture::draw()
@@ -139,13 +261,6 @@ void LLFloaterProfileTexture::draw()
static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f);
drawConeToOwner(mContextConeOpacity, max_opacity, owner);
- if (mImage.notNull())
- {
- // Pump the texture priority
- mImage->addTextureStats(MAX_IMAGE_AREA);
- mImage->setKnownDrawSize(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT, LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
- }
-
LLFloater::draw();
}
@@ -156,77 +271,18 @@ void LLFloaterProfileTexture::onOpen(const LLSD& key)
void LLFloaterProfileTexture::resetAsset()
{
- mProfileIcon->setValue("Generic_Person_Large");
- mImageID = LLUUID::null;
- if (mImage.notNull())
- {
- mImage->setBoostLevel(mImageOldBoostLevel);
- mImage = NULL;
- }
+ mProfileIcon->setValue(LLUUID::null);
}
void LLFloaterProfileTexture::loadAsset(const LLUUID &image_id)
{
- if (mImageID != image_id)
- {
- if (mImage.notNull())
- {
- mImage->setBoostLevel(mImageOldBoostLevel);
- mImage = NULL;
- }
- }
- else
- {
- return;
- }
-
mProfileIcon->setValue(image_id);
- mImageID = image_id;
- mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- mImageOldBoostLevel = mImage->getBoostLevel();
- mImage->setKnownDrawSize(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT, LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT);
- mImage->forceToSaveRawImage(0);
-
- if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0)
- {
- mImage->setLoadedCallback(LLFloaterProfileTexture::onTextureLoaded,
- 0, TRUE, FALSE, new LLHandle<LLFloater>(getHandle()), &mCallbackTextureList);
-
- mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
- mAssetStatus = LLPreview::PREVIEW_ASSET_LOADING;
- }
- else
- {
- mAssetStatus = LLPreview::PREVIEW_ASSET_LOADED;
- }
-
- mUpdateDimensions = TRUE;
updateDimensions();
}
-// static
-void LLFloaterProfileTexture::onTextureLoaded(
- BOOL success,
- LLViewerFetchedTexture *src_vi,
- LLImageRaw* src,
- LLImageRaw* aux_src,
- S32 discard_level,
- BOOL final,
- void* userdata)
+void LLFloaterProfileTexture::onImageLoaded(BOOL success, LLViewerFetchedTexture* imagep)
{
- LLHandle<LLFloater>* handle = (LLHandle<LLFloater>*)userdata;
-
- if (!handle->isDead())
- {
- LLFloaterProfileTexture* floater = static_cast<LLFloaterProfileTexture*>(handle->get());
- if (floater && success)
- {
- floater->mUpdateDimensions = TRUE;
- floater->updateDimensions();
- }
- }
-
- if (final || !success)
+ if (success)
{
- delete handle;
+ updateDimensions();
}
}
diff --git a/indra/newview/llfloaterprofiletexture.h b/indra/newview/llfloaterprofiletexture.h
index 66a61213dd..12efbab572 100644
--- a/indra/newview/llfloaterprofiletexture.h
+++ b/indra/newview/llfloaterprofiletexture.h
@@ -28,11 +28,50 @@
#define LL_LLFLOATERPROFILETEXTURE_H
#include "llfloater.h"
+#include "lliconctrl.h"
#include "llviewertexture.h"
class LLButton;
class LLImageRaw;
-class LLIconCtrl;
+
+class LLProfileImageCtrl: public LLIconCtrl
+{
+public:
+ struct Params: public LLInitParam::Block<Params, LLIconCtrl::Params>
+ {
+ };
+
+ LLProfileImageCtrl(const Params& p);
+ virtual ~LLProfileImageCtrl();
+
+
+ virtual void setValue(const LLSD& value) override;
+ LLUUID getImageAssetId() { return mImageID; }
+ LLPointer<LLViewerFetchedTexture> getImage() {return mImage;}
+ void draw() override;
+
+ typedef boost::signals2::signal<void(bool success, LLViewerFetchedTexture* imagep)> image_loaded_signal_t;
+ boost::signals2::connection setImageLoadedCallback(const image_loaded_signal_t::slot_type& cb);
+private:
+ void onImageLoaded(bool success, LLViewerFetchedTexture* src_vi);
+ static void onImageLoaded(BOOL success,
+ LLViewerFetchedTexture* src_vi,
+ LLImageRaw* src,
+ LLImageRaw* aux_src,
+ S32 discard_level,
+ BOOL final,
+ void* userdata);
+ void releaseTexture();
+
+ void setImageAssetId(const LLUUID& asset_id);
+private:
+ LLPointer<LLViewerFetchedTexture> mImage;
+ LLUUID mImageID;
+ S32 mImageOldBoostLevel;
+ bool mWasNoDelete;
+ image_loaded_signal_t* mImageLoadedSignal;
+ LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList;
+};
class LLFloaterProfileTexture : public LLFloater
{
@@ -46,36 +85,23 @@ public:
void resetAsset();
void loadAsset(const LLUUID &image_id);
-
- static void onTextureLoaded(
- BOOL success,
- LLViewerFetchedTexture *src_vi,
- LLImageRaw* src,
- LLImageRaw* aux_src,
- S32 discard_level,
- BOOL final,
- void* userdata);
+ void onImageLoaded(BOOL success, LLViewerFetchedTexture* imagep);
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override;
+
+ LLHandle<LLFloater> getHandle() const { return LLFloater::getHandle(); }
protected:
BOOL postBuild() override;
private:
void updateDimensions();
- LLUUID mImageID;
- LLPointer<LLViewerFetchedTexture> mImage;
- S32 mImageOldBoostLevel;
- S32 mAssetStatus;
F32 mContextConeOpacity;
S32 mLastHeight;
S32 mLastWidth;
- BOOL mUpdateDimensions;
LLHandle<LLView> mOwnerHandle;
- LLIconCtrl* mProfileIcon;
+ LLProfileImageCtrl* mProfileIcon;
LLButton* mCloseButton;
-
- LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList;
};
#endif // LL_LLFLOATERPROFILETEXTURE_H
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 67c942b267..197b0d89c0 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -71,7 +71,6 @@
#include "llpanelblockedlist.h"
#include "llpanelprofileclassifieds.h"
#include "llpanelprofilepicks.h"
-#include "llthumbnailctrl.h"
#include "lltrans.h"
#include "llviewercontrol.h"
#include "llviewermenu.h" //is_agent_mappable
@@ -719,7 +718,7 @@ BOOL LLPanelProfileSecondLife::postBuild()
mGroupList = getChild<LLGroupList>("group_list");
mShowInSearchCombo = getChild<LLComboBox>("show_in_search");
mHideAgeCombo = getChild<LLComboBox>("hide_age");
- mSecondLifePic = getChild<LLThumbnailCtrl>("2nd_life_pic");
+ mSecondLifePic = getChild<LLProfileImageCtrl>("2nd_life_pic");
mSecondLifePicLayout = getChild<LLPanel>("image_panel");
mDescriptionEdit = getChild<LLTextEditor>("sl_description_edit");
mAgentActionMenuButton = getChild<LLMenuButton>("agent_actions_menu");
@@ -818,10 +817,9 @@ void LLPanelProfileSecondLife::resetData()
// Set default image and 1:1 dimensions for it
mSecondLifePic->setValue("Generic_Person_Large");
- mImageId = LLUUID::null;
LLRect imageRect = mSecondLifePicLayout->getRect();
- mSecondLifePicLayout->reshape(imageRect.getHeight(), imageRect.getHeight());
+ mSecondLifePicLayout->reshape(imageRect.getWidth(), imageRect.getWidth());
setDescriptionText(LLStringUtil::null);
mGroups.clear();
@@ -923,36 +921,12 @@ void LLPanelProfileSecondLife::setProfileImageUploading(bool loading)
void LLPanelProfileSecondLife::setProfileImageUploaded(const LLUUID &image_asset_id)
{
mSecondLifePic->setValue(image_asset_id);
- mImageId = image_asset_id;
-
- LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(image_asset_id);
- if (imagep->getFullHeight())
- {
- onImageLoaded(true, imagep);
- }
- else
- {
- imagep->setLoadedCallback(onImageLoaded,
- MAX_DISCARD_LEVEL,
- FALSE,
- FALSE,
- new LLHandle<LLPanel>(getHandle()),
- NULL,
- FALSE);
- }
LLFloater *floater = mFloaterProfileTextureHandle.get();
if (floater)
{
LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
- if (mImageId.notNull())
- {
- texture_view->loadAsset(mImageId);
- }
- else
- {
- texture_view->resetAsset();
- }
+ texture_view->loadAsset(mSecondLifePic->getImageAssetId());
}
setProfileImageUploading(false);
@@ -1000,33 +974,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
setDescriptionText(avatar_data->about_text);
- if (avatar_data->image_id.notNull())
- {
- mSecondLifePic->setValue(avatar_data->image_id);
- mImageId = avatar_data->image_id;
- }
- else
- {
- mSecondLifePic->setValue("Generic_Person_Large");
- mImageId = LLUUID::null;
- }
-
- // Will be loaded as a LLViewerFetchedTexture::BOOST_UI due to mSecondLifePic
- LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(avatar_data->image_id);
- if (imagep->getFullHeight())
- {
- onImageLoaded(true, imagep);
- }
- else
- {
- imagep->setLoadedCallback(onImageLoaded,
- MAX_DISCARD_LEVEL,
- FALSE,
- FALSE,
- new LLHandle<LLPanel>(getHandle()),
- NULL,
- FALSE);
- }
+ mSecondLifePic->setValue(avatar_data->image_id);
if (getSelfProfile())
{
@@ -1213,34 +1161,6 @@ void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTextur
}
}
-//static
-void LLPanelProfileSecondLife::onImageLoaded(BOOL success,
- LLViewerFetchedTexture *src_vi,
- LLImageRaw* src,
- LLImageRaw* aux_src,
- S32 discard_level,
- BOOL final,
- void* userdata)
-{
- if (!userdata) return;
-
- LLHandle<LLPanel>* handle = (LLHandle<LLPanel>*)userdata;
-
- if (!handle->isDead())
- {
- LLPanelProfileSecondLife* panel = static_cast<LLPanelProfileSecondLife*>(handle->get());
- if (panel)
- {
- panel->onImageLoaded(success, src_vi);
- }
- }
-
- if (final || !success)
- {
- delete handle;
- }
-}
-
// virtual, called by LLAvatarTracker
void LLPanelProfileSecondLife::changed(U32 mask)
{
@@ -1505,7 +1425,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata)
}
else if (item_name == "upload_photo")
{
- (new LLProfileImagePicker(PROFILE_IMAGE_SL, new LLHandle<LLPanel>(getHandle())))->getFile();
+ (new LLProfileImagePicker(PROFILE_IMAGE_SL, new LLHandle<LLPanel>(LLPanel::getHandle())))->getFile();
LLFloater* floaterp = mFloaterTexturePickerHandle.get();
if (floaterp)
@@ -1580,7 +1500,7 @@ bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata)
else if (item_name == "remove_photo")
{
std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
- return mImageId.notNull() && !cap_url.empty() && !mWaitingForImageUpload && getIsLoaded();
+ return mSecondLifePic->getImageAssetId().notNull() && !cap_url.empty() && !mWaitingForImageUpload && getIsLoaded();
}
return false;
@@ -1715,9 +1635,9 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture()
{
LLFloaterProfileTexture * texture_view = new LLFloaterProfileTexture(parent_floater);
mFloaterProfileTextureHandle = texture_view->getHandle();
- if (mImageId.notNull())
+ if (mSecondLifePic->getImageAssetId().notNull())
{
- texture_view->loadAsset(mImageId);
+ texture_view->loadAsset(mSecondLifePic->getImageAssetId());
}
else
{
@@ -1734,9 +1654,9 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture()
LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
texture_view->setMinimized(FALSE);
texture_view->setVisibleAndFrontmost(TRUE);
- if (mImageId.notNull())
+ if (mSecondLifePic->getImageAssetId().notNull())
{
- texture_view->loadAsset(mImageId);
+ texture_view->loadAsset(mSecondLifePic->getImageAssetId());
}
else
{
@@ -1759,9 +1679,9 @@ void LLPanelProfileSecondLife::onShowTexturePicker()
getWindow()->setCursor(UI_CURSOR_WAIT);
LLFloaterTexturePicker* texture_floaterp = new LLFloaterTexturePicker(
this,
- mImageId,
+ mSecondLifePic->getImageAssetId(),
LLUUID::null,
- mImageId,
+ mSecondLifePic->getImageAssetId(),
FALSE,
FALSE,
"SELECT PHOTO",
@@ -1798,7 +1718,7 @@ void LLPanelProfileSecondLife::onShowTexturePicker()
void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id)
{
- if (mImageId == id)
+ if (mSecondLifePic->getImageAssetId() == id)
return;
std::function<void(bool)> callback = [id](bool result)
@@ -1814,27 +1734,19 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id)
if (!saveAgentUserInfoCoro("sl_image_id", id, callback))
return;
- mImageId = id;
- if (mImageId == LLUUID::null)
- {
- mSecondLifePic->setValue("Generic_Person_Large");
- }
- else
- {
- mSecondLifePic->setValue(mImageId);
- }
+ mSecondLifePic->setValue(id);
LLFloater *floater = mFloaterProfileTextureHandle.get();
if (floater)
{
LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
- if (mImageId == LLUUID::null)
+ if (id == LLUUID::null)
{
texture_view->resetAsset();
}
else
{
- texture_view->loadAsset(mImageId);
+ texture_view->loadAsset(id);
}
}
}
@@ -1996,7 +1908,7 @@ LLPanelProfileFirstLife::~LLPanelProfileFirstLife()
BOOL LLPanelProfileFirstLife::postBuild()
{
mDescriptionEdit = getChild<LLTextEditor>("fl_description_edit");
- mPicture = getChild<LLThumbnailCtrl>("real_world_pic");
+ mPicture = getChild<LLProfileImageCtrl>("real_world_pic");
mUploadPhoto = getChild<LLButton>("fl_upload_image");
mChangePhoto = getChild<LLButton>("fl_change_image");
@@ -2031,7 +1943,7 @@ void LLPanelProfileFirstLife::setProfileImageUploading(bool loading)
{
mUploadPhoto->setEnabled(!loading);
mChangePhoto->setEnabled(!loading);
- mRemovePhoto->setEnabled(!loading && mImageId.notNull());
+ mRemovePhoto->setEnabled(!loading && mPicture->getImageAssetId().notNull());
LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("image_upload_indicator");
indicator->setVisible(loading);
@@ -2048,7 +1960,6 @@ void LLPanelProfileFirstLife::setProfileImageUploading(bool loading)
void LLPanelProfileFirstLife::setProfileImageUploaded(const LLUUID &image_asset_id)
{
mPicture->setValue(image_asset_id);
- mImageId = image_asset_id;
setProfileImageUploading(false);
}
@@ -2062,7 +1973,7 @@ void LLPanelProfileFirstLife::commitUnsavedChanges()
void LLPanelProfileFirstLife::onUploadPhoto()
{
- (new LLProfileImagePicker(PROFILE_IMAGE_FL, new LLHandle<LLPanel>(getHandle())))->getFile();
+ (new LLProfileImagePicker(PROFILE_IMAGE_FL, new LLHandle<LLPanel>(LLPanel::getHandle())))->getFile();
LLFloater* floaterp = mFloaterTexturePickerHandle.get();
if (floaterp)
@@ -2085,9 +1996,9 @@ void LLPanelProfileFirstLife::onChangePhoto()
getWindow()->setCursor(UI_CURSOR_WAIT);
LLFloaterTexturePicker* texture_floaterp = new LLFloaterTexturePicker(
this,
- mImageId,
+ mPicture->getImageAssetId(),
LLUUID::null,
- mImageId,
+ mPicture->getImageAssetId(),
FALSE,
FALSE,
"SELECT PHOTO",
@@ -2134,23 +2045,15 @@ void LLPanelProfileFirstLife::onRemovePhoto()
void LLPanelProfileFirstLife::onCommitPhoto(const LLUUID& id)
{
- if (mImageId == id)
+ if (mPicture->getImageAssetId() == id)
return;
if (!saveAgentUserInfoCoro("fl_image_id", id))
return;
- mImageId = id;
- if (mImageId.notNull())
- {
- mPicture->setValue(mImageId);
- }
- else
- {
- mPicture->setValue("Generic_Person_Large");
- }
+ mPicture->setValue(id);
- mRemovePhoto->setEnabled(mImageId.notNull());
+ mRemovePhoto->setEnabled(id.notNull());
}
void LLPanelProfileFirstLife::setDescriptionText(const std::string &text)
@@ -2201,16 +2104,7 @@ void LLPanelProfileFirstLife::processProperties(const LLAvatarData* avatar_data)
{
setDescriptionText(avatar_data->fl_about_text);
- mImageId = avatar_data->fl_image_id;
-
- if (mImageId.notNull())
- {
- mPicture->setValue(mImageId);
- }
- else
- {
- mPicture->setValue("Generic_Person_Large");
- }
+ mPicture->setValue(avatar_data->fl_image_id);
setLoaded();
}
@@ -2218,8 +2112,7 @@ void LLPanelProfileFirstLife::processProperties(const LLAvatarData* avatar_data)
void LLPanelProfileFirstLife::resetData()
{
setDescriptionText(std::string());
- mPicture->setValue("Generic_Person_Large");
- mImageId = LLUUID::null;
+ mPicture->setValue(LLUUID::null);
mUploadPhoto->setVisible(getSelfProfile());
mChangePhoto->setVisible(getSelfProfile());
@@ -2236,7 +2129,7 @@ void LLPanelProfileFirstLife::setLoaded()
{
mDescriptionEdit->setEnabled(TRUE);
mPicture->setEnabled(TRUE);
- mRemovePhoto->setEnabled(mImageId.notNull());
+ mRemovePhoto->setEnabled(mPicture->getImageAssetId().notNull());
}
}
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 221a576a65..3760fe11d7 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -58,9 +58,9 @@ class LLTextBase;
class LLMenuButton;
class LLLineEditor;
class LLTextEditor;
-class LLThumbnailCtrl;
class LLPanelProfileClassifieds;
class LLPanelProfilePicks;
+class LLProfileImageCtrl;
class LLViewerFetchedTexture;
@@ -137,13 +137,6 @@ protected:
void fillAgeData(const LLAvatarData* avatar_data);
void onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep);
- static void onImageLoaded(BOOL success,
- LLViewerFetchedTexture *src_vi,
- LLImageRaw* src,
- LLImageRaw* aux_src,
- S32 discard_level,
- BOOL final,
- void* userdata);
/**
* Displays avatar's online status if possible.
@@ -186,7 +179,7 @@ private:
LLGroupList* mGroupList;
LLComboBox* mShowInSearchCombo;
LLComboBox* mHideAgeCombo;
- LLThumbnailCtrl* mSecondLifePic;
+ LLProfileImageCtrl* mSecondLifePic;
LLPanel* mSecondLifePicLayout;
LLTextEditor* mDescriptionEdit;
LLMenuButton* mAgentActionMenuButton;
@@ -209,8 +202,6 @@ private:
bool mAllowPublish;
bool mHideAge;
std::string mDescriptionText;
- LLUUID mImageId;
-
boost::signals2::connection mAvatarNameCacheConnection;
};
@@ -259,7 +250,7 @@ private:
* Panel for displaying Avatar's first life related info.
*/
class LLPanelProfileFirstLife
- : public LLPanelProfilePropertiesProcessorTab
+ : public LLPanelProfilePropertiesProcessorTab
{
public:
LLPanelProfileFirstLife();
@@ -293,7 +284,7 @@ protected:
void onDiscardDescriptionChanges();
LLTextEditor* mDescriptionEdit;
- LLThumbnailCtrl* mPicture;
+ LLProfileImageCtrl* mPicture;
LLButton* mUploadPhoto;
LLButton* mChangePhoto;
LLButton* mRemovePhoto;
@@ -303,7 +294,6 @@ protected:
LLHandle<LLFloater> mFloaterTexturePickerHandle;
std::string mCurrentDescription;
- LLUUID mImageId;
bool mHasUnsavedChanges;
};
diff --git a/indra/newview/skins/default/xui/en/floater_profile_texture.xml b/indra/newview/skins/default/xui/en/floater_profile_texture.xml
index 3b351a3325..7c2dc11e7d 100644
--- a/indra/newview/skins/default/xui/en/floater_profile_texture.xml
+++ b/indra/newview/skins/default/xui/en/floater_profile_texture.xml
@@ -27,7 +27,7 @@
follows="left|top"
auto_resize="true"
layout="topleft">
- <icon
+ <profile_image
name="profile_pic"
image_name="Generic_Person_Large"
layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
index 6ae4890777..7315ba3cfe 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
@@ -19,7 +19,7 @@
layout="topleft"
visible="false"
/>
- <thumbnail
+ <profile_image
name="real_world_pic"
image_name="Generic_Person_Large"
show_loading="false"
diff --git a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
index 307b7b83ef..173312960c 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
@@ -71,7 +71,7 @@ Account: [ACCTTYPE]
auto_resize="false"
user_resize="false">
- <thumbnail
+ <profile_image
name="2nd_life_pic"
image_name="Generic_Person_Large"
show_loading="false"