diff options
Diffstat (limited to 'indra/newview/llpanelprofile.cpp')
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 305 |
1 files changed, 176 insertions, 129 deletions
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 4c78f7e3f5..46cb65b1ac 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -46,6 +46,7 @@ #include "lltexteditor.h" #include "lltexturectrl.h" #include "lltoggleablemenu.h" +#include "lltooldraganddrop.h" #include "llgrouplist.h" #include "llurlaction.h" @@ -321,7 +322,7 @@ public: { if (params.size() < 2) return false; LLUUID avatar_id; - if (!avatar_id.set(params[0], FALSE)) + if (!avatar_id.set(params[0], false)) { return false; } @@ -448,7 +449,7 @@ class LLFloaterProfilePermissions public: LLFloaterProfilePermissions(LLView * owner, const LLUUID &avatar_id); ~LLFloaterProfilePermissions(); - BOOL postBuild() override; + bool postBuild() override; void onOpen(const LLSD& key) override; void draw() override; void changed(U32 mask) override; // LLFriendObserver @@ -500,7 +501,7 @@ LLFloaterProfilePermissions::~LLFloaterProfilePermissions() } } -BOOL LLFloaterProfilePermissions::postBuild() +bool LLFloaterProfilePermissions::postBuild() { mDescription = getChild<LLTextBase>("perm_description"); mOnlineStatus = getChild<LLCheckBoxCtrl>("online_check"); @@ -515,7 +516,7 @@ BOOL LLFloaterProfilePermissions::postBuild() mOkBtn->setCommitCallback([this](LLUICtrl*, void*) { onApplyRights(); }, nullptr); mCancelBtn->setCommitCallback([this](LLUICtrl*, void*) { onCancel(); }, nullptr); - return TRUE; + return true; } void LLFloaterProfilePermissions::onOpen(const LLSD& key) @@ -566,11 +567,11 @@ void LLFloaterProfilePermissions::fillRightsData() { S32 rights = relation->getRightsGrantedTo(); - BOOL see_online = LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE; + bool see_online = LLRelationship::GRANT_ONLINE_STATUS & rights; mOnlineStatus->setValue(see_online); mMapRights->setEnabled(see_online); - mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); - mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); + mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights); + mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights); } else { @@ -585,7 +586,7 @@ void LLFloaterProfilePermissions::rightsConfirmationCallback(const LLSD& notific S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option != 0) // canceled { - mEditObjectRights->setValue(mEditObjectRights->getValue().asBoolean() ? FALSE : TRUE); + mEditObjectRights->setValue(!mEditObjectRights->getValue().asBoolean()); } else { @@ -611,7 +612,7 @@ void LLFloaterProfilePermissions::onCommitSeeOnlineRights() if (relation) { S32 rights = relation->getRightsGrantedTo(); - mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); + mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights); } else { @@ -621,7 +622,7 @@ void LLFloaterProfilePermissions::onCommitSeeOnlineRights() } else { - mMapRights->setValue(FALSE); + mMapRights->setValue(false); } mHasUnsavedPermChanges = true; } @@ -702,10 +703,7 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife() LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); } - if (LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this); - } + LLVoiceClient::removeObserver((LLVoiceClientStatusObserver*)this); if (mAvatarNameCacheConnection.connected()) { @@ -713,7 +711,7 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife() } } -BOOL LLPanelProfileSecondLife::postBuild() +bool LLPanelProfileSecondLife::postBuild() { mGroupList = getChild<LLGroupList>("group_list"); mShowInSearchCombo = getChild<LLComboBox>("show_in_search"); @@ -747,7 +745,7 @@ BOOL LLPanelProfileSecondLife::postBuild() mCantEditObjectsIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); }); mSecondLifePic->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentProfileTexture(); }); - return TRUE; + return true; } void LLPanelProfileSecondLife::onOpen(const LLSD& key) @@ -758,7 +756,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) LLUUID avatar_id = getAvatarId(); - BOOL own_profile = getSelfProfile(); + bool own_profile = getSelfProfile(); mGroupList->setShowNone(!own_profile); @@ -774,7 +772,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) } // Init menu, menu needs to be created in scope of a registar to work correctly. - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit; + ScopedRegistrarHelper commit; commit.add("Profile.Commit", [this](LLUICtrl*, const LLSD& userdata) { onCommitMenu(userdata); }); LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; @@ -795,7 +793,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) if (!own_profile) { - mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : TRUE); + mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : true); updateOnlineStatus(); fillRightsData(); } @@ -803,6 +801,51 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCache, this, _1, _2)); } + +bool LLPanelProfileSecondLife::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + // Try children first + if (LLPanelProfileTab::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) + && *accept != ACCEPT_NO) + { + return true; + } + + // No point sharing with own profile + if (getSelfProfile()) + { + return false; + } + + // Exclude fields that look like they are editable. + S32 child_x = 0; + S32 child_y = 0; + if (localPointToOtherView(x, y, &child_x, &child_y, mDescriptionEdit) + && mDescriptionEdit->pointInView(child_x, child_y)) + { + return false; + } + + if (localPointToOtherView(x, y, &child_x, &child_y, mGroupList) + && mGroupList->pointInView(child_x, child_y)) + { + return false; + } + + // Share + LLToolDragAndDrop::handleGiveDragAndDrop(getAvatarId(), + LLUUID::null, + drop, + cargo_type, + cargo_data, + accept); + return true; +} + void LLPanelProfileSecondLife::refreshName() { if (!mAvatarNameCacheConnection.connected()) @@ -840,9 +883,9 @@ void LLPanelProfileSecondLife::resetData() mCanEditObjectsIcon->setEnabled(false); mCantEditObjectsIcon->setEnabled(false); - childSetVisible("partner_layout", FALSE); - childSetVisible("badge_layout", FALSE); - childSetVisible("partner_spacer_layout", TRUE); + childSetVisible("partner_layout", false); + childSetVisible("badge_layout", false); + childSetVisible("partner_spacer_layout", true); } void LLPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorType type) @@ -974,12 +1017,12 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) setDescriptionText(avatar_data->about_text); - mSecondLifePic->setValue(avatar_data->image_id); + mSecondLifePic->setValue(avatar_data->image_id); if (getSelfProfile()) { mAllowPublish = avatar_data->flags & AVATAR_ALLOW_PUBLISH; - mShowInSearchCombo->setValue(mAllowPublish ? TRUE : FALSE); + mShowInSearchCombo->setValue(mAllowPublish); } } @@ -988,7 +1031,7 @@ void LLPanelProfileSecondLife::fillPartnerData(const LLAvatarData* avatar_data) LLTextBox* partner_text_ctrl = getChild<LLTextBox>("partner_link"); if (avatar_data->partner_id.notNull()) { - childSetVisible("partner_layout", TRUE); + childSetVisible("partner_layout", true); LLStringUtil::format_map_t args; args["[LINK]"] = LLSLURL("agent", avatar_data->partner_id, "inspect").getSLURLString(); std::string partner_text = getString("partner_text", args); @@ -996,7 +1039,7 @@ void LLPanelProfileSecondLife::fillPartnerData(const LLAvatarData* avatar_data) } else { - childSetVisible("partner_layout", FALSE); + childSetVisible("partner_layout", false); } } @@ -1009,7 +1052,7 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data std::string caption_text = getString("CaptionTextAcctInfo", args); getChild<LLUICtrl>("account_info")->setValue(caption_text); - const S32 LINDEN_EMPLOYEE_INDEX = 3; + constexpr S32 LINDEN_EMPLOYEE_INDEX = 3; LLDate sl_release; sl_release.fromYMDHMS(2003, 6, 23, 0, 0, 0); std::string customer_lower = avatar_data->customer_type; @@ -1018,48 +1061,48 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Linden"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeLinden")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (avatar_data->born_on < sl_release) { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Beta"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeBeta")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "beta_lifetime") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Beta_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeBetaLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "lifetime") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgeLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "secondlifetime_premium") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Premium_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgePremiumLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else if (customer_lower == "secondlifetime_premium_plus") { getChild<LLUICtrl>("badge_icon")->setValue("Profile_Badge_Pplus_Lifetime"); getChild<LLUICtrl>("badge_text")->setValue(getString("BadgePremiumPlusLifetime")); - childSetVisible("badge_layout", TRUE); - childSetVisible("partner_spacer_layout", FALSE); + childSetVisible("badge_layout", true); + childSetVisible("partner_spacer_layout", false); } else { - childSetVisible("badge_layout", FALSE); - childSetVisible("partner_spacer_layout", TRUE); + childSetVisible("badge_layout", false); + childSetVisible("partner_spacer_layout", true); } } @@ -1074,7 +1117,7 @@ void LLPanelProfileSecondLife::fillRightsData() // If true - we are viewing friend's profile, enable check boxes and set values. if (relation) { - S32 rights = relation->getRightsGrantedTo(); + const S32 rights = relation->getRightsGrantedTo(); bool can_see_online = LLRelationship::GRANT_ONLINE_STATUS & rights; bool can_see_on_map = LLRelationship::GRANT_MAP_LOCATION & rights; bool can_edit_objects = LLRelationship::GRANT_MODIFY_OBJECTS & rights; @@ -1118,18 +1161,18 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) LLUICtrl* userAgeCtrl = getChild<LLUICtrl>("user_age"); if (hide_age) { - userAgeCtrl->setVisible(FALSE); + userAgeCtrl->setVisible(false); } else { - std::string register_date = getString("age_format"); - LLSD args_age; + std::string register_date = getString("age_format"); + LLSD args_age; args_age["[AGE]"] = LLDateUtil::ageFromDate(avatar_data->born_on, LLDate::now()); - LLStringUtil::format(register_date, args_age); + LLStringUtil::format(register_date, args_age); userAgeCtrl->setValue(register_date); } - BOOL showHideAgeCombo = FALSE; + bool showHideAgeCombo = false; if (getSelfProfile()) { if (LLAvatarPropertiesProcessor::getInstance()->isHideAgeSupportedByServer()) @@ -1139,15 +1182,15 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) if (now - birth > 365 * 24 * 60 * 60) { mHideAge = avatar_data->hide_age; - mHideAgeCombo->setValue(mHideAge ? TRUE : FALSE); - showHideAgeCombo = TRUE; + mHideAgeCombo->setValue(mHideAge); + showHideAgeCombo = true; } } } mHideAgeCombo->setVisible(showHideAgeCombo); } -void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) +void LLPanelProfileSecondLife::onImageLoaded(bool success, LLViewerFetchedTexture *imagep) { LLRect imageRect = mSecondLifePicLayout->getRect(); if (!success || imagep->getFullWidth() == imagep->getFullHeight()) @@ -1172,14 +1215,14 @@ void LLPanelProfileSecondLife::changed(U32 mask) } // virtual, called by LLVoiceClient -void LLPanelProfileSecondLife::onChange(EStatusType status, const std::string &channelURI, bool proximal) +void LLPanelProfileSecondLife::onChange(EStatusType status, const LLSD& channelInfo, bool proximal) { if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) { return; } - mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(getAvatarId()) ? LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) : TRUE); + mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(getAvatarId()) ? LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) : true); } void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id) @@ -1204,7 +1247,7 @@ void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id) void LLPanelProfileSecondLife::updateOnlineStatus() { const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - if (relationship != NULL) + if (relationship) { // For friend let check if he allowed me to see his status bool online = relationship->isOnline(); @@ -1232,12 +1275,12 @@ void LLPanelProfileSecondLife::setLoaded() if (getSelfProfile()) { - mShowInSearchCombo->setEnabled(TRUE); + mShowInSearchCombo->setEnabled(true); if (mHideAgeCombo->getVisible()) { - mHideAgeCombo->setEnabled(TRUE); + mHideAgeCombo->setEnabled(true); } - mDescriptionEdit->setEnabled(TRUE); + mDescriptionEdit->setEnabled(true); } } @@ -1285,7 +1328,7 @@ void LLProfileImagePicker::notify(const std::vector<std::string>& filenames) // generate a temp texture file for coroutine std::string temp_file = gDirUtilp->getTempFilename(); U32 codec = LLImageBase::getCodecFromExtension(gDirUtilp->getExtension(file_path)); - const S32 MAX_DIM = 256; + constexpr S32 MAX_DIM = 256; if (!LLViewerTextureList::createUploadFile(file_path, temp_file, codec, MAX_DIM)) { LLSD notif_args; @@ -1384,7 +1427,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) else if (item_name == "copy_user_id") { LLWString wstr = utf8str_to_wstring(getAvatarId().asString()); - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "agent_permissions") { @@ -1409,7 +1452,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) { wstr = utf8str_to_wstring(av_name.getUserName()); } - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "edit_display_name") { @@ -1547,8 +1590,8 @@ void LLPanelProfileSecondLife::onAvatarNameCacheSetName(const LLUUID& agent_id, void LLPanelProfileSecondLife::setDescriptionText(const std::string &text) { - mSaveDescriptionChanges->setEnabled(FALSE); - mDiscardDescriptionChanges->setEnabled(FALSE); + mSaveDescriptionChanges->setEnabled(false); + mDiscardDescriptionChanges->setEnabled(false); mHasUnsavedDescriptionChanges = false; mDescriptionText = text; @@ -1557,8 +1600,8 @@ void LLPanelProfileSecondLife::setDescriptionText(const std::string &text) void LLPanelProfileSecondLife::onSetDescriptionDirty() { - mSaveDescriptionChanges->setEnabled(TRUE); - mDiscardDescriptionChanges->setEnabled(TRUE); + mSaveDescriptionChanges->setEnabled(true); + mDiscardDescriptionChanges->setEnabled(true); mHasUnsavedDescriptionChanges = true; } @@ -1568,12 +1611,12 @@ void LLPanelProfileSecondLife::onShowInSearchCallback() if (value == mAllowPublish) return; - mAllowPublish = value; + mAllowPublish = value; saveAgentUserInfoCoro("allow_publish", value); - } +} void LLPanelProfileSecondLife::onHideAgeCallback() - { +{ bool value = mHideAgeCombo->getValue().asInteger(); if (value == mHideAge) return; @@ -1587,8 +1630,8 @@ void LLPanelProfileSecondLife::onSaveDescriptionChanges() mDescriptionText = mDescriptionEdit->getValue().asString(); saveAgentUserInfoCoro("sl_about_text", mDescriptionText); - mSaveDescriptionChanges->setEnabled(FALSE); - mDiscardDescriptionChanges->setEnabled(FALSE); + mSaveDescriptionChanges->setEnabled(false); + mDiscardDescriptionChanges->setEnabled(false); mHasUnsavedDescriptionChanges = false; } @@ -1599,7 +1642,7 @@ void LLPanelProfileSecondLife::onDiscardDescriptionChanges() void LLPanelProfileSecondLife::onShowAgentPermissionsDialog() { - LLFloater *floater = mFloaterPermissionsHandle.get(); + LLFloater* floater = mFloaterPermissionsHandle.get(); if (!floater) { LLFloater* parent_floater = gFloaterView->getParentFloater(this); @@ -1608,15 +1651,15 @@ void LLPanelProfileSecondLife::onShowAgentPermissionsDialog() LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions(parent_floater, getAvatarId()); mFloaterPermissionsHandle = perms->getHandle(); perms->openFloater(); - perms->setVisibleAndFrontmost(TRUE); + perms->setVisibleAndFrontmost(true); parent_floater->addDependentFloater(mFloaterPermissionsHandle); } } else // already open { - floater->setMinimized(FALSE); - floater->setVisibleAndFrontmost(TRUE); + floater->setMinimized(false); + floater->setVisibleAndFrontmost(true); } } @@ -1627,7 +1670,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture() return; } - LLFloater *floater = mFloaterProfileTextureHandle.get(); + LLFloater* floater = mFloaterProfileTextureHandle.get(); if (!floater) { LLFloater* parent_floater = gFloaterView->getParentFloater(this); @@ -1644,7 +1687,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture() texture_view->resetAsset(); } texture_view->openFloater(); - texture_view->setVisibleAndFrontmost(TRUE); + texture_view->setVisibleAndFrontmost(true); parent_floater->addDependentFloater(mFloaterProfileTextureHandle); } @@ -1652,8 +1695,8 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture() else // already open { LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); - texture_view->setMinimized(FALSE); - texture_view->setVisibleAndFrontmost(TRUE); + texture_view->setMinimized(false); + texture_view->setVisibleAndFrontmost(true); if (mSecondLifePic->getImageAssetId().notNull()) { texture_view->loadAsset(mSecondLifePic->getImageAssetId()); @@ -1682,12 +1725,12 @@ void LLPanelProfileSecondLife::onShowTexturePicker() mSecondLifePic->getImageAssetId(), LLUUID::null, mSecondLifePic->getImageAssetId(), - FALSE, - FALSE, + false, + false, "SELECT PHOTO", PERM_NONE, PERM_NONE, - FALSE, + false, NULL, PICK_TEXTURE); @@ -1700,20 +1743,20 @@ void LLPanelProfileSecondLife::onShowTexturePicker() onCommitProfileImage(asset_id); } }); - texture_floaterp->setLocalTextureEnabled(FALSE); - texture_floaterp->setBakeTextureEnabled(FALSE); + texture_floaterp->setLocalTextureEnabled(false); + texture_floaterp->setBakeTextureEnabled(false); texture_floaterp->setCanApply(false, true, false); parent_floater->addDependentFloater(mFloaterTexturePickerHandle); texture_floaterp->openFloater(); - texture_floaterp->setFocus(TRUE); + texture_floaterp->setFocus(true); } } else { - floaterp->setMinimized(FALSE); - floaterp->setVisibleAndFrontmost(TRUE); + floaterp->setMinimized(false); + floaterp->setVisibleAndFrontmost(true); } } @@ -1722,43 +1765,47 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id) if (mSecondLifePic->getImageAssetId() == id) return; - std::function<void(bool)> callback = [id](bool result) + std::function<void(bool)> callback = [id](bool result) + { + if (result) { - if (result) - { - LLAvatarIconIDCache::getInstance()->add(gAgentID, id); + LLAvatarIconIDCache::getInstance()->add(gAgentID, id); // Should trigger callbacks in icon controls (or request Legacy) - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); - } - }; + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); + } + }; if (!saveAgentUserInfoCoro("sl_image_id", id, callback)) return; mSecondLifePic->setValue(id); - LLFloater *floater = mFloaterProfileTextureHandle.get(); - if (floater) + LLFloater* floater = mFloaterProfileTextureHandle.get(); + if (floater) + { + LLFloaterProfileTexture* texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); + if (texture_view) { - LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); - if (id == LLUUID::null) + if (id.isNull()) { texture_view->resetAsset(); } else { - texture_view->loadAsset(id); + texture_view->loadAsset(id); } } } +} ////////////////////////////////////////////////////////////////////////// // LLPanelProfileWeb LLPanelProfileWeb::LLPanelProfileWeb() : LLPanelProfileTab() - , mWebBrowser(NULL) + , mWebBrowser(nullptr) , mAvatarNameCacheConnection() + , mFirstNavigate(false) { } @@ -1779,13 +1826,13 @@ void LLPanelProfileWeb::onOpen(const LLSD& key) mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileWeb::onAvatarNameCache, this, _1, _2)); } -BOOL LLPanelProfileWeb::postBuild() +bool LLPanelProfileWeb::postBuild() { mWebBrowser = getChild<LLMediaCtrl>("profile_html"); mWebBrowser->addObserver(this); mWebBrowser->setHomePageUrl("about:blank"); - return TRUE; + return true; } void LLPanelProfileWeb::resetData() @@ -1800,7 +1847,7 @@ void LLPanelProfileWeb::updateData() { setIsLoading(); - mWebBrowser->setVisible(TRUE); + mWebBrowser->setVisible(true); mPerformanceTimer.start(); mWebBrowser->navigateTo(mURLWebProfile, HTTP_CONTENT_TEXT_HTML); } @@ -1837,7 +1884,7 @@ void LLPanelProfileWeb::onCommitLoad(LLUICtrl* ctrl) LLSD::String valstr = ctrl->getValue().asString(); if (valstr.empty()) { - mWebBrowser->setVisible(TRUE); + mWebBrowser->setVisible(true); mPerformanceTimer.start(); mWebBrowser->navigateTo( mURLHome, HTTP_CONTENT_TEXT_HTML ); } @@ -1906,7 +1953,7 @@ LLPanelProfileFirstLife::~LLPanelProfileFirstLife() { } -BOOL LLPanelProfileFirstLife::postBuild() +bool LLPanelProfileFirstLife::postBuild() { mDescriptionEdit = getChild<LLTextEditor>("fl_description_edit"); mPicture = getChild<LLProfileImageCtrl>("real_world_pic"); @@ -1924,7 +1971,7 @@ BOOL LLPanelProfileFirstLife::postBuild() mDiscardChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardDescriptionChanges(); }, nullptr); mDescriptionEdit->setKeystrokeCallback([this](LLTextEditor* caller) { onSetDescriptionDirty(); }); - return TRUE; + return true; } void LLPanelProfileFirstLife::onOpen(const LLSD& key) @@ -1934,7 +1981,7 @@ void LLPanelProfileFirstLife::onOpen(const LLSD& key) if (!getSelfProfile()) { // Otherwise as the only focusable element it will be selected - mDescriptionEdit->setTabStop(FALSE); + mDescriptionEdit->setTabStop(false); } resetData(); @@ -2000,12 +2047,12 @@ void LLPanelProfileFirstLife::onChangePhoto() mPicture->getImageAssetId(), LLUUID::null, mPicture->getImageAssetId(), - FALSE, - FALSE, + false, + false, "SELECT PHOTO", PERM_NONE, PERM_NONE, - FALSE, + false, NULL, PICK_TEXTURE); @@ -2025,13 +2072,13 @@ void LLPanelProfileFirstLife::onChangePhoto() parent_floater->addDependentFloater(mFloaterTexturePickerHandle); texture_floaterp->openFloater(); - texture_floaterp->setFocus(TRUE); + texture_floaterp->setFocus(true); } } else { - floaterp->setMinimized(FALSE); - floaterp->setVisibleAndFrontmost(TRUE); + floaterp->setMinimized(false); + floaterp->setVisibleAndFrontmost(true); } } @@ -2061,8 +2108,8 @@ void LLPanelProfileFirstLife::onCommitPhoto(const LLUUID& id) void LLPanelProfileFirstLife::setDescriptionText(const std::string &text) { - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; mCurrentDescription = text; @@ -2071,8 +2118,8 @@ void LLPanelProfileFirstLife::setDescriptionText(const std::string &text) void LLPanelProfileFirstLife::onSetDescriptionDirty() { - mSaveChanges->setEnabled(TRUE); - mDiscardChanges->setEnabled(TRUE); + mSaveChanges->setEnabled(true); + mDiscardChanges->setEnabled(true); mHasUnsavedChanges = true; } @@ -2081,8 +2128,8 @@ void LLPanelProfileFirstLife::onSaveDescriptionChanges() mCurrentDescription = mDescriptionEdit->getValue().asString(); saveAgentUserInfoCoro("fl_about_text", mCurrentDescription); - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; } @@ -2130,8 +2177,8 @@ void LLPanelProfileFirstLife::setLoaded() if (getSelfProfile()) { - mDescriptionEdit->setEnabled(TRUE); - mPicture->setEnabled(TRUE); + mDescriptionEdit->setEnabled(true); + mPicture->setEnabled(true); mRemovePhoto->setEnabled(mPicture->getImageAssetId().notNull()); } } @@ -2159,7 +2206,7 @@ void LLPanelProfileNotes::commitUnsavedChanges() } } -BOOL LLPanelProfileNotes::postBuild() +bool LLPanelProfileNotes::postBuild() { mNotesEditor = getChild<LLTextEditor>("notes_edit"); mSaveChanges = getChild<LLButton>("notes_save_changes"); @@ -2169,7 +2216,7 @@ BOOL LLPanelProfileNotes::postBuild() mDiscardChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardNotesChanges(); }, nullptr); mNotesEditor->setKeystrokeCallback([this](LLTextEditor* caller) { onSetNotesDirty(); }); - return TRUE; + return true; } void LLPanelProfileNotes::onOpen(const LLSD& key) @@ -2181,8 +2228,8 @@ void LLPanelProfileNotes::onOpen(const LLSD& key) void LLPanelProfileNotes::setNotesText(const std::string &text) { - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; mCurrentNotes = text; @@ -2191,8 +2238,8 @@ void LLPanelProfileNotes::setNotesText(const std::string &text) void LLPanelProfileNotes::onSetNotesDirty() { - mSaveChanges->setEnabled(TRUE); - mDiscardChanges->setEnabled(TRUE); + mSaveChanges->setEnabled(true); + mDiscardChanges->setEnabled(true); mHasUnsavedChanges = true; } @@ -2201,8 +2248,8 @@ void LLPanelProfileNotes::onSaveNotesChanges() mCurrentNotes = mNotesEditor->getValue().asString(); saveAgentUserInfoCoro("notes", mCurrentNotes); - mSaveChanges->setEnabled(FALSE); - mDiscardChanges->setEnabled(FALSE); + mSaveChanges->setEnabled(false); + mDiscardChanges->setEnabled(false); mHasUnsavedChanges = false; } @@ -2226,7 +2273,7 @@ void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType typ void LLPanelProfileNotes::processProperties(const LLAvatarData* avatar_data) { setNotesText(avatar_data->notes); - mNotesEditor->setEnabled(TRUE); + mNotesEditor->setEnabled(true); setLoaded(); } @@ -2249,9 +2296,9 @@ LLPanelProfile::~LLPanelProfile() { } -BOOL LLPanelProfile::postBuild() +bool LLPanelProfile::postBuild() { - return TRUE; + return true; } void LLPanelProfile::onTabChange() |