summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-08-21 14:15:07 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-08-21 19:14:28 +0300
commit40e93e9f4d9059a298e16009483cf531eccd7c82 (patch)
treece485f3387dcf630ac895f499518a5c74dad2a23
parentdb84bf9567c27e266ccc6b1b6aed089c6022fe91 (diff)
Fix formatting and add some more constexpr
-rw-r--r--indra/llinventory/llpermissionsflags.h34
-rw-r--r--indra/newview/llpanelprofile.cpp56
2 files changed, 47 insertions, 43 deletions
diff --git a/indra/llinventory/llpermissionsflags.h b/indra/llinventory/llpermissionsflags.h
index aaf1fd3afb..0ab4de0ab2 100644
--- a/indra/llinventory/llpermissionsflags.h
+++ b/indra/llinventory/llpermissionsflags.h
@@ -37,48 +37,48 @@ typedef U32 PermissionBit;
// Do you have permission to transfer ownership of the object or
// item. Fair use rules dictate that if you cannot copy, you can
// always transfer.
-const PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000
+constexpr PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000
// objects, scale or change textures
// parcels, allow building on it
-const PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000
+constexpr PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000
// objects, allow copy
-const PermissionBit PERM_COPY = (1 << 15); // 0x00008000
+constexpr PermissionBit PERM_COPY = (1 << 15); // 0x00008000
// parcels, allow entry, deprecated
-//const PermissionBit PERM_ENTER = (1 << 16); // 0x00010000
+//constexpr PermissionBit PERM_ENTER = (1 << 16); // 0x00010000
// parcels, allow terraform, deprecated
-//const PermissionBit PERM_TERRAFORM = (1 << 17); // 0x00020000
+//constexpr PermissionBit PERM_TERRAFORM = (1 << 17); // 0x00020000
// NOTA BENE: This flag is NO LONGER USED!!! However, it is possible that some
// objects in the universe have it set so DON"T USE IT going forward.
-//const PermissionBit PERM_OWNER_DEBIT = (1 << 18); // 0x00040000
+//constexpr PermissionBit PERM_OWNER_DEBIT = (1 << 18); // 0x00040000
// objects, can grab/translate/rotate
-const PermissionBit PERM_MOVE = (1 << 19); // 0x00080000
+constexpr PermissionBit PERM_MOVE = (1 << 19); // 0x00080000
// parcels, avatars take damage, deprecated
//const PermissionBit PERM_DAMAGE = (1 << 20); // 0x00100000
// don't use bit 31 -- printf/scanf with "%x" assume signed numbers
-const PermissionBit PERM_RESERVED = ((U32)1) << 31;
+constexpr PermissionBit PERM_RESERVED = ((U32)1) << 31;
-const PermissionMask PERM_NONE = 0x00000000;
-const PermissionMask PERM_ALL = 0x7FFFFFFF;
-//const PermissionMask PERM_ALL_PARCEL = PERM_MODIFY | PERM_ENTER | PERM_TERRAFORM | PERM_DAMAGE;
-const PermissionMask PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
+constexpr PermissionMask PERM_NONE = 0x00000000;
+constexpr PermissionMask PERM_ALL = 0x7FFFFFFF;
+//constexpr PermissionMask PERM_ALL_PARCEL = PERM_MODIFY | PERM_ENTER | PERM_TERRAFORM | PERM_DAMAGE;
+constexpr PermissionMask PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
// Useful stuff for transmission.
// Which permissions field are we trying to change?
-const U8 PERM_BASE = 0x01;
+constexpr U8 PERM_BASE = 0x01;
// TODO: Add another PERM_OWNER operation type for allowOperationBy DK 04/03/06
-const U8 PERM_OWNER = 0x02;
-const U8 PERM_GROUP = 0x04;
-const U8 PERM_EVERYONE = 0x08;
-const U8 PERM_NEXT_OWNER = 0x10;
+constexpr U8 PERM_OWNER = 0x02;
+constexpr U8 PERM_GROUP = 0x04;
+constexpr U8 PERM_EVERYONE = 0x08;
+constexpr U8 PERM_NEXT_OWNER = 0x10;
// This is just a quickie debugging key
// no modify: PERM_ALL & ~PERM_MODIFY = 0x7fffbfff
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 9711729498..08605f7cf4 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -1017,7 +1017,7 @@ 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())
{
@@ -1052,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;
@@ -1117,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;
@@ -1165,10 +1165,10 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data)
}
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);
}
@@ -1247,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();
@@ -1328,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;
@@ -1611,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;
@@ -1642,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);
@@ -1670,7 +1670,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture()
return;
}
- LLFloater *floater = mFloaterProfileTextureHandle.get();
+ LLFloater* floater = mFloaterProfileTextureHandle.get();
if (!floater)
{
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
@@ -1765,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)
{
}