From 2fa1c42aadbe2a29e1bcced9a487c0e5abf0602b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 29 Mar 2012 23:48:29 -0700 Subject: CHUI-51 WIP notifications routig code cleanup phase 2, removal of extraneous signaling in favor of llnotificationchannels made notificationchannels work better with overrides and lifetime managed by creator --- indra/llcommon/llinstancetracker.h | 5 ++++- indra/llcommon/llrefcount.h | 19 +++++++++++++++++++ indra/llcommon/llthread.h | 17 +++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 34d841a4e0..11f582372e 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -43,7 +43,7 @@ * semantics: one instance per process, rather than one instance per module as * sometimes happens with data simply declared static. */ -class LL_COMMON_API LLInstanceTrackerBase : public boost::noncopyable +class LL_COMMON_API LLInstanceTrackerBase { protected: /// Get a process-unique void* pointer slot for the specified type_info @@ -209,6 +209,9 @@ protected: virtual const KEY& getKey() const { return mInstanceKey; } private: + LLInstanceTracker( const LLInstanceTracker& ); + const LLInstanceTracker& operator=( const LLInstanceTracker& ); + void add_(KEY key) { mInstanceKey = key; diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 8eb5d53f3f..32ae15435a 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -27,6 +27,7 @@ #define LLREFCOUNT_H #include +#include #define LL_REF_COUNT_DEBUG 0 #if LL_REF_COUNT_DEBUG @@ -86,4 +87,22 @@ private: #endif }; +/** + * intrusive pointer support + * this allows you to use boost::intrusive_ptr with any LLRefCount-derived type + */ +namespace boost +{ + inline void intrusive_ptr_add_ref(LLRefCount* p) + { + p->ref(); + } + + inline void intrusive_ptr_release(LLRefCount* p) + { + p->unref(); + } +}; + + #endif diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index b52e70ab2e..cf39696b4f 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -30,6 +30,7 @@ #include "llapp.h" #include "llapr.h" #include "apr_thread_cond.h" +#include "boost/intrusive_ptr.hpp" class LLThread; class LLMutex; @@ -266,6 +267,22 @@ private: S32 mRef; }; +/** + * intrusive pointer support for LLThreadSafeRefCount + * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type + */ +namespace boost +{ + inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) + { + p->ref(); + } + + inline void intrusive_ptr_release(LLThreadSafeRefCount* p) + { + p->unref(); + } +}; //============================================================================ // Simple responder for self destructing callbacks -- cgit v1.2.3 From 9b92235291382deac15b860efa281f625d2173dd Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 8 Jun 2012 01:08:58 +0300 Subject: CHUI-120 WIP Added conversations participants drag and drop from avatar lists to IM floaters. - Added new drag and drop type DAD_PERSON and source SOURCE_PEOPLE to avoid highliting the toolbars when using SOURCE_VIEWER. - Disabled calling card drop support as it is considered obsolete. --- indra/llcommon/llassettype.cpp | 1 + indra/llcommon/llassettype.h | 3 +++ indra/llcommon/stdenums.h | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 5e566d6c7c..5ae2df3994 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -95,6 +95,7 @@ LLAssetDictionary::LLAssetDictionary() addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "sym folder link", false, false, true)); addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, false, false)); addEntry(LLAssetType::AT_WIDGET, new AssetEntry("WIDGET", "widget", "widget", false, false, false)); + addEntry(LLAssetType::AT_PERSON, new AssetEntry("PERSON", "person", "person", false, false, false)); addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE, FALSE, FALSE)); }; diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index d538accbf7..69b01731e5 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -112,6 +112,9 @@ public: AT_WIDGET = 40, // UI Widget: this is *not* an inventory asset type, only a viewer side asset (e.g. button, other ui items...) + AT_PERSON = 45, + // A user uuid which is not an inventory asset type, used in viewer only for adding a person to a chat via drag and drop. + AT_MESH = 49, // Mesh data in our proprietary SLM format diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h index 40b3364b36..efcbe76795 100644 --- a/indra/llcommon/stdenums.h +++ b/indra/llcommon/stdenums.h @@ -51,7 +51,8 @@ enum EDragAndDropType DAD_LINK = 14, DAD_MESH = 15, DAD_WIDGET = 16, - DAD_COUNT = 17, // number of types in this enum + DAD_PERSON = 17, + DAD_COUNT = 18, // number of types in this enum }; // Reasons for drags to be denied. -- cgit v1.2.3 From 118e3b33bd417331397f89770d46b1b3eeeffc8e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 3 Aug 2012 17:43:48 -0700 Subject: CHUI-270 FIX Progress spinner not visible in merchant outbox --- indra/llcommon/llinitparam.cpp | 7 ++----- indra/llcommon/llinitparam.h | 10 +++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index 451b638a3f..89c831d296 100644 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp @@ -335,15 +335,12 @@ namespace LLInitParam { const std::string& top_name = name_stack_range.first->first; - ParamDescriptor::deserialize_func_t deserialize_func = NULL; - Param* paramp = NULL; - BlockDescriptor::param_map_t::iterator found_it = block_data.mNamedParams.find(top_name); if (found_it != block_data.mNamedParams.end()) { // find pointer to member parameter from offset table - paramp = getParamFromHandle(found_it->second->mParamHandle); - deserialize_func = found_it->second->mDeserializeFunc; + Param* paramp = getParamFromHandle(found_it->second->mParamHandle); + ParamDescriptor::deserialize_func_t deserialize_func = found_it->second->mDeserializeFunc; Parser::name_stack_range_t new_name_stack(name_stack_range.first, name_stack_range.second); ++new_name_stack.first; diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 2f767c234e..14ba8e0b43 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -2194,7 +2194,7 @@ namespace LLInitParam resetToDefault(); } return mValue.deserializeBlock(p, name_stack_range, new_name); - } + } void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const { @@ -2211,12 +2211,16 @@ namespace LLInitParam bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) { - if (overwrite) + if ((overwrite && source_provided) // new values coming in on top or... + || (!overwrite && !dst_provided)) // values being pushed under with nothing already there { + // clear away what is there and take the new stuff as a whole resetToDefault(); return mValue.mergeBlock(block_data, source.getValue(), overwrite); } - return false; + + + return mValue.mergeBlock(block_data, source.getValue(), overwrite); } bool validateBlock(bool emit_errors = true) const -- cgit v1.2.3 From a1a1410d25c3e4ff87e33344b416b7a827cdb1c2 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Mon, 27 Aug 2012 18:16:47 -0700 Subject: Skipping the realloc alignment test on Linux as the ll_aligned_malloc_16() function is not implemented to ensure alignment on Linux. --- indra/llcommon/llmemory.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 9dd776ff57..08e2a2caa6 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -65,6 +65,8 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size) // returned hunk MUST #elif defined(LL_DARWIN) return realloc(ptr,size); // default osx malloc is 16 byte aligned. #else + // The realloc alignment test is skipped on Linux because the ll_aligned_realloc_16() + // function is not implemented to ensure alignment (see alignment_test.cpp) return realloc(ptr,size); // FIXME not guaranteed to be aligned. #endif } -- cgit v1.2.3 From 5dc8738076d158aa74a93f7f3630a17d9102fdc4 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 10 Sep 2012 07:40:13 -0700 Subject: CHUI-283: Basic Implementation, just have hard coded avatar icon appearing and profile/info buttons visible. profile/info buttons do not have proper positioning or mouseclick events. --- indra/llcommon/llfoldertype.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/llcommon/llfoldertype.h (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h old mode 100644 new mode 100755 index a0c847914f..6b5ae572a9 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -89,7 +89,9 @@ public: FT_COUNT, - FT_NONE = -1 + FT_NONE = -1, + + FT_PROFILE = 58 }; static EType lookup(const std::string& type_name); -- cgit v1.2.3 From c6863d18d7c981756c57bbcd52baa06af00d1551 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 13 Sep 2012 19:10:28 -0700 Subject: CHUI-283: Now upon the information icon and speaker icon do not overlap the username text. Instead the username text will be truncated with an ellipse to prevent the overlap. Also did a code cleanup. --- indra/llcommon/llfoldertype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index 6b5ae572a9..609b550900 100755 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -91,7 +91,7 @@ public: FT_NONE = -1, - FT_PROFILE = 58 + FT_PROFILEXXXGGG = 58 }; static EType lookup(const std::string& type_name); -- cgit v1.2.3 From 3c8407f32cf947ee1631ed66bba7a676e8b3b670 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 18 Sep 2012 12:15:51 -0700 Subject: CHUI-283: Now the avatar icon loads in the user's avatar image.Also the avatar image is of proper size. The participant of the conversation is offset correctly as well. --- indra/llcommon/llfoldertype.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index 609b550900..a0c847914f 100755 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -89,9 +89,7 @@ public: FT_COUNT, - FT_NONE = -1, - - FT_PROFILEXXXGGG = 58 + FT_NONE = -1 }; static EType lookup(const std::string& type_name); -- cgit v1.2.3 From 3d5e24d135bd5d2636f075f9ef12ffba2129c61f Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Fri, 21 Sep 2012 17:32:28 -0700 Subject: Adding the CXX to each CMake project definition. --- indra/llcommon/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index dd7b8c6eb8..b29cd5bb53 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -1,7 +1,7 @@ # -*- cmake -*- -project(llcommon) +project(llcommon CXX) include(00-Common) include(LLCommon) -- cgit v1.2.3 From 0ca59987843cfcaedb12592b9466567ef421c4e8 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Wed, 3 Oct 2012 17:53:28 -0700 Subject: Backed out changeset: eb957fafe167 --- indra/llcommon/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index b29cd5bb53..dd7b8c6eb8 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -1,7 +1,7 @@ # -*- cmake -*- -project(llcommon CXX) +project(llcommon) include(00-Common) include(LLCommon) -- cgit v1.2.3 From 3a49beed0e96a797a6d663bcae5e932437ca3661 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Dec 2012 20:25:46 -0800 Subject: CHUI-580 : WIP : Change the display name cache system, deprecating the old protocol and using the cap (People API) whenever available. Still has occurence of Resident as last name to clean up. --- indra/llcommon/llavatarname.cpp | 69 +++++++++++++++++++++++++++++++++++++++-- indra/llcommon/llavatarname.h | 57 ++++++++++++++++++++++++---------- 2 files changed, 108 insertions(+), 18 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 3206843bf4..b49e6a7aac 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -30,6 +30,7 @@ #include "llavatarname.h" #include "lldate.h" +#include "llframetimer.h" #include "llsd.h" // Store these in pre-built std::strings to avoid memory allocations in @@ -42,6 +43,8 @@ static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); +bool LLAvatarName::sUseDisplayNames = true; + LLAvatarName::LLAvatarName() : mUsername(), mDisplayName(), @@ -61,6 +64,17 @@ bool LLAvatarName::operator<(const LLAvatarName& rhs) const return mUsername < rhs.mUsername; } +//static +void LLAvatarName::setUseDisplayNames(bool use) +{ + sUseDisplayNames = use; +} +//static +bool LLAvatarName::useDisplayNames() +{ + return sUseDisplayNames; +} + LLSD LLAvatarName::asLLSD() const { LLSD sd; @@ -85,6 +99,33 @@ void LLAvatarName::fromLLSD(const LLSD& sd) mExpires = expires.secondsSinceEpoch(); LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE]; mNextUpdate = next_update.secondsSinceEpoch(); + + // Some avatars don't have explicit display names set. Force a legible display name here. + if (mDisplayName.empty()) + { + mDisplayName = mUsername; + } +} + +void LLAvatarName::fromString(const std::string& full_name, F64 expires) +{ + mDisplayName = full_name; + std::string::size_type index = full_name.find(' '); + if (index != std::string::npos) + { + mLegacyFirstName = full_name.substr(0, index); + mLegacyLastName = full_name.substr(index+1); + mUsername = mLegacyFirstName + " " + mLegacyLastName; + } + else + { + mLegacyFirstName = full_name; + mLegacyLastName = ""; + mUsername = full_name; + } + mIsDisplayNameDefault = true; + mIsTemporaryName = true; + mExpires = LLFrameTimer::getTotalSeconds() + expires; } std::string LLAvatarName::getCompleteName() const @@ -104,9 +145,22 @@ std::string LLAvatarName::getCompleteName() const return name; } -std::string LLAvatarName::getLegacyName() const +std::string LLAvatarName::getDisplayName() const +{ + if (sUseDisplayNames) + { + return mDisplayName; + } + else + { + return getUserName(); + } +} + +std::string LLAvatarName::getUserName() const { - if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled? + // If we cannot create a user name from the legacy strings, use the display name + if (mLegacyFirstName.empty() && mLegacyLastName.empty()) { return mDisplayName; } @@ -118,3 +172,14 @@ std::string LLAvatarName::getLegacyName() const name += mLegacyLastName; return name; } + +void LLAvatarName::dump() const +{ + llinfos << "Merov debug : display = " << mDisplayName << ", user = " << mUsername << ", complete = " << getCompleteName() << ", legacy = " << getUserName() << " first = " << mLegacyFirstName << " last = " << mLegacyLastName << llendl; + LL_DEBUGS("AvNameCache") << "LLAvatarName: " + << "user '" << mUsername << "' " + << "display '" << mDisplayName << "' " + << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" + << LL_ENDL; +} + diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index ba258d6d52..cf9eb27b03 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -43,19 +43,50 @@ public: void fromLLSD(const LLSD& sd); + // Used only in legacy mode when the display name capability is not provided server side + void fromString(const std::string& full_name, F64 expires = 0.0f); + + static void setUseDisplayNames(bool use); + static bool useDisplayNames(); + + // Name is valid if not temporary and not yet expired + bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); } + + // + bool isDisplayNameDefault() const { return mIsDisplayNameDefault; } + // For normal names, returns "James Linden (james.linden)" // When display names are disabled returns just "James Linden" std::string getCompleteName() const; - - // Returns "James Linden" or "bobsmith123 Resident" for backwards - // compatibility with systems like voice and muting - // *TODO: Eliminate this in favor of username only - std::string getLegacyName() const; - + + // "José Sanchez" or "James Linden", UTF-8 encoded Unicode + // Takes the display name preference into account. This is truly the name that should + // be used for all UI where an avatar name has to be used unless we truly want something else (rare) + std::string getDisplayName() const; + + // Returns "James Linden" or "bobsmith123 Resident" + // Used where we explicitely prefer or need a non UTF-8 legacy (ASCII) name + // Also used for backwards compatibility with systems like voice and muting + std::string getUserName() const; + + // Debug print of the object + void dump() const; + + // Names can change, so need to keep track of when name was + // last checked. + // Unix time-from-epoch seconds for efficiency + F64 mExpires; + + // You can only change your name every N hours, so record + // when the next update is allowed + // Unix time-from-epoch seconds + F64 mNextUpdate; + +private: // "bobsmith123" or "james.linden", US-ASCII only std::string mUsername; - // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode + // "José Sanchez" or "James Linden", UTF-8 encoded Unicode // Contains data whether or not user has explicitly set // a display name; may duplicate their username. std::string mDisplayName; @@ -81,15 +112,9 @@ public: // shown in UI, but are not serialized. bool mIsTemporaryName; - // Names can change, so need to keep track of when name was - // last checked. - // Unix time-from-epoch seconds for efficiency - F64 mExpires; - - // You can only change your name every N hours, so record - // when the next update is allowed - // Unix time-from-epoch seconds - F64 mNextUpdate; + // Global flag indicating if display name should be used or not + // This will affect the output of the high level "get" methods + static bool sUseDisplayNames; }; #endif -- cgit v1.2.3 From bb322a1cccd3fab28951ad4e11b5edcfc4e48140 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Dec 2012 00:10:50 -0800 Subject: CHUI-580 : Fixed : Clean up the use of display name. Allow the use of the legacy protocol in settings.xml --- indra/llcommon/llavatarname.cpp | 75 +++++++++++++++++++++++++++++++---------- indra/llcommon/llavatarname.h | 13 ++++--- 2 files changed, 66 insertions(+), 22 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index b49e6a7aac..95ecce509b 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -45,6 +45,12 @@ static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); bool LLAvatarName::sUseDisplayNames = true; +// Minimum time-to-live (in seconds) for a name entry. +// Avatar name should always guarantee to expire reasonably soon by default +// so if the failure to get a valid expiration time was due to something temporary +// we will eventually request and get the right data. +const F64 MIN_ENTRY_LIFETIME = 60.0; + LLAvatarName::LLAvatarName() : mUsername(), mDisplayName(), @@ -107,40 +113,67 @@ void LLAvatarName::fromLLSD(const LLSD& sd) } } -void LLAvatarName::fromString(const std::string& full_name, F64 expires) +// Transform a string (typically provided by the legacy service) into a decent +// avatar name instance. +void LLAvatarName::fromString(const std::string& full_name) { mDisplayName = full_name; std::string::size_type index = full_name.find(' '); if (index != std::string::npos) { + // The name is in 2 parts (first last) mLegacyFirstName = full_name.substr(0, index); mLegacyLastName = full_name.substr(index+1); - mUsername = mLegacyFirstName + " " + mLegacyLastName; + if (mLegacyLastName != "Resident") + { + mUsername = mLegacyFirstName + "." + mLegacyLastName; + mDisplayName = full_name; + LLStringUtil::toLower(mUsername); + } + else + { + // Very old names do have a dummy "Resident" last name + // that we choose to hide from users. + mUsername = mLegacyFirstName; + mDisplayName = mLegacyFirstName; + } } else { mLegacyFirstName = full_name; mLegacyLastName = ""; mUsername = full_name; + mDisplayName = full_name; } mIsDisplayNameDefault = true; mIsTemporaryName = true; + setExpires(MIN_ENTRY_LIFETIME); +} + +void LLAvatarName::setExpires(F64 expires) +{ mExpires = LLFrameTimer::getTotalSeconds() + expires; } std::string LLAvatarName::getCompleteName() const { std::string name; - if (mUsername.empty() || mIsDisplayNameDefault) - // If the display name feature is off - // OR this particular display name is defaulted (i.e. based on user name), - // then display only the easier to read instance of the person's name. + if (sUseDisplayNames) { - name = mDisplayName; + if (mUsername.empty() || mIsDisplayNameDefault) + { + // If this particular display name is defaulted (i.e. based on user name), + // then display only the easier to read instance of the person's name. + name = mDisplayName; + } + else + { + name = mDisplayName + " (" + mUsername + ")"; + } } else { - name = mDisplayName + " (" + mUsername + ")"; + name = getUserName(); } return name; } @@ -159,23 +192,29 @@ std::string LLAvatarName::getDisplayName() const std::string LLAvatarName::getUserName() const { - // If we cannot create a user name from the legacy strings, use the display name - if (mLegacyFirstName.empty() && mLegacyLastName.empty()) + std::string name; + if (mLegacyLastName.empty() || (mLegacyLastName == "Resident")) { - return mDisplayName; + if (mLegacyFirstName.empty()) + { + // If we cannot create a user name from the legacy strings, use the display name + name = mDisplayName; + } + else + { + // The last name might be empty if it defaulted to "Resident" + name = mLegacyFirstName; + } + } + else + { + name = mLegacyFirstName + " " + mLegacyLastName; } - - std::string name; - name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() ); - name = mLegacyFirstName; - name += " "; - name += mLegacyLastName; return name; } void LLAvatarName::dump() const { - llinfos << "Merov debug : display = " << mDisplayName << ", user = " << mUsername << ", complete = " << getCompleteName() << ", legacy = " << getUserName() << " first = " << mLegacyFirstName << " last = " << mLegacyLastName << llendl; LL_DEBUGS("AvNameCache") << "LLAvatarName: " << "user '" << mUsername << "' " << "display '" << mDisplayName << "' " diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index cf9eb27b03..2f8c534974 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -39,20 +39,25 @@ public: bool operator<(const LLAvatarName& rhs) const; + // Conversion to and from LLSD (cache file or server response) LLSD asLLSD() const; - void fromLLSD(const LLSD& sd); // Used only in legacy mode when the display name capability is not provided server side - void fromString(const std::string& full_name, F64 expires = 0.0f); + // or to otherwise create a temporary valid item. + void fromString(const std::string& full_name); + // Set the name object to become invalid in "expires" seconds from now + void setExpires(F64 expires); + + // Set and get the display name flag set by the user in preferences. static void setUseDisplayNames(bool use); static bool useDisplayNames(); - // Name is valid if not temporary and not yet expired + // A name object is valid if not temporary and not yet expired (default is expiration not checked) bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); } - // + // Return true if the name is made up from legacy or temporary data bool isDisplayNameDefault() const { return mIsDisplayNameDefault; } // For normal names, returns "James Linden (james.linden)" -- cgit v1.2.3 From 08cc82ec483fab8299d52ba979f04df95e525acb Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 13 Dec 2012 22:45:47 -0800 Subject: CHUI-599 : Fixed : Avatar name provides now a method to get the regular account name. --- indra/llcommon/llavatarname.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 2f8c534974..4827353018 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -74,6 +74,9 @@ public: // Also used for backwards compatibility with systems like voice and muting std::string getUserName() const; + // Returns "james.linden" or the legacy name for very old names + std::string getAccountName() const { return mUsername; } + // Debug print of the object void dump() const; -- cgit v1.2.3 From c7cac7896ee4ccdd71dad432f1314b85987e78cf Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 13 Feb 2013 20:44:38 +0200 Subject: CHUI-739 Fixed! FUI toolbars not displayed when switching between CHUI and release viewer : parsing declare values of Enums --- indra/llcommon/llinitparam.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 75c87c4bdb..695403e3f4 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -439,7 +439,7 @@ namespace LLInitParam {} void operator ()(const std::string& name) - { + { *this = name; } @@ -516,14 +516,30 @@ namespace LLInitParam { static bool read(T& param, Parser* parser) { - // read all enums as ints + std::string value_string; + //TypeValues::value_t v; + + // trying to get the declare value + parser_read_func_map_t::iterator string_func = parser->mParserReadFuncs->find(&typeid(std::string)); + if (string_func != parser->mParserReadFuncs->end()) + { + if (string_func->second(*parser, (void*)&value_string)) + { + if (TypeValues::getValueFromName(value_string, param)) + { + return true; + } + } + } + + // read enums as ints if it not declared as string parser_read_func_map_t::iterator found_it = parser->mParserReadFuncs->find(&typeid(S32)); if (found_it != parser->mParserReadFuncs->end()) { - S32 value; - if (found_it->second(*parser, (void*)&value)) + S32 value_S32; + if (found_it->second(*parser, (void*)&value_S32)) { - param = (T)value; + param = (T)value_S32; return true; } } -- cgit v1.2.3 From 638d94eef75799d47f8b913e0909b4079e55c03b Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 14 Feb 2013 18:51:13 +0200 Subject: CHUI-739 : Clean up : FUI toolbars not displayed when switching between CHUI and release viewer --- indra/llcommon/llinitparam.h | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 695403e3f4..eb4d84d835 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -517,7 +517,6 @@ namespace LLInitParam static bool read(T& param, Parser* parser) { std::string value_string; - //TypeValues::value_t v; // trying to get the declare value parser_read_func_map_t::iterator string_func = parser->mParserReadFuncs->find(&typeid(std::string)); -- cgit v1.2.3 From 45849294cefd33c4875b5fe5b3fc8f04745452cf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 18 Feb 2013 20:30:22 -0800 Subject: CHUI-739 FIX FUI toolbars not displayed when switching between CHUI and release viewer param blocks no longer write enums as ints --- indra/llcommon/llinitparam.h | 94 +++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 59 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 75c87c4bdb..66aac4f549 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -485,62 +485,6 @@ namespace LLInitParam typedef std::map parser_write_func_map_t; typedef std::map parser_inspect_func_map_t; - private: - template::value> - struct ReaderWriter - { - static bool read(T& param, Parser* parser) - { - parser_read_func_map_t::iterator found_it = parser->mParserReadFuncs->find(&typeid(T)); - if (found_it != parser->mParserReadFuncs->end()) - { - return found_it->second(*parser, (void*)¶m); - } - return false; - } - - static bool write(const T& param, Parser* parser, name_stack_t& name_stack) - { - parser_write_func_map_t::iterator found_it = parser->mParserWriteFuncs->find(&typeid(T)); - if (found_it != parser->mParserWriteFuncs->end()) - { - return found_it->second(*parser, (const void*)¶m, name_stack); - } - return false; - } - }; - - // read enums as ints - template - struct ReaderWriter - { - static bool read(T& param, Parser* parser) - { - // read all enums as ints - parser_read_func_map_t::iterator found_it = parser->mParserReadFuncs->find(&typeid(S32)); - if (found_it != parser->mParserReadFuncs->end()) - { - S32 value; - if (found_it->second(*parser, (void*)&value)) - { - param = (T)value; - return true; - } - } - return false; - } - - static bool write(const T& param, Parser* parser, name_stack_t& name_stack) - { - parser_write_func_map_t::iterator found_it = parser->mParserWriteFuncs->find(&typeid(S32)); - if (found_it != parser->mParserWriteFuncs->end()) - { - return found_it->second(*parser, (const void*)¶m, name_stack); - } - return false; - } - }; - public: Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) @@ -552,14 +496,46 @@ namespace LLInitParam virtual ~Parser(); - template bool readValue(T& param) + template bool readValue(T& param, typename boost::disable_if >::type* dummy = 0) { - return ReaderWriter::read(param, this); + parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); + if (found_it != mParserReadFuncs->end()) + { + return found_it->second(*this, (void*)¶m); + } + + return false; } + template bool readValue(T& param, typename boost::enable_if >::type* dummy = 0) + { + parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); + if (found_it != mParserReadFuncs->end()) + { + return found_it->second(*this, (void*)¶m); + } + else + { + found_it = mParserReadFuncs->find(&typeid(S32)); + if (found_it != mParserReadFuncs->end()) + { + S32 int_value; + bool parsed = found_it->second(*this, (void*)&int_value); + param = (T)int_value; + return parsed; + } + } + return false; + } + template bool writeValue(const T& param, name_stack_t& name_stack) { - return ReaderWriter::write(param, this, name_stack); + parser_write_func_map_t::iterator found_it = mParserWriteFuncs->find(&typeid(T)); + if (found_it != mParserWriteFuncs->end()) + { + return found_it->second(*this, (const void*)¶m, name_stack); + } + return false; } // dispatch inspection to registered inspection functions, for each parameter in a param block -- cgit v1.2.3 From 9ebe7db402af546211b65faf43d1635f3b92937e Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 25 Feb 2013 17:29:15 -0500 Subject: increment minor version: 3.5.0 --- indra/llcommon/llversionviewer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 6a5ff314e4..1554e9e665 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -28,8 +28,8 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 3; -const S32 LL_VERSION_MINOR = 4; -const S32 LL_VERSION_PATCH = 6; +const S32 LL_VERSION_MINOR = 5; +const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3