diff options
author | Merov Linden <merov@lindenlab.com> | 2012-11-03 20:44:00 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-11-03 20:44:00 -0700 |
commit | 7c7cc56b037f05f148a7215d0c5f567989a0c012 (patch) | |
tree | 11afb3864d36de63ccd2b1dffa7ba2daebd82e9f | |
parent | b6ad7db0d61033425a4f65270731023afe74ecce (diff) | |
parent | 3b39ec165aa837d02bf1bf57ff8f3aab3229659c (diff) |
Pull merge from richard/viewer-chui
37 files changed, 484 insertions, 301 deletions
@@ -325,7 +325,15 @@ fba99f381b8d4ad1b7b42fa4993b29998d95be18 DRTVWR-179 173c2809f9873499c4b9d6bc044ec941c954d3fb DRTVWR-228 1dc94555582f52718834081e7659e973ae4521f7 3.4.1-beta8 52c164c8023a5e65f3dc1b0bbb7fa1dd0c631b6b DRTVWR-231 -9c4519aa5c70f7560111fb5c740d3a7dc20a845a 3.4.1-beta9 464cf7a63a9a2f95bc4972dc022ca765e93de7d3 DRTVWR-233 -9c4519aa5c70f7560111fb5c740d3a7dc20a845a 3.4.1-beta9 637fe8bbee5e24940448198c221d5ee0fa3247b4 3.4.1-beta9 +4e0d84e92132e9e95a1d52a1e49bad69c278ea05 3.4.1-beta10 +f7cbd60a3f57ff1101157eeb79ea21e8898bedae DRTVWR-235 +baf97f06ae17223614c5e31aa42e71d87cff07fe DRTVWR-236 +18498afcdb835d6fc4d36ed935347d3b65307bad 3.4.1-beta11 +b2f21e3442542283a80e7eaebae9f833e5a927b6 DRTVWR-237 +853a202426398cb0b7676aa498603a25d8ad20fb 3.4.1-beta12 +853a202426398cb0b7676aa498603a25d8ad20fb 3.4.1-beta12 +b6b68f3c2c6dd04ad88bd0575aad67bf87a9c108 3.4.1-beta12 +b6b68f3c2c6dd04ad88bd0575aad67bf87a9c108 3.4.1-beta12 +3f9be82de642d468c5fc272cb9d96b46b5498402 3.4.1-beta12 diff --git a/BuildParams b/BuildParams index dbf7a4cbc4..32b738cfdf 100644 --- a/BuildParams +++ b/BuildParams @@ -3,6 +3,7 @@ # Please refer to: # https://wiki.secondlife.com/wiki/Automated_Build_System + # Global setting for now... Darwin.symbolfiles = "newview/Release/secondlife-symbols-darwin.tar.bz2" CYGWIN.symbolfiles = "newview/Release/secondlife-symbols-windows.tar.bz2" @@ -20,8 +21,13 @@ email_status_this_is_os = true # Limit extent of codeticket updates to revisions after... codeticket_since = 3.3.0-release +clean_on_success = false +run_tests = false +build_Darwin_Debug = false +build_Darwin_RelWithDebInfo = false + # ======================================== -# Viewer Development +# Viewer Development -- # ======================================== # Report changes since... diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 00baf626d2..666c94af86 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -199,7 +199,7 @@ if (DARWIN) add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE) set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}") - set(DARWIN_extra_cstar_flags "-mlong-branch") + set(DARWIN_extra_cstar_flags "-mlong-branch -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DARWIN_extra_cstar_flags}") # NOTE: it's critical that the optimization flag is put in front. diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake index 73b3642ae6..09501e0406 100644 --- a/indra/cmake/GooglePerfTools.cmake +++ b/indra/cmake/GooglePerfTools.cmake @@ -3,7 +3,7 @@ include(Prebuilt) # If you want to enable or disable TCMALLOC in viewer builds, this is the place. # set ON or OFF as desired. -set (USE_TCMALLOC OFF) +set (USE_TCMALLOC ON) if (STANDALONE) include(FindGooglePerfTools) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index c3f6f7de2a..4ac1e55cfc 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -78,7 +78,7 @@ public: typedef LLOctreeTraveler<T> oct_traveler; typedef LLTreeTraveler<T> tree_traveler; - typedef LLPointer<T>* element_list; + typedef std::vector<LLPointer<T> > element_list; typedef LLPointer<T>* element_iter; typedef const LLPointer<T>* const_element_iter; typedef typename std::vector<LLTreeListener<T>*>::iterator tree_listener_iter; @@ -106,8 +106,9 @@ public: : mParent((oct_node*)parent), mOctant(octant) { - mData = NULL; - mDataEnd = NULL; + //always keep a NULL terminated list to avoid out of bounds exceptions in debug builds + mData.push_back(NULL); + mDataEnd = &mData[0]; mCenter = center; mSize = size; @@ -133,9 +134,9 @@ public: mData[i] = NULL; } - free(mData); - mData = NULL; - mDataEnd = NULL; + mData.clear(); + mData.push_back(NULL); + mDataEnd = &mData[0]; for (U32 i = 0; i < getChildCount(); i++) { @@ -239,9 +240,9 @@ public: bool isEmpty() const { return mElementCount == 0; } element_list& getData() { return mData; } const element_list& getData() const { return mData; } - element_iter getDataBegin() { return mData; } + element_iter getDataBegin() { return &mData[0]; } element_iter getDataEnd() { return mDataEnd; } - const_element_iter getDataBegin() const { return mData; } + const_element_iter getDataBegin() const { return &mData[0]; } const_element_iter getDataEnd() const { return mDataEnd; } U32 getChildCount() const { return mChildCount; } @@ -321,14 +322,10 @@ public: if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) || (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))) { //it belongs here + mData.push_back(NULL); + mData[mElementCount] = data; mElementCount++; - mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); - - //avoid unref on uninitialized memory - memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>)); - - mData[mElementCount-1] = data; - mDataEnd = mData + mElementCount; + mDataEnd = &mData[mElementCount]; data->setBinIndex(mElementCount-1); BaseType::insert(data); return true; @@ -364,14 +361,10 @@ public: if( lt == 0x7 ) { + mData.push_back(NULL); + mData[mElementCount] = data; mElementCount++; - mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); - - //avoid unref on uninitialized memory - memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>)); - - mData[mElementCount-1] = data; - mDataEnd = mData + mElementCount; + mDataEnd = &mData[mElementCount]; data->setBinIndex(mElementCount-1); BaseType::insert(data); return true; @@ -436,16 +429,15 @@ public: mData[i]->setBinIndex(i); } - mData[mElementCount] = NULL; //needed for unref - mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); - mDataEnd = mData+mElementCount; + mData[mElementCount] = NULL; + mData.pop_back(); + mDataEnd = &mData[mElementCount]; } else { - mData[0] = NULL; //needed for unref - free(mData); - mData = NULL; - mDataEnd = NULL; + mData.clear(); + mData.push_back(NULL); + mDataEnd = &mData[0]; } notifyRemoval(data); @@ -491,7 +483,7 @@ public: } //node is now root - llwarns << "!!! OCTREE REMOVING FACE BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl; + llwarns << "!!! OCTREE REMOVING ELEMENT BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl; node->removeByAddress(data); llassert(data->getBinIndex() == -1); return true; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 58b17f74a8..8f7d4afb1b 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -725,7 +725,27 @@ void LLFloater::closeFloater(bool app_quitting) make_ui_sound("UISndWindowClose"); } - //If floater is a dependent, remove it from parent (dependee) + gFocusMgr.clearLastFocusForGroup(this); + + if (hasFocus()) + { + // Do this early, so UI controls will commit before the + // window is taken down. + releaseFocus(); + + // give focus to dependee floater if it exists, and we had focus first + if (isDependent()) + { + LLFloater* dependee = mDependeeHandle.get(); + if (dependee && !dependee->isDead()) + { + dependee->setFocus(TRUE); + } + } + } + + + //If floater is a dependent, remove it from parent (dependee) LLFloater* dependee = mDependeeHandle.get(); if (dependee) { @@ -750,24 +770,6 @@ void LLFloater::closeFloater(bool app_quitting) } cleanupHandles(); - gFocusMgr.clearLastFocusForGroup(this); - - if (hasFocus()) - { - // Do this early, so UI controls will commit before the - // window is taken down. - releaseFocus(); - - // give focus to dependee floater if it exists, and we had focus first - if (isDependent()) - { - LLFloater* dependee = mDependeeHandle.get(); - if (dependee && !dependee->isDead()) - { - dependee->setFocus(TRUE); - } - } - } dirtyRect(); diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index b289581dc2..c5231c4f08 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1838,7 +1838,7 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) } if( !handled ) { - if(mIndentation < x && x < mIndentation + mArrowSize + mTextPad) + if(mIndentation < x && x < mIndentation + (isMinimized() ? 0 : mArrowSize) + mTextPad) { toggleOpen(); handled = TRUE; @@ -1862,7 +1862,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) } if( !handled ) { - if(mIndentation < x && x < mIndentation + mArrowSize + mTextPad) + if(mIndentation < x && x < mIndentation + (isMinimized() ? 0 : mArrowSize) + mTextPad) { // don't select when user double-clicks plus sign // so as not to contradict single-click behavior diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 19a6b0a44a..7e37e06064 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -289,6 +289,7 @@ protected: friend class LLUICtrlFactory; void updateLabelRotation(); + virtual bool isMinimized() { return FALSE; } public: typedef std::list<LLFolderViewItem*> items_t; diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index fdd45bd76f..929b7da081 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1787,22 +1787,18 @@ std::ostream& operator<<(std::ostream& s, const LLNotification& notification) return s; } -//static -void LLPostponedNotification::lookupName(LLPostponedNotification* thiz, - const LLUUID& id, +void LLPostponedNotification::lookupName(const LLUUID& id, bool is_group) { if (is_group) { gCacheName->getGroup(id, boost::bind(&LLPostponedNotification::onGroupNameCache, - thiz, _1, _2, _3)); + this, _1, _2, _3)); } else { - LLAvatarNameCache::get(id, - boost::bind(&LLPostponedNotification::onAvatarNameCache, - thiz, _1, _2)); + fetchAvatarName(id); } } @@ -1813,6 +1809,20 @@ void LLPostponedNotification::onGroupNameCache(const LLUUID& id, finalizeName(full_name); } +void LLPostponedNotification::fetchAvatarName(const LLUUID& id) +{ + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + if (id.notNull()) + { + mAvatarNameCacheConnection = LLAvatarNameCache::get(id, + boost::bind(&LLPostponedNotification::onAvatarNameCache, this, _1, _2)); + } +} + void LLPostponedNotification::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 19b30b8973..c677dfe298 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -87,6 +87,7 @@ #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> #include <boost/type_traits.hpp> +#include <boost/signals2.hpp> #include "llevents.h" #include "llfunctorregistry.h" @@ -972,14 +973,15 @@ public: thiz->mParams = params; // Avoid header file dependency on llcachename.h - lookupName(thiz, id, is_group); + thiz->lookupName(id, is_group); } private: - static void lookupName(LLPostponedNotification* thiz, const LLUUID& id, bool is_group); + void lookupName(const LLUUID& id, bool is_group); // only used for groups void onGroupNameCache(const LLUUID& id, const std::string& full_name, bool is_group); // only used for avatars + void fetchAvatarName(const LLUUID& id); void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); // used for both group and avatar names void finalizeName(const std::string& name); @@ -990,8 +992,19 @@ private: } protected: - LLPostponedNotification() {} - virtual ~LLPostponedNotification() {} + LLPostponedNotification() + : mParams(), + mName(), + mAvatarNameCacheConnection() + {} + + virtual ~LLPostponedNotification() + { + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + } /** * Abstract method provides possibility to modify notification parameters and @@ -1002,6 +1015,7 @@ protected: LLNotification::Params mParams; std::string mName; + boost::signals2::connection mAvatarNameCacheConnection; }; // Stores only persistent notifications. diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5248feae1b..c6ba8a22bd 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2003,8 +2003,9 @@ if (INSTALL) endif (INSTALL) if (PACKAGE) + set(SYMBOL_SEARCH_DIRS "") if (WINDOWS) - set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-windows.tar.bz2") # slplugin.exe failing symbols dump - need to debug, might have to do with updated version of google breakpad # set(VIEWER_EXE_GLOBS "${VIEWER_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX} slplugin.exe") @@ -2013,13 +2014,20 @@ if (PACKAGE) set(VIEWER_COPY_MANIFEST copy_w_viewer_manifest) endif (WINDOWS) if (DARWIN) - set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + # *TODO: Generate these search dirs in the cmake files related to each binary. + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/llplugin/slplugin/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_crash_logger/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_updater/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/gstreamer010/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/webkit/${CMAKE_CFG_INTDIR}") set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-darwin.tar.bz2") - set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin") + set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin mac-updater mac-crash-logger") set(VIEWER_LIB_GLOB "*.dylib") endif (DARWIN) if (LINUX) - set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/packaged") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/packaged") set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-linux.tar.bz2") set(VIEWER_EXE_GLOBS "do-not-directly-run-secondlife-bin SLPlugin") set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}*") @@ -2039,7 +2047,7 @@ if (PACKAGE) ARGS "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py" "${LLBUILD_CONFIG}" - "${VIEWER_DIST_DIR}" + "${SYMBOL_SEARCH_DIRS}" "${VIEWER_EXE_GLOBS}" "${VIEWER_LIB_GLOB}" "${AUTOBUILD_INSTALL_DIR}/bin/dump_syms" diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9ada5e5918..0537487ca3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -69,7 +69,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>0.95</real> + <real>1</real> </map> <key>AdvanceSnapshot</key> <map> @@ -4302,7 +4302,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>0.65</real> + <real>0.95</real> </map> <key>InBandwidth</key> <map> diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py index 5ebec1563e..4181e4ebb3 100644 --- a/indra/newview/generate_breakpad_symbols.py +++ b/indra/newview/generate_breakpad_symbols.py @@ -39,17 +39,20 @@ import shlex import subprocess import tarfile import StringIO +import pprint + +DEBUG=False def usage(): - print >>sys.stderr, "usage: %s viewer_dir viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0] + print >>sys.stderr, "usage: %s search_dirs viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0] class MissingModuleError(Exception): def __init__(self, modules): Exception.__init__(self, "Failed to find required modules: %r" % modules) self.modules = modules -def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file): - print "generate_breakpad_symbols run with args: %s" % str((configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file)) +def main(configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file): + print "generate_breakpad_symbols run with args: %s" % str((configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file)) if not re.match("release", configuration, re.IGNORECASE): print "skipping breakpad symbol generation for non-release build." @@ -67,21 +70,49 @@ def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, vi return True return fnmatch.fnmatch(f, libs_suffix) + search_dirs = search_dirs.split(";") + def list_files(): - for (dirname, subdirs, filenames) in os.walk(viewer_dir): - #print "scanning '%s' for modules..." % dirname - for f in itertools.ifilter(matches, filenames): - yield os.path.join(dirname, f) + for search_dir in search_dirs: + for (dirname, subdirs, filenames) in os.walk(search_dir): + if DEBUG: + print "scanning '%s' for modules..." % dirname + for f in itertools.ifilter(matches, filenames): + yield os.path.join(dirname, f) def dump_module(m): print "dumping module '%s' with '%s'..." % (m, dump_syms_tool) - child = subprocess.Popen([dump_syms_tool, m] , stdout=subprocess.PIPE) + dsym_full_path = m + child = subprocess.Popen([dump_syms_tool, dsym_full_path] , stdout=subprocess.PIPE) out, err = child.communicate() return (m,child.returncode, out, err) - out = tarfile.open(viewer_symbol_file, 'w:bz2') + + modules = {} + + for m in list_files(): + if DEBUG: + print "examining module '%s' ... " % m, + filename=os.path.basename(m) + if -1 != m.find("DWARF"): + # Just use this module; it has the symbols we want. + modules[filename] = m + if DEBUG: + print "found dSYM entry" + elif filename not in modules: + # Only use this if we don't already have a (possibly better) entry. + modules[filename] = m + if DEBUG: + print "found new entry" + elif DEBUG: + print "ignoring entry" + + + print "Found these following modules:" + pprint.pprint( modules ) - for (filename,status,symbols,err) in itertools.imap(dump_module, list_files()): + out = tarfile.open(viewer_symbol_file, 'w:bz2') + for (filename,status,symbols,err) in itertools.imap(dump_module, modules.values()): if status == 0: module_line = symbols[:symbols.index('\n')] module_line = module_line.split() diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 62c6c6763b..6355f0db56 100755 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -28,6 +28,8 @@ #include "llavatariconctrl.h" +#include <boost/signals2.hpp> + // viewer includes #include "llagent.h" #include "llavatarconstants.h" @@ -148,9 +150,13 @@ LLAvatarIconCtrl::Params::Params() LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p) -: LLIconCtrl(p), + : LLIconCtrl(p), + LLAvatarPropertiesObserver(), + mAvatarId(), + mFullName(), mDrawTooltip(p.draw_tooltip), - mDefaultIconName(p.default_icon_name) + mDefaultIconName(p.default_icon_name), + mAvatarNameCacheConnection() { mPriority = LLViewerFetchedTexture::BOOST_ICON; @@ -203,6 +209,11 @@ LLAvatarIconCtrl::~LLAvatarIconCtrl() LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this); // Name callbacks will be automatically disconnected since LLUICtrl is trackable } + + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } } //virtual @@ -245,9 +256,19 @@ void LLAvatarIconCtrl::setValue(const LLSD& value) LLIconCtrl::setValue(value); } - if (mAvatarId != LLUUID::null) + fetchAvatarName(); +} + +void LLAvatarIconCtrl::fetchAvatarName() +{ + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + if (mAvatarId.notNull()) { - LLAvatarNameCache::get(mAvatarId, boost::bind(&LLAvatarIconCtrl::onAvatarNameCache, this, _1, _2)); + mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarId, boost::bind(&LLAvatarIconCtrl::onAvatarNameCache, this, _1, _2)); } } diff --git a/indra/newview/llavatariconctrl.h b/indra/newview/llavatariconctrl.h index 7f568fc5b8..f55967926a 100644 --- a/indra/newview/llavatariconctrl.h +++ b/indra/newview/llavatariconctrl.h @@ -27,6 +27,8 @@ #ifndef LL_LLAVATARICONCTRL_H #define LL_LLAVATARICONCTRL_H +#include <boost/signals2.hpp> + #include "lliconctrl.h" #include "llavatarpropertiesprocessor.h" #include "llviewermenu.h" @@ -86,20 +88,24 @@ public: // LLAvatarPropertiesProcessor observer trigger virtual void processProperties(void* data, EAvatarProcessorType type); - void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - const LLUUID& getAvatarId() const { return mAvatarId; } const std::string& getFullName() const { return mFullName; } void setDrawTooltip(bool value) { mDrawTooltip = value;} protected: - LLUUID mAvatarId; - std::string mFullName; - bool mDrawTooltip; - std::string mDefaultIconName; + LLUUID mAvatarId; + std::string mFullName; + bool mDrawTooltip; + std::string mDefaultIconName; bool updateFromCache(); + +private: + void fetchAvatarName(); + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); + + boost::signals2::connection mAvatarNameCacheConnection; }; #endif // LL_LLAVATARICONCTRL_H diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 7b5229b5e6..7ff1b39573 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -27,6 +27,8 @@ #include "llviewerprecompiledheaders.h" +#include <boost/signals2.hpp> + #include "llavataractions.h" #include "llavatarlistitem.h" @@ -59,7 +61,8 @@ LLAvatarListItem::Params::Params() LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) -: LLPanel(), + : LLPanel(), + LLFriendObserver(), mAvatarIcon(NULL), mAvatarName(NULL), mLastInteractionTime(NULL), @@ -74,7 +77,8 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) mShowInfoBtn(true), mShowProfileBtn(true), mShowPermissions(false), - mHovered(false) + mHovered(false), + mAvatarNameCacheConnection() { if (not_from_ui_factory) { @@ -87,7 +91,14 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) LLAvatarListItem::~LLAvatarListItem() { if (mAvatarId.notNull()) + { LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this); + } + + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } } BOOL LLAvatarListItem::postBuild() @@ -130,6 +141,19 @@ BOOL LLAvatarListItem::postBuild() return TRUE; } +void LLAvatarListItem::fetchAvatarName() +{ + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + if (mAvatarId.notNull()) + { + mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2)); + } +} + S32 LLAvatarListItem::notifyParent(const LLSD& info) { if (info.has("visibility_changed")) @@ -260,8 +284,7 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, b mAvatarIcon->setValue(id); // Set avatar name. - LLAvatarNameCache::get(id, - boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2)); + fetchAvatarName(); } } @@ -414,8 +437,7 @@ std::string LLAvatarListItem::getAvatarToolTip() const void LLAvatarListItem::updateAvatarName() { - LLAvatarNameCache::get(getAvatarId(), - boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2)); + fetchAvatarName(); } //== PRIVATE SECITON ========================================================== diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 28a50870d4..41853b6b51 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -27,6 +27,8 @@ #ifndef LL_LLAVATARLISTITEM_H #define LL_LLAVATARLISTITEM_H +#include <boost/signals2.hpp> + #include "llpanel.h" #include "lloutputmonitorctrl.h" #include "llbutton.h" @@ -217,6 +219,9 @@ private: /// true when the mouse pointer is hovering over this item bool mHovered; + + void fetchAvatarName(); + boost::signals2::connection mAvatarNameCacheConnection; static bool sStaticInitialized; // this variable is introduced to improve code readability static S32 sLeftPadding; // padding to first left visible child (icon or name) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index c61a8c8562..605e3ece51 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -28,6 +28,8 @@ #include "llchathistory.h" +#include <boost/signals2.hpp> + #include "llavatarnamecache.h" #include "llinstantmessage.h" @@ -110,7 +112,8 @@ public: mFrom(), mSessionID(), mMinUserNameWidth(0), - mUserNameFont(NULL) + mUserNameFont(NULL), + mAvatarNameCacheConnection() {} static LLChatHistoryHeader* createInstance(const std::string& file_name) @@ -124,6 +127,11 @@ public: { // Detach the info button so that it doesn't get destroyed (EXT-8463). hideInfoCtrl(); + + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } } BOOL handleMouseUp(S32 x, S32 y, MASK mask) @@ -283,8 +291,7 @@ public: // Start with blank so sample data from XUI XML doesn't // flash on the screen user_name->setValue( LLSD() ); - LLAvatarNameCache::get(mAvatarID, - boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2)); + fetchAvatarName(); } else if (chat.mChatStyle == CHAT_STYLE_HISTORY || mSourceType == CHAT_SOURCE_AGENT) @@ -416,31 +423,6 @@ public: } } - void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) - { - mFrom = av_name.mDisplayName; - - LLTextBox* user_name = getChild<LLTextBox>("user_name"); - user_name->setValue( LLSD(av_name.mDisplayName ) ); - user_name->setToolTip( av_name.mUsername ); - - if (gSavedSettings.getBOOL("NameTagShowUsernames") && - LLAvatarNameCache::useDisplayNames() && - !av_name.mIsDisplayNameDefault) - { - LLStyle::Params style_params_name; - LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); - style_params_name.color(userNameColor); - style_params_name.font.name("SansSerifSmall"); - style_params_name.font.style("NORMAL"); - style_params_name.readonly_color(userNameColor); - user_name->appendText(" - " + av_name.mUsername, FALSE, style_params_name); - } - setToolTip( av_name.mUsername ); - // name might have changed, update width - updateMinUserNameWidth(); - } - protected: static const S32 PADDING = 20; @@ -555,6 +537,45 @@ private: user_name->reshape(user_rect.getWidth() + delta_pos_x, user_rect.getHeight()); } + void fetchAvatarName() + { + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + if (mAvatarID.notNull()) + { + mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID, + boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2)); + } + } + + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) + { + mFrom = av_name.mDisplayName; + + LLTextBox* user_name = getChild<LLTextBox>("user_name"); + user_name->setValue( LLSD(av_name.mDisplayName ) ); + user_name->setToolTip( av_name.mUsername ); + + if (gSavedSettings.getBOOL("NameTagShowUsernames") && + LLAvatarNameCache::useDisplayNames() && + !av_name.mIsDisplayNameDefault) + { + LLStyle::Params style_params_name; + LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); + style_params_name.color(userNameColor); + style_params_name.font.name("SansSerifSmall"); + style_params_name.font.style("NORMAL"); + style_params_name.readonly_color(userNameColor); + user_name->appendText(" - " + av_name.mUsername, FALSE, style_params_name); + } + setToolTip( av_name.mUsername ); + // name might have changed, update width + updateMinUserNameWidth(); + } + protected: LLHandle<LLView> mPopupMenuHandleAvatar; LLHandle<LLView> mPopupMenuHandleObject; @@ -569,6 +590,9 @@ protected: S32 mMinUserNameWidth; const LLFontGL* mUserNameFont; + +private: + boost::signals2::connection mAvatarNameCacheConnection; }; LLUICtrl* LLChatHistoryHeader::sInfoCtrl = NULL; diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index 39f5d0b8f6..3ebb83b336 100644 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -97,7 +97,7 @@ void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& nam // Do not spawn chiclet when using the new multitab conversation UI if (LLIMConversation::isChatMultiTab()) { - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); return; } diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 74188195f6..47a82bfe17 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -369,7 +369,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0) + mDistToAgent(-1.0), + mAvatarNameCacheConnection() { mConvType = CONV_PARTICIPANT; } @@ -378,11 +379,38 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLConversationItem(uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0) + mDistToAgent(-1.0), + mAvatarNameCacheConnection() { mConvType = CONV_PARTICIPANT; } +LLConversationItemParticipant::~LLConversationItemParticipant() +{ + // Disconnect any previous avatar name cache connection to ensure + // that the callback method is not called after destruction + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } +} + +void LLConversationItemParticipant::fetchAvatarName() +{ + // Disconnect any previous avatar name cache connection + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + // Request the avatar name from the cache + llassert(getUUID().notNull()); + if (getUUID().notNull()) + { + mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2)); + } +} + void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) { menuentry_vec_t items; @@ -400,12 +428,15 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; - LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent); - if (parent_session) + if(mParent != NULL) { - parent_session->requestSort(); - parent_session->updateParticipantName(this); - postEvent("update_participant", parent_session, this); + LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent); + if (parent_session != NULL) + { + parent_session->requestSort(); + parent_session->updateParticipantName(this); + postEvent("update_participant", parent_session, this); + } } } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 1d082852f5..481d46af58 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -27,9 +27,11 @@ #ifndef LL_LLCONVERSATIONMODEL_H #define LL_LLCONVERSATIONMODEL_H +#include <boost/signals2.hpp> + +#include "llavatarname.h" #include "llfolderviewitem.h" #include "llfolderviewmodel.h" -#include "llavatarname.h" #include "llviewerfoldertype.h" // Implementation of conversations list @@ -177,7 +179,7 @@ class LLConversationItemParticipant : public LLConversationItem public: LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItemParticipant() {} + virtual ~LLConversationItemParticipant(); virtual const std::string& getDisplayName() const { return mDisplayName; } @@ -189,17 +191,21 @@ public: void setDistance(F64 dist) { mDistToAgent = dist; mNeedsRefresh = true; } void buildContextMenu(LLMenuGL& menu, U32 flags); - void onAvatarNameCache(const LLAvatarName& av_name); virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); } + void fetchAvatarName(); + void dumpDebugData(); private: + void onAvatarNameCache(const LLAvatarName& av_name); + bool mIsMuted; // default is false bool mIsModerator; // default is false std::string mDisplayName; F64 mDistToAgent; // Distance to the agent. A negative (meaningless) value means the distance has not been set. + boost::signals2::connection mAvatarNameCacheConnection; }; // We don't want to ever filter conversations but we need to declare that class to create a conversation view model. diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 18cb9bdb27..d50e527007 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -69,6 +69,8 @@ public: /*virtual*/ void toggleOpen(); + /*virtual*/ bool isMinimized() { return mMinimizedMode; } + void toggleMinimizedMode(bool is_minimized); void setVisibleIfDetached(BOOL visible); diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index a6a246a01e..920666ef90 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -119,6 +119,55 @@ LLIMConversation* LLIMConversation::getConversation(const LLUUID& uuid) return conv; }; +void LLIMConversation::setVisible(BOOL visible) +{ + LLTransientDockableFloater::setVisible(visible); + + if(visible) + { + LLIMConversation::addToHost(mSessionID); + } + setFocus(visible); +} + + + +void LLIMConversation::addToHost(const LLUUID& session_id) +{ + if ((session_id.notNull() && !gIMMgr->hasSession(session_id)) + || !LLIMConversation::isChatMultiTab()) + { + return; + } + + // Get the floater: this will create the instance if it didn't exist + LLIMConversation* conversp = LLIMConversation::getConversation(session_id); + if (conversp) + { + LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); + + // Do not add again existing floaters + if (floater_container && !conversp->isHostAttached()) + { + conversp->setHostAttached(true); + + if (!conversp->isNearbyChat() + || gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) + { + floater_container->addFloater(conversp, TRUE, LLTabContainer::END); + } + else + { + // setting of the "potential" host for Nearby Chat: this sequence sets + // LLFloater::mHostHandle = NULL (a current host), but + // LLFloater::mLastHostHandle = floater_container (a "future" host) + conversp->setHost(floater_container); + conversp->setHost(NULL); + } + + } + } +} BOOL LLIMConversation::postBuild() { diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 2bd1582e87..cb306c4d8d 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -60,17 +60,26 @@ public: */ static bool isChatMultiTab(); + // add conversation to container + static void addToHost(const LLUUID& session_id); + + bool isHostAttached() {return mIsHostAttached;} + void setHostAttached(bool is_attached) {mIsHostAttached = is_attached;} + static LLIMConversation* findConversation(const LLUUID& uuid); static LLIMConversation* getConversation(const LLUUID& uuid); // show/hide the translation check box void showTranslationCheckbox(const BOOL visible = FALSE); + bool isNearbyChat() {return mIsNearbyChat;} + // LLFloater overrides /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL postBuild(); /*virtual*/ void draw(); + /*virtual*/ void setVisible(BOOL visible); // Handle the left hand participant list widgets void addConversationViewParticipant(LLConversationItem* item); @@ -79,6 +88,7 @@ public: void refreshConversation(); void buildConversationViewParticipant(); + protected: // callback for click on any items of the visual states menu @@ -155,6 +165,7 @@ private: void reshapeChatHistory(); bool checkIfTornOff(); + bool mIsHostAttached; LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called. }; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 4e1bfb4e77..607cdbd265 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -594,34 +594,6 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } -void LLIMFloater::addToHost(const LLUUID& session_id) -{ - if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) - { - return; - } - - // Get the floater: this will create the instance if it didn't exist - LLIMFloater* floater = getInstance(session_id); - if (floater) - { - - LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - - // Do not attach to the IM container if it's already attached - if (!getFloaterHost()) - { - // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists - LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; - if (floater_container) - { - floater_container->addFloater(floater, FALSE, i_pt); - } - } - } -} - //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) @@ -730,7 +702,7 @@ void LLIMFloater::setVisible(BOOL visible) (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - LLTransientDockableFloater::setVisible(visible); + LLIMConversation::setVisible(visible); // update notification channel state if(channel) @@ -1317,7 +1289,7 @@ void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) floater->removeTypingIndicator(); } -// CHUI-441 : We should not create a floater here but go through LLIMFLoaterContainer +// static void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) { LLIMFloater::addToHost(session_id); diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index ec3a96f694..39210546fb 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -72,7 +72,6 @@ public: static LLIMFloater* findInstance(const LLUUID& session_id); static LLIMFloater* getInstance(const LLUUID& session_id); - static void addToHost(const LLUUID& session_id); // LLFloater overrides /*virtual*/ void onClose(bool app_quitting); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 298a6055bf..72e0f90f8c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -99,7 +99,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { addConversationListItem(session_id); - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); } void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -110,7 +110,7 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { addConversationListItem(session_id); - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); } void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) @@ -344,20 +344,6 @@ LLIMFloaterContainer* LLIMFloaterContainer::getInstance() return LLFloaterReg::getTypedInstance<LLIMFloaterContainer>("im_container"); } -void LLIMFloaterContainer::setMinimized(BOOL b) -{ - if (isMinimized() == b) return; - - LLMultiFloater::setMinimized(b); - - if (isMinimized()) return; - - if (getActiveFloater()) - { - getActiveFloater()->setVisible(TRUE); - } -} - // Update all participants in the conversation lists void LLIMFloaterContainer::processParticipantsStyleUpdate() { @@ -373,16 +359,7 @@ void LLIMFloaterContainer::processParticipantsStyleUpdate() { LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model); // Get the avatar name for this participant id from the cache and update the model - LLUUID participant_id = participant_model->getUUID(); - LLAvatarName av_name; - LLAvatarNameCache::get(participant_id,&av_name); - // Avoid updating the model though if the cache is still waiting for its first update - if (!av_name.mDisplayName.empty()) - { - participant_model->onAvatarNameCache(av_name); - } - // Bind update to the next cache name signal - LLAvatarNameCache::get(participant_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant_model, _2)); + participant_model->fetchAvatarName(); // Next participant current_participant_model++; } @@ -530,9 +507,9 @@ void LLIMFloaterContainer::setVisible(BOOL visible) } nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChat>("nearby_chat"); - if (nearby_chat && !nearby_chat->isHostSet()) + if (nearby_chat) { - nearby_chat->addToHost(); + LLIMConversation::addToHost(LLUUID()); } // We need to show/hide all the associated conversations that have been torn off @@ -1244,10 +1221,16 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener bool isWidgetSelected = false; + LLFolderViewItem* new_selection = NULL; LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid); if (widget) { isWidgetSelected = widget->isSelected(); + new_selection = mConversationsRoot->getNextFromChild(widget); + if(new_selection == NULL) + { + new_selection = mConversationsRoot->getPreviousFromChild(widget); + } widget->destroyView(); } @@ -1259,12 +1242,13 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c if (change_focus) { setFocus(TRUE); - conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); - if (widget_it != mConversationsWidgets.end()) + if(new_selection != NULL) { - mSelectedSession = widget_it->first; - LLFolderViewItem* widget = widget_it->second; - widget->selectItem(); + LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem()); + if(vmi != NULL) + { + selectConversation(vmi->getUUID()); + } } } return isWidgetSelected; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index cc6cc8c464..a6f8677e46 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -76,8 +76,6 @@ public: static void onCurrentChannelChanged(const LLUUID& session_id); - virtual void setMinimized(BOOL b); - void collapseMessagesPane(bool collapse); // Callbacks diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 5b274dd389..d1c7c6bfd7 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -91,8 +91,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd) : LLIMConversation(llsd), //mOutputMonitor(NULL), mSpeakerMgr(NULL), - mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT), - mIsHostSet(false) + mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) { mIsP2PChat = false; mIsNearbyChat = true; @@ -283,7 +282,7 @@ void LLNearbyChat::setFocus(BOOL focusFlag) } -void LLNearbyChat::setVisible(BOOL visible) +void LLNearbyChat::setVisible(BOOL visible) { LLIMConversation::setVisible(visible); @@ -304,35 +303,6 @@ void LLNearbyChat::onTearOffClicked() gSavedSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater); } -void LLNearbyChat::addToHost() -{ - if ( LLIMConversation::isChatMultiTab()) - { - LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - if (im_box) - { - if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) - { - im_box->addFloater(this, TRUE, LLTabContainer::END); - } - else - { - // setting of the "potential" host: this sequence sets - // LLFloater::mHostHandle = NULL (a current host), but - // LLFloater::mLastHostHandle = im_box (a "future" host) - setHost(im_box); - setHost(NULL); - } - } - - mIsHostSet = true; - } - } - -bool LLNearbyChat::isHostSet() -{ - return mIsHostSet; -} // virtual void LLNearbyChat::onOpen(const LLSD& key) diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 7ada4daea8..b155fd3c26 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -53,7 +53,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void setFocus(BOOL focusFlag); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(BOOL visible); void loadHistory(); void reloadMessages(); @@ -78,8 +78,6 @@ public: static void startChat(const char* line); static void stopChat(); - bool isHostSet(); - static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); @@ -121,7 +119,6 @@ private: LLHandle<LLView> mPopupMenuHandle; std::vector<LLChat> mMessageArchive; - bool mIsHostSet; }; #endif diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index b263143bd1..e199cb5776 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -676,8 +676,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) LLAvatarName avatar_name; bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.mDisplayName , avatar_id, mRootViewModel); - // Binds avatar's name update callback - LLAvatarNameCache::get(avatar_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant, _2)); + participant->fetchAvatarName(); if (mAvatarList) { mAvatarList->getIDs().push_back(avatar_id); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 6acbf82fd7..6d13ebec37 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -4716,55 +4716,63 @@ LLCullResult::LLCullResult() mVisibleListAllocated = 0; mVisibleBridgeAllocated = 0; - mVisibleGroups = NULL; - mVisibleGroupsEnd = NULL; - mAlphaGroups = NULL; - mAlphaGroupsEnd = NULL; - mOcclusionGroups = NULL; - mOcclusionGroupsEnd = NULL; - mDrawableGroups = NULL; - mDrawableGroupsEnd = NULL; - mVisibleList = NULL; - mVisibleListEnd = NULL; - mVisibleBridge = NULL; - mVisibleBridgeEnd = NULL; + mVisibleGroups.clear(); + mVisibleGroups.push_back(NULL); + mVisibleGroupsEnd = &mVisibleGroups[0]; + mAlphaGroups.clear(); + mAlphaGroups.push_back(NULL); + mAlphaGroupsEnd = &mAlphaGroups[0]; + mOcclusionGroups.clear(); + mOcclusionGroups.push_back(NULL); + mOcclusionGroupsEnd = &mOcclusionGroups[0]; + mDrawableGroups.clear(); + mDrawableGroups.push_back(NULL); + mDrawableGroupsEnd = &mDrawableGroups[0]; + mVisibleList.clear(); + mVisibleList.push_back(NULL); + mVisibleListEnd = &mVisibleList[0]; + mVisibleBridge.clear(); + mVisibleBridge.push_back(NULL); + mVisibleBridgeEnd = &mVisibleBridge[0]; for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) { - mRenderMap[i] = NULL; - mRenderMapEnd[i] = NULL; + mRenderMap[i].clear(); + mRenderMap[i].push_back(NULL); + mRenderMapEnd[i] = &mRenderMap[i][0]; mRenderMapAllocated[i] = 0; } clear(); } -void LLCullResult::pushBack(void**& head, U32& count, void* val) +template <class T, class V> +void LLCullResult::pushBack(T& head, U32& count, V* val) { + head[count] = val; + head.push_back(NULL); count++; - head = (void**) realloc((void*) head, sizeof(void*) * count); - head[count-1] = val; } void LLCullResult::clear() { mVisibleGroupsSize = 0; - mVisibleGroupsEnd = mVisibleGroups; + mVisibleGroupsEnd = &mVisibleGroups[0]; mAlphaGroupsSize = 0; - mAlphaGroupsEnd = mAlphaGroups; + mAlphaGroupsEnd = &mAlphaGroups[0]; mOcclusionGroupsSize = 0; - mOcclusionGroupsEnd = mOcclusionGroups; + mOcclusionGroupsEnd = &mOcclusionGroups[0]; mDrawableGroupsSize = 0; - mDrawableGroupsEnd = mDrawableGroups; + mDrawableGroupsEnd = &mDrawableGroups[0]; mVisibleListSize = 0; - mVisibleListEnd = mVisibleList; + mVisibleListEnd = &mVisibleList[0]; mVisibleBridgeSize = 0; - mVisibleBridgeEnd = mVisibleBridge; + mVisibleBridgeEnd = &mVisibleBridge[0]; for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) @@ -4774,13 +4782,13 @@ void LLCullResult::clear() mRenderMap[i][j] = 0; } mRenderMapSize[i] = 0; - mRenderMapEnd[i] = mRenderMap[i]; + mRenderMapEnd[i] = &(mRenderMap[i][0]); } } LLCullResult::sg_iterator LLCullResult::beginVisibleGroups() { - return mVisibleGroups; + return &mVisibleGroups[0]; } LLCullResult::sg_iterator LLCullResult::endVisibleGroups() @@ -4790,7 +4798,7 @@ LLCullResult::sg_iterator LLCullResult::endVisibleGroups() LLCullResult::sg_iterator LLCullResult::beginAlphaGroups() { - return mAlphaGroups; + return &mAlphaGroups[0]; } LLCullResult::sg_iterator LLCullResult::endAlphaGroups() @@ -4800,7 +4808,7 @@ LLCullResult::sg_iterator LLCullResult::endAlphaGroups() LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups() { - return mOcclusionGroups; + return &mOcclusionGroups[0]; } LLCullResult::sg_iterator LLCullResult::endOcclusionGroups() @@ -4810,7 +4818,7 @@ LLCullResult::sg_iterator LLCullResult::endOcclusionGroups() LLCullResult::sg_iterator LLCullResult::beginDrawableGroups() { - return mDrawableGroups; + return &mDrawableGroups[0]; } LLCullResult::sg_iterator LLCullResult::endDrawableGroups() @@ -4820,7 +4828,7 @@ LLCullResult::sg_iterator LLCullResult::endDrawableGroups() LLCullResult::drawable_iterator LLCullResult::beginVisibleList() { - return mVisibleList; + return &mVisibleList[0]; } LLCullResult::drawable_iterator LLCullResult::endVisibleList() @@ -4830,7 +4838,7 @@ LLCullResult::drawable_iterator LLCullResult::endVisibleList() LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge() { - return mVisibleBridge; + return &mVisibleBridge[0]; } LLCullResult::bridge_iterator LLCullResult::endVisibleBridge() @@ -4840,7 +4848,7 @@ LLCullResult::bridge_iterator LLCullResult::endVisibleBridge() LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type) { - return mRenderMap[type]; + return &mRenderMap[type][0]; } LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type) @@ -4856,10 +4864,10 @@ void LLCullResult::pushVisibleGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mVisibleGroups, mVisibleGroupsAllocated, (void*) group); + pushBack(mVisibleGroups, mVisibleGroupsAllocated, group); } ++mVisibleGroupsSize; - mVisibleGroupsEnd = mVisibleGroups+mVisibleGroupsSize; + mVisibleGroupsEnd = &mVisibleGroups[mVisibleGroupsSize]; } void LLCullResult::pushAlphaGroup(LLSpatialGroup* group) @@ -4870,10 +4878,10 @@ void LLCullResult::pushAlphaGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mAlphaGroups, mAlphaGroupsAllocated, (void*) group); + pushBack(mAlphaGroups, mAlphaGroupsAllocated, group); } ++mAlphaGroupsSize; - mAlphaGroupsEnd = mAlphaGroups+mAlphaGroupsSize; + mAlphaGroupsEnd = &mAlphaGroups[mAlphaGroupsSize]; } void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group) @@ -4884,10 +4892,10 @@ void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mOcclusionGroups, mOcclusionGroupsAllocated, (void*) group); + pushBack(mOcclusionGroups, mOcclusionGroupsAllocated, group); } ++mOcclusionGroupsSize; - mOcclusionGroupsEnd = mOcclusionGroups+mOcclusionGroupsSize; + mOcclusionGroupsEnd = &mOcclusionGroups[mOcclusionGroupsSize]; } void LLCullResult::pushDrawableGroup(LLSpatialGroup* group) @@ -4898,10 +4906,10 @@ void LLCullResult::pushDrawableGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mDrawableGroups, mDrawableGroupsAllocated, (void*) group); + pushBack(mDrawableGroups, mDrawableGroupsAllocated, group); } ++mDrawableGroupsSize; - mDrawableGroupsEnd = mDrawableGroups+mDrawableGroupsSize; + mDrawableGroupsEnd = &mDrawableGroups[mDrawableGroupsSize]; } void LLCullResult::pushDrawable(LLDrawable* drawable) @@ -4912,10 +4920,10 @@ void LLCullResult::pushDrawable(LLDrawable* drawable) } else { - pushBack((void**&) mVisibleList, mVisibleListAllocated, (void*) drawable); + pushBack(mVisibleList, mVisibleListAllocated, drawable); } ++mVisibleListSize; - mVisibleListEnd = mVisibleList+mVisibleListSize; + mVisibleListEnd = &mVisibleList[mVisibleListSize]; } void LLCullResult::pushBridge(LLSpatialBridge* bridge) @@ -4926,10 +4934,10 @@ void LLCullResult::pushBridge(LLSpatialBridge* bridge) } else { - pushBack((void**&) mVisibleBridge, mVisibleBridgeAllocated, (void*) bridge); + pushBack(mVisibleBridge, mVisibleBridgeAllocated, bridge); } ++mVisibleBridgeSize; - mVisibleBridgeEnd = mVisibleBridge+mVisibleBridgeSize; + mVisibleBridgeEnd = &mVisibleBridge[mVisibleBridgeSize]; } void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info) @@ -4940,10 +4948,10 @@ void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info) } else { - pushBack((void**&) mRenderMap[type], mRenderMapAllocated[type], (void*) draw_info); + pushBack(mRenderMap[type], mRenderMapAllocated[type], draw_info); } ++mRenderMapSize[type]; - mRenderMapEnd[type] = mRenderMap[type] + mRenderMapSize[type]; + mRenderMapEnd[type] = &(mRenderMap[type][mRenderMapSize[type]]); } diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index e63037b4a8..b1706d9d35 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -569,10 +569,10 @@ class LLCullResult public: LLCullResult(); - typedef LLSpatialGroup** sg_list_t; - typedef LLDrawable** drawable_list_t; - typedef LLSpatialBridge** bridge_list_t; - typedef LLDrawInfo** drawinfo_list_t; + typedef std::vector<LLSpatialGroup*> sg_list_t; + typedef std::vector<LLDrawable*> drawable_list_t; + typedef std::vector<LLSpatialBridge*> bridge_list_t; + typedef std::vector<LLDrawInfo*> drawinfo_list_t; typedef LLSpatialGroup** sg_iterator; typedef LLSpatialBridge** bridge_iterator; @@ -622,7 +622,7 @@ public: private: - void pushBack(void** &head, U32& count, void* val); + template <class T, class V> void pushBack(T &head, U32& count, V* val); U32 mVisibleGroupsSize; U32 mAlphaGroupsSize; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index e399b45cba..9e5c3f14f8 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -948,7 +948,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) std::vector<LLViewerObject*>::iterator idle_end = idle_list.begin()+idle_count; if (gSavedSettings.getBOOL("FreezeTime")) - { + { for (std::vector<LLViewerObject*>::iterator iter = idle_list.begin(); iter != idle_end; iter++) @@ -969,14 +969,14 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) llassert(objectp->isActive()); objectp->idleUpdate(agent, world, frame_time); - } + } //update flexible objects LLVolumeImplFlexible::updateClass(); //update animated textures LLViewerTextureAnim::updateClass(); - } + } @@ -1401,9 +1401,9 @@ void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) mActiveObjects[idx]->setListIndex(idx); } - mActiveObjects.pop_back(); + mActiveObjects.pop_back(); + } } -} void LLViewerObjectList::updateActive(LLViewerObject *objectp) { @@ -1446,8 +1446,11 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) } } - llassert(objectp->isActive() || objectp->getListIndex() == -1); + //post condition: if object is active, it must be on the active list + llassert(!active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) != mActiveObjects.end()); + //post condition: if object is not active, it must not be on the active list + llassert(active || std::find(mActiveObjects.begin(), mActiveObjects.end(), objectp) == mActiveObjects.end()); } void LLViewerObjectList::updateObjectCost(LLViewerObject* object) diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 9936432a71..449a4633ff 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -129,6 +129,7 @@ public: LLViewerObject *getSelectedObject(const U32 object_id); inline S32 getNumObjects() { return (S32) mObjects.size(); } + inline S32 getNumActiveObjects() { return (S32) mActiveObjects.size(); } void addToMap(LLViewerObject *objectp); void removeFromMap(LLViewerObject *objectp); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 4e37a9043d..3b2292c04d 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -563,6 +563,9 @@ public: addText(xpos, ypos, llformat("%d Render Calls", gPipeline.mBatchCount)); ypos += y_inc; + addText(xpos, ypos, llformat("%d/%d Objects Active", gObjectList.getNumActiveObjects(), gObjectList.getNumObjects())); + ypos += y_inc; + addText(xpos, ypos, llformat("%d Matrix Ops", gPipeline.mMatrixOpCount)); ypos += y_inc; diff --git a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml index 2b22f0d6e3..9e825fe516 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml @@ -362,7 +362,7 @@ follows="left|top" height="16" increment="0.01" - initial_value="0.8" + initial_value="1.0" layout="topleft" label_width="115" label="Active:" @@ -380,7 +380,7 @@ follows="left|top" height="16" increment="0.01" - initial_value="0.5" + initial_value="0.95" layout="topleft" label_width="115" label="Inactive:" |