diff options
133 files changed, 2710 insertions, 1782 deletions
diff --git a/autobuild.xml b/autobuild.xml index 66afa31386..892c1fcf5f 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -138,11 +138,11 @@ <key>archive</key> <map> <key>hash</key> - <string>d8d9e1e15ec09c81acfa9ffb80c3f20435373543</string> + <string>d600779da508fbb64eb85957f2866fd2b039b674</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-boost/releases/download/v1.84.0-r1/boost-1.84-darwin64-8499892512.tar.zst</string> + <string>https://github.com/secondlife/3p-boost/releases/download/v1.85.0-r1/boost-1.85-darwin64-10124675220.tar.zst</string> </map> <key>name</key> <string>darwin64</string> @@ -152,11 +152,11 @@ <key>archive</key> <map> <key>hash</key> - <string>a5552fcd343179c4c7d6dd6289675431a8c0fe8d</string> + <string>ce39890fe263358d99c45f1b697107b72e3b6870</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-boost/releases/download/v1.84.0-r1/boost-1.84-linux64-8499892512.tar.zst</string> + <string>https://github.com/secondlife/3p-boost/releases/download/v1.85.0-r1/boost-1.85-linux64-10124675220.tar.zst</string> </map> <key>name</key> <string>linux64</string> @@ -166,11 +166,11 @@ <key>archive</key> <map> <key>hash</key> - <string>5af9c69093e171eda552720a7acd570496db17db</string> + <string>2b0b0b0aaf3bdb1d36809db7d08bd60ae7e8fed1</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-boost/releases/download/v1.84.0-r1/boost-1.84-windows64-8499892512.tar.zst</string> + <string>https://github.com/secondlife/3p-boost/releases/download/v1.85.0-r1/boost-1.85-windows64-10124675220.tar.zst</string> </map> <key>name</key> <string>windows64</string> @@ -183,7 +183,7 @@ <key>copyright</key> <string>(see individual source files)</string> <key>version</key> - <string>1.81-09d25a7</string> + <string>1.85</string> <key>name</key> <string>boost</string> <key>description</key> @@ -244,11 +244,11 @@ <key>archive</key> <map> <key>hash</key> - <string>fd656d2478728c4fc268478ec40d33b0ed1b7d83</string> + <string>a29852f41b77a26a2c10af1d179bf7c4b6a1b12b</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r4/colladadom-2.3.8500178177-darwin64-8500178177.tar.zst</string> + <string>https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r6/colladadom-2.3.10129939866-darwin64-10129939866.tar.zst</string> </map> <key>name</key> <string>darwin64</string> @@ -258,11 +258,11 @@ <key>archive</key> <map> <key>hash</key> - <string>aebc0ddcae18852e78143fbac793cd4a32f0f251</string> + <string>933c31aa8da53731c75c272b90a64dde08dc1f4d</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r4/colladadom-2.3.8500178177-linux64-8500178177.tar.zst</string> + <string>https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r6/colladadom-2.3.10129939866-linux64-10129939866.tar.zst</string> </map> <key>name</key> <string>linux64</string> @@ -272,11 +272,11 @@ <key>archive</key> <map> <key>hash</key> - <string>3b25739b1a923c2edcf19864a1c82aeb5042567b</string> + <string>c01f1692a48d26436297bd5ac4b54fd3c71f7651</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r4/colladadom-2.3.8500178177-windows64-8500178177.tar.zst</string> + <string>https://github.com/secondlife/3p-colladadom/releases/download/v2.3-r6/colladadom-2.3.10129939866-windows64-10129939866.tar.zst</string> </map> <key>name</key> <string>windows64</string> @@ -289,7 +289,7 @@ <key>copyright</key> <string>Copyright 2006 Sony Computer Entertainment Inc.</string> <key>version</key> - <string>2.3.ab0c124</string> + <string>2.3.10129939866</string> <key>name</key> <string>colladadom</string> </map> @@ -2653,66 +2653,6 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>description</key> <string>TUT is a small and portable unit test framework for C++.</string> </map> - <key>uriparser</key> - <map> - <key>platforms</key> - <map> - <key>darwin64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>4b6ee5113b1368ec9ff5b59e195adde370b9f585</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-uriparser/releases/download/v0.9.4-8fff38a/uriparser-0.9.4-darwin64-8fff38a.tar.zst</string> - </map> - <key>name</key> - <string>darwin64</string> - </map> - <key>linux64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>44dc74ec73e37c56bef6317d12a29d0435cb4bbb</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-uriparser/releases/download/v0.9.4-8fff38a/uriparser-0.9.4-linux64-8fff38a.tar.zst</string> - </map> - <key>name</key> - <string>linux64</string> - </map> - <key>windows64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>e8b20edfc624f1d09bc83480932a9c844d47fc13</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-uriparser/releases/download/v0.9.4-8fff38a/uriparser-0.9.4-windows64-8fff38a.tar.zst</string> - </map> - <key>name</key> - <string>windows64</string> - </map> - </map> - <key>license</key> - <string>New BSD license</string> - <key>license_file</key> - <string>LICENSES/uriparser.txt</string> - <key>copyright</key> - <string>Copyright (C) 2007, Weijia Song <songweijia@gmail.com>, Sebastian Pipping <webmaster@hartwork.org></string> - <key>version</key> - <string>0.9.4</string> - <key>name</key> - <string>uriparser</string> - <key>description</key> - <string>uriparser is a strictly RFC 3986 compliant URI parsing and handling library written in C. uriparser is cross-platform, fast, supports Unicode and is licensed under the New BSD license.</string> - </map> <key>viewer-fonts</key> <map> <key>platforms</key> diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 4ae9377500..272b4092a9 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -109,11 +109,6 @@ if (WINDOWS) string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") endif() - # workaround for github runner image breakage: - # https://github.com/actions/runner-images/issues/10004#issuecomment-2153445161 - # can be removed after the above issue is resolved and deployed across GHA - add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) - # Allow use of sprintf etc add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif (WINDOWS) diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake index 293d8931cb..57f44dae59 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -24,7 +24,8 @@ if (WINDOWS) libboost_program_options-mt${addrsfx} libboost_regex-mt${addrsfx} libboost_system-mt${addrsfx} - libboost_thread-mt${addrsfx}) + libboost_thread-mt${addrsfx} + libboost_url-mt${addrsfx}) elseif (LINUX) target_link_libraries( ll::boost INTERFACE boost_fiber-mt${addrsfx} @@ -32,9 +33,9 @@ elseif (LINUX) boost_filesystem-mt${addrsfx} boost_program_options-mt${addrsfx} boost_regex-mt${addrsfx} - boost_thread-mt${addrsfx} boost_system-mt${addrsfx} - ) + boost_thread-mt${addrsfx} + boost_url-mt${addrsfx}) elseif (DARWIN) target_link_libraries( ll::boost INTERFACE boost_context-mt${addrsfx} @@ -43,7 +44,8 @@ elseif (DARWIN) boost_program_options-mt${addrsfx} boost_regex-mt${addrsfx} boost_system-mt${addrsfx} - boost_thread-mt${addrsfx}) + boost_thread-mt${addrsfx} + boost_url-mt${addrsfx}) endif (WINDOWS) if (LINUX) diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 1692fa2415..10b17a6e26 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -56,7 +56,6 @@ set(cmake_SOURCE_FILES Tut.cmake UI.cmake UnixInstall.cmake - URIPARSER.cmake Variables.cmake ViewerMiscLibs.cmake VisualLeakDetector.cmake diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 7dbbdb81b7..28c7377e23 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -58,7 +58,6 @@ if(WINDOWS) libaprutil-1.dll nghttp2.dll libhunspell.dll - uriparser.dll ) # OpenSSL @@ -190,9 +189,6 @@ elseif(DARWIN) libndofdev.dylib libnghttp2.dylib libnghttp2.14.dylib - liburiparser.dylib - liburiparser.1.dylib - liburiparser.1.0.27.dylib ) if (TARGET ll::openal) diff --git a/indra/cmake/URIPARSER.cmake b/indra/cmake/URIPARSER.cmake deleted file mode 100644 index 6c33ff70e1..0000000000 --- a/indra/cmake/URIPARSER.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# -*- cmake -*- - -include_guard() - -include(Prebuilt) - -add_library( ll::uriparser INTERFACE IMPORTED ) - -use_system_binary( uriparser ) - -use_prebuilt_binary(uriparser) -if (WINDOWS) - target_link_libraries( ll::uriparser INTERFACE uriparser) -elseif (LINUX) - target_link_libraries( ll::uriparser INTERFACE uriparser) -elseif (DARWIN) - target_link_libraries( ll::uriparser INTERFACE liburiparser.dylib) -endif (WINDOWS) -target_include_directories( ll::uriparser SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/uriparser) diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index a46f9acc63..d8a6fffea6 100755 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -790,9 +790,12 @@ bool LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) if (gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND)) { - // Just put it on the decode queue. + // Just put it on the decode queue it if it's not already in the queue LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL; - mImpl->mDecodeQueue.push_back(uuid); + if (std::find(mImpl->mDecodeQueue.begin(), mImpl->mDecodeQueue.end(), uuid) == mImpl->mDecodeQueue.end()) + { + mImpl->mDecodeQueue.emplace_back(uuid); + } return true; } diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 3697422ac8..613c408157 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -1827,7 +1827,17 @@ bool LLAudioData::load() { // Hrm. Right now, let's unset the buffer, since it's empty. gAudiop->cleanupBuffer(mBufferp); - mBufferp = NULL; + mBufferp = nullptr; + + if (!gDirUtilp->fileExists(wav_path)) + { + mHasLocalData = false; + mHasDecodedData = false; + mHasCompletedDecode = false; + mHasDecodeFailed = false; + mHasWAVLoadFailed = false; + gAudiop->preloadSound(mID); + } return false; } diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 95e991c246..8e43627a5f 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -10,7 +10,6 @@ include(Boost) include(LLSharedLibs) include(Copy3rdPartyLibs) include(ZLIBNG) -include(URIPARSER) include(Tracy) @@ -278,7 +277,6 @@ target_link_libraries( ll::expat ll::zlib-ng ll::boost - ll::uriparser ll::oslibraries ll::tracy ) diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index 2ebb7fc742..33a48d970d 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -29,12 +29,7 @@ #include "linden_common.h" #include "lluriparser.h" -#if LL_DARWIN -#include <signal.h> -#include <setjmp.h> -#endif - -LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedTmp(false), mRes(0) +LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedTmp(false), mRes(false) { if (u.find("://") == std::string::npos) { @@ -42,36 +37,52 @@ LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedT mTmpScheme = true; } - mNormalizedUri += u.c_str(); + mNormalizedUri.append(u); mRes = parse(); } LLUriParser::~LLUriParser() { - uriFreeUriMembersA(&mUri); } -S32 LLUriParser::parse() +bool LLUriParser::parse() { - mRes = uriParseSingleUriA(&mUri, mNormalizedUri.c_str(), NULL); + try + { + auto res = boost::urls::parse_uri(mNormalizedUri); + if (res) + { + mUri = *res; + mRes = true; + } + else + { + mRes = false; + } + } + catch (const std::length_error&) + { + LL_WARNS() << "Failed to parse uri due to exceeding uri_view max_size" << LL_ENDL; + mRes = false; + } return mRes; } -const char * LLUriParser::scheme() const +const std::string& LLUriParser::scheme() const { - return mScheme.c_str(); + return mScheme; } -void LLUriParser::sheme(const std::string& s) +void LLUriParser::scheme(const std::string& s) { mTmpScheme = !s.size(); mScheme = s; } -const char * LLUriParser::port() const +const std::string& LLUriParser::port() const { - return mPort.c_str(); + return mPort; } void LLUriParser::port(const std::string& s) @@ -79,9 +90,9 @@ void LLUriParser::port(const std::string& s) mPort = s; } -const char * LLUriParser::host() const +const std::string& LLUriParser::host() const { - return mHost.c_str(); + return mHost; } void LLUriParser::host(const std::string& s) @@ -89,9 +100,9 @@ void LLUriParser::host(const std::string& s) mHost = s; } -const char * LLUriParser::path() const +const std::string& LLUriParser::path() const { - return mPath.c_str(); + return mPath; } void LLUriParser::path(const std::string& s) @@ -99,9 +110,9 @@ void LLUriParser::path(const std::string& s) mPath = s; } -const char * LLUriParser::query() const +const std::string& LLUriParser::query() const { - return mQuery.c_str(); + return mQuery; } void LLUriParser::query(const std::string& s) @@ -109,9 +120,9 @@ void LLUriParser::query(const std::string& s) mQuery = s; } -const char * LLUriParser::fragment() const +const std::string& LLUriParser::fragment() const { - return mFragment.c_str(); + return mFragment; } void LLUriParser::fragment(const std::string& s) @@ -119,19 +130,6 @@ void LLUriParser::fragment(const std::string& s) mFragment = s; } -void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str) -{ - if (textRange.first != NULL && textRange.afterLast != NULL && textRange.first < textRange.afterLast) - { - const ptrdiff_t len = textRange.afterLast - textRange.first; - str.assign(textRange.first, static_cast<std::string::size_type>(len)); - } - else - { - str = LLStringUtil::null; - } -} - void LLUriParser::extractParts() { if (mTmpScheme || mNormalizedTmp) @@ -140,96 +138,24 @@ void LLUriParser::extractParts() } else { - textRangeToString(mUri.scheme, mScheme); + mScheme = mUri.scheme(); } - textRangeToString(mUri.hostText, mHost); - textRangeToString(mUri.portText, mPort); - textRangeToString(mUri.query, mQuery); - textRangeToString(mUri.fragment, mFragment); - - UriPathSegmentA * pathHead = mUri.pathHead; - while (pathHead) - { - std::string partOfPath; - textRangeToString(pathHead->text, partOfPath); - - mPath += '/'; - mPath += partOfPath; - - pathHead = pathHead->next; - } + mHost = mUri.host(); + mPort = mUri.port(); + mQuery = mUri.query(); + mFragment = mUri.fragment(); + mPath = mUri.path(); } -#if LL_DARWIN -typedef void(*sighandler_t)(int); -jmp_buf return_to_normalize; -static int sLastSignal = 0; -void uri_signal_handler(int signal) -{ - sLastSignal = signal; - // Apparently signal handler throwing an exception doesn't work. - // This is ugly and unsafe due to not unwinding content of uriparser library, - // but unless we have a way to catch this as NSexception, jump appears to be the only option. - longjmp(return_to_normalize, 1 /*setjmp will return this value*/); -} -#endif - -S32 LLUriParser::normalize() +bool LLUriParser::normalize() { mNormalizedTmp = mTmpScheme; - if (!mRes) + if (mRes) { -#if LL_DARWIN - sighandler_t last_sigill_handler, last_sigbus_handler; - last_sigill_handler = signal(SIGILL, &uri_signal_handler); // illegal instruction - last_sigbus_handler = signal(SIGBUS, &uri_signal_handler); - - if (setjmp(return_to_normalize)) - { - // Issue: external library crashed via signal - // If you encountered this, please try to figure out what's wrong: - // 1. Verify that library's input is 'sane' - // 2. Check if we have an NSexception to work with (unlikely) - // 3. See if passing same string causes exception to repeat - // - // Crash happens at uriNormalizeSyntaxExA - // Warning!!! This does not properly unwind stack, - // if this can be handled by NSexception, it needs to be remade - llassert(0); - - LL_WARNS() << "Uriparser crashed with " << sLastSignal << " , while processing: " << mNormalizedUri << LL_ENDL; - signal(SIGILL, last_sigill_handler); - signal(SIGBUS, last_sigbus_handler); - return 1; - } -#endif - - mRes = uriNormalizeSyntaxExA(&mUri, URI_NORMALIZE_SCHEME | URI_NORMALIZE_HOST); - -#if LL_DARWIN - signal(SIGILL, last_sigill_handler); - signal(SIGBUS, last_sigbus_handler); -#endif - - if (!mRes) - { - S32 chars_required; - mRes = uriToStringCharsRequiredA(&mUri, &chars_required); - - if (!mRes) - { - chars_required++; - std::vector<char> label_buf(chars_required); - mRes = uriToStringA(&label_buf[0], &mUri, chars_required, NULL); - - if (!mRes) - { - mNormalizedUri = &label_buf[mTmpScheme ? 7 : 0]; - mTmpScheme = false; - } - } - } + mUri.normalize_scheme().normalize_authority(); + mNormalizedUri = mUri.buffer().substr(mTmpScheme ? 7 : 0); + mTmpScheme = false; } if(mTmpScheme && mNormalizedUri.size() > 7) @@ -302,7 +228,7 @@ bool LLUriParser::test() const return uri == mNormalizedUri; } -const char * LLUriParser::normalizedUri() const +const std::string& LLUriParser::normalizedUri() const { - return mNormalizedUri.c_str(); + return mNormalizedUri; } diff --git a/indra/llcommon/lluriparser.h b/indra/llcommon/lluriparser.h index 77eb4031d5..61d613f399 100644 --- a/indra/llcommon/lluriparser.h +++ b/indra/llcommon/lluriparser.h @@ -30,7 +30,7 @@ #define LL_LLURIPARSER_H #include <string> -#include "uriparser/Uri.h" +#include "boost/url.hpp" class LL_COMMON_API LLUriParser { @@ -38,36 +38,35 @@ public: LLUriParser(const std::string& u); ~LLUriParser(); - const char * scheme() const; - void sheme (const std::string& s); + const std::string& scheme() const; + void scheme (const std::string& s); - const char * port() const; + const std::string& port() const; void port (const std::string& s); - const char * host() const; + const std::string& host() const; void host (const std::string& s); - const char * path() const; + const std::string& path() const; void path (const std::string& s); - const char * query() const; + const std::string& query() const; void query (const std::string& s); - const char * fragment() const; + const std::string& fragment() const; void fragment (const std::string& s); - const char * normalizedUri() const; + const std::string& normalizedUri() const; void extractParts(); void glue(std::string& uri) const; void glueFirst(std::string& uri, bool use_scheme = true) const; void glueSecond(std::string& uri) const; bool test() const; - S32 normalize(); + bool normalize(); private: - S32 parse(); - void textRangeToString(UriTextRangeA& textRange, std::string& str); + bool parse(); std::string mScheme; std::string mHost; std::string mPort; @@ -76,9 +75,9 @@ private: std::string mFragment; std::string mNormalizedUri; - UriUriA mUri; + boost::url mUri; - S32 mRes; + bool mRes; bool mTmpScheme; bool mNormalizedTmp; }; diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index 8b0f8c2e4c..a00262c132 100644 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -157,7 +157,6 @@ if (DARWIN) libapr-1.0.dylib libaprutil-1.0.dylib libnghttp2*.dylib - liburiparser*.dylib ${EXPAT_COPY} ) diff --git a/indra/llcorehttp/tests/llcorehttp_test.cpp b/indra/llcorehttp/tests/llcorehttp_test.cpp index c0cc2c8030..8a788e5a93 100755 --- a/indra/llcorehttp/tests/llcorehttp_test.cpp +++ b/indra/llcorehttp/tests/llcorehttp_test.cpp @@ -43,9 +43,12 @@ #include "test_httpoperation.hpp" // As of 2019-06-28, test_httprequest.hpp consistently crashes on Mac Release // builds for reasons not yet diagnosed. -#if ! (LL_DARWIN && LL_RELEASE) +// On Linux too, this is likely to badly handling (p)thread creation and not waiting +// for threads to properly shutdown +#if LL_WINDOWS #include "test_httprequest.hpp" #endif + #include "test_httpheaders.hpp" #include "test_httprequestqueue.hpp" #include "_httpservice.h" diff --git a/indra/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp index 6e191ad096..4fa5769f65 100644 --- a/indra/llfilesystem/tests/lldir_test.cpp +++ b/indra/llfilesystem/tests/lldir_test.cpp @@ -27,12 +27,14 @@ #include "linden_common.h" +#include <filesystem> #include "llstring.h" #include "tests/StringVec.h" #include "../lldir.h" #include "../lldiriterator.h" #include "../test/lltut.h" +#include "../test/namedtempfile.h" #include "stringize.h" #include <boost/assign/list_of.hpp> @@ -425,23 +427,19 @@ namespace tut return path; } - std::string makeTestDir( const std::string& dirbase ) + std::string makeTestDir( ) { - int counter; - std::string uniqueDir; - bool foundUnused; - std::string delim = gDirUtilp->getDirDelimiter(); + auto p = NamedTempFile::temp_path(); + std::filesystem::create_directories(p.native()); - for (counter=0, foundUnused=false; !foundUnused; counter++ ) - { - char counterStr[3]; - sprintf(counterStr, "%02d", counter); - uniqueDir = dirbase + counterStr; - foundUnused = ! ( LLFile::isdir(uniqueDir) || LLFile::isfile(uniqueDir) ); - } - ensure("test directory '" + uniqueDir + "' creation failed", !LLFile::mkdir(uniqueDir)); + std::string ret = p.string(); - return uniqueDir + delim; // HACK - apparently, the trailing delimiter is needed... + // There's an implicit assumtion all over this code that the returned path ends with "/" (or "\") + + if(ret.size() >= 1 && ret[ ret.size()-1 ] != std::filesystem::path::preferred_separator ) + ret += std::filesystem::path::preferred_separator; + + return ret; } static const char* DirScanFilename[5] = { "file1.abc", "file2.abc", "file1.xyz", "file2.xyz", "file1.mno" }; @@ -497,8 +495,9 @@ namespace tut // Create the same 5 file names of the two directories - std::string dir1 = makeTestDir(dirTemp + "LLDirIterator"); - std::string dir2 = makeTestDir(dirTemp + "LLDirIterator"); + std::string dir1 = makeTestDir(); + std::string dir2 = makeTestDir(); + std::string dir1files[5]; std::string dir2files[5]; for (int i=0; i<5; i++) diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index 821c17f03d..f7af469e66 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -209,10 +209,6 @@ inline LLColor3::LLColor3(const F32 *vec) mV[VBLUE] = vec[VBLUE]; } -#if LL_WINDOWS -# pragma warning( disable : 4996 ) // strncpy teh sux0r -#endif - inline LLColor3::LLColor3(const char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF { if (strlen(color_string) < 6) /* Flawfinder: ignore */ diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 3fdc691141..918a69be6f 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -585,7 +585,7 @@ LLSD HttpCoroJSONHandler::handleSuccess(LLCore::HttpResponse * response, LLCore: LLCore::BufferArrayStream bas(body); - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value jsonRoot = boost::json::parse(bas, ec); if(ec.failed()) { // deserialization failed. Record the reason and pass back an empty map for markup. @@ -610,7 +610,7 @@ LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response, bool &succes LLCore::BufferArrayStream bas(body); - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value jsonRoot = boost::json::parse(bas, ec); if (ec.failed()) { diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index b9a4235a4e..b6cdb81b33 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -406,7 +406,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons // recursively render ellipses at end of string // we've already reserved enough room gGL.pushUIMatrix(); - renderUTF8(std::string("..."), + static LLWString elipses_wstr(utf8string_to_wstring(std::string("..."))); + render(elipses_wstr, 0, (cur_x - origin.mV[VX]) / sScaleX, (F32)y, color, diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 3ff0617554..399f79ad2e 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -231,8 +231,6 @@ void LLBadge::draw() // Calculate badge size based on label text // - LLWString badge_label_wstring = mLabel; - S32 badge_label_begin_offset = 0; S32 badge_char_length = S32_MAX; S32 badge_pixel_length = S32_MAX; @@ -240,7 +238,7 @@ void LLBadge::draw() bool do_not_use_ellipses = false; F32 badge_width = (2.0f * mPaddingHoriz) + - mGLFont->getWidthF32(badge_label_wstring.c_str(), badge_label_begin_offset, badge_char_length); + mGLFont->getWidthF32(mLabel.getWString().c_str(), badge_label_begin_offset, badge_char_length); F32 badge_height = (2.0f * mPaddingVert) + mGLFont->getLineHeight(); @@ -354,7 +352,7 @@ void LLBadge::draw() // Draw the label // - mGLFont->render(badge_label_wstring, + mGLFont->render(mLabel.getWString(), badge_label_begin_offset, badge_center_x + mLabelOffsetHoriz, badge_center_y + mLabelOffsetVert, diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 9e1e3ba120..7b612e445b 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -796,9 +796,6 @@ void LLButton::draw() if( ll::ui::SearchableControl::getHighlighted() ) label_color = ll::ui::SearchableControl::getHighlightColor(); - // Unselected label assignments - LLWString label = getCurrentLabel(); - // overlay with keyboard focus border if (hasFocus()) { @@ -927,8 +924,9 @@ void LLButton::draw() } // Draw label - if( !label.empty() ) + if( !getCurrentLabel().empty() ) // Unselected label assignments { + LLWString label = getCurrentLabel(); LLWStringUtil::trim(label); S32 x; @@ -1082,10 +1080,10 @@ void LLButton::autoResize() resize(getCurrentLabel()); } -void LLButton::resize(LLUIString label) +void LLButton::resize(const LLUIString& label) { // get label length - S32 label_width = mGLFont->getWidth(label.getString()); + S32 label_width = mGLFont->getWidth(label.getWString().c_str()); // get current btn length S32 btn_width =getRect().getWidth(); // check if it need resize diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 80a876393e..a54a5b1a43 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -239,7 +239,7 @@ public: LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; } void autoResize(); // resize with label of current btn state - void resize(LLUIString label); // resize with label input + void resize(const LLUIString& label); // resize with label input void setLabel(const std::string& label); void setLabel(const LLUIString& label); void setLabel( const LLStringExplicit& label); diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index fe4f991921..4f52f5936d 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -183,7 +183,7 @@ void LLConsole::draw() static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f); F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f); - LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground"); + static LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground"); color.mV[VALPHA] *= console_opacity; F32 line_height = (F32)mFont->getLineHeight(); diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index 4c2912cde6..b414e4354d 100644 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -46,7 +46,7 @@ static ContainerViewRegistry::Register<LLPanel> r3("panel", &LLPanel::fromXML); LLContainerView::LLContainerView(const LLContainerView::Params& p) : LLView(p), mShowLabel(p.show_label), - mLabel(p.label), + mLabel(utf8str_to_wstring(p.label)), mDisplayChildren(p.display_children) { mScrollContainer = NULL; @@ -120,8 +120,8 @@ void LLContainerView::draw() // Draw the label if (mShowLabel) { - LLFontGL::getFontMonospace()->renderUTF8( - mLabel, 0, 2, getRect().getHeight() - 2, LLColor4(1,1,1,1), LLFontGL::LEFT, LLFontGL::TOP); + LLFontGL::getFontMonospace()->render( + mLabel, 0, 2.f, (F32)(getRect().getHeight() - 2), LLColor4(1,1,1,1), LLFontGL::LEFT, LLFontGL::TOP); } LLView::draw(); @@ -285,7 +285,7 @@ LLRect LLContainerView::getRequiredRect() void LLContainerView::setLabel(const std::string& label) { - mLabel = label; + mLabel = utf8str_to_wstring(label); } void LLContainerView::setDisplayChildren(bool displayChildren) diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index 319fb7d5e9..c6dd401e85 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -89,6 +89,6 @@ public: protected: bool mDisplayChildren; - std::string mLabel; + LLWString mLabel; }; #endif // LL_CONTAINERVIEW_ diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index bf0862e8a9..11dbad8c09 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -43,6 +43,8 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, mDockWidgetHandle = dockWidget->getHandle(); } + mNonToolbarPanelHandle = mDockableFloater->getRootView()->getChild<LLView>("non_toolbar_panel")->getHandle(); + if (dockableFloater->isDocked()) { on(); @@ -97,7 +99,10 @@ void LLDockControl::setDock(LLView* dockWidget) void LLDockControl::getAllowedRect(LLRect& rect) { - rect = mDockableFloater->getRootView()->getChild<LLView>("non_toolbar_panel")->getRect(); + if(!mNonToolbarPanelHandle.isDead()) + { + rect = mNonToolbarPanelHandle.get()->getRect(); + } } void LLDockControl::repositionDockable() diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index fb0bf7d251..7e31330713 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -84,6 +84,7 @@ private: bool mDockWidgetVisible; DocAt mDockAt; LLHandle<LLView> mDockWidgetHandle; + LLHandle<LLView> mNonToolbarPanelHandle; LLRect mPrevDockRect; LLRect mRootRect; LLRect mFloaterRect; diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 1d4ecbe9c9..388dc5b1ac 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -211,7 +211,7 @@ LLFolderView::LLFolderView(const Params& p) //clear label // go ahead and render root folder as usual // just make sure the label ("Inventory Folder") never shows up - mLabel = LLStringUtil::null; + mLabel.clear(); // Escape is handled by reverting the rename, not commiting it (default behavior) LLLineEditor::Params params; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 4c1733506c..63a600b15f 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -140,7 +140,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mItemHeight(p.item_height), mControlLabelRotation(0.f), mDragAndDropTarget(false), - mLabel(p.name), + mLabel(utf8str_to_wstring(p.name)), mRoot(p.root), mViewModelItem(p.listener), mIsMouseOverTitle(false), @@ -193,7 +193,7 @@ bool LLFolderViewItem::postBuild() { // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) // it also sets search strings so it requires a filter reset - mLabel = vmi->getDisplayName(); + mLabel = utf8str_to_wstring(vmi->getDisplayName()); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -306,7 +306,7 @@ void LLFolderViewItem::refresh() { LLFolderViewModelItem& vmi = *getViewModelItem(); - mLabel = vmi.getDisplayName(); + mLabel = utf8str_to_wstring(vmi.getDisplayName()); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -319,7 +319,7 @@ void LLFolderViewItem::refresh() // Very Expensive! // Can do a number of expensive checks, like checking active motions, wearables or friend list mLabelStyle = vmi.getLabelStyle(); - mLabelSuffix = vmi.getLabelSuffix(); + mLabelSuffix = utf8str_to_wstring(vmi.getLabelSuffix()); } // Dirty the filter flag of the model from the view (CHUI-849) @@ -344,7 +344,7 @@ void LLFolderViewItem::refreshSuffix() // Very Expensive! // Can do a number of expensive checks, like checking active motions, wearables or friend list mLabelStyle = vmi->getLabelStyle(); - mLabelSuffix = vmi->getLabelSuffix(); + mLabelSuffix = utf8str_to_wstring(vmi->getLabelSuffix()); } mLabelWidthDirty = true; @@ -405,7 +405,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height ) // it is purely visual, so it is fine to do at our laisure refreshSuffix(); } - mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(LLFontGL::NORMAL)->getWidth(mLabelSuffix) + mLabelPaddingRight; + mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel.c_str()) + getLabelFontForStyle(LLFontGL::NORMAL)->getWidth(mLabelSuffix.c_str()) + mLabelPaddingRight; mLabelWidthDirty = false; } @@ -890,7 +890,7 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y //--------------------------------------------------------------------------------// // Draw the actual label text // - font->renderUTF8(mLabel, 0, x, y, color, + font->render(mLabel, 0, x, y, color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true); } @@ -944,7 +944,7 @@ void LLFolderViewItem::draw() F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; F32 text_left = (F32)getLabelXPos(); - std::string combined_string = mLabel + mLabelSuffix; + LLWString combined_string = mLabel + mLabelSuffix; const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL); S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset()); @@ -954,8 +954,8 @@ void LLFolderViewItem::draw() S32 top = getRect().getHeight() - TOP_PAD; if(mLabelSuffix.empty() || (font == suffix_font)) { - S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2; - S32 right = left + font->getWidth(combined_string, static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; + S32 left = ll_round(text_left) + font->getWidth(combined_string.c_str(), 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2; + S32 right = left + font->getWidth(combined_string.c_str(), static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -966,8 +966,8 @@ void LLFolderViewItem::draw() S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length); if(label_filter_length > 0) { - S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel, 0, llmin(filter_offset, (S32)mLabel.size()))) - 2; - S32 right = left + (S32)font->getWidthF32(mLabel, filter_offset, label_filter_length) + 2; + S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, llmin(filter_offset, (S32)mLabel.size()))) - 2; + S32 right = left + (S32)font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); box_image->draw(box_rect, sFilterBGColor); @@ -976,8 +976,8 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset))- 2; - S32 right = left + (S32)suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2; + S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset)) - 2; + S32 right = left + (S32)suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); box_image->draw(box_rect, sFilterBGColor); @@ -999,7 +999,7 @@ void LLFolderViewItem::draw() // if (!mLabelSuffix.empty()) { - suffix_font->renderUTF8( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor, + suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x); } @@ -1011,9 +1011,9 @@ void LLFolderViewItem::draw() { if(mLabelSuffix.empty() || (font == suffix_font)) { - F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string, filter_offset, filter_string_length); + F32 match_string_left = text_left + font->getWidthF32(combined_string.c_str(), 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string.c_str(), filter_offset, filter_string_length); F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; - font->renderUTF8(combined_string, filter_offset, match_string_left, yy, + font->render(combined_string, filter_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, filter_string_length, S32_MAX, &right_x); } @@ -1022,9 +1022,9 @@ void LLFolderViewItem::draw() S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length); if(label_filter_length > 0) { - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel, filter_offset, label_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length); F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; - font->renderUTF8(mLabel, filter_offset, match_string_left, yy, + font->render(mLabel, filter_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, label_filter_length, S32_MAX, &right_x); } @@ -1033,9 +1033,9 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length); F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; - suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, + suffix_font->render(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, suffix_filter_length, S32_MAX, &right_x); } diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index f7ced81274..60cdac3ab9 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -89,14 +89,14 @@ protected: LLFolderViewItem(const Params& p); - std::string mLabel; + LLWString mLabel; S32 mLabelWidth; bool mLabelWidthDirty; S32 mLabelPaddingRight; LLFolderViewFolder* mParentFolder; LLPointer<LLFolderViewModelItem> mViewModelItem; LLFontGL::StyleFlags mLabelStyle; - std::string mLabelSuffix; + LLWString mLabelSuffix; bool mSuffixNeedsRefresh; //suffix and icons LLUIImagePtr mIcon, mIconOpen, @@ -242,7 +242,7 @@ public: // This method returns the label displayed on the view. This // method was primarily added to allow sorting on the folder // contents possible before the entire view has been constructed. - const std::string& getLabel() const { return mLabel; } + const LLWString& getLabel() const { return mLabel; } LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; } const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 0038a8ae18..69ffa9a94f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -545,8 +545,8 @@ void LLMenuItemGL::draw( void ) std::string::size_type offset = upper_case_label.find(mJumpKey); if (offset != std::string::npos) { - S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset)); - S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); + S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset)); + S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, (MENU_ITEM_PADDING / 2) + 1, x_end, (MENU_ITEM_PADDING / 2) + 1); } } @@ -1648,9 +1648,9 @@ void LLMenuItemBranchDownGL::draw( void ) std::string::size_type offset = upper_case_label.find(getJumpKey()); if (offset != std::string::npos) { - S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f); - S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset)); - S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); + S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getWString().c_str(), 0, S32_MAX) / 2.f); + S32 x_begin = x_offset + getFont()->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset)); + S32 x_end = x_offset + getFont()->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); } } diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 01e2fc6ac9..6b9a1b1c13 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -245,7 +245,7 @@ bool LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExpli res = mLabelBox->setTextArg(key, text); if (res && mLabelWidth == 0) { - S32 label_width = mFont->getWidth(mLabelBox->getText()); + S32 label_width = mFont->getWidth(mLabelBox->getWText().c_str()); LLRect rect = mLabelBox->getRect(); S32 prev_right = rect.mRight; rect.mRight = rect.mLeft + label_width; diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 9c73b1ba3f..d0eec387bd 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -113,7 +113,8 @@ LLScrollbar::LLScrollbar(const Params & p) up_btn.tab_stop(false); up_btn.follows.flags = (mOrientation == VERTICAL ? (FOLLOWS_RIGHT | FOLLOWS_TOP) : (FOLLOWS_LEFT | FOLLOWS_BOTTOM)); - addChild(LLUICtrlFactory::create<LLButton>(up_btn)); + mLineUpBtn = LLUICtrlFactory::create<LLButton>(up_btn); + addChild(mLineUpBtn); LLButton::Params down_btn(mOrientation == VERTICAL ? p.down_button : p.right_button); down_btn.name(std::string("Line Down")); @@ -123,7 +124,8 @@ LLScrollbar::LLScrollbar(const Params & p) down_btn.mouse_held_callback.function(boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2)); down_btn.tab_stop(false); - addChild(LLUICtrlFactory::create<LLButton>(down_btn)); + mLineDownBtn = LLUICtrlFactory::create<LLButton>(down_btn); + addChild(mLineDownBtn); } @@ -468,22 +470,20 @@ void LLScrollbar::reshape(S32 width, S32 height, bool called_from_parent) { if (width == getRect().getWidth() && height == getRect().getHeight()) return; LLView::reshape( width, height, called_from_parent ); - LLButton* up_button = getChild<LLButton>("Line Up"); - LLButton* down_button = getChild<LLButton>("Line Down"); if (mOrientation == VERTICAL) { - up_button->reshape(up_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - down_button->reshape(down_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - up_button->setOrigin(0, getRect().getHeight() - up_button->getRect().getHeight()); - down_button->setOrigin(0, 0); + mLineUpBtn->reshape(mLineUpBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineDownBtn->reshape(mLineDownBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineUpBtn->setOrigin(0, getRect().getHeight() - mLineUpBtn->getRect().getHeight()); + mLineDownBtn->setOrigin(0, 0); } else { - up_button->reshape(llmin(getRect().getWidth() / 2, mThickness), up_button->getRect().getHeight()); - down_button->reshape(llmin(getRect().getWidth() / 2, mThickness), down_button->getRect().getHeight()); - up_button->setOrigin(0, 0); - down_button->setOrigin(getRect().getWidth() - down_button->getRect().getWidth(), 0); + mLineUpBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineUpBtn->getRect().getHeight()); + mLineDownBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineDownBtn->getRect().getHeight()); + mLineUpBtn->setOrigin(0, 0); + mLineDownBtn->setOrigin(getRect().getWidth() - mLineDownBtn->getRect().getWidth(), 0); } updateThumbRect(); } diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 7b935aa51b..9607355a9d 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -161,6 +161,9 @@ private: LLUIImagePtr mTrackImageH; S32 mThickness; + + LLButton* mLineUpBtn = nullptr; + LLButton* mLineDownBtn = nullptr; }; diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 5dccf9a8ba..88ef4eb0c1 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -305,7 +305,7 @@ bool LLScrollListText::needsToolTip() const return LLScrollListCell::needsToolTip(); // ...otherwise, show tooltips for truncated text - return mFont->getWidth(mText.getString()) > getWidth(); + return mFont->getWidth(mText.getWString().c_str()) > getWidth(); } //virtual @@ -328,7 +328,7 @@ LLScrollListText::~LLScrollListText() S32 LLScrollListText::getContentWidth() const { - return mFont->getWidth(mText.getString()); + return mFont->getWidth(mText.getWString().c_str()); } @@ -394,18 +394,18 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col switch(mFontAlignment) { case LLFontGL::LEFT: - left = mFont->getWidth(mText.getString(), 1, mHighlightOffset); + left = mFont->getWidth(mText.getWString().c_str(), 1, mHighlightOffset); break; case LLFontGL::RIGHT: - left = getWidth() - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX); + left = getWidth() - mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, S32_MAX); break; case LLFontGL::HCENTER: - left = (getWidth() - mFont->getWidth(mText.getString())) / 2; + left = (getWidth() - mFont->getWidth(mText.getWString().c_str())) / 2; break; } LLRect highlight_rect(left - 2, mFont->getLineHeight() + 1, - left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, + left + mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, mHighlightCount) + 1, 1); mRoundedRectImage->draw(highlight_rect, highlight_color); } @@ -613,18 +613,18 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight switch (mFontAlignment) { case LLFontGL::LEFT: - left = mFont->getWidth(mText.getString(), icon_space + 1, mHighlightOffset); + left = mFont->getWidth(mText.getWString().c_str(), icon_space + 1, mHighlightOffset); break; case LLFontGL::RIGHT: - left = getWidth() - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX) - icon_space; + left = getWidth() - mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, S32_MAX) - icon_space; break; case LLFontGL::HCENTER: - left = (getWidth() - mFont->getWidth(mText.getString()) - icon_space) / 2; + left = (getWidth() - mFont->getWidth(mText.getWString().c_str()) - icon_space) / 2; break; } LLRect highlight_rect(left - 2, mFont->getLineHeight() + 1, - left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, + left + mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, mHighlightCount) + 1, 1); mRoundedRectImage->draw(highlight_rect, highlight_color); } @@ -642,12 +642,12 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight break; case LLFontGL::RIGHT: start_text_x = (F32)getWidth(); - start_icon_x = getWidth() - mFont->getWidth(mText.getString()) - icon_space; + start_icon_x = getWidth() - mFont->getWidth(mText.getWString().c_str()) - icon_space; break; case LLFontGL::HCENTER: F32 center = (F32)getWidth()* 0.5f; start_text_x = center + ((F32)icon_space * 0.5f); - start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getString())) * 0.5f)); + start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getWString().c_str())) * 0.5f)); break; } mFont->render(mText.getWString(), 0, diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 1d9564d107..e711a6ed1b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -196,7 +196,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mHighlightedItem(-1), mBorder(NULL), mSortCallback(NULL), - mCommentTextView(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mTotalColumnPadding(0), @@ -288,13 +287,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) addColumn(*row_it); } - for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows.begin(); - row_it != p.contents.rows.end(); - ++row_it) - { - addRow(*row_it); - } - LLTextBox::Params text_p; text_p.name("comment_text"); text_p.border_visible(false); @@ -302,7 +294,15 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) text_p.follows.flags(FOLLOWS_ALL); // word wrap was added accroding to the EXT-6841 text_p.wrap(true); - addChild(LLUICtrlFactory::create<LLTextBox>(text_p)); + mCommentText = LLUICtrlFactory::create<LLTextBox>(text_p); + addChild(mCommentText); + + for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows.begin(); + row_it != p.contents.rows.end(); + ++row_it) + { + addRow(*row_it); + } } S32 LLScrollListCtrl::getSearchColumn() @@ -541,12 +541,7 @@ void LLScrollListCtrl::updateLayout() getRect().getWidth() - 2 * mBorderThickness, getRect().getHeight() - (2 * mBorderThickness ) - heading_size ); - if (mCommentTextView == NULL) - { - mCommentTextView = getChildView("comment_text"); - } - - mCommentTextView->setShape(mItemListRect); + mCommentText->setShape(mItemListRect); // how many lines of content in a single "page" S32 page_lines = getLinesPerPage(); @@ -664,7 +659,7 @@ S32 LLScrollListCtrl::calcMaxContentWidth() if (mColumnWidthsDirty) { // update max content width for this column, by looking at all items - column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel) + mColumnPadding + HEADING_TEXT_PADDING : 0; + column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel.getWString().c_str()) + mColumnPadding + HEADING_TEXT_PADDING : 0; item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) { @@ -1244,7 +1239,7 @@ void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change) void LLScrollListCtrl::setCommentText(const std::string& comment_text) { - getChild<LLTextBox>("comment_text")->setValue(comment_text); + mCommentText->setValue(comment_text); } LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos) @@ -1479,10 +1474,9 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const item = getFirstSelected(); if (item) { - auto col = item->getColumn(column); - if(col) + if (LLScrollListCell* cell = item->getColumn(column)) { - return col->getValue().asString(); + return cell->getValue().asString(); } } @@ -1728,7 +1722,7 @@ void LLScrollListCtrl::draw() updateColumns(); - getChildView("comment_text")->setVisible(mItemList.empty()); + mCommentText->setVisible(mItemList.empty()); drawItems(); @@ -2720,7 +2714,8 @@ struct SameSortColumn bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending) { LLScrollListColumn* sort_column = getColumn(column_idx); - if (!sort_column) return false; + if (!sort_column) + return false; sort_column->mSortDirection = ascending ? LLScrollListColumn::ASCENDING : LLScrollListColumn::DESCENDING; @@ -2733,32 +2728,28 @@ bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending) mSortColumns.push_back(new_sort_column); return true; } - else - { - // grab current sort column - sort_column_t cur_sort_column = mSortColumns.back(); - // remove any existing sort criterion referencing this column - // and add the new one - mSortColumns.erase(remove_if(mSortColumns.begin(), mSortColumns.end(), SameSortColumn(column_idx)), mSortColumns.end()); - mSortColumns.push_back(new_sort_column); + // grab current sort column + sort_column_t cur_sort_column = mSortColumns.back(); - // did the sort criteria change? - return (cur_sort_column != new_sort_column); - } + // remove any existing sort criterion referencing this column + // and add the new one + mSortColumns.erase(remove_if(mSortColumns.begin(), mSortColumns.end(), SameSortColumn(column_idx)), mSortColumns.end()); + mSortColumns.push_back(new_sort_column); + + // did the sort criteria change? + return cur_sort_column != new_sort_column; } S32 LLScrollListCtrl::getLinesPerPage() { - //if mPageLines is NOT provided display all item if (mPageLines) { return mPageLines; } - else - { - return mLineHeight ? mItemListRect.getHeight() / mLineHeight : getItemCount(); - } + + // If mPageLines is NOT provided then display all items + return mLineHeight ? mItemListRect.getHeight() / mLineHeight : getItemCount(); } @@ -2774,7 +2765,7 @@ void LLScrollListCtrl::sortByColumn(const std::string& name, bool ascending) column_map_t::iterator itor = mColumns.find(name); if (itor != mColumns.end()) { - sortByColumnIndex((*itor).second->mIndex, ascending); + sortByColumnIndex(itor->second->mIndex, ascending); } } @@ -3093,8 +3084,7 @@ std::string LLScrollListCtrl::getSortColumnName() { LLScrollListColumn* column = mSortColumns.empty() ? NULL : mColumnsIndexed[mSortColumns.back().first]; - if (column) return column->mName; - else return ""; + return column ? column->mName : LLStringUtil::null; } bool LLScrollListCtrl::hasSortOrder() const diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index f25ba61fd4..1f9f26e08b 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -530,7 +530,7 @@ private: class LLViewBorder* mBorder; LLHandle<LLContextMenu> mPopupMenuHandle; - LLView *mCommentTextView; + LLTextBox* mCommentText = nullptr; LLWString mSearchString; LLFrameTimer mSearchTimer; diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 22579205d8..0c3ab6bda0 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -225,7 +225,7 @@ bool LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& res = mLabelBox->setTextArg(key, text); if (res && mLabelFont && mLabelWidth == 0) { - S32 label_width = mLabelFont->getWidth(mLabelBox->getText()); + S32 label_width = mLabelFont->getWidth(mLabelBox->getWText().c_str()); LLRect rect = mLabelBox->getRect(); S32 prev_right = rect.mRight; rect.mRight = rect.mLeft + label_width; diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 4273fae71e..2693243eb1 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -598,7 +598,7 @@ LLRect LLStatBar::getRequiredRect() void LLStatBar::drawLabelAndValue( F32 value, std::string &label, LLRect &bar_rect, S32 decimal_digits ) { - LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), + LLFontGL::getFontMonospace()->render(mLabel.getWString(), 0, 0.F, (F32)getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), LLFontGL::LEFT, LLFontGL::TOP); std::string value_str = !llisnan(value) @@ -673,14 +673,14 @@ void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect ) { decimal_digits = 0; } - std::string tick_label = llformat("%.*f", decimal_digits, tick_value); - S32 tick_label_width = LLFontGL::getFontMonospace()->getWidth(tick_label); + LLWString tick_label = utf8str_to_wstring(llformat("%.*f", decimal_digits, tick_value)); + S32 tick_label_width = LLFontGL::getFontMonospace()->getWidth(tick_label.c_str()); if (mOrientation == HORIZONTAL) { if (tick_begin > last_label + MIN_LABEL_SPACING) { gl_rect_2d(bar_rect.mLeft, tick_end, bar_rect.mRight - TICK_LENGTH, tick_begin, LLColor4(1.f, 1.f, 1.f, 0.25f)); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_rect.mRight, tick_begin, + LLFontGL::getFontMonospace()->render(tick_label, 0, (F32)bar_rect.mRight, (F32)tick_begin, LLColor4(1.f, 1.f, 1.f, 0.5f), LLFontGL::LEFT, LLFontGL::VCENTER); last_label = tick_begin; @@ -696,7 +696,7 @@ void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect ) { gl_rect_2d(tick_begin, bar_rect.mTop, tick_end, bar_rect.mBottom - TICK_LENGTH, LLColor4(1.f, 1.f, 1.f, 0.25f)); S32 label_pos = tick_begin - ll_round((F32)tick_label_width * ((F32)tick_begin / (F32)bar_rect.getWidth())); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, label_pos, bar_rect.mBottom - TICK_LENGTH, + LLFontGL::getFontMonospace()->render(tick_label, 0, (F32)label_pos, (F32)(bar_rect.mBottom - TICK_LENGTH), LLColor4(1.f, 1.f, 1.f, 0.5f), LLFontGL::LEFT, LLFontGL::TOP); last_label = label_pos; diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index 95a9493323..28b4d387f1 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -93,8 +93,6 @@ void LLStatGraph::draw() mUpdateTimer.reset(); } - LLColor4 color; - threshold_vec_t::iterator it = std::lower_bound(mThresholds.begin(), mThresholds.end(), Threshold(mValue / mMax, LLUIColor())); if (it != mThresholds.begin()) @@ -102,15 +100,14 @@ void LLStatGraph::draw() it--; } - color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); - gGL.color4fv(color.mV); + static LLColor4 default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); + gGL.color4fv(default_color.mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true); gGL.color4fv(LLColor4::black.mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, false); - color = it->mColor; - gGL.color4fv(color.mV); + gGL.color4fv(it->mColor().mV); gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, true); } diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 198441804b..79d2fcd049 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -239,7 +239,7 @@ std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) cons return url; } LLUriParser up(escapeUrl(url)); - if (up.normalize() == 0) + if (up.normalize()) { std::string label; up.extractParts(); diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 3a4ce6a72f..cec1ddfc57 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -221,7 +221,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL if (match_entry == mUrlEntryTrusted) { LLUriParser up(url); - if (up.normalize() == 0) + if (up.normalize()) { url = up.normalizedUri(); } diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 1bf3e3c43b..e5e0545dad 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -98,6 +98,7 @@ void LLViewerEventRecorder::setMouseGlobalCoords(S32 x, S32 y) { } void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 global_x, S32 global_y, std::string mName) { + if (!logEvents) return; LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), xui); if (! target_view) { @@ -126,6 +127,8 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype) { + if (!logEvents) return; + LLSD event=LLSD::emptyMap(); event.insert("event",LLSD(std::string("visibility"))); @@ -167,6 +170,7 @@ void LLViewerEventRecorder::update_xui(std::string xui) { void LLViewerEventRecorder::logKeyEvent(KEY key, MASK mask) { + if (!logEvents) return; // NOTE: Event recording only logs keydown events - the viewer itself hides keyup events at a fairly low level in the code and does not appear to care about them anywhere LLSD event = LLSD::emptyMap(); diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index e48bc94b0a..8131a56288 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -81,8 +81,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.background_visible = true; panel_p.bg_alpha_image = params.bg_image; panel_p.auto_resize = false; - LLLayoutPanel* notification_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); - stackp->addChild(notification_panel); + mNotificationsArea = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); + stackp->addChild(mNotificationsArea); panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); panel_p.auto_resize = true; @@ -92,15 +92,15 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.mouse_opaque = false; panel_p.background_visible = false; panel_p.bg_alpha_color = params.shade_color; - LLLayoutPanel* dummy_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); - stackp->addChild(dummy_panel); + mBackgroundArea = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); + stackp->addChild(mBackgroundArea); layout_p = LLUICtrlFactory::getDefaultParams<LLLayoutStack>(); layout_p.rect = LLRect(0, 30, 800, 0); layout_p.follows.flags = FOLLOWS_ALL; layout_p.orientation = LLLayoutStack::HORIZONTAL; stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p); - notification_panel->addChild(stackp); + mNotificationsArea->addChild(stackp); panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); panel_p.rect.height = 30; @@ -121,7 +121,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) text_p.name = "notification_text"; text_p.use_ellipses = true; text_p.wrap = true; - panel->addChild(LLUICtrlFactory::create<LLTextBox>(text_p)); + mNotificationsText = LLUICtrlFactory::create<LLTextBox>(text_p); + panel->addChild(mNotificationsText); panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); panel_p.auto_resize = false; @@ -154,11 +155,9 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) void LLWindowShade::draw() { - LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect(); + LLRect message_rect = mNotificationsText->getTextBoundingRect(); - LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area"); - - notification_area->reshape(notification_area->getRect().getWidth(), + mNotificationsArea->reshape(mNotificationsArea->getRect().getWidth(), llclamp(message_rect.getHeight() + 15, llmax(mFormHeight, MIN_NOTIFICATION_AREA_HEIGHT), MAX_NOTIFICATION_AREA_HEIGHT)); @@ -176,21 +175,21 @@ void LLWindowShade::draw() { hide(); } - else if (notification_area->getVisibleAmount() < 0.01f) + else if (mNotificationsArea->getVisibleAmount() < 0.01f) { displayLatestNotification(); } - if (!notification_area->getVisible() && (notification_area->getVisibleAmount() < 0.001f)) + if (!mNotificationsArea->getVisible() && (mNotificationsArea->getVisibleAmount() < 0.001f)) { - getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false); + mBackgroundArea->setBackgroundVisible(false); setMouseOpaque(false); } } void LLWindowShade::hide() { - getChildRef<LLLayoutPanel>("notification_area").setVisible(false); + mNotificationsArea->setVisible(false); } void LLWindowShade::onCloseNotification() @@ -244,13 +243,12 @@ void LLWindowShade::displayLatestNotification() LLSD payload = notification->getPayload(); LLNotificationFormPtr formp = notification->getForm(); - LLLayoutPanel& notification_area = getChildRef<LLLayoutPanel>("notification_area"); - notification_area.getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon()); - notification_area.getChild<LLUICtrl>("notification_text")->setValue(notification->getMessage()); - notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(notification->getMessage()); + mNotificationsArea->getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon()); + mNotificationsText->setValue(notification->getMessage()); + mNotificationsText->setToolTip(notification->getMessage()); LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); - LLLayoutPanel& form_elements = notification_area.getChildRef<LLLayoutPanel>("form_elements"); + LLLayoutPanel& form_elements = mNotificationsArea->getChildRef<LLLayoutPanel>("form_elements"); form_elements.deleteAllChildren(); form_elements.reshape(form_elements.getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT); @@ -355,25 +353,25 @@ void LLWindowShade::displayLatestNotification() (*it)->translate(0, delta_y); } - getChildRef<LLLayoutPanel>("notification_area").setVisible(true); - getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(mModal); + mNotificationsArea->setVisible(true); + mBackgroundArea->setBackgroundVisible(mModal); setMouseOpaque(mModal); } void LLWindowShade::setBackgroundImage(LLUIImage* image) { - getChild<LLLayoutPanel>("notification_area")->setTransparentImage(image); + mNotificationsArea->setTransparentImage(image); } void LLWindowShade::setTextColor(LLColor4 color) { - getChild<LLTextBox>("notification_text")->setColor(color); + mNotificationsText->setColor(color); } bool LLWindowShade::isShown() const { - return getChildRef<LLLayoutPanel>("notification_area").getVisible(); + return mNotificationsArea->getVisible(); } void LLWindowShade::setCanClose(bool can_close) diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index a401394d78..da29188943 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -31,6 +31,9 @@ #include "llnotifications.h" #include "lluiimage.h" +class LLLayoutPanel; +class LLTextBox; + class LLWindowShade : public LLUICtrl { public: @@ -68,6 +71,10 @@ private: void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name); void onClickIgnore(LLUICtrl* ctrl); + LLLayoutPanel* mBackgroundArea = nullptr; + LLLayoutPanel* mNotificationsArea = nullptr; + LLTextBox* mNotificationsText = nullptr; + std::vector<LLNotificationPtr> mNotifications; LLSD mNotificationResponse; bool mModal; diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h index 2fb5525519..c1acd77275 100644 --- a/indra/llwebrtc/llwebrtc_impl.h +++ b/indra/llwebrtc/llwebrtc_impl.h @@ -41,6 +41,7 @@ #include "llwebrtc.h" // WebRTC Includes #ifdef WEBRTC_WIN +#pragma warning(push) #pragma warning(disable : 4996) // ignore 'deprecated.' We don't use the functions marked // deprecated in the webrtc headers, but msvc complains anyway. // Clang doesn't, and that's generally what webrtc uses. @@ -63,7 +64,6 @@ #include "api/task_queue/default_task_queue_factory.h" #include "modules/audio_device/include/audio_device_defines.h" - namespace llwebrtc { @@ -379,4 +379,8 @@ class LLWebRTCPeerConnectionImpl : public LLWebRTCPeerConnectionInterface, } +#if WEBRTC_WIN +#pragma warning(pop) +#endif + #endif // LLWEBRTC_IMPL_H diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 5b29bfd973..4b2306da87 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -171,7 +171,7 @@ public: void *getPlatformWindow() override; void bringToFront() override; - + void setLanguageTextInput(const LLCoordGL& pos) override; void spawnWebBrowser(const std::string &escaped_url, bool async) override; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index cc5c7f5d12..e67286af3d 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -44,7 +44,6 @@ include(ViewerManager) include(VisualLeakDetector) include(VulkanGltf) include(ZLIBNG) -include(URIPARSER) include(LLPrimitive) if (NOT HAVOK_TPV) @@ -278,6 +277,7 @@ set(viewer_SOURCE_FILES llfloaterregioninfo.cpp llfloaterreporter.cpp llfloaterregionrestarting.cpp + llfloaterregionrestartschedule.cpp llfloatersavecamerapreset.cpp llfloatersaveprefpreset.cpp llfloatersceneloadstats.cpp @@ -945,6 +945,7 @@ set(viewer_HEADER_FILES llfloaterregioninfo.h llfloaterreporter.h llfloaterregionrestarting.h + llfloaterregionrestartschedule.h llfloatersavecamerapreset.h llfloatersaveprefpreset.h llfloatersceneloadstats.h @@ -1728,7 +1729,6 @@ if (WINDOWS) ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg ${SHARED_LIB_STAGING_DIR}/openjp2.dll ${SHARED_LIB_STAGING_DIR}/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/uriparser.dll ${SHARED_LIB_STAGING_DIR}/llwebrtc.dll #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/SLVoice.exe #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/libsndfile-1.dll diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0f0b8d4c2a..092cd5b87b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12693,6 +12693,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>Use24HourClock</key> + <map> + <key>Comment</key> + <string>12 vs 24. At the moment only for region restart schedule floater</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>EnvironmentPersistAcrossLogin</key> <map> <key>Comment</key> @@ -14219,6 +14230,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>DisableLookAtAnimation</key> + <map> + <key>Comment</key> + <string>Avatar follows cursor with avatars eyes, when disabled, avatar will look forward</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>WebProfileFloaterRect</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 625a7b7fba..ad817d5747 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -683,7 +683,7 @@ bool LLAppViewerWin32::init() } else { - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value build_data = boost::json::parse(inf, ec); if(ec.failed()) { diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 214b5f5cde..8e9ab8f87f 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -451,7 +451,7 @@ void LLAvatarTracker::findAgent() msg->nextBlockFast(_PREHASH_AgentBlock); msg->addUUIDFast(_PREHASH_Hunter, gAgentID); msg->addUUIDFast(_PREHASH_Prey, mTrackingData->mAvatarID); - msg->addU32Fast(_PREHASH_SpaceIP, 0); // will get filled in by simulator + msg->addIPAddrFast(_PREHASH_SpaceIP, 0); // will get filled in by simulator msg->nextBlockFast(_PREHASH_LocationBlock); const F64 NO_LOCATION = 0.0; msg->addF64Fast(_PREHASH_GlobalX, NO_LOCATION); diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 42fe8fc6e6..748e10160c 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -41,7 +41,7 @@ public: : LLTextSegment(start, end), mEditor(editor), mStyle(style), - mExpanderLabel(more_text) + mExpanderLabel(utf8str_to_wstring(more_text)) {} /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const @@ -80,7 +80,7 @@ public: /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect) { F32 right_x; - mStyle->getFont()->renderUTF8(mExpanderLabel, start, + mStyle->getFont()->render(mExpanderLabel, start, draw_rect.mRight, draw_rect.mTop, mStyle->getColor(), LLFontGL::RIGHT, LLFontGL::TOP, @@ -103,7 +103,7 @@ public: private: LLTextBase& mEditor; LLStyleSP mStyle; - std::string mExpanderLabel; + LLWString mExpanderLabel; }; LLExpandableTextBox::LLTextBoxEx::Params::Params() diff --git a/indra/newview/llfloaterconversationlog.cpp b/indra/newview/llfloaterconversationlog.cpp index 648d3af5a5..97399c9cf7 100644 --- a/indra/newview/llfloaterconversationlog.cpp +++ b/indra/newview/llfloaterconversationlog.cpp @@ -55,10 +55,11 @@ bool LLFloaterConversationLog::postBuild() } // Use the context menu of the Conversation list for the Conversation tab gear menu. + mConversationsGearBtn = getChild<LLMenuButton>("conversations_gear_btn"); LLToggleableMenu* conversations_gear_menu = mConversationLogList->getContextMenu(); if (conversations_gear_menu) { - getChild<LLMenuButton>("conversations_gear_btn")->setMenu(conversations_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); + mConversationsGearBtn->setMenu(conversations_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); } getChild<LLFilterEditor>("people_filter_input")->setCommitCallback(boost::bind(&LLFloaterConversationLog::onFilterEdit, this, _2)); @@ -68,7 +69,7 @@ bool LLFloaterConversationLog::postBuild() void LLFloaterConversationLog::draw() { - getChild<LLMenuButton>("conversations_gear_btn")->setEnabled(mConversationLogList->getSelectedItem() != NULL); + mConversationsGearBtn->setEnabled(mConversationLogList->getSelectedItem() != NULL); LLFloater::draw(); } diff --git a/indra/newview/llfloaterconversationlog.h b/indra/newview/llfloaterconversationlog.h index 85ca37c530..c82237c108 100644 --- a/indra/newview/llfloaterconversationlog.h +++ b/indra/newview/llfloaterconversationlog.h @@ -29,6 +29,7 @@ #include "llfloater.h" class LLConversationLogList; +class LLMenuButton; class LLFloaterConversationLog : public LLFloater { @@ -50,6 +51,7 @@ private: bool isActionChecked(const LLSD& userdata); LLConversationLogList* mConversationLogList; + LLMenuButton* mConversationsGearBtn = nullptr; }; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index a0b56b14f0..2eebb6cc64 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -262,6 +262,7 @@ bool LLFloaterIMSessionTab::postBuild() { bool result; + mContentsView = getChild<LLView>("contents_view"); mBodyStack = getChild<LLLayoutStack>("main_stack"); mParticipantListAndHistoryStack = getChild<LLLayoutStack>("im_panels"); @@ -861,7 +862,6 @@ void LLFloaterIMSessionTab::hideOrShowTitle() { const LLFloater::Params& default_params = LLFloater::getDefaultParams(); S32 floater_header_size = default_params.header_height; - LLView* floater_contents = getChild<LLView>("contents_view"); LLRect floater_rect = getLocalRect(); S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0); @@ -869,7 +869,7 @@ void LLFloaterIMSessionTab::hideOrShowTitle() LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom); mDragHandle->setShape(handle_rect); mDragHandle->setVisible(isTornOff()); - floater_contents->setShape(contents_rect); + mContentsView->setShape(contents_rect); } void LLFloaterIMSessionTab::updateSessionName(const std::string& name) diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 0a8502cfc5..29e10184b1 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -164,6 +164,7 @@ protected: LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item); LLUUID mSessionID; + LLView* mContentsView; LLLayoutStack* mBodyStack; LLLayoutStack* mParticipantListAndHistoryStack; LLLayoutPanel* mParticipantListPanel; // add the widgets to that see mConversationsListPanel diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 41b6025e0f..bec76fe5e4 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2443,19 +2443,34 @@ LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) bool LLPanelLandAccess::postBuild() { - childSetCommitCallback("public_access", onCommitPublicAccess, this); - childSetCommitCallback("limit_payment", onCommitAny, this); - childSetCommitCallback("limit_age_verified", onCommitAny, this); - childSetCommitCallback("GroupCheck", onCommitGroupCheck, this); - childSetCommitCallback("PassCheck", onCommitAny, this); - childSetCommitCallback("pass_combo", onCommitAny, this); - childSetCommitCallback("PriceSpin", onCommitAny, this); - childSetCommitCallback("HoursSpin", onCommitAny, this); - - childSetAction("add_allowed", boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); - childSetAction("remove_allowed", onClickRemoveAccess, this); - childSetAction("add_banned", boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); - childSetAction("remove_banned", onClickRemoveBanned, this); + mPaymentInfoCheck = getChild<LLUICtrl>("limit_payment"); + mPaymentInfoCheck->setCommitCallback(onCommitAny, this); + mAgeVerifiedCheck = getChild<LLUICtrl>("limit_age_verified"); + mAgeVerifiedCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassCheck = getChild<LLUICtrl>("PassCheck"); + mTemporaryPassCheck->setCommitCallback(onCommitAny, this); + mPublicAccessCheck = getChild<LLUICtrl>("public_access"); + mPublicAccessCheck->setCommitCallback(onCommitPublicAccess, this); + mGroupAccessCheck = getChild<LLUICtrl>("GroupCheck"); + mGroupAccessCheck->setCommitCallback(onCommitGroupCheck, this); + mTemporaryPassCombo = getChild<LLComboBox>("pass_combo"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassPriceSpin = getChild<LLUICtrl>("PriceSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassHourSpin = getChild<LLUICtrl>("HoursSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + + mAllowText = getChild<LLUICtrl>("AllowedText"); + mBanText = getChild<LLUICtrl>("BanCheck"); + + mBtnAddAllowed = getChild<LLButton>("add_allowed"); + mBtnAddAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); + mBtnRemoveAllowed = getChild<LLButton>("remove_allowed"); + mBtnRemoveAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveAccess, this)); + mBtnAddBanned = getChild<LLButton>("add_banned"); + mBtnAddBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); + mBtnRemoveBanned = getChild<LLButton>("remove_banned"); + mBtnRemoveBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveBanned, this)); mListAccess = getChild<LLNameListCtrl>("AccessList"); if (mListAccess) @@ -2494,17 +2509,17 @@ void LLPanelLandAccess::refresh() if (parcel->getRegionAllowAccessOverride()) { - getChild<LLUICtrl>("public_access")->setValue(public_access); - getChild<LLUICtrl>("GroupCheck")->setValue(use_group); + mPublicAccessCheck->setValue(public_access); + mGroupAccessCheck->setValue(use_group); } else { - getChild<LLUICtrl>("public_access")->setValue(true); - getChild<LLUICtrl>("GroupCheck")->setValue(false); + mPublicAccessCheck->setValue(true); + mGroupAccessCheck->setValue(false); } std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name ); + mGroupAccessCheck->setLabelArg("[GROUP]", group_name ); // Allow list if (mListAccess) @@ -2513,11 +2528,11 @@ void LLPanelLandAccess::refresh() mListAccess->clearSortOrder(); mListAccess->deleteAllItems(); auto count = parcel->mAccessList.size(); - getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); - getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mAllowText->setTextArg("[COUNT]", llformat("%d", count)); + mAllowText->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mListAccess->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); + mListAccess->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); for (LLAccessEntry::map::const_iterator cit = parcel->mAccessList.begin(); cit != parcel->mAccessList.end(); ++cit) @@ -2561,11 +2576,11 @@ void LLPanelLandAccess::refresh() mListBanned->clearSortOrder(); mListBanned->deleteAllItems(); auto count = parcel->mBanList.size(); - getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); - getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mBanText->setTextArg("[COUNT]", llformat("%d",count)); + mBanText->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mListBanned->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); + mListBanned->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); for (LLAccessEntry::map::const_iterator cit = parcel->mBanList.begin(); cit != parcel->mBanList.end(); ++cit) @@ -2622,75 +2637,74 @@ void LLPanelLandAccess::refresh() if(parcel->getRegionDenyAnonymousOverride()) { - getChild<LLUICtrl>("limit_payment")->setValue(true); - getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); + mPaymentInfoCheck->setValue(true); + mPaymentInfoCheck->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); } else { - getChild<LLUICtrl>("limit_payment")->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS))); - getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() ); + mPaymentInfoCheck->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS))); + mPaymentInfoCheck->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() ); } if(parcel->getRegionDenyAgeUnverifiedOverride()) { - getChild<LLUICtrl>("limit_age_verified")->setValue(true); - getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") ); + mAgeVerifiedCheck->setValue(true); + mAgeVerifiedCheck->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") ); } else { - getChild<LLUICtrl>("limit_age_verified")->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); - getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() ); + mAgeVerifiedCheck->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); + mAgeVerifiedCheck->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() ); } bool use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); - getChild<LLUICtrl>("PassCheck")->setValue(use_pass); - LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo"); - if (passcombo) + mTemporaryPassCheck->setValue(use_pass); + if (mTemporaryPassCombo) { if (public_access || !use_pass) { - passcombo->selectByValue("anyone"); + mTemporaryPassCombo->selectByValue("anyone"); } } S32 pass_price = parcel->getPassPrice(); - getChild<LLUICtrl>("PriceSpin")->setValue((F32)pass_price ); + mTemporaryPassPriceSpin->setValue((F32)pass_price); F32 pass_hours = parcel->getPassHours(); - getChild<LLUICtrl>("HoursSpin")->setValue(pass_hours ); + mTemporaryPassHourSpin->setValue(pass_hours); } else { - getChild<LLUICtrl>("public_access")->setValue(false); - getChild<LLUICtrl>("limit_payment")->setValue(false); - getChild<LLUICtrl>("limit_age_verified")->setValue(false); - getChild<LLUICtrl>("GroupCheck")->setValue(false); - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", LLStringUtil::null ); - getChild<LLUICtrl>("PassCheck")->setValue(false); - getChild<LLUICtrl>("PriceSpin")->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); - getChild<LLUICtrl>("HoursSpin")->setValue(PARCEL_PASS_HOURS_DEFAULT ); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); + mPublicAccessCheck->setValue(false); + mPaymentInfoCheck->setValue(false); + mAgeVerifiedCheck->setValue(false); + mGroupAccessCheck->setValue(false); + mGroupAccessCheck->setLabelArg("[GROUP]", LLStringUtil::null ); + mTemporaryPassCheck->setValue(false); + mTemporaryPassPriceSpin->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); + mTemporaryPassHourSpin->setValue(PARCEL_PASS_HOURS_DEFAULT ); + mListAccess->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); + mListAccess->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); + mListBanned->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); + mListBanned->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); } } void LLPanelLandAccess::refresh_ui() { - getChildView("public_access")->setEnabled(false); - getChildView("limit_payment")->setEnabled(false); - getChildView("limit_age_verified")->setEnabled(false); - getChildView("GroupCheck")->setEnabled(false); - getChildView("PassCheck")->setEnabled(false); - getChildView("pass_combo")->setEnabled(false); - getChildView("PriceSpin")->setEnabled(false); - getChildView("HoursSpin")->setEnabled(false); - getChildView("AccessList")->setEnabled(false); - getChildView("BannedList")->setEnabled(false); - getChildView("add_allowed")->setEnabled(false); - getChildView("remove_allowed")->setEnabled(false); - getChildView("add_banned")->setEnabled(false); - getChildView("remove_banned")->setEnabled(false); + mPublicAccessCheck->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); + mGroupAccessCheck->setEnabled(false); + mTemporaryPassCheck->setEnabled(false); + mTemporaryPassCombo->setEnabled(false); + mTemporaryPassPriceSpin->setEnabled(false); + mTemporaryPassHourSpin->setEnabled(false); + mListAccess->setEnabled(false); + mListBanned->setEnabled(false); + mBtnAddAllowed->setEnabled(false); + mBtnRemoveAllowed->setEnabled(false); + mBtnAddBanned->setEnabled(false); + mBtnRemoveBanned->setEnabled(false); LLParcel *parcel = mParcel->getParcel(); if (parcel && !gDisconnected) @@ -2703,73 +2717,64 @@ void LLPanelLandAccess::refresh_ui() can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); } - getChildView("public_access")->setEnabled(can_manage_allowed); - bool public_access = getChild<LLUICtrl>("public_access")->getValue().asBoolean(); + mPublicAccessCheck->setEnabled(can_manage_allowed); + bool public_access = mPublicAccessCheck->getValue().asBoolean(); if (public_access) { bool override = false; if(parcel->getRegionDenyAnonymousOverride()) { override = true; - getChildView("limit_payment")->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); } else { - getChildView("limit_payment")->setEnabled(can_manage_allowed); + mPaymentInfoCheck->setEnabled(can_manage_allowed); } if(parcel->getRegionDenyAgeUnverifiedOverride()) { override = true; - getChildView("limit_age_verified")->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); } else { - getChildView("limit_age_verified")->setEnabled(can_manage_allowed); + mAgeVerifiedCheck->setEnabled(can_manage_allowed); } - if (override) - { - getChildView("Only Allow")->setToolTip(getString("estate_override")); - } - else - { - getChildView("Only Allow")->setToolTip(std::string()); - } - getChildView("PassCheck")->setEnabled(false); - getChildView("pass_combo")->setEnabled(false); - getChildView("AccessList")->setEnabled(false); + mTemporaryPassCheck->setEnabled(false); + mTemporaryPassCombo->setEnabled(false); + mListAccess->setEnabled(false); } else { - getChildView("limit_payment")->setEnabled(false); - getChildView("limit_age_verified")->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); - - bool sell_passes = getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); - getChildView("PassCheck")->setEnabled(can_manage_allowed); + bool sell_passes = mTemporaryPassCheck->getValue().asBoolean(); + mTemporaryPassCheck->setEnabled(can_manage_allowed); if (sell_passes) { - getChildView("pass_combo")->setEnabled(can_manage_allowed); - getChildView("PriceSpin")->setEnabled(can_manage_allowed); - getChildView("HoursSpin")->setEnabled(can_manage_allowed); + mTemporaryPassCombo->setEnabled(can_manage_allowed); + mTemporaryPassPriceSpin->setEnabled(can_manage_allowed); + mTemporaryPassHourSpin->setEnabled(can_manage_allowed); } } std::string group_name; if (gCacheName->getGroupName(parcel->getGroupID(), group_name)) { - bool can_allow_groups = !public_access || (public_access && (getChild<LLUICtrl>("limit_payment")->getValue().asBoolean() ^ getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean())); - getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups); + bool can_allow_groups = !public_access || (public_access && (mPaymentInfoCheck->getValue().asBoolean() ^ mAgeVerifiedCheck->getValue().asBoolean())); + mGroupAccessCheck->setEnabled(can_manage_allowed && can_allow_groups); } - getChildView("AccessList")->setEnabled(can_manage_allowed); + mListAccess->setEnabled(can_manage_allowed); auto allowed_list_count = parcel->mAccessList.size(); - getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); + mBtnAddAllowed->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); bool has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); - getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected); + mBtnRemoveAllowed->setEnabled(can_manage_allowed && has_selected); - getChildView("BannedList")->setEnabled(can_manage_banned); + mListBanned->setEnabled(can_manage_banned); auto banned_list_count = parcel->mBanList.size(); - getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); + mBtnAddBanned->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0); - getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected); + mBtnRemoveBanned->setEnabled(can_manage_banned && has_selected); } } @@ -2783,7 +2788,7 @@ void LLPanelLandAccess::refreshNames() { gCacheName->getGroupName(parcel->getGroupID(), group_name); } - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name); + mGroupAccessCheck->setLabelArg("[GROUP]", group_name); } @@ -2817,9 +2822,9 @@ void LLPanelLandAccess::onCommitGroupCheck(LLUICtrl *ctrl, void *userdata) return; } - bool use_pass_list = !self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); - LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); + bool use_pass_list = !self->mPublicAccessCheck->getValue().asBoolean(); + bool use_access_group = self->mGroupAccessCheck->getValue().asBoolean(); + LLCtrlSelectionInterface* passcombo = self->mTemporaryPassCombo; if (passcombo) { if (use_access_group && use_pass_list) @@ -2846,8 +2851,8 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } // Extract data from UI - bool public_access = self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); + bool public_access = self->mPublicAccessCheck->getValue().asBoolean(); + bool use_access_group = self->mGroupAccessCheck->getValue().asBoolean(); if (use_access_group) { std::string group_name; @@ -2864,14 +2869,14 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) if (public_access) { use_access_list = false; - limit_payment = self->getChild<LLUICtrl>("limit_payment")->getValue().asBoolean(); - limit_age_verified = self->getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean(); + limit_payment = self->mPaymentInfoCheck->getValue().asBoolean(); + limit_age_verified = self->mAgeVerifiedCheck->getValue().asBoolean(); } else { use_access_list = true; - use_pass_list = self->getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); - LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); + use_pass_list = self->mTemporaryPassCheck->getValue().asBoolean(); + LLCtrlSelectionInterface* passcombo = self->mTemporaryPassCombo; if (passcombo) { if (use_access_group && use_pass_list) @@ -2884,8 +2889,8 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } } - S32 pass_price = llfloor((F32)self->getChild<LLUICtrl>("PriceSpin")->getValue().asReal()); - F32 pass_hours = (F32)self->getChild<LLUICtrl>("HoursSpin")->getValue().asReal(); + S32 pass_price = llfloor((F32)self->mTemporaryPassPriceSpin->getValue().asReal()); + F32 pass_hours = (F32)self->mTemporaryPassHourSpin->getValue().asReal(); // Push data into current parcel parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); @@ -2907,10 +2912,9 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) void LLPanelLandAccess::onClickAddAccess() { - LLView * button = findChild<LLButton>("add_allowed"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), false, false, false, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), false, false, false, root_floater->getName(), mBtnAddAllowed); if (picker) { root_floater->addDependentFloater(picker); @@ -2938,16 +2942,14 @@ void LLPanelLandAccess::callbackAvatarCBAccess(const uuid_vec_t& ids) } } -// static -void LLPanelLandAccess::onClickRemoveAccess(void* data) +void LLPanelLandAccess::onClickRemoveAccess() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - if (panelp && panelp->mListAccess) + if (mListAccess) { - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { - std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected(); + std::vector<LLScrollListItem*> names = mListAccess->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); iter != names.end(); ) { @@ -2956,18 +2958,16 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data) parcel->removeFromAccessList(agent_id); } LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS); - panelp->refresh(); + refresh(); } } } -// static void LLPanelLandAccess::onClickAddBanned() { - LLView * button = findChild<LLButton>("add_banned"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), true, false, false, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), true, false, false, root_floater->getName(), mBtnAddBanned); if (picker) { root_floater->addDependentFloater(picker); @@ -3014,16 +3014,14 @@ void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 durat } } -// static -void LLPanelLandAccess::onClickRemoveBanned(void* data) +void LLPanelLandAccess::onClickRemoveBanned() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - if (panelp && panelp->mListBanned) + if (mListBanned) { - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { - std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected(); + std::vector<LLScrollListItem*> names = mListBanned->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); iter != names.end(); ) { @@ -3032,7 +3030,7 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data) parcel->removeFromBanList(agent_id); } LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN); - panelp->refresh(); + refresh(); } } } @@ -3331,10 +3329,10 @@ bool LLPanelLandEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return false; - getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(false); - getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(false); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(true); + mBtnUseDefault->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); + mCheckAllowOverride->setVisible(false); + mPanelEnvRegionMsg->setVisible(false); + mPanelEnvAltitudes->setVisible(true); return true; } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 3560304566..95f6a44a94 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -375,13 +375,13 @@ public: static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata); static void onCommitAny(LLUICtrl* ctrl, void *userdata); static void onCommitGroupCheck(LLUICtrl* ctrl, void *userdata); - static void onClickRemoveAccess(void*); - static void onClickRemoveBanned(void*); virtual bool postBuild(); void onClickAddAccess(); void onClickAddBanned(); + void onClickRemoveAccess(); + void onClickRemoveBanned(); void callbackAvatarCBBanned(const uuid_vec_t& ids); void callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration); void callbackAvatarCBAccess(const uuid_vec_t& ids); @@ -389,6 +389,20 @@ public: protected: LLNameListCtrl* mListAccess; LLNameListCtrl* mListBanned; + LLUICtrl* mAllowText = nullptr; + LLUICtrl* mBanText = nullptr; + LLUICtrl* mPublicAccessCheck = nullptr; + LLUICtrl* mGroupAccessCheck = nullptr; + LLUICtrl* mPaymentInfoCheck = nullptr; + LLUICtrl* mAgeVerifiedCheck = nullptr; + LLUICtrl* mTemporaryPassCheck = nullptr; + LLComboBox* mTemporaryPassCombo = nullptr; + LLUICtrl* mTemporaryPassPriceSpin = nullptr; + LLUICtrl* mTemporaryPassHourSpin = nullptr; + LLButton* mBtnAddAllowed = nullptr; + LLButton* mBtnRemoveAllowed = nullptr; + LLButton* mBtnAddBanned = nullptr; + LLButton* mBtnRemoveBanned = nullptr; LLSafeHandle<LLParcelSelection>& mParcel; }; diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 01579ac165..2c6050af94 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -152,6 +152,13 @@ bool LLFloaterPerformance::postBuild() mStartAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::startAutotune, this)); mStopAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::stopAutotune, this)); + mCheckTuneContinous = mAutoadjustmentsPanel->getChild<LLCheckBoxCtrl>("AutoTuneContinuous"); + mTextWIPDesc = mAutoadjustmentsPanel->getChild<LLTextBox>("wip_desc"); + mTextDisplayDesc = mAutoadjustmentsPanel->getChild<LLTextBox>("display_desc"); + + mTextFPSLabel = getChild<LLTextBox>("fps_lbl"); + mTextFPSValue = getChild<LLTextBox>("fps_value"); + gSavedPerAccountSettings.declareBOOL("HadEnabledAutoFPS", false, "User had enabled AutoFPS at least once", LLControlVariable::PERSIST_ALWAYS); return true; @@ -512,7 +519,7 @@ void LLFloaterPerformance::setFPSText() { const S32 NUM_PERIODS = 50; S32 current_fps = (S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, NUM_PERIODS)); - getChild<LLTextBox>("fps_value")->setValue(current_fps); + mTextFPSValue->setValue(current_fps); std::string fps_text = getString("fps_text"); static LLCachedControl<bool> vsync_enabled(gSavedSettings, "RenderVSyncEnable", true); @@ -521,7 +528,7 @@ void LLFloaterPerformance::setFPSText() { fps_text += getString("max_text"); } - getChild<LLTextBox>("fps_lbl")->setValue(fps_text); + mTextFPSLabel->setValue(fps_text); } void LLFloaterPerformance::detachObject(const LLUUID& obj_id) @@ -726,10 +733,10 @@ void LLFloaterPerformance::updateAutotuneCtrls(bool autotune_enabled) static LLCachedControl<bool> auto_tune_locked(gSavedSettings, "AutoTuneLock"); mStartAutotuneBtn->setEnabled(!autotune_enabled && !auto_tune_locked); mStopAutotuneBtn->setEnabled(autotune_enabled && !auto_tune_locked); - getChild<LLCheckBoxCtrl>("AutoTuneContinuous")->setEnabled(!autotune_enabled || (autotune_enabled && auto_tune_locked)); + mCheckTuneContinous->setEnabled(!autotune_enabled || (autotune_enabled && auto_tune_locked)); - getChild<LLTextBox>("wip_desc")->setVisible(autotune_enabled && !auto_tune_locked); - getChild<LLTextBox>("display_desc")->setVisible(LLPerfStats::tunables.vsyncEnabled); + mTextWIPDesc->setVisible(autotune_enabled && !auto_tune_locked); + mTextDisplayDesc->setVisible(LLPerfStats::tunables.vsyncEnabled); } void LLFloaterPerformance::enableAutotuneWarning() diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 797b800b62..6cca85a009 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -30,7 +30,9 @@ #include "lllistcontextmenu.h" class LLCharacter; +class LLCheckBoxCtrl; class LLNameListCtrl; +class LLTextBox; class LLFloaterPerformance : public LLFloater { @@ -90,6 +92,13 @@ private: LLButton* mStartAutotuneBtn; LLButton* mStopAutotuneBtn; + LLTextBox* mTextWIPDesc = nullptr; + LLTextBox* mTextDisplayDesc = nullptr; + LLTextBox* mTextFPSLabel = nullptr; + LLTextBox* mTextFPSValue = nullptr; + + LLCheckBoxCtrl* mCheckTuneContinous = nullptr; + LLListContextMenu* mContextMenu; LLTimer* mUpdateTimer; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index fe867ffd14..e90e8ae48a 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -61,6 +61,7 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterregiondebugconsole.h" +#include "llfloaterregionrestartschedule.h" #include "llfloatertelehub.h" #include "llgltfmateriallist.h" #include "llinventorymodel.h" @@ -259,6 +260,7 @@ bool LLFloaterRegionInfo::postBuild() panel = new LLPanelRegionGeneralInfo; mInfoPanels.push_back(panel); panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel)); + panel->getCommitCallbackRegistrar().add("RegionInfo.ManageRestart", boost::bind(&LLPanelRegionInfo::onClickManageRestartSchedule, panel)); panel->buildFromFile("panel_region_general.xml"); mTab->addTabPanel(panel); @@ -852,8 +854,9 @@ void LLPanelRegionInfo::initCtrl(const std::string& name) template<typename CTRL> void LLPanelRegionInfo::initAndSetCtrl(CTRL*& ctrl, const std::string& name) { - initCtrl(name); ctrl = findChild<CTRL>(name); + if (ctrl) + ctrl->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this)); } void LLPanelRegionInfo::onClickManageTelehub() @@ -862,6 +865,25 @@ void LLPanelRegionInfo::onClickManageTelehub() LLFloaterReg::showInstance("telehubs"); } +void LLPanelRegionInfo::onClickManageRestartSchedule() +{ + LLFloater* floaterp = mFloaterRestartScheduleHandle.get(); + // Show the dialog + if (!floaterp) + { + floaterp = new LLFloaterRegionRestartSchedule(this); + } + + if (floaterp->getVisible()) + { + floaterp->closeFloater(); + } + else + { + floaterp->openFloater(); + } +} + ///////////////////////////////////////////////////////////////////////////// // LLPanelRegionGeneralInfo // @@ -877,6 +899,8 @@ bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region) getChildView("kick_all_btn")->setEnabled(allow_modify); getChildView("im_btn")->setEnabled(allow_modify); getChildView("manage_telehub_btn")->setEnabled(allow_modify); + getChildView("manage_restart_btn")->setEnabled(allow_modify); + getChildView("manage_restart_btn")->setVisible(LLFloaterRegionRestartSchedule::canUse()); // Data gets filled in by processRegionInfo @@ -2331,7 +2355,6 @@ void LLPanelEstateInfo::refresh() // Disable access restriction controls if they make no sense. bool public_access = ("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString()); - getChildView("Only Allow")->setEnabled(public_access); getChildView("limit_payment")->setEnabled(public_access); getChildView("limit_age_verified")->setEnabled(public_access); getChildView("limit_bots")->setEnabled(public_access); @@ -4201,11 +4224,11 @@ bool LLPanelRegionEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return false; - getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(true); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(true); + mBtnUseDefault->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); + mCheckAllowOverride->setVisible(true); + mPanelEnvAltitudes->setVisible(true); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); }); + mCheckAllowOverride->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); }); mCommitConnect = estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this)); return true; @@ -4227,7 +4250,7 @@ void LLPanelRegionEnvironment::refresh() LLPanelEnvironmentInfo::refresh(); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); + mCheckAllowOverride->setValue(mAllowOverride); } bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) @@ -4293,7 +4316,7 @@ bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notifi case 1: mAllowOverride = mAllowOverrideRestore; - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); + mCheckAllowOverride->setValue(mAllowOverride); break; default: break; diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 60564435d7..b604a28fc3 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -154,6 +154,7 @@ public: void disableButton(const std::string& btn_name); void onClickManageTelehub(); + void onClickManageRestartSchedule(); protected: void initCtrl(const std::string& name); @@ -174,6 +175,7 @@ protected: // member data LLHost mHost; + LLHandle<LLFloater> mFloaterRestartScheduleHandle; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llfloaterregionrestartschedule.cpp b/indra/newview/llfloaterregionrestartschedule.cpp new file mode 100644 index 0000000000..59bcb22dce --- /dev/null +++ b/indra/newview/llfloaterregionrestartschedule.cpp @@ -0,0 +1,386 @@ +/** + * @file llfloaterregionrestartschedule.cpp + * @author Andrii Kleshchev + * @brief LLFloaterRegionRestartSchedule class + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterregionrestartschedule.h" + +#include "llagent.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "lllineeditor.h" +#include "llviewercontrol.h" + + +// match with values used by capability +constexpr char CHECKBOX_PREFIXES[] = +{ + 's', + 'm', + 't', + 'w', + 'r', + 'f', + 'a', +}; + +const std::string CHECKBOX_NAME = "_chk"; + +LLFloaterRegionRestartSchedule::LLFloaterRegionRestartSchedule( + LLView* owner) + : LLFloater(LLSD()) + , mOwnerHandle(owner->getHandle()) +{ + buildFromFile("floater_region_restart_schedule.xml"); +} + +LLFloaterRegionRestartSchedule::~LLFloaterRegionRestartSchedule() +{ + +} + +bool LLFloaterRegionRestartSchedule::postBuild() +{ + mPMAMButton = getChild<LLButton>("am_pm_btn"); + mPMAMButton->setClickedCallback([this](LLUICtrl*, const LLSD&) { onPMAMButtonClicked(); }); + + // By default mPMAMButton is supposed to be visible. + // If localized xml set mPMAMButton to be invisible, assume + // 24h format and prealligned "UTC" label + if (mPMAMButton->getVisible()) + { + bool use_24h_format = gSavedSettings.getBOOL("Use24HourClock"); + if (use_24h_format) + { + mPMAMButton->setVisible(false); + LLUICtrl* lbl = getChild<LLUICtrl>("utc_label"); + lbl->translate(-mPMAMButton->getRect().getWidth(), 0); + } + } + + mSaveButton = getChild<LLButton>("save_btn"); + mSaveButton->setClickedCallback([this](LLUICtrl*, const LLSD&) { onSaveButtonClicked(); }); + + mCancelButton = getChild<LLButton>("cancel_btn"); + mCancelButton->setClickedCallback([this](LLUICtrl*, const LLSD&) { closeFloater(false); }); + + + mHoursLineEditor = getChild<LLLineEditor>("hours_edt"); + mHoursLineEditor->setPrevalidate(LLTextValidate::validateNonNegativeS32); + mHoursLineEditor->setCommitCallback([this](LLUICtrl* ctrl, const LLSD& value) { onCommitHours(value); }); + + mMinutesLineEditor = getChild<LLLineEditor>("minutes_edt"); + mMinutesLineEditor->setPrevalidate(LLTextValidate::validateNonNegativeS32); + mMinutesLineEditor->setCommitCallback([this](LLUICtrl* ctrl, const LLSD& value) { onCommitMinutes(value); }); + + for (char c : CHECKBOX_PREFIXES) + { + std::string name = c + CHECKBOX_NAME; + LLCheckBoxCtrl* chk = getChild<LLCheckBoxCtrl>(name); + chk->setCommitCallback([this](LLUICtrl* ctrl, const LLSD& value) { mSaveButton->setEnabled(true); }); + } + + resetUI(false); + + return true; +} + +void LLFloaterRegionRestartSchedule::onOpen(const LLSD& key) +{ + std::string url = gAgent.getRegionCapability("RegionSchedule"); + if (!url.empty()) + { + LLCoros::instance().launch("LLFloaterRegionRestartSchedule::requestRegionShcheduleCoro", + boost::bind(&LLFloaterRegionRestartSchedule::requestRegionShcheduleCoro, url, getHandle())); + + mSaveButton->setEnabled(false); + } + else + { + LL_WARNS("Region") << "Started region schedule floater, but RegionSchedule capability is not available" << LL_ENDL; + } +} + +void LLFloaterRegionRestartSchedule::draw() +{ + LLView* owner = mOwnerHandle.get(); + if (owner) + { + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, owner); + } + + LLFloater::draw(); +} + +void LLFloaterRegionRestartSchedule::onPMAMButtonClicked() +{ + mSaveButton->setEnabled(true); + mTimeAM = !mTimeAM; + updateAMPM(); +} + +void LLFloaterRegionRestartSchedule::onSaveButtonClicked() +{ + std::string url = gAgent.getRegionCapability("RegionSchedule"); + if (!url.empty()) + { + std::string days; + for (char c : CHECKBOX_PREFIXES) + { + std::string name = c + CHECKBOX_NAME; + LLCheckBoxCtrl* chk = getChild<LLCheckBoxCtrl>(name); + if (chk->getValue()) + { + days += c; + } + } + LLSD restart; + if (days.size() < 7) + { + LLStringUtil::toUpper(days); + restart["type"] = "W"; + // if days are empty, will reset schedule + restart["days"] = days; + } + else + { + restart["type"] = "D"; + } + S32 hours = mHoursLineEditor->getValue().asInteger(); + if (mPMAMButton->getVisible()) + { + if (hours == 12) + { + hours = 0; // 12:00 AM equals 0:00, while 12:00 PM equals 12:00 + } + if (!mTimeAM) + { + hours += 12; + } + } + restart["time"] = hours * 3600 + mMinutesLineEditor->getValue().asInteger() * 60; + + LLSD body; + body["restart"] = restart; // event name, at the moment only "restart" is supported + LLCoros::instance().launch("LLFloaterRegionRestartSchedule::setRegionShcheduleCoro", + boost::bind(&LLFloaterRegionRestartSchedule::setRegionShcheduleCoro, url, body, getHandle())); + + mSaveButton->setEnabled(false); + } + else + { + LL_WARNS("Region") << "Saving region schedule, but RegionSchedule capability is not available" << LL_ENDL; + } +} + +void LLFloaterRegionRestartSchedule::onCommitHours(const LLSD& value) +{ + S32 hours = value.asInteger(); + if (mPMAMButton->getVisible()) + { + // 0:00 equals 12:00 AM 1:00 equals 1:00 AM, 12am < 1am < 2am < 3am... + if (hours == 0) hours = 12; + llclamp(hours, 1, 12); + } + else + { + llclamp(hours, 0, 23); + } + mHoursLineEditor->setText(llformat("%02d", hours)); + mSaveButton->setEnabled(true); +} + +void LLFloaterRegionRestartSchedule::onCommitMinutes(const LLSD& value) +{ + S32 minutes = value.asInteger(); + llclamp(minutes, 0, 59); + mMinutesLineEditor->setText(llformat("%02d", minutes)); + mSaveButton->setEnabled(true); +} + +void LLFloaterRegionRestartSchedule::resetUI(bool enable_ui) +{ + for (char c : CHECKBOX_PREFIXES) + { + std::string name = c + CHECKBOX_NAME; + LLCheckBoxCtrl* chk = getChild<LLCheckBoxCtrl>(name); + chk->setValue(false); + chk->setEnabled(enable_ui); + } + if (mPMAMButton->getVisible()) + { + mHoursLineEditor->setValue("12"); + mPMAMButton->setEnabled(enable_ui); + } + else + { + mHoursLineEditor->setValue("00"); + } + mMinutesLineEditor->setValue("00"); + mMinutesLineEditor->setEnabled(enable_ui); + mHoursLineEditor->setEnabled(enable_ui); + mTimeAM = true; + updateAMPM(); +} + +void LLFloaterRegionRestartSchedule::updateAMPM() +{ + std::string value; + if (mTimeAM) + { + value = getString("am_string"); + } + else + { + value = getString("pm_string"); + } + mPMAMButton->setLabel(value); +} + +bool LLFloaterRegionRestartSchedule::canUse() +{ + std::string url = gAgent.getRegionCapability("RegionSchedule"); + return !url.empty(); +} + +void LLFloaterRegionRestartSchedule::requestRegionShcheduleCoro(std::string url, LLHandle<LLFloater> handle) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("RegionShcheduleRequest", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + + httpOpts->setWantHeaders(true); + + LLSD result = httpAdapter->getAndSuspend(httpRequest, url, httpOpts); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + LLFloaterRegionRestartSchedule* floater = dynamic_cast<LLFloaterRegionRestartSchedule*>(handle.get()); + if (!floater) + { + LL_DEBUGS("Region") << "Region Restart Schedule floater is already dead" << LL_ENDL; + } + else if (!status) + { + LL_WARNS("Region") << "Failed to get region schedule: " << status.toString() << LL_ENDL; + floater->resetUI(false); + } + else if (!result.has("restart")) + { + floater->resetUI(true); // no restart schedule yet + } + else + { + // example: 'restart':{'days':'TR','time':i7200,'type':'W'} + LLSD &restart = result["restart"]; + std::string type = restart["type"]; + std::string days = restart["days"]; + if (type == "W") // weekly || restart.has("days") + { + LLStringUtil::toLower(days); + for (char c : CHECKBOX_PREFIXES) + { + bool enabled = days.find(c) != std::string::npos; + std::string name = c + CHECKBOX_NAME; + LLCheckBoxCtrl *chk = floater->getChild<LLCheckBoxCtrl>(name); + chk->setValue(enabled); + chk->setEnabled(true); + } + } + else // dayly + { + for (char c : CHECKBOX_PREFIXES) + { + std::string name = c + CHECKBOX_NAME; + LLCheckBoxCtrl* chk = floater->getChild<LLCheckBoxCtrl>(name); + chk->setValue(true); + chk->setEnabled(true); + } + } + + S32 seconds_after_midnight = restart["time"].asInteger(); + S32 hours = seconds_after_midnight / 3600; + S32 minutes = (seconds_after_midnight % 3600) / 60; + + if (floater->mPMAMButton->getVisible()) + { + if (hours >= 12) + { + hours -= 12; + floater->mTimeAM = false; + } + else + { + floater->mTimeAM = true; + } + if (hours == 0) + { + hours = 12; // 0:00 equals 12:00 AM , 1:00 equals 1:00 AM + } + floater->mPMAMButton->setEnabled(true); + } + else + { + floater->mTimeAM = true; + } + floater->updateAMPM(); + floater->mHoursLineEditor->setText(llformat("%02d", hours)); + floater->mHoursLineEditor->setEnabled(true); + floater->mMinutesLineEditor->setText(llformat("%02d", minutes)); + floater->mMinutesLineEditor->setEnabled(true); + + LL_DEBUGS("Region") << "Region restart schedule type: " << type + << " Days: " << days + << " Time:" << hours << ":" << minutes << LL_ENDL; + } +} + +void LLFloaterRegionRestartSchedule::setRegionShcheduleCoro(std::string url, LLSD body, LLHandle<LLFloater> handle) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("RegionShcheduleSetter", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + + httpOpts->setWantHeaders(true); + + LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + LLFloaterRegionRestartSchedule* floater = dynamic_cast<LLFloaterRegionRestartSchedule*>(handle.get()); + if (floater) + { + floater->closeFloater(); + } +} diff --git a/indra/newview/llfloaterregionrestartschedule.h b/indra/newview/llfloaterregionrestartschedule.h new file mode 100644 index 0000000000..465ed538a5 --- /dev/null +++ b/indra/newview/llfloaterregionrestartschedule.h @@ -0,0 +1,74 @@ +/** + * @file llfloaterregionrestartschedule.h + * @author Andrii Kleshchev + * @brief LLFloaterRegionRestartSchedule class header file + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERREGIONRESTARTSCHEDULE_H +#define LL_LLFLOATERREGIONRESTARTSCHEDULE_H + +#include "llfloater.h" + +class LLLineEditor; +class LLButton; + +class LLFloaterRegionRestartSchedule : public LLFloater +{ +public: + LLFloaterRegionRestartSchedule(LLView* owner); + + virtual ~LLFloaterRegionRestartSchedule(); + + bool postBuild() override; + void onOpen(const LLSD& key) override; + void draw() override; + + void onPMAMButtonClicked(); + void onSaveButtonClicked(); + + void onCommitHours(const LLSD& value); + void onCommitMinutes(const LLSD& value); + + void resetUI(bool enable_ui); + void updateAMPM(); + + static bool canUse(); + +protected: + static void requestRegionShcheduleCoro(std::string url, LLHandle<LLFloater> handle); + static void setRegionShcheduleCoro(std::string url, LLSD body, LLHandle<LLFloater> handle); + + LLHandle<LLView> mOwnerHandle; + F32 mContextConeOpacity{ 0.f }; + + LLLineEditor* mHoursLineEditor{nullptr}; + LLLineEditor* mMinutesLineEditor{ nullptr }; + LLButton* mPMAMButton{ nullptr }; + LLButton* mSaveButton{ nullptr }; + LLButton* mCancelButton{ nullptr }; + + bool mTimeAM{ true }; +}; + +#endif // LL_LLFLOATERREGIONRESTARTSCHEDULE_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index e03b11e572..ddc567c029 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -192,7 +192,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate } } - bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean(); + bool use_freeze_frame = floaterp->mFreezeFrameCheck && floaterp->mFreezeFrameCheck->getValue().asBoolean(); if (use_freeze_frame) { @@ -720,7 +720,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool new_width = spanel->getTypedPreviewWidth(); new_height = spanel->getTypedPreviewHeight(); - // Limit custom size for inventory snapshots to 512x512 px. + // Limit custom size for inventory snapshots to 2048x2048 px. if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE) { new_width = llmin(new_width, MAX_TEXTURE_SIZE); @@ -1002,8 +1002,9 @@ bool LLFloaterSnapshot::postBuild() getChild<LLUICtrl>("layer_types")->setValue("colors"); getChildView("layer_types")->setEnabled(false); - getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); - childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this); + mFreezeFrameCheck = getChild<LLUICtrl>("freeze_frame_check"); + mFreezeFrameCheck->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); + mFreezeFrameCheck->setCommitCallback(&ImplBase::onCommitFreezeFrame, this); getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this); diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index ac5a472b03..6df851b839 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -72,6 +72,7 @@ protected: LLUICtrl* mThumbnailPlaceholder; LLUICtrl *mRefreshBtn, *mRefreshLabel; LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; + LLUICtrl* mFreezeFrameCheck = nullptr; }; class LLFloaterSnapshotBase::ImplBase diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 2a72a361d6..8d74a99539 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -39,6 +39,8 @@ #include "llbutton.h" #include "llcallingcard.h" #include "llcombobox.h" +#include "llcheckboxctrl.h" +#include "llsliderctrl.h" #include "llviewercontrol.h" #include "llcommandhandler.h" #include "lldraghandle.h" @@ -317,15 +319,35 @@ bool LLFloaterWorldMap::postBuild() mMapView = dynamic_cast<LLWorldMapView*>(getChild<LLPanel>("objects_mapview")); mMapView->setPan(0, 0, true); + mTeleportButton = getChild<LLButton>("Teleport"); + mShowDestinationButton = getChild<LLButton>("Show Destination"); + mCopySlurlButton = getChild<LLButton>("copy_slurl"); + mGoHomeButton = getChild<LLButton>("Go Home"); + + mPeopleCheck = getChild<LLCheckBoxCtrl>("people_chk"); + mInfohubCheck = getChild<LLCheckBoxCtrl>("infohub_chk"); + mLandSaleCheck = getChild<LLCheckBoxCtrl>("land_for_sale_chk"); + mEventsCheck = getChild<LLCheckBoxCtrl>("event_chk"); + mEventsMatureCheck = getChild<LLCheckBoxCtrl>("events_mature_chk"); + mEventsAdultCheck = getChild<LLCheckBoxCtrl>("events_adult_chk"); + + mAvatarIcon = getChild<LLUICtrl>("avatar_icon"); + mLandmarkIcon = getChild<LLUICtrl>("landmark_icon"); + mLocationIcon = getChild<LLUICtrl>("location_icon"); + + mTeleportCoordSpinX = getChild<LLUICtrl>("teleport_coordinate_x"); + mTeleportCoordSpinY = getChild<LLUICtrl>("teleport_coordinate_y"); + mTeleportCoordSpinZ = getChild<LLUICtrl>("teleport_coordinate_z"); + LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo"); avatar_combo->selectFirstItem(); avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) ); avatar_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListFriendCombo = dynamic_cast<LLCtrlListInterface *>(avatar_combo); - LLSearchEditor *location_editor = getChild<LLSearchEditor>("location"); - location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); - location_editor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); + mLocationEditor = getChild<LLSearchEditor>("location"); + mLocationEditor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); + mLocationEditor->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this)); mListSearchResults = childGetListInterface("search_results"); @@ -336,8 +358,9 @@ bool LLFloaterWorldMap::postBuild() landmark_combo->setTextChangedCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListLandmarkCombo = dynamic_cast<LLCtrlListInterface *>(landmark_combo); + mZoomSlider = getChild<LLSliderCtrl>("zoom slider"); F32 slider_zoom = mMapView->getZoom(); - getChild<LLUICtrl>("zoom slider")->setValue(slider_zoom); + mZoomSlider->setValue(slider_zoom); getChild<LLPanel>("expand_btn_panel")->setMouseDownCallback(boost::bind(&LLFloaterWorldMap::onExpandCollapseBtn, this)); @@ -414,7 +437,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id); - getChild<LLUICtrl>("location")->setFocus( true); + mLocationEditor->setFocus( true); gFocusMgr.triggerFocusFlash(); buildAvatarIDList(); @@ -452,9 +475,9 @@ bool LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) S32 map_y = y - mMapView->getRect().mBottom; if (mMapView->pointInView(map_x, map_y)) { - F32 old_slider_zoom = (F32) getChild<LLUICtrl>("zoom slider")->getValue().asReal(); + F32 old_slider_zoom = (F32) mZoomSlider->getValue().asReal(); F32 slider_zoom = old_slider_zoom + ((F32) clicks * -0.3333f); - getChild<LLUICtrl>("zoom slider")->setValue(LLSD(slider_zoom)); + mZoomSlider->setValue(LLSD(slider_zoom)); mMapView->zoomWithPivot(slider_zoom, map_x, map_y); return true; } @@ -483,32 +506,32 @@ void LLFloaterWorldMap::draw() LLViewerRegion* regionp = gAgent.getRegion(); bool agent_on_prelude = (regionp && regionp->isPrelude()); bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude; - getChildView("Go Home")->setEnabled(enable_go_home); + mGoHomeButton->setEnabled(enable_go_home); updateLocation(); LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if (LLTracker::TRACKING_AVATAR == tracking_status) { - getChild<LLUICtrl>("avatar_icon")->setColor( map_track_color); + mAvatarIcon->setColor( map_track_color); } else { - getChild<LLUICtrl>("avatar_icon")->setColor( map_track_disabled_color); + mAvatarIcon->setColor( map_track_disabled_color); } if (LLTracker::TRACKING_LANDMARK == tracking_status) { - getChild<LLUICtrl>("landmark_icon")->setColor( map_track_color); + mLandmarkIcon->setColor( map_track_color); } else { - getChild<LLUICtrl>("landmark_icon")->setColor( map_track_disabled_color); + mLandmarkIcon->setColor( map_track_disabled_color); } if (LLTracker::TRACKING_LOCATION == tracking_status) { - getChild<LLUICtrl>("location_icon")->setColor( map_track_color); + mLocationIcon->setColor( map_track_color); } else { @@ -518,11 +541,11 @@ void LLFloaterWorldMap::draw() double value = fmod(seconds, 2); value = 0.5 + 0.5*cos(value * F_PI); LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); - getChild<LLUICtrl>("location_icon")->setColor( loading_color); + mLocationIcon->setColor( loading_color); } else { - getChild<LLUICtrl>("location_icon")->setColor( map_track_disabled_color); + mLocationIcon->setColor( map_track_disabled_color); } } @@ -532,27 +555,26 @@ void LLFloaterWorldMap::draw() centerOnTarget(true); } - getChildView("Teleport")->setEnabled((bool)tracking_status); + mTeleportButton->setEnabled((bool)tracking_status); // getChildView("Clear")->setEnabled((bool)tracking_status); - getChildView("Show Destination")->setEnabled((bool)tracking_status || LLWorldMap::getInstance()->isTracking()); - getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) ); + mShowDestinationButton->setEnabled((bool)tracking_status || LLWorldMap::getInstance()->isTracking()); + mCopySlurlButton->setEnabled((mSLURL.isValid()) ); setMouseOpaque(true); getDragHandle()->setMouseOpaque(true); - mMapView->zoom((F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal()); + mMapView->zoom((F32)mZoomSlider->getValue().asReal()); // Enable/disable checkboxes depending on the zoom level // If above threshold level (i.e. low res) -> Disable all checkboxes // If under threshold level (i.e. high res) -> Enable all checkboxes bool enable = mMapView->showRegionInfo(); - getChildView("people_chk")->setEnabled(enable); - getChildView("infohub_chk")->setEnabled(enable); - getChildView("telehub_chk")->setEnabled(enable); - getChildView("land_for_sale_chk")->setEnabled(enable); - getChildView("event_chk")->setEnabled(enable); - getChildView("events_mature_chk")->setEnabled(enable); - getChildView("events_adult_chk")->setEnabled(enable); + mPeopleCheck->setEnabled(enable); + mInfohubCheck->setEnabled(enable); + mLandSaleCheck->setEnabled(enable); + mEventsCheck->setEnabled(enable); + mEventsMatureCheck->setEnabled(enable); + mEventsAdultCheck->setEnabled(enable); LLFloater::draw(); } @@ -576,7 +598,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& // convenience. if(gAgent.isGodlike()) { - getChild<LLUICtrl>("teleport_coordinate_z")->setValue(LLSD(200.f)); + mTeleportCoordSpinZ->setValue(LLSD(200.f)); } // Don't re-request info if we already have it or we won't have it in time to teleport if (mTrackedStatus != LLTracker::TRACKING_AVATAR || avatar_id != mTrackedAvatarID) @@ -711,9 +733,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) // enable/disable teleport destination coordinates void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled ) { - childSetEnabled("teleport_coordinate_x", enabled ); - childSetEnabled("teleport_coordinate_y", enabled ); - childSetEnabled("teleport_coordinate_z", enabled ); + mTeleportCoordSpinX->setEnabled(enabled); + mTeleportCoordSpinY->setEnabled(enabled); + mTeleportCoordSpinZ->setEnabled(enabled); } // update display of teleport destination coordinates - pos is in global coordinates @@ -728,9 +750,9 @@ void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos ) F32 region_local_z = (F32)llclamp( pos.mdV[VZ], 0.0, (F64)REGION_HEIGHT_METERS ); // write in the values - childSetValue("teleport_coordinate_x", region_local_x ); - childSetValue("teleport_coordinate_y", region_local_y ); - childSetValue("teleport_coordinate_z", region_local_z ); + mTeleportCoordSpinX->setValue(region_local_x); + mTeleportCoordSpinY->setValue(region_local_y); + mTeleportCoordSpinZ->setValue(region_local_z); } void LLFloaterWorldMap::updateLocation() @@ -757,7 +779,7 @@ void LLFloaterWorldMap::updateLocation() mSetToUserPosition = false; // Fill out the location field - getChild<LLUICtrl>("location")->setValue(agent_sim_name); + mLocationEditor->setValue(agent_sim_name); // update the coordinate display with location of avatar in region updateTeleportCoordsDisplay( agentPos ); @@ -790,7 +812,7 @@ void LLFloaterWorldMap::updateLocation() } } - getChild<LLUICtrl>("location")->setValue(sim_name); + mLocationEditor->setValue(sim_name); // refresh coordinate display to reflect where user clicked. LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal(); @@ -825,17 +847,17 @@ void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S3 else { // fill in UI based on URL - gFloaterWorldMap->getChild<LLUICtrl>("location")->setValue(region_name); + mLocationEditor->setValue(region_name); // Save local coords to highlight position after region global // position is returned. - gFloaterWorldMap->mCompletingRegionPos.set( + mCompletingRegionPos.set( (F32)x_coord, (F32)y_coord, (F32)z_coord); // pass sim name to combo box - gFloaterWorldMap->mCompletingRegionName = region_name; + mCompletingRegionName = region_name; LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name); - LLStringUtil::toLower(gFloaterWorldMap->mCompletingRegionName); + LLStringUtil::toLower(mCompletingRegionName); LLWorldMap::getInstance()->setTrackingCommit(); } } @@ -1067,7 +1089,7 @@ void LLFloaterWorldMap::adjustZoomSliderBounds() F32 min_power = log(pixels_per_region/256.f)/log(2.f); - getChild<LLSliderCtrl>("zoom slider")->setMinValue(min_power); + mZoomSlider->setMinValue(min_power); } @@ -1229,7 +1251,7 @@ void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus ) void LLFloaterWorldMap::updateSearchEnabled() { if (childHasKeyboardFocus("location") && - getChild<LLUICtrl>("location")->getValue().asString().length() > 0) + mLocationEditor->getValue().asString().length() > 0) { setDefaultBtn("DoSearch"); } @@ -1250,14 +1272,14 @@ void LLFloaterWorldMap::onLocationCommit() mCompletingRegionName = ""; mLastRegionName = ""; - std::string str = getChild<LLUICtrl>("location")->getValue().asString(); + std::string str = mLocationEditor->getValue().asString(); // Trim any leading and trailing spaces in the search target std::string saved_str = str; LLStringUtil::trim( str ); if ( str != saved_str ) { // Set the value in the UI if any spaces were removed - getChild<LLUICtrl>("location")->setValue(str); + mLocationEditor->setValue(str); } // Don't try completing empty name (STORM-1427). @@ -1287,11 +1309,11 @@ void LLFloaterWorldMap::onCoordinatesCommit() return; } - S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal(); - S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal(); - S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal(); + S32 x_coord = (S32)mTeleportCoordSpinX->getValue().asReal(); + S32 y_coord = (S32)mTeleportCoordSpinY->getValue().asReal(); + S32 z_coord = (S32)mTeleportCoordSpinZ->getValue().asReal(); - const std::string region_name = childGetValue("location").asString(); + const std::string region_name = mLocationEditor->getValue().asString(); trackURL( region_name, x_coord, y_coord, z_coord ); } @@ -1420,7 +1442,7 @@ void LLFloaterWorldMap::teleport() && av_tracker.haveTrackingInfo() ) { pos_global = av_tracker.getGlobalPos(); - pos_global.mdV[VZ] = getChild<LLUICtrl>("teleport_coordinate_z")->getValue(); + pos_global.mdV[VZ] = mTeleportCoordSpinZ->getValue(); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status) { @@ -1654,7 +1676,7 @@ void LLFloaterWorldMap::onCommitSearchResult() pos_global.mdV[VY] += (F64)pos_local.mV[VY]; pos_global.mdV[VZ] = (F64)pos_local.mV[VZ]; - getChild<LLUICtrl>("location")->setValue(sim_name); + mLocationEditor->setValue(sim_name); trackLocation(pos_global); setDefaultBtn("Teleport"); break; diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 6765157e55..a99100f5bd 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -45,6 +45,11 @@ class LLItemInfo; class LLLineEditor; class LLTabContainer; class LLWorldMapView; +class LLButton; +class LLCheckBoxCtrl; +class LLSliderCtrl; +class LLSpinCtrl; +class LLSearchEditor; class LLFloaterWorldMap : public LLFloater { @@ -142,7 +147,6 @@ protected: void buildLandmarkIDLists(); void flyToLandmark(); void teleportToLandmark(); - void setLandmarkVisited(); void buildAvatarIDList(); void flyToAvatar(); @@ -195,6 +199,29 @@ private: LLCtrlListInterface * mListLandmarkCombo; LLCtrlListInterface * mListSearchResults; + LLButton* mTeleportButton = nullptr; + LLButton* mShowDestinationButton = nullptr; + LLButton* mCopySlurlButton = nullptr; + LLButton* mGoHomeButton = nullptr; + + LLCheckBoxCtrl* mPeopleCheck = nullptr; + LLCheckBoxCtrl* mInfohubCheck = nullptr; + LLCheckBoxCtrl* mLandSaleCheck = nullptr; + LLCheckBoxCtrl* mEventsCheck = nullptr; + LLCheckBoxCtrl* mEventsMatureCheck = nullptr; + LLCheckBoxCtrl* mEventsAdultCheck = nullptr; + + LLUICtrl* mAvatarIcon = nullptr; + LLUICtrl* mLandmarkIcon = nullptr; + LLUICtrl* mLocationIcon = nullptr; + + LLSearchEditor* mLocationEditor = nullptr; + LLUICtrl* mTeleportCoordSpinX = nullptr; + LLUICtrl* mTeleportCoordSpinY = nullptr; + LLUICtrl* mTeleportCoordSpinZ = nullptr; + + LLSliderCtrl* mZoomSlider = nullptr; + boost::signals2::connection mTeleportFinishConnection; }; diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 8ee11cdbd2..1bbeba43ec 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -536,7 +536,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool fromKeyPress) if (!gesture) return; // Reset gesture to first step - gesture->mCurrentStep = 0; + gesture->reset(); gesture->mTriggeredByKey = fromKeyPress; // Add to list of playing diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 1057bc25e0..76d3e3e049 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -806,7 +806,7 @@ void LLGroupMgrGroupData::banMemberById(const LLUUID& participant_uuid) mPendingBanRequest = false; - LLGroupMemberData* member_data = (*mi).second; + LLGroupMemberData* member_data = mi->second; if (member_data && member_data->isInRole(mOwnerRole)) { return; // can't ban group owner @@ -832,8 +832,7 @@ void LLGroupMgrGroupData::banMemberById(const LLUUID& participant_uuid) // LLGroupMgr // -LLGroupMgr::LLGroupMgr(): - mMemberRequestInFlight(false) +LLGroupMgr::LLGroupMgr() { } @@ -968,11 +967,11 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mMemberRequestID != request_id)) { - LL_WARNS() << "processGroupMembersReply: Received incorrect (stale?) group or request id" << LL_ENDL; + LL_WARNS() << "Received incorrect (stale?) group or request id" << LL_ENDL; return; } - msg->getS32(_PREHASH_GroupData, "MemberCount", group_datap->mMemberCount ); + msg->getS32Fast(_PREHASH_GroupData, _PREHASH_MemberCount, group_datap->mMemberCount); if (group_datap->mMemberCount > 0) { @@ -987,12 +986,12 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) { LLUUID member_id; - msg->getUUIDFast(_PREHASH_MemberData, _PREHASH_AgentID, member_id, i ); - msg->getS32(_PREHASH_MemberData, _PREHASH_Contribution, contribution, i); - msg->getU64(_PREHASH_MemberData, "AgentPowers", agent_powers, i); + msg->getUUIDFast(_PREHASH_MemberData, _PREHASH_AgentID, member_id, i); + msg->getS32Fast(_PREHASH_MemberData, _PREHASH_Contribution, contribution, i); + msg->getU64Fast(_PREHASH_MemberData, _PREHASH_AgentPowers, agent_powers, i); msg->getStringFast(_PREHASH_MemberData, _PREHASH_OnlineStatus, online_status, i); - msg->getString(_PREHASH_MemberData, "Title", title, i); - msg->getBOOL(_PREHASH_MemberData,"IsOwner",is_owner,i); + msg->getStringFast(_PREHASH_MemberData, _PREHASH_Title, title, i); + msg->getBOOLFast(_PREHASH_MemberData, _PREHASH_IsOwner, is_owner, i); if (member_id.notNull()) { @@ -1037,7 +1036,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) group_datap->mMemberVersion.generate(); - if (group_datap->mMembers.size() == (U32)group_datap->mMemberCount) + if (group_datap->mMembers.size() == (U32)group_datap->mMemberCount) { group_datap->mMemberDataComplete = true; group_datap->mMemberRequestID.setNull(); @@ -1678,13 +1677,12 @@ void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) if (group_datap->mRoleMembersRequestID.isNull()) { // Don't send the request if we don't have all the member or role data - if (!group_datap->isMemberDataComplete() - || !group_datap->isRoleDataComplete()) + if (!group_datap->isMemberDataComplete() || !group_datap->isRoleDataComplete()) { // *TODO: KLW FIXME: Should we start a member or role data request? LL_INFOS("GrpMgr") << " Pending: " << (group_datap->mPendingRoleMemberRequest ? "Y" : "N") - << " MemberDataComplete: " << (group_datap->mMemberDataComplete ? "Y" : "N") - << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << LL_ENDL; + << ", MemberDataComplete: " << (group_datap->mMemberDataComplete ? "Y" : "N") + << ", RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << LL_ENDL; group_datap->mPendingRoleMemberRequest = true; return; } @@ -1984,14 +1982,14 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, group_datap->mMemberVersion.generate(); } -void LLGroupMgr::getGroupBanRequestCoro(std::string url, LLUUID groupId) +void LLGroupMgr::getGroupBanRequestCoro(std::string url, LLUUID group_id) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("groupMembersRequest", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - std::string finalUrl = url + "?group_id=" + groupId.asString(); + std::string finalUrl = url + "?group_id=" + group_id.asString(); LLSD result = httpAdapter->getAndSuspend(httpRequest, finalUrl); @@ -2012,8 +2010,8 @@ void LLGroupMgr::getGroupBanRequestCoro(std::string url, LLUUID groupId) } } -void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID groupId, - U32 action, uuid_vec_t banList, bool update) +void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID group_id, + U32 action, uuid_vec_t ban_list, bool update) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -2026,20 +2024,16 @@ void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID groupId, httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); - - std::string finalUrl = url + "?group_id=" + groupId.asString(); + std::string finalUrl = url + "?group_id=" + group_id.asString(); LLSD postData = LLSD::emptyMap(); postData["ban_action"] = (LLSD::Integer)action; // Add our list of potential banned residents to the list postData["ban_ids"] = LLSD::emptyArray(); - LLSD banEntry; - uuid_vec_t::const_iterator it = banList.begin(); - for (; it != banList.end(); ++it) + for (const LLUUID& ban_id : ban_list) { - banEntry = (*it); - postData["ban_ids"].append(banEntry); + postData["ban_ids"].append(ban_id); } LL_WARNS() << "post: " << ll_pretty_print_sd(postData) << LL_ENDL; @@ -2064,7 +2058,7 @@ void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID groupId, if (update) { - getGroupBanRequestCoro(url, groupId); + getGroupBanRequestCoro(url, group_id); } } @@ -2151,55 +2145,80 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST); } -void LLGroupMgr::groupMembersRequestCoro(std::string url, LLUUID groupId) +void LLGroupMgr::groupMembersRequestCoro(std::string url, LLUUID group_id, U32 page_size, U32 page_start, U32 sort_column, bool sort_descending) { + LL_INFOS("GrpMgr") << "group_id: '" << group_id << "'" + << ", page_size: " << page_size << ", page_start: " << page_start + << ", sort_column: " << sort_column << ", sort_descending: " << sort_descending << LL_ENDL; LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("groupMembersRequest", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + + LLSD postData = LLSD::emptyMap(); + postData["group_id"] = group_id; + + if (page_size) + { + postData["page_size"] = LLSD::Integer(page_size); + if (page_start) + { + postData["page_start"] = LLSD::Integer(page_start); + } + } + + if (sort_column) + { + postData["sort_column"] = LLSD::Integer(sort_column); + if (sort_descending) + { + postData["sort_descending"] = 1; + } + } mMemberRequestInFlight = true; - LLSD postData = LLSD::emptyMap(); - postData["group_id"] = groupId; + LLSD response = httpAdapter->postAndSuspend(httpRequest, url, postData, httpOpts); - LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData, httpOpts); + mMemberRequestInFlight = false; - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLSD httpResults = response.get(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { LL_WARNS("GrpMgr") << "Error receiving group member data " << LL_ENDL; - mMemberRequestInFlight = false; return; } - result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); - LLGroupMgr::processCapGroupMembersRequest(result); - mMemberRequestInFlight = false; + response.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); + processCapGroupMembersResponse(response, url, page_size, page_start, sort_column, sort_descending); } -void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id) +void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id, U32 page_size, U32 page_start, const std::string& sort_column_name, bool sort_descending) { static U32 lastGroupMemberRequestFrame = 0; // Have we requested the information already this frame? // Todo: make this per group, we can invite to one group and simultaneously be checking another one - if ((lastGroupMemberRequestFrame == gFrameCount) || (mMemberRequestInFlight)) + if ((lastGroupMemberRequestFrame == gFrameCount) || mMemberRequestInFlight) return; + LL_INFOS("GrpMgr") << "group_id: '" << group_id << "'" + << ", page_size: " << page_size << ", page_start: " << page_start + << ", sort_column_name: '" << sort_column_name << "', sort_descending: " << sort_descending << LL_ENDL; + LLViewerRegion* currentRegion = gAgent.getRegion(); // Thank you FS:Ansariel! - if(!currentRegion) + if (!currentRegion) { LL_WARNS("GrpMgr") << "Agent does not have a current region. Uh-oh!" << LL_ENDL; return; } // Check to make sure we have our capabilities - if(!currentRegion->capabilitiesReceived()) + if (!currentRegion->capabilitiesReceived()) { LL_WARNS("GrpMgr") << " Capabilities not received!" << LL_ENDL; return; @@ -2209,9 +2228,9 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id) std::string cap_url = currentRegion->getCapability("GroupMemberData"); // Thank you FS:Ansariel! - if(cap_url.empty()) + if (cap_url.empty()) { - LL_INFOS("GrpMgr") << "Region has no GroupMemberData capability. Falling back to UDP fetch." << LL_ENDL; + LL_INFOS("GrpMgr") << "Region has no GroupMemberData capability. Falling back to UDP fetch." << LL_ENDL; sendGroupMembersRequest(group_id); return; } @@ -2221,120 +2240,139 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id) lastGroupMemberRequestFrame = gFrameCount; - LLCoros::instance().launch("LLGroupMgr::groupMembersRequestCoro", - boost::bind(&LLGroupMgr::groupMembersRequestCoro, this, cap_url, group_id)); -} + U32 sort_column = 0; // No sorting by default + if (!sort_column_name.empty()) + { + static const std::vector<std::string> column_names = { "name", "donated", "online", "title" }; + auto it = std::find(column_names.begin(), column_names.end(), sort_column_name); + if (it == column_names.end()) + { + LL_WARNS("GrpMgr") << "Invalid column name: '" << sort_column_name << "'" << LL_ENDL; + } + else + { + // Use offset (1) because 0 means "no sorting" + sort_column = 1 + (U32)std::distance(column_names.begin(), it); + } + } + LLCoros::instance().launch("LLGroupMgr::groupMembersRequestCoro", [&]() + { + groupMembersRequestCoro(cap_url, group_id, page_size, page_start, sort_column, sort_descending); + }); +} -void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) +void LLGroupMgr::processCapGroupMembersResponse(const LLSD& response, const std::string& url, U32 page_size, U32 page_start, U32 sort_column, bool sort_descending) { + LLUUID group_id = response["group_id"].asUUID(); + LL_INFOS("GrpMgr") << "group_id: '" << group_id << "'" + << ", page_size: " << page_size << ", page_start: " << page_start + << ", sort_column: " << sort_column << ", sort_descending: " << sort_descending << LL_ENDL; + // Did we get anything in content? - if(!content.size()) + if (!response.size()) { - LL_DEBUGS("GrpMgr") << "No group member data received." << LL_ENDL; + LL_INFOS("GrpMgr") << "No group member data received." << LL_ENDL; return; } - LLUUID group_id = content["group_id"].asUUID(); - LLGroupMgrGroupData* group_datap = getGroupData(group_id); - if(!group_datap) + if (!group_datap) { LL_WARNS("GrpMgr") << "Received incorrect, possibly stale, group or request id" << LL_ENDL; return; } - // If we have no members, there's no reason to do anything else - S32 num_members = content["member_count"]; - if (num_members < 1) - { - LL_INFOS("GrpMgr") << "Received empty group members list for group id: " << group_id.asString() << LL_ENDL; - // Set mMemberDataComplete for correct handling of empty responses. See MAINT-5237 - group_datap->mMemberDataComplete = true; - group_datap->mChanged = true; - LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA); - return; - } - - group_datap->mMemberCount = num_members; - - LLSD member_list = content["members"]; - LLSD titles = content["titles"]; - LLSD defaults = content["defaults"]; + LLSD members = response["members"]; + LLSD titles = response["titles"]; + LLSD defaults = response["defaults"]; - std::string online_status; - std::string title; - S32 contribution; - U64 member_powers; - // If this is changed to a bool, make sure to change the LLGroupMemberData constructor - bool is_owner; + size_t members_before = group_datap->mMembers.size(); + size_t members_loaded = members.size(); // Compute this once, rather than every time. - U64 default_powers = llstrtou64(defaults["default_powers"].asString().c_str(), NULL, 16); + std::string default_title = titles.size() ? titles[0].asString() : LLStringUtil::null; + U64 default_powers = llstrtou64(defaults["default_powers"].asString().c_str(), NULL, 16); - LLSD::map_const_iterator member_iter_start = member_list.beginMap(); - LLSD::map_const_iterator member_iter_end = member_list.endMap(); - for( ; member_iter_start != member_iter_end; ++member_iter_start) + auto members_end = members.endMap(); + for (auto it = members.beginMap(); it != members_end; ++it) { // Reset defaults - online_status = "unknown"; - title = titles[0].asString(); - contribution = 0; - member_powers = default_powers; - is_owner = false; + std::string online_status = "unknown"; + std::string title = default_title; + U64 member_powers = default_powers; + S32 donated_square_meters = 0; + bool is_owner = false; - const LLUUID member_id(member_iter_start->first); - LLSD member_info = member_iter_start->second; + const LLUUID member_id(it->first); + LLSD member_info = it->second; - if(member_info.has("last_login")) + if (member_info.has("last_login")) { online_status = member_info["last_login"].asString(); - if(online_status == "Online") + if (online_status == "Online") + { online_status = LLTrans::getString("group_member_status_online"); + } else + { formatDateString(online_status); + } } - if(member_info.has("title")) + if (member_info.has("title")) + { title = titles[member_info["title"].asInteger()].asString(); + } - if(member_info.has("powers")) + if (member_info.has("powers")) + { member_powers = llstrtou64(member_info["powers"].asString().c_str(), NULL, 16); + } - if(member_info.has("donated_square_meters")) - contribution = member_info["donated_square_meters"]; + if (member_info.has("donated_square_meters")) + { + donated_square_meters = member_info["donated_square_meters"]; + } - if(member_info.has("owner")) + if (member_info.has("owner")) + { is_owner = true; + } LLGroupMemberData* data = new LLGroupMemberData(member_id, - contribution, - member_powers, - title, - online_status, - is_owner); - - LLGroupMemberData* member_old = group_datap->mMembers[member_id]; - if (member_old && group_datap->mRoleMemberDataComplete) - { - LLGroupMemberData::role_list_t::iterator rit = member_old->roleBegin(); - LLGroupMemberData::role_list_t::iterator end = member_old->roleEnd(); + donated_square_meters, member_powers, title, online_status, is_owner); - for ( ; rit != end; ++rit) + if (group_datap->mRoleMemberDataComplete) + { + if (LLGroupMemberData* member_old = group_datap->mMembers[member_id]) { - data->addRole((*rit).first,(*rit).second); + auto role_end = member_old->roleEnd(); + for (auto role_it = member_old->roleBegin(); role_it != role_end; ++role_it) + { + data->addRole(role_it->first, role_it->second); + } + } + else + { + group_datap->mRoleMemberDataComplete = false; } - } - else - { - group_datap->mRoleMemberDataComplete = false; } group_datap->mMembers[member_id] = data; } + U32 member_count = (U32)group_datap->mMembers.size(); + + group_datap->mMemberCount = (S32)member_count; + group_datap->mMemberDataComplete = true; + group_datap->mMemberRequestID.setNull(); group_datap->mMemberVersion.generate(); + LL_INFOS("GrpMgr") << "members before: " << members_before + << ", members loaded: " << members_loaded + << ", members now: " << member_count << LL_ENDL; + // Technically, we have this data, but to prevent completely overhauling // this entire system (it would be nice, but I don't have the time), // I'm going to be dumb and just call services I most likely don't need @@ -2342,12 +2380,19 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) // // TODO: // Refactor to reduce multiple calls for data we already have. - if(group_datap->mTitles.size() < 1) + if (group_datap->mTitles.size() < 1) + { sendGroupTitlesRequest(group_id); + } + if (page_size && members_loaded >= page_size && member_count > members_before) + { + LLCoros::instance().launch("LLGroupMgr::groupMembersRequestCoro", [&]() + { + groupMembersRequestCoro(url, group_id, page_size, page_start, sort_column, sort_descending); + }); + } - group_datap->mMemberDataComplete = true; - group_datap->mMemberRequestID.setNull(); // Make the role-member data request if (group_datap->mPendingRoleMemberRequest || !group_datap->mRoleMemberDataComplete) { @@ -2357,10 +2402,8 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) group_datap->mChanged = true; notifyObservers(GC_MEMBER_DATA); - } - void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) { LL_DEBUGS("GrpMgr") << "LLGroupMgr::sendGroupRoleChanges" << LL_ENDL; @@ -2379,9 +2422,11 @@ void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) void LLGroupMgr::cancelGroupRoleChanges(const LLUUID& group_id) { LL_DEBUGS("GrpMgr") << "LLGroupMgr::cancelGroupRoleChanges" << LL_ENDL; - LLGroupMgrGroupData* group_datap = getGroupData(group_id); - if (group_datap) group_datap->cancelRoleChanges(); + if (LLGroupMgrGroupData* group_datap = getGroupData(group_id)) + { + group_datap->cancelRoleChanges(); + } } //static @@ -2503,5 +2548,3 @@ void LLGroupMgr::debugClearAllGroups(void*) LLGroupMgr::getInstance()->clearGroups(); LLGroupMgr::parseRoleActions("role_actions.xml"); } - - diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 18efae7654..21cf4a62b6 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -403,7 +403,7 @@ public: bool mature_publish); static void sendGroupMemberJoin(const LLUUID& group_id); - static void sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,LLUUID>& role_member_pairs); + static void sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID, LLUUID>& role_member_pairs); static void sendGroupMemberEjects(const LLUUID& group_id, uuid_vec_t& member_ids); @@ -413,7 +413,8 @@ public: const uuid_vec_t &ban_list = uuid_vec_t()); - void sendCapGroupMembersRequest(const LLUUID& group_id); + void sendCapGroupMembersRequest(const LLUUID& group_id, + U32 page_size = 0, U32 page_start = 0, const std::string& sort_column_name = LLStringUtil::null, bool sort_descending = false); void cancelGroupRoleChanges(const LLUUID& group_id); @@ -436,16 +437,15 @@ public: void clearGroupData(const LLUUID& group_id); private: - void groupMembersRequestCoro(std::string url, LLUUID groupId); - void processCapGroupMembersRequest(const LLSD& content); + void groupMembersRequestCoro(std::string url, LLUUID group_id, U32 page_size, U32 page_start, U32 sort_column, bool sort_descending); + void processCapGroupMembersResponse(const LLSD& response, const std::string& url, U32 page_size, U32 page_start, U32 sort_column, bool sort_descending); - void getGroupBanRequestCoro(std::string url, LLUUID groupId); - void postGroupBanRequestCoro(std::string url, LLUUID groupId, U32 action, uuid_vec_t banList, bool update); + void getGroupBanRequestCoro(std::string url, LLUUID group_id); + void postGroupBanRequestCoro(std::string url, LLUUID group_id, U32 action, uuid_vec_t ban_list, bool update); static void processGroupBanRequest(const LLSD& content); void notifyObservers(LLGroupChange gc); - void notifyObserver(const LLUUID& group_id, LLGroupChange gc); void addGroup(LLGroupMgrGroupData* group_datap); LLGroupMgrGroupData* createGroupData(const LLUUID &id); bool hasPendingPropertyRequest(const LLUUID& id); @@ -465,7 +465,7 @@ private: typedef std::map<LLUUID,observer_set_t> observer_map_t; observer_map_t mParticularObservers; - bool mMemberRequestInFlight; + bool mMemberRequestInFlight { false }; }; diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index c8b7e00776..d0d2ee191a 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -36,6 +36,7 @@ #include "llvoavatar.h" #include "lldrawable.h" #include "llviewerobjectlist.h" +#include "llviewercontrol.h" #include "llrendersphere.h" #include "llselectmgr.h" #include "llglheaders.h" @@ -561,8 +562,16 @@ void LLHUDEffectLookAt::update() { if (calcTargetPosition()) { + static LLCachedControl<bool> disable_look_at(gSavedSettings, "DisableLookAtAnimation", true); LLMotion* head_motion = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->findMotion(ANIM_AGENT_HEAD_ROT); - if (!head_motion || head_motion->isStopped()) + if (disable_look_at()) + { + if (head_motion) + { + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->stopMotion(ANIM_AGENT_HEAD_ROT); + } + } + else if (!head_motion || head_motion->isStopped()) { ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_HEAD_ROT); } @@ -665,7 +674,15 @@ bool LLHUDEffectLookAt::calcTargetPosition() if (!mTargetPos.isFinite()) return false; - source_avatar->setAnimationData("LookAtPoint", (void *)&mTargetPos); + static LLCachedControl<bool> disable_look_at(gSavedSettings, "DisableLookAtAnimation", true); + if (disable_look_at()) + { + source_avatar->removeAnimationData("LookAtPoint"); + } + else + { + source_avatar->setAnimationData("LookAtPoint", (void*)&mTargetPos); + } return true; } diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 5ee0ab437d..35bcf65db6 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -392,7 +392,8 @@ void LLHUDText::updateVisibility() LLVector3 pos_agent_center = gAgent.getPosAgentFromGlobal(mPositionGlobal) - dir_from_camera; F32 last_distance_center = (pos_agent_center - LLViewerCamera::getInstance()->getOrigin()).magVec(); - F32 max_draw_distance = gSavedSettings.getF32("PrimTextMaxDrawDistance"); + static LLCachedControl<F32> prim_text_max_dist(gSavedSettings, "PrimTextMaxDrawDistance"); + F32 max_draw_distance = prim_text_max_dist; if(max_draw_distance < 0) { diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 59e9226837..6024a6319c 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -2334,14 +2334,14 @@ void LLInventorySingleFolderPanel::clearNavigationHistory() mBackwardFolders.clear(); } -bool LLInventorySingleFolderPanel::isBackwardAvailable() +bool LLInventorySingleFolderPanel::isBackwardAvailable() const { - return (!mBackwardFolders.empty() && (mFolderID != mBackwardFolders.back())); + return !mBackwardFolders.empty() && (mFolderID != mBackwardFolders.back()); } -bool LLInventorySingleFolderPanel::isForwardAvailable() +bool LLInventorySingleFolderPanel::isForwardAvailable() const { - return (!mForwardFolders.empty() && (mFolderID != mForwardFolders.back())); + return !mForwardFolders.empty() && (mFolderID != mForwardFolders.back()); } boost::signals2::connection LLInventorySingleFolderPanel::setRootChangedCallback(root_changed_callback_t cb) @@ -2406,9 +2406,14 @@ void LLInventorySingleFolderPanel::updateSingleFolderRoot() } } -bool LLInventorySingleFolderPanel::hasVisibleItems() +bool LLInventorySingleFolderPanel::hasVisibleItems() const { - return mFolderRoot.get()->hasVisibleChildren(); + if (const LLFolderView* root = mFolderRoot.get()) + { + return root->hasVisibleChildren(); + } + + return false; } void LLInventorySingleFolderPanel::doCreate(const LLSD& userdata) diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 6dead2cf6d..56909c8d98 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -420,10 +420,10 @@ public: void doToSelected(const LLSD& userdata); void doShare(); - bool isBackwardAvailable(); - bool isForwardAvailable(); + bool isBackwardAvailable() const; + bool isForwardAvailable() const; - bool hasVisibleItems(); + bool hasVisibleItems() const; void setNavBackwardList(std::list<LLUUID> backward_list) { mBackwardFolders = backward_list; } void setNavForwardList(std::list<LLUUID> forward_list) { mForwardFolders = forward_list; } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index c02a12e6b2..1c64ed6822 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3743,7 +3743,8 @@ void LLMeshRepository::notifyLoadedMeshes() ? (2 * LLAppCoreHttp::PIPELINING_DEPTH) : 5); - LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("Mesh2MaxConcurrentRequests"); + static LLCachedControl<U32> mesh2_max_req(gSavedSettings, "Mesh2MaxConcurrentRequests"); + LLMeshRepoThread::sMaxConcurrentRequests = mesh2_max_req; LLMeshRepoThread::sRequestHighWater = llclamp(scale * S32(LLMeshRepoThread::sMaxConcurrentRequests), REQUEST2_HIGH_WATER_MIN, REQUEST2_HIGH_WATER_MAX); diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 96be917019..7482890d1e 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -416,7 +416,8 @@ void LLOutfitGallery::updateRowsIfNeeded() bool compareGalleryItem(LLOutfitGalleryItem* item1, LLOutfitGalleryItem* item2) { - if(gSavedSettings.getBOOL("OutfitGallerySortByName") || + static LLCachedControl<bool> outfit_gallery_sort_by_name(gSavedSettings, "OutfitGallerySortByName"); + if(outfit_gallery_sort_by_name || ((item1->isDefaultImage() && item2->isDefaultImage()) || (!item1->isDefaultImage() && !item2->isDefaultImage()))) { std::string name1 = item1->getItemName(); @@ -738,13 +739,16 @@ void LLOutfitGallery::onFilterSubStringChanged(const std::string& new_string, co void LLOutfitGallery::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id) { - if (mOutfitMap[base_id]) + auto base_it = mOutfitMap.find(base_id); + if (base_it != mOutfitMap.end()) { - mOutfitMap[base_id]->setOutfitWorn(true); + base_it->second->setOutfitWorn(true); } - if (mOutfitMap[prev_id]) + + auto prev_it = mOutfitMap.find(prev_id); + if (prev_it != mOutfitMap.end()) { - mOutfitMap[prev_id]->setOutfitWorn(false); + prev_it->second->setOutfitWorn(false); } } @@ -858,13 +862,16 @@ void LLOutfitGallery::onChangeOutfitSelection(LLWearableItemsList* list, const L { if (mSelectedOutfitUUID == category_id) return; - if (mOutfitMap[mSelectedOutfitUUID]) + + auto selected_it = mOutfitMap.find(mSelectedOutfitUUID); + if (selected_it != mOutfitMap.end()) { - mOutfitMap[mSelectedOutfitUUID]->setSelected(false); + selected_it->second->setSelected(false); } - if (mOutfitMap[category_id]) + auto category_it = mOutfitMap.find(category_id); + if (category_it != mOutfitMap.end()) { - mOutfitMap[category_id]->setSelected(true); + category_it->second->setSelected(true); } // mSelectedOutfitUUID will be set in LLOutfitListBase::ChangeOutfitSelection } @@ -886,9 +893,10 @@ bool LLOutfitGallery::canWearSelected() bool LLOutfitGallery::hasDefaultImage(const LLUUID& outfit_cat_id) { - if (mOutfitMap[outfit_cat_id]) + auto outfit_it = mOutfitMap.find(outfit_cat_id); + if (outfit_it != mOutfitMap.end()) { - return mOutfitMap[outfit_cat_id]->isDefaultImage(); + return outfit_it->second->isDefaultImage(); } return false; } @@ -936,6 +944,7 @@ LLOutfitGalleryItem::~LLOutfitGalleryItem() bool LLOutfitGalleryItem::postBuild() { + mPreviewIcon = getChild<LLIconCtrl>("preview_outfit"); setDefaultImage(); mOutfitNameText = getChild<LLTextBox>("outfit_name"); @@ -951,10 +960,12 @@ void LLOutfitGalleryItem::draw() LLPanel::draw(); // Draw border - LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "OutfitGalleryItemSelected" : "OutfitGalleryItemUnselected", LLColor4::white); - LLRect border = getChildView("preview_outfit")->getRect(); + static LLUIColor selected_color = LLUIColorTable::instance().getColor("OutfitGalleryItemSelected", LLColor4::white); + static LLUIColor unselected_color = LLUIColorTable::instance().getColor("OutfitGalleryItemUnselected", LLColor4::white); + const LLColor4& border_color = mSelected ? selected_color : unselected_color; + LLRect border = mPreviewIcon->getRect(); border.mRight = border.mRight + 1; - gl_rect_2d(border, border_color.get(), false); + gl_rect_2d(border, border_color, false); // If the floater is focused, don't apply its alpha to the texture (STORM-677). const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); @@ -1110,7 +1121,7 @@ bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id) { mImageAssetId = image_asset_id; mTexturep = texture; - getChildView("preview_outfit")->setVisible(false); + mPreviewIcon->setVisible(false); mDefaultImage = false; mImageUpdatePending = (texture->getDiscardLevel() == -1); return true; @@ -1127,7 +1138,7 @@ void LLOutfitGalleryItem::setDefaultImage() { mTexturep = NULL; mImageAssetId.setNull(); - getChildView("preview_outfit")->setVisible(true); + mPreviewIcon->setVisible(true); mDefaultImage = true; mImageUpdatePending = false; } diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index d921a7fe72..5b2a33d0ca 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -261,6 +261,7 @@ private: LLTextBox* mOutfitNameText; LLTextBox* mOutfitWornText; LLPanel* mTextBgPanel; + LLIconCtrl* mPreviewIcon = nullptr; bool mSelected; bool mWorn; bool mDefaultImage; diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 0de22fce25..7d55ba3265 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -94,16 +94,21 @@ bool LLPanelBlockedList::postBuild() break; } + mBlockedGearBtn = getChild<LLMenuButton>("blocked_gear_btn"); + // Use the context menu of the Block list for the Block tab gear menu. LLToggleableMenu* blocked_gear_menu = mBlockedList->getContextMenu(); if (blocked_gear_menu) { - getChild<LLMenuButton>("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); + mBlockedGearBtn->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); } + mUnblockBtn = getChild<LLButton>("unblock_btn"); + mUnblockBtn->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); - getChild<LLButton>("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); getChild<LLFilterEditor>("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2)); + mBlockLimitText = getChild<LLUICtrl>("block_limit"); + return LLPanel::postBuild(); } @@ -140,11 +145,12 @@ void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect) void LLPanelBlockedList::updateButtons() { bool hasSelected = NULL != mBlockedList->getSelectedItem(); - getChildView("unblock_btn")->setEnabled(hasSelected); - getChildView("blocked_gear_btn")->setEnabled(hasSelected); + mUnblockBtn->setEnabled(hasSelected); + mBlockedGearBtn->setEnabled(hasSelected); - getChild<LLUICtrl>("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize())); - getChild<LLUICtrl>("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit"))); + static LLCachedControl<S32> mute_list_limit(gSavedSettings, "MuteListLimit"); + mBlockLimitText->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize())); + mBlockLimitText->setTextArg("[LIMIT]", llformat("%d", mute_list_limit())); } void LLPanelBlockedList::unblockItem() diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 446f3d4bad..1f470199ce 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -33,6 +33,8 @@ class LLAvatarName; class LLBlockList; +class LLMenuButton; +class LLButton; class LLPanelBlockedList : public LLPanel { @@ -78,7 +80,10 @@ private: static void callbackBlockByName(const std::string& text); private: - LLBlockList* mBlockedList; + LLBlockList* mBlockedList = nullptr; + LLUICtrl* mBlockLimitText = nullptr; + LLMenuButton* mBlockedGearBtn = nullptr; + LLButton* mUnblockBtn = nullptr; LLHandle<LLFloater> mPicker; }; diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index e88f6c0470..282b6d4a0a 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -48,6 +48,7 @@ #include "llscrollingpanelparam.h" #include "llradiogroup.h" #include "llnotificationsutil.h" +#include "lliconctrl.h" #include "llcolorswatch.h" #include "lltexturectrl.h" @@ -307,8 +308,8 @@ LLEditWearableDictionary::Subparts::Subparts() addEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, "mTorso", "physics_breasts_updown", "physics_breasts_updown_param_list", "physics_breasts_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f), SEX_FEMALE)); addEntry(SUBPART_PHYSICS_BREASTS_INOUT, new SubpartEntry(SUBPART_PHYSICS_BREASTS_INOUT, "mTorso", "physics_breasts_inout", "physics_breasts_inout_param_list", "physics_breasts_inout_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE)); addEntry(SUBPART_PHYSICS_BREASTS_LEFTRIGHT, new SubpartEntry(SUBPART_PHYSICS_BREASTS_LEFTRIGHT, "mTorso", "physics_breasts_leftright", "physics_breasts_leftright_param_list", "physics_breasts_leftright_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE)); - addEntry(SUBPART_PHYSICS_BELLY_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BELLY_UPDOWN, "mTorso", "physics_belly_updown", "physics_belly_updown_param_list", "physics_belly_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH)); - addEntry(SUBPART_PHYSICS_BUTT_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BUTT_UPDOWN, "mTorso", "physics_butt_updown", "physics_butt_updown_param_list", "physics_butt_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH)); + addEntry(SUBPART_PHYSICS_BELLY_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BELLY_UPDOWN, "mTorso", "physics_belly_updown", "physics_belly_updown_param_list", "physics_belly_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH)); + addEntry(SUBPART_PHYSICS_BUTT_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BUTT_UPDOWN, "mTorso", "physics_butt_updown", "physics_butt_updown_param_list", "physics_butt_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH)); addEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, new SubpartEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, "mTorso", "physics_butt_leftright", "physics_butt_leftright_param_list", "physics_butt_leftright_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH)); addEntry(SUBPART_PHYSICS_ADVANCED, new SubpartEntry(SUBPART_PHYSICS_ADVANCED, "mTorso", "physics_advanced", "physics_advanced_param_list", "physics_advanced_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH)); } @@ -727,8 +728,14 @@ bool LLPanelEditWearable::postBuild() mPanelTitle = getChild<LLTextBox>("edit_wearable_title"); mDescTitle = getChild<LLTextBox>("description_text"); - getChild<LLRadioGroup>("sex_radio")->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this)); - getChild<LLButton>("save_as_button")->setCommitCallback(boost::bind(&LLPanelEditWearable::onSaveAsButtonClicked, this)); + mSexRadio = getChild<LLRadioGroup>("sex_radio"); + mSexRadio->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this)); + + mMaleIcon = getChild<LLIconCtrl>("male_icon"); + mFemaleIcon = getChild<LLIconCtrl>("female_icon"); + + mBtnSaveAs = getChild<LLButton>("save_as_button"); + mBtnSaveAs->setCommitCallback(boost::bind(&LLPanelEditWearable::onSaveAsButtonClicked, this)); // The following panels will be shown/hidden based on what wearable we're editing // body parts @@ -806,8 +813,20 @@ bool LLPanelEditWearable::postBuild() continue; } + mAccordionTabs.emplace(accordion_tab, tab); + // initialize callback to ensure camera view changes appropriately. tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index)); + + const std::string& scrolling_panel = subpart_entry->mParamList; + if (!scrolling_panel.empty()) + { + LLScrollingPanelList* panel_list = tab->findChild<LLScrollingPanelList>(scrolling_panel); + if (panel_list) + { + mParamPanels.emplace(scrolling_panel, panel_list); + } + } } // initialize texture and color picker controls @@ -1211,19 +1230,21 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, bool show, bo continue; } - LLScrollingPanelList *panel_list = findChild<LLScrollingPanelList>(scrolling_panel); - LLAccordionCtrlTab *tab = findChild<LLAccordionCtrlTab>(accordion_tab); - if (!panel_list) + auto accord_it = mAccordionTabs.find(accordion_tab); + if (accord_it == mAccordionTabs.end()) { - LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL; - continue; + LL_WARNS() << "could not get llaccordionctrltab from UI with name: " << accordion_tab << LL_ENDL; + continue; } + LLAccordionCtrlTab* tab = accord_it->second; - if (!tab) + auto panel_it = mParamPanels.find(scrolling_panel); + if (panel_it == mParamPanels.end()) { - LL_WARNS() << "could not get llaccordionctrltab from UI with name: " << accordion_tab << LL_ENDL; - continue; + LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL; + continue; } + LLScrollingPanelList *panel_list = panel_it->second; // Don't show female subparts if you're not female, etc. if (!(gAgentAvatarp->getSex() & subpart_entry->mSex)) @@ -1237,7 +1258,7 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, bool show, bo } // what edit group do we want to extract params for? - const std::string edit_group = subpart_entry->mEditGroup; + const std::string& edit_group = subpart_entry->mEditGroup; // storage for ordered list of visual params value_map_t sorted_params; @@ -1337,9 +1358,9 @@ void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type) // Toggle controls specific to shape editing panel. { bool is_shape = (type == LLWearableType::WT_SHAPE); - getChildView("sex_radio")->setVisible( is_shape); - getChildView("female_icon")->setVisible( is_shape); - getChildView("male_icon")->setVisible( is_shape); + mSexRadio->setVisible(is_shape); + mFemaleIcon->setVisible(is_shape); + mMaleIcon->setVisible(is_shape); } } @@ -1400,15 +1421,15 @@ void LLPanelEditWearable::updateScrollingPanelUI() ESubpart subpart_e = wearable_entry->mSubparts[index]; const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e); - const std::string scrolling_panel = subpart_entry->mParamList; - - LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel); + const std::string& scrolling_panel = subpart_entry->mParamList; - if (!panel_list) + auto panel_it = mParamPanels.find(scrolling_panel); + if (panel_it == mParamPanels.end()) { - LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL; - continue; + LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL; + continue; } + LLScrollingPanelList* panel_list = panel_it->second; panel_list->updatePanels(true); } @@ -1542,7 +1563,7 @@ void LLPanelEditWearable::updateVerbs() bool is_dirty = isDirty(); mBtnRevert->setEnabled(is_dirty); - getChildView("save_as_button")->setEnabled(is_dirty && can_copy); + mBtnSaveAs->setEnabled(is_dirty && can_copy); if (isAgentAvatarValid()) { @@ -1580,7 +1601,7 @@ void LLPanelEditWearable::configureAlphaCheckbox(LLAvatarAppearanceDefines::ETex LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild<LLCheckBoxCtrl>(name); checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te)); - mAlphaCheckbox2Index[name] = te; + mAlphaCheckbox2Index.push_back(std::make_pair(checkbox,te)); } void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te) @@ -1637,11 +1658,10 @@ void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LL void LLPanelEditWearable::updateAlphaCheckboxes() { - for (string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin(); - iter != mAlphaCheckbox2Index.end(); ++iter ) + for (const auto& check_pair : mAlphaCheckbox2Index) { - LLAvatarAppearanceDefines::ETextureIndex te = (LLAvatarAppearanceDefines::ETextureIndex)iter->second; - LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild<LLCheckBoxCtrl>(iter->first); + LLAvatarAppearanceDefines::ETextureIndex te = (LLAvatarAppearanceDefines::ETextureIndex)check_pair.second; + LLCheckBoxCtrl* ctrl = check_pair.first; if (ctrl) { ctrl->set(!gAgentAvatarp->isTextureVisible(te, mWearablePtr)); diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index aa4ac915c7..443b52b8fc 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -44,6 +44,8 @@ class LLViewerJointMesh; class LLAccordionCtrlTab; class LLJoint; class LLLineEditor; +class LLRadioGroup; +class LLIconCtrl; class LLPanelEditWearable : public LLPanel { @@ -123,6 +125,7 @@ private: LLViewerInventoryItem* mWearableItem; // these are constant no matter what wearable we're editing + LLButton* mBtnSaveAs; LLButton *mBtnRevert; LLButton *mBtnBack; std::string mBackBtnLabel; @@ -131,6 +134,9 @@ private: LLTextBox *mDescTitle; LLTextBox *mTxtAvatarHeight; + LLRadioGroup* mSexRadio = nullptr; + LLIconCtrl* mMaleIcon = nullptr; + LLIconCtrl* mFemaleIcon = nullptr; // localized and parameterized strings that used to build avatar_height_label std::string mMeters; @@ -170,8 +176,11 @@ private: LLPanel *mPanelUniversal; LLPanel *mPanelPhysics; - typedef std::map<std::string, LLAvatarAppearanceDefines::ETextureIndex> string_texture_index_map_t; - string_texture_index_map_t mAlphaCheckbox2Index; + std::unordered_map<std::string, LLAccordionCtrlTab*> mAccordionTabs; + std::unordered_map<std::string, LLScrollingPanelList*> mParamPanels; + + typedef std::vector<std::pair<LLCheckBoxCtrl*, LLAvatarAppearanceDefines::ETextureIndex>> checkbox_texture_index_vec_t; + checkbox_texture_index_vec_t mAlphaCheckbox2Index; typedef std::map<LLAvatarAppearanceDefines::ETextureIndex, LLUUID> s32_uuid_map_t; s32_uuid_map_t mPreviousAlphaTexture; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a706e339ea..51e2c05070 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -41,6 +41,7 @@ #include "llfloater.h" #include "llfloaterreg.h" #include "llfloatereditextdaycycle.h" +#include "lliconctrl.h" #include "llmultisliderctrl.h" #include "llnotificationsutil.h" #include "llsettingsvo.h" @@ -109,10 +110,7 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET | LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES); -const U32 ALTITUDE_SLIDER_COUNT = 3; const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; -const U32 ALTITUDE_MARKERS_COUNT = 3; -const U32 ALTITUDE_PREFIXERS_COUNT = 5; const std::string slider_marker_base = "mark"; @@ -167,24 +165,61 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() bool LLPanelEnvironmentInfo::postBuild() { + mIconGround = getChild<LLIconCtrl>(ICN_GROUND); + mIconWater = getChild<LLIconCtrl>(ICN_WATER); - getChild<LLUICtrl>(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); - getChild<LLUICtrl>(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); - getChild<LLUICtrl>(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); - getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); }); + mPanelEnvAltitudes = getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES); + mPanelEnvConfig = getChild<LLUICtrl>(PNL_SETTINGS); + mPanelEnvButtons = getChild <LLUICtrl>(PNL_BUTTONS); + mPanelEnvDisabled = getChild<LLUICtrl>(PNL_DISABLED); + mPanelEnvRegionMsg = getChild<LLUICtrl>(PNL_REGION_MSG); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged((F32)value.asReal()); }); - getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged((F32)value.asReal()); }); - getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); - getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + mEnvironmentDisabledText = getChild<LLTextBox>(TXT_DISABLED); + mLabelApparentTime = getChild<LLTextBox>(LBL_TIMEOFDAY); - getChild<LLMultiSliderCtrl>(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); - getChild<LLMultiSliderCtrl>(SLD_ALTITUDES)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); + mBtnUseDefault = getChild<LLButton>(BTN_USEDEFAULT); + mBtnUseDefault->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); + + mBtnSelectInv = getChild<LLButton>(BTN_SELECTINV); + mBtnSelectInv->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); + + mBtnEdit = getChild<LLButton>(BTN_EDIT); + mBtnEdit->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); + + mBtnResetAltitudes = getChild<LLButton>(BTN_RST_ALTITUDES); + mBtnResetAltitudes->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); }); + + mCheckAllowOverride = getChild<LLCheckBoxCtrl>(CHK_ALLOWOVERRIDE); + + mSliderDayLength = getChild<LLSliderCtrl>(SLD_DAYLENGTH); + mSliderDayLength->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged((F32)value.asReal()); }); + mSliderDayLength->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + mSliderDayLength->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + + mSliderDayOffset = getChild<LLSliderCtrl>(SLD_DAYOFFSET); + mSliderDayOffset->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged((F32)value.asReal()); }); + mSliderDayOffset->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + mSliderDayOffset->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + + mMultiSliderAltitudes = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES); + mMultiSliderAltitudes->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); + mMultiSliderAltitudes->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); + for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) + { + mAltitudeMarkers[idx] = findChild<LLUICtrl>(slider_marker_base + llformat("%u", idx)); + } + + for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) + { + mAltitudeDropTarget[idx] = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); + mAltitudeLabels[idx] = findChild<LLTextBox>("txt_" + alt_prefixes[idx]); + mAltitudeEditor[idx] = findChild<LLLineEditor>("edt_invname_" + alt_prefixes[idx]); + mAltitudePanels[idx] = findChild<LLView>("pnl_" + alt_prefixes[idx]); + } + for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; idx++) { LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); @@ -192,11 +227,12 @@ bool LLPanelEnvironmentInfo::postBuild() { drop_target->setPanel(this, alt_sliders[idx]); } + // set initial values to prevent [ALTITUDE] from displaying - updateAltLabel(alt_prefixes[idx], idx + 2, (F32)(idx * 1000)); + updateAltLabel(idx, idx + 2, (F32)(idx * 1000)); } - getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); - getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[4])->setPanel(this, alt_prefixes[4]); + mAltitudeDropTarget[3]->setPanel(this, alt_prefixes[3]); + mAltitudeDropTarget[4]->setPanel(this, alt_prefixes[4]); return true; } @@ -262,8 +298,8 @@ void LLPanelEnvironmentInfo::refresh() if (dayoffset.value() > 12.0f) dayoffset -= F32Hours(24.0); - getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setValue(daylength.value()); - getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setValue(dayoffset.value()); + mSliderDayLength->setValue(daylength.value()); + mSliderDayOffset->setValue(dayoffset.value()); udpateApparentTimeOfDay(); @@ -273,59 +309,58 @@ void LLPanelEnvironmentInfo::refresh() if (altitudes.size() > 0) { - LLMultiSliderCtrl *sld = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES); - sld->clear(); + mMultiSliderAltitudes->clear(); for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) { // make sure values are in range, server is supposed to validate them, // but issues happen, try to fix values in such case - F32 altitude = llclamp(altitudes[idx + 1], sld->getMinValue(), sld->getMaxValue()); - bool res = sld->addSlider(altitude, alt_sliders[idx]); + F32 altitude = llclamp(altitudes[idx + 1], mMultiSliderAltitudes->getMinValue(), mMultiSliderAltitudes->getMaxValue()); + bool res = mMultiSliderAltitudes->addSlider(altitude, alt_sliders[idx]); if (!res) { LL_WARNS_ONCE("ENVPANEL") << "Failed to validate altitude from server for parcel id" << getParcelId() << LL_ENDL; // Find a spot to insert altitude. // Assuming everything alright with slider, we should find new place in 11 steps top (step 25m, no overlap 100m) - F32 alt_step = (altitude > (sld->getMaxValue() / 2)) ? -sld->getIncrement() : sld->getIncrement(); + F32 alt_step = (altitude > (mMultiSliderAltitudes->getMaxValue() / 2)) ? -mMultiSliderAltitudes->getIncrement() : mMultiSliderAltitudes->getIncrement(); for (U32 i = 0; i < 30; i++) { altitude += alt_step; - if (altitude > sld->getMaxValue()) + if (altitude > mMultiSliderAltitudes->getMaxValue()) { - altitude = sld->getMinValue(); + altitude = mMultiSliderAltitudes->getMinValue(); } - else if (altitude < sld->getMinValue()) + else if (altitude < mMultiSliderAltitudes->getMinValue()) { - altitude = sld->getMaxValue(); + altitude = mMultiSliderAltitudes->getMaxValue(); } - res = sld->addSlider(altitude, alt_sliders[idx]); + res = mMultiSliderAltitudes->addSlider(altitude, alt_sliders[idx]); if (res) break; } } if (res) { // slider has some auto correction that might have kicked in - altitude = sld->getSliderValue(alt_sliders[idx]); + altitude = mMultiSliderAltitudes->getSliderValue(alt_sliders[idx]); } else { // Something is very very wrong LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL; } - updateAltLabel(alt_prefixes[idx], idx + 2, altitude); + updateAltLabel(idx, idx + 2, altitude); mAltitudes[alt_sliders[idx]] = AltitudeData(idx + 2, idx, altitude); } - if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) + if (mMultiSliderAltitudes->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) { LL_WARNS("ENVPANEL") << "Failed to add altitude sliders!" << LL_ENDL; } readjustAltLabels(); - sld->resetCurSlider(); + mMultiSliderAltitudes->resetCurSlider(); } - updateAltLabel(alt_prefixes[3], 1, 0); // ground - updateAltLabel(alt_prefixes[4], 0, 0); // water + updateAltLabel(3, 1, 0); // ground + updateAltLabel(4, 0, 0); // water } @@ -455,77 +490,75 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) if (mNoEnvironment || (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion())) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_LEGACY)); + mEnvironmentDisabledText->setText(getString(STR_LEGACY)); } else if (mNoSelection) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_NO_PARCEL)); + mEnvironmentDisabledText->setText(getString(STR_NO_PARCEL)); } else if (mCrossRegion) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_CROSS_REGION)); + mEnvironmentDisabledText->setText(getString(STR_CROSS_REGION)); } else if (!isRegion() && !mAllowOverride) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_DISALLOWED)); + mEnvironmentDisabledText->setText(getString(STR_DISALLOWED)); } else if (!is_bigenough) { is_unavailable = true; - getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_TOO_SMALL)); + mEnvironmentDisabledText->setText(getString(STR_TOO_SMALL)); } if (is_unavailable) { - getChild<LLUICtrl>(PNL_SETTINGS)->setVisible(false); - getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(false); - getChild<LLUICtrl>(PNL_DISABLED)->setVisible(true); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(false); - getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(false); + mPanelEnvConfig->setVisible(false); + mPanelEnvButtons->setVisible(false); + mPanelEnvDisabled->setVisible(true); + mPanelEnvAltitudes->setVisible(false); + mPanelEnvRegionMsg->setVisible(false); updateEditFloater(mCurrentEnvironment, false); return false; } - getChild<LLUICtrl>(PNL_SETTINGS)->setVisible(true); - getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(true); - getChild<LLUICtrl>(PNL_DISABLED)->setVisible(false); - getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(isRegion()); + mPanelEnvConfig->setVisible(true); + mPanelEnvButtons->setVisible(true); + mPanelEnvDisabled->setVisible(false); + mPanelEnvRegionMsg->setVisible(isRegion()); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); - getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setVisible(isRegion()); + mPanelEnvAltitudes->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); + mBtnResetAltitudes->setVisible(isRegion()); bool can_enable = enabled && !is_legacy && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); - getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(can_enable); - getChild<LLUICtrl>(BTN_USEDEFAULT)->setEnabled(can_enable); - getChild<LLUICtrl>(BTN_EDIT)->setEnabled(can_enable); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_enable); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable); - getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(can_enable && isRegion()); - getChild<LLUICtrl>(ICN_GROUND)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); - getChild<LLUICtrl>(ICN_WATER)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); - getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion()); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion()); + mBtnSelectInv->setEnabled(can_enable); + mBtnUseDefault->setEnabled(can_enable); + mBtnEdit->setEnabled(can_enable); + mSliderDayLength->setEnabled(can_enable); + mSliderDayOffset->setEnabled(can_enable); + mMultiSliderAltitudes->setEnabled(can_enable && isRegion()); + mIconGround->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); + mIconWater->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); + mBtnResetAltitudes->setEnabled(can_enable && isRegion()); + mPanelEnvAltitudes->setEnabled(can_enable); + mCheckAllowOverride->setEnabled(can_enable && isRegion()); for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) { - LLUICtrl* marker = findChild<LLUICtrl>(slider_marker_base + llformat("%u", idx)); - if (marker) + if (mAltitudeMarkers[idx]) { static LLColor4 marker_color(0.75f, 0.75f, 0.75f, 1.f); - marker->setColor((can_enable && isRegion()) ? marker_color : marker_color % 0.3f); + mAltitudeMarkers[idx]->setColor((can_enable && isRegion()) ? marker_color : marker_color % 0.3f); } } for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) { - LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); - if (drop_target) + if (mAltitudeDropTarget[idx]) { - drop_target->setDndEnabled(can_enable); + mAltitudeDropTarget[idx]->setDndEnabled(can_enable); } } @@ -542,24 +575,18 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) mDirtyFlag &= ~flag; } -void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_prefix, U32 sky_index, F32 alt_value) +void LLPanelEnvironmentInfo::updateAltLabel(U32 alt_index, U32 sky_index, F32 alt_value) { - LLMultiSliderCtrl *sld = findChild<LLMultiSliderCtrl>(SLD_ALTITUDES); - if (!sld) - { - LL_WARNS() << "Failed to find slider " << SLD_ALTITUDES << LL_ENDL; - return; - } - LLRect sld_rect = sld->getRect(); + LLRect sld_rect = mMultiSliderAltitudes->getRect(); S32 sld_range = sld_rect.getHeight(); S32 sld_bottom = sld_rect.mBottom; S32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. S32 pos = (S32)((sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100))); // get related views - LLTextBox* text = findChild<LLTextBox>("txt_" + alt_prefix); - LLLineEditor *field = findChild<LLLineEditor>("edt_invname_" + alt_prefix); - LLView *alt_panel = findChild<LLView>("pnl_" + alt_prefix); + LLTextBox* text = mAltitudeLabels[alt_index]; + LLLineEditor* field = mAltitudeEditor[alt_index]; + LLView* alt_panel = mAltitudePanels[alt_index]; if (text && (sky_index > 1)) { @@ -596,19 +623,16 @@ void LLPanelEnvironmentInfo::readjustAltLabels() // Very simple "adjust after the fact" method // Note: labels can be in any order - LLMultiSliderCtrl *sld = findChild<LLMultiSliderCtrl>(SLD_ALTITUDES); - if (!sld) return; - LLView* view_midle = NULL; U32 midle_ind = 0; S32 shift_up = 0; S32 shift_down = 0; - LLRect sld_rect = sld->getRect(); + LLRect sld_rect = mMultiSliderAltitudes->getRect(); // Find the middle one for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) { - LLView* cmp_view = findChild<LLView>(alt_panels[i], true); + LLView* cmp_view = mAltitudePanels[i]; if (!cmp_view) return; LLRect cmp_rect = cmp_view->getRect(); S32 pos = 0; @@ -619,7 +643,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { if (i != j) { - LLView* intr_view = findChild<LLView>(alt_panels[j], true); + LLView* intr_view = mAltitudePanels[j]; if (!intr_view) return; LLRect intr_rect = intr_view->getRect(); if (cmp_rect.mBottom >= intr_rect.mBottom) @@ -667,7 +691,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { if (i != midle_ind) { - LLView* trn_view = findChild<LLView>(alt_panels[i], true); + LLView* trn_view = mAltitudePanels[i]; LLRect trn_rect = trn_view->getRect(); if (trn_rect.mBottom <= midle_rect.mTop && trn_rect.mBottom >= midle_rect.mBottom) @@ -787,7 +811,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da } iter->second.mTrackIndex = new_index; - updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mTrackIndex, iter->second.mAltitude); + updateAltLabel(iter->second.mLabelIndex, iter->second.mTrackIndex, iter->second.mAltitude); iter++; } @@ -907,10 +931,10 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0) || (mCurrentEnvironment->mDayOffset.value() < 1.0)) { - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setVisible(false); + mLabelApparentTime->setVisible(false); return; } - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setVisible(true); + mLabelApparentTime->setVisible(true); S32Seconds now((S32)LLDate::now().secondsSinceEpoch()); @@ -932,10 +956,10 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString()); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[HH]", LLSD(hourofday.value()).asString()); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[MM]", lblminute); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM")); - getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString()); + mLabelApparentTime->setTextArg("[HH]", LLSD(hourofday.value()).asString()); + mLabelApparentTime->setTextArg("[MM]", lblminute); + mLabelApparentTime->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM")); + mLabelApparentTime->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString()); } diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index b478142987..c9b95cc348 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -39,6 +39,8 @@ #include "llestateinfomodel.h" class LLViewerRegion; +class LLIconCtrl; +class LLSettingsDropTarget; class LLPanelEnvironmentInfo : public LLPanel { @@ -63,6 +65,10 @@ public: protected: LOG_CLASS(LLPanelEnvironmentInfo); + static constexpr U32 ALTITUDE_SLIDER_COUNT = 3; + static constexpr U32 ALTITUDE_MARKERS_COUNT = 3; + static constexpr U32 ALTITUDE_PREFIXERS_COUNT = 5; + static const std::string BTN_SELECTINV; static const std::string BTN_EDIT; static const std::string BTN_USEDEFAULT; @@ -108,7 +114,7 @@ protected: bool getIsDirty() const { return (mDirtyFlag != 0); } bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); } U32 getDirtyFlag() const { return mDirtyFlag; } - void updateAltLabel(const std::string &alt_prefix, U32 sky_index, F32 alt_value); + void updateAltLabel(U32 alt_index, U32 sky_index, F32 alt_value); void readjustAltLabels(); void onSldDayLengthChanged(F32 value); @@ -168,6 +174,37 @@ protected: altitudes_data_t mAltitudes; S32 mCurEnvVersion; // used to filter duplicate callbacks/refreshes + LLUICtrl* mPanelEnvAltitudes = nullptr; + LLUICtrl* mPanelEnvConfig = nullptr; + LLUICtrl* mPanelEnvButtons = nullptr; + LLUICtrl* mPanelEnvDisabled = nullptr; + LLUICtrl* mPanelEnvRegionMsg = nullptr; + + LLButton* mBtnSelectInv = nullptr; + LLButton* mBtnEdit = nullptr; + LLButton* mBtnUseDefault = nullptr; + LLButton* mBtnResetAltitudes = nullptr; + + LLMultiSliderCtrl* mMultiSliderAltitudes = nullptr; + + LLSliderCtrl* mSliderDayLength = nullptr; + LLSliderCtrl* mSliderDayOffset = nullptr; + + LLTextBox* mEnvironmentDisabledText = nullptr; + LLTextBox* mLabelApparentTime = nullptr; + + LLCheckBoxCtrl* mCheckAllowOverride = nullptr; + + LLIconCtrl* mIconGround = nullptr; + LLIconCtrl* mIconWater = nullptr; + + std::array<LLUICtrl*, ALTITUDE_MARKERS_COUNT> mAltitudeMarkers; + std::array<LLSettingsDropTarget*, ALTITUDE_PREFIXERS_COUNT> mAltitudeDropTarget; + + std::array<LLTextBox*, ALTITUDE_PREFIXERS_COUNT> mAltitudeLabels; + std::array<LLLineEditor*, ALTITUDE_PREFIXERS_COUNT> mAltitudeEditor; + std::array<LLView*, ALTITUDE_PREFIXERS_COUNT> mAltitudePanels; + protected: typedef boost::signals2::connection connection_t; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 51095fd1db..7b3834bd60 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -201,13 +201,11 @@ LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() U32 matmedia_selection = mComboMatMedia->getCurrentIndex(); if (matmedia_selection == MATMEDIA_MATERIAL) { - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); - channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); + channel_to_edit = (LLRender::eTexIndex)mRadioMaterialType->getSelectedIndex(); } if (matmedia_selection == MATMEDIA_PBR) { - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_pbr_type"); - channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); + channel_to_edit = (LLRender::eTexIndex)mRadioPbrType->getSelectedIndex(); } } @@ -220,8 +218,7 @@ LLRender::eTexIndex LLPanelFace::getTextureDropChannel() { if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) { - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); - return LLRender::eTexIndex(radio_mat_type->getSelectedIndex()); + return LLRender::eTexIndex(mRadioMaterialType->getSelectedIndex()); } return LLRender::eTexIndex(MATTYPE_DIFFUSE); @@ -231,8 +228,7 @@ LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() { if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { - LLRadioGroup* radio_pbr_type = getChild<LLRadioGroup>("radio_pbr_type"); - return texture_info_from_pbrtype(radio_pbr_type->getSelectedIndex()); + return texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); } return texture_info_from_pbrtype(PBRTYPE_BASE_COLOR); @@ -240,8 +236,8 @@ LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() // Things the UI provides... // -LLUUID LLPanelFace::getCurrentNormalMap() { return getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); } -LLUUID LLPanelFace::getCurrentSpecularMap() { return getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->getImageAssetID(); } U32 LLPanelFace::getCurrentShininess() { return getChild<LLComboBox>("combobox shininess")->getCurrentIndex(); } U32 LLPanelFace::getCurrentBumpiness() { return getChild<LLComboBox>("combobox bumpiness")->getCurrentIndex(); } U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)getChild<LLComboBox>("combobox alphamode")->getCurrentIndex(); } @@ -307,41 +303,26 @@ bool LLPanelFace::postBuild() childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this); childSetAction("save_selected_pbr", &LLPanelFace::onClickBtnSavePBR, this); - LLTextureCtrl* mTextureCtrl; - LLTextureCtrl* mShinyTextureCtrl; - LLTextureCtrl* mBumpyTextureCtrl; - LLColorSwatchCtrl* mColorSwatch; - LLColorSwatchCtrl* mShinyColorSwatch; - - LLComboBox* mComboTexGen; - - LLCheckBoxCtrl *mCheckFullbright; - - LLTextBox* mLabelColorTransp; - LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha - - LLSpinCtrl* mCtrlGlow; - setMouseOpaque(false); - LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); - if (pbr_ctrl) + mPBRTextureCtrl = getChild<LLTextureCtrl>("pbr_control"); + if (mPBRTextureCtrl) { - pbr_ctrl->setDefaultImageAssetID(LLUUID::null); - pbr_ctrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); - pbr_ctrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); - pbr_ctrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); - pbr_ctrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); - pbr_ctrl->setDragCallback(boost::bind(&LLPanelFace::onDragPbr, this, _2)); - pbr_ctrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onPbrSelectionChanged, this, _1)); - pbr_ctrl->setOnCloseCallback(boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2)); + mPBRTextureCtrl->setDefaultImageAssetID(LLUUID::null); + mPBRTextureCtrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); + mPBRTextureCtrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); + mPBRTextureCtrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); + mPBRTextureCtrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); + mPBRTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragPbr, this, _2)); + mPBRTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onPbrSelectionChanged, this, _1)); + mPBRTextureCtrl->setOnCloseCallback(boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2)); - pbr_ctrl->setFollowsTop(); - pbr_ctrl->setFollowsLeft(); - pbr_ctrl->setImmediateFilterPermMask(PERM_NONE); - pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - pbr_ctrl->setBakeTextureEnabled(false); - pbr_ctrl->setInventoryPickType(PICK_MATERIAL); + mPBRTextureCtrl->setFollowsTop(); + mPBRTextureCtrl->setFollowsLeft(); + mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mPBRTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); + mPBRTextureCtrl->setBakeTextureEnabled(false); + mPBRTextureCtrl->setInventoryPickType(PICK_MATERIAL); } mTextureCtrl = getChild<LLTextureCtrl>("texture control"); @@ -454,18 +435,18 @@ bool LLPanelFace::postBuild() mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); } - LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type"); - if(radio_mat_type) + mRadioMaterialType = getChild<LLRadioGroup>("radio_material_type"); + if(mRadioMaterialType) { - radio_mat_type->setCommitCallback(LLPanelFace::onCommitMaterialType, this); - radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); + mRadioMaterialType->setCommitCallback(LLPanelFace::onCommitMaterialType, this); + mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); } - LLRadioGroup* radio_pbr_type = findChild<LLRadioGroup>("radio_pbr_type"); - if (radio_pbr_type) + mRadioPbrType = getChild<LLRadioGroup>("radio_pbr_type"); + if (mRadioPbrType) { - radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this); - radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); + mRadioPbrType->setCommitCallback(LLPanelFace::onCommitPbrType, this); + mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } mCtrlGlow = getChild<LLSpinCtrl>("glow"); @@ -532,7 +513,6 @@ void LLPanelFace::draw() void LLPanelFace::sendTexture() { - LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("texture control"); if(!mTextureCtrl) return; if( !mTextureCtrl->getTentative() ) { @@ -553,17 +533,16 @@ void LLPanelFace::sendTexture() void LLPanelFace::sendBump(U32 bumpiness) { - LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); if (bumpiness < BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; - bumpytexture_ctrl->clear(); - bumpytexture_ctrl->setImageAssetID(LLUUID()); + mBumpyTextureCtrl->clear(); + mBumpyTextureCtrl->setImageAssetID(LLUUID()); } updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); - LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID(); + LLUUID current_normal_map = mBumpyTextureCtrl->getImageAssetID(); U8 bump = (U8) bumpiness & TEM_BUMP_MASK; @@ -576,25 +555,21 @@ void LLPanelFace::sendBump(U32 bumpiness) // LLSelectedTEMaterial::setNormalID(this, current_normal_map); - LLSelectMgr::getInstance()->selectionSetBumpmap( bump, bumpytexture_ctrl->getImageItemID() ); + LLSelectMgr::getInstance()->selectionSetBumpmap( bump, mBumpyTextureCtrl->getImageItemID() ); } void LLPanelFace::sendTexGen() { - LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); - if(!mComboTexGen)return; U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen ); } void LLPanelFace::sendShiny(U32 shininess) { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - if (shininess < SHINY_TEXTURE) { - texture_ctrl->clear(); - texture_ctrl->setImageAssetID(LLUUID()); + mShinyTextureCtrl->clear(); + mShinyTextureCtrl->setImageAssetID(LLUUID()); } LLUUID specmap = getCurrentSpecularMap(); @@ -605,7 +580,7 @@ void LLPanelFace::sendShiny(U32 shininess) LLSelectedTEMaterial::setSpecularID(this, specmap); - LLSelectMgr::getInstance()->selectionSetShiny( shiny, texture_ctrl->getImageItemID() ); + LLSelectMgr::getInstance()->selectionSetShiny( shiny, mShinyTextureCtrl->getImageItemID() ); updateShinyControls(!specmap.isNull(), true); @@ -613,7 +588,6 @@ void LLPanelFace::sendShiny(U32 shininess) void LLPanelFace::sendFullbright() { - LLCheckBoxCtrl* mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright"); if(!mCheckFullbright)return; U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0; LLSelectMgr::getInstance()->selectionSetFullbright( fullbright ); @@ -621,8 +595,6 @@ void LLPanelFace::sendFullbright() void LLPanelFace::sendColor() { - - LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); @@ -631,7 +603,6 @@ void LLPanelFace::sendColor() void LLPanelFace::sendAlpha() { - LLSpinCtrl* mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans"); if(!mCtrlColorTransp)return; F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f; @@ -641,8 +612,6 @@ void LLPanelFace::sendAlpha() void LLPanelFace::sendGlow() { - LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow"); - llassert(mCtrlGlow); if (mCtrlGlow) { F32 glow = mCtrlGlow->get(); @@ -996,14 +965,13 @@ void LLPanelFace::sendTextureInfo() LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } -void LLPanelFace::alignTestureLayer() +void LLPanelFace::alignTextureLayer() { LLFace* last_face = NULL; bool identical_face = false; LLSelectedTE::getFace(last_face, identical_face); - LLRadioGroup * radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); - LLPanelFaceSetAlignedConcreteTEFunctor setfunc(this, last_face, static_cast<LLRender::eTexIndex>(radio_mat_type->getSelectedIndex())); + LLPanelFaceSetAlignedConcreteTEFunctor setfunc(this, last_face, static_cast<LLRender::eTexIndex>(mRadioMaterialType->getSelectedIndex())); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); } @@ -1055,10 +1023,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool identical_norm = false; bool identical_spec = false; - LLTextureCtrl *texture_ctrl = getChild<LLTextureCtrl>("texture control"); - LLTextureCtrl *shinytexture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - LLTextureCtrl *bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - LLUUID id; LLUUID normmap_id; LLUUID specmap_id; @@ -1122,21 +1086,19 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } mComboMatMedia->setEnabled(editable); - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); - if (radio_mat_type->getSelectedIndex() < MATTYPE_DIFFUSE) + if (mRadioMaterialType->getSelectedIndex() < MATTYPE_DIFFUSE) { - radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); + mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); } - radio_mat_type->setEnabled(editable); + mRadioMaterialType->setEnabled(editable); - LLRadioGroup* radio_pbr_type = getChild<LLRadioGroup>("radio_pbr_type"); - if (radio_pbr_type->getSelectedIndex() < PBRTYPE_RENDER_MATERIAL_ID) + if (mRadioPbrType->getSelectedIndex() < PBRTYPE_RENDER_MATERIAL_ID) { - radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); + mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } - radio_pbr_type->setEnabled(editable); + mRadioPbrType->setEnabled(editable); const bool pbr_selected = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR; - const bool texture_info_selected = pbr_selected && radio_pbr_type->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID; + const bool texture_info_selected = pbr_selected && mRadioPbrType->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID; getChildView("checkbox_sync_settings")->setEnabled(editable); childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); @@ -1147,30 +1109,28 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { getChildView("color label")->setEnabled(editable); } - LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>("colorswatch"); LLColor4 color = LLColor4::white; bool identical_color = false; - if (color_swatch) { LLSelectedTE::getColor(color, identical_color); - LLColor4 prev_color = color_swatch->get(); + LLColor4 prev_color = mColorSwatch->get(); - color_swatch->setOriginal(color); - color_swatch->set(color, force_set_values || (prev_color != color) || !editable); + mColorSwatch->setOriginal(color); + mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); - color_swatch->setValid(editable && !has_pbr_material); - color_swatch->setEnabled( editable && !has_pbr_material); - color_swatch->setCanApplyImmediately( editable && !has_pbr_material); + mColorSwatch->setValid(editable && !has_pbr_material); + mColorSwatch->setEnabled( editable && !has_pbr_material); + mColorSwatch->setCanApplyImmediately( editable && !has_pbr_material); } // Color transparency - getChildView("color trans")->setEnabled(editable); + mLabelColorTransp->setEnabled(editable); F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; - getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable && has_material); + mCtrlColorTransp->setValue(editable ? transparency : 0); + mCtrlColorTransp->setEnabled(editable && has_material); U8 shiny = 0; bool identical_shiny = false; @@ -1200,10 +1160,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild<LLUICtrl>("combobox shininess")->setTentative(!identical_spec); getChild<LLUICtrl>("glossiness")->setTentative(!identical_spec); getChild<LLUICtrl>("environment")->setTentative(!identical_spec); - getChild<LLUICtrl>("shinycolorswatch")->setTentative(!identical_spec); + mShinyColorSwatch->setTentative(!identical_spec); - LLColorSwatchCtrl* mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch"); - if (mShinyColorSwatch) { mShinyColorSwatch->setValid(editable); mShinyColorSwatch->setEnabled( editable ); @@ -1304,13 +1262,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) updateAlphaControls(); - if (texture_ctrl) + if (mTextureCtrl) { if (identical_diffuse) { - texture_ctrl->setTentative(false); - texture_ctrl->setEnabled(editable && !has_pbr_material); - texture_ctrl->setImageAssetID(id); + mTextureCtrl->setTentative(false); + mTextureCtrl->setEnabled(editable && !has_pbr_material); + mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); @@ -1318,27 +1276,27 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("maskcutoff")->setEnabled(can_change_alpha); getChildView("label maskcutoff")->setEnabled(can_change_alpha); - texture_ctrl->setBakeTextureEnabled(true); + mTextureCtrl->setBakeTextureEnabled(true); } else if (id.isNull()) { // None selected - texture_ctrl->setTentative(false); - texture_ctrl->setEnabled(false); - texture_ctrl->setImageAssetID(LLUUID::null); + mTextureCtrl->setTentative(false); + mTextureCtrl->setEnabled(false); + mTextureCtrl->setImageAssetID(LLUUID::null); getChildView("combobox alphamode")->setEnabled(false); getChildView("label alphamode")->setEnabled(false); getChildView("maskcutoff")->setEnabled(false); getChildView("label maskcutoff")->setEnabled(false); - texture_ctrl->setBakeTextureEnabled(false); + mTextureCtrl->setBakeTextureEnabled(false); } else { // Tentative: multiple selected with different textures - texture_ctrl->setTentative(true); - texture_ctrl->setEnabled(editable && !has_pbr_material); - texture_ctrl->setImageAssetID(id); + mTextureCtrl->setTentative(true); + mTextureCtrl->setEnabled(editable && !has_pbr_material); + mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); @@ -1346,7 +1304,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("maskcutoff")->setEnabled(can_change_alpha); getChildView("label maskcutoff")->setEnabled(can_change_alpha); - texture_ctrl->setBakeTextureEnabled(true); + mTextureCtrl->setBakeTextureEnabled(true); } if (attachment) @@ -1354,43 +1312,43 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // attachments are in world and in inventory, // server doesn't support changing permissions // in such case - texture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { - texture_ctrl->setImmediateFilterPermMask(PERM_NONE); + mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } - if (shinytexture_ctrl) + if (mShinyTextureCtrl) { - shinytexture_ctrl->setTentative( !identical_spec ); - shinytexture_ctrl->setEnabled( editable && !has_pbr_material); - shinytexture_ctrl->setImageAssetID( specmap_id ); + mShinyTextureCtrl->setTentative( !identical_spec ); + mShinyTextureCtrl->setEnabled( editable && !has_pbr_material); + mShinyTextureCtrl->setImageAssetID( specmap_id ); if (attachment) { - shinytexture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mShinyTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { - shinytexture_ctrl->setImmediateFilterPermMask(PERM_NONE); + mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } - if (bumpytexture_ctrl) + if (mBumpyTextureCtrl) { - bumpytexture_ctrl->setTentative( !identical_norm ); - bumpytexture_ctrl->setEnabled( editable && !has_pbr_material); - bumpytexture_ctrl->setImageAssetID( normmap_id ); + mBumpyTextureCtrl->setTentative( !identical_norm ); + mBumpyTextureCtrl->setEnabled( editable && !has_pbr_material); + mBumpyTextureCtrl->setImageAssetID( normmap_id ); if (attachment) { - bumpytexture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { - bumpytexture_ctrl->setImmediateFilterPermMask(PERM_NONE); + mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } } @@ -1621,26 +1579,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 glow = 0.f; bool identical_glow = false; LLSelectedTE::getGlow(glow,identical_glow); - getChild<LLUICtrl>("glow")->setValue(glow); - getChild<LLUICtrl>("glow")->setTentative(!identical_glow); - getChildView("glow")->setEnabled(editable); + mCtrlGlow->setValue(glow); + mCtrlGlow->setTentative(!identical_glow); + mCtrlGlow->setEnabled(editable); getChildView("glow label")->setEnabled(editable); } { - LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); - if (combobox_texgen) - { - // Maps from enum to combobox entry index - combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox texgen'" << LL_ENDL; - } + // Maps from enum to combobox entry index + mComboTexGen->selectNthItem(((S32)selected_texgen) >> 1); - getChildView("combobox texgen")->setEnabled(editable); - getChild<LLUICtrl>("combobox texgen")->setTentative(!identical); + mComboTexGen->setEnabled(editable); + mComboTexGen->setTentative(!identical); getChildView("tex gen")->setEnabled(editable); } @@ -1650,9 +1600,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); - getChild<LLUICtrl>("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); - getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material); - getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical_fullbright); + mCheckFullbright->setValue((S32)(fullbright_flag != 0)); + mCheckFullbright->setEnabled(editable && !has_pbr_material); + mCheckFullbright->setTentative(!identical_fullbright); mComboMatMedia->setEnabledByValue("Materials", !has_pbr_material); } @@ -1670,8 +1620,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats); LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); - LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); - if (mComboTexGen) { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; bool enabled = editable && (index != 1); @@ -1682,12 +1630,12 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) U32 material_type = MATTYPE_DIFFUSE; if (material_selection == MATMEDIA_MATERIAL) { - material_type = radio_mat_type->getSelectedIndex(); + material_type = mRadioMaterialType->getSelectedIndex(); } else if (material_selection == MATMEDIA_PBR) { enabled = editable && has_pbr_material; - material_type = radio_pbr_type->getSelectedIndex(); + material_type = mRadioPbrType->getSelectedIndex(); } switch (material_type) @@ -1783,8 +1731,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - texture_ctrl->setImageAssetID(material->getSpecularID()); + mShinyTextureCtrl->setImageAssetID(material->getSpecularID()); if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) { @@ -1814,17 +1761,15 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // if (!material->getSpecularID().isNull()) { - LLColorSwatchCtrl* shiny_swatch = getChild<LLColorSwatchCtrl>("shinycolorswatch"); LLColor4 new_color = material->getSpecularLightColor(); - LLColor4 old_color = shiny_swatch->get(); + LLColor4 old_color = mShinyColorSwatch->get(); - shiny_swatch->setOriginal(new_color); - shiny_swatch->set(new_color, force_set_values || old_color != new_color || !editable); + mShinyColorSwatch->setOriginal(new_color); + mShinyColorSwatch->set(new_color, force_set_values || old_color != new_color || !editable); } // Bumpy (normal) - texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - texture_ctrl->setImageAssetID(material->getNormalID()); + mBumpyTextureCtrl->setImageAssetID(material->getNormalID()); if (!material->getNormalID().isNull()) { @@ -1859,8 +1804,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) calcp->setVar(LLCalc::TEX_U_OFFSET, (F32)childGetValue("TexOffsetU").asReal()); calcp->setVar(LLCalc::TEX_V_OFFSET, (F32)childGetValue("TexOffsetV").asReal()); calcp->setVar(LLCalc::TEX_ROTATION, (F32)childGetValue("TexRot").asReal()); - calcp->setVar(LLCalc::TEX_TRANSPARENCY, (F32)childGetValue("ColorTrans").asReal()); - calcp->setVar(LLCalc::TEX_GLOW, (F32)childGetValue("glow").asReal()); + calcp->setVar(LLCalc::TEX_TRANSPARENCY, (F32)mCtrlColorTransp->getValue().asReal()); + calcp->setVar(LLCalc::TEX_GLOW, (F32)mCtrlGlow->getValue().asReal()); } else { @@ -1868,32 +1813,31 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) clearCtrls(); // Disable non-UICtrls - LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); - if (pbr_ctrl) + if (mPBRTextureCtrl) { - pbr_ctrl->setImageAssetID(LLUUID::null); - pbr_ctrl->setEnabled(false); + mPBRTextureCtrl->setImageAssetID(LLUUID::null); + mPBRTextureCtrl->setEnabled(false); } - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); - if (texture_ctrl) + + if (mTextureCtrl) { - texture_ctrl->setImageAssetID( LLUUID::null ); - texture_ctrl->setEnabled( false ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. -// texture_ctrl->setValid(false); + mTextureCtrl->setImageAssetID( LLUUID::null ); + mTextureCtrl->setEnabled( false ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. +// mTextureCtrl->setValid(false); } - LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); + if (mColorSwatch) { mColorSwatch->setEnabled( false ); mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") ); mColorSwatch->setValid(false); } - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); - if (radio_mat_type) + + if (mRadioMaterialType) { - radio_mat_type->setSelectedIndex(0); + mRadioMaterialType->setSelectedIndex(0); } - getChildView("color trans")->setEnabled(false); + mLabelColorTransp->setEnabled(false); getChildView("rptctrl")->setEnabled(false); getChildView("tex gen")->setEnabled(false); getChildView("label shininess")->setEnabled(false); @@ -2005,23 +1949,22 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool saveable = LLMaterialEditor::canSaveObjectsMaterial(); // pbr material - LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); LLUUID pbr_id; - if (pbr_ctrl) + if (mPBRTextureCtrl) { LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); - pbr_ctrl->setTentative(!identical_pbr); - pbr_ctrl->setEnabled(settable); - pbr_ctrl->setImageAssetID(pbr_id); + mPBRTextureCtrl->setTentative(!identical_pbr); + mPBRTextureCtrl->setEnabled(settable); + mPBRTextureCtrl->setImageAssetID(pbr_id); if (objectp->isAttachment()) { - pbr_ctrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); + mPBRTextureCtrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); } else { - pbr_ctrl->setImmediateFilterPermMask(PERM_NONE); + mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } @@ -2080,13 +2023,12 @@ void LLPanelFace::updateVisibilityGLTF(LLViewerObject* objectp /*= nullptr */) const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); const bool inventory_pending = objectp && objectp->isInventoryPending(); - LLRadioGroup* radio_pbr_type = findChild<LLRadioGroup>("radio_pbr_type"); - radio_pbr_type->setVisible(show_pbr); + mRadioPbrType->setVisible(show_pbr); - const U32 pbr_type = radio_pbr_type->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); const bool show_pbr_render_material_id = show_pbr && (pbr_type == PBRTYPE_RENDER_MATERIAL_ID); - getChildView("pbr_control")->setVisible(show_pbr_render_material_id); + mPBRTextureCtrl->setVisible(show_pbr_render_material_id); getChildView("pbr_from_inventory")->setVisible(show_pbr_render_material_id); getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); @@ -2890,7 +2832,7 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - LLSelectedTEMaterial::setSpecularLightColor(this, getChild<LLColorSwatchCtrl>("shinycolorswatch")->get()); + LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -2916,7 +2858,7 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onSelectShinyColor(const LLSD& data) { - LLSelectedTEMaterial::setSpecularLightColor(this, getChild<LLColorSwatchCtrl>("shinycolorswatch")->get()); + LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); LLSelectMgr::getInstance()->saveSelectedShinyColors(); } @@ -2935,33 +2877,31 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) { - LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type"); - LLRadioGroup* radio_pbr_type = findChild<LLRadioGroup>("radio_pbr_type"); LLComboBox* combo_shininess = findChild<LLComboBox>("combobox shininess"); LLComboBox* combo_bumpiness = findChild<LLComboBox>("combobox bumpiness"); - if (!radio_mat_type || !radio_pbr_type || !mComboMatMedia || !combo_shininess || !combo_bumpiness) + if (!mRadioMaterialType || !mRadioPbrType || !mComboMatMedia || !combo_shininess || !combo_bumpiness) { LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; } U32 materials_media = mComboMatMedia->getCurrentIndex(); - U32 material_type = radio_mat_type->getSelectedIndex(); + U32 material_type = mRadioMaterialType->getSelectedIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && mComboMatMedia->getEnabled(); bool show_material = materials_media == MATMEDIA_MATERIAL; bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled())); bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); const bool show_pbr_asset = show_pbr && texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; - radio_mat_type->setVisible(show_material); + mRadioMaterialType->setVisible(show_material); // Shared material controls getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); getChildView("tex gen")->setVisible(show_material || show_media || show_pbr_asset); - getChildView("combobox texgen")->setVisible(show_material || show_media || show_pbr_asset); + mComboTexGen->setVisible(show_material || show_media || show_pbr_asset); getChildView("button align textures")->setVisible(show_material || show_media); // Media controls @@ -2971,7 +2911,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) getChildView("button align")->setVisible(show_media); // Diffuse texture controls - getChildView("texture control")->setVisible(show_texture && show_material); + mTextureCtrl->setVisible(show_texture && show_material); getChildView("label alphamode")->setVisible(show_texture && show_material); getChildView("combobox alphamode")->setVisible(show_texture && show_material); getChildView("label maskcutoff")->setVisible(false); @@ -2988,7 +2928,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) getChildView("TexOffsetV")->setVisible(show_texture); // Specular map controls - getChildView("shinytexture control")->setVisible(show_shininess); + mShinyTextureCtrl->setVisible(show_shininess); getChildView("combobox shininess")->setVisible(show_shininess); getChildView("label shininess")->setVisible(show_shininess); getChildView("label glossiness")->setVisible(false); @@ -2996,7 +2936,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) getChildView("label environment")->setVisible(false); getChildView("environment")->setVisible(false); getChildView("label shinycolor")->setVisible(false); - getChildView("shinycolorswatch")->setVisible(false); + mShinyColorSwatch->setVisible(false); if (show_shininess) { updateShinyControls(); @@ -3012,7 +2952,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) { updateBumpyControls(); } - getChildView("bumpytexture control")->setVisible(show_bumpiness); + mBumpyTextureCtrl->setVisible(show_bumpiness); getChildView("combobox bumpiness")->setVisible(show_bumpiness); getChildView("label bumpiness")->setVisible(show_bumpiness); getChildView("bumpyScaleU")->setVisible(show_bumpiness); @@ -3073,8 +3013,7 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) // static void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox) { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID(); + LLUUID shiny_texture_ID = mShinyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; LLComboBox* comboShiny = getChild<LLComboBox>("combobox shininess"); @@ -3110,10 +3049,8 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh } } - - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); U32 materials_media = mComboMatMedia->getCurrentIndex(); - U32 material_type = radio_mat_type->getSelectedIndex(); + U32 material_type = mRadioMaterialType->getSelectedIndex(); bool show_material = (materials_media == MATMEDIA_MATERIAL); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); U32 shiny_value = comboShiny->getCurrentIndex(); @@ -3123,14 +3060,13 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh getChildView("label environment")->setVisible(show_shinyctrls); getChildView("environment")->setVisible(show_shinyctrls); getChildView("label shinycolor")->setVisible(show_shinyctrls); - getChildView("shinycolorswatch")->setVisible(show_shinyctrls); + mShinyColorSwatch->setVisible(show_shinyctrls); } // static void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox) { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); + LLUUID bumpy_texture_ID = mBumpyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; LLComboBox* comboBumpy = getChild<LLComboBox>("combobox bumpiness"); if (!comboBumpy) @@ -3140,10 +3076,6 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co if (mess_with_combobox) { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); - LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; - if (!bumpy_texture_ID.isNull() && is_setting_texture) { if (!comboBumpy->itemExists(USE_TEXTURE)) @@ -3196,10 +3128,9 @@ void LLPanelFace::updateAlphaControls() } U32 mat_type = MATTYPE_DIFFUSE; - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); - if(radio_mat_type) + if(mRadioMaterialType) { - mat_type = radio_mat_type->getSelectedIndex(); + mat_type = mRadioMaterialType->getSelectedIndex(); } show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL); @@ -3251,20 +3182,19 @@ bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) void LLPanelFace::onCommitPbr(const LLSD& data) { - LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); - if (!pbr_ctrl) return; - if (!pbr_ctrl->getTentative()) + if (!mPBRTextureCtrl) return; + if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a // permissions check in the selection manager. ARGH! - LLUUID id = pbr_ctrl->getImageItemID(); + LLUUID id = mPBRTextureCtrl->getImageItemID(); if (id.isNull()) { - id = pbr_ctrl->getImageAssetID(); + id = mPBRTextureCtrl->getImageAssetID(); } if (!LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) { - // If failed to set material, refresh pbr_ctrl's value + // If failed to set material, refresh mPBRTextureCtrl's value refresh(); } } @@ -3279,16 +3209,15 @@ void LLPanelFace::onSelectPbr(const LLSD& data) { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); - LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); - if (!pbr_ctrl) return; - if (!pbr_ctrl->getTentative()) + if (!mPBRTextureCtrl) return; + if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a // permissions check in the selection manager. ARGH! - LLUUID id = pbr_ctrl->getImageItemID(); + LLUUID id = mPBRTextureCtrl->getImageItemID(); if (id.isNull()) { - id = pbr_ctrl->getImageAssetID(); + id = mPBRTextureCtrl->getImageAssetID(); } if (!LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) { @@ -3388,7 +3317,7 @@ void LLPanelFace::onCancelSpecularTexture(const LLSD& data) U8 shiny = 0; bool identical_shiny = false; LLSelectedTE::getShiny(shiny, identical_shiny); - LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); + LLUUID spec_map_id = mShinyTextureCtrl->getImageAssetID(); shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE; sendShiny(shiny); } @@ -3398,7 +3327,7 @@ void LLPanelFace::onCancelNormalTexture(const LLSD& data) U8 bumpy = 0; bool identical_bumpy = false; LLSelectedTE::getBumpmap(bumpy, identical_bumpy); - LLUUID spec_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); + LLUUID spec_map_id = mBumpyTextureCtrl->getImageAssetID(); bumpy = spec_map_id.isNull() ? bumpy : BUMPY_TEXTURE; sendBump(bumpy); } @@ -3869,13 +3798,11 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) U32 material_type = 0; if (materials_media == MATMEDIA_PBR) { - LLRadioGroup *radio_mat_type = self->getChild<LLRadioGroup>("radio_pbr_type"); - material_type = radio_mat_type->getSelectedIndex(); + material_type = self->mRadioPbrType->getSelectedIndex(); } if (materials_media == MATMEDIA_MATERIAL) { - LLRadioGroup *radio_mat_type = self->getChild<LLRadioGroup>("radio_material_type"); - material_type = radio_mat_type->getSelectedIndex(); + material_type = self->mRadioMaterialType->getSelectedIndex(); } F32 repeats_per_meter = (F32) repeats_ctrl->getValue().asReal(); @@ -4003,15 +3930,14 @@ void LLPanelFace::onClickAutoFix(void* userdata) void LLPanelFace::onAlignTexture(void* userdata) { LLPanelFace* self = (LLPanelFace*)userdata; - self->alignTestureLayer(); + self->alignTextureLayer(); } void LLPanelFace::onClickBtnLoadInvPBR(void* userdata) { // Shouldn't this be "save to inventory?" LLPanelFace* self = (LLPanelFace*)userdata; - LLTextureCtrl* pbr_ctrl = self->findChild<LLTextureCtrl>("pbr_control"); - pbr_ctrl->showPicker(true); + self->mPBRTextureCtrl->showPicker(true); } void LLPanelFace::onClickBtnEditPBR(void* userdata) @@ -4916,7 +4842,7 @@ void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::fun void LLPanelFace::setMaterialOverridesFromSelection() { - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); U32 texture_info_start; U32 texture_info_end; @@ -5086,7 +5012,7 @@ bool LLPanelFace::Selection::compareSelection() void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VX] = value; @@ -5096,7 +5022,7 @@ void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VY] = value; @@ -5106,7 +5032,7 @@ void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal() * DEG_TO_RAD; - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mRotation = value; @@ -5116,7 +5042,7 @@ void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VX] = value; @@ -5126,7 +5052,7 @@ void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VY] = value; @@ -5136,12 +5062,8 @@ void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; - LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type"); - if(!radio_mat_type) - { - return; - } - U32 mattype = radio_mat_type->getSelectedIndex(); + + U32 mattype = mRadioMaterialType->getSelectedIndex(); std::string which_control="texture control"; switch (mattype) { @@ -5187,8 +5109,7 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) { - LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); - if (pbr_ctrl) + if (mPBRTextureCtrl) { LLUUID obj_owner_id; std::string obj_owner_name; @@ -5206,12 +5127,12 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) if ((can_copy && can_transfer && can_modify) || from_library) { - pbr_ctrl->setCanApply(true, true); + mPBRTextureCtrl->setCanApply(true, true); return; } // if material has (no-transfer) attribute it can be applied only for object which we own and is not for sale - pbr_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); + mPBRTextureCtrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); if (gSavedSettings.getBOOL("TextureLivePreview")) { diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 602b05d240..5468c369cb 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -52,6 +52,7 @@ class LLFloater; class LLMaterialID; class LLMediaCtrl; class LLMenuButton; +class LLRadioGroup; class PBRPickerAgentListener; class PBRPickerObjectListener; @@ -147,7 +148,7 @@ protected: void sendFullbright(); // applies and sends full bright void sendGlow(); - void alignTestureLayer(); + void alignTextureLayer(); void updateCopyTexButton(); @@ -291,9 +292,27 @@ private: F32 getCurrentShinyOffsetU(); F32 getCurrentShinyOffsetV(); - LLComboBox *mComboMatMedia; - LLMediaCtrl *mTitleMedia; - LLTextBox *mTitleMediaText; + LLTextureCtrl* mPBRTextureCtrl = nullptr; + LLTextureCtrl* mTextureCtrl = nullptr; + LLTextureCtrl* mShinyTextureCtrl = nullptr; + LLTextureCtrl* mBumpyTextureCtrl = nullptr; + LLColorSwatchCtrl* mColorSwatch = nullptr; + LLColorSwatchCtrl* mShinyColorSwatch = nullptr; + + LLComboBox* mComboTexGen = nullptr; + + LLRadioGroup* mRadioMaterialType = nullptr; + LLRadioGroup* mRadioPbrType = nullptr; + + LLCheckBoxCtrl* mCheckFullbright = nullptr; + + LLTextBox* mLabelColorTransp = nullptr; + LLSpinCtrl* mCtrlColorTransp = nullptr; // transparency = 1 - alpha + + LLSpinCtrl* mCtrlGlow = nullptr; + LLComboBox *mComboMatMedia = nullptr; + LLMediaCtrl *mTitleMedia = nullptr; + LLTextBox *mTitleMediaText = nullptr; // Update visibility of controls to match current UI mode // (e.g. materials vs media editing) diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 519f157973..079a5583d4 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -113,7 +113,7 @@ void LLPanelGroup::onOpen(const LLSD& key) if(!key.has("action")) { setGroupID(group_id); - getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab(); + mGroupsAccordion->expandDefaultTab(); return; } @@ -148,24 +148,26 @@ void LLPanelGroup::onOpen(const LLSD& key) bool LLPanelGroup::postBuild() { + mGroupsAccordion = getChild<LLAccordionCtrl>("groups_accordion"); + mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); - LLButton* button; + mButtonApply = getChild<LLButton>("btn_apply"); + mButtonApply->setClickedCallback(onBtnApply, this); + mButtonApply->setVisible(true); + mButtonApply->setEnabled(false); - button = getChild<LLButton>("btn_apply"); - button->setClickedCallback(onBtnApply, this); - button->setVisible(true); - button->setEnabled(false); + mButtonCall = getChild<LLButton>("btn_call"); + mButtonCall->setClickedCallback(onBtnGroupCallClicked, this); - button = getChild<LLButton>("btn_call"); - button->setClickedCallback(onBtnGroupCallClicked, this); + mButtonChat = getChild<LLButton>("btn_chat"); + mButtonChat->setClickedCallback(onBtnGroupChatClicked, this); - button = getChild<LLButton>("btn_chat"); - button->setClickedCallback(onBtnGroupChatClicked, this); + mButtonRefresh = getChild<LLButton>("btn_refresh"); + mButtonRefresh->setClickedCallback(onBtnRefresh, this); - button = getChild<LLButton>("btn_refresh"); - button->setClickedCallback(onBtnRefresh, this); + mGroupNameCtrl = getChild<LLUICtrl>("group_name"); childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL); @@ -184,7 +186,7 @@ bool LLPanelGroup::postBuild() if(panel_general) { panel_general->setupCtrls(this); - button = panel_general->getChild<LLButton>("btn_join"); + LLButton* button = panel_general->getChild<LLButton>("btn_join"); button->setVisible(false); button->setEnabled(true); @@ -199,9 +201,8 @@ bool LLPanelGroup::postBuild() return true; } -void LLPanelGroup::reposButton(const std::string& name) +void LLPanelGroup::reposButton(LLButton* button) { - LLButton* button = findChild<LLButton>(name); if(!button) return; LLRect btn_rect = button->getRect(); @@ -211,23 +212,10 @@ void LLPanelGroup::reposButton(const std::string& name) void LLPanelGroup::reposButtons() { - LLButton* button_refresh = findChild<LLButton>("btn_refresh"); - LLButton* button_cancel = findChild<LLButton>("btn_cancel"); - - if(button_refresh && button_cancel && button_refresh->getVisible() && button_cancel->getVisible()) - { - LLRect btn_refresh_rect = button_refresh->getRect(); - LLRect btn_cancel_rect = button_cancel->getRect(); - btn_refresh_rect.setLeftTopAndSize( btn_cancel_rect.mLeft + btn_cancel_rect.getWidth() + 2, - btn_refresh_rect.getHeight() + 2, btn_refresh_rect.getWidth(), btn_refresh_rect.getHeight()); - button_refresh->setRect(btn_refresh_rect); - } - - reposButton("btn_apply"); - reposButton("btn_refresh"); - reposButton("btn_cancel"); - reposButton("btn_chat"); - reposButton("btn_call"); + reposButton(mButtonApply); + reposButton(mButtonRefresh); + reposButton(mButtonChat); + reposButton(mButtonCall); } void LLPanelGroup::reshape(S32 width, S32 height, bool called_from_parent ) @@ -279,9 +267,9 @@ void LLPanelGroup::onBtnJoin() } else { - LL_DEBUGS() << "joining group: " << mID << LL_ENDL; - LLGroupActions::join(mID); -} + LL_DEBUGS() << "joining group: " << mID << LL_ENDL; + LLGroupActions::join(mID); + } } void LLPanelGroup::changed(LLGroupChange gc) @@ -299,7 +287,7 @@ void LLPanelGroup::onChange(EStatusType status, const LLSD& channelInfo, bool pr return; } - childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); + mButtonCall->setEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); } void LLPanelGroup::notifyObservers() @@ -313,9 +301,8 @@ void LLPanelGroup::update(LLGroupChange gc) if(gdatap) { std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; - LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); - group_name_ctrl->setValue(group_name); - group_name_ctrl->setToolTip(group_name); + mGroupNameCtrl->setValue(group_name); + mGroupNameCtrl->setToolTip(group_name); LLGroupData agent_gdatap; bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlikeWithoutAdminMenuFakery(); @@ -367,37 +354,24 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) if(gdatap) { std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; - LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); - group_name_ctrl->setValue(group_name); - group_name_ctrl->setToolTip(group_name); + mGroupNameCtrl->setValue(group_name); + mGroupNameCtrl->setToolTip(group_name); } - LLButton* button_apply = findChild<LLButton>("btn_apply"); - LLButton* button_refresh = findChild<LLButton>("btn_refresh"); - - LLButton* button_cancel = findChild<LLButton>("btn_cancel"); - LLButton* button_call = findChild<LLButton>("btn_call"); - LLButton* button_chat = findChild<LLButton>("btn_chat"); - - bool is_null_group_id = group_id == LLUUID::null; - if(button_apply) - button_apply->setVisible(!is_null_group_id); - if(button_refresh) - button_refresh->setVisible(!is_null_group_id); - - if(button_cancel) - button_cancel->setVisible(!is_null_group_id); + if(mButtonApply) + mButtonApply->setVisible(!is_null_group_id); + if(mButtonRefresh) + mButtonRefresh->setVisible(!is_null_group_id); - if(button_call) - button_call->setVisible(!is_null_group_id); - if(button_chat) - button_chat->setVisible(!is_null_group_id); + if(mButtonCall) + mButtonCall->setVisible(!is_null_group_id); + if(mButtonChat) + mButtonChat->setVisible(!is_null_group_id); getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id); - LLAccordionCtrl* tab_ctrl = getChild<LLAccordionCtrl>("groups_accordion"); - tab_ctrl->reset(); + mGroupsAccordion->reset(); LLAccordionCtrlTab* tab_general = getChild<LLAccordionCtrlTab>("group_general_tab"); LLAccordionCtrlTab* tab_roles = getChild<LLAccordionCtrlTab>("group_roles_tab"); @@ -428,13 +402,13 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) tab_land->setVisible(false); tab_experiences->setVisible(false); - getChild<LLUICtrl>("group_name")->setVisible(false); + mGroupNameCtrl->setVisible(false); getChild<LLUICtrl>("group_name_editor")->setVisible(true); - if(button_call) - button_call->setVisible(false); - if(button_chat) - button_chat->setVisible(false); + if(mButtonCall) + mButtonCall->setVisible(false); + if(mButtonChat) + mButtonChat->setVisible(false); } else { @@ -460,18 +434,18 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) tab_land->setVisible(is_member); tab_experiences->setVisible(is_member); - getChild<LLUICtrl>("group_name")->setVisible(true); + mGroupNameCtrl->setVisible(true); getChild<LLUICtrl>("group_name_editor")->setVisible(false); - if(button_apply) - button_apply->setVisible(is_member); - if(button_call) - button_call->setVisible(is_member); - if(button_chat) - button_chat->setVisible(is_member); + if(mButtonApply) + mButtonApply->setVisible(is_member); + if(mButtonCall) + mButtonCall->setVisible(is_member); + if(mButtonChat) + mButtonChat->setVisible(is_member); } - tab_ctrl->arrange(); + mGroupsAccordion->arrange(); reposButtons(); update(GC_ALL);//show/hide "join" button if data is already ready @@ -539,20 +513,18 @@ void LLPanelGroup::draw() if (mRefreshTimer.hasExpired()) { mRefreshTimer.stop(); - childEnable("btn_refresh"); - childEnable("groups_accordion"); + if(mButtonRefresh) mButtonRefresh->setEnabled(true); + mGroupsAccordion->setEnabled(true); } - LLButton* button_apply = findChild<LLButton>("btn_apply"); - - if(button_apply && button_apply->getVisible()) + if(mButtonApply && mButtonApply->getVisible()) { bool enable = false; std::string mesg; for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it) enable = enable || (*it)->needsApply(mesg); - childSetEnabled("btn_apply", enable); + mButtonApply->setEnabled(enable); } } @@ -568,8 +540,8 @@ void LLPanelGroup::refreshData() setGroupID(getID()); // 5 second timeout - childDisable("btn_refresh"); - childDisable("groups_accordion"); + if(mButtonRefresh) mButtonRefresh->setEnabled(false); + mGroupsAccordion->setEnabled(false); mRefreshTimer.start(); mRefreshTimer.setTimerExpirySec(5); diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index ede8118720..fa0e1d4104 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -33,11 +33,12 @@ class LLOfferInfo; -const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005; // 5ms +const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005f; // 5ms // Forward declares class LLPanelGroupTab; class LLTabContainer; +class LLAccordionCtrl; class LLAgent; @@ -98,7 +99,7 @@ protected: static void onBtnGroupCallClicked(void*); static void onBtnGroupChatClicked(void*); - void reposButton(const std::string& name); + void reposButton(LLButton* button); void reposButtons(); @@ -114,7 +115,14 @@ protected: std::vector<LLPanelGroupTab* > mTabs; - LLButton* mButtonJoin; + LLAccordionCtrl* mGroupsAccordion = nullptr; + + LLUICtrl* mGroupNameCtrl = nullptr; + LLButton* mButtonJoin = nullptr; + LLButton* mButtonApply = nullptr; + LLButton* mButtonCall = nullptr; + LLButton* mButtonChat = nullptr; + LLButton* mButtonRefresh = nullptr; LLUICtrl* mJoinText; }; diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp index f54ec45a3c..433db74cda 100644 --- a/indra/newview/llpanelgroupbulk.cpp +++ b/indra/newview/llpanelgroupbulk.cpp @@ -68,33 +68,36 @@ LLPanelGroupBulkImpl::LLPanelGroupBulkImpl(const LLUUID& group_id) : mAlreadyInGroup(), mConfirmedOwnerInvite(false), mListFullNotificationSent(false) -{} +{ +} LLPanelGroupBulkImpl::~LLPanelGroupBulkImpl() { - if(mAvatarNameCacheConnection.connected()) + if (mAvatarNameCacheConnection.connected()) { mAvatarNameCacheConnection.disconnect(); } } +// static void LLPanelGroupBulkImpl::callbackClickAdd(void* userdata) { - LLPanelGroupBulk* panelp = (LLPanelGroupBulk*)userdata; - - if(panelp) + if (LLPanelGroupBulk* panelp = (LLPanelGroupBulk*)userdata) { - //Right now this is hard coded with some knowledge that it is part - //of a floater since the avatar picker needs to be added as a dependent - //floater to the parent floater. - //Soon the avatar picker will be embedded into this panel - //instead of being it's own separate floater. But that is next week. - //This will do for now. -jwolk May 10, 2006 + // Right now this is hard coded with some knowledge that it is part + // of a floater since the avatar picker needs to be added as a dependent + // floater to the parent floater. + // Soon the avatar picker will be embedded into this panel + // instead of being it's own separate floater. But that is next week. + // This will do for now. -jwolk May 10, 2006 LLView* button = panelp->findChild<LLButton>("add_button"); LLFloater* root_floater = gFloaterView->getParentFloater(panelp); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(callbackAddUsers, _1, panelp->mImplementation), true, false, false, root_floater->getName(), button); - if(picker) + [&](const uuid_vec_t& agent_ids, const std::vector<LLAvatarName>&) + { + panelp->mImplementation->addUsers(agent_ids); + }, true, false, false, root_floater->getName(), button); + if (picker) { root_floater->addDependentFloater(picker); LLGroupMgr::getInstance()->sendCapGroupMembersRequest(panelp->mImplementation->mGroupID); @@ -102,70 +105,72 @@ void LLPanelGroupBulkImpl::callbackClickAdd(void* userdata) } } +// static void LLPanelGroupBulkImpl::callbackClickRemove(void* userdata) { - LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata; - if (selfp) + if (LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata) + { selfp->handleRemove(); + } } +// static void LLPanelGroupBulkImpl::callbackClickCancel(void* userdata) { - LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata; - if(selfp) + if (LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata) + { (*(selfp->mCloseCallback))(selfp->mCloseCallbackUserData); + } } +// static void LLPanelGroupBulkImpl::callbackSelect(LLUICtrl* ctrl, void* userdata) { - LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata; - if (selfp) + if (LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata) + { selfp->handleSelection(); + } } -void LLPanelGroupBulkImpl::callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data) +void LLPanelGroupBulkImpl::addUsers(const uuid_vec_t& agent_ids) { std::vector<std::string> names; - for (S32 i = 0; i < (S32)agent_ids.size(); i++) + for (const LLUUID& agent_id : agent_ids) { LLAvatarName av_name; - if (LLAvatarNameCache::get(agent_ids[i], &av_name)) + if (LLAvatarNameCache::get(agent_id, &av_name)) { - onAvatarNameCache(agent_ids[i], av_name, user_data); + onAvatarNameCache(agent_id, av_name); } else { - LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data; - if (selfp) + if (mAvatarNameCacheConnection.connected()) { - if (selfp->mAvatarNameCacheConnection.connected()) - { - selfp->mAvatarNameCacheConnection.disconnect(); - } - // *TODO : Add a callback per avatar name being fetched. - selfp->mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_ids[i],boost::bind(onAvatarNameCache, _1, _2, user_data)); + mAvatarNameCacheConnection.disconnect(); } + // *TODO : Add a callback per avatar name being fetched. + mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, + [&](const LLUUID& agent_id, const LLAvatarName& av_name) + { + onAvatarNameCache(agent_id, av_name); + }); } } } -void LLPanelGroupBulkImpl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, void* user_data) +void LLPanelGroupBulkImpl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data; - - if (selfp) + if (mAvatarNameCacheConnection.connected()) { - if (selfp->mAvatarNameCacheConnection.connected()) - { - selfp->mAvatarNameCacheConnection.disconnect(); - } - std::vector<std::string> names; - uuid_vec_t agent_ids; - agent_ids.push_back(agent_id); - names.push_back(av_name.getCompleteName()); - - selfp->addUsers(names, agent_ids); + mAvatarNameCacheConnection.disconnect(); } + + std::vector<std::string> names; + uuid_vec_t agent_ids; + agent_ids.push_back(agent_id); + names.push_back(av_name.getCompleteName()); + + addUsers(names, agent_ids); } void LLPanelGroupBulkImpl::handleRemove() @@ -174,17 +179,15 @@ void LLPanelGroupBulkImpl::handleRemove() if (selection.empty()) return; - std::vector<LLScrollListItem*>::iterator iter; - for(iter = selection.begin(); iter != selection.end(); ++iter) + for (const LLScrollListItem* item : selection) { - mInviteeIDs.erase((*iter)->getUUID()); + mInviteeIDs.erase(item->getUUID()); } mBulkAgentList->deleteSelectedItems(); mRemoveButton->setEnabled(false); - if( mOKButton && mOKButton->getEnabled() && - mBulkAgentList->isEmpty()) + if (mOKButton && mOKButton->getEnabled() && mBulkAgentList->isEmpty()) { mOKButton->setEnabled(false); } @@ -192,24 +195,17 @@ void LLPanelGroupBulkImpl::handleRemove() void LLPanelGroupBulkImpl::handleSelection() { - std::vector<LLScrollListItem*> selection = mBulkAgentList->getAllSelected(); - if (selection.empty()) - mRemoveButton->setEnabled(false); - else - mRemoveButton->setEnabled(true); + mRemoveButton->setEnabled(mBulkAgentList->getFirstSelected()); } void LLPanelGroupBulkImpl::addUsers(const std::vector<std::string>& names, const uuid_vec_t& agent_ids) { - std::string name; - LLUUID id; - - if(mListFullNotificationSent) + if (mListFullNotificationSent) { return; } - if( !mListFullNotificationSent && + if (!mListFullNotificationSent && (names.size() + mInviteeIDs.size() > MAX_GROUP_INVITES)) { mListFullNotificationSent = true; @@ -223,32 +219,35 @@ void LLPanelGroupBulkImpl::addUsers(const std::vector<std::string>& names, const for (S32 i = 0; i < (S32)names.size(); ++i) { - name = names[i]; - id = agent_ids[i]; + const LLUUID& id = agent_ids[i]; - if(mInviteeIDs.find(id) != mInviteeIDs.end()) + if (mInviteeIDs.find(id) != mInviteeIDs.end()) { continue; } - //add the name to the names list + // Add the name to the name list LLSD row; row["id"] = id; - row["columns"][0]["value"] = name; + row["columns"][0]["value"] = names[i]; mBulkAgentList->addElement(row); mInviteeIDs.insert(id); // We've successfully added someone to the list. - if(mOKButton && !mOKButton->getEnabled()) + if (mOKButton && !mOKButton->getEnabled()) + { mOKButton->setEnabled(true); + } } } void LLPanelGroupBulkImpl::setGroupName(std::string name) { - if(mGroupName) + if (mGroupName) + { mGroupName->setText(name); + } } @@ -258,7 +257,8 @@ LLPanelGroupBulk::LLPanelGroupBulk(const LLUUID& group_id) : mPendingGroupPropertiesUpdate(false), mPendingRoleDataUpdate(false), mPendingMemberDataUpdate(false) -{} +{ +} LLPanelGroupBulk::~LLPanelGroupBulk() { @@ -269,11 +269,15 @@ void LLPanelGroupBulk::clear() { mImplementation->mInviteeIDs.clear(); - if(mImplementation->mBulkAgentList) + if (mImplementation->mBulkAgentList) + { mImplementation->mBulkAgentList->deleteAllItems(); + } - if(mImplementation->mOKButton) + if (mImplementation->mOKButton) + { mImplementation->mOKButton->setEnabled(false); + } } void LLPanelGroupBulk::update() @@ -292,12 +296,14 @@ void LLPanelGroupBulk::updateGroupName() { LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); - if( gdatap && + if (gdatap && gdatap->isGroupPropertiesDataComplete()) { // Only do work if the current group name differs - if(mImplementation->mGroupName->getText().compare(gdatap->mName) != 0) + if (mImplementation->mGroupName->getText().compare(gdatap->mName) != 0) + { mImplementation->setGroupName(gdatap->mName); + } } else { @@ -308,43 +314,34 @@ void LLPanelGroupBulk::updateGroupName() void LLPanelGroupBulk::updateGroupData() { LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); - if(gdatap && gdatap->isGroupPropertiesDataComplete()) + if (gdatap && gdatap->isGroupPropertiesDataComplete()) { mPendingGroupPropertiesUpdate = false; } - else + else if (!mPendingGroupPropertiesUpdate) { - if(!mPendingGroupPropertiesUpdate) - { - mPendingGroupPropertiesUpdate = true; - LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID); - } + mPendingGroupPropertiesUpdate = true; + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID); } - if(gdatap && gdatap->isRoleDataComplete()) + if (gdatap && gdatap->isRoleDataComplete()) { mPendingRoleDataUpdate = false; } - else + else if (!mPendingRoleDataUpdate) { - if(!mPendingRoleDataUpdate) - { - mPendingRoleDataUpdate = true; - LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID); - } + mPendingRoleDataUpdate = true; + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID); } - if(gdatap && gdatap->isMemberDataComplete()) + if (gdatap && gdatap->isMemberDataComplete()) { mPendingMemberDataUpdate = false; } - else + else if (!mPendingMemberDataUpdate) { - if(!mPendingMemberDataUpdate) - { - mPendingMemberDataUpdate = true; - LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID); - } + mPendingMemberDataUpdate = true; + LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID); } } @@ -367,21 +364,20 @@ void LLPanelGroupBulk::setCloseCallback(void (*close_callback)(void*), void* dat void LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids) { std::vector<std::string> names; - for (S32 i = 0; i < (S32)agent_ids.size(); i++) + for (size_t i = 0; i < agent_ids.size(); i++) { std::string fullname; - LLUUID agent_id = agent_ids[i]; + const LLUUID& agent_id = agent_ids[i]; LLViewerObject* dest = gObjectList.findObject(agent_id); - if(dest && dest->isAvatar()) + if (dest && dest->isAvatar()) { LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvlast = dest->getNVPair("LastName"); - if(nvfirst && nvlast) + if (nvfirst && nvlast) { - fullname = LLCacheName::buildFullName( - nvfirst->getString(), nvlast->getString()); - + fullname = LLCacheName::buildFullName(nvfirst->getString(), nvlast->getString()); } + if (!fullname.empty()) { names.push_back(fullname); @@ -394,20 +390,25 @@ void LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids) } else { - //looks like user try to invite offline friend - //for offline avatar_id gObjectList.findObject() will return null - //so we need to do this additional search in avatar tracker, see EXT-4732 + // Looks like the user tries to invite a friend which is offline. + // For offline avatar_id gObjectList.findObject() will return null + // so we need to do this additional search in avatar tracker, see EXT-4732 if (LLAvatarTracker::instance().isBuddy(agent_id)) { LLAvatarName av_name; if (!LLAvatarNameCache::get(agent_id, &av_name)) { - // actually it should happen, just in case - LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&LLPanelGroupBulk::addUserCallback, this, _1, _2)); + // Actually it shouldn't happen, just in case + LLAvatarNameCache::get(LLUUID(agent_id), + [&](const LLUUID& agent_id, const LLAvatarName& av_name) + { + addUserCallback(agent_id, av_name); + }); // for this special case! - //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence + // when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence // removed id will be added in callback agent_ids.erase(agent_ids.begin() + i); + i--; // To process the next agent_id with the same index } else { diff --git a/indra/newview/llpanelgroupbulkimpl.h b/indra/newview/llpanelgroupbulkimpl.h index 963780200a..5a479f8117 100644 --- a/indra/newview/llpanelgroupbulkimpl.h +++ b/indra/newview/llpanelgroupbulkimpl.h @@ -50,9 +50,10 @@ public: static void callbackClickCancel(void* userdata); static void callbackSelect(LLUICtrl* ctrl, void* userdata); - static void callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data); - static void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, void* user_data); + void addUsers(const uuid_vec_t& agent_ids); + + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); void handleRemove(); void handleSelection(); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index bc56b49e5d..4404efff98 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -812,20 +812,14 @@ bool LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) { LLPanelGroupSubTab::postBuildSubTab(root); - // Upcast parent so we can ask it for sibling controls. - LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root; - // Look recursively from the parent to find all our widgets. - bool recurse = true; - mHeader = parent->findChild<LLPanel>("members_header", recurse); - mFooter = parent->findChild<LLPanel>("members_footer", recurse); - - mMembersList = parent->getChild<LLNameListCtrl>("member_list", recurse); - mAssignedRolesList = parent->getChild<LLScrollListCtrl>("member_assigned_roles", recurse); - mAllowedActionsList = parent->getChild<LLScrollListCtrl>("member_allowed_actions", recurse); - mActionDescription = parent->getChild<LLTextEditor>("member_action_description", recurse); + mHeader = root->findChild<LLPanel>("members_header"); + mFooter = root->findChild<LLPanel>("members_footer"); - if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList || !mActionDescription) return false; + mMembersList = root->getChild<LLNameListCtrl>("member_list"); + mAssignedRolesList = root->getChild<LLScrollListCtrl>("member_assigned_roles"); + mAllowedActionsList = root->getChild<LLScrollListCtrl>("member_allowed_actions"); + mActionDescription = root->getChild<LLTextEditor>("member_action_description"); mAllowedActionsList->setCommitOnSelectionChange(true); mAllowedActionsList->setCommitCallback(boost::bind(&LLPanelGroupMembersSubTab::updateActionDescription, this)); @@ -844,31 +838,22 @@ bool LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) row["columns"][2]["column"] = "online"; mMembersList->addElement(row); std::string order_by = gSavedSettings.getString("GroupMembersSortOrder"); - if(!order_by.empty()) + if (!order_by.empty()) { mMembersList->sortByColumn(order_by, true); } - LLButton* button = parent->getChild<LLButton>("member_invite", recurse); - if ( button ) - { - button->setClickedCallback(onInviteMember, this); - button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE)); - } + LLButton* button = root->getChild<LLButton>("member_invite"); + button->setClickedCallback(onInviteMember, this); + button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE)); - mEjectBtn = parent->getChild<LLButton>("member_eject", recurse); - if ( mEjectBtn ) - { - mEjectBtn->setClickedCallback(onEjectMembers, this); - mEjectBtn->setEnabled(false); - } + mEjectBtn = root->getChild<LLButton>("member_eject"); + mEjectBtn->setClickedCallback(onEjectMembers, this); + mEjectBtn->setEnabled(false); - mBanBtn = parent->getChild<LLButton>("member_ban", recurse); - if(mBanBtn) - { - mBanBtn->setClickedCallback(onBanMember, this); - mBanBtn->setEnabled(false); - } + mBanBtn = root->getChild<LLButton>("member_ban"); + mBanBtn->setClickedCallback(onBanMember, this); + mBanBtn->setEnabled(false); return true; } @@ -1371,11 +1356,14 @@ void LLPanelGroupMembersSubTab::activate() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); LLPanelGroupSubTab::activate(); - if(!mActivated) + if (!mActivated) { if (!gdatap || !gdatap->isMemberDataComplete()) { - LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID); + const U32 page_size = 50; + std::string sort_column_name = mMembersList->getSortColumnName(); + bool sort_descending = !mMembersList->getSortAscending(); + LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID, page_size, 0, sort_column_name, sort_descending); } if (!gdatap || !gdatap->isRoleMemberDataComplete()) @@ -1483,8 +1471,7 @@ bool LLPanelGroupMembersSubTab::addOwnerCB(const LLSD& notification, const LLSD& void LLPanelGroupMembersSubTab::applyMemberChanges() { - //sucks to do a find again here, but it is in constant time, so, could - //be worse + // Sucks to do a find again here, but it is in constant time, so, could be worse LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { @@ -1492,8 +1479,7 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() return; } - //we need to add all of the changed roles data - //for each member whose role changed + // We need to add all of the changed roles data for each member whose role changed for (member_role_changes_map_t::iterator member = mMemberRoleChangeData.begin(); member != mMemberRoleChangeData.end(); ++member) { @@ -1511,7 +1497,7 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() mMemberRoleChangeData.clear(); LLGroupMgr::getInstance()->sendGroupRoleMemberChanges(mGroupID); - //force a UI update + // Force an UI update handleMemberSelect(); mChanged = false; @@ -1522,32 +1508,23 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() bool LLPanelGroupMembersSubTab::matchesSearchFilter(const std::string& fullname) { // If the search filter is empty, everything passes. - if (mSearchFilter.empty()) return true; + if (mSearchFilter.empty()) + return true; // Create a full name, and compare it to the search filter. std::string fullname_lc(fullname); LLStringUtil::toLower(fullname_lc); std::string::size_type match = fullname_lc.find(mSearchFilter); - - if (std::string::npos == match) - { - // not found - return false; - } - else - { - return true; - } + return match != std::string::npos; } U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id) { - //we loop over all of the changes - //if we are adding a role, then we simply add the role's powers - //if we are removing a role, we store that role id away - //and then we have to build the powers up bases on the roles the agent - //is in + // We loop over all of the changes + // If we are adding a role, then we simply add the role's powers + // If we are removing a role, we store that role id away + // and then we have to build the powers up bases on the roles the agent is in LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) @@ -1557,7 +1534,7 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag } LLGroupMgrGroupData::member_list_t::iterator iter = gdatap->mMembers.find(agent_id); - if ( iter == gdatap->mMembers.end() ) + if (iter == gdatap->mMembers.end()) { LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No member data for member with UUID " << agent_id << LL_ENDL; return GP_NO_POWERS; @@ -1570,37 +1547,36 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag return GP_NO_POWERS; } - //see if there are unsaved role changes for this agent + // See if there are unsaved role changes for this agent role_change_data_map_t* role_change_datap = NULL; member_role_changes_map_t::iterator member = mMemberRoleChangeData.find(agent_id); - if ( member != mMemberRoleChangeData.end() ) + if (member != mMemberRoleChangeData.end()) { - //this member has unsaved role changes - //so grab them - role_change_datap = (*member).second; + // This member has unsaved role changes + // so grab them + role_change_datap = member->second; } U64 new_powers = GP_NO_POWERS; - if ( role_change_datap ) + if (role_change_datap) { uuid_vec_t roles_to_be_removed; - for (role_change_data_map_t::iterator role = role_change_datap->begin(); - role != role_change_datap->end(); ++ role) + for (const auto& role : *role_change_datap) { - if ( role->second == RMC_ADD ) + if (role.second == RMC_ADD) { - new_powers |= gdatap->getRolePowers(role->first); + new_powers |= gdatap->getRolePowers(role.first); } else { - roles_to_be_removed.push_back(role->first); + roles_to_be_removed.push_back(role.first); } } - //loop over the member's current roles, summing up - //the powers (not including the role we are removing) + // loop over the member's current roles, summing up + // the powers (not including the role we are removing) for (LLGroupMemberData::role_list_t::iterator current_role = member_data->roleBegin(); current_role != member_data->roleEnd(); ++current_role) { @@ -1661,9 +1637,10 @@ void LLPanelGroupMembersSubTab::draw() void LLPanelGroupMembersSubTab::update(LLGroupChange gc) { - if (mGroupID.isNull()) return; + if (mGroupID.isNull()) + return; - if ( GC_TITLES == gc || GC_PROPERTIES == gc ) + if (GC_TITLES == gc || GC_PROPERTIES == gc) { // Don't care about title or general group properties updates. return; @@ -1677,9 +1654,9 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) } // Wait for both all data to be retrieved before displaying anything. - if ( gdatap->isMemberDataComplete() - && gdatap->isRoleDataComplete() - && gdatap->isRoleMemberDataComplete()) + if (gdatap->isMemberDataComplete() && + gdatap->isRoleDataComplete() && + gdatap->isRoleMemberDataComplete()) { mMemberProgress = gdatap->mMembers.begin(); mPendingMemberUpdate = true; @@ -1690,18 +1667,18 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) // Build a string with info on retrieval progress. std::ostringstream retrieved; - if ( gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete() && !gdatap->mMembers.size() ) + if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete() && !gdatap->mMembers.size()) { // MAINT-5237 retrieved << "Member list not available."; } - else if ( !gdatap->isMemberDataComplete() ) + else if (!gdatap->isMemberDataComplete()) { // Still busy retreiving member list. retrieved << "Retrieving member list (" << gdatap->mMembers.size() << " / " << gdatap->mMemberCount << ")..."; } - else if( !gdatap->isRoleDataComplete() ) + else if (!gdatap->isRoleDataComplete()) { // Still busy retreiving role list. retrieved << "Retrieving role list (" << gdatap->mRoles.size() @@ -1719,7 +1696,9 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) { - if (!data) return; + if (!data) + return; + LLUIString donated = getString("donation_area"); donated.setArg("[AREA]", llformat("%d", data->getContribution())); @@ -1765,7 +1744,7 @@ void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemb if (matchesSearchFilter(av_name.getAccountName())) { addMemberToList(member); - if(!mMembersList->getEnabled()) + if (!mMembersList->getEnabled()) { mMembersList->setEnabled(true); } @@ -1788,15 +1767,15 @@ void LLPanelGroupMembersSubTab::updateMembers() // Make sure all data is still complete. Incomplete data // may occur if we refresh. - if ( !gdatap->isMemberDataComplete() - || !gdatap->isRoleDataComplete() - || !gdatap->isRoleMemberDataComplete()) + if (!gdatap->isMemberDataComplete() || + !gdatap->isRoleDataComplete() || + !gdatap->isRoleMemberDataComplete()) { return; } - //cleanup list only for first iteration - if(mMemberProgress == gdatap->mMembers.begin()) + // Cleanup list only for first iteration + if (mMemberProgress == gdatap->mMembers.begin()) { mMembersList->deleteAllItems(); } @@ -1806,7 +1785,7 @@ void LLPanelGroupMembersSubTab::updateMembers() LLTimer update_time; update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME); - for( ; mMemberProgress != end && !update_time.hasExpired(); ++mMemberProgress) + for (; mMemberProgress != end && !update_time.hasExpired(); ++mMemberProgress) { if (!mMemberProgress->second) continue; @@ -1866,7 +1845,8 @@ void LLPanelGroupMembersSubTab::onBanMember(void* user_data) void LLPanelGroupMembersSubTab::confirmBanMembers() { std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); - if (selection.empty()) return; + if (selection.empty()) + return; auto selection_count = selection.size(); if (selection_count == 1) @@ -1912,8 +1892,7 @@ void LLPanelGroupMembersSubTab::updateActionDescription() return; } - LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata(); - if (rap) + if (LLRoleAction* rap = (LLRoleAction*)action_item->getUserdata()) { std::string desc = rap->mLongDescription.empty() ? rap->mDescription : rap->mLongDescription; mActionDescription->setText(desc); @@ -1923,23 +1902,22 @@ void LLPanelGroupMembersSubTab::updateActionDescription() void LLPanelGroupMembersSubTab::handleBanMember() { LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); - if(!gdatap) + if (!gdatap) { LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL; return; } std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); - if(selection.empty()) + if (selection.empty()) { return; } uuid_vec_t ban_ids; - std::vector<LLScrollListItem*>::iterator itor; - for(itor = selection.begin(); itor != selection.end(); ++itor) + for (const LLScrollListItem* item : selection) { - LLUUID ban_id = (*itor)->getUUID(); + LLUUID ban_id = item->getUUID(); ban_ids.push_back(ban_id); LLGroupBanData ban_data; @@ -1983,54 +1961,33 @@ bool LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root; // Look recursively from the parent to find all our widgets. - bool recurse = true; - mHeader = parent->findChild<LLPanel>("roles_header", recurse); - mFooter = parent->findChild<LLPanel>("roles_footer", recurse); - - - mRolesList = parent->getChild<LLScrollListCtrl>("role_list", recurse); - mAssignedMembersList = parent->getChild<LLNameListCtrl>("role_assigned_members", recurse); - mAllowedActionsList = parent->getChild<LLScrollListCtrl>("role_allowed_actions", recurse); - mActionDescription = parent->getChild<LLTextEditor>("role_action_description", recurse); + mHeader = parent->findChild<LLPanel>("roles_header"); + mFooter = parent->findChild<LLPanel>("roles_footer"); - mRoleName = parent->getChild<LLLineEditor>("role_name", recurse); - mRoleTitle = parent->getChild<LLLineEditor>("role_title", recurse); - mRoleDescription = parent->getChild<LLTextEditor>("role_description", recurse); + mRolesList = parent->getChild<LLScrollListCtrl>("role_list"); + mAssignedMembersList = parent->getChild<LLNameListCtrl>("role_assigned_members"); + mAllowedActionsList = parent->getChild<LLScrollListCtrl>("role_allowed_actions"); + mActionDescription = parent->getChild<LLTextEditor>("role_action_description"); - mMemberVisibleCheck = parent->getChild<LLCheckBoxCtrl>("role_visible_in_list", recurse); + mRoleName = parent->getChild<LLLineEditor>("role_name"); + mRoleTitle = parent->getChild<LLLineEditor>("role_title"); + mRoleDescription = parent->getChild<LLTextEditor>("role_description"); - if (!mRolesList || !mAssignedMembersList || !mAllowedActionsList || !mActionDescription - || !mRoleName || !mRoleTitle || !mRoleDescription || !mMemberVisibleCheck) - { - LL_WARNS() << "ARG! element not found." << LL_ENDL; - return false; - } + mMemberVisibleCheck = parent->getChild<LLCheckBoxCtrl>("role_visible_in_list"); mRemoveEveryoneTxt = getString("cant_delete_role"); - mCreateRoleButton = - parent->getChild<LLButton>("role_create", recurse); - if ( mCreateRoleButton ) - { - mCreateRoleButton->setClickedCallback(onCreateRole, this); - mCreateRoleButton->setEnabled(false); - } + mCreateRoleButton = parent->getChild<LLButton>("role_create"); + mCreateRoleButton->setClickedCallback(onCreateRole, this); + mCreateRoleButton->setEnabled(false); - mCopyRoleButton = - parent->getChild<LLButton>("role_copy", recurse); - if ( mCopyRoleButton ) - { - mCopyRoleButton->setClickedCallback(onCopyRole, this); - mCopyRoleButton->setEnabled(false); - } + mCopyRoleButton = parent->getChild<LLButton>("role_copy"); + mCopyRoleButton->setClickedCallback(onCopyRole, this); + mCopyRoleButton->setEnabled(false); - mDeleteRoleButton = - parent->getChild<LLButton>("role_delete", recurse); - if ( mDeleteRoleButton ) - { - mDeleteRoleButton->setClickedCallback(onDeleteRole, this); - mDeleteRoleButton->setEnabled(false); - } + mDeleteRoleButton = parent->getChild<LLButton>("role_delete"); + mDeleteRoleButton->setClickedCallback(onDeleteRole, this); + mDeleteRoleButton->setEnabled(false); mRolesList->setCommitOnSelectionChange(true); mRolesList->setCommitCallback(onRoleSelect, this); @@ -2949,26 +2906,19 @@ void LLPanelGroupActionsSubTab::handleActionSelect() mActionMembers->deleteAllItems(); mActionRoles->deleteAllItems(); - U64 power_mask = GP_NO_POWERS; - std::vector<LLScrollListItem*> selection = - mActionList->getAllSelected(); - if (selection.empty()) return; - - LLRoleAction* rap; + std::vector<LLScrollListItem*> selection = mActionList->getAllSelected(); + if (selection.empty()) + return; - std::vector<LLScrollListItem*>::iterator itor; - for (itor = selection.begin() ; - itor != selection.end(); ++itor) + U64 power_mask = GP_NO_POWERS; + for (const LLScrollListItem* item : selection) { - rap = (LLRoleAction*)( (*itor)->getUserdata() ); - power_mask |= rap->mPowerBit; + power_mask |= ((LLRoleAction*)item->getUserdata())->mPowerBit; } if (selection.size() == 1) { - LLScrollListItem* item = selection[0]; - rap = (LLRoleAction*)(item->getUserdata()); - + LLRoleAction* rap = (LLRoleAction*)selection.front()->getUserdata(); if (rap->mLongDescription.empty()) { mActionDescription->setText(rap->mDescription); @@ -2985,21 +2935,19 @@ void LLPanelGroupActionsSubTab::handleActionSelect() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); - if (!gdatap) return; + if (!gdatap) + return; if (gdatap->isMemberDataComplete()) { - LLGroupMgrGroupData::member_list_t::iterator it = gdatap->mMembers.begin(); - LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end(); - LLGroupMemberData* gmd; - - for ( ; it != end; ++it) + for (const auto& it : gdatap->mMembers) { - gmd = (*it).second; - if (!gmd) continue; - if ((gmd->getAgentPowers() & power_mask) == power_mask) + if (LLGroupMemberData* gmd = it.second) { - mActionMembers->addNameItem(gmd->getID()); + if ((gmd->getAgentPowers() & power_mask) == power_mask) + { + mActionMembers->addNameItem(gmd->getID()); + } } } } diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index 3e22374294..07f4a710db 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -58,14 +58,26 @@ public: bool LLPanelLandInfo::postBuild() { - childSetAction("button buy land",boost::bind(onClickClaim)); - childSetAction("button abandon land", boost::bind(onClickRelease)); - childSetAction("button subdivide land", boost::bind(onClickDivide)); - childSetAction("button join land", boost::bind(onClickJoin)); - childSetAction("button about land", boost::bind(onClickAbout)); + mButtonBuyLand = getChild<LLButton>("button buy land"); + mButtonBuyLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickClaim, this)); + + mButtonAbandonLand = getChild<LLButton>("button abandon land"); + mButtonAbandonLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickRelease, this)); + + mButtonSubdivLand = getChild<LLButton>("button subdivide land"); + mButtonSubdivLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickDivide, this)); + + mButtonJoinLand = getChild<LLButton>("button join land"); + mButtonJoinLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickJoin, this)); + + mButtonAboutLand = getChild<LLButton>("button about land"); + mButtonAboutLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickAbout, this)); mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners"); - getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + mCheckShowOwners->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + + mTextArea = getChild<LLTextBox>("label_area"); + mTextAreaPrice = getChild<LLTextBox>("label_area_price"); return true; } @@ -119,17 +131,14 @@ void LLPanelLandInfo::refresh() if (!parcel || !regionp) { // nothing selected, disable panel - getChildView("label_area_price")->setVisible(false); - getChildView("label_area")->setVisible(false); - - //mTextPrice->setText(LLStringUtil::null); - getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null); - - getChildView("button buy land")->setEnabled(false); - getChildView("button abandon land")->setEnabled(false); - getChildView("button subdivide land")->setEnabled(false); - getChildView("button join land")->setEnabled(false); - getChildView("button about land")->setEnabled(false); + mTextAreaPrice->setVisible(false); + mTextArea->setVisible(false); + + mButtonBuyLand->setEnabled(false); + mButtonAbandonLand->setEnabled(false); + mButtonSubdivLand->setEnabled(false); + mButtonJoinLand->setEnabled(false); + mButtonAboutLand->setEnabled(false); } else { @@ -147,11 +156,11 @@ void LLPanelLandInfo::refresh() if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners()) { - getChildView("button buy land")->setEnabled(true); + mButtonBuyLand->setEnabled(true); } else { - getChildView("button buy land")->setEnabled(can_buy); + mButtonBuyLand->setEnabled(can_buy); } bool owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); @@ -163,16 +172,16 @@ void LLPanelLandInfo::refresh() bool manager_divideable = ( gAgent.canManageEstate() && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) ); - getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); + mButtonAbandonLand->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); // only mainland sims are subdividable by owner if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { - getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); + mButtonSubdivLand->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); } else { - getChildView("button subdivide land")->setEnabled(manager_divideable || gAgent.isGodlike()); + mButtonSubdivLand->setEnabled(manager_divideable || gAgent.isGodlike()); } // To join land, must have something selected, @@ -183,15 +192,15 @@ void LLPanelLandInfo::refresh() //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1 && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) { - getChildView("button join land")->setEnabled(true); + mButtonJoinLand->setEnabled(true); } else { LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL; - getChildView("button join land")->setEnabled(false); + mButtonJoinLand->setEnabled(false); } - getChildView("button about land")->setEnabled(true); + mButtonAboutLand->setEnabled(true); // show pricing information S32 area; @@ -206,47 +215,42 @@ void LLPanelLandInfo::refresh() &dwell); if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())) { - getChild<LLUICtrl>("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price)); - getChild<LLUICtrl>("label_area_price")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area_price")->setVisible(true); - getChildView("label_area")->setVisible(false); + mTextAreaPrice->setTextArg("[PRICE]", llformat("%d",claim_price)); + mTextAreaPrice->setTextArg("[AREA]", llformat("%d",area)); + mTextAreaPrice->setVisible(true); + mTextArea->setVisible(false); } else { - getChildView("label_area_price")->setVisible(false); - getChild<LLUICtrl>("label_area")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area")->setVisible(true); + mTextAreaPrice->setVisible(false); + mTextArea->setTextArg("[AREA]", llformat("%d",area)); + mTextArea->setVisible(true); } } } -//static void LLPanelLandInfo::onClickClaim() { LLViewerParcelMgr::getInstance()->startBuyLand(); } -//static void LLPanelLandInfo::onClickRelease() { LLViewerParcelMgr::getInstance()->startReleaseLand(); } -// static void LLPanelLandInfo::onClickDivide() { LLViewerParcelMgr::getInstance()->startDivideLand(); } -// static void LLPanelLandInfo::onClickJoin() { LLViewerParcelMgr::getInstance()->startJoinLand(); } -//static void LLPanelLandInfo::onClickAbout() { // Promote the rectangle selection to a parcel selection diff --git a/indra/newview/llpanelland.h b/indra/newview/llpanelland.h index 7d0c6936bd..aeadee4085 100644 --- a/indra/newview/llpanelland.h +++ b/indra/newview/llpanelland.h @@ -46,20 +46,27 @@ public: void refresh() override; static void refreshAll(); - LLCheckBoxCtrl *mCheckShowOwners; - protected: - static void onClickClaim(); - static void onClickRelease(); - static void onClickDivide(); - static void onClickJoin(); - static void onClickAbout(); + void onClickClaim(); + void onClickRelease(); + void onClickDivide(); + void onClickJoin(); + void onClickAbout(); protected: bool postBuild() override; static LLPanelLandSelectObserver* sObserver; static LLPanelLandInfo* sInstance; +private: + LLCheckBoxCtrl *mCheckShowOwners = nullptr; + LLButton* mButtonBuyLand = nullptr; + LLButton* mButtonAbandonLand = nullptr; + LLButton* mButtonSubdivLand = nullptr; + LLButton* mButtonJoinLand = nullptr; + LLButton* mButtonAboutLand = nullptr; + LLTextBox* mTextArea = nullptr; + LLTextBox* mTextAreaPrice = nullptr; }; #endif diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index bbf533b694..fd7085c452 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -154,28 +154,30 @@ bool LLPanelMainInventory::postBuild() //panel->getFilter().markDefault(); // Set up the default inv. panel/filter settings. - mActivePanel = getChild<LLInventoryPanel>(ALL_ITEMS); - if (mActivePanel) + mAllItemsPanel = getChild<LLInventoryPanel>(ALL_ITEMS); + if (mAllItemsPanel) { // "All Items" is the previous only view, so it gets the InventorySortOrder - mActivePanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER)); - mActivePanel->getFilter().markDefault(); - mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); - mActivePanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mActivePanel, _1, _2)); + mAllItemsPanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER)); + mAllItemsPanel->getFilter().markDefault(); + mAllItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + mAllItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mAllItemsPanel, _1, _2)); mResortActivePanel = true; } - LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>(RECENT_ITEMS); - if (recent_items_panel) + mActivePanel = mAllItemsPanel; + + mRecentPanel = getChild<LLInventoryPanel>(RECENT_ITEMS); + if (mRecentPanel) { // assign default values until we will be sure that we have setting to restore - recent_items_panel->setSinceLogoff(true); - recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE); - recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - LLInventoryFilter& recent_filter = recent_items_panel->getFilter(); + mRecentPanel->setSinceLogoff(true); + mRecentPanel->setSortOrder(LLInventoryFilter::SO_DATE); + mRecentPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + LLInventoryFilter& recent_filter = mRecentPanel->getFilter(); recent_filter.setFilterObjectTypes(recent_filter.getFilterObjectTypes() & ~(0x1 << LLInventoryType::IT_CATEGORY)); recent_filter.setEmptyLookupMessage("InventoryNoMatchingRecentItems"); recent_filter.markDefault(); - recent_items_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, recent_items_panel, _1, _2)); + mRecentPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mRecentPanel, _1, _2)); } mWornItemsPanel = getChild<LLInventoryPanel>(WORN_ITEMS); @@ -211,17 +213,17 @@ bool LLPanelMainInventory::postBuild() // Load the persistent "Recent Items" settings. // Note that the "All Items" settings do not persist. - if(recent_items_panel) + if(mRecentPanel) { - if(savedFilterState.has(recent_items_panel->getFilter().getName())) + if(savedFilterState.has(mRecentPanel->getFilter().getName())) { LLSD recent_items = savedFilterState.get( - recent_items_panel->getFilter().getName()); + mRecentPanel->getFilter().getName()); LLInventoryFilter::Params p; LLParamSDParser parser; parser.readSD(recent_items, p); - recent_items_panel->getFilter().fromParams(p); - recent_items_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER)); + mRecentPanel->getFilter().fromParams(p); + mRecentPanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER)); } } if(mActivePanel) @@ -362,7 +364,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel() { - return getChild<LLInventoryPanel>(ALL_ITEMS); + return mAllItemsPanel; } void LLPanelMainInventory::selectAllItemsPanel() @@ -372,7 +374,7 @@ void LLPanelMainInventory::selectAllItemsPanel() bool LLPanelMainInventory::isRecentItemsPanelSelected() { - return (RECENT_ITEMS == getActivePanel()->getName()); + return (mRecentPanel == getActivePanel()); } void LLPanelMainInventory::startSearch() @@ -1077,8 +1079,8 @@ void LLPanelMainInventory::toggleFindOptions() void LLPanelMainInventory::setSelectCallback(const LLFolderView::signal_t::slot_type& cb) { - getChild<LLInventoryPanel>(ALL_ITEMS)->setSelectCallback(cb); - getChild<LLInventoryPanel>(RECENT_ITEMS)->setSelectCallback(cb); + mAllItemsPanel->setSelectCallback(cb); + mRecentPanel->setSelectCallback(cb); } void LLPanelMainInventory::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, bool user_action) @@ -1482,10 +1484,10 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data) void LLPanelMainInventory::initListCommandsHandlers() { childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this)); - childSetAction("view_mode_btn", boost::bind(&LLPanelMainInventory::onViewModeClick, this)); - childSetAction("up_btn", boost::bind(&LLPanelMainInventory::onUpFolderClicked, this)); - childSetAction("back_btn", boost::bind(&LLPanelMainInventory::onBackFolderClicked, this)); - childSetAction("forward_btn", boost::bind(&LLPanelMainInventory::onForwardFolderClicked, this)); + mViewModeBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onViewModeClick, this)); + mUpBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onUpFolderClicked, this)); + mBackBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onBackFolderClicked, this)); + mForwardBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onForwardFolderClicked, this)); mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2)); mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2)); @@ -1550,12 +1552,9 @@ void LLPanelMainInventory::initSingleFolderRoot(const LLUUID& start_folder_id) void LLPanelMainInventory::initInventoryViews() { - LLInventoryPanel* all_item = getChild<LLInventoryPanel>(ALL_ITEMS); - all_item->initializeViewBuilding(); - LLInventoryPanel* recent_item = getChild<LLInventoryPanel>(RECENT_ITEMS); - recent_item->initializeViewBuilding(); - LLInventoryPanel* worn_item = getChild<LLInventoryPanel>(WORN_ITEMS); - worn_item->initializeViewBuilding(); + mAllItemsPanel->initializeViewBuilding(); + mRecentPanel->initializeViewBuilding(); + mWornItemsPanel->initializeViewBuilding(); } void LLPanelMainInventory::toggleViewMode() diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index cad2501645..68ac3410d8 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -184,7 +184,9 @@ private: LLUICtrl* mCounterCtrl; LLHandle<LLFloater> mFinderHandle; LLInventoryPanel* mActivePanel; - LLInventoryPanel* mWornItemsPanel; + LLInventoryPanel* mAllItemsPanel = nullptr; + LLInventoryPanel* mRecentPanel = nullptr; + LLInventoryPanel* mWornItemsPanel = nullptr; bool mResortActivePanel; LLSaveFolderState* mSavedFolderState; std::string mFilterText; diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ce545ae21d..4cd4afaa5a 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -434,6 +434,8 @@ LLPanelOutfitEdit::~LLPanelOutfitEdit() delete mCOFDragAndDropObserver; + delete mWearableListViewItemsComparator; + while (!mListViewItemTypes.empty()) { delete mListViewItemTypes.back(); mListViewItemTypes.pop_back(); @@ -476,8 +478,10 @@ bool LLPanelOutfitEdit::postBuild() mFolderViewBtn = getChild<LLButton>("folder_view_btn"); mListViewBtn = getChild<LLButton>("list_view_btn"); + mFilterPanel = getChild<LLView>("filter_panel"); + mFilterBtn = getChild<LLButton>("filter_button"); + mFilterBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this)); - childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL); childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesFolderView, this), NULL); childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL); childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL); @@ -530,13 +534,17 @@ bool LLPanelOutfitEdit::postBuild() mSearchFilter = getChild<LLFilterEditor>("look_item_filter"); mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2)); - childSetAction("show_add_wearables_btn", boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this)); + mShowAddWearablesBtn = getChild<LLButton>("show_add_wearables_btn"); + mShowAddWearablesBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this)); mPlusBtn = getChild<LLButton>("plus_btn"); mPlusBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this)); childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance())); + mNoAddWearablesButtonBar = getChild<LLUICtrl>("no_add_wearables_button_bar"); + mAddWearablesButtonBar = getChild<LLUICtrl>("add_wearables_button_bar"); + /* * By default AT_CLOTHING are sorted by (in in MY OUTFITS): * - by type (types order determined in LLWearableType::EType) @@ -567,7 +575,11 @@ bool LLPanelOutfitEdit::postBuild() getChild<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); + mLoadingIndicator = getChild<LLLoadingIndicator>("edit_outfit_loading_indicator"); + mOutfitNameStatusPanel = getChild<LLPanel>("outfit_name_and_status"); + onOutfitChanging(gAgentWearables.isCOFChangeInProgress()); + return true; } @@ -603,15 +615,15 @@ void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables) { mAddWearablesPanel->setVisible(show_add_wearables); - getChild<LLUICtrl>("show_add_wearables_btn")->setValue(show_add_wearables); + mShowAddWearablesBtn->setValue(show_add_wearables); updateFiltersVisibility(); - getChildView("filter_button")->setVisible( show_add_wearables); + mFilterBtn->setVisible( show_add_wearables); //search filter should be disabled if (!show_add_wearables) { - getChild<LLUICtrl>("filter_button")->setValue(false); + mFilterBtn->setValue(false); mFolderViewFilterCmbBox->setVisible(false); mListViewFilterCmbBox->setVisible(false); @@ -638,15 +650,15 @@ void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables) } //switching button bars - getChildView("no_add_wearables_button_bar")->setVisible( !show_add_wearables); - getChildView("add_wearables_button_bar")->setVisible( show_add_wearables); + mNoAddWearablesButtonBar->setVisible( !show_add_wearables); + mAddWearablesButtonBar->setVisible( show_add_wearables); } void LLPanelOutfitEdit::showWearablesFilter() { - bool filter_visible = getChild<LLUICtrl>("filter_button")->getValue(); + bool filter_visible = mFilterBtn->getValue(); - getChildView("filter_panel")->setVisible( filter_visible); + mFilterPanel->setVisible(filter_visible); if(!filter_visible) { @@ -1309,19 +1321,17 @@ static void update_status_widget_rect(LLView * widget, S32 right_border) void LLPanelOutfitEdit::onOutfitChanging(bool started) { - static LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("edit_outfit_loading_indicator"); - static LLView* status_panel = getChild<LLView>("outfit_name_and_status"); - static S32 indicator_delta = status_panel->getRect().getWidth() - indicator->getRect().mLeft; + S32 indicator_delta = mOutfitNameStatusPanel->getRect().getWidth() - mLoadingIndicator->getRect().mLeft; S32 delta = started ? indicator_delta : 0; - S32 right_border = status_panel->getRect().getWidth() - delta; + S32 right_border = mOutfitNameStatusPanel->getRect().getWidth() - delta; if (mCurrentOutfitName) update_status_widget_rect(mCurrentOutfitName, right_border); if (mStatus) update_status_widget_rect(mStatus, right_border); - indicator->setVisible(started); + mLoadingIndicator->setVisible(started); } void LLPanelOutfitEdit::getCurrentItemUUID(LLUUID& selected_id) diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 384b7faee4..a989d93d9e 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -59,6 +59,7 @@ class LLMenuGL; class LLFindNonLinksByMask; class LLFindWearablesOfType; class LLWearableItemTypeNameComparator; +class LLLoadingIndicator; class LLPanelOutfitEdit : public LLPanel { @@ -218,7 +219,14 @@ private: LLButton* mFolderViewBtn; LLButton* mListViewBtn; LLButton* mPlusBtn; + LLButton* mShowAddWearablesBtn = nullptr; + LLButton* mFilterBtn = nullptr; LLPanel* mAddWearablesPanel; + LLPanel* mOutfitNameStatusPanel = nullptr; + LLLoadingIndicator* mLoadingIndicator = nullptr; + LLView* mFilterPanel = nullptr; + LLUICtrl* mNoAddWearablesButtonBar = nullptr; + LLUICtrl* mAddWearablesButtonBar = nullptr; LLComboBox* mFolderViewFilterCmbBox; LLComboBox* mListViewFilterCmbBox; diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 5b595a48b7..47c02793a3 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -252,7 +252,8 @@ void LLPanelOutfitsInventory::openApearanceTab(const std::string& tab_name) void LLPanelOutfitsInventory::initListCommandsHandlers() { mListCommands = getChild<LLPanel>("bottom_panel"); - mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this)); + mWearBtn = mListCommands->getChild<LLButton>("wear_btn"); + mWearBtn->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this)); mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this)); mOutfitGalleryPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this)); } @@ -263,14 +264,12 @@ void LLPanelOutfitsInventory::updateListCommands() bool wear_enabled = isActionEnabled("wear"); bool wear_visible = !isCOFPanelActive(); bool make_outfit_enabled = isActionEnabled("save_outfit"); - - LLButton* wear_btn = mListCommands->getChild<LLButton>("wear_btn"); mMyOutfitsPanel->childSetEnabled("trash_btn", trash_enabled); mOutfitGalleryPanel->childSetEnabled("trash_btn", trash_enabled); - wear_btn->setEnabled(wear_enabled); - wear_btn->setVisible(wear_visible); + mWearBtn->setEnabled(wear_enabled); + mWearBtn->setVisible(wear_visible); getChild<LLButton>(SAVE_BTN)->setEnabled(make_outfit_enabled); - wear_btn->setToolTip(getString((!isOutfitsGalleryPanelActive() && mMyOutfitsPanel->hasItemSelected()) ? "wear_items_tooltip" : "wear_outfit_tooltip")); + mWearBtn->setToolTip(getString((!isOutfitsGalleryPanelActive() && mMyOutfitsPanel->hasItemSelected()) ? "wear_items_tooltip" : "wear_outfit_tooltip")); } void LLPanelOutfitsInventory::onTrashButtonClick() diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index 0c501d5c71..e046681e95 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -101,6 +101,7 @@ protected: private: LLPanel* mListCommands; LLMenuGL* mMenuAdd; + LLButton* mWearBtn = nullptr; // List Commands // ////////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 7f64cfca08..2f0a8f7656 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -153,8 +153,6 @@ public: id_it = uuids.begin(), id_end = uuids.end(); - LLAvatarItemDistanceComparator::id_to_pos_map_t pos_map; - mAvatarsPositions.clear(); for (;pos_it != pos_end && id_it != id_end; ++pos_it, ++id_it ) @@ -618,15 +616,13 @@ bool LLPanelPeople::postBuild() { S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); - mNearbyFilterCommitConnection = getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - mFriedsFilterCommitConnection = getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - mGroupsFilterCommitConnection = getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - mRecentFilterCommitConnection = getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - + LLPanel* group_tab = getChild<LLPanel>(GROUP_TAB_NAME); + mGroupDelBtn = group_tab->getChild<LLButton>("minus_btn"); + mGroupCountText = group_tab->getChild<LLTextBox>("groupcount"); if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium) { - getChild<LLTextBox>("groupcount")->setText(getString("GroupCountWithInfo")); - getChild<LLTextBox>("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); + mGroupCountText->setText(getString("GroupCountWithInfo")); + mGroupCountText->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); } mTabContainer = getChild<LLTabContainer>("tabs"); @@ -639,40 +635,56 @@ bool LLPanelPeople::postBuild() friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2)); friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this)); + mFriendsGearBtn = friends_tab->getChild<LLButton>("gear_btn"); + mFriendsDelFriendBtn = friends_tab->getChild<LLUICtrl>("friends_del_btn"); + mOnlineFriendList = friends_tab->getChild<LLAvatarList>("avatars_online"); mAllFriendList = friends_tab->getChild<LLAvatarList>("avatars_all"); mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online")); mOnlineFriendList->setShowIcons("FriendsListShowIcons"); - mOnlineFriendList->showPermissions("FriendsListShowPermissions"); + mOnlineFriendList->showPermissions(gSavedSettings.getBOOL("FriendsListShowPermissions")); mOnlineFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames")); mAllFriendList->setNoItemsCommentText(getString("no_friends")); mAllFriendList->setShowIcons("FriendsListShowIcons"); - mAllFriendList->showPermissions("FriendsListShowPermissions"); + mAllFriendList->showPermissions(gSavedSettings.getBOOL("FriendsListShowPermissions")); mAllFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames")); LLPanel* nearby_tab = getChild<LLPanel>(NEARBY_TAB_NAME); nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2)); + mNearbyList = nearby_tab->getChild<LLAvatarList>("avatar_list"); mNearbyList->setNoItemsCommentText(getString("no_one_near")); mNearbyList->setNoItemsMsg(getString("no_one_near")); mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near")); mNearbyList->setShowIcons("NearbyListShowIcons"); mNearbyList->setShowCompleteName(!gSavedSettings.getBOOL("NearbyListHideUsernames")); - mMiniMap = (LLNetMap*)getChildView("Net Map",true); + mMiniMap = nearby_tab->getChild<LLNetMap>("Net Map", true); mMiniMap->setToolTipMsg(gSavedSettings.getBOOL("DoubleClickTeleport") ? getString("AltMiniMapToolTipMsg") : getString("MiniMapToolTipMsg")); - mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list"); + mNearbyGearBtn = nearby_tab->getChild<LLButton>("gear_btn"); + mNearbyAddFriendBtn = nearby_tab->getChild<LLButton>("add_friend_btn"); + + LLPanel* recent_tab = getChild<LLPanel>(RECENT_TAB_NAME); + mRecentList = recent_tab->getChild<LLAvatarList>("avatar_list"); mRecentList->setNoItemsCommentText(getString("no_recent_people")); mRecentList->setNoItemsMsg(getString("no_recent_people")); mRecentList->setNoFilteredItemsMsg(getString("no_filtered_recent_people")); mRecentList->setShowIcons("RecentListShowIcons"); - mGroupList = getChild<LLGroupList>("group_list"); + mRecentGearBtn = recent_tab->getChild<LLButton>("gear_btn"); + mRecentAddFriendBtn = recent_tab->getChild<LLButton>("add_friend_btn"); + + mGroupList = group_tab->getChild<LLGroupList>("group_list"); mGroupList->setNoItemsCommentText(getString("no_groups_msg")); mGroupList->setNoItemsMsg(getString("no_groups_msg")); mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg")); + mNearbyFilterCommitConnection = nearby_tab->getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mFriedsFilterCommitConnection = friends_tab->getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mRecentFilterCommitConnection = recent_tab->getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mGroupsFilterCommitConnection = group_tab->getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mNearbyList->setContextMenu(&LLPanelPeopleMenus::gNearbyPeopleContextMenu); mRecentList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); @@ -850,10 +862,11 @@ void LLPanelPeople::updateRecentList() void LLPanelPeople::updateButtons() { - std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); + bool nearby_tab_active = (cur_tab == NEARBY_TAB_NAME); bool friends_tab_active = (cur_tab == FRIENDS_TAB_NAME); bool group_tab_active = (cur_tab == GROUP_TAB_NAME); - //bool recent_tab_active = (cur_tab == RECENT_TAB_NAME); + bool recent_tab_active = (cur_tab == RECENT_TAB_NAME); LLUUID selected_id; uuid_vec_t selected_uuids; @@ -868,14 +881,13 @@ void LLPanelPeople::updateButtons() selected_id = mGroupList->getSelectedUUID(); } - LLPanel* groups_panel = mTabContainer->getCurrentPanel(); - groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected + mGroupDelBtn->setEnabled(item_selected && selected_id.notNull()); // a real group selected U32 groups_count = static_cast<U32>(gAgent.mGroups.size()); U32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; - groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); - groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); + mGroupCountText->setTextArg("[COUNT]", llformat("%d", groups_count)); + mGroupCountText->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); } else { @@ -889,33 +901,36 @@ void LLPanelPeople::updateButtons() is_self = gAgent.getID() == selected_id; } - LLPanel* cur_panel = mTabContainer->getCurrentPanel(); - if (cur_panel) { - if (cur_panel->hasChild("add_friend_btn", true)) - cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self); + if(nearby_tab_active) + { + mNearbyAddFriendBtn->setEnabled(item_selected && !is_friend && !is_self); + mNearbyGearBtn->setEnabled(multiple_selected); + } if (friends_tab_active) { - cur_panel->getChildView("friends_del_btn")->setEnabled(multiple_selected); + mFriendsDelFriendBtn->setEnabled(multiple_selected); + mFriendsGearBtn->setEnabled(multiple_selected); } - if (!group_tab_active) + if (recent_tab_active) { - cur_panel->getChildView("gear_btn")->setEnabled(multiple_selected); + mRecentAddFriendBtn->setEnabled(item_selected && !is_friend && !is_self); + mRecentGearBtn->setEnabled(multiple_selected); } } } } -std::string LLPanelPeople::getActiveTabName() const +const std::string& LLPanelPeople::getActiveTabName() const { return mTabContainer->getCurrentPanel()->getName(); } LLUUID LLPanelPeople::getCurrentItemID() const { - std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); if (cur_tab == FRIENDS_TAB_NAME) // this tab has two lists { @@ -945,7 +960,7 @@ LLUUID LLPanelPeople::getCurrentItemID() const void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const { - std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); if (cur_tab == FRIENDS_TAB_NAME) { @@ -1033,7 +1048,7 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) saved_filter = search_upper; // Apply new filter to the current tab. - const std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); if (cur_tab == NEARBY_TAB_NAME) { mNearbyList->setNameFilter(filter); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 768ba1ef49..445bc4c081 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -84,7 +84,7 @@ private: bool isItemsFreeOfFriends(const uuid_vec_t& uuids); void updateButtons(); - std::string getActiveTabName() const; + const std::string& getActiveTabName() const; LLUUID getCurrentItemID() const; void getCurrentItemIDs(uuid_vec_t& selected_uuids) const; void setSortOrder(LLAvatarList* list, ESortOrder order, bool save = true); @@ -139,6 +139,17 @@ private: LLGroupList* mGroupList; LLNetMap* mMiniMap; + LLButton* mNearbyGearBtn = nullptr; + LLButton* mFriendsGearBtn = nullptr; + LLButton* mRecentGearBtn = nullptr; + LLButton* mGroupDelBtn = nullptr; + + LLButton* mNearbyAddFriendBtn = nullptr; + LLButton* mRecentAddFriendBtn = nullptr; + LLUICtrl* mFriendsDelFriendBtn = nullptr; + + LLTextBox* mGroupCountText = nullptr; + std::vector<std::string> mSavedOriginalFilters; std::vector<std::string> mSavedFilters; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index fcf0757073..8f44b28ebe 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1020,7 +1020,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) setDescriptionText(avatar_data->about_text); - mSecondLifePic->setValue(avatar_data->image_id); + mSecondLifePic->setValue(avatar_data->image_id); if (getSelfProfile()) { @@ -1168,10 +1168,10 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) } else { - std::string register_date = getString("age_format"); - LLSD args_age; + std::string register_date = getString("age_format"); + LLSD args_age; args_age["[AGE]"] = LLDateUtil::ageFromDate(avatar_data->born_on, LLDate::now()); - LLStringUtil::format(register_date, args_age); + LLStringUtil::format(register_date, args_age); userAgeCtrl->setValue(register_date); } @@ -1614,12 +1614,12 @@ void LLPanelProfileSecondLife::onShowInSearchCallback() if (value == mAllowPublish) return; - mAllowPublish = value; + mAllowPublish = value; saveAgentUserInfoCoro("allow_publish", value); - } +} void LLPanelProfileSecondLife::onHideAgeCallback() - { +{ bool value = mHideAgeCombo->getValue().asInteger(); if (value == mHideAge) return; @@ -1768,35 +1768,35 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id) if (mSecondLifePic->getImageAssetId() == id) return; - std::function<void(bool)> callback = [id](bool result) + std::function<void(bool)> callback = [id](bool result) + { + if (result) { - if (result) - { - LLAvatarIconIDCache::getInstance()->add(gAgentID, id); + LLAvatarIconIDCache::getInstance()->add(gAgentID, id); // Should trigger callbacks in icon controls (or request Legacy) - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); - } - }; + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID); + } + }; if (!saveAgentUserInfoCoro("sl_image_id", id, callback)) return; mSecondLifePic->setValue(id); - LLFloater *floater = mFloaterProfileTextureHandle.get(); - if (floater) - { - LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); + LLFloater *floater = mFloaterProfileTextureHandle.get(); + if (floater) + { + LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater); if (id == LLUUID::null) - { - texture_view->resetAsset(); - } - else - { + { + texture_view->resetAsset(); + } + else + { texture_view->loadAsset(id); - } } } +} ////////////////////////////////////////////////////////////////////////// // LLPanelProfileWeb diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index 6782aa2123..86291708b0 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -454,25 +454,26 @@ F32 LLPhysicsMotion::calculateAcceleration_local(const F32 velocity_local, const bool LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - // Skip if disabled globally. - if (!gSavedSettings.getBOOL("AvatarPhysics")) - { - return true; - } + // Skip if disabled globally. + static LLCachedControl<bool> av_physics(gSavedSettings, "AvatarPhysics"); + if (!av_physics) + { + return true; + } - bool update_visuals = false; - for (motion_vec_t::iterator iter = mMotions.begin(); - iter != mMotions.end(); - ++iter) - { - LLPhysicsMotion *motion = (*iter); - update_visuals |= motion->onUpdate(time); - } + bool update_visuals = false; + for (motion_vec_t::iterator iter = mMotions.begin(); + iter != mMotions.end(); + ++iter) + { + LLPhysicsMotion *motion = (*iter); + update_visuals |= motion->onUpdate(time); + } - if (update_visuals) - mCharacter->updateVisualParams(); + if (update_visuals) + mCharacter->updateVisualParams(); - return true; + return true; } // Return true if character has to update visual params. diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 7bef0339c5..80e403dfde 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -81,6 +81,11 @@ bool LLProgressView::postBuild() { mProgressBar = getChild<LLProgressBar>("login_progress_bar"); + mLogosLabel = getChild<LLTextBox>("logos_lbl"); + + mProgressText = getChild<LLTextBox>("progress_text"); + mMessageText = getChild<LLTextBox>("message_text"); + // media control that is used to play intro video mMediaCtrl = getChild<LLMediaCtrl>("login_media_panel"); mMediaCtrl->setVisible( false ); // hidden initially @@ -238,9 +243,8 @@ void LLProgressView::drawLogos(F32 alpha) // logos are tied to label, // due to potential resizes we have to figure offsets out on draw or resize - LLTextBox *logos_label = getChild<LLTextBox>("logos_lbl"); S32 offset_x, offset_y; - logos_label->localPointToScreen(0, 0, &offset_x, &offset_y); + mLogosLabel->localPointToScreen(0, 0, &offset_x, &offset_y); std::vector<TextureData>::const_iterator iter = mLogosList.begin(); std::vector<TextureData>::const_iterator end = mLogosList.end(); for (; iter != end; iter++) @@ -325,7 +329,7 @@ void LLProgressView::draw() void LLProgressView::setText(const std::string& text) { - getChild<LLUICtrl>("progress_text")->setValue(text); + mProgressText->setValue(text); } void LLProgressView::setPercent(const F32 percent) @@ -336,7 +340,7 @@ void LLProgressView::setPercent(const F32 percent) void LLProgressView::setMessage(const std::string& msg) { mMessage = msg; - getChild<LLUICtrl>("message_text")->setValue(mMessage); + mMessageText->setValue(mMessage); } void LLProgressView::loadLogo(const std::string &path, @@ -387,8 +391,7 @@ void LLProgressView::initLogos() S32 icon_width, icon_height; // We don't know final screen rect yet, so we can't precalculate position fully - LLTextBox *logos_label = getChild<LLTextBox>("logos_lbl"); - S32 texture_start_x = (S32)logos_label->getFont()->getWidthF32(logos_label->getText()) + default_pad; + S32 texture_start_x = (S32)mLogosLabel->getFont()->getWidthF32(mLogosLabel->getWText().c_str()) + default_pad; S32 texture_start_y = -7; // Normally we would just preload these textures from textures.xml, diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index db3f4a2e32..15b04a8eb9 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -36,6 +36,7 @@ class LLImageRaw; class LLButton; class LLProgressBar; class LLViewerTexture; +class LLTextBox; class LLProgressView : public LLPanel, @@ -85,6 +86,9 @@ public: protected: LLProgressBar* mProgressBar; LLMediaCtrl* mMediaCtrl; + LLTextBox* mLogosLabel = nullptr; + LLTextBox* mProgressText = nullptr; + LLTextBox* mMessageText = nullptr; F32 mPercentDone; std::string mMessage; LLButton* mCancelBtn; diff --git a/indra/newview/llscrollingpanelparambase.cpp b/indra/newview/llscrollingpanelparambase.cpp index 247639aa48..d6b5434fa4 100644 --- a/indra/newview/llscrollingpanelparambase.cpp +++ b/indra/newview/llscrollingpanelparambase.cpp @@ -51,12 +51,13 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan else buildFromFile( "panel_scrolling_param_base.xml"); - getChild<LLUICtrl>("param slider")->setValue(weightToPercent(param->getWeight())); + mParamSlider = getChild<LLUICtrl>("param slider"); + mParamSlider->setValue(weightToPercent(param->getWeight())); std::string display_name = LLTrans::getString(param->getDisplayName()); - getChild<LLUICtrl>("param slider")->setLabelArg("[DESC]", display_name); - getChildView("param slider")->setEnabled(mAllowModify); - childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this); + mParamSlider->setLabelArg("[DESC]", display_name); + mParamSlider->setEnabled(mAllowModify); + mParamSlider->setCommitCallback(LLScrollingPanelParamBase::onSliderMoved, this); setVisible(false); setBorderVisible( false ); @@ -77,9 +78,9 @@ void LLScrollingPanelParamBase::updatePanel(bool allow_modify) } F32 current_weight = mWearable->getVisualParamWeight( param->getID() ); - getChild<LLUICtrl>("param slider")->setValue(weightToPercent( current_weight ) ); + mParamSlider->setValue(weightToPercent( current_weight ) ); mAllowModify = allow_modify; - getChildView("param slider")->setEnabled(mAllowModify); + mParamSlider->setEnabled(mAllowModify); } // static diff --git a/indra/newview/llscrollingpanelparambase.h b/indra/newview/llscrollingpanelparambase.h index 9deafcc81a..d5477a8397 100644 --- a/indra/newview/llscrollingpanelparambase.h +++ b/indra/newview/llscrollingpanelparambase.h @@ -55,6 +55,7 @@ public: public: LLViewerVisualParam* mParam; protected: + LLUICtrl* mParamSlider = nullptr; bool mAllowModify; LLWearable *mWearable; }; diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 35d07d1ac8..c618483fc4 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -39,6 +39,7 @@ #include "llfloaterreg.h" #include "llfloaterworldmap.h" #include "llfolderviewmodel.h" +#include "llloadingindicator.h" #include "lloutfitobserver.h" #include "llpaneleditwearable.h" #include "llpaneloutfitsinventory.h" @@ -137,6 +138,8 @@ bool LLSidepanelAppearance::postBuild() mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook"); + mWearableLoadingIndicator = getChild<LLLoadingIndicator>("wearables_loading_indicator"); + mEditOutfitBtn = getChild<LLButton>("edit_outfit_btn"); setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChanged,this,_2)); @@ -541,8 +544,8 @@ void LLSidepanelAppearance::inventoryFetched() void LLSidepanelAppearance::setWearablesLoading(bool val) { - getChildView("wearables_loading_indicator")->setVisible( val); - getChildView("edit_outfit_btn")->setVisible( !val); + mWearableLoadingIndicator->setVisible(val); + mEditOutfitBtn->setVisible(!val); if (!val) { diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index f3d34a857c..1c1de99795 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -38,6 +38,7 @@ class LLCurrentlyWornFetchObserver; class LLPanelEditWearable; class LLViewerWearable; class LLPanelOutfitsInventory; +class LLLoadingIndicator; class LLSidepanelAppearance : public LLPanel { @@ -86,8 +87,11 @@ private: LLButton* mOpenOutfitBtn; LLButton* mEditAppearanceBtn; + LLButton* mEditOutfitBtn = nullptr; LLPanel* mCurrOutfitPanel; + LLLoadingIndicator* mWearableLoadingIndicator = nullptr; + LLTextBox* mCurrentLookName; LLTextBox* mOutfitStatus; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index e154777aef..35057a910a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -558,6 +558,7 @@ bool LLFloaterTexturePicker::postBuild() mResolutionLabel = getChild<LLTextBox>("size_lbl"); mResolutionWarning = getChild<LLTextBox>("over_limit_lbl"); + mPreviewWidget = getChild<LLView>("preview_widget"); mDefaultBtn = getChild<LLButton>("Default"); mNoneBtn = getChild<LLButton>("None"); @@ -653,7 +654,6 @@ void LLFloaterTexturePicker::draw() bool valid_dims = updateImageStats(); // if we're inactive, gray out "apply immediate" checkbox - getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected); mSelectBtn->setEnabled(mActive && mCanApply && valid_dims); mPipetteBtn->setEnabled(mActive); mPipetteBtn->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); @@ -731,7 +731,7 @@ void LLFloaterTexturePicker::draw() } // Border - LLRect border = getChildView("preview_widget")->getRect(); + LLRect border = mPreviewWidget->getRect(); gl_rect_2d( border, LLColor4::black, false ); diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 3c6cff4eaa..df5e763139 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -437,6 +437,7 @@ protected: LLButton* mPipetteBtn; LLButton* mSelectBtn; LLButton* mCancelBtn; + LLView* mPreviewWidget = nullptr; private: bool mCanApply; diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 531e657a1e..8cdc2e94f4 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -1424,7 +1424,8 @@ void LLToolPie::handleDeselect() LLTool* LLToolPie::getOverrideTool(MASK mask) { - if (gSavedSettings.getBOOL("EnableGrab")) + static LLCachedControl<bool> enable_grab(gSavedSettings, "EnableGrab"); + if (enable_grab) { if (mask == DEFAULT_GRAB_MASK) { diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index b6fbcaa330..72e30bd765 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -398,7 +398,7 @@ bool LLGoogleTranslationHandler::parseResponse( { const std::string& text = !body.empty() ? body : http_response["error_body"].asStringRef(); - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value root = boost::json::parse(text, ec); if (ec.failed()) { @@ -431,7 +431,7 @@ void LLGoogleTranslationHandler::parseErrorResponse( int& status, std::string& err_msg) { - boost::json::error_code ec; + boost::system::error_code ec; auto message = root.find_pointer("/data/message", ec); auto code = root.find_pointer("/data/code", ec); if (!message || !code) @@ -456,7 +456,7 @@ bool LLGoogleTranslationHandler::parseTranslation( std::string& translation, std::string& detected_lang) { - boost::json::error_code ec; + boost::system::error_code ec; auto translated_text = root.find_pointer("/data/translations/0/translatedText", ec); if (!translated_text) return false; @@ -656,7 +656,7 @@ bool LLAzureTranslationHandler::checkVerificationResponse( // Expected: "{\"error\":{\"code\":400000,\"message\":\"One of the request inputs is not valid.\"}}" // But for now just verify response is a valid json - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value root = boost::json::parse(response["error_body"].asString(), ec); if (ec.failed()) { @@ -686,7 +686,7 @@ bool LLAzureTranslationHandler::parseResponse( //Example: // "[{\"detectedLanguage\":{\"language\":\"en\",\"score\":1.0},\"translations\":[{\"text\":\"Hello, what is your name?\",\"to\":\"en\"}]}]" - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value root = boost::json::parse(body, ec); if (ec.failed()) { @@ -726,7 +726,7 @@ std::string LLAzureTranslationHandler::parseErrorResponse( // Expected: "{\"error\":{\"code\":400000,\"message\":\"One of the request inputs is not valid.\"}}" // But for now just verify response is a valid json with an error - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value root = boost::json::parse(body, ec); if (ec.failed()) { @@ -956,7 +956,7 @@ bool LLDeepLTranslationHandler::parseResponse( //Example: // "{\"translations\":[{\"detected_source_language\":\"EN\",\"text\":\"test\"}]}" - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value root = boost::json::parse(body, ec); if (ec.failed()) { @@ -1004,7 +1004,7 @@ std::string LLDeepLTranslationHandler::parseErrorResponse( const std::string& body) { // Example: "{\"message\":\"One of the request inputs is not valid.\"}" - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value root = boost::json::parse(body, ec); if (ec.failed()) { diff --git a/indra/newview/llviewermedia_streamingaudio.cpp b/indra/newview/llviewermedia_streamingaudio.cpp index af3a21c183..b68ffbe1a2 100644 --- a/indra/newview/llviewermedia_streamingaudio.cpp +++ b/indra/newview/llviewermedia_streamingaudio.cpp @@ -70,6 +70,8 @@ void LLStreamingAudio_MediaPlugins::start(const std::string& url) LL_INFOS() << "setting stream to NULL"<< LL_ENDL; mURL.clear(); mMediaPlugin->stop(); + delete mMediaPlugin; + mMediaPlugin = nullptr; } } @@ -79,6 +81,8 @@ void LLStreamingAudio_MediaPlugins::stop() if(mMediaPlugin) { mMediaPlugin->stop(); + delete mMediaPlugin; + mMediaPlugin = nullptr; } mURL.clear(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2687938b35..cd0b3dbd0c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -350,7 +350,10 @@ class LLMenuParcelObserver : public LLParcelObserver public: LLMenuParcelObserver(); ~LLMenuParcelObserver(); - virtual void changed(); + void changed() override; +private: + LLHandle<LLUICtrl> mLandBuyHandle; + LLHandle<LLUICtrl> mLandBuyPassHandle; }; static LLMenuParcelObserver* gMenuParcelObserver = NULL; @@ -359,6 +362,8 @@ static LLUIListener sUIListener; LLMenuParcelObserver::LLMenuParcelObserver() { + mLandBuyHandle = gMenuLand->getChild<LLMenuItemCallGL>("Land Buy")->getHandle(); + mLandBuyPassHandle = gMenuLand->getChild<LLMenuItemCallGL>("Land Buy Pass")->getHandle(); LLViewerParcelMgr::getInstance()->addObserver(this); } @@ -372,17 +377,16 @@ void LLMenuParcelObserver::changed() LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (gMenuLand && parcel) { - LLView* child = gMenuLand->findChild<LLView>("Land Buy Pass"); - if (child) + if (!mLandBuyPassHandle.isDead()) { - child->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); + static_cast<LLMenuItemCallGL*>(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); } - child = gMenuLand->findChild<LLView>("Land Buy"); - if (child) + if (!mLandBuyHandle.isDead()) { bool buyable = enable_buy_land(NULL); - child->setEnabled(buyable); + static_cast<LLMenuItemCallGL*>(mLandBuyHandle.get())->setEnabled(buyable); } } } @@ -402,10 +406,34 @@ void initialize_menus(); // Break up groups of more than 6 items with separators //----------------------------------------------------------------------------- -void set_merchant_SLM_menu() +void set_merchant_SLM_menu(); + +class LLSLMMenuUpdater +{ +public: + LLSLMMenuUpdater(); + ~LLSLMMenuUpdater() = default; + + void setMerchantMenu(); + void checkMerchantStatus(bool force); + +private: + LLHandle<LLView> mMarketplaceListingsItem; +}; + +static LLSLMMenuUpdater* gSLMMenuUpdater = NULL; + +LLSLMMenuUpdater::LLSLMMenuUpdater() +{ + mMarketplaceListingsItem = gMenuHolder->getChild<LLView>("MarketplaceListings")->getHandle(); +} +void LLSLMMenuUpdater::setMerchantMenu() { // All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool - gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(true); + if(!mMarketplaceListingsItem.isDead()) + { + mMarketplaceListingsItem.get()->setVisible(true); + } LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); gToolBarView->enableCommand(command->id(), true); @@ -422,7 +450,7 @@ void set_merchant_SLM_menu() } } -void check_merchant_status(bool force) +void LLSLMMenuUpdater::checkMerchantStatus(bool force) { if (force) { @@ -430,7 +458,10 @@ void check_merchant_status(bool force) LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED); } // Hide SLM related menu item - gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(false); + if(!mMarketplaceListingsItem.isDead()) + { + mMarketplaceListingsItem.get()->setVisible(false); + } // Also disable the toolbar button for Marketplace Listings LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); @@ -440,6 +471,16 @@ void check_merchant_status(bool force) LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_SLM_menu)); } +void set_merchant_SLM_menu() +{ + if(gSLMMenuUpdater) gSLMMenuUpdater->setMerchantMenu(); +} + +void check_merchant_status(bool force) +{ + if(gSLMMenuUpdater) gSLMMenuUpdater->checkMerchantStatus(force); +} + void init_menus() { // Initialize actions @@ -555,6 +596,8 @@ void init_menus() // Let land based option enable when parcel changes gMenuParcelObserver = new LLMenuParcelObserver(); + gSLMMenuUpdater = new LLSLMMenuUpdater(); + gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); gLoginMenuBarView->arrangeAndClear(); LLRect menuBarRect = gLoginMenuBarView->getRect(); @@ -2752,6 +2795,9 @@ class LLAdminOnSaveState: public view_listener_t //----------------------------------------------------------------------------- void cleanup_menus() { + delete gSLMMenuUpdater; + gSLMMenuUpdater = nullptr; + delete gMenuParcelObserver; gMenuParcelObserver = NULL; @@ -2768,7 +2814,7 @@ void cleanup_menus() gMenuAttachmentSelf = NULL; delete gMenuAttachmentOther; - gMenuAttachmentSelf = NULL; + gMenuAttachmentOther = NULL; delete gMenuLand; gMenuLand = NULL; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cb0635d103..57ed0da06b 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -3277,6 +3277,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("VoiceSignalingRequest"); capabilityNames.append("ReadOfflineMsgs"); // Requires to respond reliably: AcceptFriendship, AcceptGroupInvite, DeclineFriendship, DeclineGroupInvite capabilityNames.append("RegionObjects"); + capabilityNames.append("RegionSchedule"); capabilityNames.append("RemoteParcelRequest"); capabilityNames.append("RenderMaterials"); capabilityNames.append("RequestTextureDownload"); diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 891c9383bf..4b299a51f5 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -37,6 +37,7 @@ #include "llui.h" #include "llkeyboard.h" #include "llagent.h" +#include "lltrans.h" #include "lluiusage.h" const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f; @@ -597,7 +598,11 @@ bool LLVoiceClient::voiceEnabled() bool enabled = enable_voice_chat && !cmd_line_disable_voice && !gNonInteractive; if (enabled && !mVoiceEffectSupportNotified && getVoiceEffectEnabled() && !getVoiceEffectDefault().isNull()) { - LLNotificationsUtil::add("VoiceEffectsNotSupported", LLSD(), LLSD(), &LLVoiceClient::onVoiceEffectsNotSupported); + static const LLSD args = llsd::map( + "FAQ_URL", LLTrans::getString("no_voice_morphing_faq_url") + ); + + LLNotificationsUtil::add("VoiceEffectsNotSupported", args, LLSD(), &LLVoiceClient::onVoiceEffectsNotSupported); mVoiceEffectSupportNotified = true; } return enabled; diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 59158922d0..bd0b0eaff3 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2096,7 +2096,7 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID ®ionID, const s { // retries wait a short period...randomize it so // all clients don't try to reconnect at once. - mRetryWaitSecs = (F32)((F32) rand() / ((F32)RAND_MAX)) + 0.5f; + mRetryWaitSecs = static_cast<F32>(rand()) / static_cast<F32>(RAND_MAX) + 0.5f; mWebRTCPeerConnectionInterface = llwebrtc::newPeerConnection(); mWebRTCPeerConnectionInterface->setSignalingObserver(this); @@ -2678,7 +2678,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() case VOICE_STATE_SESSION_UP: { mRetryWaitPeriod = 0; - mRetryWaitSecs = (F32)((F32) rand() / ((F32)RAND_MAX)) + 0.5f; + mRetryWaitSecs = static_cast<F32>(rand()) / static_cast<F32>(RAND_MAX) + 0.5f; // we'll stay here as long as the session remains up. if (mShutDown) @@ -2700,7 +2700,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() { // back off the retry period, and do it by a small random // bit so all clients don't reconnect at once. - mRetryWaitSecs += (F32)((F32) rand() / ((F32)RAND_MAX)) + 0.5f; + mRetryWaitSecs += static_cast<F32>(rand()) / static_cast<F32>(RAND_MAX) + 0.5f; mRetryWaitPeriod = 0; } } @@ -2789,7 +2789,7 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b return; } - boost::json::error_code ec; + boost::system::error_code ec; boost::json::value voice_data_parsed = boost::json::parse(data, ec); if (!ec) // don't collect comments { diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 5ee6aec9f9..8ce1a745c3 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -102,15 +102,21 @@ LLPanelWearableOutfitItem::Params::Params() bool LLPanelWearableOutfitItem::postBuild() { + if (mShowWidgets) + { + mAddWearableBtn = getChild<LLButton>("add_wearable"); + mRemoveWearableBtn = getChild<LLButton>("remove_wearable"); + } + LLPanelWearableListItem::postBuild(); if(mShowWidgets) { - addWidgetToRightSide("add_wearable"); - addWidgetToRightSide("remove_wearable"); + addWidgetToRightSide(mAddWearableBtn); + addWidgetToRightSide(mRemoveWearableBtn); - childSetAction("add_wearable", boost::bind(&LLPanelWearableOutfitItem::onAddWearable, this)); - childSetAction("remove_wearable", boost::bind(&LLPanelWearableOutfitItem::onRemoveWearable, this)); + mAddWearableBtn->setClickedCallback(boost::bind(&LLPanelWearableOutfitItem::onAddWearable, this)); + mRemoveWearableBtn->setClickedCallback(boost::bind(&LLPanelWearableOutfitItem::onRemoveWearable, this)); setWidgetsVisible(false); reshapeWidgets(); @@ -205,12 +211,12 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name, } if(mShowWidgets) { - setShowWidget("add_wearable", !is_worn); + setShowWidget(mAddWearableBtn, !is_worn); // Body parts can't be removed, only replaced LLViewerInventoryItem* inv_item = getItem(); bool show_remove = is_worn && inv_item && (inv_item->getType() != LLAssetType::AT_BODYPART); - setShowWidget("remove_wearable", show_remove); + setShowWidget(mRemoveWearableBtn, show_remove); if(mHovered) { diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index 7b69711154..3fe1059176 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -104,6 +104,8 @@ protected: bool worn_indication_enabled, const Params& params, bool show_widgets = false); private: + LLButton* mAddWearableBtn = nullptr; + LLButton* mRemoveWearableBtn = nullptr; bool mWornIndicationEnabled; bool mShowWidgets; }; diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index d8852de954..a319aa00bc 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -50,7 +50,6 @@ #include "llviewerwindow.h" #include "llnotificationsutil.h" #include "lluriparser.h" -#include "uriparser/Uri.h" bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async ); diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index a0eec1e941..4757bd42e0 100755 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1023,18 +1023,20 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& drawImage(pos_global, sTrackCircleImage, color); } - // clamp text position to on-screen - const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2; - S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f); - text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING); - text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset); - if (label != "") { - font->renderUTF8( - label, 0, - text_x, - text_y, + // clamp text position to on-screen + const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2; + + LLWString wlabel = utf8string_to_wstring(label); + S32 half_text_width = llfloor(font->getWidthF32(wlabel.c_str()) * 0.5f); + text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING); + text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset); + + font->render( + wlabel, 0, + (F32)text_x, + (F32)text_y, LLColor4::white, LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 42a6987a18..056affb68e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -10574,10 +10574,13 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool sShadowRender = false; popRenderTypeMask(); - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); + if (!preview_avatar) + { + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); + } if (!preview_avatar && !for_profile) { diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 738d448f00..7b06bed0a3 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -341,7 +341,6 @@ name="emoji_recent_empty_text" follows="top|left|right" layout="topleft" - auto_resize="false" h_pad="20" v_pad="10" top="0" diff --git a/indra/newview/skins/default/xui/en/floater_region_restart_schedule.xml b/indra/newview/skins/default/xui/en/floater_region_restart_schedule.xml new file mode 100644 index 0000000000..fd04acde35 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_region_restart_schedule.xml @@ -0,0 +1,278 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + height="180" + layout="topleft" + name="floater_region_restart_schedule" + help_topic="Preferences_Graphics_Advanced" + single_instance="true" + save_rect="true" + title="REGION RESTART SCHEDULE" + width="300"> + +<!-- This block shows Advanced Settings --> + <floater.string name="am_string">am</floater.string> + <floater.string name="pm_string">pm</floater.string> + + <text + name="days_general" + type="string" + follows="left|top" + layout="topleft" + height="16" + top="15" + left="20" + width="328"> + Restart the region on following days: + </text> + + <check_box + name="s_chk" + label="" + tool_tip="Sunday" + follows="left|top" + layout="topleft" + height="20" + width="20" + left="60" + top_pad="5" /> + + <check_box + name="m_chk" + label="" + tool_tip="Monday" + follows="left|top" + layout="topleft" + height="20" + width="20" + left_pad="5" + top_delta="0" /> + + <check_box + name="t_chk" + label="" + tool_tip="Tuesday" + follows="left|top" + layout="topleft" + height="20" + width="20" + left_pad="5" + top_delta="0" /> + + <check_box + name="w_chk" + label="" + tool_tip="Wednesday" + follows="left|top" + layout="topleft" + height="20" + width="20" + left_pad="5" + top_delta="0" /> + + <check_box + name="r_chk" + label="" + tool_tip="Thursday" + follows="left|top" + layout="topleft" + height="20" + width="20" + left_pad="5" + top_delta="0" /> + + <check_box + name="f_chk" + label="" + tool_tip="Friday" + follows="left|top" + layout="topleft" + height="20" + width="20" + left_pad="5" + top_delta="0" /> + + <check_box + name="a_chk" + label="" + tool_tip="Saturday" + follows="left|top" + layout="topleft" + height="20" + width="20" + left_pad="5" + top_delta="0" /> + + <text + name="su_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_pad="5" + left="57" + width="25"> + Su + </text> + + <text + name="mo_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_delta="0" + left_pad="0" + width="25"> + Mo + </text> + + <text + name="tu_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_delta="0" + left_pad="0" + width="25"> + Tu + </text> + + <text + name="we_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_delta="0" + left_pad="1" + width="25"> + We + </text> + + <text + name="th_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_delta="0" + left_pad="0" + width="25"> + Th + </text> + + <text + name="fr_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_delta="0" + left_pad="0" + width="25"> + Fr + </text> + + <text + name="sa_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_delta="0" + left_pad="0" + width="25"> + Sa + </text> + + <text + name="at_label" + type="string" + follows="left|top" + layout="topleft" + halign="right" + height="16" + top_pad="15" + left="30" + width="40"> + at + </text> + <line_editor + name="hours_edt" + max_length_bytes="2" + follows="left|top" + layout="topleft" + commit_on_focus_lost="true" + height="23" + width="40" + left_pad="4" + top_delta="-5"/> + <text + name="separator_label" + type="string" + follows="left|top" + layout="topleft" + halign="center" + height="16" + top_delta="5" + left_pad="0" + width="12"> + : + </text> + <line_editor + name="minutes_edt" + max_length_bytes="2" + follows="left|top" + layout="topleft" + commit_on_focus_lost="true" + height="23" + width="40" + left_pad="0" + top_delta="-5"/> + <button + name="am_pm_btn" + label="am" + follows="left|top" + layout="topleft" + height="23" + width="40" + left_pad="1" + top_delta="0"/> + <text + name="utc_label" + type="string" + follows="left|top" + layout="topleft" + height="16" + top_delta="5" + left_pad="5" + width="22"> + UTC + </text> + <button + name="save_btn" + label="Save" + follows="top|left" + layout="topleft" + top="145" + left="25" + height="25" + width="110"/> + <button + name="cancel_btn" + label="Cancel" + follows="bottom|right" + layout="topleft" + left_pad="20" + top_delta="0" + height="25" + width="110"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index e17dbbeb2f..e9ce774e8c 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3967,6 +3967,16 @@ function="World.EnvPreset" parameter="AllowSelectAvatar" /> </menu_item_check> <menu_item_check + label="Disable Look At Animation" + name="Disable Look At Animation"> + <menu_item_check.on_check + function="CheckControl" + parameter="DisableLookAtAnimation" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="DisableLookAtAnimation" /> + </menu_item_check> + <menu_item_check label="Render Only Friends" name="Render Only Friends"> <menu_item_check.on_check diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 2c19a89fb2..2e08f6b3be 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -8871,10 +8871,10 @@ New Voice Morphs are available! persist="true" type="alertmodal"> Voice Morphs are not supported by this viewer. +For more information about other voice morph tools, see [[FAQ_URL] this article]. <usetemplate - notext="Cancel" - name="okcancelbuttons" - yestext="Disable Voice Morphing"/> + name="okignore" + yestext="OK"/> <tag>voice</tag> </notification> diff --git a/indra/newview/skins/default/xui/en/panel_edit_alpha.xml b/indra/newview/skins/default/xui/en/panel_edit_alpha.xml index 30fee7361f..ab0e447028 100644 --- a/indra/newview/skins/default/xui/en/panel_edit_alpha.xml +++ b/indra/newview/skins/default/xui/en/panel_edit_alpha.xml @@ -33,7 +33,6 @@ top="0" width="313" > <check_box - control_name="LowerAlphaTextureInvisible" follows="left|top" height="16" layout="topleft" @@ -58,7 +57,6 @@ </texture_picker> <check_box - control_name="UpperAlphaTextureInvisible" follows="left|top" height="16" layout="topleft" @@ -83,7 +81,6 @@ </texture_picker> <check_box - control_name="HeadAlphaTextureInvisible" follows="left|top" height="16" layout="topleft" @@ -108,7 +105,6 @@ </texture_picker> <check_box - control_name="Eye AlphaTextureInvisible" follows="left|top" height="16" layout="topleft" @@ -133,7 +129,6 @@ </texture_picker> <check_box - control_name="HairAlphaTextureInvisible" follows="left|top" height="16" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_region_general.xml b/indra/newview/skins/default/xui/en/panel_region_general.xml index 74d21c436e..6ef1b6e44a 100644 --- a/indra/newview/skins/default/xui/en/panel_region_general.xml +++ b/indra/newview/skins/default/xui/en/panel_region_general.xml @@ -270,8 +270,20 @@ left="250" name="manage_telehub_btn" top="70" - width="150"> + width="160"> <button.commit_callback function="RegionInfo.ManageTelehub" /> </button> + <button + follows="left|top" + height="20" + label="Manage Restart Schedule..." + layout="topleft" + name="manage_restart_btn" + top_pad="5" + left_delta="0" + width="160"> + <button.commit_callback + function="RegionInfo.ManageRestart" /> + </button> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml index 2035bc2caa..ec642131ae 100644 --- a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml +++ b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml @@ -84,7 +84,7 @@ enabled="false" height="132" image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled_Selected" + image_disabled_selected="PushButton_Selected_Disabled" image_selected="PushButton_Selected" image_unselected="PushButton_Off" layout="topleft" @@ -97,7 +97,7 @@ enabled="false" height="132" image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled_Selected" + image_disabled_selected="PushButton_Selected_Disabled" image_selected="PushButton_Selected" image_unselected="PushButton_Off" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index bee58da6b0..2d04b3e0fe 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3818,6 +3818,7 @@ Please reinstall viewer from https://secondlife.com/support/downloads/ and cont <string name="voice_morphing_url">https://secondlife.com/destination/voice-island</string> <string name="premium_voice_morphing_url">https://secondlife.com/destination/voice-morphing-premium</string> + <string name="no_voice_morphing_faq_url">https://lindenlab.freshdesk.com/support/solutions/articles/31000173560-webrtc-update-for-voice-chat-faq/</string> <string name="lindenhomes_get_home_url">https://secondlife.com/land/lindenhomes/member.php</string> <string name="lindenhomes_my_home_url">https://land.secondlife.com/en-Us/lindenhomes/my-home.php</string> diff --git a/indra/newview/skins/default/xui/en/widgets/drop_down.xml b/indra/newview/skins/default/xui/en/widgets/drop_down.xml index 75ed485645..80f98b64fc 100644 --- a/indra/newview/skins/default/xui/en/widgets/drop_down.xml +++ b/indra/newview/skins/default/xui/en/widgets/drop_down.xml @@ -12,7 +12,7 @@ image_unselected="PushButton_Off" image_selected="PushButton_Selected" image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled_Selected" + image_disabled_selected="PushButton_Selected_Disabled" image_overlay="Combobox_Over" image_overlay_alignment="right" /> <drop_down.combo_list bg_writeable_color="white" /> diff --git a/indra/newview/skins/default/xui/en/widgets/emoji_complete.xml b/indra/newview/skins/default/xui/en/widgets/emoji_complete.xml index 6cc8d7118f..4a1ba169ad 100644 --- a/indra/newview/skins/default/xui/en/widgets/emoji_complete.xml +++ b/indra/newview/skins/default/xui/en/widgets/emoji_complete.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <emoji_complete autosize="false" - hover_image="ListItem_Over" selected_image="ListItem_Select" max_visible="7" padding="8" diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index d94bdc31d2..f9a61ee311 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -563,9 +563,6 @@ class Windows_x86_64_Manifest(ViewerManifest): # For textures self.path("openjp2.dll") - # Uriparser - self.path("uriparser.dll") - # These need to be installed as a SxS assembly, currently a 'private' assembly. # See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx self.path("msvcp140.dll") @@ -1024,7 +1021,6 @@ class Darwin_x86_64_Manifest(ViewerManifest): # libnghttp2.major.dylib, which is a symlink to # libnghttp2.version.dylib. Get all of them. "libnghttp2.*dylib", - "liburiparser.*dylib", ): dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile) @@ -1253,11 +1249,13 @@ class LinuxManifest(ViewerManifest): with self.prefix(dst="res-sdl") : self.path("secondlife_256.BMP","ll_icon.BMP") + with self.prefix(src=os.path.join(self.args['build'], os.pardir, "llwebrtc" ), dst="lib"): + self.path("libllwebrtc.so") + # plugins with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins'), dst="bin/llplugin"): self.path("gstreamer10/libmedia_plugin_gstreamer10.so", "libmedia_plugin_gstreamer.so") - with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins'), dst="bin/llplugin"): self.path("cef/libmedia_plugin_cef.so", "libmedia_plugin_cef.so" ) with self.prefix(src=os.path.join(pkgdir, 'lib', 'release'), dst="lib"): diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index 3dcddf9dc2..745c0eedf8 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -71,6 +71,7 @@ if (WINDOWS) PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT" LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\"" + RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}" ) elseif (DARWIN) # Support our "@executable_path/../Resources" load path for our test |