summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lloutfitgallery.cpp1
-rw-r--r--indra/newview/llpanelprofile.cpp275
-rw-r--r--indra/newview/llpanelprofile.h11
-rw-r--r--indra/newview/skins/default/xui/en/menu_avatar_self.xml7
-rw-r--r--indra/newview/skins/default/xui/en/menu_profile_self.xml11
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_firstlife.xml11
6 files changed, 282 insertions, 34 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 4febb72c6c..f419e2e06d 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -1374,6 +1374,7 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)
texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLOutfitGallery::onTexturePickerCommit, this, _1, _2));
texture_floaterp->setOnUpdateImageStatsCallback(boost::bind(&LLOutfitGallery::onTexturePickerUpdateImageStats, this, _1));
texture_floaterp->setLocalTextureEnabled(FALSE);
+ texture_floaterp->setBakeTextureEnabled(FALSE);
texture_floaterp->setCanApply(false, true);
}
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 6c4e0e9878..dbb83b0da2 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -169,6 +169,14 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
{
avatar_data->flags |= AVATAR_ALLOW_PUBLISH;
}
+ if (result["identified"].asBoolean())
+ {
+ avatar_data->flags |= AVATAR_IDENTIFIED;
+ }
+ if (result["transacted"].asBoolean())
+ {
+ avatar_data->flags |= AVATAR_TRANSACTED;
+ }
avatar_data->caption_index = 0;
if (result.has("charter_member")) // won't be present if "caption" is set
@@ -1412,6 +1420,10 @@ void LLProfileImagePicker::notify(const std::vector<std::string>& filenames)
{
return;
}
+ if (filenames.empty())
+ {
+ return;
+ }
std::string file_path = filenames[0];
if (file_path.empty())
{
@@ -1541,34 +1553,28 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata)
url = LLWeb::expandURLSubstitutions(url, subs);
LLUrlAction::openURL(url);
}
- else if (item_name == "change_photo")
+ else if (item_name == "upload_photo")
{
(new LLProfileImagePicker(PROFILE_IMAGE_SL, new LLHandle<LLPanel>(getHandle())))->getFile();
+
+ LLFloater* floaterp = mFloaterTexturePickerHandle.get();
+ if (floaterp)
+ {
+ floaterp->closeFloater();
+ }
+ }
+ else if (item_name == "change_photo")
+ {
+ onShowTexturePicker();
}
else if (item_name == "remove_photo")
{
- LLSD params;
- params["sl_image_id"] = LLUUID::null;
+ onCommitProfileImage(LLUUID::null);
- std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
- if (!cap_url.empty())
+ LLFloater* floaterp = mFloaterTexturePickerHandle.get();
+ if (floaterp)
{
- LLCoros::instance().launch("putAgentUserInfoCoro",
- boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), params));
-
- mSecondLifePic->setValue("Generic_Person_Large");
- mImageId = LLUUID::null;
-
- LLFloater *floater = mFloaterProfileTextureHandle.get();
- if (floater)
- {
- LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
- texture_view->resetAsset();
- }
- }
- else
- {
- LL_WARNS("AvatarProperties") << "Failed to update profile data, no cap found" << LL_ENDL;
+ floaterp->closeFloater();
}
}
}
@@ -1615,15 +1621,16 @@ bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata)
{
return !mAvatarNameCacheConnection.connected();
}
- else if (item_name == "change_photo")
+ else if (item_name == "upload_photo"
+ || item_name == "change_photo")
{
std::string cap_url = gAgent.getRegionCapability(PROFILE_IMAGE_UPLOAD_CAP);
- return !cap_url.empty() && !mWaitingForImageUpload;
+ return !cap_url.empty() && !mWaitingForImageUpload && getIsLoaded();
}
else if (item_name == "remove_photo")
{
std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
- return mImageId.notNull() && !cap_url.empty() && !mWaitingForImageUpload;
+ return mImageId.notNull() && !cap_url.empty() && !mWaitingForImageUpload && getIsLoaded();
}
return false;
@@ -1799,6 +1806,117 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture()
}
}
+void LLPanelProfileSecondLife::onShowTexturePicker()
+{
+ LLFloater* floaterp = mFloaterTexturePickerHandle.get();
+
+ // Show the dialog
+ if (!floaterp)
+ {
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ if (parent_floater)
+ {
+ // because inventory construction is somewhat slow
+ getWindow()->setCursor(UI_CURSOR_WAIT);
+ LLFloaterTexturePicker* texture_floaterp = new LLFloaterTexturePicker(
+ this,
+ mImageId,
+ LLUUID::null,
+ mImageId,
+ FALSE,
+ FALSE,
+ "SELECT PHOTO",
+ PERM_NONE,
+ PERM_NONE,
+ PERM_NONE,
+ FALSE,
+ NULL);
+
+ mFloaterTexturePickerHandle = texture_floaterp->getHandle();
+
+ texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id)
+ {
+ if (op == LLTextureCtrl::TEXTURE_SELECT)
+ {
+ LLUUID image_asset_id;
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterTexturePickerHandle.get();
+ if (floaterp)
+ {
+ if (id.notNull())
+ {
+ image_asset_id = id;
+ }
+ else
+ {
+ image_asset_id = floaterp->getAssetID();
+ }
+ }
+
+ onCommitProfileImage(image_asset_id);
+ }
+ });
+ texture_floaterp->setLocalTextureEnabled(FALSE);
+ texture_floaterp->setBakeTextureEnabled(FALSE);
+ texture_floaterp->setCanApply(false, true);
+
+ parent_floater->addDependentFloater(mFloaterTexturePickerHandle);
+
+ texture_floaterp->openFloater();
+ texture_floaterp->setFocus(TRUE);
+ }
+ }
+ else
+ {
+ floaterp->setMinimized(FALSE);
+ floaterp->setVisibleAndFrontmost(TRUE);
+ }
+}
+
+void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id)
+{
+ if (mImageId == id)
+ {
+ return;
+ }
+
+ std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
+ if (!cap_url.empty())
+ {
+ LLSD params;
+ params["sl_image_id"] = id;
+ LLCoros::instance().launch("putAgentUserInfoCoro",
+ boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), params));
+
+ mImageId = id;
+ if (mImageId == LLUUID::null)
+ {
+ mSecondLifePic->setValue("Generic_Person_Large");
+ }
+ else
+ {
+ mSecondLifePic->setValue(mImageId);
+ }
+
+ LLFloater *floater = mFloaterProfileTextureHandle.get();
+ if (floater)
+ {
+ LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
+ if (mImageId == LLUUID::null)
+ {
+ texture_view->resetAsset();
+ }
+ else
+ {
+ texture_view->loadAsset(mImageId);
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS("AvatarProperties") << "Failed to update profile data, no cap found" << LL_ENDL;
+ }
+}
+
void LLPanelProfileSecondLife::onOpenNotes()
{
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
@@ -1973,11 +2091,13 @@ BOOL LLPanelProfileFirstLife::postBuild()
mDescriptionEdit = getChild<LLTextEditor>("fl_description_edit");
mPicture = getChild<LLIconCtrl>("real_world_pic");
- mChangePhoto = getChild<LLButton>("fl_upload_image");
+ mUploadPhoto = getChild<LLButton>("fl_upload_image");
+ mChangePhoto = getChild<LLButton>("fl_change_image");
mRemovePhoto = getChild<LLButton>("fl_remove_image");
mSaveChanges = getChild<LLButton>("fl_save_changes");
mDiscardChanges = getChild<LLButton>("fl_discard_changes");
+ mUploadPhoto->setCommitCallback([this](LLUICtrl*, void*) { onUploadPhoto(); }, nullptr);
mChangePhoto->setCommitCallback([this](LLUICtrl*, void*) { onChangePhoto(); }, nullptr);
mRemovePhoto->setCommitCallback([this](LLUICtrl*, void*) { onRemovePhoto(); }, nullptr);
mSaveChanges->setCommitCallback([this](LLUICtrl*, void*) { onSaveDescriptionChanges(); }, nullptr);
@@ -2002,8 +2122,9 @@ void LLPanelProfileFirstLife::onOpen(const LLSD& key)
void LLPanelProfileFirstLife::setProfileImageUploading(bool loading)
{
+ mUploadPhoto->setEnabled(!loading);
mChangePhoto->setEnabled(!loading);
- mRemovePhoto->setEnabled(!loading);
+ mRemovePhoto->setEnabled(!loading && mImageId.notNull());
LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("image_upload_indicator");
indicator->setVisible(loading);
@@ -2031,23 +2152,107 @@ void LLPanelProfileFirstLife::commitUnsavedChanges()
}
}
-void LLPanelProfileFirstLife::onChangePhoto()
+void LLPanelProfileFirstLife::onUploadPhoto()
{
(new LLProfileImagePicker(PROFILE_IMAGE_FL, new LLHandle<LLPanel>(getHandle())))->getFile();
}
+void LLPanelProfileFirstLife::onChangePhoto()
+{
+ LLFloater* floaterp = mFloaterTexturePickerHandle.get();
+
+ // Show the dialog
+ if (!floaterp)
+ {
+ LLFloater* parent_floater = gFloaterView->getParentFloater(this);
+ if (parent_floater)
+ {
+ // because inventory construction is somewhat slow
+ getWindow()->setCursor(UI_CURSOR_WAIT);
+ LLFloaterTexturePicker* texture_floaterp = new LLFloaterTexturePicker(
+ this,
+ mImageId,
+ LLUUID::null,
+ mImageId,
+ FALSE,
+ FALSE,
+ "SELECT PHOTO",
+ PERM_NONE,
+ PERM_NONE,
+ PERM_NONE,
+ FALSE,
+ NULL);
+
+ mFloaterTexturePickerHandle = texture_floaterp->getHandle();
+
+ texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id)
+ {
+ if (op == LLTextureCtrl::TEXTURE_SELECT)
+ {
+ LLUUID image_asset_id;
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterTexturePickerHandle.get();
+ if (floaterp)
+ {
+ if (id.notNull())
+ {
+ image_asset_id = id;
+ }
+ else
+ {
+ image_asset_id = floaterp->getAssetID();
+ }
+ }
+
+ onCommitPhoto(image_asset_id);
+ }
+ });
+ texture_floaterp->setLocalTextureEnabled(FALSE);
+ texture_floaterp->setCanApply(false, true);
+
+ parent_floater->addDependentFloater(mFloaterTexturePickerHandle);
+
+ texture_floaterp->openFloater();
+ texture_floaterp->setFocus(TRUE);
+ }
+ }
+ else
+ {
+ floaterp->setMinimized(FALSE);
+ floaterp->setVisibleAndFrontmost(TRUE);
+ }
+}
+
void LLPanelProfileFirstLife::onRemovePhoto()
{
- LLSD params;
- params["fl_image_id"] = LLUUID::null;
+ onCommitPhoto(LLUUID::null);
+}
+
+void LLPanelProfileFirstLife::onCommitPhoto(const LLUUID& id)
+{
+ if (mImageId == id)
+ {
+ return;
+ }
std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
if (!cap_url.empty())
{
+ LLSD params;
+ params["fl_image_id"] = id;
LLCoros::instance().launch("putAgentUserInfoCoro",
boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), params));
- mPicture->setValue("Generic_Person_Large");
+ mImageId = id;
+ if (mImageId.notNull())
+ {
+ mPicture->setValue(mImageId);
+ }
+ else
+ {
+ mPicture->setValue("Generic_Person_Large");
+ }
+
+ mRemovePhoto->setEnabled(mImageId.notNull());
}
else
{
@@ -2099,14 +2304,18 @@ void LLPanelProfileFirstLife::onDiscardDescriptionChanges()
void LLPanelProfileFirstLife::processProperties(const LLAvatarData* avatar_data)
{
setDescriptionText(avatar_data->fl_about_text);
- if (avatar_data->fl_image_id.notNull())
+
+ mImageId = avatar_data->fl_image_id;
+
+ if (mImageId.notNull())
{
- mPicture->setValue(avatar_data->fl_image_id);
+ mPicture->setValue(mImageId);
}
else
{
mPicture->setValue("Generic_Person_Large");
}
+
setLoaded();
}
@@ -2115,6 +2324,7 @@ void LLPanelProfileFirstLife::resetData()
mDescriptionEdit->setValue(LLStringUtil::null);
mPicture->setValue("Generic_Person_Large");
+ mUploadPhoto->setVisible(getSelfProfile());
mChangePhoto->setVisible(getSelfProfile());
mRemovePhoto->setVisible(getSelfProfile());
mSaveChanges->setVisible(getSelfProfile());
@@ -2129,6 +2339,7 @@ void LLPanelProfileFirstLife::setLoaded()
{
mDescriptionEdit->setEnabled(TRUE);
mPicture->setEnabled(TRUE);
+ mRemovePhoto->setEnabled(mImageId.notNull());
}
}
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 943048843f..b363bd3fd2 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -181,6 +181,8 @@ private:
void onDiscardDescriptionChanges();
void onShowAgentPermissionsDialog();
void onShowAgentProfileTexture();
+ void onShowTexturePicker();
+ void onCommitProfileImage(const LLUUID& id);
void onOpenNotes();
private:
@@ -205,6 +207,7 @@ private:
LLHandle<LLFloater> mFloaterPermissionsHandle;
LLHandle<LLFloater> mFloaterProfileTextureHandle;
+ LLHandle<LLFloater> mFloaterTexturePickerHandle;
bool mHasUnsavedDescriptionChanges;
bool mVoiceStatus;
@@ -288,8 +291,10 @@ public:
protected:
void setLoaded() override;
+ void onUploadPhoto();
void onChangePhoto();
void onRemovePhoto();
+ void onCommitPhoto(const LLUUID& id);
void setDescriptionText(const std::string &text);
void onSetDescriptionDirty();
void onSaveDescriptionChanges();
@@ -297,12 +302,16 @@ protected:
LLTextEditor* mDescriptionEdit;
LLIconCtrl* mPicture;
+ LLButton* mUploadPhoto;
LLButton* mChangePhoto;
LLButton* mRemovePhoto;
LLButton* mSaveChanges;
LLButton* mDiscardChanges;
- std::string mCurrentDescription;
+ LLHandle<LLFloater> mFloaterTexturePickerHandle;
+
+ std::string mCurrentDescription;
+ LLUUID mImageId;
bool mHasUnsavedChanges;
};
diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml
index 500b6fffc2..20f3ad080b 100644
--- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml
+++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml
@@ -290,4 +290,11 @@
<menu_item_call.on_visible
function="EnableMuteParticle" />
</menu_item_call>
+ <menu_item_separator/>
+ <menu_item_call label="View Profile"
+ layout="topleft"
+ name="show_avatar_profile">
+ <menu_item_call.on_click
+ function="Avatar.ToggleMyProfile" />
+ </menu_item_call>
</context_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_profile_self.xml b/indra/newview/skins/default/xui/en/menu_profile_self.xml
index 552c96c60c..d0bd4000f8 100644
--- a/indra/newview/skins/default/xui/en/menu_profile_self.xml
+++ b/indra/newview/skins/default/xui/en/menu_profile_self.xml
@@ -19,6 +19,17 @@
parameter="edit_partner"/>
</menu_item_call>
<menu_item_call
+ label="Upload Photo"
+ layout="topleft"
+ name="upload_photo">
+ <menu_item_call.on_click
+ function="Profile.Commit"
+ parameter="upload_photo"/>
+ <menu_item_call.on_enable
+ function="Profile.EnableItem"
+ parameter="upload_photo"/>
+ </menu_item_call>
+ <menu_item_call
label="Change Photo"
layout="topleft"
name="change_photo">
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 90e0f1bc05..ca1e405a62 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
@@ -39,8 +39,17 @@
visible="false"/>
<button
name="fl_upload_image"
+ label="Upload Photo"
+ top="102"
+ left="175"
+ height="20"
+ width="120"
+ follows="top|left"
+ layout="topleft"/>
+ <button
+ name="fl_change_image"
label="Change Photo"
- top="127"
+ top_pad="5"
left="175"
height="20"
width="120"