Fix formatting and add some more constexpr

master
Ansariel 2024-08-21 14:15:07 +02:00 committed by Andrey Kleshchev
parent db84bf9567
commit 40e93e9f4d
2 changed files with 47 additions and 43 deletions

View File

@ -37,48 +37,48 @@ typedef U32 PermissionBit;
// Do you have permission to transfer ownership of the object or // Do you have permission to transfer ownership of the object or
// item. Fair use rules dictate that if you cannot copy, you can // item. Fair use rules dictate that if you cannot copy, you can
// always transfer. // always transfer.
const PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000 constexpr PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000
// objects, scale or change textures // objects, scale or change textures
// parcels, allow building on it // parcels, allow building on it
const PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000 constexpr PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000
// objects, allow copy // objects, allow copy
const PermissionBit PERM_COPY = (1 << 15); // 0x00008000 constexpr PermissionBit PERM_COPY = (1 << 15); // 0x00008000
// parcels, allow entry, deprecated // parcels, allow entry, deprecated
//const PermissionBit PERM_ENTER = (1 << 16); // 0x00010000 //constexpr PermissionBit PERM_ENTER = (1 << 16); // 0x00010000
// parcels, allow terraform, deprecated // 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 // 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. // 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 // objects, can grab/translate/rotate
const PermissionBit PERM_MOVE = (1 << 19); // 0x00080000 constexpr PermissionBit PERM_MOVE = (1 << 19); // 0x00080000
// parcels, avatars take damage, deprecated // parcels, avatars take damage, deprecated
//const PermissionBit PERM_DAMAGE = (1 << 20); // 0x00100000 //const PermissionBit PERM_DAMAGE = (1 << 20); // 0x00100000
// don't use bit 31 -- printf/scanf with "%x" assume signed numbers // 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; constexpr PermissionMask PERM_NONE = 0x00000000;
const PermissionMask PERM_ALL = 0x7FFFFFFF; constexpr PermissionMask PERM_ALL = 0x7FFFFFFF;
//const PermissionMask PERM_ALL_PARCEL = PERM_MODIFY | PERM_ENTER | PERM_TERRAFORM | PERM_DAMAGE; //constexpr 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_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
// Useful stuff for transmission. // Useful stuff for transmission.
// Which permissions field are we trying to change? // 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 // TODO: Add another PERM_OWNER operation type for allowOperationBy DK 04/03/06
const U8 PERM_OWNER = 0x02; constexpr U8 PERM_OWNER = 0x02;
const U8 PERM_GROUP = 0x04; constexpr U8 PERM_GROUP = 0x04;
const U8 PERM_EVERYONE = 0x08; constexpr U8 PERM_EVERYONE = 0x08;
const U8 PERM_NEXT_OWNER = 0x10; constexpr U8 PERM_NEXT_OWNER = 0x10;
// This is just a quickie debugging key // This is just a quickie debugging key
// no modify: PERM_ALL & ~PERM_MODIFY = 0x7fffbfff // no modify: PERM_ALL & ~PERM_MODIFY = 0x7fffbfff

View File

@ -1017,7 +1017,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
setDescriptionText(avatar_data->about_text); setDescriptionText(avatar_data->about_text);
mSecondLifePic->setValue(avatar_data->image_id); mSecondLifePic->setValue(avatar_data->image_id);
if (getSelfProfile()) if (getSelfProfile())
{ {
@ -1052,7 +1052,7 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data
std::string caption_text = getString("CaptionTextAcctInfo", args); std::string caption_text = getString("CaptionTextAcctInfo", args);
getChild<LLUICtrl>("account_info")->setValue(caption_text); getChild<LLUICtrl>("account_info")->setValue(caption_text);
const S32 LINDEN_EMPLOYEE_INDEX = 3; constexpr S32 LINDEN_EMPLOYEE_INDEX = 3;
LLDate sl_release; LLDate sl_release;
sl_release.fromYMDHMS(2003, 6, 23, 0, 0, 0); sl_release.fromYMDHMS(2003, 6, 23, 0, 0, 0);
std::string customer_lower = avatar_data->customer_type; 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 true - we are viewing friend's profile, enable check boxes and set values.
if (relation) if (relation)
{ {
S32 rights = relation->getRightsGrantedTo(); const S32 rights = relation->getRightsGrantedTo();
bool can_see_online = LLRelationship::GRANT_ONLINE_STATUS & rights; bool can_see_online = LLRelationship::GRANT_ONLINE_STATUS & rights;
bool can_see_on_map = LLRelationship::GRANT_MAP_LOCATION & rights; bool can_see_on_map = LLRelationship::GRANT_MAP_LOCATION & rights;
bool can_edit_objects = LLRelationship::GRANT_MODIFY_OBJECTS & rights; bool can_edit_objects = LLRelationship::GRANT_MODIFY_OBJECTS & rights;
@ -1165,10 +1165,10 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data)
} }
else else
{ {
std::string register_date = getString("age_format"); std::string register_date = getString("age_format");
LLSD args_age; LLSD args_age;
args_age["[AGE]"] = LLDateUtil::ageFromDate(avatar_data->born_on, LLDate::now()); 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); userAgeCtrl->setValue(register_date);
} }
@ -1247,7 +1247,7 @@ void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id)
void LLPanelProfileSecondLife::updateOnlineStatus() void LLPanelProfileSecondLife::updateOnlineStatus()
{ {
const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
if (relationship != NULL) if (relationship)
{ {
// For friend let check if he allowed me to see his status // For friend let check if he allowed me to see his status
bool online = relationship->isOnline(); bool online = relationship->isOnline();
@ -1328,7 +1328,7 @@ void LLProfileImagePicker::notify(const std::vector<std::string>& filenames)
// generate a temp texture file for coroutine // generate a temp texture file for coroutine
std::string temp_file = gDirUtilp->getTempFilename(); std::string temp_file = gDirUtilp->getTempFilename();
U32 codec = LLImageBase::getCodecFromExtension(gDirUtilp->getExtension(file_path)); 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)) if (!LLViewerTextureList::createUploadFile(file_path, temp_file, codec, MAX_DIM))
{ {
LLSD notif_args; LLSD notif_args;
@ -1611,12 +1611,12 @@ void LLPanelProfileSecondLife::onShowInSearchCallback()
if (value == mAllowPublish) if (value == mAllowPublish)
return; return;
mAllowPublish = value; mAllowPublish = value;
saveAgentUserInfoCoro("allow_publish", value); saveAgentUserInfoCoro("allow_publish", value);
} }
void LLPanelProfileSecondLife::onHideAgeCallback() void LLPanelProfileSecondLife::onHideAgeCallback()
{ {
bool value = mHideAgeCombo->getValue().asInteger(); bool value = mHideAgeCombo->getValue().asInteger();
if (value == mHideAge) if (value == mHideAge)
return; return;
@ -1642,7 +1642,7 @@ void LLPanelProfileSecondLife::onDiscardDescriptionChanges()
void LLPanelProfileSecondLife::onShowAgentPermissionsDialog() void LLPanelProfileSecondLife::onShowAgentPermissionsDialog()
{ {
LLFloater *floater = mFloaterPermissionsHandle.get(); LLFloater* floater = mFloaterPermissionsHandle.get();
if (!floater) if (!floater)
{ {
LLFloater* parent_floater = gFloaterView->getParentFloater(this); LLFloater* parent_floater = gFloaterView->getParentFloater(this);
@ -1670,7 +1670,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture()
return; return;
} }
LLFloater *floater = mFloaterProfileTextureHandle.get(); LLFloater* floater = mFloaterProfileTextureHandle.get();
if (!floater) if (!floater)
{ {
LLFloater* parent_floater = gFloaterView->getParentFloater(this); LLFloater* parent_floater = gFloaterView->getParentFloater(this);
@ -1765,43 +1765,47 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id)
if (mSecondLifePic->getImageAssetId() == id) if (mSecondLifePic->getImageAssetId() == id)
return; 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) // Should trigger callbacks in icon controls (or request Legacy)
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID);
} }
}; };
if (!saveAgentUserInfoCoro("sl_image_id", id, callback)) if (!saveAgentUserInfoCoro("sl_image_id", id, callback))
return; return;
mSecondLifePic->setValue(id); mSecondLifePic->setValue(id);
LLFloater *floater = mFloaterProfileTextureHandle.get(); LLFloater* floater = mFloaterProfileTextureHandle.get();
if (floater) if (floater)
{
LLFloaterProfileTexture* texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
if (texture_view)
{ {
LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); if (id.isNull())
if (id == LLUUID::null)
{ {
texture_view->resetAsset(); texture_view->resetAsset();
} }
else else
{ {
texture_view->loadAsset(id); texture_view->loadAsset(id);
} }
} }
} }
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// LLPanelProfileWeb // LLPanelProfileWeb
LLPanelProfileWeb::LLPanelProfileWeb() LLPanelProfileWeb::LLPanelProfileWeb()
: LLPanelProfileTab() : LLPanelProfileTab()
, mWebBrowser(NULL) , mWebBrowser(nullptr)
, mAvatarNameCacheConnection() , mAvatarNameCacheConnection()
, mFirstNavigate(false)
{ {
} }