diff --git a/.github/labeler.yaml b/.github/labeler.yaml index 5a6590d4aac..6359419ba67 100644 --- a/.github/labeler.yaml +++ b/.github/labeler.yaml @@ -1,81 +1,109 @@ llappearance: - - indra/llappearance/**/* +- changed-files: + - any-glob-to-any-file: indra/llappearance/** llaudio: - - indra/llaudio/**/* +- changed-files: + - any-glob-to-any-file: indra/llaudio/** llcharacter: - - indra/llcharacter/**/* +- changed-files: + - any-glob-to-any-file: indra/llcharacter/** llcommon: - - indra/llcommon/**/* +- changed-files: + - any-glob-to-any-file: indra/llcommon/** llcorehttp: - - indra/llcorehttp/**/* +- changed-files: + - any-glob-to-any-file: indra/llcorehttp/** llcrashlogger: - - indra/llcrashlogger/**/* +- changed-files: + - any-glob-to-any-file: indra/llcrashlogger/** llfilesystem: - - indra/llfilesystem/**/* +- changed-files: + - any-glob-to-any-file: indra/llfilesystem/** llimage: - - indra/llimage/**/* +- changed-files: + - any-glob-to-any-file: indra/llimage/** llimagej2coj: - - indra/llimagej2coj/**/* +- changed-files: + - any-glob-to-any-file: indra/llimagej2coj/** llinventory: - - indra/llinventory/**/* +- changed-files: + - any-glob-to-any-file: indra/llinventory/** llkdu: - - indra/llkdu/**/* +- changed-files: + - any-glob-to-any-file: indra/llkdu/** llmath: - - indra/llmath/**/* +- changed-files: + - any-glob-to-any-file: indra/llmath/** llmeshoptimizer: - - indra/llmeshoptimizer/**/* +- changed-files: + - any-glob-to-any-file: indra/llmeshoptimizer/** llmessage: - - indra/llmessage/**/* +- changed-files: + - any-glob-to-any-file: indra/llmessage/** llplugin: - - indra/llplugin/**/* +- changed-files: + - any-glob-to-any-file: indra/llplugin/** llprimitive: - - indra/llprimitive/**/* +- changed-files: + - any-glob-to-any-file: indra/llprimitive/** llrender: - - indra/llrender/**/* +- changed-files: + - any-glob-to-any-file: indra/llrender/** llui: - - indra/llui/**/* +- changed-files: + - any-glob-to-any-file: indra/llui/** llwindow: - - indra/llwindow/**/* +- changed-files: + - any-glob-to-any-file: indra/llwindow/** llxml: - - indra/llxml/**/* +- changed-files: + - any-glob-to-any-file: indra/llxml/** cmake: - - '**/*.cmake' - - '**/*/cmake/*' - - '**/CMakeLists.txt' +- changed-files: + - any-glob-to-any-file: + - '**/*.cmake' + - '**/*/cmake/*' + - '**/CMakeLists.txt' python: - - '**/*.py' +- changed-files: + - any-glob-to-any-file: '**/*.py' c/cpp: - - '**/*.c' - - '**/*.cpp' - - '**/*.cxx' - - '**/*.h' - - '**/*.hpp' - - '**/*.hxx' - - '**/*.i' - - '**/*.inl' - - '**/*.y' - -'team:viewer': - - '*' +- changed-files: + - any-glob-to-any-file: + - '**/*.c' + - '**/*.cpp' + - '**/*.cxx' + - '**/*.h' + - '**/*.hpp' + - '**/*.hxx' + - '**/*.i' + - '**/*.inl' + - '**/*.y' + +objc: +- changed-files: + - any-glob-to-any-file: + - '**/*.m' + - '**/*.mm' diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4c948e55864..4c8d98ce2f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -91,7 +91,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.11" - name: Checkout build variables @@ -362,8 +362,9 @@ jobs: post-windows-symbols: env: - BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }} - BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }} + BUGSPLAT_DATABASE: "${{ secrets.BUGSPLAT_DATABASE }}" + SYMBOL_UPLOAD_CLIENT_ID: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_ID }}" + SYMBOL_UPLOAD_CLIENT_SECRET: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_SECRET }}" needs: build if: needs.build.outputs.configuration == 'Release' runs-on: ubuntu-latest @@ -374,51 +375,56 @@ jobs: name: Windows-app path: _artifacts - name: Download Windows Symbols - if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS + if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID uses: actions/download-artifact@v4 with: name: Windows-symbols - name: Extract viewer pdb - if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS + if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID shell: bash run: | tar -xJf "${{ needs.build.outputs.viewer_channel }}.sym.tar.xz" -C _artifacts - name: Post Windows symbols - if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS - uses: secondlife-3p/symbol-upload@v10 + if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID + uses: BugSplat-Git/symbol-upload@095d163ae9ceb006d286a731dcd35cf6a1b458c8 with: - username: ${{ env.BUGSPLAT_USER }} - password: ${{ env.BUGSPLAT_PASS }} - database: "SecondLife_Viewer_2018" + clientId: "${{ env.SYMBOL_UPLOAD_CLIENT_ID }}" + clientSecret: "${{ env.SYMBOL_UPLOAD_CLIENT_SECRET }}" + database: "${{ env.BUGSPLAT_DATABASE }}" application: ${{ needs.build.outputs.viewer_channel }} version: ${{ needs.build.outputs.viewer_version }} directory: _artifacts files: "**/{SecondLifeViewer.exe,llwebrtc.dll,*.pdb}" + node-version: "22" + dumpSyms: false post-mac-symbols: env: - BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }} - BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }} + BUGSPLAT_DATABASE: "${{ secrets.BUGSPLAT_DATABASE }}" + SYMBOL_UPLOAD_CLIENT_ID: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_ID }}" + SYMBOL_UPLOAD_CLIENT_SECRET: "${{ secrets.BUGSPLAT_SYMBOL_UPLOAD_CLIENT_SECRET }}" needs: build if: needs.build.outputs.configuration == 'Release' runs-on: ubuntu-latest steps: - name: Download Mac Symbols - if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS + if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID uses: actions/download-artifact@v4 with: name: macOS-symbols - name: Post Mac symbols - if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS - uses: secondlife-3p/symbol-upload@v10 + if: env.BUGSPLAT_DATABASE && env.SYMBOL_UPLOAD_CLIENT_ID + uses: BugSplat-Git/symbol-upload@095d163ae9ceb006d286a731dcd35cf6a1b458c8 with: - username: ${{ env.BUGSPLAT_USER }} - password: ${{ env.BUGSPLAT_PASS }} - database: "SecondLife_Viewer_2018" + clientId: "${{ env.SYMBOL_UPLOAD_CLIENT_ID }}" + clientSecret: "${{ env.SYMBOL_UPLOAD_CLIENT_SECRET }}" + database: "${{ env.BUGSPLAT_DATABASE }}" application: ${{ needs.build.outputs.viewer_channel }} version: ${{ needs.build.outputs.viewer_version }} (${{ needs.build.outputs.viewer_version }}) directory: . files: "**/*.xcarchive.zip" + node-version: "22" + dumpSyms: false release: needs: [setup, build, sign-and-package-windows, sign-and-package-mac] diff --git a/.github/workflows/check-pr.yaml b/.github/workflows/check-pr.yaml index a5cee9157c7..08e907e83f5 100644 --- a/.github/workflows/check-pr.yaml +++ b/.github/workflows/check-pr.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check PR description - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | const description = context.payload.pull_request.body || ''; diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml index 627ba512c41..5b31c584d50 100644 --- a/.github/workflows/cla.yaml +++ b/.github/workflows/cla.yaml @@ -23,4 +23,4 @@ jobs: path-to-signatures: signatures.json remote-organization-name: secondlife remote-repository-name: cla-signatures - allowlist: callum@mbp.localdomain,rye@lindenlab.com,rye + allowlist: callum@mbp.localdomain,rye@lindenlab.com,rye,bot* diff --git a/.github/workflows/label.yaml b/.github/workflows/label.yaml index 6e41d8aa2d8..218327ef470 100644 --- a/.github/workflows/label.yaml +++ b/.github/workflows/label.yaml @@ -9,7 +9,7 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v6 with: configuration-path: .github/labeler.yaml repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 726e1cd889b..8f942fa11bc 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v6 with: python-version: 3.x - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index f77151a815f..edfe71b6930 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -12,7 +12,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v6 + - uses: actions/stale@v10 id: stale with: stale-pr-message: This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or it will be closed in 7 days diff --git a/.github/workflows/tag-release.yaml b/.github/workflows/tag-release.yaml index 24ee2de7949..2922065f995 100644 --- a/.github/workflows/tag-release.yaml +++ b/.github/workflows/tag-release.yaml @@ -35,7 +35,7 @@ jobs: echo NIGHTLY_DATE=${NIGHTLY_DATE} >> ${GITHUB_ENV} echo TAG_ID="$(echo ${{ github.sha }} | cut -c1-8)-${{ inputs.project || '${NIGHTLY_DATE}' }}" >> ${GITHUB_ENV} - name: Update Tag - uses: actions/github-script@v7.0.1 + uses: actions/github-script@v8 with: # use a real access token instead of GITHUB_TOKEN default. # required so that the results of this tag creation can trigger the build workflow diff --git a/autobuild.xml b/autobuild.xml index 2983307cbe6..d58a785b6b6 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -46,11 +46,11 @@ archive hash - a21487f4e3a68721fd97edef117795a1b7212a77 + 3f8e58fe74e144b771858e89a5514bf354964c76 hash_algorithm sha1 url - https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r1/apr_suite-1.7.5-12259255574-darwin64-12259255574.tar.zst + https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r2/apr_suite-1.7.5-18696779749-darwin64-18696779749.tar.zst name darwin64 @@ -60,11 +60,11 @@ archive hash - 45baf82d3366734e542a2a3749f495b64f5513b4 + df36114eb8fb66fdcbb190011222a7d336791d98 hash_algorithm sha1 url - https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r1/apr_suite-1.7.5-12259255574-linux64-12259255574.tar.zst + https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r2/apr_suite-1.7.5-18696779749-linux64-18696779749.tar.zst name linux64 @@ -74,11 +74,11 @@ archive hash - bdd35d3b9580d3cdcb98afae639936aaa40e24c4 + 164705831819d247753c9fd608c2c1ac8dca1883 hash_algorithm sha1 url - https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r1/apr_suite-1.7.5-12259255574-windows64-12259255574.tar.zst + https://github.com/secondlife/3p-apr_suite/releases/download/v1.7.5-r2/apr_suite-1.7.5-18696779749-windows64-18696779749.tar.zst name windows64 @@ -91,7 +91,7 @@ copyright Copyright © 2012 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. version - 1.7.5-12259255574 + 1.7.5-18696779749 name apr_suite description @@ -166,11 +166,11 @@ archive hash - cd1f1d55a2488657ec2253774b3a414621f81b24 + 9bcafdd7e1df6b92096fa850627d4f3437630d4a hash_algorithm sha1 url - https://github.com/secondlife/3p-bugsplat/releases/download/v1.1.5-71fc41e/bugsplat-1.1.1-9599607655-darwin64-9599607655.tar.zst + https://github.com/secondlife/3p-bugsplat/releases/download/v1.2.6-a475cbb/bugsplat-1.2.6-19430122611-darwin64-19430122611.tar.zst name darwin64 @@ -180,11 +180,11 @@ archive hash - 9fb0615d17988bd89a2e5ae6d4d19e150afb54a9 + 4e9f0c1cdbc1cebf6185ecc45228ced7f9af1532 hash_algorithm sha1 url - https://github.com/secondlife/3p-bugsplat/releases/download/v1.1.5-71fc41e/bugsplat-5.0.1.0-9599607655-windows64-9599607655.tar.zst + https://github.com/secondlife/3p-bugsplat/releases/download/v1.2.6-a475cbb/bugsplat-6.1.1.0-19430122611-windows64-19430122611.tar.zst name windows64 diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake index 310659686dc..e0807a7d19d 100644 --- a/indra/cmake/APR.cmake +++ b/indra/cmake/APR.cmake @@ -31,8 +31,3 @@ if(DARWIN) endif() target_include_directories(ll::apr SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/apr-1) - -# Fix erroneous check for __attribute__ definition introduced with APR 1.7.5, causing lots of "this declaration may not have extern 'C' linkage" errors in VS -file(READ ${LIBS_PREBUILT_DIR}/include/apr-1/apr.h APR_HEADER_CONTENTS) -string(REPLACE "#if !(defined(__attribute__) || defined(__has_attribute))" "#if !defined(__attribute__)" APR_HEADER_CONTENTS "${APR_HEADER_CONTENTS}") -file(WRITE ${LIBS_PREBUILT_DIR}/include/apr-1/apr.h "${APR_HEADER_CONTENTS}") diff --git a/indra/cmake/bugsplat.cmake b/indra/cmake/bugsplat.cmake index 509981d72cd..d2a8fcca46a 100644 --- a/indra/cmake/bugsplat.cmake +++ b/indra/cmake/bugsplat.cmake @@ -23,8 +23,14 @@ if (USE_BUGSPLAT) elseif (DARWIN) find_library(BUGSPLAT_LIBRARIES BugsplatMac REQUIRED NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}") + find_library(CRASHREPORTED_LIBRARIES CrashReporter REQUIRED + NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}") + find_library(HOCKEYSDK_LIBRARIES HockeySDK REQUIRED + NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}") target_link_libraries( ll::bugsplat INTERFACE ${BUGSPLAT_LIBRARIES} + ${CRASHREPORTED_LIBRARIES} + ${HOCKEYSDK_LIBRARIES} ) else (WINDOWS) message(FATAL_ERROR "BugSplat is not supported; add -DUSE_BUGSPLAT=OFF") diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index b82734615f5..be1c74a9082 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1229,7 +1229,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints) { bool old_version = false; - std::unique_ptr joint_motion_list(new LLKeyframeMotion::JointMotionList); + std::unique_ptr joint_motion_list = std::make_unique(); //------------------------------------------------------------------------- // get base priority @@ -1826,7 +1826,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo for(S32 i = 0; i < num_constraints; ++i) { // read in constraint data - std::unique_ptr constraintp(new JointConstraintSharedData); + std::unique_ptr constraintp = std::make_unique(); U8 byte = 0; if (!dp.unpackU8(byte, "chain_length")) diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp index bc9f5786601..a51857c9a1b 100644 --- a/indra/llcharacter/llmotion.cpp +++ b/indra/llcharacter/llmotion.cpp @@ -51,8 +51,8 @@ LLMotion::LLMotion( const LLUUID &id ) : mSendStopTimestamp(F32_MAX), mResidualWeight(0.f), mFadeWeight(1.f), - mDeactivateCallback(NULL), - mDeactivateCallbackUserData(NULL) + mDeactivateCallback(nullptr), + mDeactivateCallbackUserData(nullptr) { for (S32 i=0; i<3; ++i) memset(&mJointSignature[i][0], 0, sizeof(U8) * LL_CHARACTER_MAX_ANIMATED_JOINTS); diff --git a/indra/llcharacter/llmultigesture.h b/indra/llcharacter/llmultigesture.h index af0cb086503..199ed5c543c 100644 --- a/indra/llcharacter/llmultigesture.h +++ b/indra/llcharacter/llmultigesture.h @@ -54,11 +54,10 @@ class LLMultiGesture void reset(); const std::string& getTrigger() const { return mTrigger; } -protected: - LLMultiGesture(const LLMultiGesture& gest); - const LLMultiGesture& operator=(const LLMultiGesture& rhs); -public: + LLMultiGesture(const LLMultiGesture& gest) = delete; + const LLMultiGesture& operator=(const LLMultiGesture& rhs) = delete; + KEY mKey { 0 }; MASK mMask { 0 }; diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 3caddb9c625..8d2c4a3723b 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -30,7 +30,8 @@ #include "v3math.h" #include "llstring.h" #include "llxmltree.h" -#include + +#include class LLPolyMesh; class LLXmlTreeNode; @@ -104,7 +105,7 @@ LL_ALIGN_PREFIX(16) class LLVisualParam { public: - typedef boost::function visual_param_mapper; + typedef std::function visual_param_mapper; LLVisualParam(); virtual ~LLVisualParam(); diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 2de9deea701..4d04c2c1190 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -101,6 +101,7 @@ set(llcommon_SOURCE_FILES lluri.cpp lluriparser.cpp lluuid.cpp + llwatchdog.cpp llworkerthread.cpp hbxxh.cpp u64.cpp @@ -240,6 +241,7 @@ set(llcommon_HEADER_FILES lluri.h lluriparser.h lluuid.h + llwatchdog.h llwin32headers.h llworkerthread.h hbxxh.h diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 01763c49aab..eeff2694a74 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -154,7 +154,7 @@ LLVolatileAPRPool::LLVolatileAPRPool(bool is_local, apr_pool_t *parent, apr_size //create mutex if(!is_local) //not a local apr_pool, that is: shared by multiple threads. { - mMutexp.reset(new std::mutex()); + mMutexp = std::make_unique(); } } diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 693cd7c01fa..11e474b5dda 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -33,7 +33,6 @@ #include // Need PATH_MAX in APR headers... #endif -#include #include "llwin32headers.h" #include "apr_thread_proc.h" #include "apr_getopt.h" @@ -145,7 +144,7 @@ class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool // 2, a global pool. // -class LL_COMMON_API LLAPRFile : boost::noncopyable +class LL_COMMON_API LLAPRFile { // make this non copyable since a copy closes the file private: @@ -153,9 +152,12 @@ class LL_COMMON_API LLAPRFile : boost::noncopyable LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool. public: - LLAPRFile() ; + LLAPRFile(); LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL); - ~LLAPRFile() ; + ~LLAPRFile(); + + LLAPRFile(const LLAPRFile&) = delete; + LLAPRFile& operator=(const LLAPRFile&) = delete; apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL, S32* sizep = NULL); apr_status_t open(const std::string& filename, apr_int32_t flags, bool use_global_pool); //use gAPRPoolp. diff --git a/indra/llcommon/llcallbacklist.h b/indra/llcommon/llcallbacklist.h index d6c415f7c57..036e575117d 100644 --- a/indra/llcommon/llcallbacklist.h +++ b/indra/llcommon/llcallbacklist.h @@ -27,8 +27,9 @@ #ifndef LL_LLCALLBACKLIST_H #define LL_LLCALLBACKLIST_H -#include "llstl.h" -#include +#include "stdtypes.h" + +#include #include class LLCallbackList @@ -59,8 +60,8 @@ class LLCallbackList callback_list_t mCallbackList; }; -typedef boost::function nullary_func_t; -typedef boost::function bool_func_t; +typedef std::function nullary_func_t; +typedef std::function bool_func_t; // Call a given callable once in idle loop. void doOnIdleOneTime(nullary_func_t callable); diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index c3820ae9876..9df52b6ed5a 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -37,7 +37,7 @@ #include "mutex.h" #include "llsingleton.h" #include "llinstancetracker.h" -#include +#include #include #include #include @@ -112,7 +112,7 @@ class LL_COMMON_API LLCoros: public LLSingleton /// stuck with the term "coroutine." typedef boost::fibers::fiber coro; /// Canonical callable type - typedef boost::function callable_t; + typedef std::function callable_t; /** * Create and start running a new coroutine with specified name. The name diff --git a/indra/llcommon/lldeadmantimer.h b/indra/llcommon/lldeadmantimer.h index 3f10420d41d..19d65b78b63 100644 --- a/indra/llcommon/lldeadmantimer.h +++ b/indra/llcommon/lldeadmantimer.h @@ -99,13 +99,10 @@ class LL_COMMON_API LLDeadmanTimer /// during updates. If false, cpu usage data isn't /// collected and will be zero if queried. LLDeadmanTimer(F64 horizon, bool inc_cpu); + ~LLDeadmanTimer() = default; - ~LLDeadmanTimer() - {} - -private: - LLDeadmanTimer(const LLDeadmanTimer &); // Not defined - void operator=(const LLDeadmanTimer &); // Not defined + LLDeadmanTimer(const LLDeadmanTimer &) = delete; + LLDeadmanTimer& operator=(const LLDeadmanTimer&) = delete; public: /// Get the current time. Zero-basis for this time diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h index 47b6fedc7d7..a1b5c83caf4 100644 --- a/indra/llcommon/lldependencies.h +++ b/indra/llcommon/lldependencies.h @@ -30,6 +30,7 @@ #if ! defined(LL_LLDEPENDENCIES_H) #define LL_LLDEPENDENCIES_H +#include #include #include #include @@ -38,7 +39,6 @@ #include #include #include -#include #include #include "llexception.h" @@ -217,7 +217,7 @@ class LLDependencies: public LLDependenciesBase /// We have various ways to get the dependencies for a given DepNode. /// Rather than having to restate each one for 'after' and 'before' /// separately, pass a dep_selector so we can apply each to either. - typedef boost::function dep_selector; + typedef std::function dep_selector; public: LLDependencies() {} @@ -340,7 +340,7 @@ class LLDependencies: public LLDependenciesBase public: /// iterator over value_type entries - typedef boost::transform_iterator, + typedef boost::transform_iterator, typename DepNodeMap::iterator> iterator; /// range over value_type entries typedef boost::iterator_range range; @@ -352,7 +352,7 @@ class LLDependencies: public LLDependenciesBase } /// iterator over const_value_type entries - typedef boost::transform_iterator, + typedef boost::transform_iterator, typename DepNodeMap::const_iterator> const_iterator; /// range over const_value_type entries typedef boost::iterator_range const_range; @@ -364,7 +364,7 @@ class LLDependencies: public LLDependenciesBase } /// iterator over stored NODEs - typedef boost::transform_iterator, + typedef boost::transform_iterator, typename DepNodeMap::iterator> node_iterator; /// range over stored NODEs typedef boost::iterator_range node_range; @@ -380,7 +380,7 @@ class LLDependencies: public LLDependenciesBase } /// const iterator over stored NODEs - typedef boost::transform_iterator, + typedef boost::transform_iterator, typename DepNodeMap::const_iterator> const_node_iterator; /// const range over stored NODEs typedef boost::iterator_range const_node_range; @@ -396,7 +396,7 @@ class LLDependencies: public LLDependenciesBase } /// const iterator over stored KEYs - typedef boost::transform_iterator, + typedef boost::transform_iterator, typename DepNodeMap::const_iterator> const_key_iterator; /// const range over stored KEYs typedef boost::iterator_range const_key_range; diff --git a/indra/llcommon/lldoubledispatch.h b/indra/llcommon/lldoubledispatch.h index 25039c3e9c1..ad4dc57d589 100644 --- a/indra/llcommon/lldoubledispatch.h +++ b/indra/llcommon/lldoubledispatch.h @@ -30,9 +30,7 @@ #define LL_LLDOUBLEDISPATCH_H #include -#include -#include -#include +#include /** * This class supports function calls which are virtual on the dynamic type of @@ -156,9 +154,9 @@ class LLDoubleDispatch insert(t1, t2, func); if (symmetrical) { - // Use boost::bind() to construct a param-swapping thunk. Don't + // Use std::bind() to construct a param-swapping thunk. Don't // forget to reverse the parameters too. - insert(t2, t1, boost::bind(func, _2, _1)); + insert(t2, t1, std::bind(func, std::placeholders::_2, std::placeholders::_1)); } } @@ -193,7 +191,7 @@ class LLDoubleDispatch insert(Type(), Type(), func, insertion); if (symmetrical) { - insert(Type(), Type(), boost::bind(func, _2, _1), insertion); + insert(Type(), Type(), std::bind(func, std::placeholders::_2, std::placeholders::_1), insertion); } } @@ -271,8 +269,8 @@ class LLDoubleDispatch typename DispatchTable::iterator find(const ParamBaseType& param1, const ParamBaseType& param2) { return std::find_if(mDispatch.begin(), mDispatch.end(), - boost::bind(&EntryBase::matches, _1, - boost::ref(param1), boost::ref(param2))); + std::bind(&EntryBase::matches, std::placeholders::_1, + std::ref(param1), std::ref(param2))); } /// Look up the first matching entry. diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 3411e9c6bb5..b14464382b7 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -527,8 +527,8 @@ namespace mFileLevelMap(), mTagLevelMap(), mUniqueLogMessages(), - mCrashFunction(NULL), - mTimeFunction(NULL), + mCrashFunction(nullptr), + mTimeFunction(nullptr), mRecorders(), mShouldLogCallCounter(0) { @@ -1231,7 +1231,7 @@ namespace std::ostringstream message_stream; - if (r->wantsTime() && s->mTimeFunction != NULL) + if (r->wantsTime() && s->mTimeFunction != nullptr) { message_stream << s->mTimeFunction(); } diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 0a7b3d20461..d254fa54074 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -31,7 +31,7 @@ #include "llerror.h" #include "llpointer.h" #include "llrefcount.h" -#include "boost/function.hpp" +#include #include class LLSD; @@ -92,7 +92,7 @@ namespace LLError Control functions. */ - typedef boost::function FatalFunction; + typedef std::function FatalFunction; LL_COMMON_API void setFatalFunction(const FatalFunction&); // The fatal function will be called after an message of LEVEL_ERROR diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 4c3c0f34148..97a60e2829f 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -33,9 +33,7 @@ #define LL_LLEVENTDISPATCHER_H #include -#include #include -#include // until C++17, when we get std::is_invocable #include #include // std::function #include // std::unique_ptr @@ -99,7 +97,7 @@ class LL_COMMON_API LLEventDispatcher template ::value + std::is_invocable::value >::type> void add(const std::string& name, const std::string& desc, @@ -295,9 +293,8 @@ class LL_COMMON_API LLEventDispatcher * converted to the corresponding parameter type using LLSDParam. */ template () - >::type> + typename=typename std::enable_if_t< + ! std::is_invocable()>> void add(const std::string& name, const std::string& desc, CALLABLE&& f) @@ -318,7 +315,7 @@ class LL_COMMON_API LLEventDispatcher */ template::value && + std::is_member_function_pointer::value && ! std::is_convertible::value >::type> void add(const std::string& name, const std::string& desc, Method f, @@ -338,7 +335,7 @@ class LL_COMMON_API LLEventDispatcher template::value && - ! boost::hof::is_invocable::value + ! std::is_invocable::value >::type> void add(const std::string& name, const std::string& desc, Function f, const LLSD& params, const LLSD& defaults=LLSD()); @@ -364,7 +361,7 @@ class LL_COMMON_API LLEventDispatcher */ template::value && + std::is_member_function_pointer::value && ! std::is_convertible::value >::type> void add(const std::string& name, const std::string& desc, Method f, diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h index d8c7e15a275..8b917c23be1 100644 --- a/indra/llcommon/lleventfilter.h +++ b/indra/llcommon/lleventfilter.h @@ -33,7 +33,8 @@ #include "stdtypes.h" #include "lltimer.h" #include "llsdutil.h" -#include + +#include class LLEventTimer; class LLDate; @@ -92,8 +93,8 @@ class LL_COMMON_API LLEventTimeoutBase: public LLEventFilter /// construct and connect LLEventTimeoutBase(LLEventPump& source); - /// Callable, can be constructed with boost::bind() - typedef boost::function Action; + /// Callable, can be constructed with std::bind() + typedef std::function Action; /** * Start countdown timer for the specified number of @a seconds. Forward diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 3c6743eac93..9a5324b5987 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -44,7 +44,6 @@ #include #include // external library headers -#include #if LL_WINDOWS #pragma warning (push) #pragma warning (disable : 4701) // compiler thinks might use uninitialized var, but no diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 4bf1fa07a2f..18c05a00814 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -41,11 +41,7 @@ #include #include -#include // noncopyable #include -#include -#include // reference_wrapper -#include #include #include "llsd.h" #include "llsingleton.h" diff --git a/indra/llcommon/llhandle.h b/indra/llcommon/llhandle.h index ceea1d9c482..fd7d32e79af 100644 --- a/indra/llcommon/llhandle.h +++ b/indra/llcommon/llhandle.h @@ -31,8 +31,6 @@ #include "llrefcount.h" #include "llexception.h" #include -#include -#include #include /** @@ -90,7 +88,7 @@ class LLHandle LLHandle() : mTombStone(getDefaultTombStone()) {} template - LLHandle(const LLHandle& other, typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) + LLHandle(const LLHandle& other, typename std::enable_if_t>* dummy = 0) : mTombStone(other.mTombStone) {} @@ -199,7 +197,7 @@ class LLHandleProvider } template - LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const + LLHandle getDerivedHandle(typename std::enable_if_t >* dummy = 0) const { LLHandle downcast_handle; downcast_handle.mTombStone = getHandle().mTombStone; diff --git a/indra/llcommon/llinitdestroyclass.h b/indra/llcommon/llinitdestroyclass.h index 2354c9f2ed3..7cc9c6b930a 100644 --- a/indra/llcommon/llinitdestroyclass.h +++ b/indra/llcommon/llinitdestroyclass.h @@ -37,7 +37,7 @@ #define LL_LLINITDESTROYCLASS_H #include "llsingleton.h" -#include +#include #include #include #include // std::pair @@ -50,7 +50,7 @@ class LLCallbackRegistry { public: - typedef boost::function func_t; + typedef std::function func_t; void registerCallback(const std::string& name, const func_t& func) { diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 32d7b17034a..b01ea0bfb1b 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -28,11 +28,12 @@ #ifndef LL_LLPARAM_H #define LL_LLPARAM_H +#include +#include #include #include +#include #include -#include -#include #include #include "llerror.h" @@ -105,6 +106,26 @@ namespace LLTypeTags }; } +namespace ll +{ + // Primary template: general case is false + template + struct is_std_function : std::false_type + { + }; + + // Specialization for std::function + // R is the return type, Args is a parameter pack for argument types + template + struct is_std_function> : std::true_type + { + }; + + // Helper variable template for convenience (C++14 onwards) + template + constexpr bool is_std_function_v = is_std_function::value; +} + namespace LLInitParam { // used to indicate no matching value to a given name when parsing @@ -114,7 +135,7 @@ namespace LLInitParam // wraps comparison operator between any 2 values of the same type // specialize to handle cases where equality isn't defined well, or at all - template ::value > + template || ll::is_std_function_v> struct ParamCompare { static bool equals(const T &a, const T &b) @@ -123,7 +144,7 @@ namespace LLInitParam } }; - // boost function types are not comparable + // boost and std function types are not comparable template struct ParamCompare { @@ -474,7 +495,7 @@ namespace LLInitParam typedef bool (*parser_read_func_t)(Parser& parser, void* output); typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); - typedef boost::function parser_inspect_func_t; + typedef std::function parser_inspect_func_t; typedef std::map parser_read_func_map_t; typedef std::map parser_write_func_map_t; @@ -491,7 +512,7 @@ namespace LLInitParam virtual ~Parser(); - template bool readValue(T& param, typename boost::disable_if >::type* dummy = 0) + template bool readValue(T& param, typename std::enable_if_t>* dummy = 0) { parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); if (found_it != mParserReadFuncs->end()) @@ -502,7 +523,7 @@ namespace LLInitParam return false; } - template bool readValue(T& param, typename boost::enable_if >::type* dummy = 0) + template bool readValue(T& param, typename std::enable_if_t >* dummy = 0) { parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); if (found_it != mParserReadFuncs->end()) diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index ada6b9519e5..1614cc6e57f 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -61,7 +61,7 @@ class LLLeapImpl: public LLLeap // Pass it a callback to our connect() method, so it can send events // from a particular LLEventPump to the plugin without having to know // this class or method name. - mListener(new LLLeapListener( + mListener(std::make_unique( [this](LLEventPump& pump, const std::string& listener) { return connect(pump, listener); })) { diff --git a/indra/llcommon/llleaplistener.h b/indra/llcommon/llleaplistener.h index cad4543d02f..f5587d1d68d 100644 --- a/indra/llcommon/llleaplistener.h +++ b/indra/llcommon/llleaplistener.h @@ -13,10 +13,9 @@ #define LL_LLLEAPLISTENER_H #include "lleventapi.h" +#include #include #include -#include -#include /// Listener class implementing LLLeap query/control operations. /// See https://jira.lindenlab.com/jira/browse/DEV-31978. @@ -31,7 +30,7 @@ class LLLeapListener: public LLEventAPI * define the signature for a function that will perform that, and make * our constructor accept such a function. */ - typedef boost::function + typedef std::function ConnectFunc; LLLeapListener(const ConnectFunc& connect); ~LLLeapListener(); diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index 62943845a58..f3615a12705 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -29,7 +29,6 @@ #include "stdtypes.h" #include "llthread.h" -#include #include "mutex.h" #include @@ -249,7 +248,7 @@ class LLMutexTrylock * The constructor handles the lock, and the destructor handles * the unlock. Instances of this class are not thread safe. */ -class LL_COMMON_API LLScopedLock : private boost::noncopyable +class LL_COMMON_API LLScopedLock { public: /** @@ -265,6 +264,12 @@ class LL_COMMON_API LLScopedLock : private boost::noncopyable */ ~LLScopedLock(); + /* + * @brief Non-copyable constructor and operator + */ + LLScopedLock(const LLScopedLock&) = delete; + LLScopedLock& operator=(const LLScopedLock&) = delete; + /** * @brief Check lock. */ diff --git a/indra/llcommon/llpounceable.h b/indra/llcommon/llpounceable.h index 0421ce966a7..e86098f20bc 100644 --- a/indra/llcommon/llpounceable.h +++ b/indra/llcommon/llpounceable.h @@ -36,13 +36,13 @@ #define LL_LLPOUNCEABLE_H #include "llsingleton.h" -#include #include -#include #include #include #include +#include + // Forward declare the user template, since we want to be able to point to it // in some of its implementation classes. template @@ -139,7 +139,7 @@ class LLPounceableQueueImpl // LLPounceable is for an LLPounceable instance on the heap or the stack. // LLPounceable is for a static LLPounceable instance. template -class LLPounceable: public boost::noncopyable +class LLPounceable { private: typedef LLPounceableTraits traits; @@ -158,9 +158,13 @@ class LLPounceable: public boost::noncopyable mEmpty(empty) {} + // Non-copyable + LLPounceable(const LLPounceable&) = delete; + LLPounceable& operator=(const LLPounceable&) = delete; + // make read access to mHeld as cheap and transparent as possible operator T () const { return mHeld; } - typename boost::remove_pointer::type operator*() const { return *mHeld; } + typename std::remove_pointer::type operator*() const { return *mHeld; } typename boost::call_traits::value_type operator->() const { return mHeld; } // uncomment 'explicit' as soon as we allow C++11 compilation /*explicit*/ operator bool() const { return bool(mHeld); } diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 912e596c3f3..670b7401338 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -457,7 +457,8 @@ class ReadPipeImpl: public LLProcess::ReadPipe ("slot", LLSD::Integer(mIndex)) ("name", whichfile(mIndex)) ("desc", mDesc) - ("eof", state == CLOSED)); + ("eof", state == CLOSED) + ("exhst", state == EXHAUSTED)); } return false; @@ -528,18 +529,9 @@ LLProcess::LLProcess(const LLSDOrParams& params): // preserve existing semantics, we promise that mAttached defaults to the // same setting as mAutokill. mAttached(params.attached.isProvided()? params.attached : params.autokill), - mPool(NULL), - mPipes(NSLOTS) + mPool(NULL) { - // Hmm, when you construct a ptr_vector with a size, it merely reserves - // space, it doesn't actually make it that big. Explicitly make it bigger. - // Because of ptr_vector's odd semantics, have to push_back(0) the right - // number of times! resize() wants to default-construct new BasePipe - // instances, which fails because it's pure virtual. But because of the - // constructor call, these push_back() calls should require no new - // allocation. - for (size_t i = 0; i < mPipes.capacity(); ++i) - mPipes.push_back(0); + mPipes.resize(NSLOTS); if (! params.validateBlock(true)) { @@ -751,11 +743,11 @@ LLProcess::LLProcess(const LLSDOrParams& params): apr_file_t* pipe(mProcess.*(members[i])); if (i == STDIN) { - mPipes.replace(i, new WritePipeImpl(desc, pipe)); + mPipes[i] = std::make_unique(desc, pipe); } else { - mPipes.replace(i, new ReadPipeImpl(desc, pipe, FILESLOT(i))); + mPipes[i] = std::make_unique(desc, pipe, FILESLOT(i)); } // Removed temporaily for Xcode 7 build tests: error was: // "error: expression with side effects will be evaluated despite @@ -1063,14 +1055,14 @@ PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) error = STRINGIZE(mDesc << " has no slot " << slot); return NULL; } - if (mPipes.is_null(slot)) + if (!mPipes[slot]) { error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a monitored pipe"); return NULL; } // Make sure we dynamic_cast in pointer domain so we can test, rather than // accepting runtime's exception. - PIPETYPE* ppipe = dynamic_cast(&mPipes[slot]); + PIPETYPE* ppipe = dynamic_cast(mPipes[slot].get()); if (! ppipe) { error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a " << typeid(PIPETYPE).name()); diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index cc2d6566fc6..0c71cfc4159 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -31,9 +31,7 @@ #include "llsdparam.h" #include "llexception.h" #include "apr_thread_proc.h" -#include #include -#include #include // std::ostream #if LL_WINDOWS @@ -67,7 +65,7 @@ typedef std::shared_ptr LLProcessPtr; * indra/llcommon/tests/llprocess_test.cpp for an example of waiting for * child-process termination in a standalone test context. */ -class LL_COMMON_API LLProcess: public boost::noncopyable +class LL_COMMON_API LLProcess { LOG_CLASS(LLProcess); public: @@ -542,6 +540,10 @@ class LL_COMMON_API LLProcess: public boost::noncopyable static std::string basename(const std::string& path); static std::string getline(std::istream&); + // Non-copyable + LLProcess(const LLProcess&) = delete; + LLProcess& operator=(const LLProcess&) = delete; + private: /// constructor is private: use create() instead LLProcess(const LLSDOrParams& params); @@ -564,7 +566,7 @@ class LL_COMMON_API LLProcess: public boost::noncopyable bool mAutokill, mAttached; Status mStatus; // explicitly want this ptr_vector to be able to store NULLs - typedef boost::ptr_vector< boost::nullable > PipeVector; + typedef std::vector> PipeVector; PipeVector mPipes; apr_pool_t* mPool; }; diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 718f4713213..0778b123eaf 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -739,32 +739,7 @@ class LLProcessorInfoDarwinImpl : public LLProcessorInfoImpl } } - // *NOTE:Mani - I didn't find any docs that assure me that machdep.cpu.feature_bits will always be - // The feature bits I think it is. Here's a test: -#ifndef LL_RELEASE_FOR_DOWNLOAD - #if defined(__i386__) && defined(__PIC__) - /* %ebx may be the PIC register. */ - #define __cpuid(level, a, b, c, d) \ - __asm__ ("xchgl\t%%ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchgl\t%%ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - #else - #define __cpuid(level, a, b, c, d) \ - __asm__ ("cpuid\n\t" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - #endif - - unsigned int eax, ebx, ecx, edx; - __cpuid(0x1, eax, ebx, ecx, edx); - if(feature_infos[0] != (S32)edx) - { - LL_WARNS() << "machdep.cpu.feature_bits doesn't match expected cpuid result!" << LL_ENDL; - } -#endif // LL_RELEASE_FOR_DOWNLOAD - + // @TODO: Audit our usage of machdep.cpu.feature_bits. uint64_t ext_feature_info = getSysctlInt64("machdep.cpu.extfeature_bits"); S32 *ext_feature_infos = (S32*)(&ext_feature_info); diff --git a/indra/llcommon/llprocinfo.h b/indra/llcommon/llprocinfo.h index 59557998127..0fc8b9dbe4a 100644 --- a/indra/llcommon/llprocinfo.h +++ b/indra/llcommon/llprocinfo.h @@ -51,10 +51,10 @@ class LL_COMMON_API LLProcInfo typedef U64 time_type; /// Relative microseconds private: - LLProcInfo(); // Not defined - ~LLProcInfo(); // Not defined - LLProcInfo(const LLProcInfo &); // Not defined - void operator=(const LLProcInfo &); // Not defined + LLProcInfo() = delete; + ~LLProcInfo() = delete; + LLProcInfo(const LLProcInfo&) = delete; + LLProcInfo& operator=(const LLProcInfo&) = delete; public: /// Get accumulated system and user CPU time in diff --git a/indra/llcommon/llptrto.cpp b/indra/llcommon/llptrto.cpp index c4528a47a7d..adf636c4d25 100644 --- a/indra/llcommon/llptrto.cpp +++ b/indra/llcommon/llptrto.cpp @@ -31,10 +31,9 @@ // associated header #include "llptrto.h" // STL headers +#include // std headers // external library headers -#include -#include // other Linden headers #include "llmemory.h" @@ -76,27 +75,27 @@ class SubBar: public Bar int main(int argc, char *argv[]) { // test LLPtrTo<> - BOOST_STATIC_ASSERT((boost::is_same::type, LLPointer >::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, LLPointer >::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, LLPointer >::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, Bar*>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, SubBar*>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, int*>::value)); + static_assert((std::is_same_v::type, LLPointer >)); + static_assert((std::is_same_v::type, LLPointer >)); + static_assert((std::is_same_v::type, LLPointer >)); + static_assert((std::is_same_v::type, Bar*>)); + static_assert((std::is_same_v::type, SubBar*>)); + static_assert((std::is_same_v::type, int*>)); // Test LLRemovePointer<>. Note that we remove both pointer variants from // each kind of type, regardless of whether the variant makes sense. - BOOST_STATIC_ASSERT((boost::is_same::type, RCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same >::type, RCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, RCSubFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same >::type, RCSubFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, TSRCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same >::type, TSRCFoo>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, Bar>::value)); - BOOST_STATIC_ASSERT((boost::is_same >::type, Bar>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, SubBar>::value)); - BOOST_STATIC_ASSERT((boost::is_same >::type, SubBar>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, int>::value)); - BOOST_STATIC_ASSERT((boost::is_same >::type, int>::value)); + static_assert((std::is_same_v::type, RCFoo>)); + static_assert((std::is_same_v >::type, RCFoo>)); + static_assert((std::is_same_v::type, RCSubFoo>)); + static_assert((std::is_same_v >::type, RCSubFoo>)); + static_assert((std::is_same_v::type, TSRCFoo>)); + static_assert((std::is_same_v >::type, TSRCFoo>)); + static_assert((std::is_same_v::type, Bar>)); + static_assert((std::is_same_v >::type, Bar>)); + static_assert((std::is_same_v::type, SubBar>)); + static_assert((std::is_same_v >::type, SubBar>)); + static_assert((std::is_same_v::type, int>)); + static_assert((std::is_same_v >::type, int>)); return 0; } diff --git a/indra/llcommon/llptrto.h b/indra/llcommon/llptrto.h index b57a1ee7f46..24e312559ef 100644 --- a/indra/llcommon/llptrto.h +++ b/indra/llcommon/llptrto.h @@ -35,8 +35,6 @@ #include "llrefcount.h" // LLRefCount #include #include -#include -#include #include // std::shared_ptr, std::unique_ptr #include @@ -58,14 +56,14 @@ struct LLPtrTo /// specialize for subclasses of LLRefCount template -struct LLPtrTo::value >::type> +struct LLPtrTo::value >::type> { typedef LLPointer type; }; /// specialize for subclasses of LLThreadSafeRefCount template -struct LLPtrTo::value >::type> +struct LLPtrTo::value >::type> { typedef LLPointer type; }; @@ -76,7 +74,7 @@ struct LLPtrTo struct LLRemovePointer { - typedef typename boost::remove_pointer::type type; + typedef typename std::remove_pointer::type type; }; /// specialize for LLPointer diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index 02d3a96fcc2..de50b8ae95e 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -117,11 +117,11 @@ class LL_COMMON_API LLQueuedThread : public LLThread virtual ~LLQueuedThread(); virtual void shutdown(); -private: // No copy constructor or copy assignment - LLQueuedThread(const LLQueuedThread&); - LLQueuedThread& operator=(const LLQueuedThread&); + LLQueuedThread(const LLQueuedThread&) = delete; + LLQueuedThread& operator=(const LLQueuedThread&) = delete; +private: virtual bool runCondition(void); virtual void run(void); virtual void startThread(void); diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 3a253d8fa62..93ca7d1d00b 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -26,7 +26,6 @@ #ifndef LLREFCOUNT_H #define LLREFCOUNT_H -#include #include #include "llatomic.h" diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index 3ae153a67c8..caaac3d7629 100644 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -30,7 +30,6 @@ // Project includes #include "llsdparam.h" #include "llsdutil.h" -#include "boost/bind.hpp" static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; @@ -43,8 +42,6 @@ static const LLSD NO_VALUE_MARKER; LLParamSDParser::LLParamSDParser() : Parser(sReadFuncs, sWriteFuncs, sInspectFuncs) { - using boost::bind; - if (sReadFuncs.empty()) { registerParserFuncs(readFlag, &LLParamSDParser::writeFlag); @@ -97,7 +94,7 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool mNameStack.clear(); setParseSilently(silent); - LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack); + LLParamSDParserUtilities::readSDValues(std::bind(&LLParamSDParser::submit, this, std::ref(block), std::placeholders::_1, std::placeholders::_2), sd, mNameStack); //readSDValues(sd, block); } @@ -276,14 +273,14 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI } else if (sd.isUndefined()) { - if (!cb.empty()) + if (cb != nullptr) { cb(NO_VALUE_MARKER, stack); } } else { - if (!cb.empty()) + if (cb != nullptr) { cb(sd, stack); } @@ -333,7 +330,7 @@ namespace LLInitParam if (!p.writeValue(mValue, name_stack_range)) { // otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack_range); + LLParamSDParserUtilities::readSDValues(std::bind(&serializeElement, std::ref(p), std::placeholders::_1, std::placeholders::_2), mValue, name_stack_range); } return true; } diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 21ebb9a2587..447ba023276 100644 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -29,14 +29,14 @@ #define LL_LLSDPARAM_H #include "llinitparam.h" -#include "boost/function.hpp" +#include #include "llfasttimer.h" struct LL_COMMON_API LLParamSDParserUtilities { static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); - typedef boost::function read_sd_cb_t; + typedef std::function read_sd_cb_t; static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack); static void readSDValues(read_sd_cb_t cb, const LLSD& sd); }; diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index b5659e053cb..3fba8602eed 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -25,7 +25,6 @@ #ifndef LLSINGLETON_H #define LLSINGLETON_H -#include #include #include #include @@ -43,11 +42,14 @@ #pragma warning(disable : 4506) // no definition for inline function #endif -class LLSingletonBase: private boost::noncopyable +class LLSingletonBase { public: class MasterList; + LLSingletonBase(const LLSingletonBase&) = delete; + LLSingletonBase& operator=(const LLSingletonBase&) = delete; + private: // All existing LLSingleton instances are tracked in this master list. typedef std::list list_t; diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index db716b1431f..7dd8256e72c 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -1234,9 +1234,9 @@ void LLStringUtilBase::getTokens(const string_type& string, std::vector > instrp; if (escapes.empty()) - instrp.reset(new LLStringUtilBaseImpl::InString(string.begin(), string.end())); + instrp = std::make_unique>(string.begin(), string.end()); else - instrp.reset(new LLStringUtilBaseImpl::InEscString(string.begin(), string.end(), escapes)); + instrp = std::make_unique>(string.begin(), string.end(), escapes); LLStringUtilBaseImpl::getTokens(*instrp, tokens, drop_delims, keep_delims, quotes); } diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 270ca400863..803bab393c2 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -51,9 +51,6 @@ #include #include #include -#include -#include -#include #include "llfasttimer.h" using namespace llsd; @@ -722,7 +719,7 @@ class Stats // Store every integer type as LLSD::Integer. template void add(const LLSD::String& name, const T& value, - typename boost::enable_if >::type* = 0) + typename std::enable_if_t >* = 0) { mStats[name] = LLSD::Integer(value); } @@ -730,7 +727,7 @@ class Stats // Store every floating-point type as LLSD::Real. template void add(const LLSD::String& name, const T& value, - typename boost::enable_if >::type* = 0) + typename std::enable_if_t >* = 0) { mStats[name] = LLSD::Real(value); } diff --git a/indra/llcommon/lltreeiterators.h b/indra/llcommon/lltreeiterators.h index cef501b9874..cc13955d2f4 100644 --- a/indra/llcommon/lltreeiterators.h +++ b/indra/llcommon/lltreeiterators.h @@ -60,10 +60,10 @@ #define LL_LLTREEITERATORS_H #include "llptrto.h" +#include #include #include #include -#include #include namespace LLTreeIter @@ -93,7 +93,7 @@ class LLBaseIter: public boost::iterator_facade::type ptr_type; /// function that advances from this node to next accepts a node pointer /// and returns another - typedef boost::function func_type; + typedef std::function func_type; typedef SELFTYPE self_type; }; @@ -330,7 +330,7 @@ class LLTreeDFSIter: public LLBaseIter, NODE> typedef typename super::ptr_type ptr_type; // The func_type is different for this: from a NODE pointer, we must // obtain a CHILDITER. - typedef boost::function func_type; + typedef std::function func_type; private: typedef std::vector list_type; public: @@ -435,7 +435,7 @@ class LLTreeDFSPostIter: public LLBaseIter, N typedef typename super::ptr_type ptr_type; // The func_type is different for this: from a NODE pointer, we must // obtain a CHILDITER. - typedef boost::function func_type; + typedef std::function func_type; private: // Upon reaching a given node in our pending list, we need to know whether // we've already pushed that node's children, so we must associate a bool @@ -574,7 +574,7 @@ class LLTreeBFSIter: public LLBaseIter, NODE> typedef typename super::ptr_type ptr_type; // The func_type is different for this: from a NODE pointer, we must // obtain a CHILDITER. - typedef boost::function func_type; + typedef std::function func_type; private: // We need a FIFO queue rather than a LIFO stack. Use a deque rather than // a vector, since vector can't implement pop_front() efficiently. diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index 33a48d970db..1d246bb70e1 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -33,7 +33,7 @@ LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedT { if (u.find("://") == std::string::npos) { - mNormalizedUri = "http://"; + mNormalizedUri = "https://"; mTmpScheme = true; } diff --git a/indra/newview/llwatchdog.cpp b/indra/llcommon/llwatchdog.cpp similarity index 81% rename from indra/newview/llwatchdog.cpp rename to indra/llcommon/llwatchdog.cpp index bf171fe954c..fa240a9ed77 100644 --- a/indra/newview/llwatchdog.cpp +++ b/indra/llcommon/llwatchdog.cpp @@ -24,8 +24,9 @@ * $/LicenseInfo$ */ +// Precompiled header +#include "linden_common.h" -#include "llviewerprecompiledheaders.h" #include "llwatchdog.h" #include "llthread.h" @@ -66,7 +67,9 @@ class LLWatchdogTimerThread : public LLThread }; // LLWatchdogEntry -LLWatchdogEntry::LLWatchdogEntry() +LLWatchdogEntry::LLWatchdogEntry(const std::string& thread_name) + : mThreadName(thread_name) + , mThreadID(LLThread::currentID()) { } @@ -88,11 +91,16 @@ void LLWatchdogEntry::stop() LLWatchdog::getInstance()->remove(this); } } +std::string LLWatchdogEntry::getThreadName() const +{ + return mThreadName + llformat(": %d", mThreadID); +} // LLWatchdogTimeout const std::string UNINIT_STRING = "uninitialized"; -LLWatchdogTimeout::LLWatchdogTimeout() : +LLWatchdogTimeout::LLWatchdogTimeout(const std::string& thread_name) : + LLWatchdogEntry(thread_name), mTimeout(0.0f), mPingState(UNINIT_STRING) { @@ -174,7 +182,7 @@ void LLWatchdog::remove(LLWatchdogEntry* e) unlockThread(); } -void LLWatchdog::init() +void LLWatchdog::init(func_t set_error_state_callback) { if (!mSuspectsAccessMutex && !mTimer) { @@ -187,6 +195,7 @@ void LLWatchdog::init() // start needs to use the mSuspectsAccessMutex mTimer->start(); } + mCreateMarkerFnc = set_error_state_callback; } void LLWatchdog::cleanup() @@ -241,7 +250,22 @@ void LLWatchdog::run() mTimer->stop(); } - LL_ERRS() << "Watchdog timer expired; assuming viewer is hung and crashing" << LL_ENDL; + // Sets error marker file + mCreateMarkerFnc(); + // Todo1: Warn user? + // Todo2: We probably want to report even if 5 seconds passed, just not error 'yet'. + std::string last_state = (*result)->getLastState(); + if (last_state.empty()) + { + LL_ERRS() << "Watchdog timer for thread " << (*result)->getThreadName() + << " expired; assuming viewer is hung and crashing" << LL_ENDL; + } + else + { + LL_ERRS() << "Watchdog timer for thread " << (*result)->getThreadName() + << " expired with state: " << last_state + << "; assuming viewer is hung and crashing" << LL_ENDL; + } } } diff --git a/indra/newview/llwatchdog.h b/indra/llcommon/llwatchdog.h similarity index 76% rename from indra/newview/llwatchdog.h rename to indra/llcommon/llwatchdog.h index 1931c582b01..fded881bb8d 100644 --- a/indra/newview/llwatchdog.h +++ b/indra/llcommon/llwatchdog.h @@ -27,18 +27,20 @@ #ifndef LL_LLTHREADWATCHDOG_H #define LL_LLTHREADWATCHDOG_H -#include - #ifndef LL_TIMER_H #include "lltimer.h" #endif +#include "llmutex.h" +#include "llsingleton.h" + +#include // LLWatchdogEntry is the interface used by the tasks that // need to be watched. class LLWatchdogEntry { public: - LLWatchdogEntry(); + LLWatchdogEntry(const std::string &thread_name); virtual ~LLWatchdogEntry(); // isAlive is accessed by the watchdog thread. @@ -48,12 +50,19 @@ class LLWatchdogEntry virtual void reset() = 0; virtual void start(); virtual void stop(); + virtual std::string getLastState() const { return std::string(); } + typedef std::thread::id id_t; + std::string getThreadName() const; + +private: + id_t mThreadID; // ID of the thread being watched + std::string mThreadName; }; class LLWatchdogTimeout : public LLWatchdogEntry { public: - LLWatchdogTimeout(); + LLWatchdogTimeout(const std::string& thread_name); virtual ~LLWatchdogTimeout(); bool isAlive() const override; @@ -65,6 +74,7 @@ class LLWatchdogTimeout : public LLWatchdogEntry void setTimeout(F32 d); void ping(std::string_view state); const std::string& getState() {return mPingState; } + std::string getLastState() const override { return mPingState; } private: LLTimer mTimer; @@ -83,10 +93,12 @@ class LLWatchdog : public LLSingleton void add(LLWatchdogEntry* e); void remove(LLWatchdogEntry* e); - void init(); + typedef std::function func_t; + void init(func_t set_error_state_callback); void run(); void cleanup(); + private: void lockThread(); void unlockThread(); @@ -96,6 +108,11 @@ class LLWatchdog : public LLSingleton LLMutex* mSuspectsAccessMutex; LLWatchdogTimerThread* mTimer; U64 mLastClockCount; + + // At the moment watchdog expects app to set markers in mCreateMarkerFnc, + // but technically can be used to set any error states or do some cleanup + // or show warnings. + func_t mCreateMarkerFnc; }; #endif // LL_LLTHREADWATCHDOG_H diff --git a/indra/llcommon/tests/lldependencies_test.cpp b/indra/llcommon/tests/lldependencies_test.cpp index 84eb41b5fea..2fea92e3b73 100644 --- a/indra/llcommon/tests/lldependencies_test.cpp +++ b/indra/llcommon/tests/lldependencies_test.cpp @@ -31,7 +31,6 @@ #include // std headers // external library headers -#include // Precompiled header #include "linden_common.h" // associated header @@ -106,8 +105,6 @@ std::ostream& operator<<(std::ostream& out, const std::set& set) /***************************************************************************** * Other helpers *****************************************************************************/ -using boost::assign::list_of; - typedef LLDependencies<> StringDeps; typedef StringDeps::KeyList StringList; @@ -165,7 +162,7 @@ namespace tut // The quick brown fox jumps over the lazy yellow dog. // (note, "The" and "the" are distinct, else this test wouldn't work) deps.add("lazy"); - ensure_equals(sorted_keys(deps), make(list_of("lazy"))); + ensure_equals(sorted_keys(deps), StringList{"lazy"}); deps.add("jumps"); ensure("found lazy", deps.get("lazy")); ensure("not found dog.", ! deps.get("dog.")); @@ -175,24 +172,23 @@ namespace tut // A change to the implementation of boost::topological_sort() would // be an acceptable reason, and you can simply update the expected // test output. - ensure_equals(sorted_keys(deps), make(list_of("lazy")("jumps"))); - deps.add("The", 0, empty, list_of("fox")("dog.")); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps" }); + deps.add("The", 0, empty, { "fox", "dog." }); // Test key accessors ensure("empty before deps for missing key", is_empty(deps.get_before_range("bogus"))); ensure("empty before deps for jumps", is_empty(deps.get_before_range("jumps"))); - ensure_equals(instance_from_range< std::set >(deps.get_before_range("The")), - make< std::set >(list_of("dog.")("fox"))); + ensure_equals(instance_from_range< std::set >(deps.get_before_range("The")), std::set{ "dog.", "fox" }); // resume building dependencies - ensure_equals(sorted_keys(deps), make(list_of("lazy")("jumps")("The"))); - deps.add("the", 0, list_of("The")); - ensure_equals(sorted_keys(deps), make(list_of("lazy")("jumps")("The")("the"))); - deps.add("fox", 0, list_of("The"), list_of("jumps")); - ensure_equals(sorted_keys(deps), make(list_of("lazy")("The")("the")("fox")("jumps"))); - deps.add("the", 0, list_of("The")); // same, see if cache works - ensure_equals(sorted_keys(deps), make(list_of("lazy")("The")("the")("fox")("jumps"))); - deps.add("jumps", 0, empty, list_of("over")); // update jumps deps - ensure_equals(sorted_keys(deps), make(list_of("lazy")("The")("the")("fox")("jumps"))); -/*==========================================================================*| + ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps", "The" }); + deps.add("the", 0, { "The" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "jumps", "The", "the" }); + deps.add("fox", 0, { "The" }, { "jumps" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" }); + deps.add("the", 0, { "The" }); // same, see if cache works + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" }); + deps.add("jumps", 0, empty, { "over" }); // update jumps deps + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps" }); + /*==========================================================================*| // It drives me nuts that this test doesn't work in the test // framework, because -- for reasons unknown -- running the test // framework on Mac OS X 10.5 Leopard and Windows XP Pro, the catch @@ -216,22 +212,21 @@ namespace tut deps.remove("over"); } |*==========================================================================*/ - deps.add("dog.", 0, list_of("yellow")("lazy")); - ensure_equals(instance_from_range< std::set >(deps.get_after_range("dog.")), - make< std::set >(list_of("lazy")("yellow"))); - ensure_equals(sorted_keys(deps), make(list_of("lazy")("The")("the")("fox")("jumps")("dog."))); - deps.add("quick", 0, list_of("The"), list_of("fox")("brown")); - ensure_equals(sorted_keys(deps), make(list_of("lazy")("The")("the")("quick")("fox")("jumps")("dog."))); - deps.add("over", 0, list_of("jumps"), list_of("yellow")("the")); - ensure_equals(sorted_keys(deps), make(list_of("lazy")("The")("quick")("fox")("jumps")("over")("the")("dog."))); - deps.add("yellow", 0, list_of("the"), list_of("lazy")); - ensure_equals(sorted_keys(deps), make(list_of("The")("quick")("fox")("jumps")("over")("the")("yellow")("lazy")("dog."))); + deps.add("dog.", 0, { "yellow", "lazy" }); + ensure_equals(instance_from_range< std::set >(deps.get_after_range("dog.")), std::set{ "lazy", "yellow" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "fox", "jumps", "dog." }); + deps.add("quick", 0, { "The" }, { "fox", "brown" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "the", "quick", "fox", "jumps", "dog." }); + deps.add("over", 0, { "jumps" }, { "yellow", "the" }); + ensure_equals(sorted_keys(deps), StringList{ "lazy", "The", "quick", "fox", "jumps", "over", "the", "dog." }); + deps.add("yellow", 0, { "the" }, { "lazy" }); + ensure_equals(sorted_keys(deps), StringList{ "The", "quick", "fox", "jumps", "over", "the", "yellow", "lazy", "dog." }); deps.add("brown"); // By now the dependencies are pretty well in place. A change to THIS // order should be viewed with suspicion. - ensure_equals(sorted_keys(deps), make(list_of("The")("quick")("brown")("fox")("jumps")("over")("the")("yellow")("lazy")("dog."))); + ensure_equals(sorted_keys(deps), StringList{ "The", "quick", "brown", "fox", "jumps", "over", "the", "yellow", "lazy", "dog." }); - StringList keys(make(list_of("The")("brown")("dog.")("fox")("jumps")("lazy")("over")("quick")("the")("yellow"))); + StringList keys(StringList{ "The", "brown", "dog.", "fox", "jumps", "lazy", "over", "quick", "the", "yellow" }); ensure_equals(instance_from_range(deps.get_key_range()), keys); #if (! defined(__GNUC__)) || (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) // This is the succinct way, works on modern compilers @@ -255,9 +250,9 @@ namespace tut typedef LLDependencies NameIndexDeps; NameIndexDeps nideps; const NameIndexDeps& const_nideps(nideps); - nideps.add("def", 2, list_of("ghi")); + nideps.add("def", 2, { "ghi" }); nideps.add("ghi", 3); - nideps.add("abc", 1, list_of("def")); + nideps.add("abc", 1, { "def" }); NameIndexDeps::range range(nideps.get_range()); ensure_equals(range.begin()->first, "abc"); ensure_equals(range.begin()->second, 1); @@ -269,20 +264,20 @@ namespace tut ensure_equals(const_iterator->first, "def"); ensure_equals(const_iterator->second, 2); // NameIndexDeps::node_range node_range(nideps.get_node_range()); -// ensure_equals(instance_from_range >(node_range), make< std::vector >(list_of(1)(2)(3))); +// ensure_equals(instance_from_range >(node_range), make< std::vector >(list_of(1,2,3))); // *node_range.begin() = 0; // *node_range.begin() = 1; NameIndexDeps::const_node_range const_node_range(const_nideps.get_node_range()); - ensure_equals(instance_from_range >(const_node_range), make< std::vector >(list_of(1)(2)(3))); + ensure_equals(instance_from_range>(const_node_range), std::vector{ 1, 2, 3 }); NameIndexDeps::const_key_range const_key_range(const_nideps.get_key_range()); - ensure_equals(instance_from_range(const_key_range), make(list_of("abc")("def")("ghi"))); + ensure_equals(instance_from_range(const_key_range), StringList{ "abc", "def", "ghi" }); NameIndexDeps::sorted_range sorted(const_nideps.sort()); NameIndexDeps::sorted_iterator sortiter(sorted.begin()); ensure_equals(sortiter->first, "ghi"); ensure_equals(sortiter->second, 3); // test all iterator-flavored versions of get_after_range() - StringList def(make(list_of("def"))); + StringList def{"def"}; ensure("empty abc before list", is_empty(nideps.get_before_range(nideps.get_range().begin()))); ensure_equals(instance_from_range(nideps.get_after_range(nideps.get_range().begin())), def); @@ -296,7 +291,6 @@ namespace tut def); // advance from "ghi" to "def", which must come after "ghi" ++sortiter; - ensure_equals(instance_from_range(const_nideps.get_after_range(sortiter)), - make(list_of("ghi"))); + ensure_equals(instance_from_range(const_nideps.get_after_range(sortiter)), StringList{ "ghi" }); } } // namespace tut diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index 44f772e3220..8b206f7b14c 100644 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 13422612d67..d3d8e54d455 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -21,7 +21,6 @@ // external library headers #include "llapr.h" #include "apr_thread_proc.h" -#include #include #include // other Linden headers @@ -126,6 +125,8 @@ void waitfor(LLProcess& proc, int timeout=60) { yield(); } + // Pump once more after the process exits to flush any final events such as EOF. + yield(0); std::string msg = "process took longer than " + std::to_string(timeout) + " seconds to terminate"; tut::ensure(msg, i < timeout); } @@ -137,6 +138,8 @@ void waitfor(LLProcess::handle h, const std::string& desc, int timeout=60) { yield(); } + // Pump once more after the process exits to flush any final events such as EOF. + yield(0); std::string msg = "process took longer than " + std::to_string(timeout) + " seconds to terminate"; tut::ensure(msg, i < timeout); } @@ -260,9 +263,12 @@ static std::string python_out(const std::string& desc, const CONTENT& script) } /// Create a temporary directory and clean it up later. -class NamedTempDir: public boost::noncopyable +class NamedTempDir { public: + NamedTempDir(const NamedTempDir&) = delete; + NamedTempDir& operator=(const NamedTempDir&) = delete; + NamedTempDir(): mPath(NamedTempFile::temp_path()), mCreated(boost::filesystem::create_directories(mPath)) @@ -1091,8 +1097,11 @@ namespace tut ensure_equals("bad child exit code", py.mPy->getStatus().mData, 0); } - struct EventListener: public boost::noncopyable + struct EventListener { + EventListener(const EventListener&) = delete; + EventListener& operator=(const EventListener&) = delete; + EventListener(LLEventPump& pump) { mConnection = @@ -1203,8 +1212,8 @@ namespace tut { set_test_name("ReadPipe \"eof\" event"); PythonProcessLauncher py(get_test_name(), - "from __future__ import print_function\n" - "print('Hello from Python!')\n"); + "import time\n" + "time.sleep(1.5)\n"); py.mParams.files.add(LLProcess::FileParam()); // stdin py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout py.launch(); diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index b18712b8e9e..7393e0087c5 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -28,13 +28,10 @@ #include "linden_common.h" -#include #include "../llstring.h" #include "StringVec.h" // must come BEFORE lltut.h #include "../test/lltut.h" -using boost::assign::list_of; - namespace tut { struct string_index @@ -763,14 +760,14 @@ namespace tut ensure_equals("only delims", LLStringUtil::getTokens(" \r\n ", " \r\n"), StringVec()); ensure_equals("sequence of delims", - LLStringUtil::getTokens(",,, one ,,,", ","), list_of("one")); + LLStringUtil::getTokens(",,, one ,,,", ","), StringVec{"one"}); // nat considers this a dubious implementation side effect, but I'd // hate to change it now... ensure_equals("noncontiguous tokens", - LLStringUtil::getTokens(", ,, , one ,,,", ","), list_of("")("")("one")); + LLStringUtil::getTokens(", ,, , one ,,,", ","), StringVec{ "", "", "one" }); ensure_equals("space-padded tokens", - LLStringUtil::getTokens(", one , two ,", ","), list_of("one")("two")); - ensure_equals("no delims", LLStringUtil::getTokens("one", ","), list_of("one")); + LLStringUtil::getTokens(", one , two ,", ","), StringVec{"one", "two"}); + ensure_equals("no delims", LLStringUtil::getTokens("one", ","), StringVec{ "one" }); } // Shorthand for verifying that getTokens() behaves the same when you @@ -817,39 +814,33 @@ namespace tut ensure_getTokens("only delims", " \r\n ", " \r\n", "", StringVec()); ensure_getTokens("sequence of delims", - ",,, one ,,,", ", ", "", list_of("one")); + ",,, one ,,,", ", ", "", StringVec{"one"}); // Note contrast with the case in the previous method ensure_getTokens("noncontiguous tokens", - ", ,, , one ,,,", ", ", "", list_of("one")); + ", ,, , one ,,,", ", ", "", StringVec{"one"}); ensure_getTokens("space-padded tokens", ", one , two ,", ", ", "", - list_of("one")("two")); - ensure_getTokens("no delims", "one", ",", "", list_of("one")); + StringVec{"one", "two"}); + ensure_getTokens("no delims", "one", ",", "", StringVec{ "one" }); // drop_delims vs. keep_delims ensure_getTokens("arithmetic", - " ab+def / xx* yy ", " ", "+-*/", - list_of("ab")("+")("def")("/")("xx")("*")("yy")); + " ab+def / xx* yy ", " ", "+-*/", { "ab", "+", "def", "/", "xx", "*", "yy" }); // quotes ensure_getTokens("no quotes", - "She said, \"Don't go.\"", " ", ",", "", - list_of("She")("said")(",")("\"Don't")("go.\"")); + "She said, \"Don't go.\"", " ", ",", "", { "She", "said", ",", "\"Don't", "go.\"" }); ensure_getTokens("quotes", - "She said, \"Don't go.\"", " ", ",", "\"", - list_of("She")("said")(",")("Don't go.")); + "She said, \"Don't go.\"", " ", ",", "\"", { "She", "said", ",", "Don't go." }); ensure_getTokens("quotes and delims", "run c:/'Documents and Settings'/someone", " ", "", "'", - list_of("run")("c:/Documents and Settings/someone")); + { "run", "c:/Documents and Settings/someone" }); ensure_getTokens("unmatched quote", - "baby don't leave", " ", "", "'", - list_of("baby")("don't")("leave")); + "baby don't leave", " ", "", "'", { "baby", "don't", "leave" }); ensure_getTokens("adjacent quoted", - "abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'", - list_of("abcdef \"ghijkl' mnopqr")); + "abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'", { "abcdef \"ghijkl' mnopqr" }); ensure_getTokens("quoted empty string", - "--set SomeVar ''", " ", "", "'", - list_of("--set")("SomeVar")("")); + "--set SomeVar ''", " ", "", "'", { "--set", "SomeVar", "" }); // escapes // Don't use backslash as an escape for these tests -- you'll go nuts @@ -857,15 +848,12 @@ namespace tut // something else! ensure_equals("escaped delims", LLStringUtil::getTokens("^ a - dog^-gone^ phrase", " ", "-", "", "^"), - list_of(" a")("-")("dog-gone phrase")); + StringVec{ " a", "-", "dog-gone phrase" }); ensure_equals("escaped quotes", LLStringUtil::getTokens("say: 'this isn^'t w^orking'.", " ", "", "'", "^"), - list_of("say:")("this isn't working.")); + StringVec{ "say:", "this isn't working." }); ensure_equals("escaped escape", - LLStringUtil::getTokens("want x^^2", " ", "", "", "^"), - list_of("want")("x^2")); - ensure_equals("escape at end", - LLStringUtil::getTokens("it's^ up there^", " ", "", "'", "^"), - list_of("it's up")("there^")); + LLStringUtil::getTokens("want x^^2", " ", "", "", "^"), StringVec{ "want", "x^2" }); + ensure_equals("escape at end", LLStringUtil::getTokens("it's^ up there^", " ", "", "'", "^"), StringVec{ "it's up", "there^" }); } } diff --git a/indra/llcommon/tests/lltreeiterators_test.cpp b/indra/llcommon/tests/lltreeiterators_test.cpp index 7a2adfd8bad..6734596d257 100644 --- a/indra/llcommon/tests/lltreeiterators_test.cpp +++ b/indra/llcommon/tests/lltreeiterators_test.cpp @@ -32,6 +32,7 @@ // STL headers // std headers +#include #include #include #include @@ -915,7 +916,7 @@ struct WalkExpected: public Expected template typename LLPtrTo::type get_B2b(const typename LLPtrTo::type& root, - const boost::function::type&)>& child_begin) + const std::function::type&)>& child_begin) { typedef typename LLPtrTo::type NodePtr; CHILDITER Bi(child_begin(root)); diff --git a/indra/llcorehttp/_httplibcurl.h b/indra/llcorehttp/_httplibcurl.h index 36319658379..58affcb7962 100644 --- a/indra/llcorehttp/_httplibcurl.h +++ b/indra/llcorehttp/_httplibcurl.h @@ -61,8 +61,8 @@ class HttpLibcurl virtual ~HttpLibcurl(); private: - HttpLibcurl(const HttpLibcurl &); // Not defined - void operator=(const HttpLibcurl &); // Not defined + HttpLibcurl(const HttpLibcurl&) = delete; + void operator=(const HttpLibcurl&) = delete; public: typedef std::shared_ptr opReqPtr_t; @@ -179,8 +179,8 @@ class HttpLibcurl ~HandleCache(); private: - HandleCache(const HandleCache &); // Not defined - void operator=(const HandleCache &); // Not defined + HandleCache(const HandleCache&) = delete; + void operator=(const HandleCache&) = delete; public: /// Allocate a curl handle for caller. May be freed using diff --git a/indra/llcorehttp/_httpoperation.h b/indra/llcorehttp/_httpoperation.h index ff7efe60e99..8412043aa5f 100644 --- a/indra/llcorehttp/_httpoperation.h +++ b/indra/llcorehttp/_httpoperation.h @@ -68,8 +68,7 @@ class HttpService; /// via queue-like interfaces that are thread compatible /// and those interfaces establish the access rules. -class HttpOperation : private boost::noncopyable, - public std::enable_shared_from_this +class HttpOperation : public std::enable_shared_from_this { public: typedef std::shared_ptr ptr_t; @@ -82,6 +81,9 @@ class HttpOperation : private boost::noncopyable, /// Threading: called by any thread. virtual ~HttpOperation(); // Use release() + // Non-copyable + HttpOperation(const HttpOperation&) = delete; + HttpOperation& operator=(const HttpOperation&) = delete; public: /// Register a reply queue and a handler for completion notifications. @@ -220,12 +222,10 @@ class HttpOpStop : public HttpOperation { public: HttpOpStop(); - virtual ~HttpOpStop(); -private: - HttpOpStop(const HttpOpStop &); // Not defined - void operator=(const HttpOpStop &); // Not defined + HttpOpStop(const HttpOpStop &) = delete; + HttpOpStop& operator=(const HttpOpStop&) = delete; public: virtual void stageFromRequest(HttpService *); @@ -242,12 +242,10 @@ class HttpOpNull : public HttpOperation { public: HttpOpNull(); - virtual ~HttpOpNull(); -private: - HttpOpNull(const HttpOpNull &); // Not defined - void operator=(const HttpOpNull &); // Not defined + HttpOpNull(const HttpOpNull&) = delete; + HttpOpNull& operator=(const HttpOpNull&) = delete; public: virtual void stageFromRequest(HttpService *); @@ -264,12 +262,10 @@ class HttpOpSpin : public HttpOperation // 0 does a hard spin in the operation // 1 does a soft spin continuously requeuing itself HttpOpSpin(int mode); - virtual ~HttpOpSpin(); -private: - HttpOpSpin(const HttpOpSpin &); // Not defined - void operator=(const HttpOpSpin &); // Not defined + HttpOpSpin(const HttpOpSpin&) = delete; + HttpOpSpin& operator=(const HttpOpSpin&) = delete; public: virtual void stageFromRequest(HttpService *); diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 081a4d9bac9..9704486791c 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -153,7 +153,7 @@ HttpOpRequest::HttpOpRequest() mPolicyRetryLimit(HTTP_RETRY_COUNT_DEFAULT), mPolicyMinRetryBackoff(HttpTime(HTTP_RETRY_BACKOFF_MIN_DEFAULT)), mPolicyMaxRetryBackoff(HttpTime(HTTP_RETRY_BACKOFF_MAX_DEFAULT)), - mCallbackSSLVerify(NULL) + mCallbackSSLVerify(nullptr) { // *NOTE: As members are added, retry initialization/cleanup // may need to be extended in @see prepareRequest(). @@ -272,7 +272,7 @@ void HttpOpRequest::visitNotifier(HttpRequest * request) response->setContentType(mReplyConType); response->setRetries(mPolicyRetries, mPolicy503Retries); - HttpResponse::TransferStats::ptr_t stats = HttpResponse::TransferStats::ptr_t(new HttpResponse::TransferStats); + HttpResponse::TransferStats::ptr_t stats = std::make_shared(); curl_easy_getinfo(mCurlHandle, CURLINFO_SIZE_DOWNLOAD, &stats->mSizeDownload); curl_easy_getinfo(mCurlHandle, CURLINFO_TOTAL_TIME, &stats->mTotalTime); @@ -964,7 +964,7 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi // Save headers in response if (! op->mReplyHeaders) { - op->mReplyHeaders = HttpHeaders::ptr_t(new HttpHeaders); + op->mReplyHeaders = std::make_shared(); } op->mReplyHeaders->append(name, value ? value : ""); } diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h index b029bc740c7..717535555cf 100644 --- a/indra/llcorehttp/_httpoprequest.h +++ b/indra/llcorehttp/_httpoprequest.h @@ -73,8 +73,8 @@ class HttpOpRequest : public HttpOperation virtual ~HttpOpRequest(); // Use release() private: - HttpOpRequest(const HttpOpRequest &); // Not defined - void operator=(const HttpOpRequest &); // Not defined + HttpOpRequest(const HttpOpRequest&) = delete; + void operator=(const HttpOpRequest&) = delete; public: enum EMethod diff --git a/indra/llcorehttp/_httpopsetget.h b/indra/llcorehttp/_httpopsetget.h index 0b927a6b717..ff8204547b7 100644 --- a/indra/llcorehttp/_httpopsetget.h +++ b/indra/llcorehttp/_httpopsetget.h @@ -60,8 +60,8 @@ class HttpOpSetGet : public HttpOperation virtual ~HttpOpSetGet(); // Use release() private: - HttpOpSetGet(const HttpOpSetGet &); // Not defined - void operator=(const HttpOpSetGet &); // Not defined + HttpOpSetGet(const HttpOpSetGet&) = delete; + void operator=(const HttpOpSetGet&) = delete; public: /// Threading: called by application thread diff --git a/indra/llcorehttp/_httppolicy.h b/indra/llcorehttp/_httppolicy.h index a074949f203..82f552176ee 100644 --- a/indra/llcorehttp/_httppolicy.h +++ b/indra/llcorehttp/_httppolicy.h @@ -56,8 +56,8 @@ class HttpPolicy virtual ~HttpPolicy(); private: - HttpPolicy(const HttpPolicy &); // Not defined - void operator=(const HttpPolicy &); // Not defined + HttpPolicy(const HttpPolicy&) = delete; + void operator=(const HttpPolicy&) = delete; public: typedef std::shared_ptr opReqPtr_t; diff --git a/indra/llcorehttp/_httppolicyclass.h b/indra/llcorehttp/_httppolicyclass.h index 32bcad4f9c4..5bf0fa1fa7e 100644 --- a/indra/llcorehttp/_httppolicyclass.h +++ b/indra/llcorehttp/_httppolicyclass.h @@ -53,7 +53,7 @@ class HttpPolicyClass ~HttpPolicyClass(); HttpPolicyClass & operator=(const HttpPolicyClass &); - HttpPolicyClass(const HttpPolicyClass &); // Not defined + HttpPolicyClass(const HttpPolicyClass &); public: HttpStatus set(HttpRequest::EPolicyOption opt, long value); diff --git a/indra/llcorehttp/_httppolicyglobal.h b/indra/llcorehttp/_httppolicyglobal.h index d9114d167f6..3840d66b221 100644 --- a/indra/llcorehttp/_httppolicyglobal.h +++ b/indra/llcorehttp/_httppolicyglobal.h @@ -55,7 +55,7 @@ class HttpPolicyGlobal HttpPolicyGlobal & operator=(const HttpPolicyGlobal &); private: - HttpPolicyGlobal(const HttpPolicyGlobal &); // Not defined + HttpPolicyGlobal(const HttpPolicyGlobal &) = delete; public: HttpStatus set(HttpRequest::EPolicyOption opt, long value); diff --git a/indra/llcorehttp/_httpreadyqueue.h b/indra/llcorehttp/_httpreadyqueue.h index 0bc07235114..04fcf25356f 100644 --- a/indra/llcorehttp/_httpreadyqueue.h +++ b/indra/llcorehttp/_httpreadyqueue.h @@ -77,8 +77,8 @@ class HttpReadyQueue : public HttpReadyQueueBase {} protected: - HttpReadyQueue(const HttpReadyQueue &); // Not defined - void operator=(const HttpReadyQueue &); // Not defined + HttpReadyQueue(const HttpReadyQueue&) = delete; + void operator=(const HttpReadyQueue&) = delete; public: diff --git a/indra/llcorehttp/_httpreplyqueue.h b/indra/llcorehttp/_httpreplyqueue.h index d8847fafb52..e1b56486918 100644 --- a/indra/llcorehttp/_httpreplyqueue.h +++ b/indra/llcorehttp/_httpreplyqueue.h @@ -30,8 +30,6 @@ #include "_refcounted.h" #include "_mutex.h" -#include "boost/noncopyable.hpp" - namespace LLCore { @@ -59,7 +57,7 @@ class HttpOperation; /// will be coded anyway so it shouldn't be too much of a /// burden. -class HttpReplyQueue : private boost::noncopyable +class HttpReplyQueue { public: @@ -69,6 +67,9 @@ class HttpReplyQueue : private boost::noncopyable HttpReplyQueue(); virtual ~HttpReplyQueue(); + HttpReplyQueue(const HttpReplyQueue&) = delete; + HttpReplyQueue& operator=(const HttpReplyQueue&) = delete; + public: typedef std::vector< opPtr_t > OpContainer; diff --git a/indra/llcorehttp/_httprequestqueue.h b/indra/llcorehttp/_httprequestqueue.h index 0823126f78b..82537c90535 100644 --- a/indra/llcorehttp/_httprequestqueue.h +++ b/indra/llcorehttp/_httprequestqueue.h @@ -57,8 +57,8 @@ class HttpRequestQueue : public LLCoreInt::RefCounted virtual ~HttpRequestQueue(); // Use release() private: - HttpRequestQueue(const HttpRequestQueue &); // Not defined - void operator=(const HttpRequestQueue &); // Not defined + HttpRequestQueue(const HttpRequestQueue&) = delete; + void operator=(const HttpRequestQueue&) = delete; public: typedef std::shared_ptr opPtr_t; diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index 5880fb7e873..a8660decc3f 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -27,7 +27,6 @@ #include "_httpservice.h" #include -#include #include "_httpoperation.h" #include "_httprequestqueue.h" diff --git a/indra/llcorehttp/_httpservice.h b/indra/llcorehttp/_httpservice.h index 13eb034f0ee..7202b496fc6 100644 --- a/indra/llcorehttp/_httpservice.h +++ b/indra/llcorehttp/_httpservice.h @@ -86,8 +86,8 @@ class HttpService virtual ~HttpService(); private: - HttpService(const HttpService &); // Not defined - void operator=(const HttpService &); // Not defined + HttpService(const HttpService&) = delete; + void operator=(const HttpService&) = delete; public: enum EState diff --git a/indra/llcorehttp/_refcounted.h b/indra/llcorehttp/_refcounted.h index 7470965a7f7..63684b5e2ca 100644 --- a/indra/llcorehttp/_refcounted.h +++ b/indra/llcorehttp/_refcounted.h @@ -31,12 +31,9 @@ #include "linden_common.h" #include "fix_macros.h" -#include #include - #include "llatomic.h" - namespace LLCoreInt { @@ -44,8 +41,9 @@ namespace LLCoreInt class RefCounted { private: - RefCounted(); // Not defined - may not be default constructed - void operator=(const RefCounted &); // Not defined + RefCounted() = delete; // may not be default constructed + RefCounted(const RefCounted&) = delete; + RefCounted& operator=(const RefCounted&) = delete; public: explicit RefCounted(bool const implicit) diff --git a/indra/llcorehttp/_thread.h b/indra/llcorehttp/_thread.h index 6c0e39cf929..93efbbedbcc 100644 --- a/indra/llcorehttp/_thread.h +++ b/indra/llcorehttp/_thread.h @@ -42,8 +42,10 @@ namespace LLCoreInt class HttpThread : public RefCounted { private: - HttpThread(); // Not defined - void operator=(const HttpThread &); // Not defined + // May not be default constructed or copied + HttpThread() = delete; + HttpThread(const HttpThread&) = delete; + void operator=(const HttpThread &) = delete; void at_exit() { diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp index 6b33661d8f3..46c03f991d5 100644 --- a/indra/llcorehttp/bufferarray.cpp +++ b/indra/llcorehttp/bufferarray.cpp @@ -57,12 +57,12 @@ class BufferArray::Block void operator delete(void *); void operator delete(void *, size_t len); + Block(const Block&) = delete; + Block& operator=(const Block&) = delete; + protected: Block(size_t len); - Block(const Block &); // Not defined - void operator=(const Block &); // Not defined - // Allocate the block with the additional space for the // buffered data at the end of the object. void * operator new(size_t len, size_t addl_len); diff --git a/indra/llcorehttp/bufferarray.h b/indra/llcorehttp/bufferarray.h index 5105dbc4f72..9abe1778ed3 100644 --- a/indra/llcorehttp/bufferarray.h +++ b/indra/llcorehttp/bufferarray.h @@ -79,8 +79,8 @@ class BufferArray : public LLCoreInt::RefCounted virtual ~BufferArray(); // Use release() private: - BufferArray(const BufferArray &); // Not defined - void operator=(const BufferArray &); // Not defined + BufferArray(const BufferArray&) = delete; + void operator=(const BufferArray&) = delete; public: // Internal magic number, may be used by unit tests. diff --git a/indra/llcorehttp/bufferstream.h b/indra/llcorehttp/bufferstream.h index 93891810aa2..ba84821df30 100644 --- a/indra/llcorehttp/bufferstream.h +++ b/indra/llcorehttp/bufferstream.h @@ -91,8 +91,8 @@ class BufferArrayStreamBuf : public std::streambuf virtual ~BufferArrayStreamBuf(); private: - BufferArrayStreamBuf(const BufferArrayStreamBuf &); // Not defined - void operator=(const BufferArrayStreamBuf &); // Not defined + BufferArrayStreamBuf(const BufferArrayStreamBuf&) = delete; + void operator=(const BufferArrayStreamBuf&) = delete; public: // Input interfaces from std::streambuf diff --git a/indra/llcorehttp/httpcommon.h b/indra/llcorehttp/httpcommon.h index 511a17e000d..1c003a0966c 100644 --- a/indra/llcorehttp/httpcommon.h +++ b/indra/llcorehttp/httpcommon.h @@ -191,7 +191,6 @@ #include "llsd.h" #include #include -#include "boost/noncopyable.hpp" namespace LLCore { @@ -297,25 +296,25 @@ struct HttpStatus HttpStatus() { - mDetails = std::shared_ptr
(new Details(LLCORE, HE_SUCCESS)); + mDetails = std::make_shared
(LLCORE, HE_SUCCESS); } HttpStatus(type_enum_t type, short status) { - mDetails = std::shared_ptr
(new Details(type, status)); + mDetails = std::make_shared
(type, status); } HttpStatus(int http_status) { - mDetails = std::shared_ptr
(new Details(http_status, - (http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR)); + mDetails = std::make_shared
(http_status, + (http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR); llassert(http_status >= 100 && http_status <= 999); } HttpStatus(int http_status, const std::string &message) { - mDetails = std::shared_ptr
(new Details(http_status, - (http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR)); + mDetails = std::make_shared
(http_status, + (http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR); llassert(http_status >= 100 && http_status <= 999); mDetails->mMessage = message; } @@ -337,7 +336,7 @@ struct HttpStatus HttpStatus & clone(const HttpStatus &rhs) { - mDetails = std::shared_ptr
(new Details(*rhs.mDetails)); + mDetails = std::make_shared
(*rhs.mDetails); return *this; } diff --git a/indra/llcorehttp/httpheaders.h b/indra/llcorehttp/httpheaders.h index a5ca7749b0a..6a03cf40839 100644 --- a/indra/llcorehttp/httpheaders.h +++ b/indra/llcorehttp/httpheaders.h @@ -74,7 +74,7 @@ namespace LLCore /// constructor is given a refcount. /// -class HttpHeaders: private boost::noncopyable +class HttpHeaders { public: typedef std::pair header_t; @@ -94,11 +94,11 @@ class HttpHeaders: private boost::noncopyable HttpHeaders(); virtual ~HttpHeaders(); // Use release() - //typedef LLCoreInt::IntrusivePtr ptr_t; -protected: + // Non-copyable + HttpHeaders(const HttpHeaders&) = delete; + HttpHeaders& operator=(const HttpHeaders&) = delete; - HttpHeaders(const HttpHeaders &); // Not defined - void operator=(const HttpHeaders &); // Not defined + //typedef LLCoreInt::IntrusivePtr ptr_t; public: // Empty the list of headers. diff --git a/indra/llcorehttp/httpoptions.h b/indra/llcorehttp/httpoptions.h index fdb277c66ef..d50c5470ae9 100644 --- a/indra/llcorehttp/httpoptions.h +++ b/indra/llcorehttp/httpoptions.h @@ -55,7 +55,7 @@ namespace LLCore /// Allocation: Refcounted, heap only. Caller of the constructor /// is given a refcount. /// -class HttpOptions : private boost::noncopyable +class HttpOptions { public: HttpOptions(); @@ -64,10 +64,9 @@ class HttpOptions : private boost::noncopyable virtual ~HttpOptions(); // Use release() -protected: - - HttpOptions(const HttpOptions &); // Not defined - void operator=(const HttpOptions &); // Not defined + // Non-copyable + HttpOptions(const HttpOptions&) = delete; + HttpOptions& operator=(const HttpOptions&) = delete; public: diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index 2aaf71f8a4f..d8fcd6a03fe 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -60,7 +60,7 @@ HttpRequest::HttpRequest() mRequestQueue = HttpRequestQueue::instanceOf(); mRequestQueue->addRef(); - mReplyQueue.reset( new HttpReplyQueue() ); + mReplyQueue = std::make_shared(); HTTPStats::instance().recordHTTPRequest(); } @@ -129,7 +129,7 @@ HttpHandle HttpRequest::setPolicyOption(EPolicyOption opt, policy_t pclass, { HttpStatus status; - HttpOpSetGet::ptr_t op(new HttpOpSetGet()); + HttpOpSetGet::ptr_t op = std::make_shared(); if (! (status = op->setupSet(opt, pclass, value))) { mLastReqStatus = status; @@ -152,7 +152,7 @@ HttpHandle HttpRequest::setPolicyOption(EPolicyOption opt, policy_t pclass, { HttpStatus status; - HttpOpSetGet::ptr_t op (new HttpOpSetGet()); + HttpOpSetGet::ptr_t op = std::make_shared(); if (! (status = op->setupSet(opt, pclass, value))) { mLastReqStatus = status; @@ -190,7 +190,7 @@ HttpHandle HttpRequest::requestGet(policy_t policy_id, LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; HttpStatus status; - HttpOpRequest::ptr_t op(new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (! (status = op->setupGet(policy_id, url, options, headers))) { mLastReqStatus = status; @@ -219,7 +219,7 @@ HttpHandle HttpRequest::requestGetByteRange(policy_t policy_id, LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; HttpStatus status; - HttpOpRequest::ptr_t op(new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (! (status = op->setupGetByteRange(policy_id, url, offset, len, options, headers))) { mLastReqStatus = status; @@ -246,7 +246,7 @@ HttpHandle HttpRequest::requestPost(policy_t policy_id, { HttpStatus status; - HttpOpRequest::ptr_t op(new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (! (status = op->setupPost(policy_id, url, body, options, headers))) { mLastReqStatus = status; @@ -273,7 +273,7 @@ HttpHandle HttpRequest::requestPut(policy_t policy_id, { HttpStatus status; - HttpOpRequest::ptr_t op (new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (! (status = op->setupPut(policy_id, url, body, options, headers))) { mLastReqStatus = status; @@ -298,7 +298,7 @@ HttpHandle HttpRequest::requestDelete(policy_t policy_id, { HttpStatus status; - HttpOpRequest::ptr_t op(new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (!(status = op->setupDelete(policy_id, url, options, headers))) { mLastReqStatus = status; @@ -324,7 +324,7 @@ HttpHandle HttpRequest::requestPatch(policy_t policy_id, { HttpStatus status; - HttpOpRequest::ptr_t op (new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (!(status = op->setupPatch(policy_id, url, body, options, headers))) { mLastReqStatus = status; @@ -349,7 +349,7 @@ HttpHandle HttpRequest::requestCopy(policy_t policy_id, { HttpStatus status; - HttpOpRequest::ptr_t op(new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (!(status = op->setupCopy(policy_id, url, options, headers))) { mLastReqStatus = status; @@ -375,7 +375,7 @@ HttpHandle HttpRequest::requestMove(policy_t policy_id, { HttpStatus status; - HttpOpRequest::ptr_t op (new HttpOpRequest()); + HttpOpRequest::ptr_t op = std::make_shared(); if (!(status = op->setupMove(policy_id, url, options, headers))) { mLastReqStatus = status; @@ -397,7 +397,7 @@ HttpHandle HttpRequest::requestNoOp(HttpHandler::ptr_t user_handler) { HttpStatus status; - HttpOperation::ptr_t op (new HttpOpNull()); + HttpOperation::ptr_t op = std::make_shared(); op->setReplyPath(mReplyQueue, user_handler); if (! (status = mRequestQueue->addOp(op))) // transfers refcount { @@ -463,7 +463,7 @@ HttpHandle HttpRequest::requestCancel(HttpHandle request, HttpHandler::ptr_t use { HttpStatus status; - HttpOperation::ptr_t op(new HttpOpCancel(request)); + HttpOperation::ptr_t op = std::make_shared(request); op->setReplyPath(mReplyQueue, user_handler); if (! (status = mRequestQueue->addOp(op))) // transfers refcount { @@ -528,7 +528,7 @@ HttpHandle HttpRequest::requestStopThread(HttpHandler::ptr_t user_handler) HttpStatus status; HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); - HttpOperation::ptr_t op(new HttpOpStop()); + HttpOperation::ptr_t op = std::make_shared(); op->setReplyPath(mReplyQueue, user_handler); if (! (status = mRequestQueue->addOp(op))) // transfers refcount { @@ -548,7 +548,7 @@ HttpHandle HttpRequest::requestSpin(int mode) HttpStatus status; HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); - HttpOperation::ptr_t op(new HttpOpSpin(mode)); + HttpOperation::ptr_t op = std::make_shared(mode); op->setReplyPath(mReplyQueue, HttpHandler::ptr_t()); if (! (status = mRequestQueue->addOp(op))) // transfers refcount { diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h index e6e051410e4..f7516f127ae 100644 --- a/indra/llcorehttp/httprequest.h +++ b/indra/llcorehttp/httprequest.h @@ -104,9 +104,9 @@ class HttpRequest /// Represents a default, catch-all policy class that guarantees /// eventual service for any HTTP request. - static const policy_t DEFAULT_POLICY_ID = 0; - static const policy_t INVALID_POLICY_ID = 0xFFFFFFFFU; - static const policy_t GLOBAL_POLICY_ID = 0xFFFFFFFEU; + static constexpr policy_t DEFAULT_POLICY_ID = 0; + static constexpr policy_t INVALID_POLICY_ID = 0xFFFFFFFFU; + static constexpr policy_t GLOBAL_POLICY_ID = 0xFFFFFFFEU; /// Create a new policy class into which requests can be made. /// @@ -237,7 +237,7 @@ class HttpRequest /// Prototype for policy based callbacks. The callback methods will be executed /// on the worker thread so no modifications should be made to the HttpHandler object. - typedef boost::function policyCallback_t; + typedef std::function policyCallback_t; /// Set a policy option for a global or class parameter at /// startup time (prior to thread start). diff --git a/indra/llcorehttp/httpresponse.h b/indra/llcorehttp/httpresponse.h index 99c8f1d2f91..ed2d76c10f7 100644 --- a/indra/llcorehttp/httpresponse.h +++ b/indra/llcorehttp/httpresponse.h @@ -65,8 +65,8 @@ class HttpResponse : public LLCoreInt::RefCounted protected: virtual ~HttpResponse(); // Use release() - HttpResponse(const HttpResponse &); // Not defined - void operator=(const HttpResponse &); // Not defined + HttpResponse(const HttpResponse&) = delete; + void operator=(const HttpResponse&) = delete; public: /// Statistics for the HTTP diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index ea33a3bb906..190539cea59 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -44,16 +44,9 @@ #include "stringize.h" #include "llstring.h" #include -#include -#include -#include #include -#include #include -using boost::assign::list_of; -using boost::assign::map_list_of; - #if LL_WINDOWS #include "lldir_win32.h" LLDir_Win32 gDirUtil; @@ -448,28 +441,28 @@ const std::string &LLDir::getUserName() const static std::string ELLPathToString(ELLPath location) { typedef std::map ELLPathMap; -#define ENT(symbol) (symbol, #symbol) - static const ELLPathMap sMap = map_list_of - ENT(LL_PATH_NONE) - ENT(LL_PATH_USER_SETTINGS) - ENT(LL_PATH_APP_SETTINGS) - ENT(LL_PATH_PER_SL_ACCOUNT) // returns/expands to blank string if we don't know the account name yet - ENT(LL_PATH_CACHE) - ENT(LL_PATH_CHARACTER) - ENT(LL_PATH_HELP) - ENT(LL_PATH_LOGS) - ENT(LL_PATH_TEMP) - ENT(LL_PATH_SKINS) - ENT(LL_PATH_TOP_SKIN) - ENT(LL_PATH_CHAT_LOGS) - ENT(LL_PATH_PER_ACCOUNT_CHAT_LOGS) - ENT(LL_PATH_USER_SKIN) - ENT(LL_PATH_LOCAL_ASSETS) - ENT(LL_PATH_EXECUTABLE) - ENT(LL_PATH_DEFAULT_SKIN) - ENT(LL_PATH_FONTS) - ENT(LL_PATH_LAST) - ; +#define ENT(symbol) { symbol, #symbol } + static const ELLPathMap sMap = { + ENT(LL_PATH_NONE), + ENT(LL_PATH_USER_SETTINGS), + ENT(LL_PATH_APP_SETTINGS), + ENT(LL_PATH_PER_SL_ACCOUNT), // returns/expands to blank string if we don't know the account name yet + ENT(LL_PATH_CACHE), + ENT(LL_PATH_CHARACTER), + ENT(LL_PATH_HELP), + ENT(LL_PATH_LOGS), + ENT(LL_PATH_TEMP), + ENT(LL_PATH_SKINS), + ENT(LL_PATH_TOP_SKIN), + ENT(LL_PATH_CHAT_LOGS), + ENT(LL_PATH_PER_ACCOUNT_CHAT_LOGS), + ENT(LL_PATH_USER_SKIN), + ENT(LL_PATH_LOCAL_ASSETS), + ENT(LL_PATH_EXECUTABLE), + ENT(LL_PATH_DEFAULT_SKIN), + ENT(LL_PATH_FONTS), + ENT(LL_PATH_LAST), + }; #undef ENT ELLPathMap::const_iterator found = sMap.find(location); @@ -725,10 +718,10 @@ std::vector LLDir::findSkinnedFilenames(const std::string& subdir, LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // Recognize subdirs that have no localization. - static const std::set sUnlocalized = list_of - ("") // top-level directory not localized - ("textures") // textures not localized - ; + static const std::set sUnlocalized = { + "", // top-level directory not localized + "textures" // textures not localized + }; LL_DEBUGS("LLDir") << "subdir '" << subdir << "', filename '" << filename << "', constraint " diff --git a/indra/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp index d7d57fa86fb..13db6fad801 100644 --- a/indra/llfilesystem/tests/lldir_test.cpp +++ b/indra/llfilesystem/tests/lldir_test.cpp @@ -34,19 +34,6 @@ #include "../test/lltut.h" #include "stringize.h" -#include - -using boost::assign::list_of; - -// We use ensure_equals(..., vec(list_of(...))) not because it's functionally -// required, but because ensure_equals() knows how to format a StringVec. -// Turns out that when ensure_equals() displays a test failure with just -// list_of("string")("another"), you see 'stringanother' vs. '("string", -// "another")'. -StringVec vec(const StringVec& v) -{ - return v; -} // For some tests, use a dummy LLDir that uses memory data instead of touching // the filesystem @@ -590,20 +577,18 @@ namespace tut // top-level directory of a skin isn't localized ensure_equals(lldir.findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS), - vec(list_of("install/skins/default/colors.xml") - ("user/skins/default/colors.xml"))); + StringVec{ "install/skins/default/colors.xml", "user/skins/default/colors.xml" }); // We should not have needed to check for skins/default/en. We should // just "know" that SKINBASE is not localized. lldir.ensure_not_checked("install/skins/default/en"); ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_default.jpeg"), - vec(list_of("install/skins/default/textures/only_default.jpeg"))); + StringVec{ "install/skins/default/textures/only_default.jpeg" }); // Nor should we have needed to check skins/default/textures/en // because textures is known not to be localized. lldir.ensure_not_checked("install/skins/default/textures/en"); - StringVec expected(vec(list_of("install/skins/default/xui/en/strings.xml") - ("user/skins/default/xui/en/strings.xml"))); + StringVec expected(StringVec{ "install/skins/default/xui/en/strings.xml", "user/skins/default/xui/en/strings.xml" }); ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS), expected); // The first time, we had to probe to find out whether xui was localized. @@ -616,23 +601,19 @@ namespace tut lldir.ensure_not_checked("install/skins/default/xui/en"); // localized subdir with "en-us" instead of "en" - ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), - vec(list_of("install/skins/default/html/en-us/welcome.html"))); + ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" }); lldir.ensure_checked("install/skins/default/html/en"); lldir.ensure_checked("install/skins/default/html/en-us"); lldir.clear_checked(); - ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), - vec(list_of("install/skins/default/html/en-us/welcome.html"))); + ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" }); lldir.ensure_not_checked("install/skins/default/html/en"); lldir.ensure_not_checked("install/skins/default/html/en-us"); - ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), - vec(list_of("install/skins/default/future/somefile.txt"))); + ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), StringVec{ "install/skins/default/future/somefile.txt" }); // Test probing for an unrecognized unlocalized future subdir. lldir.ensure_checked("install/skins/default/future/en"); lldir.clear_checked(); - ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), - vec(list_of("install/skins/default/future/somefile.txt"))); + ensure_equals(lldir.findSkinnedFilenames("future", "somefile.txt"), StringVec{ "install/skins/default/future/somefile.txt" }); // Second time it should remember that future is unlocalized. lldir.ensure_not_checked("install/skins/default/future/en"); @@ -643,8 +624,7 @@ namespace tut // make the default localization be "en" and allow "en-gb" (or // whatever) localizations, which would work much more the way you'd // expect. - ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), - vec(list_of("install/skins/default/html/en-us/welcome.html"))); + ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), StringVec{ "install/skins/default/html/en-us/welcome.html" }); /*------------------------ "default", "fr" -------------------------*/ // We start being able to distinguish localized subdirs from @@ -654,100 +634,74 @@ namespace tut // pass merge=true to request this filename in all relevant skins ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS), - vec(list_of - ("install/skins/default/xui/en/strings.xml") - ("install/skins/default/xui/fr/strings.xml") - ("user/skins/default/xui/en/strings.xml") - ("user/skins/default/xui/fr/strings.xml"))); + StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/default/xui/fr/strings.xml", + "user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml" }); // pass (or default) merge=false to request only most specific skin ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), - vec(list_of - ("user/skins/default/xui/en/strings.xml") - ("user/skins/default/xui/fr/strings.xml"))); + StringVec{ "user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml" }); // Our dummy floater.xml has a user localization (for "fr") but no // English override. This is a case in which CURRENT_SKIN nonetheless // returns paths from two different skins. ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "floater.xml"), - vec(list_of - ("install/skins/default/xui/en/floater.xml") - ("user/skins/default/xui/fr/floater.xml"))); + StringVec{ "install/skins/default/xui/en/floater.xml", "user/skins/default/xui/fr/floater.xml" }); // Our dummy newfile.xml has an English override but no user // localization. This is another case in which CURRENT_SKIN // nonetheless returns paths from two different skins. ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "newfile.xml"), - vec(list_of - ("user/skins/default/xui/en/newfile.xml") - ("install/skins/default/xui/fr/newfile.xml"))); + StringVec{ "user/skins/default/xui/en/newfile.xml", "install/skins/default/xui/fr/newfile.xml" }); ensure_equals(lldir.findSkinnedFilenames("html", "welcome.html"), - vec(list_of - ("install/skins/default/html/en-us/welcome.html") - ("install/skins/default/html/fr/welcome.html"))); + StringVec{ "install/skins/default/html/en-us/welcome.html", "install/skins/default/html/fr/welcome.html" }); /*------------------------ "default", "zh" -------------------------*/ lldir.setSkinFolder("default", "zh"); // Because strings.xml has only a "fr" override but no "zh" override // in any skin, the most localized version we can find is "en". - ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), - vec(list_of("user/skins/default/xui/en/strings.xml"))); + ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), StringVec{ "user/skins/default/xui/en/strings.xml" }); /*------------------------- "steam", "en" --------------------------*/ lldir.setSkinFolder("steam", "en"); ensure_equals(lldir.findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS), - vec(list_of - ("install/skins/default/colors.xml") - ("install/skins/steam/colors.xml") - ("user/skins/default/colors.xml") - ("user/skins/steam/colors.xml"))); + StringVec{ "install/skins/default/colors.xml", "install/skins/steam/colors.xml", "user/skins/default/colors.xml", + "user/skins/steam/colors.xml" }); ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_default.jpeg"), - vec(list_of("install/skins/default/textures/only_default.jpeg"))); + StringVec{ "install/skins/default/textures/only_default.jpeg" }); ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_steam.jpeg"), - vec(list_of("install/skins/steam/textures/only_steam.jpeg"))); + StringVec{ "install/skins/steam/textures/only_steam.jpeg" }); ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_user_default.jpeg"), - vec(list_of("user/skins/default/textures/only_user_default.jpeg"))); + StringVec{ "user/skins/default/textures/only_user_default.jpeg" }); ensure_equals(lldir.findSkinnedFilenames(LLDir::TEXTURES, "only_user_steam.jpeg"), - vec(list_of("user/skins/steam/textures/only_user_steam.jpeg"))); + StringVec{ "user/skins/steam/textures/only_user_steam.jpeg" }); // CURRENT_SKIN - ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), - vec(list_of("user/skins/steam/xui/en/strings.xml"))); + ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), StringVec{ "user/skins/steam/xui/en/strings.xml" }); // pass constraint=ALL_SKINS to request this filename in all relevant skins ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS), - vec(list_of - ("install/skins/default/xui/en/strings.xml") - ("install/skins/steam/xui/en/strings.xml") - ("user/skins/default/xui/en/strings.xml") - ("user/skins/steam/xui/en/strings.xml"))); + StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/steam/xui/en/strings.xml", + "user/skins/default/xui/en/strings.xml", "user/skins/steam/xui/en/strings.xml" }); /*------------------------- "steam", "fr" --------------------------*/ lldir.setSkinFolder("steam", "fr"); // pass CURRENT_SKIN to request only the most specialized files ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml"), - vec(list_of - ("user/skins/steam/xui/en/strings.xml") - ("user/skins/steam/xui/fr/strings.xml"))); + StringVec{ "user/skins/steam/xui/en/strings.xml", "user/skins/steam/xui/fr/strings.xml" }); // pass ALL_SKINS to request this filename in all relevant skins ensure_equals(lldir.findSkinnedFilenames(LLDir::XUI, "strings.xml", LLDir::ALL_SKINS), - vec(list_of - ("install/skins/default/xui/en/strings.xml") - ("install/skins/default/xui/fr/strings.xml") - ("install/skins/steam/xui/en/strings.xml") - ("install/skins/steam/xui/fr/strings.xml") - ("user/skins/default/xui/en/strings.xml") - ("user/skins/default/xui/fr/strings.xml") - ("user/skins/steam/xui/en/strings.xml") - ("user/skins/steam/xui/fr/strings.xml"))); + StringVec{ "install/skins/default/xui/en/strings.xml", "install/skins/default/xui/fr/strings.xml", + "install/skins/steam/xui/en/strings.xml", "install/skins/steam/xui/fr/strings.xml", + "user/skins/default/xui/en/strings.xml", "user/skins/default/xui/fr/strings.xml", + "user/skins/steam/xui/en/strings.xml", "user/skins/steam/xui/fr/strings.xml" }); } template<> template<> diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index ca8a4199e8e..35bc7065b1f 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -709,8 +709,20 @@ U8* LLImageBase::allocateData(S32 size) mData = (U8*)ll_aligned_malloc_16(size); if (!mData) { - LL_WARNS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL; - mBadBufferAllocation = true; + constexpr S32 MAX_TOLERANCE = 1024 * 1024 * 4; // 4 MB + if (size > MAX_TOLERANCE) + { + // If a big image failed to allocate, tollerate it for now. + // It's insightfull when crash logs without obvious cause are being analyzed, + // so a crash in a random location that normally is a mystery can get proper handling. + LL_WARNS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL; + } + else + { + // We are too far gone if we can't allocate a small buffer. + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL; + } } } diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index bdaef0c6534..46ab6a441eb 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -67,7 +67,7 @@ class ImageRequest LLImageDecodeThread::LLImageDecodeThread(bool /*threaded*/) : mDecodeCount(0) { - mThreadPool.reset(new LL::ThreadPool("ImageDecode", 8)); + mThreadPool = std::make_unique("ImageDecode", 8); mThreadPool->start(); } diff --git a/indra/llinventory/lllandmark.h b/indra/llinventory/lllandmark.h index 75596dc2871..75520195ec9 100644 --- a/indra/llinventory/lllandmark.h +++ b/indra/llinventory/lllandmark.h @@ -28,8 +28,8 @@ #ifndef LL_LLLANDMARK_H #define LL_LLLANDMARK_H +#include #include -#include #include "llframetimer.h" #include "lluuid.h" #include "v3dmath.h" @@ -41,7 +41,7 @@ class LLLandmark { public: // for calling back interested parties when a region handle comes back. - typedef boost::function region_handle_callback_t; + typedef std::function region_handle_callback_t; ~LLLandmark() {} diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index d7a94d61a51..031029531c2 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -598,7 +598,7 @@ bool LLSettingsBase::Validator::verify(LLSD &data, U32 flags) return false; } - if (!mVerify.empty() && !mVerify(data[mName], flags)) + if (mVerify != nullptr && !mVerify(data[mName], flags)) { LL_WARNS("SETTINGS") << "Setting '" << mName << "' fails validation." << LL_ENDL; return false; diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index bea6fdec976..20979bd98e4 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -49,8 +49,7 @@ #define SETTINGS_OVERRIDE override class LLSettingsBase : - public PTR_NAMESPACE::enable_shared_from_this, - private boost::noncopyable + public PTR_NAMESPACE::enable_shared_from_this { friend class LLEnvironment; friend class LLSettingsDay; @@ -96,7 +95,11 @@ class LLSettingsBase : typedef PTR_NAMESPACE::shared_ptr ptr_t; - virtual ~LLSettingsBase() { }; + virtual ~LLSettingsBase() = default; + + // Non-copyable + LLSettingsBase(const LLSettingsBase&) = delete; + LLSettingsBase& operator=(const LLSettingsBase&) = delete; //--------------------------------------------------------------------- virtual std::string getSettingsType() const = 0; @@ -285,7 +288,7 @@ class LLSettingsBase : public: static const U32 VALIDATION_PARTIAL; - typedef boost::function verify_pr; + typedef std::function verify_pr; Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr(), LLSD defval = LLSD()) : mName(name), @@ -430,7 +433,7 @@ class LLSettingsBlender : public PTR_NAMESPACE::enable_shared_from_this* node); ~LLVolumeOctreeListener(); - LLVolumeOctreeListener(const LLVolumeOctreeListener& rhs) - { - *this = rhs; - } - - const LLVolumeOctreeListener& operator=(const LLVolumeOctreeListener& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } + LLVolumeOctreeListener(const LLVolumeOctreeListener& rhs) = delete; + const LLVolumeOctreeListener& operator=(const LLVolumeOctreeListener& rhs) = delete; //LISTENER FUNCTIONS virtual void handleChildAddition(const LLOctreeNode* parent, LLOctreeNode* child); diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index b2757a7306d..48f613c124c 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -15,7 +15,6 @@ set(llmessage_SOURCE_FILES llassetstorage.cpp llavatarname.cpp llavatarnamecache.cpp - llblowfishcipher.cpp llbuffer.cpp llbufferstream.cpp llcachename.cpp @@ -37,7 +36,6 @@ set(llmessage_SOURCE_FILES lliopipe.cpp lliosocket.cpp llioutil.cpp - llmail.cpp llmessagebuilder.cpp llmessageconfig.cpp llmessagereader.cpp @@ -94,7 +92,6 @@ set(llmessage_HEADER_FILES llassetstorage.h llavatarname.h llavatarnamecache.h - llblowfishcipher.h llbuffer.h llbufferstream.h llcachename.h @@ -124,7 +121,6 @@ set(llmessage_HEADER_FILES lliosocket.h llioutil.h llloginflags.h - llmail.h llmessagebuilder.h llmessageconfig.h llmessagereader.h diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 9b4454a8476..ebafc53a4de 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -117,9 +117,9 @@ LLAvatarNameCache::LLAvatarNameCache() mUsePeopleAPI = true; - sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest()); - sHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()); - sHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()); + sHttpRequest = std::make_shared(); + sHttpHeaders = std::make_shared(); + sHttpOptions = std::make_shared(); sHttpPolicy = LLCore::HttpRequest::DEFAULT_POLICY_ID; } diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index fe51355207c..0ddaee2aa14 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -42,7 +42,7 @@ class LLAvatarNameCache : public LLSingleton ~LLAvatarNameCache(); public: typedef boost::signals2::signal use_display_name_signal_t; - typedef boost::function account_name_changed_callback_t; + typedef std::function account_name_changed_callback_t; // Import/export the name cache to file. bool importFile(std::istream& istr); diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp deleted file mode 100644 index 3973565e220..00000000000 --- a/indra/llmessage/llblowfishcipher.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @file llblowfishcipher.cpp - * @brief Wrapper around OpenSSL Blowfish encryption algorithm. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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 "linden_common.h" -#include "llblowfishcipher.h" -#include - - -LLBlowfishCipher::LLBlowfishCipher(const U8* secret, size_t secret_size) -: LLCipher() -{ - llassert(secret); - - mSecretSize = secret_size; - mSecret = new U8[mSecretSize]; - memcpy(mSecret, secret, mSecretSize); -} - -LLBlowfishCipher::~LLBlowfishCipher() -{ - delete [] mSecret; - mSecret = NULL; -} - -// virtual -U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) -{ - if (!src || !src_len || !dst || !dst_len) return 0; - if (src_len > dst_len) return 0; - - // OpenSSL uses "cipher contexts" to hold encryption parameters. - EVP_CIPHER_CTX *context = EVP_CIPHER_CTX_new(); - if (!context) - { - LL_WARNS() << "LLBlowfishCipher::encrypt EVP_CIPHER_CTX initiation failure" << LL_ENDL; - return 0; - } - - // We want a blowfish cyclic block chain cipher, but need to set - // the key length before we pass in a key, so call EncryptInit - // first with NULLs. - EVP_EncryptInit_ex(context, EVP_bf_cbc(), NULL, NULL, NULL); - EVP_CIPHER_CTX_set_key_length(context, (int)mSecretSize); - - // Complete initialization. Per EVP_EncryptInit man page, the - // cipher pointer must be NULL. Apparently initial_vector must - // be 8 bytes for blowfish, as this is the block size. - unsigned char initial_vector[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - EVP_EncryptInit_ex(context, NULL, NULL, mSecret, initial_vector); - - int blocksize = EVP_CIPHER_CTX_block_size(context); - int keylen = EVP_CIPHER_CTX_key_length(context); - int iv_length = EVP_CIPHER_CTX_iv_length(context); - LL_DEBUGS() << "LLBlowfishCipher blocksize " << blocksize - << " keylen " << keylen - << " iv_len " << iv_length - << LL_ENDL; - - int output_len = 0; - int temp_len = 0; - if (!EVP_EncryptUpdate(context, - dst, - &output_len, - src, - src_len)) - { - LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << LL_ENDL; - goto BF_ENCRYPT_ERROR; - } - - // There may be some final data left to encrypt if the input is - // not an exact multiple of the block size. - if (!EVP_EncryptFinal_ex(context, (unsigned char*)(dst + output_len), &temp_len)) - { - LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << LL_ENDL; - goto BF_ENCRYPT_ERROR; - } - output_len += temp_len; - - EVP_CIPHER_CTX_free(context); - return output_len; - -BF_ENCRYPT_ERROR: - EVP_CIPHER_CTX_free(context); - return 0; -} - -// virtual -U32 LLBlowfishCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) -{ - LL_ERRS() << "LLBlowfishCipher decrypt unsupported" << LL_ENDL; - return 0; -} - -// virtual -U32 LLBlowfishCipher::requiredEncryptionSpace(U32 len) const -{ - // *HACK: We know blowfish uses an 8 byte block size. - // Oddly, sometimes EVP_Encrypt produces an extra block - // if the input is an exact multiple of the block size. - // So round up. - const U32 BLOCK_SIZE = 8; - len += BLOCK_SIZE; - len -= (len % BLOCK_SIZE); - return len; -} diff --git a/indra/llmessage/llblowfishcipher.h b/indra/llmessage/llblowfishcipher.h deleted file mode 100644 index 53dc94cce98..00000000000 --- a/indra/llmessage/llblowfishcipher.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file llblowfishcipher.h - * @brief A symmetric block cipher, designed in 1993 by Bruce Schneier. - * We use it because it has an 8 byte block size, allowing encryption of - * two UUIDs and a timestamp (16x2 + 4 = 36 bytes) with only 40 bytes of - * output. AES has a block size of 32 bytes, so this would require 64 bytes. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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 LLBLOWFISHCIPHER_H -#define LLBLOWFISHCIPHER_H - -#include "llcipher.h" - - -class LLBlowfishCipher : public LLCipher -{ -public: - // Secret may be up to 56 bytes in length per Blowfish spec. - LLBlowfishCipher(const U8* secret, size_t secret_size); - virtual ~LLBlowfishCipher(); - - // See llcipher.h for documentation. - /*virtual*/ U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len); - /*virtual*/ U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len); - /*virtual*/ U32 requiredEncryptionSpace(U32 src_len) const; - -#ifdef _DEBUG - static bool testHarness(); -#endif - -private: - U8* mSecret; - size_t mSecretSize; -}; - -#endif // LL_LLCRYPTO_H diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 64f660d0ce2..56dfaef873a 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -600,7 +600,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) // This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. // The reason it is a slot is so that the legacy get() function below can bind an old callback -// and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior +// and pass it as a slot. The reason it isn't a std::function is so that trackable behavior // doesn't get lost. As a result, we have to bind the slot to a signal to call it, even when // we call it immediately. -Steve // NOTE: Even though passing first and last name is a bit of extra overhead, it eliminates the @@ -780,6 +780,7 @@ void LLCacheName::Impl::processPendingAsks() void LLCacheName::Impl::processPendingReplies() { // First call all the callbacks, because they might send messages. + // Todo: needs cleanup logic, otherwise invalid ids might stay here indefinitely for(ReplyQueue::iterator it = mReplyQueue.begin(); it != mReplyQueue.end(); ++it) { PendingReply* reply = *it; diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 8f9c02bdcac..c2b1a2f069a 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -71,8 +71,8 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, mPacketsOutID(0), mPacketsInID(in_id), mHighestPacketID(in_id), - mTimeoutCallback(NULL), - mTimeoutUserData(NULL), + mTimeoutCallback(nullptr), + mTimeoutUserData(nullptr), mTrusted(false), mbAllowTimeout(true), mbAlive(true), diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index 5c7b1c42350..0e5725baf3f 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -53,7 +53,7 @@ static const U32 DEFAULT_POOL_SIZE = 5; const U32 LLCoprocedureManager::DEFAULT_QUEUE_SIZE = 1024*512; //========================================================================= -class LLCoprocedurePool: private boost::noncopyable +class LLCoprocedurePool { public: typedef LLCoprocedureManager::CoProcedure_t CoProcedure_t; @@ -61,6 +61,10 @@ class LLCoprocedurePool: private boost::noncopyable LLCoprocedurePool(const std::string &name, size_t size, size_t queue_size); ~LLCoprocedurePool(); + // Non-copyable + LLCoprocedurePool(const LLCoprocedurePool&) = delete; + LLCoprocedurePool& operator=(const LLCoprocedurePool&) = delete; + /// Places the coprocedure on the queue for processing. /// /// @param name Is used for debugging and should identify this coroutine. @@ -151,8 +155,8 @@ LLCoprocedureManager::~LLCoprocedureManager() // Shutting down, just log it LL_WARNS() << "Exception during ~LLCoprocedureManager(): " << e.what() << LL_ENDL; } - mPropertyQueryFn.clear(); - mPropertyDefineFn.clear(); + mPropertyQueryFn = nullptr; + mPropertyDefineFn = nullptr; mPoolMap.clear(); } @@ -195,7 +199,7 @@ void LLCoprocedureManager::initializePool(const std::string &poolName, size_t qu LL_WARNS("CoProcMgr") << "LLCoprocedureManager: No setting for \"" << keyName << "\" setting pool size to default of " << size << LL_ENDL; } - poolPtr_t pool(new LLCoprocedurePool(poolName, size, queue_size)); + poolPtr_t pool = std::make_shared(poolName, size, queue_size); LL_ERRS_IF(!pool, "CoprocedureManager") << "Unable to create pool named \"" << poolName << "\" FATAL!" << LL_ENDL; bool inserted = mPoolMap.emplace(poolName, pool).second; @@ -365,7 +369,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size, s for (size_t count = 0; count < mPoolSize; ++count) { - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter( mPoolName + "Adapter", mHTTPPolicy)); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared(mPoolName + "Adapter", mHTTPPolicy); std::string pooledCoro = LLCoros::instance().launch( "LLCoprocedurePool("+mPoolName+")::coprocedureInvokerCoro", diff --git a/indra/llmessage/llcoproceduremanager.h b/indra/llmessage/llcoproceduremanager.h index 485333657ca..f6f9a5783b2 100644 --- a/indra/llmessage/llcoproceduremanager.h +++ b/indra/llmessage/llcoproceduremanager.h @@ -41,10 +41,10 @@ class LLCoprocedureManager : public LLSingleton < LLCoprocedureManager > virtual ~LLCoprocedureManager(); public: - typedef boost::function SettingQuery_t; - typedef boost::function SettingUpdate_t; + typedef std::function SettingQuery_t; + typedef std::function SettingUpdate_t; - typedef boost::function CoProcedure_t; + typedef std::function CoProcedure_t; /// Places the coprocedure on the queue for processing. /// diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 992e1457582..b24e5e4fccd 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -57,7 +57,7 @@ namespace inline bool getBoolSetting(const std::string &keyname) { - if (!mBoolSettingGet || mBoolSettingGet.empty()) + if (mBoolSettingGet == nullptr) return(false); return mBoolSettingGet(HTTP_LOGBODY_KEY); } @@ -69,7 +69,7 @@ void setPropertyMethods(BoolSettingQuery_t queryfn, BoolSettingUpdate_t updatefn mBoolSettingGet = queryfn; mBoolSettingPut = updatefn; - if (mBoolSettingPut && !mBoolSettingPut.empty()) + if (mBoolSettingPut != nullptr) { mBoolSettingPut(HTTP_LOGBODY_KEY, false, "Log the entire HTTP body in the case of an HTTP error."); } @@ -666,9 +666,9 @@ const std::string HttpCoroutineAdapter::HTTP_RESULTS_HEADERS("headers"); const std::string HttpCoroutineAdapter::HTTP_RESULTS_CONTENT("content"); const std::string HttpCoroutineAdapter::HTTP_RESULTS_RAW("raw"); -HttpCoroutineAdapter::HttpCoroutineAdapter(const std::string &name, +HttpCoroutineAdapter::HttpCoroutineAdapter(std::string name, LLCore::HttpRequest::policy_t policyId) : - mAdapterName(name), + mAdapterName(std::move(name)), mPolicyId(policyId), mYieldingHandle(LLCORE_HTTP_HANDLE_INVALID), mWeakRequest(), @@ -686,7 +686,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return postAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -723,7 +723,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); } @@ -733,7 +733,7 @@ LLSD HttpCoroutineAdapter::postRawAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); } @@ -797,7 +797,7 @@ LLSD HttpCoroutineAdapter::postJsonAndSuspend(LLCore::HttpRequest::ptr_t request LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray); @@ -846,7 +846,7 @@ LLSD HttpCoroutineAdapter::putAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return putAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -856,7 +856,7 @@ LLSD HttpCoroutineAdapter::putJsonAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray); @@ -931,7 +931,7 @@ LLSD HttpCoroutineAdapter::getAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -941,7 +941,7 @@ LLSD HttpCoroutineAdapter::getRawAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -950,7 +950,7 @@ LLSD HttpCoroutineAdapter::getJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -987,7 +987,7 @@ LLSD HttpCoroutineAdapter::deleteAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return deleteAndSuspend_(request, url, options, headers, httpHandler); } @@ -997,7 +997,7 @@ LLSD HttpCoroutineAdapter::deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t reque LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return deleteAndSuspend_(request, url, options, headers, httpHandler); } @@ -1032,7 +1032,7 @@ LLSD HttpCoroutineAdapter::patchAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); return patchAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -1070,10 +1070,10 @@ LLSD HttpCoroutineAdapter::copyAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = std::make_shared(); headers->append(HTTP_OUT_HEADER_DESTINATION, dest); return copyAndSuspend_(request, url, options, headers, httpHandler); @@ -1112,10 +1112,10 @@ LLSD HttpCoroutineAdapter::moveAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared(replyPump); if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = std::make_shared(); headers->append(HTTP_OUT_HEADER_DESTINATION, dest); return moveAndSuspend_(request, url, options, headers, httpHandler); @@ -1153,7 +1153,7 @@ LLSD HttpCoroutineAdapter::moveAndSuspend_(LLCore::HttpRequest::ptr_t &request, void HttpCoroutineAdapter::checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &headers) { if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = std::make_shared(); if (!headers->find(HTTP_OUT_HEADER_ACCEPT)) { headers->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); @@ -1236,9 +1236,9 @@ void HttpCoroutineAdapter::callbackHttpGet(const std::string &url, LLCore::HttpR /*static*/ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::string &success, const std::string &failure) { - completionCallback_t cbSuccess = (success.empty()) ? NULL : + completionCallback_t cbSuccess = (success.empty()) ? nullptr : static_cast(boost::bind(&logMessageSuccess, "HttpCoroutineAdapter", url, success)); - completionCallback_t cbFailure = (failure.empty()) ? NULL : + completionCallback_t cbFailure = (failure.empty()) ? nullptr : static_cast(boost::bind(&logMessageFail, "HttpCoroutineAdapter", url, failure)); callbackHttpGet(url, cbSuccess, cbFailure); } @@ -1247,9 +1247,9 @@ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::str void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericGetCoro", policyId)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("genericGetCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); @@ -1286,9 +1286,9 @@ void HttpCoroutineAdapter::callbackHttpPost(const std::string &url, LLCore::Http /*static*/ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &postData, const std::string &success, const std::string &failure) { - completionCallback_t cbSuccess = (success.empty()) ? NULL : + completionCallback_t cbSuccess = (success.empty()) ? nullptr : static_cast(boost::bind(&logMessageSuccess, "HttpCoroutineAdapter", url, success)); - completionCallback_t cbFailure = (failure.empty()) ? NULL : + completionCallback_t cbFailure = (failure.empty()) ? nullptr : static_cast(boost::bind(&logMessageFail, "HttpCoroutineAdapter", url, failure)); callbackHttpPost(url, postData, cbSuccess, cbFailure); @@ -1298,9 +1298,9 @@ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &p void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", policyId)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("genericPostCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); @@ -1342,9 +1342,9 @@ void HttpCoroutineAdapter::callbackHttpDel(const std::string &url, LLCore::HttpR void HttpCoroutineAdapter::trivialDelCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericDelCoro", policyId)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared("genericDelCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index 45b673b9d58..3dbfd6f00db 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -58,8 +58,8 @@ namespace LLCoreHttpUtil { /// Allow access to to the property settings methods. -typedef boost::function BoolSettingQuery_t; -typedef boost::function BoolSettingUpdate_t; +typedef std::function BoolSettingQuery_t; +typedef std::function BoolSettingUpdate_t; void setPropertyMethods(BoolSettingQuery_t queryfn, BoolSettingUpdate_t updatefn); @@ -320,7 +320,7 @@ class HttpCoroutineAdapter typedef std::shared_ptr ptr_t; typedef std::weak_ptr wptr_t; - HttpCoroutineAdapter(const std::string &name, LLCore::HttpRequest::policy_t policyId); + HttpCoroutineAdapter(std::string name, LLCore::HttpRequest::policy_t policyId); ~HttpCoroutineAdapter(); /// Execute a Post transaction on the supplied URL and yield execution of @@ -330,19 +330,19 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD postAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD postAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD postAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return postAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } LLSD postAndSuspend(LLCore::HttpRequest::ptr_t &request, @@ -350,59 +350,59 @@ class HttpCoroutineAdapter LLCore::HttpHeaders::ptr_t &headers) { return postAndSuspend(request, url, rawbody, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } LLSD postRawAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD postRawAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpHeaders::ptr_t &headers) { return postRawAndSuspend(request, url, rawbody, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, std::string fileName, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, std::string fileName, LLCore::HttpHeaders::ptr_t &headers) { return postFileAndSuspend(request, url, fileName, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, LLCore::HttpHeaders::ptr_t &headers) { return postFileAndSuspend(request, url, assetId, assetType, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } LLSD postJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD postJsonAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return postJsonAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } @@ -414,27 +414,27 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD putAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD putAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t headers) { return putAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } LLSD putJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD putJsonAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return putJsonAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } /// Execute a Get transaction on the supplied URL and yield execution of @@ -445,25 +445,25 @@ class HttpCoroutineAdapter /// LLSD getAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD getAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { return getAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + std::make_shared(), headers); } LLSD getRawAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD getRawAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { return getRawAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + std::make_shared(), headers); } @@ -473,13 +473,13 @@ class HttpCoroutineAdapter /// before being returned to the caller. LLSD getJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD getJsonAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { return getJsonAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + std::make_shared(), headers); } @@ -491,13 +491,13 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD deleteAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD deleteAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpHeaders::ptr_t headers) { return deleteAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + std::make_shared(), headers); } @@ -507,13 +507,13 @@ class HttpCoroutineAdapter /// before being returned to the caller. LLSD deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpHeaders::ptr_t headers) { return deleteJsonAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + std::make_shared(), headers); } @@ -525,14 +525,14 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD patchAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD patchAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return patchAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } /// Execute a COPY transaction on the supplied URL and yield execution of @@ -545,14 +545,14 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD copyAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const std::string dest, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD copyAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const std::string & dest, LLCore::HttpHeaders::ptr_t &headers) { return copyAndSuspend(request, url, dest, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } /// Execute a MOVE transaction on the supplied URL and yield execution of @@ -565,14 +565,14 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD moveAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const std::string dest, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = std::make_shared(), + LLCore::HttpHeaders::ptr_t headers = std::make_shared()); LLSD moveAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const std::string & dest, LLCore::HttpHeaders::ptr_t &headers) { return moveAndSuspend(request, url, dest, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + std::make_shared(), headers); } /// @@ -585,21 +585,21 @@ class HttpCoroutineAdapter /// should match this form. /// @sa callbackHttpGet /// @sa callbackHttpPost - typedef boost::function completionCallback_t; + typedef std::function completionCallback_t; - static void callbackHttpGet(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = NULL, completionCallback_t failure = NULL); - static void callbackHttpGet(const std::string &url, completionCallback_t success = NULL, completionCallback_t failure = NULL) + static void callbackHttpGet(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = nullptr, completionCallback_t failure = nullptr); + static void callbackHttpGet(const std::string &url, completionCallback_t success = nullptr, completionCallback_t failure = nullptr) { callbackHttpGet(url, LLCore::HttpRequest::DEFAULT_POLICY_ID, success, failure); } - static void callbackHttpPost(const std::string &url, LLCore::HttpRequest::policy_t policyId, const LLSD &postData, completionCallback_t success = NULL, completionCallback_t failure = NULL); - static void callbackHttpPost(const std::string &url, const LLSD &postData, completionCallback_t success = NULL, completionCallback_t failure = NULL) + static void callbackHttpPost(const std::string &url, LLCore::HttpRequest::policy_t policyId, const LLSD &postData, completionCallback_t success = nullptr, completionCallback_t failure = nullptr); + static void callbackHttpPost(const std::string &url, const LLSD &postData, completionCallback_t success = nullptr, completionCallback_t failure = nullptr) { callbackHttpPost(url, LLCore::HttpRequest::DEFAULT_POLICY_ID, postData, success, failure); } - static void callbackHttpDel(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = NULL, - completionCallback_t failure = NULL); + static void callbackHttpDel(const std::string& url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = nullptr, + completionCallback_t failure = nullptr); /// Generic Get and post routines for HTTP via coroutines. /// These static methods do all required setup for the GET or POST operation. diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 78cca47456e..e4c7deb1c59 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -35,7 +35,6 @@ #include #include #include -#include //========================================================================= namespace LLExperienceCacheImpl @@ -113,9 +112,7 @@ void LLExperienceCache::initSingleton() constexpr size_t CORO_QUEUE_SIZE = 2048; LLCoprocedureManager::instance().initializePool("ExpCache", CORO_QUEUE_SIZE); - LLCoros::instance().launch("LLExperienceCache::idleCoro", - boost::bind(&LLExperienceCache::idleCoro, this)); - + LLCoros::instance().launch("LLExperienceCache::idleCoro", LLExperienceCache::idleCoro); } void LLExperienceCache::cleanup() @@ -247,14 +244,22 @@ const LLExperienceCache::cache_t& LLExperienceCache::getCached() return mCache; } +// static because used by coroutine and can outlive the instance void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, std::string url, RequestQueue_t requests) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); //LL_INFOS("requestExperiencesCoro") << "url: " << url << LL_ENDL; LLSD result = httpAdapter->getAndSuspend(httpRequest, url); + if (sShutdown) + { + return; + } + + LLExperienceCache* self = LLExperienceCache::getInstance(); + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -266,7 +271,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap // build dummy entries for the failed requests for (RequestQueue_t::const_iterator it = requests.begin(); it != requests.end(); ++it) { - LLSD exp = get(*it); + LLSD exp = self->get(*it); //leave the properties alone if we already have a cache entry for this xp if (exp.isUndefined()) { @@ -279,7 +284,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap exp["error"] = (LLSD::Integer)status.getType(); exp[QUOTA] = DEFAULT_QUOTA; - processExperience(*it, exp); + self->processExperience(*it, exp); } return; } @@ -295,7 +300,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap LL_DEBUGS("ExperienceCache") << "Received result for " << public_key << " display '" << row[LLExperienceCache::NAME].asString() << "'" << LL_ENDL; - processExperience(public_key, row); + self->processExperience(public_key, row); } LLSD error_ids = result["error_ids"]; @@ -311,7 +316,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap exp[MISSING] = true; exp[QUOTA] = DEFAULT_QUOTA; - processExperience(id, exp); + self->processExperience(id, exp); LL_WARNS("ExperienceCache") << "LLExperienceResponder::result() error result for " << id << LL_ENDL; } @@ -320,7 +325,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap void LLExperienceCache::requestExperiences() { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -362,7 +367,7 @@ void LLExperienceCache::requestExperiences() if (mRequestQueue.empty() || (ostr.tellp() > EXP_URL_SEND_THRESHOLD)) { // request is placed in the coprocedure pool for the ExpCache cache. Throttling is done by the pool itself. LLCoprocedureManager::instance().enqueueCoprocedure("ExpCache", "RequestExperiences", - boost::bind(&LLExperienceCache::requestExperiencesCoro, this, _1, ostr.str(), requests) ); + boost::bind(&LLExperienceCache::requestExperiencesCoro, _1, ostr.str(), requests) ); ostr.str(std::string()); ostr << urlBase << "?page_size=" << PAGE_SIZE1; @@ -394,7 +399,7 @@ void LLExperienceCache::setCapabilityQuery(LLExperienceCache::CapabilityQuery_t mCapability = queryfn; } - +// static, because coro can outlive the instance void LLExperienceCache::idleCoro() { const F32 SECS_BETWEEN_REQUESTS = 0.5f; @@ -403,14 +408,15 @@ void LLExperienceCache::idleCoro() LL_INFOS("ExperienceCache") << "Launching Experience cache idle coro." << LL_ENDL; do { - if (mEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT)) + LLExperienceCache* self = LLExperienceCache::getInstance(); + if (self->mEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT)) { - eraseExpired(); + self->eraseExpired(); } - if (!mRequestQueue.empty()) + if (!self->mRequestQueue.empty()) { - requestExperiences(); + self->requestExperiences(); } llcoro::suspendUntilTimeout(SECS_BETWEEN_REQUESTS); @@ -527,7 +533,7 @@ void LLExperienceCache::get(const LLUUID& key, LLExperienceCache::ExperienceGetF fetch(key); - signal_ptr signal = signal_ptr(new callback_signal_t()); + signal_ptr signal = std::make_shared(); std::pair result = mSignalMap.insert(signal_map_t::value_type(key, signal)); if (!result.second) @@ -538,7 +544,7 @@ void LLExperienceCache::get(const LLUUID& key, LLExperienceCache::ExperienceGetF //========================================================================= void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const LLUUID& itemId, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -550,7 +556,7 @@ void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const LLUUID& itemId, std::string url, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -562,7 +568,7 @@ void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const void LLExperienceCache::fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID objectId, LLUUID itemId, std::string url, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); if (url.empty()) { @@ -600,8 +606,10 @@ void LLExperienceCache::fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCorout failure["error"] = -1; failure["message"] = "no experience"; } - if (fn && !fn.empty()) + if (fn != nullptr) + { fn(failure); + } return; } @@ -612,7 +620,7 @@ void LLExperienceCache::fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCorout //------------------------------------------------------------------------- void LLExperienceCache::findExperienceByName(const std::string text, int page, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -624,7 +632,7 @@ void LLExperienceCache::findExperienceByName(const std::string text, int page, E void LLExperienceCache::findExperienceByNameCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, std::string text, int page, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::ostringstream url; @@ -655,7 +663,7 @@ void LLExperienceCache::findExperienceByNameCoro(LLCoreHttpUtil::HttpCoroutineAd //------------------------------------------------------------------------- void LLExperienceCache::getGroupExperiences(const LLUUID &groupId, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -667,7 +675,7 @@ void LLExperienceCache::getGroupExperiences(const LLUUID &groupId, ExperienceGet void LLExperienceCache::getGroupExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID groupId, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); // search for experiences owned by the current group std::string url = mCapability("GroupExperiences"); @@ -710,7 +718,7 @@ void LLExperienceCache::setRegionExperiences(CapabilityQuery_t regioncaps, const void LLExperienceCache::regionExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, CapabilityQuery_t regioncaps, bool update, LLSD experiences, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); // search for experiences owned by the current group std::string url = regioncaps("RegionExperiences"); @@ -743,7 +751,7 @@ void LLExperienceCache::regionExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapt //------------------------------------------------------------------------- void LLExperienceCache::getExperiencePermission(const LLUUID &experienceId, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -767,7 +775,7 @@ void LLExperienceCache::getExperiencePermission(const LLUUID &experienceId, Expe void LLExperienceCache::setExperiencePermission(const LLUUID &experienceId, const std::string &permission, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -797,7 +805,7 @@ void LLExperienceCache::setExperiencePermission(const LLUUID &experienceId, cons void LLExperienceCache::forgetExperiencePermission(const LLUUID &experienceId, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -822,7 +830,7 @@ void LLExperienceCache::forgetExperiencePermission(const LLUUID &experienceId, E void LLExperienceCache::experiencePermissionCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, permissionInvoker_fn invokerfn, std::string url, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); // search for experiences owned by the current group @@ -841,7 +849,7 @@ void LLExperienceCache::experiencePermissionCoro(LLCoreHttpUtil::HttpCoroutineAd //------------------------------------------------------------------------- void LLExperienceCache::getExperienceAdmin(const LLUUID &experienceId, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -853,7 +861,7 @@ void LLExperienceCache::getExperienceAdmin(const LLUUID &experienceId, Experienc void LLExperienceCache::getExperienceAdminCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID experienceId, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string url = mCapability("IsExperienceAdmin"); if (url.empty()) @@ -873,7 +881,7 @@ void LLExperienceCache::getExperienceAdminCoro(LLCoreHttpUtil::HttpCoroutineAdap //------------------------------------------------------------------------- void LLExperienceCache::updateExperience(LLSD updateData, ExperienceGetFn_t fn) { - if (mCapability.empty()) + if (mCapability == nullptr) { LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; return; @@ -885,7 +893,7 @@ void LLExperienceCache::updateExperience(LLSD updateData, ExperienceGetFn_t fn) void LLExperienceCache::updateExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLSD updateData, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string url = mCapability("UpdateExperience"); if (url.empty()) diff --git a/indra/llmessage/llexperiencecache.h b/indra/llmessage/llexperiencecache.h index 81e904107f2..9ecdb9efca4 100644 --- a/indra/llmessage/llexperiencecache.h +++ b/indra/llmessage/llexperiencecache.h @@ -35,7 +35,7 @@ #include "llsd.h" #include "llcorehttputil.h" #include -#include +#include class LLSD; class LLUUID; @@ -46,8 +46,8 @@ class LLExperienceCache: public LLSingleton < LLExperienceCache > LLSINGLETON(LLExperienceCache); public: - typedef boost::function CapabilityQuery_t; - typedef boost::function ExperienceGetFn_t; + typedef std::function CapabilityQuery_t; + typedef std::function ExperienceGetFn_t; void setCapabilityQuery(CapabilityQuery_t queryfn); void cleanup(); @@ -108,7 +108,7 @@ class LLExperienceCache: public LLSingleton < LLExperienceCache > virtual void initSingleton() override; - typedef boost::function permissionInvoker_fn; + typedef std::function permissionInvoker_fn; // Callback types for get() typedef boost::signals2::signal < void(const LLSD &) > callback_signal_t; @@ -144,9 +144,9 @@ class LLExperienceCache: public LLSingleton < LLExperienceCache > std::string mCacheFileName; static bool sShutdown; // control for coroutines, they exist out of LLExperienceCache's scope, so they need a static control - void idleCoro(); + static void idleCoro(); void eraseExpired(); - void requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, std::string, RequestQueue_t); + static void requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, std::string, RequestQueue_t); void requestExperiences(); void fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, LLUUID, LLUUID, std::string, ExperienceGetFn_t); diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp deleted file mode 100644 index b842aeda620..00000000000 --- a/indra/llmessage/llmail.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/** - * @file llmail.cpp - * @brief smtp helper functions. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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 "linden_common.h" - -#include "llmail.h" - -#include "llwin32headers.h" -#include -#include - -#include "apr_pools.h" -#include "apr_network_io.h" - -#include "llapr.h" -#include "llbase32.h" // IM-to-email address -#include "llblowfishcipher.h" -#include "llerror.h" -#include "llhost.h" -#include "llsd.h" -#include "llstring.h" -#include "lluuid.h" -#include "net.h" - -// -// constants -// -const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096; - -static bool gMailEnabled = true; -static apr_pool_t* gMailPool; -static apr_sockaddr_t* gSockAddr; -static apr_socket_t* gMailSocket; - -bool connect_smtp(); -void disconnect_smtp(); - -//#if LL_WINDOWS -//SOCKADDR_IN gMailDstAddr, gMailSrcAddr, gMailLclAddr; -//#else -//struct sockaddr_in gMailDstAddr, gMailSrcAddr, gMailLclAddr; -//#endif - -// Define this for a super-spammy mail mode. -//#define LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND 1 - -bool connect_smtp() -{ - // Prepare an soket to talk smtp - apr_status_t status; - status = apr_socket_create( - &gMailSocket, - gSockAddr->sa.sin.sin_family, - SOCK_STREAM, - APR_PROTO_TCP, - gMailPool); - if(ll_apr_warn_status(status)) return false; - status = apr_socket_connect(gMailSocket, gSockAddr); - if(ll_apr_warn_status(status)) - { - status = apr_socket_close(gMailSocket); - ll_apr_warn_status(status); - return false; - } - return true; -} - -void disconnect_smtp() -{ - if(gMailSocket) - { - apr_status_t status = apr_socket_close(gMailSocket); - ll_apr_warn_status(status); - gMailSocket = NULL; - } -} - -// Returns true on success. -// message should NOT be SMTP escaped. -// static -bool LLMail::send( - const char* from_name, - const char* from_address, - const char* to_name, - const char* to_address, - const char* subject, - const char* message, - const LLSD& headers) -{ - std::string header = buildSMTPTransaction( - from_name, - from_address, - to_name, - to_address, - subject, - headers); - if(header.empty()) - { - return false; - } - - std::string message_str; - if(message) - { - message_str = message; - } - bool rv = send(header, message_str, to_address, from_address); - if(rv) return true; - return false; -} - -// static -void LLMail::init(const std::string& hostname, apr_pool_t* pool) -{ - gMailSocket = NULL; - if(hostname.empty() || !pool) - { - gMailPool = NULL; - gSockAddr = NULL; - } - else - { - gMailPool = pool; - - // collect all the information into a socaddr sturcture. the - // documentation is a bit unclear, but I either have to - // specify APR_UNSPEC or not specify any flags. I am not sure - // which option is better. - apr_status_t status = apr_sockaddr_info_get( - &gSockAddr, - hostname.c_str(), - APR_UNSPEC, - 25, - APR_IPV4_ADDR_OK, - gMailPool); - ll_apr_warn_status(status); - } -} - -// static -void LLMail::enable(bool mail_enabled) -{ - gMailEnabled = mail_enabled; -} - -// Test a subject line for RFC2822 compliance. -static bool valid_subject_chars(const char *subject) -{ - for (; *subject != '\0'; subject++) - { - unsigned char c = *subject; - - if (c == '\xa' || c == '\xd' || c > '\x7f') - { - return false; - } - } - - return true; -} - -// static -std::string LLMail::buildSMTPTransaction( - const char* from_name, - const char* from_address, - const char* to_name, - const char* to_address, - const char* subject, - const LLSD& headers) -{ - if(!from_address || !to_address) - { - LL_INFOS() << "send_mail build_smtp_transaction reject: missing to and/or" - << " from address." << LL_ENDL; - return std::string(); - } - if(!valid_subject_chars(subject)) - { - LL_INFOS() << "send_mail build_smtp_transaction reject: bad subject header: " - << "to=<" << to_address - << ">, from=<" << from_address << ">" - << LL_ENDL; - return std::string(); - } - std::ostringstream from_fmt; - if(from_name && from_name[0]) - { - // "My Name" - from_fmt << "\"" << from_name << "\" <" << from_address << ">"; - } - else - { - // - from_fmt << "<" << from_address << ">"; - } - std::ostringstream to_fmt; - if(to_name && to_name[0]) - { - to_fmt << "\"" << to_name << "\" <" << to_address << ">"; - } - else - { - to_fmt << "<" << to_address << ">"; - } - std::ostringstream header; - header - << "HELO lindenlab.com\r\n" - << "MAIL FROM:<" << from_address << ">\r\n" - << "RCPT TO:<" << to_address << ">\r\n" - << "DATA\r\n" - << "From: " << from_fmt.str() << "\r\n" - << "To: " << to_fmt.str() << "\r\n" - << "Subject: " << subject << "\r\n"; - - if(headers.isMap()) - { - LLSD::map_const_iterator iter = headers.beginMap(); - LLSD::map_const_iterator end = headers.endMap(); - for(; iter != end; ++iter) - { - header << (*iter).first << ": " << ((*iter).second).asString() - << "\r\n"; - } - } - - header << "\r\n"; - return header.str(); -} - -// static -bool LLMail::send( - const std::string& header, - const std::string& raw_message, - const char* from_address, - const char* to_address) -{ - if(!from_address || !to_address) - { - LL_INFOS() << "send_mail reject: missing to and/or from address." - << LL_ENDL; - return false; - } - - // remove any "." SMTP commands to prevent injection (DEV-35777) - // we don't need to worry about "\r\n.\r\n" because of the - // "\n" --> "\n\n" conversion going into rfc2822_msg below - std::string message = raw_message; - std::string bad_string = "\n.\n"; - std::string good_string = "\n..\n"; - while (1) - { - auto index = message.find(bad_string); - if (index == std::string::npos) break; - message.replace(index, bad_string.size(), good_string); - } - - // convert all "\n" into "\r\n" - std::ostringstream rfc2822_msg; - for(U32 i = 0; i < message.size(); ++i) - { - switch(message[i]) - { - case '\0': - break; - case '\n': - // *NOTE: this is kinda busted if we're fed \r\n - rfc2822_msg << "\r\n"; - break; - default: - rfc2822_msg << message[i]; - break; - } - } - - if(!gMailEnabled) - { - LL_INFOS() << "send_mail reject: mail system is disabled: to=<" - << to_address << ">, from=<" << from_address - << ">" << LL_ENDL; - // Any future interface to SMTP should return this as an - // error. --mark - return true; - } - if(!gSockAddr) - { - LL_WARNS() << "send_mail reject: mail system not initialized: to=<" - << to_address << ">, from=<" << from_address - << ">" << LL_ENDL; - return false; - } - - if(!connect_smtp()) - { - LL_WARNS() << "send_mail reject: SMTP connect failure: to=<" - << to_address << ">, from=<" << from_address - << ">" << LL_ENDL; - return false; - } - - std::ostringstream smtp_fmt; - smtp_fmt << header << rfc2822_msg.str() << "\r\n" << ".\r\n" << "QUIT\r\n"; - std::string smtp_transaction = smtp_fmt.str(); - size_t original_size = smtp_transaction.size(); - apr_size_t send_size = original_size; - apr_status_t status = apr_socket_send( - gMailSocket, - smtp_transaction.c_str(), - (apr_size_t*)&send_size); - disconnect_smtp(); - if(ll_apr_warn_status(status)) - { - LL_WARNS() << "send_mail socket failure: unable to write " - << "to=<" << to_address - << ">, from=<" << from_address << ">" - << ", bytes=" << original_size - << ", sent=" << send_size << LL_ENDL; - return false; - } - if(send_size >= LL_MAX_KNOWN_GOOD_MAIL_SIZE) - { - LL_WARNS() << "send_mail message has been shown to fail in testing " - << "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE - << " bytes. The next log about success is potentially a lie." << LL_ENDL; - } - LL_DEBUGS() << "send_mail success: " - << "to=<" << to_address - << ">, from=<" << from_address << ">" - << ", bytes=" << original_size - << ", sent=" << send_size << LL_ENDL; - -#if LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND - LL_INFOS() << rfc2822_msg.str() << LL_ENDL; -#endif - return true; -} - - -// static -std::string LLMail::encryptIMEmailAddress(const LLUUID& from_agent_id, - const LLUUID& to_agent_id, - U32 time, - const U8* secret, - size_t secret_size) -{ -#if LL_WINDOWS - return "blowfish-not-supported-on-windows"; -#else - size_t data_size = 4 + UUID_BYTES + UUID_BYTES; - // Convert input data into a binary blob - std::vector data; - data.resize(data_size); - // *NOTE: This may suffer from endian issues. Could be htolememcpy. - memcpy(&data[0], &time, 4); - memcpy(&data[4], &from_agent_id.mData[0], UUID_BYTES); - memcpy(&data[4 + UUID_BYTES], &to_agent_id.mData[0], UUID_BYTES); - - // Encrypt the blob - LLBlowfishCipher cipher(secret, secret_size); - size_t encrypted_size = cipher.requiredEncryptionSpace(data.size()); - U8* encrypted = new U8[encrypted_size]; - cipher.encrypt(&data[0], data_size, encrypted, encrypted_size); - - std::string address = LLBase32::encode(encrypted, encrypted_size); - - // Make it more pretty for humans. - LLStringUtil::toLower(address); - - delete [] encrypted; - - return address; -#endif -} diff --git a/indra/llmessage/llmail.h b/indra/llmessage/llmail.h deleted file mode 100644 index d67b89d1ea8..00000000000 --- a/indra/llmessage/llmail.h +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @file llmail.h - * @brief smtp helper functions. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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_LLMAIL_H -#define LL_LLMAIL_H - -typedef struct apr_pool_t apr_pool_t; - -#include "llsd.h" - -class LLMail -{ -public: - // if hostname is NULL, then the host is resolved as 'mail' - static void init(const std::string& hostname, apr_pool_t* pool); - - // Allow all email transmission to be disabled/enabled. - static void enable(bool mail_enabled); - - /** - * @brief send an email - * @param from_name The name of the email sender - * @param from_address The email address for the sender - * @param to_name The name of the email recipient - * @param to_address The email recipient address - * @param subject The subject of the email - * @param headers optional X-Foo headers in an llsd map. - * @return Returns true if the call succeeds, false otherwise. - * - * Results in: - * From: "from_name" - * To: "to_name" - * Subject: subject - * - * message - */ - static bool send( - const char* from_name, - const char* from_address, - const char* to_name, - const char* to_address, - const char* subject, - const char* message, - const LLSD& headers = LLSD()); - - /** - * @brief build the complete smtp transaction & header for use in an - * mail. - * - * @param from_name The name of the email sender - * @param from_address The email address for the sender - * @param to_name The name of the email recipient - * @param to_address The email recipient address - * @param subject The subject of the email - * @param headers optional X-Foo headers in an llsd map. - * @return Returns the complete SMTP transaction mail header. - */ - static std::string buildSMTPTransaction( - const char* from_name, - const char* from_address, - const char* to_name, - const char* to_address, - const char* subject, - const LLSD& headers = LLSD()); - - /** - * @brief send an email with header and body. - * - * @param header The email header. Use build_mail_header(). - * @param message The unescaped email message. - * @param from_address Used for debugging - * @param to_address Used for debugging - * @return Returns true if the message could be sent. - */ - static bool send( - const std::string& header, - const std::string& message, - const char* from_address, - const char* to_address); - - // IM-to-email sessions use a "session id" based on an encrypted - // combination of from agent_id, to agent_id, and timestamp. When - // a user replies to an email we use the from_id to determine the - // sender's name and the to_id to route the message. The address - // is encrypted to prevent users from building addresses to spoof - // IMs from other users. The timestamps allow the "sessions" to - // expire, in case one of the sessions is stolen/hijacked. - // - // indra/tools/mailglue is responsible for parsing the inbound mail. - // - // secret: binary blob passed to blowfish, max length 56 bytes - // secret_size: length of blob, in bytes - // - // Returns: "base64" encoded email local-part, with _ and - as the - // non-alphanumeric characters. This allows better compatibility - // with email systems than the default / and + extra chars. JC - static std::string encryptIMEmailAddress( - const LLUUID& from_agent_id, - const LLUUID& to_agent_id, - U32 time, - const U8* secret, - size_t secret_size); -}; - -extern const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE; - -#endif diff --git a/indra/llmessage/lltransfertargetfile.h b/indra/llmessage/lltransfertargetfile.h index 43189eb3881..cca0ea8d04b 100644 --- a/indra/llmessage/lltransfertargetfile.h +++ b/indra/llmessage/lltransfertargetfile.h @@ -37,8 +37,8 @@ class LLTransferTargetParamsFile : public LLTransferTargetParams LLTransferTargetParamsFile() : LLTransferTargetParams(LLTTT_FILE), - mCompleteCallback(NULL), - mUserData(NULL) + mCompleteCallback(nullptr), + mUserData(nullptr) {} void setFilename(const std::string& filename) { mFilename = filename; } void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; } diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index fcf853845bb..bbc2ddf4cc9 100644 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -41,8 +41,8 @@ void LLTransferTargetVFile::updateQueue(bool shutdown) LLTransferTargetParamsVFile::LLTransferTargetParamsVFile() : LLTransferTargetParams(LLTTT_VFILE), mAssetType(LLAssetType::AT_NONE), - mCompleteCallback(NULL), - mRequestDatap(NULL), + mCompleteCallback(nullptr), + mRequestDatap(nullptr), mErrCode(0) { } diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index ad1ff86807a..e2937490bab 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -913,7 +913,7 @@ LLStoredMessagePtr LLMessageSystem::getReceivedMessage() const const std::string& name = mMessageReader->getMessageName(); LLSD message = wrapReceivedTemplateData(); - return LLStoredMessagePtr(new LLStoredMessage(name, message)); + return std::make_shared(name, message); } LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const @@ -921,7 +921,7 @@ LLStoredMessagePtr LLMessageSystem::getBuiltMessage() const const std::string& name = mMessageBuilder->getMessageName(); LLSD message = wrapBuiltTemplateData(); - return LLStoredMessagePtr(new LLStoredMessage(name, message)); + return std::make_shared(name, message); } S32 LLMessageSystem::sendMessage(const LLHost &host, LLStoredMessagePtr message) @@ -1162,7 +1162,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) { LLSD message = mLLSDMessageBuilder->getMessage(); - UntrustedCallback_t cb = NULL; + UntrustedCallback_t cb = nullptr; if ((mSendReliable) && (mReliablePacketParams.mCallback)) { cb = boost::bind(mReliablePacketParams.mCallback, mReliablePacketParams.mCallbackData, _1); @@ -1359,7 +1359,7 @@ S32 LLMessageSystem::sendMessage( return 0; } - UntrustedCallback_t cb = NULL; + UntrustedCallback_t cb = nullptr; if ((mSendReliable) && (mReliablePacketParams.mCallback)) { cb = boost::bind(mReliablePacketParams.mCallback, mReliablePacketParams.mCallbackData, _1); @@ -4028,9 +4028,9 @@ void LLMessageSystem::sendUntrustedSimulatorMessageCoro(std::string url, std::st { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("untrustedSimulatorMessage", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("untrustedSimulatorMessage", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); if (url.empty()) @@ -4049,8 +4049,10 @@ void LLMessageSystem::sendUntrustedSimulatorMessageCoro(std::string url, std::st LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - if ((callback) && (!callback.empty())) + if (callback != nullptr) + { callback((status) ? LL_ERR_NOERR : LL_ERR_TCP_TIMEOUT); + } } diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 30945cac513..14cdc48a07d 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -28,6 +28,7 @@ #define LL_MESSAGE_H #include +#include #include #if LL_LINUX @@ -55,7 +56,6 @@ #include "llmessagesenderinterface.h" #include "llstoredmessage.h" -#include "boost/function.hpp" #include "llpounceable.h" #include "llcoros.h" #include LLCOROS_MUTEX_HEADER @@ -826,7 +826,7 @@ class LLMessageSystem : public LLMessageSenderInterface void receivedMessageFromTrustedSender(); private: - typedef boost::function UntrustedCallback_t; + typedef std::function UntrustedCallback_t; void sendUntrustedSimulatorMessageCoro(std::string url, std::string message, LLSD body, UntrustedCallback_t callback); diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp deleted file mode 100644 index f4a9e501ec5..00000000000 --- a/indra/llmessage/tests/llareslistener_test.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @file llareslistener_test.cpp - * @author Mark Palange - * @date 2009-02-26 - * @brief Tests of llareslistener.h. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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$ - */ - -#if LL_WINDOWS -#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally -#endif - -// Precompiled header -#include "linden_common.h" -// associated header -#include "../llareslistener.h" -// STL headers -#include -// std headers -// external library headers -#include - -// other Linden headers -#include "llsd.h" -#include "llares.h" -#include "../test/lltut.h" -#include "llevents.h" -#include "tests/wrapllerrs.h" - -/***************************************************************************** -* Dummy stuff -*****************************************************************************/ -LLAres::LLAres(): - // Simulate this much of the real LLAres constructor: we need an - // LLAresListener instance. - mListener(new LLAresListener("LLAres", this)) -{} -LLAres::~LLAres() {} -void LLAres::rewriteURI(const std::string &uri, - LLAres::UriRewriteResponder *resp) -{ - // This is the only LLAres method I chose to implement. - // The effect is that LLAres returns immediately with - // a result that is equal to the input uri. - std::vector result; - result.push_back(uri); - resp->rewriteResult(result); -} - -LLAres::QueryResponder::~QueryResponder() {} -void LLAres::QueryResponder::queryError(int) {} -void LLAres::QueryResponder::queryResult(char const*, size_t) {} -LLQueryResponder::LLQueryResponder() {} -void LLQueryResponder::queryResult(char const*, size_t) {} -void LLQueryResponder::querySuccess() {} -void LLAres::UriRewriteResponder::queryError(int) {} -void LLAres::UriRewriteResponder::querySuccess() {} -void LLAres::UriRewriteResponder::rewriteResult(const std::vector& uris) {} - -/***************************************************************************** -* TUT -*****************************************************************************/ -namespace tut -{ - struct data - { - LLAres dummyAres; - }; - typedef test_group llareslistener_group; - typedef llareslistener_group::object object; - llareslistener_group llareslistenergrp("llareslistener"); - - struct ResponseCallback - { - std::vector mURIs; - bool operator()(const LLSD& response) - { - mURIs.clear(); - for (LLSD::array_const_iterator ri(response.beginArray()), rend(response.endArray()); - ri != rend; ++ri) - { - mURIs.push_back(*ri); - } - return false; - } - }; - - template<> template<> - void object::test<1>() - { - set_test_name("test event"); - // Tests the success and failure cases, since they both use - // the same code paths in the LLAres responder. - ResponseCallback response; - std::string pumpname("trigger"); - // Since we're asking LLEventPumps to obtain() the pump by the desired - // name, it will persist beyond the current scope, so ensure we - // disconnect from it when 'response' goes away. - LLTempBoundListener temp( - LLEventPumps::instance().obtain(pumpname).listen("rewriteURIresponse", - boost::bind(&ResponseCallback::operator(), &response, _1))); - // Now build an LLSD request that will direct its response events to - // that pump. - const std::string testURI("login.bar.com"); - LLSD request; - request["op"] = "rewriteURI"; - request["uri"] = testURI; - request["reply"] = pumpname; - LLEventPumps::instance().obtain("LLAres").post(request); - ensure_equals(response.mURIs.size(), 1); - ensure_equals(response.mURIs.front(), testURI); - } - - template<> template<> - void object::test<2>() - { - set_test_name("bad op"); - WrapLLErrs capture; - LLSD request; - request["op"] = "foo"; - std::string threw = capture.catch_llerrs([&request](){ - LLEventPumps::instance().obtain("LLAres").post(request); - }); - ensure_contains("LLAresListener bad op", threw, "bad"); - } - - template<> template<> - void object::test<3>() - { - set_test_name("bad rewriteURI request"); - WrapLLErrs capture; - LLSD request; - request["op"] = "rewriteURI"; - std::string threw = capture.catch_llerrs([&request](){ - LLEventPumps::instance().obtain("LLAres").post(request); - }); - ensure_contains("LLAresListener bad req", threw, "missing"); - ensure_contains("LLAresListener bad req", threw, "reply"); - ensure_contains("LLAresListener bad req", threw, "uri"); - } - - template<> template<> - void object::test<4>() - { - set_test_name("bad rewriteURI request"); - WrapLLErrs capture; - LLSD request; - request["op"] = "rewriteURI"; - request["reply"] = "nonexistent"; - std::string threw = capture.catch_llerrs([&request](){ - LLEventPumps::instance().obtain("LLAres").post(request); - }); - ensure_contains("LLAresListener bad req", threw, "missing"); - ensure_contains("LLAresListener bad req", threw, "uri"); - ensure_does_not_contain("LLAresListener bad req", threw, "reply"); - } - - template<> template<> - void object::test<5>() - { - set_test_name("bad rewriteURI request"); - WrapLLErrs capture; - LLSD request; - request["op"] = "rewriteURI"; - request["uri"] = "foo.bar.com"; - std::string threw = capture.catch_llerrs([&request](){ - LLEventPumps::instance().obtain("LLAres").post(request); - }); - ensure_contains("LLAresListener bad req", threw, "missing"); - ensure_contains("LLAresListener bad req", threw, "reply"); - ensure_does_not_contain("LLAresListener bad req", threw, "uri"); - } -} diff --git a/indra/llmessage/tests/llcoproceduremanager_test.cpp b/indra/llmessage/tests/llcoproceduremanager_test.cpp index 4caae5f0829..0a77fd218b0 100644 --- a/indra/llmessage/tests/llcoproceduremanager_test.cpp +++ b/indra/llmessage/tests/llcoproceduremanager_test.cpp @@ -48,7 +48,7 @@ #pragma warning(disable: 4702) #endif -LLCoreHttpUtil::HttpCoroutineAdapter::HttpCoroutineAdapter(std::string const&, unsigned int) +LLCoreHttpUtil::HttpCoroutineAdapter::HttpCoroutineAdapter(std::string name, LLCore::HttpRequest::policy_t policyId) { } diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 334f1411afb..ea604ca8d7d 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -30,7 +30,6 @@ #define LL_LLPLUGINPROCESSPARENT_H #include -#include #include "llapr.h" #include "llprocess.h" diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp index b5b17c53aac..48c6ba1fa5d 100644 --- a/indra/llprimitive/llmediaentry.cpp +++ b/indra/llprimitive/llmediaentry.cpp @@ -74,7 +74,7 @@ const char* LLMediaEntry::WHITELIST_KEY = MEDIA_WHITELIST_KEY_STR; const char* LLMediaEntry::PERMS_INTERACT_KEY = MEDIA_PERMS_INTERACT_KEY_STR; const char* LLMediaEntry::PERMS_CONTROL_KEY = MEDIA_PERMS_CONTROL_KEY_STR; -#define DEFAULT_URL_PREFIX "http://" +#define DEFAULT_URL_PREFIX "https://" // Constructor(s) LLMediaEntry::LLMediaEntry() : diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index 335d809386b..8acc75b1bef 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -29,7 +29,7 @@ #include "llmodel.h" #include "llthread.h" -#include +#include #include class LLJoint; @@ -57,25 +57,25 @@ class LLModelLoader : public LLThread // Callback with loaded model data and loaded LoD // - typedef boost::function load_callback_t; + typedef std::function load_callback_t; // Function to provide joint lookup by name // (within preview avi skeleton, for example) // - typedef boost::function joint_lookup_func_t; + typedef std::function joint_lookup_func_t; // Func to load and associate material with all it's textures, // returned value is the number of textures loaded // intentionally non-const so func can modify material to // store platform-specific data // - typedef boost::function texture_load_func_t; + typedef std::function texture_load_func_t; // Callback to inform client of state changes // during loading process (errors will be reported // as state changes here as well) // - typedef boost::function state_callback_t; + typedef std::function state_callback_t; typedef enum { diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index ccff7c7a8c0..fcd287bbb39 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -10,7 +10,6 @@ include(LLImage) include(LLWindow) set(llrender_SOURCE_FILES - llatmosphere.cpp llcubemap.cpp llcubemaparray.cpp llfontbitmapcache.cpp @@ -40,7 +39,6 @@ set(llrender_SOURCE_FILES set(llrender_HEADER_FILES CMakeLists.txt - llatmosphere.h llcubemap.h llcubemaparray.h llfontgl.h diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp deleted file mode 100644 index eae5623a3cf..00000000000 --- a/indra/llrender/llatmosphere.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/** - * @file llatmosphere.cpp - * @brief LLAtmosphere integration impl - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2018, 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 "linden_common.h" - -#include "llatmosphere.h" -#include "llfasttimer.h" -#include "llsys.h" -#include "llglheaders.h" -#include "llrender.h" -#include "llshadermgr.h" -#include "llglslshader.h" - -LLAtmosphere* gAtmosphere = nullptr; - -// Values from "Reference Solar Spectral Irradiance: ASTM G-173", ETR column -// (see http://rredc.nrel.gov/solar/spectra/am1.5/ASTMG173/ASTMG173.html), -// summed and averaged in each bin (e.g. the value for 360nm is the average -// of the ASTM G-173 values for all wavelengths between 360 and 370nm). -// Values in W.m^-2. -const int kLambdaMin = 360; -const int kLambdaMax = 830; -const double kSolarIrradiance[48] = { - 1.11776, 1.14259, 1.01249, 1.14716, 1.72765, 1.73054, 1.6887, 1.61253, - 1.91198, 2.03474, 2.02042, 2.02212, 1.93377, 1.95809, 1.91686, 1.8298, - 1.8685, 1.8931, 1.85149, 1.8504, 1.8341, 1.8345, 1.8147, 1.78158, 1.7533, - 1.6965, 1.68194, 1.64654, 1.6048, 1.52143, 1.55622, 1.5113, 1.474, 1.4482, - 1.41018, 1.36775, 1.34188, 1.31429, 1.28303, 1.26758, 1.2367, 1.2082, - 1.18737, 1.14683, 1.12362, 1.1058, 1.07124, 1.04992 -}; - -// Values from http://www.iup.uni-bremen.de/gruppen/molspec/databases/ -// referencespectra/o3spectra2011/index.html for 233K, summed and averaged in -// each bin (e.g. the value for 360nm is the average of the original values -// for all wavelengths between 360 and 370nm). Values in m^2. -const double kOzoneCrossSection[48] = { - 1.18e-27, 2.182e-28, 2.818e-28, 6.636e-28, 1.527e-27, 2.763e-27, 5.52e-27, - 8.451e-27, 1.582e-26, 2.316e-26, 3.669e-26, 4.924e-26, 7.752e-26, 9.016e-26, - 1.48e-25, 1.602e-25, 2.139e-25, 2.755e-25, 3.091e-25, 3.5e-25, 4.266e-25, - 4.672e-25, 4.398e-25, 4.701e-25, 5.019e-25, 4.305e-25, 3.74e-25, 3.215e-25, - 2.662e-25, 2.238e-25, 1.852e-25, 1.473e-25, 1.209e-25, 9.423e-26, 7.455e-26, - 6.566e-26, 5.105e-26, 4.15e-26, 4.228e-26, 3.237e-26, 2.451e-26, 2.801e-26, - 2.534e-26, 1.624e-26, 1.465e-26, 2.078e-26, 1.383e-26, 7.105e-27 -}; - -// From https://en.wikipedia.org/wiki/Dobson_unit, in molecules.m^-2. -const double kDobsonUnit = 2.687e20; -// Maximum number density of ozone molecules, in m^-3 (computed so at to get -// 300 Dobson units of ozone - for this we divide 300 DU by the integral of -// the ozone density profile defined below, which is equal to 15km). -const double kMaxOzoneNumberDensity = 300.0 * kDobsonUnit / 15000.0; -const double kRayleigh = 1.24062e-6; -const double kRayleighScaleHeight = 8000.0; -const double kMieScaleHeight = 1200.0; -const double kMieAngstromAlpha = 0.0; -const double kMieAngstromBeta = 5.328e-3; -const double kMieSingleScatteringAlbedo = 0.9; -const double kGroundAlbedo = 0.1; - -AtmosphericModelSettings::AtmosphericModelSettings() - : m_skyBottomRadius(6360.0f) - , m_skyTopRadius(6420.0f) - , m_sunArcRadians(0.00045f) - , m_mieAnisotropy(0.8f) -{ - DensityLayer rayleigh_density(0.0, 1.0, -1.0 / kRayleighScaleHeight, 0.0, 0.0); - DensityLayer mie_density(0.0, 1.0, -1.0 / kMieScaleHeight, 0.0, 0.0); - - m_rayleighProfile.push_back(rayleigh_density); - m_mieProfile.push_back(mie_density); - - // Density profile increasing linearly from 0 to 1 between 10 and 25km, and - // decreasing linearly from 1 to 0 between 25 and 40km. This is an approximate - // profile from http://www.kln.ac.lk/science/Chemistry/Teaching_Resources/ - // Documents/Introduction%20to%20atmospheric%20chemistry.pdf (page 10). - m_absorptionProfile.push_back(DensityLayer(25000.0, 0.0, 0.0, 1.0 / 15000.0, -2.0 / 3.0)); - m_absorptionProfile.push_back(DensityLayer(0.0, 0.0, 0.0, -1.0 / 15000.0, 8.0 / 3.0)); -} - -AtmosphericModelSettings::AtmosphericModelSettings( - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile) -: m_skyBottomRadius(6360.0f) -, m_skyTopRadius(6420.0f) -, m_rayleighProfile(rayleighProfile) -, m_mieProfile(mieProfile) -, m_absorptionProfile(absorptionProfile) -, m_sunArcRadians(0.00045f) -, m_mieAnisotropy(0.8f) -{ -} - -AtmosphericModelSettings::AtmosphericModelSettings( - F32 skyBottomRadius, - F32 skyTopRadius, - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile, - F32 sunArcRadians, - F32 mieAniso) -: m_skyBottomRadius(skyBottomRadius) -, m_skyTopRadius(skyTopRadius) -, m_rayleighProfile(rayleighProfile) -, m_mieProfile(mieProfile) -, m_absorptionProfile(absorptionProfile) -, m_sunArcRadians(sunArcRadians) -, m_mieAnisotropy(mieAniso) -{ -} - -bool AtmosphericModelSettings::operator==(const AtmosphericModelSettings& rhs) const -{ - if (m_skyBottomRadius != rhs.m_skyBottomRadius) - { - return false; - } - - if (m_skyTopRadius != rhs.m_skyTopRadius) - { - return false; - } - - if (m_sunArcRadians != rhs.m_sunArcRadians) - { - return false; - } - - if (m_mieAnisotropy != rhs.m_mieAnisotropy) - { - return false; - } - - if (m_rayleighProfile != rhs.m_rayleighProfile) - { - return false; - } - - if (m_mieProfile != rhs.m_mieProfile) - { - return false; - } - - if (m_absorptionProfile != rhs.m_absorptionProfile) - { - return false; - } - - return true; -} - -void LLAtmosphere::initClass() -{ - if (!gAtmosphere) - { - gAtmosphere = new LLAtmosphere; - } -} - -void LLAtmosphere::cleanupClass() -{ - if(gAtmosphere) - { - delete gAtmosphere; - } - gAtmosphere = NULL; -} - -LLAtmosphere::LLAtmosphere() -{ - for (int l = kLambdaMin; l <= kLambdaMax; l += 10) - { - double lambda = static_cast(l) * 1e-3; // micro-meters - double mie = kMieAngstromBeta / kMieScaleHeight * pow(lambda, -kMieAngstromAlpha); - m_wavelengths.push_back(l); - m_solar_irradiance.push_back(kSolarIrradiance[(l - kLambdaMin) / 10]); - m_rayleigh_scattering.push_back(kRayleigh * pow(lambda, -4)); - m_mie_scattering.push_back(mie * kMieSingleScatteringAlbedo); - m_mie_extinction.push_back(mie); - m_absorption_extinction.push_back(kMaxOzoneNumberDensity * kOzoneCrossSection[(l - kLambdaMin) / 10]); - m_ground_albedo.push_back(kGroundAlbedo); - } - - AtmosphericModelSettings defaults; - configureAtmosphericModel(defaults); -} - -LLAtmosphere::~LLAtmosphere() -{ - // Cease referencing textures from atmosphere::model from our LLGLTextures wrappers for same. - if (m_transmittance) - { - m_transmittance->setTexName(0); - } - - if (m_scattering) - { - m_scattering->setTexName(0); - } - - if (m_mie_scatter_texture) - { - m_mie_scatter_texture->setTexName(0); - } -} - -bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings) -{ - // TBD - return true; -} - -LLGLTexture* LLAtmosphere::getTransmittance() -{ - if (!m_transmittance) - { - m_transmittance = new LLGLTexture; - m_transmittance->generateGLTexture(); - m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); - m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); - } - return m_transmittance; -} - -LLGLTexture* LLAtmosphere::getScattering() -{ - if (!m_scattering) - { - m_scattering = new LLGLTexture; - m_scattering->generateGLTexture(); - m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); - m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); - } - return m_scattering; -} - -LLGLTexture* LLAtmosphere::getMieScattering() -{ - if (!m_mie_scatter_texture) - { - m_mie_scatter_texture = new LLGLTexture; - m_mie_scatter_texture->generateGLTexture(); - m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); - m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); - } - return m_mie_scatter_texture; -} - -LLGLTexture* LLAtmosphere::getIlluminance() -{ - if (!m_illuminance) - { - m_illuminance = new LLGLTexture; - m_illuminance->generateGLTexture(); - m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); - m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); - } - return m_illuminance; -} diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h deleted file mode 100644 index 4b8c7d08198..00000000000 --- a/indra/llrender/llatmosphere.h +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @file llatmosphere.h - * @brief LLAtmosphere class - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2018, 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_ATMOSPHERE_H -#define LL_ATMOSPHERE_H - -#include "llglheaders.h" -#include "llgltexture.h" - -// An atmosphere layer of width 'width' (in m), and whose density is defined as -// 'exp_term' * exp('exp_scale' * h) + 'linear_term' * h + 'constant_term', -// clamped to [0,1], and where h is the altitude (in m). 'exp_term' and -// 'constant_term' are unitless, while 'exp_scale' and 'linear_term' are in -// m^-1. -class DensityLayer { - public: - DensityLayer() - : width(0.0f) - , exp_term(0.0f) - , exp_scale(0.0f) - , linear_term(0.0f) - , constant_term(0.0f) - { - } - - DensityLayer(float width, float exp_term, float exp_scale, float linear_term, float constant_term) - : width(width) - , exp_term(exp_term) - , exp_scale(exp_scale) - , linear_term(linear_term) - , constant_term(constant_term) - { - } - - bool operator==(const DensityLayer& rhs) const - { - if (width != rhs.width) - { - return false; - } - - if (exp_term != rhs.exp_term) - { - return false; - } - - if (exp_scale != rhs.exp_scale) - { - return false; - } - - if (linear_term != rhs.linear_term) - { - return false; - } - - if (constant_term != rhs.constant_term) - { - return false; - } - - return true; - } - - float width = 1024.0f; - float exp_term = 1.0f; - float exp_scale = 1.0f; - float linear_term = 1.0f; - float constant_term = 0.0f; -}; - -typedef std::vector DensityProfile; - -class AtmosphericModelSettings -{ -public: - AtmosphericModelSettings(); - - AtmosphericModelSettings( - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile); - - AtmosphericModelSettings( - F32 skyBottomRadius, - F32 skyTopRadius, - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile, - F32 sunArcRadians, - F32 mieAniso); - - bool operator==(const AtmosphericModelSettings& rhs) const; - - F32 m_skyBottomRadius; - F32 m_skyTopRadius; - DensityProfile m_rayleighProfile; - DensityProfile m_mieProfile; - DensityProfile m_absorptionProfile; - F32 m_sunArcRadians; - F32 m_mieAnisotropy; -}; - -class LLAtmosphere -{ -public: - LLAtmosphere(); - ~LLAtmosphere(); - - static void initClass(); - static void cleanupClass(); - - const LLAtmosphere& operator=(const LLAtmosphere& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } - - LLGLTexture* getTransmittance(); - LLGLTexture* getScattering(); - LLGLTexture* getMieScattering(); - LLGLTexture* getIlluminance(); - - bool configureAtmosphericModel(AtmosphericModelSettings& settings); - -protected: - LLAtmosphere(const LLAtmosphere& rhs) - { - *this = rhs; - } - - LLPointer m_transmittance; - LLPointer m_scattering; - LLPointer m_mie_scatter_texture; - LLPointer m_illuminance; - - std::vector m_wavelengths; - std::vector m_solar_irradiance; - std::vector m_rayleigh_scattering; - std::vector m_mie_scattering; - std::vector m_mie_extinction; - std::vector m_absorption_extinction; - std::vector m_ground_albedo; - - AtmosphericModelSettings m_settings; -}; - -extern LLAtmosphere* gAtmosphere; - -#endif // LL_ATMOSPHERE_H diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 24ba4d6deb4..d19825d9ca6 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -29,6 +29,7 @@ // This file contains various stuff for handling gl extensions and other gl related stuff. +#include #include #include #include @@ -230,8 +231,6 @@ void clear_glerror(); */ -#include "boost/function.hpp" - class LLGLState { public: @@ -279,7 +278,7 @@ class LLGLEnableAlphaReject : public LLGLState class LLGLEnableFunc : LLGLState { public: - LLGLEnableFunc(LLGLenum state, bool enable, boost::function func) + LLGLEnableFunc(LLGLenum state, bool enable, std::function func) : LLGLState(state, enable) { if (enable) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index e9bbdeead52..2c35a6acaec 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -511,7 +511,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev { //search from the current gpu class down to class 1 to find the most relevant shader std::stringstream fname; fname << getShaderDirPrefix(); - fname << gpu_class << "/" << filename; + fname << gpu_class << gDirUtilp->getDirDelimiter() << filename; open_file_name = fname.str(); @@ -540,7 +540,14 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev if (file == NULL) { - LL_WARNS("ShaderLoading") << "GLSL Shader file not found: " << open_file_name << LL_ENDL; + if (gDirUtilp->fileExists(open_file_name)) + { + LL_WARNS("ShaderLoading") << "GLSL Shader file failed to open: " << open_file_name << LL_ENDL; + } + else + { + LL_WARNS("ShaderLoading") << "GLSL Shader file not found: " << open_file_name << LL_ENDL; + } return 0; } @@ -857,6 +864,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev //load source if (ret) { + LL_DEBUGS("ShaderLoading") << "glCreateShader done" << LL_ENDL; glShaderSource(ret, shader_code_count, (const GLchar**)shader_code_text, NULL); error = glGetError(); @@ -871,6 +879,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev //compile source if (ret) { + LL_DEBUGS("ShaderLoading") << "glShaderSource done" << U32(ret) << LL_ENDL; glCompileShader(ret); error = glGetError(); @@ -885,6 +894,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev if (error == GL_NO_ERROR) { //check for errors + LL_DEBUGS("ShaderLoading") << "glCompileShader done" << U32(ret) << LL_ENDL; GLint success = GL_TRUE; glGetShaderiv(ret, GL_COMPILE_STATUS, &success); @@ -901,6 +911,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev } else { + LL_DEBUGS("ShaderLoading") << "loadShaderFile() completed, ret: " << U32(ret) << LL_ENDL; ret = 0; } stop_glerror(); diff --git a/indra/llrender/lluiimage.h b/indra/llrender/lluiimage.h index 7988243a89d..7dde84f295b 100644 --- a/indra/llrender/lluiimage.h +++ b/indra/llrender/lluiimage.h @@ -30,14 +30,15 @@ #include "v4color.h" #include "llpointer.h" #include "llrefcount.h" -#include "llrefcount.h" #include "llrect.h" -#include -#include #include "llinitparam.h" #include "lltexture.h" #include "llrender2dutils.h" +#include + +#include + extern const LLColor4 UI_VERTEX_COLOR; class LLUIImage : public LLRefCount @@ -119,7 +120,7 @@ namespace LLInitParam class ParamValue : public CustomParamValue { - typedef boost::add_reference::type>::type T_const_ref; + typedef std::add_lvalue_reference::type>::type T_const_ref; typedef CustomParamValue super_t; public: Optional name; diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index faaa6ba0f0e..f24d75e41d0 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -98,16 +98,8 @@ class LLVertexBuffer final : public LLRefCount U32 mEnd; }; - LLVertexBuffer(const LLVertexBuffer& rhs) - { - *this = rhs; - } - - const LLVertexBuffer& operator=(const LLVertexBuffer& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } + LLVertexBuffer(const LLVertexBuffer& rhs) = delete; + const LLVertexBuffer& operator=(const LLVertexBuffer& rhs) = delete; static void initClass(LLWindow* window); static void cleanupClass(); diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 2cd394476ee..ac8f7c2126b 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -47,6 +47,8 @@ static constexpr F32 AUTO_SCROLL_RATE_ACCEL = 120.f; static LLDefaultChildRegistry::Register t2("accordion"); +std::set LLAccordionCtrl::sPendingArrange; + LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) , mFitParent(params.fit_parent) , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString()) @@ -163,7 +165,11 @@ bool LLAccordionCtrl::postBuild() //--------------------------------------------------------------------------------- LLAccordionCtrl::~LLAccordionCtrl() { - mAccordionTabs.clear(); + if (mArrangePending) + { + sPendingArrange.erase(this); + } + mAccordionTabs.clear(); } //--------------------------------------------------------------------------------- @@ -184,7 +190,7 @@ void LLAccordionCtrl::reshape(S32 width, S32 height, bool called_from_parent) // necessary text paddings can be set via h_pad and v_pad mNoVisibleTabsHelpText->setRect(getLocalRect()); - arrange(); + scheduleArrange(); } //--------------------------------------------------------------------------------- @@ -325,7 +331,7 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab) mAccordionTabs.push_back(accordion_tab); accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLAccordionCtrl::onCollapseCtrlCloseOpen, this, (S16)(mAccordionTabs.size() - 1)) ); - arrange(); + scheduleArrange(); } void LLAccordionCtrl::removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab) @@ -682,8 +688,9 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) std::string str_action = info["action"]; if (str_action == "size_changes") { - // - arrange(); + // Multiple children can request an arrange, + // but only need to do it once so schedule it for later. + scheduleArrange(); return 1; } if (str_action == "select_next") @@ -925,3 +932,25 @@ void LLAccordionCtrl::collapseAllTabs() arrange(); } } + +void LLAccordionCtrl::scheduleArrange() +{ + if (!mArrangePending) + { + mArrangePending = true; + sPendingArrange.insert(this); + } +} + +void LLAccordionCtrl::updateClass() +{ + for (LLAccordionCtrl* inst : sPendingArrange) + { + if (inst) + { + inst->mArrangePending = false; + inst->arrange(); + } + } + sPendingArrange.clear(); +} diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 43a33a2b3ca..c7bb8bc9ff7 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -142,6 +142,9 @@ class LLAccordionCtrl: public LLPanel void setSkipScrollToChild(bool skip) { mSkipScrollToChild = skip; } + void scheduleArrange(); + static void updateClass(); + private: void initNoTabsWidget(const LLTextBox::Params& tb_params); void updateNoTabsHelpTextVisibility(); @@ -188,12 +191,15 @@ class LLAccordionCtrl: public LLPanel LLTextBox* mNoVisibleTabsHelpText = nullptr; bool mSkipScrollToChild = false; + bool mArrangePending = false; std::string mNoMatchedTabsOrigString; std::string mNoVisibleTabsOrigString; LLAccordionCtrlTab* mSelectedTab = nullptr; const LLTabComparator* mTabComparator = nullptr; + + static std::set sPendingArrange; }; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index d2534b3939e..0048c44189a 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -190,7 +190,7 @@ LLButton::LLButton(const LLButton::Params& p) // Note: flashing should be allowed in settings.xml (boolean key "EnableButtonFlashing"). S32 flash_count = p.button_flash_count.isProvided()? p.button_flash_count : 0; F32 flash_rate = p.button_flash_rate.isProvided()? p.button_flash_rate : 0.0f; - mFlashingTimer = new LLFlashTimer ((LLFlashTimer::callback_t)NULL, flash_count, flash_rate); + mFlashingTimer = new LLFlashTimer((LLFlashTimer::callback_t) nullptr, flash_count, flash_rate); } else { diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 890e7c2d1e3..f530eceb4b1 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -153,7 +153,7 @@ class LLButton ~LLButton(); // For backward compatability only - typedef boost::function button_callback_t; + typedef std::function button_callback_t; void addImageAttributeToXML(LLXMLNodePtr node, const std::string& imageName, const LLUUID& imageID,const std::string& xmlTagName) const; diff --git a/indra/llui/llcallbackmap.h b/indra/llui/llcallbackmap.h index 07775dc30f5..3115606d91e 100644 --- a/indra/llui/llcallbackmap.h +++ b/indra/llui/llcallbackmap.h @@ -29,13 +29,13 @@ #include #include -#include +#include class LLCallbackMap { public: // callback definition. - typedef boost::function callback_t; + typedef std::function callback_t; typedef std::map map_t; typedef map_t::iterator map_iter_t; @@ -48,8 +48,8 @@ class LLCallbackMap return (void*)panel; } - LLCallbackMap() : mCallback(NULL), mData(NULL) { } - LLCallbackMap(callback_t callback, void* data = NULL) : mCallback(callback), mData(data) { } + LLCallbackMap() : mCallback(nullptr), mData(nullptr) {} + LLCallbackMap(callback_t callback, void* data = nullptr) : mCallback(callback), mData(data) {} callback_t mCallback; void* mData; diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 12d8233e0a1..9f9cc3e54d2 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -27,8 +27,6 @@ #ifndef LL_LLCLIPBOARD_H #define LL_LLCLIPBOARD_H -#include - #include "llstring.h" #include "lluuid.h" #include "llsingleton.h" diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index f3876ef6957..ae676251ffc 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -1009,7 +1009,7 @@ void LLComboBox::setKeystrokeOnEsc(bool enable) void LLComboBox::onTextEntry(LLLineEditor* line_editor) { - if (mTextEntryCallback != NULL) + if (mTextEntryCallback != nullptr) { (mTextEntryCallback)(line_editor, LLSD()); } @@ -1029,7 +1029,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) mList->deselectAllItems(); mLastSelectedIndex = -1; } - if (mTextChangedCallback != NULL) + if (mTextChangedCallback != nullptr) { (mTextChangedCallback)(line_editor, LLSD()); } @@ -1077,7 +1077,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) // RN: presumably text entry updateSelection(); } - if (mTextChangedCallback != NULL) + if (mTextChangedCallback != nullptr) { (mTextChangedCallback)(line_editor, LLSD()); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 8be3eb57e4f..d6ea1202d39 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -36,7 +36,6 @@ #include "llrect.h" #include "llscrolllistctrl.h" #include "lllineeditor.h" -#include // Classes diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 19ae03cdf9f..c20e5a806cb 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -77,7 +77,7 @@ LLDockableFloater::~LLDockableFloater() bool LLDockableFloater::postBuild() { // Remember we should force docking when the floater is opened for the first time - if (mIsDockedStateForcedCallback != NULL && mIsDockedStateForcedCallback()) + if (mIsDockedStateForcedCallback != nullptr && mIsDockedStateForcedCallback()) { mForceDocking = true; } diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 9c516e23a43..accd9fddfcb 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -129,7 +129,7 @@ class LLDockableFloater : public LLFloater // Checks if docking should be forced. // It may be useful e.g. if floater created in mouselook mode (see EXT-5609) - boost::function mIsDockedStateForcedCallback; + std::function mIsDockedStateForcedCallback; private: std::unique_ptr mDockControl; diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index b6ac9c19ddc..1f6c3b9f570 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -49,11 +49,11 @@ class LLDockControl public: // callback for a function getting a rect valid for control's position - typedef boost::function get_allowed_rect_callback_t; + typedef std::function get_allowed_rect_callback_t; LOG_CLASS(LLDockControl); LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, - const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_rect_callback = NULL); + const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_rect_callback = nullptr); virtual ~LLDockControl(); public: diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index 54f54653e2e..addc3375b34 100644 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -50,7 +50,7 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) void LLFlashTimer::unset() { mUnset = true; - mCallback = NULL; + mCallback = nullptr; } bool LLFlashTimer::tick() diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index 4ef70faf2dd..1cd1df392ba 100644 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h @@ -28,13 +28,13 @@ #define LL_FLASHTIMER_H #include "lleventtimer.h" -#include "boost/function.hpp" +#include class LLFlashTimer : public LLEventTimer { public: - typedef boost::function callback_t; + typedef std::function callback_t; /** * Constructor. @@ -43,7 +43,7 @@ class LLFlashTimer : public LLEventTimer * @param period - how frequently callback should be called * @param cb - callback to be called each tick */ - LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0); + LLFlashTimer(callback_t cb = nullptr, S32 count = 0, F32 period = 0.0); ~LLFlashTimer() {}; /*virtual*/ bool tick(); diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index dfe0a71b745..34eb1ea3fc6 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -537,6 +537,7 @@ bool LLFlatListView::postBuild() void LLFlatListView::rearrangeItems() { + LL_PROFILE_ZONE_SCOPED; static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); setNoItemsCommentVisible(0==size()); @@ -1132,6 +1133,7 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange) void LLFlatListView::notifyParentItemsRectChanged() { + LL_PROFILE_ZONE_SCOPED; S32 comment_height = 0; // take into account comment text height if exists @@ -1401,7 +1403,7 @@ bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) return false; } -void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent) +bool LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent) { std::string cur_filter = mFilterSubString; LLStringUtil::toUpper(cur_filter); @@ -1426,7 +1428,9 @@ void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent) { rearrangeItems(); notifyParentItemsRectChanged(); + return true; } + return false; } bool LLFlatListViewEx::hasMatchedItems() diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 1f22360a8a8..39afa33be82 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -499,8 +499,9 @@ class LLFlatListViewEx : public LLFlatListView /** * Filters the list, rearranges and notifies parent about shape changes. * Derived classes may want to overload rearrangeItems() to exclude repeated separators after filtration. + * Returns true in case of changes */ - void filterItems(bool re_sort, bool notify_parent); + bool filterItems(bool re_sort, bool notify_parent); /** * Returns true if last call of filterItems() found at least one matching item diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 94a67c8d8b5..24d1476dda5 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -30,8 +30,8 @@ #include "llrect.h" #include "llsd.h" +#include #include -#include //******************************************************* // @@ -41,7 +41,7 @@ class LLFloater; class LLUICtrl; -typedef boost::function LLFloaterBuildFunc; +typedef std::function LLFloaterBuildFunc; class LLFloaterReg { diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 0d7c98294f8..7544a444785 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -32,11 +32,11 @@ const F32 FOCUS_FADE_TIME = 0.3f; -LLFocusableElement::LLFocusableElement() -: mFocusLostCallback(NULL), - mFocusReceivedCallback(NULL), - mFocusChangedCallback(NULL), - mTopLostCallback(NULL) +LLFocusableElement::LLFocusableElement() : + mFocusLostCallback(nullptr), + mFocusReceivedCallback(nullptr), + mFocusChangedCallback(nullptr), + mTopLostCallback(nullptr) { } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 2865b789b9f..07e8b890b83 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -432,11 +432,11 @@ class LLFolderViewModel : public LLFolderViewModelCommon virtual SortType& getSorter() { return *mSorter; } virtual const SortType& getSorter() const { return *mSorter; } - virtual void setSorter(const SortType& sorter) { mSorter.reset(new SortType(sorter)); requestSortAll(); } + virtual void setSorter(const SortType& sorter) { mSorter = std::make_unique(sorter); requestSortAll(); } virtual FilterType& getFilter() override { return *mFilter; } virtual const FilterType& getFilter() const override { return *mFilter; } - virtual void setFilter(const FilterType& filter) { mFilter.reset(new FilterType(filter)); } + virtual void setFilter(const FilterType& filter) { mFilter = std::make_unique(filter); } // By default, we assume the content is available. If a network fetch mechanism is implemented for the model, // this method needs to be overloaded and return the relevant fetch status. diff --git a/indra/llui/llfunctorregistry.h b/indra/llui/llfunctorregistry.h index da5570d922e..953963b683a 100644 --- a/indra/llui/llfunctorregistry.h +++ b/indra/llui/llfunctorregistry.h @@ -31,8 +31,6 @@ #include #include -#include - #include "llsd.h" #include "llsingleton.h" diff --git a/indra/llui/lllazyvalue.h b/indra/llui/lllazyvalue.h index 622e69ce954..fc15ead032a 100644 --- a/indra/llui/lllazyvalue.h +++ b/indra/llui/lllazyvalue.h @@ -28,15 +28,16 @@ #ifndef LL_LAZY_VALUE_H #define LL_LAZY_VALUE_H -#include +#include +#include // Holds on to a value of type T *or* calls a functor to generate a value of type T template class LLLazyValue { public: - typedef typename boost::add_reference::type>::type T_const_ref; - typedef typename boost::function function_type; + typedef typename std::add_lvalue_reference::type>::type T_const_ref; + typedef typename std::function function_type; public: LLLazyValue(const function_type& value) diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 7533f76f1d4..3f762822eeb 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -60,7 +60,7 @@ class LLLineEditor { public: - typedef boost::function keystroke_callback_t; + typedef std::function keystroke_callback_t; struct MaxLength : public LLInitParam::ChoiceBlock { @@ -259,7 +259,7 @@ class LLLineEditor void setSelectAllonCommit(bool b) { mSelectAllonCommit = b; } void onKeystroke(); - typedef boost::function callback_t; + typedef std::function callback_t; void setKeystrokeCallback(callback_t callback, void* user_data); void setMaxTextLength(S32 max_text_length); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index ff9456acc6b..eacf2c59d40 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -37,7 +37,8 @@ #include "llfloater.h" #include "lluistring.h" #include "llview.h" -#include + +#include extern S32 MENU_BAR_HEIGHT; extern S32 MENU_BAR_WIDTH; diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index a05feab1d95..0ffe6cff5ec 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -457,7 +457,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mTags.push_back(tag.value); } - mForm = LLNotificationFormPtr(new LLNotificationForm(p.name, p.form_ref.form)); + mForm = std::make_shared(p.name, p.form_ref.form); } LLNotificationVisibilityRule::LLNotificationVisibilityRule(const LLNotificationVisibilityRule::Rule &p) @@ -875,7 +875,7 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele // TODO: something like this so that a missing alert is sensible: //mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions); - mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm)); + mForm = std::make_shared(*mTemplatep->mForm); mForm->append(form_elements); // apply substitution to form labels @@ -1249,7 +1249,7 @@ LLNotifications::LLNotifications() : LLNotificationChannelBase(LLNotificationFilters::includeEverything), mIgnoreAllNotifications(false) { - mListener.reset(new LLNotificationsListener(*this)); + mListener = std::make_unique(*this); LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Notification.Show", boost::bind(&LLNotifications::addFromCallback, this, _2)); // touch the instance tracker for notification channels, so that it will still be around in our destructor @@ -1487,7 +1487,7 @@ bool LLNotifications::templateExists(std::string_view name) void LLNotifications::forceResponse(const LLNotification::Params& params, S32 option) { - LLNotificationPtr temp_notify(new LLNotification(params)); + LLNotificationPtr temp_notify = std::make_shared(params); if (!temp_notify->getForm()) { @@ -1653,7 +1653,7 @@ bool LLNotifications::loadTemplates() replaceFormText(notification.form_ref.form, "$ignoretext", notification.form_ref.form_template.ignore_text); } } - mTemplates[notification.name] = LLNotificationTemplatePtr(new LLNotificationTemplate(notification)); + mTemplates[notification.name] = std::make_shared(notification); } LL_INFOS("Notifications") << "...done" << LL_ENDL; @@ -1683,7 +1683,7 @@ bool LLNotifications::loadVisibilityRules() for (const LLNotificationVisibilityRule::Rule& rule : params.rules) { - mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(rule))); + mVisibilityRules.push_back(std::make_shared(rule)); } return true; @@ -1726,7 +1726,7 @@ LLNotificationPtr LLNotifications::add(const std::string& name, const LLSD& subs // generalized add function that takes a parameter block object for more complex instantiations LLNotificationPtr LLNotifications::add(const LLNotification::Params& p) { - LLNotificationPtr pNotif(new LLNotification(p)); + LLNotificationPtr pNotif = std::make_shared(p); add(pNotif); return pNotif; } @@ -1834,7 +1834,7 @@ void LLNotifications::update(const LLNotificationPtr pNotif) LLNotificationPtr LLNotifications::find(LLUUID uuid) { - LLNotificationPtr target = LLNotificationPtr(new LLNotification(LLNotification::Params().id(uuid))); + LLNotificationPtr target = std::make_shared(LLNotification::Params().id(uuid)); LLNotificationSet::iterator it=mItems.find(target); if (it == mItems.end()) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 3c8e1e85fad..d56c459560a 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -75,6 +75,7 @@ * */ +#include #include #include #include @@ -83,8 +84,6 @@ #include #include -#include -#include #include #include #include @@ -129,7 +128,7 @@ class LLNotificationResponderInterface virtual void fromLLSD(const LLSD& params) = 0; }; -typedef boost::function LLNotificationResponder; +typedef std::function LLNotificationResponder; typedef std::shared_ptr LLNotificationResponderPtr; @@ -303,7 +302,6 @@ typedef std::shared_ptr LLNotificationVisibilityRu * shared pointer. */ class LLNotification : - boost::noncopyable, public std::enable_shared_from_this { LOG_CLASS(LLNotification); @@ -429,6 +427,10 @@ friend class LLNotifications; public: LLNotification(const LLSDParamAdapter& p); + // Non-copyable + LLNotification(const LLNotification&) = delete; + LLNotification& operator=(const LLNotification&) = delete; + void setResponseFunctor(std::string const &responseFunctorName); void setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb); @@ -666,8 +668,8 @@ namespace LLNotificationFilters template struct filterBy { - typedef boost::function field_t; - typedef typename boost::remove_reference::type value_t; + typedef std::function field_t; + typedef typename std::remove_reference::type value_t; filterBy(field_t field, value_t value, EComparison comparison = EQUAL) : mField(field), @@ -712,7 +714,7 @@ namespace LLNotificationComparators }; }; -typedef boost::function LLNotificationFilter; +typedef std::function LLNotificationFilter; typedef std::set LLNotificationSet; typedef std::multimap LLNotificationMap; @@ -817,10 +819,9 @@ typedef boost::intrusive_ptr LLNotificationChannelPtr; // manages a list of notifications // Note that if this is ever copied around, we might find ourselves with multiple copies // of a queue with notifications being added to different nonequivalent copies. So we -// make it inherit from boost::noncopyable, and then create a map of LLPointer to manage it. +// delete the copy operator and constructor, and then create a map of LLPointer to manage it. // class LLNotificationChannel : - boost::noncopyable, public LLNotificationChannelBase, public LLInstanceTracker { @@ -843,6 +844,10 @@ class LLNotificationChannel : virtual ~LLNotificationChannel(); typedef LLNotificationSet::iterator Iterator; + // Non-copyable + LLNotificationChannel(const LLNotificationChannel&) = delete; + LLNotificationChannel& operator=(const LLNotificationChannel&) = delete; + std::string getName() const { return mName; } typedef std::vector::const_iterator parents_iter; boost::iterator_range getParents() const @@ -854,7 +859,7 @@ class LLNotificationChannel : S32 size() const; size_t size(); - typedef boost::function NotificationProcess; + typedef std::function NotificationProcess; void forEachNotification(NotificationProcess process); std::string summarize(); diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index 9c1fc27c515..d07d42bdbae 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -266,7 +266,7 @@ void LLNotificationsListener::forward(const LLSD& params) entry(mForwarders.insert(ForwarderMap::value_type(channel, ForwarderMap::mapped_type())).first); if (! entry->second) { - entry->second.reset(new Forwarder(mNotifications, channel)); + entry->second = std::make_shared(mNotifications, channel); } // Now, whether this Forwarder is brand-new or not, update it with the new // request info. diff --git a/indra/llui/llnotificationsutil.cpp b/indra/llui/llnotificationsutil.cpp index c1cad431c5e..6b570d043f1 100644 --- a/indra/llui/llnotificationsutil.cpp +++ b/indra/llui/llnotificationsutil.cpp @@ -71,7 +71,7 @@ LLNotificationPtr LLNotificationsUtil::add(const std::string& name, LLNotificationPtr LLNotificationsUtil::add(const std::string& name, const LLSD& substitutions, const LLSD& payload, - boost::function functor) + std::function functor) { LLNotification::Params::Functor functor_p; functor_p.function = functor; diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h index f21d93a50ef..73e64e47ba2 100644 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h @@ -32,7 +32,7 @@ #include "llnotificationptr.h" #include "lluuid.h" -#include +#include class LLSD; @@ -55,7 +55,7 @@ namespace LLNotificationsUtil LLNotificationPtr add(const std::string& name, const LLSD& substitutions, const LLSD& payload, - boost::function functor); + std::function functor); S32 getSelectedOption(const LLSD& notification, const LLSD& response); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index db314cae0f5..2100b23783b 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -662,12 +662,12 @@ bool LLPanel::childHasFocus(std::string_view id) // Prefer getChild("foo")->setCommitCallback(boost:bind(...)), // which takes a generic slot. Or use mCommitCallbackRegistrar.add() with // a named callback and reference it in XML. -void LLPanel::childSetCommitCallback(std::string_view id, boost::function cb, void* data) +void LLPanel::childSetCommitCallback(std::string_view id, std::function cb, void* data) { LLUICtrl* child = findChild(id); if (child) { - child->setCommitCallback(boost::bind(cb, child, data)); + child->setCommitCallback(std::bind(cb, child, data)); } } @@ -759,12 +759,12 @@ void LLPanel::childSetAction(std::string_view id, const commit_signal_t::slot_ty } } -void LLPanel::childSetAction(std::string_view id, boost::function function, void* value) +void LLPanel::childSetAction(std::string_view id, std::function function, void* value) { LLButton* button = findChild(id); if (button) { - button->setClickedCallback(boost::bind(function, value)); + button->setClickedCallback(std::bind(function, value)); } } diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index f085c123c1d..fe861dc719c 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -191,7 +191,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder // Prefer getChild("foo")->setCommitCallback(boost:bind(...)), // which takes a generic slot. Or use mCommitCallbackRegistrar.add() with // a named callback and reference it in XML. - void childSetCommitCallback(std::string_view id, boost::function cb, void* data); + void childSetCommitCallback(std::string_view id, std::function cb, void* data); void childSetColor(std::string_view id, const LLUIColor& color); LLCtrlSelectionInterface* childGetSelectionInterface(std::string_view id) const; @@ -208,7 +208,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder bool childSetLabelArg(std::string_view id, const std::string& key, const LLStringExplicit& text); // LLButton - void childSetAction(std::string_view id, boost::function function, void* value); + void childSetAction(std::string_view id, std::function function, void* value); void childSetAction(std::string_view id, const commit_signal_t::slot_type& function); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); @@ -262,7 +262,7 @@ extern template class LLPanel* LLView::getChild( std::string_view name, bool recurse) const; #endif -typedef boost::function LLPanelClassCreatorFunc; +typedef std::function LLPanelClassCreatorFunc; // local static instance for registering a particular panel class diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index 68bf0fd95e0..d95536c3607 100644 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -62,7 +62,7 @@ class LLResizeBar : public LLView void setEnableSnapping(bool enable) { mSnappingEnabled = enable; } void setAllowDoubleClickSnapping(bool allow) { mAllowDoubleClickSnapping = allow; } bool canResize() const { return getEnabled() && mMaxSize > mMinSize; } - void setResizeListener(boost::function listener) {mResizeListener = listener;} + void setResizeListener(std::function listener) { mResizeListener = listener; } void setImagePanel(LLPanel * panelp); LLPanel * getImagePanel() const; @@ -78,7 +78,7 @@ class LLResizeBar : public LLView bool mSnappingEnabled, mAllowDoubleClickSnapping; LLView* mResizingView; - boost::function mResizeListener; + std::function mResizeListener; LLPointer mDragHandleImage; LLPanel * mImagePanel; }; diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 9607355a9dc..c49d2b534a4 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -40,7 +40,7 @@ class LLScrollbar { public: - typedef boost::function callback_t; + typedef std::function callback_t; struct Params : public LLInitParam::Block { diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index a3108d77e88..bdf88768c3c 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -98,6 +98,7 @@ const LLSD LLScrollListCell::getAltValue() const LLScrollListIcon::LLScrollListIcon(const LLScrollListCell::Params& p) : LLScrollListCell(p), mIcon(LLUI::getUIImage(p.value().asString())), + mIconSize(0), mColor(p.color), mAlignment(p.font_halign) {} @@ -140,20 +141,32 @@ void LLScrollListIcon::setValue(const LLSD& value) } } - void LLScrollListIcon::setColor(const LLColor4& color) { mColor = color; } +void LLScrollListIcon::setIconSize(S32 size) +{ + mIconSize = size; +} + S32 LLScrollListIcon::getWidth() const { // if no specified fix width, use width of icon - if (LLScrollListCell::getWidth() == 0 && mIcon.notNull()) + if (LLScrollListCell::getWidth() != 0) + { + return LLScrollListCell::getWidth(); + } + if (mIconSize != 0) + { + return mIconSize; + } + if (mIcon.notNull()) { return mIcon->getWidth(); } - return LLScrollListCell::getWidth(); + return 0; } @@ -161,16 +174,23 @@ void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_col { if (mIcon) { + S32 draw_width = mIcon->getWidth(); + S32 draw_height = mIcon->getHeight(); + if (mIconSize != 0) + { + draw_width = mIconSize; + draw_height = mIconSize; + } // else will draw full icon even if cell is smaller switch(mAlignment) { case LLFontGL::LEFT: - mIcon->draw(0, 0, mColor); + mIcon->draw(0, 0, draw_width, draw_height, mColor); break; case LLFontGL::RIGHT: - mIcon->draw(getWidth() - mIcon->getWidth(), 0, mColor); + mIcon->draw(getWidth() - draw_width, 0, draw_width, draw_height, mColor); break; case LLFontGL::HCENTER: - mIcon->draw((getWidth() - mIcon->getWidth()) / 2, 0, mColor); + mIcon->draw((getWidth() - draw_width) / 2, 0, draw_width, draw_height, mColor); break; default: break; diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index 7dded3c0b76..f0a0f216b48 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -197,11 +197,13 @@ class LLScrollListIcon : public LLScrollListCell /*virtual*/ const LLSD getValue() const; /*virtual*/ void setColor(const LLColor4&); /*virtual*/ void setValue(const LLSD& value); + void setIconSize(S32 size); private: LLPointer mIcon; LLColor4 mColor; LLFontGL::HAlign mAlignment; + S32 mIconSize; }; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index ff77b4d4820..b459c67dade 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -190,19 +190,19 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mColumnsDirty(false), mMaxItemCount(INT_MAX), mBorderThickness( 2 ), - mOnDoubleClickCallback( NULL ), - mOnMaximumSelectCallback( NULL ), - mOnSortChangedCallback( NULL ), + mOnDoubleClickCallback(nullptr), + mOnMaximumSelectCallback(nullptr), + mOnSortChangedCallback(nullptr), mHighlightedItem(-1), - mBorder(NULL), - mSortCallback(NULL), + mBorder(nullptr), + mSortCallback(nullptr), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mTotalColumnPadding(0), mSorted(false), mDirty(false), mOriginalSelection(-1), - mLastSelected(NULL), + mLastSelected(nullptr), mHeadingHeight(p.heading_height), mAllowMultipleSelection(p.multi_select), mDisplayColumnHeaders(p.draw_heading), @@ -222,7 +222,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mRowPadding(p.row_padding), mAlternateSort(false), mContextMenuType(MENU_NONE), - mIsFriendSignal(NULL) + mIsFriendSignal(nullptr) { mItemListRect.setOriginAndSize( mBorderThickness, diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 1f041003069..d3735c5052d 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -77,7 +77,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, }; // *TODO: Add callbacks to Params - typedef boost::function callback_t; + typedef std::function callback_t; template struct maximum { @@ -241,7 +241,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, void setMaximumSelectCallback( callback_t cb) { mOnMaximumSelectCallback = cb; } void setSortChangedCallback( callback_t cb) { mOnSortChangedCallback = cb; } // Convenience function; *TODO: replace with setter above + boost::bind() in calling code - void setDoubleClickCallback( boost::function cb, void* userdata) { mOnDoubleClickCallback = boost::bind(cb, userdata); } + void setDoubleClickCallback( std::function cb, void* userdata) { mOnDoubleClickCallback = std::bind(cb, userdata); } void swapWithNext(S32 index); void swapWithPrevious(S32 index); diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index a0c1e9d0c01..244faf8fe9d 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -106,12 +106,12 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) LLSearchEditor::~LLSearchEditor() { - mKeystrokeCallback = NULL; - mTextChangedCallback = NULL; + mKeystrokeCallback = nullptr; + mTextChangedCallback = nullptr; setCommitOnFocusLost(false); - mSearchButton = NULL; - mClearButton = NULL; + mSearchButton = nullptr; + mClearButton = nullptr; mSearchEditor->deleteAllChildren(); deleteAllChildren(); } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 44151a43554..2079ff17fc2 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -3477,7 +3477,6 @@ S32 LLTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offs void LLTextSegment::updateLayout(const LLTextBase& editor) {} F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect) { return draw_rect.mLeft; } bool LLTextSegment::canEdit() const { return false; } -bool LLTextSegment::getPermitsEmoji() const { return true; } void LLTextSegment::unlinkFromDocument(LLTextBase*) {} void LLTextSegment::linkToDocument(LLTextBase*) {} const LLUIColor& LLTextSegment::getColor() const { static const LLUIColor white = LLUIColorTable::instance().getColor("White", LLColor4::white); return white; } @@ -3521,6 +3520,11 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e { mFontHeight = mStyle->getFont()->getLineHeight(); mCanEdit = !mStyle->getDrawHighlightBg(); + if (!mCanEdit) + { + // Emoji shouldn't split the segment with the mention. + mPermitsEmoji = false; + } LLUIImagePtr image = mStyle->getImage(); if (image.notNull()) @@ -4041,6 +4045,7 @@ LLInlineViewSegment::LLInlineViewSegment(const Params& p, S32 start, S32 end) mTopPad(p.top_pad), mBottomPad(p.bottom_pad) { + mPermitsEmoji = false; } LLInlineViewSegment::~LLInlineViewSegment() diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 50767a35b3a..3ab5e905e3a 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -61,13 +61,15 @@ class LLTextSegment public: LLTextSegment(S32 start, S32 end) : mStart(start), - mEnd(end) + mEnd(end), + mPermitsEmoji(true) {} virtual ~LLTextSegment(); virtual LLTextSegmentPtr clone(LLTextBase& terget) const { return new LLTextSegment(mStart, mEnd); } static LLStyleSP cloneStyle(LLTextBase& target, const LLStyle* source); bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + bool getPermitsEmoji() const { return mPermitsEmoji; }; virtual bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; virtual S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; @@ -87,7 +89,6 @@ class LLTextSegment virtual void updateLayout(const class LLTextBase& editor); virtual F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); virtual bool canEdit() const; - virtual bool getPermitsEmoji() const; virtual void unlinkFromDocument(class LLTextBase* editor); virtual void linkToDocument(class LLTextBase* editor); @@ -126,6 +127,8 @@ class LLTextSegment protected: S32 mStart; S32 mEnd; + + bool mPermitsEmoji; }; class LLNormalTextSegment : public LLTextSegment diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 9f945d37357..d2a21998a6c 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -43,7 +43,7 @@ template class LLTextBox* LLView::getChild( LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), - mClickedCallback(NULL), + mClickedCallback(nullptr), mShowCursorHand(true) { mSkipTripleClick = true; @@ -135,9 +135,9 @@ void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& in LLTextBase::setText(mText.getString(), input_params ); } -void LLTextBox::setClickedCallback( boost::function cb, void* userdata /*= NULL */ ) +void LLTextBox::setClickedCallback(std::function cb, void* userdata /*= nullptr */) { - mClickedCallback = boost::bind(cb, userdata); + mClickedCallback = std::bind(cb, userdata); } S32 LLTextBox::getTextPixelWidth() diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 507d8f3ee68..8716917ced8 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -36,7 +36,7 @@ class LLTextBox : public: // *TODO: Add callback to Params - typedef boost::function callback_t; + typedef std::function callback_t; struct Params : public LLInitParam::Block {}; @@ -58,7 +58,7 @@ class LLTextBox : void setRightAlign() { mHAlign = LLFontGL::RIGHT; } void setHAlign(LLFontGL::HAlign align) { mHAlign = align; } - void setClickedCallback(boost::function cb, void* userdata = NULL); + void setClickedCallback(std::function cb, void* userdata = nullptr); void reshapeToFitText(bool called_from_parent = false); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 58b785fcddc..fcdf3782ae7 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1242,7 +1242,7 @@ void LLTextEditor::addChar(llwchar wc) tryToShowEmojiHelper(); tryToShowMentionHelper(); - if (!mReadOnly && mAutoreplaceCallback != NULL) + if (!mReadOnly && mAutoreplaceCallback != nullptr) { // autoreplace the text, if necessary S32 replacement_start; diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index cdfcbcdd636..d9742db34d6 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -164,7 +164,7 @@ class LLTextEditor : bool allowsEmbeddedItems() const { return mAllowEmbeddedItems; } // Autoreplace (formerly part of LLLineEditor) - typedef boost::function autoreplace_callback_t; + typedef std::function autoreplace_callback_t; autoreplace_callback_t mAutoreplaceCallback; void setAutoreplaceCallback(autoreplace_callback_t cb) { mAutoreplaceCallback = cb; } diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp index 8ffce1b8b44..1454de34c76 100644 --- a/indra/llui/lltextutil.cpp +++ b/indra/llui/lltextutil.cpp @@ -30,7 +30,7 @@ #include "lltextbox.h" #include "llurlmatch.h" -boost::function LLTextUtil::TextHelpers::iconCallbackCreationFunction = 0; +std::function LLTextUtil::TextHelpers::iconCallbackCreationFunction = nullptr; void LLTextUtil::textboxSetHighlightedVal(LLTextBox *txtbox, const LLStyle::Params& normal_style, const std::string& text, const std::string& hl) { diff --git a/indra/llui/lltextutil.h b/indra/llui/lltextutil.h index f3838e59fac..6328ff133f0 100644 --- a/indra/llui/lltextutil.h +++ b/indra/llui/lltextutil.h @@ -74,7 +74,7 @@ namespace LLTextUtil //we need this special callback since we need to create LLAvataIconCtrls while parsing //avatar/group url but can't create LLAvataIconCtrl from LLUI public: - static boost::function iconCallbackCreationFunction; + static std::function iconCallbackCreationFunction; }; diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h index a4ff144d825..096c28b4481 100644 --- a/indra/llui/lltextvalidate.h +++ b/indra/llui/lltextvalidate.h @@ -30,7 +30,6 @@ #include "llstring.h" #include "llinitparam.h" -#include namespace LLTextValidate { diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 56ab6e9bae1..785dc85448a 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -99,8 +99,8 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mWrap(p.wrap), mNeedsLayout(false), mModified(false), - mButtonPanel(NULL), - mCenteringStack(NULL), + mButtonPanel(nullptr), + mCenteringStack(nullptr), mPadLeft(p.pad_left), mPadRight(p.pad_right), mPadTop(p.pad_top), @@ -108,17 +108,17 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mPadBetween(p.pad_between), mMinGirth(p.min_girth), mPopupMenuHandle(), - mRightMouseTargetButton(NULL), - mStartDragItemCallback(NULL), - mHandleDragItemCallback(NULL), - mHandleDropCallback(NULL), - mButtonAddSignal(NULL), - mButtonEnterSignal(NULL), - mButtonLeaveSignal(NULL), - mButtonRemoveSignal(NULL), + mRightMouseTargetButton(nullptr), + mStartDragItemCallback(nullptr), + mHandleDragItemCallback(nullptr), + mHandleDropCallback(nullptr), + mButtonAddSignal(nullptr), + mButtonEnterSignal(nullptr), + mButtonLeaveSignal(nullptr), + mButtonRemoveSignal(nullptr), mDragAndDropTarget(false), - mCaretIcon(NULL), - mCenterPanel(NULL) + mCaretIcon(nullptr), + mCenterPanel(nullptr) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; @@ -1097,12 +1097,12 @@ LLToolBarButton::LLToolBarButton(const Params& p) mWidthRange(p.button_width), mDesiredHeight(p.desired_height), mId(""), - mIsEnabledSignal(NULL), - mIsRunningSignal(NULL), - mIsStartingSignal(NULL), + mIsEnabledSignal(nullptr), + mIsRunningSignal(nullptr), + mIsStartingSignal(nullptr), mIsDragged(false), - mStartDragItemCallback(NULL), - mHandleDragItemCallback(NULL), + mStartDragItemCallback(nullptr), + mHandleDragItemCallback(nullptr), mOriginalImageSelected(p.image_selected), mOriginalImageUnselected(p.image_unselected), mOriginalImagePressed(p.image_pressed), @@ -1256,7 +1256,7 @@ void LLToolBar::LLCenterLayoutPanel::handleReshape(const LLRect& rect, bool by_u { LLLayoutPanel::handleReshape(rect, by_user); - if (!mReshapeCallback.empty()) + if (mReshapeCallback != nullptr) { LLRect r; localRectToOtherView(mButtonPanel->getRect(), &r, gFloaterView); diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index a3f044c256e..abf44f259a4 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -39,9 +39,9 @@ class LLToolBar; class LLToolBarButton; class LLIconCtrl; -typedef boost::function tool_startdrag_callback_t; -typedef boost::function tool_handledrag_callback_t; -typedef boost::function tool_handledrop_callback_t; +typedef std::function tool_startdrag_callback_t; +typedef std::function tool_handledrag_callback_t; +typedef std::function tool_handledrop_callback_t; class LLToolBarButton : public LLButton { @@ -167,7 +167,7 @@ class LLToolBar class LLCenterLayoutPanel : public LLLayoutPanel { public: - typedef boost::function reshape_callback_t; + typedef std::function reshape_callback_t; virtual ~LLCenterLayoutPanel() {} /*virtual*/ void handleReshape(const LLRect& rect, bool by_user); diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 760acddd6fc..c9d6937c1a0 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -67,8 +67,8 @@ class LLToolTip : public LLPanel struct Params : public LLInitParam::Block { - typedef boost::function click_callback_t; - typedef boost::function create_callback_t; + typedef std::function click_callback_t; + typedef std::function create_callback_t; Optional message; Multiple styled_message; diff --git a/indra/llui/llui.h b/indra/llui/llui.h index b2dcb6dc88b..2ef64baaf6f 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -241,9 +241,9 @@ class LLUI : public LLSimpleton // // Methods // - typedef boost::function add_popup_t; - typedef boost::function remove_popup_t; - typedef boost::function clear_popups_t; + typedef std::function add_popup_t; + typedef std::function remove_popup_t; + typedef std::function clear_popups_t; void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& ); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index cbabb5a933b..05461edd82d 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -999,15 +999,16 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out) } // *TODO: Deprecate; for backwards compatability only: -boost::signals2::connection LLUICtrl::setCommitCallback( boost::function cb, void* data) +boost::signals2::connection LLUICtrl::setCommitCallback( std::function cb, void* data) { - return setCommitCallback( boost::bind(cb, _1, data)); + return setCommitCallback( std::bind(cb, std::placeholders::_1, data)); } -boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function cb ) + +boost::signals2::connection LLUICtrl::setValidateBeforeCommit( std::function cb ) { if (!mValidateSignal) mValidateSignal = new enable_signal_t(); - return mValidateSignal->connect(boost::bind(cb, _2)); + return mValidateSignal->connect(std::bind(cb, std::placeholders::_2)); } // virtual diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index bcaf479b0ff..749999bbfe0 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -31,7 +31,8 @@ //#include "llboost.h" #include "llrect.h" #include "llsd.h" -#include +#include +#include #include #include "llinitparam.h" @@ -47,12 +48,12 @@ class LLUICtrl : public LLView, public boost::signals2::trackable { public: - typedef boost::function commit_callback_t; + typedef std::function commit_callback_t; typedef boost::signals2::signal commit_signal_t; // *TODO: add xml support for this type of signal in the future typedef boost::signals2::signal mouse_signal_t; - typedef boost::function enable_callback_t; + typedef std::function enable_callback_t; typedef boost::signals2::signal enable_signal_t; struct CallbackParam : public LLInitParam::Block @@ -258,8 +259,8 @@ class LLUICtrl boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb ); // *TODO: Deprecate; for backwards compatability only: - boost::signals2::connection setCommitCallback( boost::function cb, void* data); - boost::signals2::connection setValidateBeforeCommit( boost::function cb ); + boost::signals2::connection setCommitCallback( std::function cb, void* data); + boost::signals2::connection setValidateBeforeCommit( std::function cb ); LLUICtrl* findRootMostFocusRoot(); diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index a2a6d661ff8..9abccfd9a0a 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -100,16 +100,19 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa std::string base_filename = search_paths.front(); if (!base_filename.empty()) { - LLUICtrlFactory::instance().pushFileName(base_filename); + LLUICtrlFactory *factory = LLUICtrlFactory::getInstance(); + factory->mFileNames.push_back(base_filename); - if (!LLXMLNode::getLayeredXMLNode(root_node, search_paths)) + if (LLXMLNode::getLayeredXMLNode(root_node, search_paths)) + { + LLXUIParser parser; + parser.readXUI(root_node, block, base_filename); + } + else { LL_WARNS() << "Couldn't parse widget from: " << base_filename << LL_ENDL; - return; } - LLXUIParser parser; - parser.readXUI(root_node, block, base_filename); - LLUICtrlFactory::instance().popFileName(); + factory->mFileNames.pop_back(); } } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 91221dc7f3f..fc069c078f9 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -311,7 +311,7 @@ LLUICtrlFactory::ParamDefaults::ParamDefaults() { template template LLChildRegistry::Register::Register(const char* tag, LLWidgetCreatorFunc func) -: LLChildRegistry::StaticRegistrar(tag, func.empty() ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder : func) +: LLChildRegistry::StaticRegistrar(tag, func == nullptr ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder : func) { // add this widget to various registries LLUICtrlFactory::instance().registerWidget(&typeid(T), &typeid(typename T::Params), tag); diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index 56d459bb26f..c4cfd0f3fb1 100644 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -28,8 +28,8 @@ #ifndef LL_LLURLACTION_H #define LL_LLURLACTION_H +#include #include -#include /// /// The LLUrlAction class provides a number of static functions that @@ -93,8 +93,8 @@ class LLUrlAction static void unblockObject(std::string url); /// specify the callbacks to enable this class's functionality - typedef boost::function url_callback_t; - typedef boost::function execute_url_callback_t; + typedef std::function url_callback_t; + typedef std::function execute_url_callback_t; static void setOpenURLCallback(url_callback_t cb); static void setOpenURLInternalCallback(url_callback_t cb); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 95603d7ed53..bba80dd20eb 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -234,7 +234,7 @@ bool LLUrlEntryBase::isWikiLinkCorrect(const std::string &labeled_url) const || label.find("www.") != std::string::npos) && label.find("://") == std::string::npos) { - label = "http://" + label; + label = "https://" + label; } return !LLUrlRegistry::instance().hasUrl(label); @@ -315,7 +315,7 @@ std::string LLUrlEntryHTTP::getUrl(const std::string &string) const { if (string.find("://") == std::string::npos) { - return "http://" + escapeUrl(string); + return "https://" + escapeUrl(string); } return escapeUrl(string); } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 97212a9d2d0..d747ef95551 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -48,9 +48,8 @@ #include "lltreeiterators.h" #include "llfocusmgr.h" +#include #include -#include -#include class LLSD; @@ -627,7 +626,7 @@ class LLView LLView& getDefaultWidgetContainer() const; // This allows special mouse-event targeting logic for testing. - typedef boost::function DrilldownFunc; + typedef std::function DrilldownFunc; static DrilldownFunc sDrilldown; public: @@ -637,7 +636,7 @@ class LLView // LLView::TemporaryDrilldownFunc scoped_func(myfunctor); // // ... test with myfunctor ... // } // exiting block restores original LLView::sDrilldown - class TemporaryDrilldownFunc: public boost::noncopyable + class TemporaryDrilldownFunc { public: TemporaryDrilldownFunc(const DrilldownFunc& func): @@ -651,6 +650,10 @@ class LLView sDrilldown = mOldDrilldown; } + // Non-copyable + TemporaryDrilldownFunc(const TemporaryDrilldownFunc&) = delete; + TemporaryDrilldownFunc& operator=(const TemporaryDrilldownFunc&) = delete; + private: DrilldownFunc mOldDrilldown; }; diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h index f755c12cbfe..2179ae54d3c 100644 --- a/indra/llui/llxuiparser.h +++ b/indra/llui/llxuiparser.h @@ -31,7 +31,7 @@ #include "llregistry.h" #include "llxmlnode.h" -#include +#include #include #include #include @@ -47,7 +47,7 @@ class LLWidgetTypeRegistry // global static instance for registering all widget types -typedef boost::function LLWidgetCreatorFunc; +typedef std::function LLWidgetCreatorFunc; typedef LLRegistry widget_registry_t; diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 161d8d7e915..d1bae497844 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -920,14 +920,17 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti config.set_max_port(60100); webrtc::PeerConnectionDependencies pc_dependencies(this); - if (mPeerConnectionFactory == nullptr) + // Other thread manages mPeerConnectionFactory's lifetime and it can be reset + // at any momment, create own scoped_refptr (atomic). + webrtc::scoped_refptr peer_connection_factory = mPeerConnectionFactory; + if (peer_connection_factory == nullptr) { RTC_LOG(LS_ERROR) << __FUNCTION__ << "Error creating peer connection, factory doesn't exist"; // Too early? mPendingJobs--; return; } - auto error_or_peer_connection = mPeerConnectionFactory->CreatePeerConnectionOrError(config, std::move(pc_dependencies)); + auto error_or_peer_connection = peer_connection_factory->CreatePeerConnectionOrError(config, std::move(pc_dependencies)); if (error_or_peer_connection.ok()) { mPeerConnection = std::move(error_or_peer_connection.value()); @@ -960,10 +963,10 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti audioOptions.noise_suppression = true; audioOptions.init_recording_on_send = false; - mLocalStream = mPeerConnectionFactory->CreateLocalMediaStream("SLStream"); + mLocalStream = peer_connection_factory->CreateLocalMediaStream("SLStream"); webrtc::scoped_refptr audio_track( - mPeerConnectionFactory->CreateAudioTrack("SLAudio", mPeerConnectionFactory->CreateAudioSource(audioOptions).get())); + peer_connection_factory->CreateAudioTrack("SLAudio", peer_connection_factory->CreateAudioSource(audioOptions).get())); audio_track->set_enabled(false); mLocalStream->AddTrack(audio_track); diff --git a/indra/llwindow/llappdelegate-objc.h b/indra/llwindow/llappdelegate-objc.h index ef36f7d4a85..5b6e11e4e4b 100644 --- a/indra/llwindow/llappdelegate-objc.h +++ b/indra/llwindow/llappdelegate-objc.h @@ -36,16 +36,17 @@ std::string secondLogPath; } -@property (assign) IBOutlet LLNSWindow *window; -@property (assign) IBOutlet NSWindow *inputWindow; -@property (assign) IBOutlet LLNonInlineTextView *inputView; +@property (assign) IBOutlet LLNSWindow * _Nullable window; +@property (assign) IBOutlet NSWindow * _Nullable inputWindow; +@property (assign) IBOutlet LLNonInlineTextView * _Nullable inputView; -@property (retain) NSString *currentInputLanguage; +@property (retain) NSString * _Nullable currentInputLanguage; - (void) oneFrame; -- (void) showInputWindow:(bool)show withEvent:(NSEvent*)textEvent; +- (void) showInputWindow:(bool)show withEvent:(nullable NSEvent *)textEvent; - (void) languageUpdated; - (bool) romanScript; +- (void) setBugsplatValue:(nullable NSString *)value forAttribute:(nullable NSString *)attribute; @end @interface LLApplication : NSApplication diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 33eebdadd15..b642736d8ea 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -30,6 +30,8 @@ #include "llwindowcallbacks.h" +#include "llstl.h" + // // Globals // diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index 713eb7aec24..067445d24cd 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -27,10 +27,9 @@ #ifndef LL_LLKEYBOARD_H #define LL_LLKEYBOARD_H +#include #include -#include -#include "llstringtable.h" #include "lltimer.h" #include "indra_constants.h" @@ -41,7 +40,7 @@ enum EKeystate KEYSTATE_UP }; -typedef boost::function LLKeyFunc; +typedef std::function LLKeyFunc; typedef std::string (LLKeyStringTranslatorFunc)(std::string_view); enum EKeyboardInsertMode diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 7a5404e6154..185940e32dd 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -205,6 +205,8 @@ class LLWindow : public LLInstanceTracker }; virtual S32 getRefreshRate() { return mRefreshRate; } + + virtual void initWatchdog() {} // windows runs window as a thread and it needs a watchdog protected: LLWindow(LLWindowCallbacks* callbacks, bool fullscreen, U32 flags); virtual ~LLWindow(); diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index e37fe116711..f8920318d31 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1259,9 +1259,6 @@ bool LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) // trigger mouse move callback LLCoordGL gl_pos; convertCoords(position, &gl_pos); - float scale = getSystemUISize(); - gl_pos.mX *= scale; - gl_pos.mY *= scale; mCallbacks->handleMouseMove(this, gl_pos, (MASK)0); return result; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 824d0f5ec62..9d05d7e5a4e 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -49,6 +49,7 @@ #include "llthreadsafequeue.h" #include "stringize.h" #include "llframetimer.h" +#include "llwatchdog.h" // System includes #include @@ -364,7 +365,8 @@ static LLMonitorInfo sMonitorInfo; // the containing class a friend. struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool { - static const int MAX_QUEUE_SIZE = 2048; + static constexpr int MAX_QUEUE_SIZE = 2048; + static constexpr F32 WINDOW_TIMEOUT_SEC = 90.f; LLThreadSafeQueue mMessageQueue; @@ -426,6 +428,50 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool PostMessage(windowHandle, WM_POST_FUNCTION_, wparam, LPARAM(ptr)); } + // Call from main thread. + void initTimeout() + { + // post into thread's queue to avoid threading issues + post([this]() + { + if (!mWindowTimeout) + { + mWindowTimeout = std::make_unique("mainloop"); + // supposed to be executed within run(), + // so no point checking if thread is alive + resumeTimeout("TimeoutInit"); + } + }); + } +private: + // These timeout related functions are strictly for the thread. + void resumeTimeout(std::string_view state) + { + if (mWindowTimeout) + { + mWindowTimeout->setTimeout(WINDOW_TIMEOUT_SEC); + mWindowTimeout->start(state); + } + } + + void pauseTimeout() + { + if (mWindowTimeout) + { + mWindowTimeout->stop(); + } + } + + void pingTimeout(std::string_view state) + { + if (mWindowTimeout) + { + mWindowTimeout->setTimeout(WINDOW_TIMEOUT_SEC); + mWindowTimeout->ping(state); + } + } + +public: using FuncType = std::function; // call GetMessage() and pull enqueue messages for later processing HWND mWindowHandleThrd = NULL; @@ -436,6 +482,8 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool bool mGLReady = false; bool mGotGLBuffer = false; LLAtomicBool mDeleteOnExit = false; +private: + std::unique_ptr mWindowTimeout; }; @@ -2502,16 +2550,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // Comes after WM_QUERYENDSESSION LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_ENDSESSION"); LL_INFOS("Window") << "Received WM_ENDSESSION with wParam: " << (U32)w_param << " lParam: " << (U32)l_param << LL_ENDL; - unsigned int end_session_flags = (U32)w_param; - if (end_session_flags == 0) - { - // session is not actually ending - return 0; - } + unsigned int end_session_flags = (U32)l_param; - if ((end_session_flags & ENDSESSION_CLOSEAPP) - || (end_session_flags & ENDSESSION_CRITICAL) - || (end_session_flags & ENDSESSION_LOGOFF)) + if (w_param == TRUE // if true, session is ending + || end_session_flags == 0 // not possible to determine type of the event + // || (end_session_flags & ENDSESSION_CLOSEAPP)) system update or low resources, must be acompanied by w_param == TRUE + || (end_session_flags & ENDSESSION_CRITICAL) // will shutdown regardless of app state + || (end_session_flags & ENDSESSION_LOGOFF)) // logoff, can delay shutdown { window_imp->post([=]() { @@ -2520,13 +2565,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { // Get the app to initiate cleanup. window_imp->mCallbacks->handleQuit(window_imp); - // The app is responsible for calling destroyWindow when done with GL } }); // Give app a second to finish up. That's not enough for a clean exit, // but better than nothing. // Todo: sync this better, some kind of waitForResult? Can't wait forever, - // but can potentially use ShutdownBlockReasonCreate for a bigger delay. + // but for ENDSESSION_LOGOFF can potentially use ShutdownBlockReasonCreate + // for a bigger delay. ms_sleep(1000); } // Don't need to post quit or destroy window, @@ -4598,6 +4643,11 @@ bool LLWindowWin32::getInputDevices(U32 device_type_filter, return false; } +void LLWindowWin32::initWatchdog() +{ + mWindowThread->initTimeout(); +} + F32 LLWindowWin32::getSystemUISize() { F32 scale_value = 1.f; @@ -4735,6 +4785,8 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem() return; } + pauseTimeout(); + IDXGIFactory4* p_factory = nullptr; HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory4), (void**)&p_factory); @@ -4838,6 +4890,8 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem() } mGotGLBuffer = true; + + resumeTimeout("checkDXMem"); } void LLWindowWin32::LLWindowWin32Thread::run() @@ -4853,6 +4907,9 @@ void LLWindowWin32::LLWindowWin32Thread::run() timeBeginPeriod(llclamp((U32) 1, tc.wPeriodMin, tc.wPeriodMax)); } + // Normally won't exist yet, but in case of re-init, make sure it's cleaned up + resumeTimeout("WindowThread"); + while (! getQueue().done()) { LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32; @@ -4862,6 +4919,7 @@ void LLWindowWin32::LLWindowWin32Thread::run() if (mWindowHandleThrd != 0) { + pingTimeout("messages"); MSG msg; BOOL status; if (mhDCThrd == 0) @@ -4889,6 +4947,7 @@ void LLWindowWin32::LLWindowWin32Thread::run() { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - Function Queue"); + pingTimeout("queue"); logger.onChange("runPending()"); //process any pending functions getQueue().runPending(); @@ -4903,6 +4962,7 @@ void LLWindowWin32::LLWindowWin32Thread::run() #endif } + pauseTimeout(); destroyWindow(); if (mDeleteOnExit) diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 0fc93ad0b12..8159092794a 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -45,83 +45,82 @@ typedef void (*LLW32MsgCallback)(const MSG &msg); class LLWindowWin32 : public LLWindow { public: - /*virtual*/ void show(); - /*virtual*/ void hide(); - /*virtual*/ void close(); - /*virtual*/ bool getVisible(); - /*virtual*/ bool getMinimized(); - /*virtual*/ bool getMaximized(); - /*virtual*/ bool maximize(); - /*virtual*/ void minimize(); - /*virtual*/ void restore(); - /*virtual*/ bool getFullscreen(); - /*virtual*/ bool getPosition(LLCoordScreen *position); - /*virtual*/ bool getSize(LLCoordScreen *size); - /*virtual*/ bool getSize(LLCoordWindow *size); - /*virtual*/ bool setPosition(LLCoordScreen position); - /*virtual*/ bool setSizeImpl(LLCoordScreen size); - /*virtual*/ bool setSizeImpl(LLCoordWindow size); - /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL); - /*virtual*/ void setTitle(const std::string title); + void show() override; + void hide() override; + void close() override; + bool getVisible() override; + bool getMinimized() override; + bool getMaximized() override; + bool maximize() override; + void minimize() override; + void restore() override; + bool getFullscreen(); + bool getPosition(LLCoordScreen *position) override; + bool getSize(LLCoordScreen *size) override; + bool getSize(LLCoordWindow *size) override; + bool setPosition(LLCoordScreen position) override; + bool setSizeImpl(LLCoordScreen size) override; + bool setSizeImpl(LLCoordWindow size) override; + bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override; + void setTitle(const std::string title) override; void* createSharedContext() override; void makeContextCurrent(void* context) override; void destroySharedContext(void* context) override; - /*virtual*/ void toggleVSync(bool enable_vsync); - /*virtual*/ bool setCursorPosition(LLCoordWindow position); - /*virtual*/ bool getCursorPosition(LLCoordWindow *position); - /*virtual*/ bool getCursorDelta(LLCoordCommon* delta); - /*virtual*/ bool isWrapMouse() const override { return !mAbsoluteCursorPosition; }; - /*virtual*/ void showCursor(); - /*virtual*/ void hideCursor(); - /*virtual*/ void showCursorFromMouseMove(); - /*virtual*/ void hideCursorUntilMouseMove(); - /*virtual*/ bool isCursorHidden(); - /*virtual*/ void updateCursor(); - /*virtual*/ ECursorType getCursor() const; - /*virtual*/ void captureMouse(); - /*virtual*/ void releaseMouse(); - /*virtual*/ void setMouseClipping( bool b ); - /*virtual*/ bool isClipboardTextAvailable(); - /*virtual*/ bool pasteTextFromClipboard(LLWString &dst); - /*virtual*/ bool copyTextToClipboard(const LLWString &src); - /*virtual*/ void flashIcon(F32 seconds); - /*virtual*/ F32 getGamma(); - /*virtual*/ bool setGamma(const F32 gamma); // Set the gamma - /*virtual*/ void setFSAASamples(const U32 fsaa_samples); - /*virtual*/ U32 getFSAASamples(); - /*virtual*/ bool restoreGamma(); // Restore original gamma table (before updating gamma) - /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } - /*virtual*/ void gatherInput(); - /*virtual*/ void delayInputProcessing(); - /*virtual*/ void swapBuffers(); - /*virtual*/ void restoreGLContext() {}; + void toggleVSync(bool enable_vsync) override; + bool setCursorPosition(LLCoordWindow position) override; + bool getCursorPosition(LLCoordWindow *position) override; + bool getCursorDelta(LLCoordCommon* delta) override; + bool isWrapMouse() const override { return !mAbsoluteCursorPosition; }; + void showCursor() override; + void hideCursor() override; + void showCursorFromMouseMove() override; + void hideCursorUntilMouseMove() override; + bool isCursorHidden() override; + void updateCursor() override; + ECursorType getCursor() const override; + void captureMouse() override; + void releaseMouse() override; + void setMouseClipping( bool b ) override; + bool isClipboardTextAvailable() override; + bool pasteTextFromClipboard(LLWString &dst) override; + bool copyTextToClipboard(const LLWString &src) override; + void flashIcon(F32 seconds) override; + F32 getGamma() override; + bool setGamma(const F32 gamma) override; // Set the gamma + void setFSAASamples(const U32 fsaa_samples) override; + U32 getFSAASamples() override; + bool restoreGamma() override; // Restore original gamma table (before updating gamma) + ESwapMethod getSwapMethod() override { return mSwapMethod; } + void gatherInput() override; + void delayInputProcessing() override; + void swapBuffers() override; // handy coordinate space conversion routines - /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordWindow *to); - /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordScreen *to); - /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordGL *to); - /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordWindow *to); - /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to); - /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to); + bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override; + bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override; + bool convertCoords(LLCoordWindow from, LLCoordGL *to) override; + bool convertCoords(LLCoordGL from, LLCoordWindow *to) override; + bool convertCoords(LLCoordScreen from, LLCoordGL *to) override; + bool convertCoords(LLCoordGL from, LLCoordScreen *to) override; - /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions); - /*virtual*/ F32 getNativeAspectRatio(); - /*virtual*/ F32 getPixelAspectRatio(); - /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; } + LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override; + F32 getNativeAspectRatio() override; + F32 getPixelAspectRatio() override; + void setNativeAspectRatio(F32 ratio) override { mOverrideAspectRatio = ratio; } - /*virtual*/ bool dialogColorPicker(F32 *r, F32 *g, F32 *b ); + bool dialogColorPicker(F32 *r, F32 *g, F32 *b ) override; - /*virtual*/ void *getPlatformWindow(); - /*virtual*/ void bringToFront(); - /*virtual*/ void focusClient(); + void *getPlatformWindow() override; + void bringToFront() override; + void focusClient() override; - /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, bool b); - /*virtual*/ void setLanguageTextInput( const LLCoordGL & pos ); - /*virtual*/ void updateLanguageTextInputArea(); - /*virtual*/ void interruptLanguageTextInput(); - /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); + void allowLanguageTextInput(LLPreeditor *preeditor, bool b) override; + void setLanguageTextInput( const LLCoordGL & pos ) override; + void updateLanguageTextInputArea() override; + void interruptLanguageTextInput() override; + void spawnWebBrowser(const std::string& escaped_url, bool async) override; - /*virtual*/ F32 getSystemUISize(); + F32 getSystemUISize() override; LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url ); @@ -129,14 +128,16 @@ class LLWindowWin32 : public LLWindow static std::vector getDynamicFallbackFontList(); static void setDPIAwareness(); - /*virtual*/ void* getDirectInput8(); - /*virtual*/ bool getInputDevices(U32 device_type_filter, + void* getDirectInput8() override; + bool getInputDevices(U32 device_type_filter, std::function osx_callback, void* win_callback, - void* userdata); + void* userdata) override; U32 getRawWParam() { return mRawWParam; } + void initWatchdog() override; + protected: LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 4f54a9d705a..da7268bf457 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -28,15 +28,15 @@ #define LL_LLCONTROL_H #include "llboost.h" -#include "llevent.h" #include "llstring.h" +#include "llpointer.h" #include "llrect.h" #include "llrefcount.h" #include "llinstancetracker.h" +#include #include -#include #include class LLVector3; @@ -341,7 +341,7 @@ class LLControlCache : public LLRefCount, public LLInstanceTrackergetSignal()->connect(0, - boost::bind(&LLControlCache::handleValueChange, this, _2) + std::bind(&LLControlCache::handleValueChange, this, std::placeholders::_2) ); mType = controlp->type(); } @@ -400,7 +400,7 @@ class LLCachedControl } operator const T&() const { return mCachedControlPtr->getValue(); } - operator boost::function () const { return boost::function(*this); } + operator std::function () const { return std::function(*this); } const T& operator()() { return mCachedControlPtr->getValue(); } private: diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 8869f4b1f60..0949a3b59f2 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -219,6 +219,7 @@ set(viewer_SOURCE_FILES llfloatercreatelandmark.cpp llfloaterdeleteprefpreset.cpp llfloaterdestinations.cpp + llfloaterdirectory.cpp llfloaterdisplayname.cpp llfloatereditenvironmentbase.cpp llfloatereditextdaycycle.cpp @@ -441,11 +442,20 @@ set(viewer_SOURCE_FILES llpanelblockedlist.cpp llpanelclassified.cpp llpanelcontents.cpp + llpaneldirbrowser.cpp + llpaneldirclassified.cpp + llpaneldirevents.cpp + llpaneldirgroups.cpp + llpaneldirland.cpp + llpaneldirpeople.cpp + llpaneldirplaces.cpp + llpaneldirweb.cpp llpaneleditsky.cpp llpaneleditwater.cpp llpaneleditwearable.cpp llpanelemojicomplete.cpp llpanelenvironment.cpp + llpaneleventinfo.cpp llpanelexperiencelisteditor.cpp llpanelexperiencelog.cpp llpanelexperiencepicker.cpp @@ -726,7 +736,6 @@ set(viewer_SOURCE_FILES llvovolume.cpp llvowater.cpp llvowlsky.cpp - llwatchdog.cpp llwearableitemslist.cpp llwearablelist.cpp llweb.cpp @@ -894,6 +903,7 @@ set(viewer_HEADER_FILES llfloatercreatelandmark.h llfloaterdeleteprefpreset.h llfloaterdestinations.h + llfloaterdirectory.h llfloaterdisplayname.h llfloatereditenvironmentbase.h llfloatereditextdaycycle.h @@ -1108,11 +1118,20 @@ set(viewer_HEADER_FILES llpanelblockedlist.h llpanelclassified.h llpanelcontents.h + llpaneldirbrowser.h + llpaneldirclassified.h + llpaneldirevents.h + llpaneldirgroups.h + llpaneldirland.h + llpaneldirpeople.h + llpaneldirplaces.h + llpaneldirweb.h llpaneleditsky.h llpaneleditwater.h llpaneleditwearable.h llpanelemojicomplete.h llpanelenvironment.h + llpaneleventinfo.h llpanelexperiencelisteditor.h llpanelexperiencelog.h llpanelexperiencepicker.h @@ -1394,7 +1413,6 @@ set(viewer_HEADER_FILES llvovolume.h llvowater.h llvowlsky.h - llwatchdog.h llwearableitemslist.h llwearablelist.h llweb.h @@ -1963,6 +1981,7 @@ elseif (DARWIN) XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "$(inherited) -L${CMAKE_CURRENT_BINARY_DIR}/llphysicsextensions/$,$,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensions -Xlinker -map -Xlinker ${CMAKE_CURRENT_BINARY_DIR}/${VIEWER_BINARY_NAME}.MAP" XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=arm64] "$(inherited) -L${CMAKE_BINARY_DIR}/llphysicsextensionsos/$,$,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensionsos" ) + add_dependencies(${VIEWER_BINARY_NAME} llphysicsextensionsos) elseif(HAVOK_TPV) set_target_properties(${VIEWER_BINARY_NAME} PROPERTIES @@ -1973,6 +1992,7 @@ elseif (DARWIN) XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "$(inherited) -L${ARCH_PREBUILT_DIRS}/ -lllphysicsextensions_tpv" XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=arm64] "$(inherited) -L${CMAKE_BINARY_DIR}/llphysicsextensionsos/$,$,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensionsos" ) + add_dependencies(${VIEWER_BINARY_NAME} llphysicsextensionsos) else() target_link_libraries(${VIEWER_BINARY_NAME} llphysicsextensionsos) endif() diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 429dc57af3a..2aaedf99442 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -7.2.3 +26.1.0 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d6a1fbd124f..fe31a00ba33 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -655,6 +655,28 @@ Value 60 + AvatarRotateThresholdSlow + + Comment + Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving slowly (degrees) + Persist + 1 + Type + F32 + Value + 60 + + AvatarRotateThresholdFast + + Comment + Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving fast (degrees) + Persist + 1 + Type + F32 + Value + 2 + AvatarPhysics Comment @@ -4462,13 +4484,24 @@ MainloopTimeoutDefault Comment - Timeout duration for mainloop lock detection, in seconds. + Timeout duration for mainloop lock detection during teleports, login and logout, in seconds. Persist 1 Type F32 Value - 60.0 + 120.0 + + MainloopTimeoutStarted + + Comment + Timeout duration for mainloop lock detection when logged in and not teleporting, in seconds. + Persist + 1 + Type + F32 + Value + 30.0 MapScale @@ -7263,7 +7296,7 @@ RenderAvatarCloth Comment - DEPRECATED - only false supported - Controls if avatars use wavy cloth + Controls if system avatar clothes use wavy cloth Persist 1 Type @@ -9020,6 +9053,17 @@ Value 16 + RenderReflectionProbeShowTransparent + + Comment + Show reflection probes in the transparency debug view + Persist + 1 + Type + Boolean + Value + 1 + RenderReflectionProbeVolumes Comment @@ -11107,6 +11151,45 @@ Value 0 + ShowPGClassifieds + + Comment + Display results of find classifieds that are flagged as general + Persist + 1 + HideFromEditor + 1 + Type + Boolean + Value + 1 + + ShowMatureClassifieds + + Comment + Display results of find classifieds that are flagged as moderate + Persist + 1 + HideFromEditor + 1 + Type + Boolean + Value + 0 + + ShowAdultClassifieds + + Comment + Display results of find classifieds that are flagged as adult + Persist + 1 + HideFromEditor + 1 + Type + Boolean + Value + 0 + ShowPGSims Comment @@ -11146,6 +11229,54 @@ Value 0 + ShowPGEvents + + Comment + Display results of find events that are flagged as general + Persist + 1 + HideFromEditor + 1 + Type + Boolean + Value + 1 + + ShowMatureGroups + + Comment + Include groups that are flagged as mature to Search results + Persist + 1 + HideFromEditor + 1 + Type + Boolean + Value + 0 + + FindLandArea + + Comment + Enables filtering of land search results by area + Persist + 1 + Type + Boolean + Value + 0 + + FindLandPrice + + Comment + Enables filtering of land search results by price + Persist + 1 + Type + Boolean + Value + 1 + ShowNearClip Comment @@ -13742,13 +13873,13 @@ WatchdogEnabled Comment - Controls whether the thread watchdog timer is activated. Value is boolean. Set to -1 to defer to built-in default. + Controls whether the thread watchdog timer is activated. Value is S32. Set to -1 to defer to built-in default. Persist 0 Type S32 Value - 0 + 1 WaterGLFogDensityScale diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index aabbbac12a5..1b1233790e0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl @@ -28,6 +28,9 @@ uniform mat4 projection_matrix; in vec3 position; in vec3 normal; in vec2 texcoord0; +#ifdef AVATAR_CLOTH +in vec4 clothing; +#endif mat4 getSkinnedTransform(); @@ -37,6 +40,15 @@ out vec3 vary_normal; out vec2 vary_texcoord0; out vec3 vary_position; +#ifdef AVATAR_CLOTH +uniform vec4 gWindDir; +uniform vec4 gSinWaveParams; +uniform vec4 gGravity; + +const vec4 gMinMaxConstants = vec4(1.0, 0.166666, 0.0083143, .00018542); // #minimax-generated coefficients +const vec4 gPiConstants = vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963); // # {1/2PI, 2PI, PI, PI/2} +#endif + void main() { vary_texcoord0 = texcoord0; @@ -46,16 +58,78 @@ void main() vec4 pos_in = vec4(position.xyz, 1.0); mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], pos_in); - pos.y = dot(trans[1], pos_in); - pos.z = dot(trans[2], pos_in); - pos.w = 1.0; norm.x = dot(trans[0].xyz, normal); norm.y = dot(trans[1].xyz, normal); norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); +#ifdef AVATAR_CLOTH + //wind + vec4 windEffect; + windEffect = vec4(dot(norm, gWindDir.xyz)); + pos.x = dot(trans[2], pos_in); + windEffect.xyz = pos.x * vec3(0.015, 0.015, 0.015) + + windEffect.xyz; + windEffect.w = windEffect.w * 2.0 + 1.0; // move wind offset value to [-1, 3] + windEffect.w = windEffect.w*gWindDir.w; // modulate wind strength + + windEffect.xyz = windEffect.xyz*gSinWaveParams.xyz + +vec3(gSinWaveParams.w); // use sin wave params to scale and offset input + + //reduce to period of 2 PI + vec4 temp1, temp0, temp2, offsetPos; + temp1.xyz = windEffect.xyz * gPiConstants.x; // change input as multiple of [0-2PI] to [0-1] + temp0.y = mod(temp1.x,1.0); + windEffect.x = temp0.y * gPiConstants.y; // scale from [0,1] to [0, 2PI] + temp1.z = temp1.z - gPiConstants.w; // shift normal oscillation by PI/2 + temp0.y = mod(temp1.z,1.0); + + windEffect.z = temp0.y * gPiConstants.y; // scale from [0,1] to [0, 2PI] + windEffect.xyz = windEffect.xyz + vec3(-3.141592); // offset to [-PI, PI] + + //calculate sinusoid + vec4 sinWave; + temp1 = windEffect*windEffect; + sinWave = -temp1 * gMinMaxConstants.w + + vec4(gMinMaxConstants.z); // y = -(x^2)/7! + 1/5! + sinWave = sinWave * -temp1 + vec4(gMinMaxConstants.y); // y = -(x^2) * (-(x^2)/7! + 1/5!) + 1/3! + sinWave = sinWave * -temp1 + vec4(gMinMaxConstants.x); // y = -(x^2) * (-(x^2) * (-(x^2)/7! + 1/5!) + 1/3!) + 1 + sinWave = sinWave * windEffect; // y = x * (-(x^2) * (-(x^2) * (-(x^2)/7! + 1/5!) + 1/3!) + 1) + + // sinWave.x holds sin(norm . wind_direction) with primary frequency + // sinWave.y holds sin(norm . wind_direction) with secondary frequency + // sinWave.z hold cos(norm . wind_direction) with primary frequency + sinWave.xyz = sinWave.xyz * gWindDir.w + + vec3(windEffect.w); // multiply by wind strength in gWindDir.w [-wind, wind] + + // add normal facing bias offset [-wind,wind] -> [-wind - .25, wind + 1] + temp1 = vec4(dot(norm, gGravity.xyz)); // how much is this normal facing in direction of gGravity? + temp1 = min(temp1, vec4(0.2,0.0,0.0,0.0)); // clamp [-1, 1] to [-1, 0.2] + temp1 = temp1*vec4(1.5,0.0,0.0,0.0); // scale from [-1,0.2] to [-1.5, 0.3] + sinWave.x = sinWave.x + temp1.x; // add gGravity effect to sinwave (only primary frequency) + sinWave.xyz = sinWave.xyz * clothing.w; // modulate by clothing coverage + + sinWave.xyz = max(sinWave.xyz, vec3(-1.0, -1.0, -1.0)); // clamp to underlying body shape + offsetPos = clothing * sinWave.x; // multiply wind effect times clothing displacement + temp2 = gWindDir*sinWave.z + vec4(norm,0); // calculate normal offset due to wind oscillation + offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+pos_in; // add to offset vertex position, and zero out effect from w + norm += temp2.xyz*2.0; // add sin wave effect on normals (exaggerated) + + //renormalize normal (again) + norm = normalize(norm); + + pos.x = dot(trans[0], offsetPos); + pos.y = dot(trans[1], offsetPos); + pos.z = dot(trans[2], offsetPos); + pos.w = 1.0; +#else + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); + pos.w = 1.0; +#endif + vary_normal = norm; vary_position = pos.xyz; diff --git a/indra/newview/gltf/asset.cpp b/indra/newview/gltf/asset.cpp index 28f30ae1c97..51fb019e934 100644 --- a/indra/newview/gltf/asset.cpp +++ b/indra/newview/gltf/asset.cpp @@ -33,10 +33,11 @@ #include "../llviewertexturelist.h" #include "../pipeline.h" #include "buffer_util.h" -#include #include "llimagejpeg.h" #include "../llskinningutil.h" +#include + using namespace LL::GLTF; using namespace boost::json; @@ -961,8 +962,40 @@ LLViewerFetchedTexture* fetch_texture(const LLUUID& id); bool Image::prep(Asset& asset, bool loadIntoVRAM) { mLoadIntoTexturePipe = loadIntoVRAM; + LLUUID id; if (mUri.size() == UUID_STR_SIZE && LLUUID::parseUUID(mUri, &id) && id.notNull()) + { // loaded from an asset, fetch the texture from the asset system + LL_DEBUGS("GLTF") << "Loading image from an id" << id<< LL_ENDL; + } + else if (mUri.find("data:") == 0) + { // embedded in a data URI, load the texture from the URI + LL_WARNS("GLTF") << "Data URIs not yet supported" << LL_ENDL; + return false; + } + + // Image::prepImpl containes code that must run on the main thread + std::promise prep_promise; + std::future prep_future = prep_promise.get_future(); + + LLAppViewer::instance()->postToMainCoro([this, &asset, id, &prep_promise]() mutable { + try { + bool result = prepImpl(asset, id); + prep_promise.set_value(result); + } + catch (...) { + // Propagate exception to the waiting thread + prep_promise.set_exception(std::current_exception()); + } + }); + + // Block until prep is done on the main thread + return prep_future.get(); +} + +bool Image::prepImpl(Asset& asset, const LLUUID& id) +{ + if (id.notNull()) { // loaded from an asset, fetch the texture from the asset system mTexture = fetch_texture(id); } diff --git a/indra/newview/gltf/asset.h b/indra/newview/gltf/asset.h index b9554d753ca..2802664ed37 100644 --- a/indra/newview/gltf/asset.h +++ b/indra/newview/gltf/asset.h @@ -320,6 +320,8 @@ namespace LL void clearData(Asset& asset); bool prep(Asset& asset, bool loadIntoVRAM); + private: + bool prepImpl(Asset& asset, const LLUUID& id); }; // Render Batch -- vertex buffer and list of primitives to render using diff --git a/indra/newview/gltf/llgltfloader.cpp b/indra/newview/gltf/llgltfloader.cpp index 4f8f80129d9..3a1d8079a93 100644 --- a/indra/newview/gltf/llgltfloader.cpp +++ b/indra/newview/gltf/llgltfloader.cpp @@ -602,11 +602,12 @@ LLGLTFLoader::LLGLTFImportMaterial LLGLTFLoader::processMaterial(S32 material_in if (material->mPbrMetallicRoughness.mBaseColorTexture.mIndex >= 0) { S32 texIndex = material->mPbrMetallicRoughness.mBaseColorTexture.mIndex; - std::string filename = processTexture(texIndex, "base_color", material->mName); + std::string full_path; + std::string filename = processTexture(full_path, texIndex, "base_color", material->mName); if (!filename.empty()) { - impMat.mDiffuseMapFilename = filename; + impMat.mDiffuseMapFilename = full_path; impMat.mDiffuseMapLabel = material->mName.empty() ? filename : material->mName; // Check if the texture is already loaded @@ -637,7 +638,7 @@ LLGLTFLoader::LLGLTFImportMaterial LLGLTFLoader::processMaterial(S32 material_in return cachedMat; } -std::string LLGLTFLoader::processTexture(S32 texture_index, const std::string& texture_type, const std::string& material_name) +std::string LLGLTFLoader::processTexture(std::string& full_path_out, S32 texture_index, const std::string& texture_type, const std::string& material_name) { S32 sourceIndex; if (!validateTextureIndex(texture_index, sourceIndex)) @@ -661,6 +662,12 @@ std::string LLGLTFLoader::processTexture(S32 texture_index, const std::string& t { // Uri might be escaped filename = LLURI::unescape(filename); + full_path = dir + gDirUtilp->getDirDelimiter() + filename; + } + + if (gDirUtilp->fileExists(full_path)) + { + full_path_out = full_path; } LL_INFOS("GLTF_IMPORT") << "Found texture: " << filename << " for material: " << material_name << LL_ENDL; diff --git a/indra/newview/gltf/llgltfloader.h b/indra/newview/gltf/llgltfloader.h index 7aa1a94c201..a847e567a62 100644 --- a/indra/newview/gltf/llgltfloader.h +++ b/indra/newview/gltf/llgltfloader.h @@ -149,7 +149,7 @@ class LLGLTFLoader : public LLModelLoader void processNodeHierarchy(S32 node_idx, std::map& mesh_name_counts, U32 submodel_limit, const LLVolumeParams& volume_params); bool addJointToModelSkin(LLMeshSkinInfo& skin_info, S32 gltf_skin_idx, size_t gltf_joint_idx); LLGLTFImportMaterial processMaterial(S32 material_index, S32 fallback_index); - std::string processTexture(S32 texture_index, const std::string& texture_type, const std::string& material_name); + std::string processTexture(std::string& full_path_out, S32 texture_index, const std::string& texture_type, const std::string& material_name); bool validateTextureIndex(S32 texture_index, S32& source_index); std::string generateMaterialName(S32 material_index, S32 fallback_index = -1); bool populateModelFromMesh(LLModel* pModel, const std::string& base_name, const LL::GLTF::Mesh &mesh, const LL::GLTF::Node &node, material_map& mats); diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp index 54d8ceb85a9..b30fe16c58e 100644 --- a/indra/newview/llaccountingcostmanager.cpp +++ b/indra/newview/llaccountingcostmanager.cpp @@ -53,8 +53,8 @@ void LLAccountingCostManager::accountingCostCoro(std::string url, LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("AccountingCost", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("accountingCostCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); try { diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e95d192f726..0d7ad0a1246 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -437,8 +437,8 @@ LLAgent::LLAgent() : mAutoPilotTargetDist(0.f), mAutoPilotNoProgressFrameCount(0), mAutoPilotRotationThreshold(0.f), - mAutoPilotFinishedCallback(NULL), - mAutoPilotCallbackData(NULL), + mAutoPilotFinishedCallback(nullptr), + mAutoPilotCallbackData(nullptr), mMovementKeysLocked(false), @@ -455,8 +455,8 @@ LLAgent::LLAgent() : mVoiceConnected(false), - mMouselookModeInSignal(NULL), - mMouselookModeOutSignal(NULL) + mMouselookModeInSignal(nullptr), + mMouselookModeOutSignal(nullptr) { for (U32 i = 0; i < TOTAL_CONTROLS; i++) { @@ -464,7 +464,7 @@ LLAgent::LLAgent() : mControlsTakenPassedOnCount[i] = 0; } - mListener.reset(new LLAgentListener(*this)); + mListener = std::make_shared(*this); addParcelChangedCallback(&setCanEditParcel); @@ -4700,9 +4700,9 @@ void LLAgent::requestAgentUserInfoCoro(std::string capurl) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestAgentUserInfoCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("requestAgentUserInfoCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; httpOpts->setFollowRedirects(true); @@ -4760,9 +4760,9 @@ void LLAgent::updateAgentUserInfoCoro(std::string capurl, std::string directory_ { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestAgentUserInfoCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("requestAgentUserInfoCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; httpOpts->setFollowRedirects(true); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index c1d3c6c14b2..3352890d999 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -39,9 +39,10 @@ #include "httprequest.h" #include "llcorehttputil.h" -#include #include +#include + extern const bool ANIMATE; extern const U8 AGENT_STATE_TYPING; // Typing indication extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected @@ -254,7 +255,7 @@ class LLAgent : public LLOldEvents::LLObservable void changeParcels(); // called by LLViewerParcelMgr when we cross a parcel boundary // Register a boost callback to be called when the agent changes parcels - typedef boost::function parcel_changed_callback_t; + typedef std::function parcel_changed_callback_t; boost::signals2::connection addParcelChangedCallback(parcel_changed_callback_t); private: @@ -756,7 +757,7 @@ class LLAgent : public LLOldEvents::LLObservable void requestEnterGodMode(); void requestLeaveGodMode(); - typedef boost::function god_level_change_callback_t; + typedef std::function god_level_change_callback_t; typedef boost::signals2::signal god_level_change_signal_t; typedef boost::signals2::connection god_level_change_slot_t; @@ -964,8 +965,8 @@ class LLAgent : public LLOldEvents::LLObservable /// Utilities for allowing the the agent sub managers to post and get via /// HTTP using the agent's policy settings and headers. - bool requestPostCapability(const std::string &capName, LLSD &postData, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL); - bool requestGetCapability(const std::string &capName, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL); + bool requestPostCapability(const std::string &capName, LLSD &postData, httpCallback_t cbSuccess = nullptr, httpCallback_t cbFailure = nullptr); + bool requestGetCapability(const std::string& capName, httpCallback_t cbSuccess = nullptr, httpCallback_t cbFailure = nullptr); LLCore::HttpRequest::policy_t getAgentPolicy() const { return mHttpPolicy; } diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index 265e4060ff9..4a5c037f1f5 100644 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -53,7 +53,7 @@ class LLAgentPicksInfo::LLAgentPicksObserver : public LLAvatarPropertiesObserver LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgent.getID()); } - typedef boost::function server_respond_callback_t; + typedef std::function server_respond_callback_t; void setServerRespondCallback(const server_respond_callback_t& cb) { diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 1e118ffa98a..70da86805cb 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -189,11 +189,11 @@ class LLAgentWearables : public LLInitClass, public LLWearable // Signals //-------------------------------------------------------------------- public: - typedef boost::function loading_started_callback_t; + typedef std::function loading_started_callback_t; typedef boost::signals2::signal loading_started_signal_t; boost::signals2::connection addLoadingStartedCallback(loading_started_callback_t cb); - typedef boost::function loaded_callback_t; + typedef std::function loaded_callback_t; typedef boost::signals2::signal loaded_signal_t; boost::signals2::connection addLoadedCallback(loaded_callback_t cb); diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 5114ac8a081..1da1647fe83 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -861,8 +861,8 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht return; } - LLCore::HttpOptions::ptr_t httpOptions(new LLCore::HttpOptions); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpOptions::ptr_t httpOptions = std::make_shared(); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; httpOptions->setTimeout(HTTP_TIMEOUT); @@ -950,7 +950,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht LL_DEBUGS("Inventory", "AIS3") << "Result: " << result << LL_ENDL; onUpdateReceived(result, type, body); - if (callback && !callback.empty()) + if (callback != nullptr) { bool needs_callback = true; LLUUID id(LLUUID::null); diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index dd490c82683..cfc286da2e8 100644 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -44,7 +44,7 @@ class AISAPI LIBRARY } ITEM_TYPE; - typedef boost::function completion_t; + typedef std::function completion_t; static bool isAvailable(); static void getCapNames(LLSD& capNames); @@ -89,7 +89,7 @@ class AISAPI static const std::string INVENTORY_CAP_NAME; static const std::string LIBRARY_CAP_NAME; - typedef boost::function < LLSD (LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t, LLCore::HttpRequest::ptr_t, + typedef std::function invokationFn_t; static void EnqueueAISCommand(const std::string &procName, LLCoprocedureManager::CoProcedure_t proc); diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index f4f19906f13..f3265afebd0 100644 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -145,8 +145,8 @@ LLAppCoreHttp::~LLAppCoreHttp() void LLAppCoreHttp::init() { LLCoreHttpUtil::setPropertyMethods( - boost::bind(&LLControlGroup::getBOOL, boost::ref(gSavedSettings), _1), - boost::bind(&LLControlGroup::declareBOOL, boost::ref(gSavedSettings), _1, _2, _3, LLControlVariable::PERSIST_NONDFT)); + std::bind(&LLControlGroup::getBOOL, std::ref(gSavedSettings), std::placeholders::_1), + std::bind(&LLControlGroup::declareBOOL, std::ref(gSavedSettings), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, LLControlVariable::PERSIST_NONDFT)); LLCore::LLHttp::initialize(); diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index af18dca1854..0b3d0355a27 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -28,9 +28,11 @@ #if defined(LL_BUGSPLAT) #include #include -@import BugsplatMac; +@import CrashReporter; +@import HockeySDK; +@import BugSplatMac; // derived from BugsplatMac's BugsplatTester/AppDelegate.m -@interface LLAppDelegate () +@interface LLAppDelegate () @end #endif #include "llwindowmacosx-objc.h" @@ -68,13 +70,22 @@ - (void) applicationDidFinishLaunching:(NSNotification *)notification #if defined(LL_BUGSPLAT) infos("bugsplat setup"); - // Engage BugsplatStartupManager *before* calling initViewer() to handle + // Engage BugSplat *before* calling initViewer() to handle // any crashes during initialization. // https://www.bugsplat.com/docs/platforms/os-x#initialization - [BugsplatStartupManager sharedManager].autoSubmitCrashReport = YES; - [BugsplatStartupManager sharedManager].askUserDetails = NO; - [BugsplatStartupManager sharedManager].delegate = self; - [[BugsplatStartupManager sharedManager] start]; + + // Initialize BugSplat + [[BugSplat shared] setDelegate:self]; + [[BugSplat shared] setAutoSubmitCrashReport:YES]; + [[BugSplat shared] setPersistUserDetails:NO]; + [[BugSplat shared] setAskUserDetails:NO]; + [BugSplat shared].expirationTimeInterval = 0; + [[BugSplat shared] start]; + + // Optionally, add some attributes to your crash reports. + // Attributes are artibrary key/value pairs that are searchable in the BugSplat dashboard. + // [[BugSplat shared] setValue:@"Value of Plain Attribute" forAttribute:@"PlainAttribute"]; + #endif infos("post-bugsplat setup"); @@ -213,9 +224,54 @@ - (bool) romanScript return true; } +- (void) setBugsplatValue:(nullable NSString *)value forAttribute:(NSString *)attribute +{ +#if defined(LL_BUGSPLAT) + //[[BugSplat shared] setValue:@"Value of not so plain Attribute" forAttribute:@"NotSoPlainAttribute"]; + [[BugSplat shared] setValue:value forAttribute:attribute]; +#endif // LL_BUGSPLAT +} + #if defined(LL_BUGSPLAT) -- (NSString *)applicationLogForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager +- (void)bugSplatWillSendCrashReport:(BugSplat *)bugSplat +{ + infos("bugSplatWillSendCrashReport"); +} + +- (void)bugSplatWillSendCrashReportsAlways:(BugSplat *)bugSplat +{ + infos("bugSplatWillSendCrashReportsAlways"); +} + +- (void)bugSplatDidFinishSendingCrashReport:(BugSplat *)bugSplat +{ + infos("bugSplatDidFinishSendingCrashReport"); + + if(!secondLogPath.empty()) + { + boost::filesystem::remove(secondLogPath); + } + clearDumpLogsDir(); +} + +- (void)bugSplatWillCancelSendingCrashReport:(BugSplat *)bugSplat +{ + infos("bugSplatWillCancelSendingCrashReport"); +} + +- (void)bugSplatWillShowSubmitCrashReportAlert:(BugSplat *)bugSplat +{ + infos("bugSplatWillShowSubmitCrashReportAlert"); +} + +- (void)bugSplat:(BugSplat *)bugSplat didFailWithError:(NSError *)error +{ + std::string error_str([[error localizedDescription] UTF8String]); + infos("bugSplat:didFailWithError: " + error_str); +} + +- (NSString *)applicationLogForBugSplat:(BugSplat *)bugSplat; { CrashMetadata& meta(CrashMetadata_instance()); // As of BugsplatMac 1.0.6, userName and userEmail properties are now @@ -226,16 +282,21 @@ - (NSString *)applicationLogForBugsplatStartupManager:(BugsplatStartupManager *) // report we are about to send. infos("applicationLogForBugsplatStartupManager setting userName = '" + meta.agentFullname + '"'); - bugsplatStartupManager.userName = + bugSplat.userName = [NSString stringWithCString:meta.agentFullname.c_str() encoding:NSUTF8StringEncoding]; // Use the email field for OS version, just as we do on Windows, until // BugSplat provides more metadata fields. infos("applicationLogForBugsplatStartupManager setting userEmail = '" + meta.OSInfo + '"'); - bugsplatStartupManager.userEmail = + bugSplat.userEmail = [NSString stringWithCString:meta.OSInfo.c_str() encoding:NSUTF8StringEncoding]; + + //bugSplat.userID = + // [NSString stringWithCString:meta.regionName.c_str() + // encoding:NSUTF8StringEncoding]; + // This strangely-named override method's return value contributes the // User Description metadata field. infos("applicationLogForBugsplatStartupManager -> '" + meta.fatalMessage + "'"); @@ -243,7 +304,8 @@ - (NSString *)applicationLogForBugsplatStartupManager:(BugsplatStartupManager *) encoding:NSUTF8StringEncoding]; } -- (NSString *)applicationKeyForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager signal:(NSString *)signal exceptionName:(NSString *)exceptionName exceptionReason:(NSString *)exceptionReason { +- (NSString *)applicationKeyForBugSplat:(BugSplat *)bugSplat signal:(NSString *)signal exceptionName:(NSString *)exceptionName exceptionReason:(NSString *)exceptionReason +{ // TODO: exceptionName, exceptionReason // Windows sends location within region as well, but that's because @@ -258,27 +320,6 @@ - (NSString *)applicationKeyForBugsplatStartupManager:(BugsplatStartupManager *) encoding:NSUTF8StringEncoding]; } -- (NSString *)defaultUserNameForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager { - std::string agentFullname(CrashMetadata_instance().agentFullname); - infos("defaultUserNameForBugsplatStartupManager -> '" + agentFullname + "'"); - return [NSString stringWithCString:agentFullname.c_str() - encoding:NSUTF8StringEncoding]; -} - -- (NSString *)defaultUserEmailForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager { - // Use the email field for OS version, just as we do on Windows, until - // BugSplat provides more metadata fields. - std::string OSInfo(CrashMetadata_instance().OSInfo); - infos("defaultUserEmailForBugsplatStartupManager -> '" + OSInfo + "'"); - return [NSString stringWithCString:OSInfo.c_str() - encoding:NSUTF8StringEncoding]; -} - -- (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugsplatStartupManager -{ - infos("bugsplatStartupManagerWillSendCrashReport"); -} - struct AttachmentInfo { AttachmentInfo(const std::string& path, const std::string& type): @@ -290,7 +331,7 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs std::string pathname, basename, mimetype; }; -- (NSArray *)attachmentsForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager +- (NSArray *)attachmentsForBugSplat:(BugSplat *)bugSplat { const CrashMetadata& metadata(CrashMetadata_instance()); @@ -311,12 +352,12 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs info.push_back(AttachmentInfo(secondLogPath, "text/xml")); } - // We "happen to know" that info[0].basename is "SecondLife.old" -- due to + // We "happen to know" that info[0].basename is "SecondLife.crash" -- due to // the fact that BugsplatMac only notices a crash during the viewer run // following the crash. // The Bugsplat service doesn't respect the MIME type above when returning // the log data to a browser, so take this opportunity to rename the file - // from .old to _log.txt + // from .crash to _log.txt info[0].basename = boost::filesystem::path(info[0].pathname).stem().string() + "_log.txt"; infos("attachmentsForBugsplatStartupManager attaching log " + info[0].basename); @@ -334,8 +375,8 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs encoding:NSUTF8StringEncoding]; NSData *nsdata = [NSData dataWithContentsOfFile:nspathname]; - BugsplatAttachment *attachment = - [[BugsplatAttachment alloc] initWithFilename:nsbasename + BugSplatAttachment *attachment = + [[BugSplatAttachment alloc] initWithFilename:nsbasename attachmentData:nsdata contentType:nsmimetype]; @@ -346,23 +387,6 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs return attachments; } -- (void)bugsplatStartupManagerDidFinishSendingCrashReport:(BugsplatStartupManager *)bugsplatStartupManager -{ - infos("Sent crash report to BugSplat"); - - if(!secondLogPath.empty()) - { - boost::filesystem::remove(secondLogPath); - } - clearDumpLogsDir(); -} - -- (void)bugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager didFailWithError:(NSError *)error -{ - // TODO: message string from NSError - infos("Could not send crash report to BugSplat"); -} - #endif // LL_BUGSPLAT @end diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 0d57b33a516..f65aaccddc6 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3908,7 +3908,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd LL_DEBUGS("Avatar") << "Will send request for cof_version " << cofVersion << LL_ENDL; bRetry = false; - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) { @@ -4379,8 +4379,8 @@ LLAppearanceMgr::LLAppearanceMgr(): outfit_observer.addCOFSavedCallback(boost::bind( &LLAppearanceMgr::setOutfitLocked, this, false)); - mUnlockOutfitTimer.reset(new LLOutfitUnLockTimer((F32)gSavedSettings.getS32( - "OutfitOperationsTimeout"))); + mUnlockOutfitTimer = std::make_unique((F32)gSavedSettings.getS32( + "OutfitOperationsTimeout")); gIdleCallbacks.addFunction(&LLAttachmentsMgr::onIdle, NULL); gIdleCallbacks.addFunction(&LLAppearanceMgr::onIdle, NULL); //sheduling appearance update requests diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 0a41a91750c..131b6817edc 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -235,7 +235,7 @@ class LLAppearanceMgr: public LLSingleton void setAppearanceServiceURL(const std::string& url) { mAppearanceServiceURL = url; } std::string getAppearanceServiceURL() const; - typedef boost::function attachments_changed_callback_t; + typedef std::function attachments_changed_callback_t; typedef boost::signals2::signal attachments_changed_signal_t; boost::signals2::connection setAttachmentsChangedCallback(attachments_changed_callback_t cb); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index bfd8b1dcc74..e7110644555 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -216,7 +216,6 @@ #include "llfloatersimplesnapshot.h" #include "llfloatersnapshot.h" #include "llsidepanelinventory.h" -#include "llatmosphere.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -1232,15 +1231,15 @@ bool LLAppViewer::init() /// Tell the Coprocedure manager how to discover and store the pool sizes // what I wanted LLCoprocedureManager::getInstance()->setPropertyMethods( - boost::bind(&LLControlGroup::getU32, boost::ref(gSavedSettings), _1), - boost::bind(&LLControlGroup::declareU32, boost::ref(gSavedSettings), _1, _2, _3, LLControlVariable::PERSIST_ALWAYS)); + std::bind(&LLControlGroup::getU32, std::ref(gSavedSettings), std::placeholders::_1), + std::bind(&LLControlGroup::declareU32, std::ref(gSavedSettings), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, LLControlVariable::PERSIST_ALWAYS)); // TODO: consider moving proxy initialization here or LLCopocedureManager after proxy initialization, may be implement // some other protection to make sure we don't use network before initializng proxy /*----------------------------------------------------------------------*/ // nat 2016-06-29 moved the following here from the former mainLoop(). - mMainloopTimeout = new LLWatchdogTimeout(); + mMainloopTimeout = new LLWatchdogTimeout("mainloop"); // Create IO Pump to use for HTTP Requests. gServicePump = new LLPumpIO(gAPRPoolp); @@ -1430,12 +1429,14 @@ bool LLAppViewer::doFrame() { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df mainloop"); + pingMainloopTimeout("df mainloop"); // canonical per-frame event mainloop.post(newFrame); } { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df suspend"); + pingMainloopTimeout("df suspend"); // give listeners a chance to run llcoro::suspend(); // if one of our coroutines threw an uncaught exception, rethrow it now @@ -1471,6 +1472,7 @@ bool LLAppViewer::doFrame() { { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df pauseMainloopTimeout"); + pingMainloopTimeout("df idle"); // So that it will be aware of last state. pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds! } @@ -1482,7 +1484,7 @@ bool LLAppViewer::doFrame() { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df resumeMainloopTimeout"); - resumeMainloopTimeout(); + resumeMainloopTimeout("df idle"); } } @@ -1497,7 +1499,7 @@ bool LLAppViewer::doFrame() } disconnectViewer(); - resumeMainloopTimeout(); + resumeMainloopTimeout("df snapshot n disconnect"); } // Render scene. @@ -1700,8 +1702,6 @@ void LLAppViewer::flushLFSIO() bool LLAppViewer::cleanup() { - LLAtmosphere::cleanupClass(); - //ditch LLVOAvatarSelf instance gAgentAvatarp = NULL; @@ -2304,7 +2304,22 @@ void errorHandler(const std::string& title_string, const std::string& message_st } if (!message_string.empty()) { - OSMessageBox(message_string, title_string.empty() ? LLTrans::getString("MBFatalError") : title_string, OSMB_OK); + if (on_main_thread()) + { + // Prevent watchdog from killing us while dialog is up. + // Can't do pauseMainloopTimeout, since this may be called + // from threads and we are not going to need watchdog now. + LLAppViewer::instance()->pauseMainloopTimeout(); + + // todo: might want to have non-crashing timeout for OOM cases + // and needs a way to pause main loop. + OSMessageBox(message_string, title_string.empty() ? LLTrans::getString("MBFatalError") : title_string, OSMB_OK); + LLAppViewer::instance()->resumeMainloopTimeout(); + } + else + { + OSMessageBox(message_string, title_string.empty() ? LLTrans::getString("MBFatalError") : title_string, OSMB_OK); + } } } @@ -3148,7 +3163,7 @@ bool LLAppViewer::initWindow() // Need to load feature table before cheking to start watchdog. bool use_watchdog = false; - int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled"); + S32 watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled"); if (watchdog_enabled_setting == -1) { use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled"); @@ -3167,7 +3182,19 @@ bool LLAppViewer::initWindow() if (use_watchdog) { - LLWatchdog::getInstance()->init(); + LLWatchdog::getInstance()->init([]() + { + LLAppViewer* app = LLAppViewer::instance(); + if (app->logoutRequestSent()) + { + app->createErrorMarker(LAST_EXEC_LOGOUT_FROZE); + } + else + { + app->createErrorMarker(LAST_EXEC_FROZE); + } + }); + gViewerWindow->getWindow()->initWatchdog(); } LLNotificationsUI::LLNotificationManager::getInstance(); @@ -3622,10 +3649,15 @@ void LLAppViewer::writeSystemInfo() if (! gDebugInfo.has("Dynamic") ) gDebugInfo["Dynamic"] = LLSD::emptyMap(); -#if LL_WINDOWS && !LL_BUGSPLAT +#if LL_DARWIN + // crash processing in CrashMetadataSingleton reads SLLog + gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.crash"); +#elif LL_WINDOWS && !LL_BUGSPLAT gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log"); #else - //Not ideal but sufficient for good reporting. + // Far from ideal, especially when multiple instances get involved. + // Note that attachmentsForBugSplat expects .old extendion. + // Todo: improve. gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.old"); //LLError::logFileName(); #endif @@ -3948,7 +3980,7 @@ void LLAppViewer::processMarkerFiles() #if LL_WINDOWS && LL_BUGSPLAT // bugsplat will set correct state in bugsplatSendLog // Might be more accurate to rename this one into 'unknown' - gLastExecEvent = LAST_EXEC_FROZE; + gLastExecEvent = LAST_EXEC_UNKNOWN; #else gLastExecEvent = LAST_EXEC_OTHER_CRASH; #endif // LL_WINDOWS @@ -3994,7 +4026,8 @@ void LLAppViewer::processMarkerFiles() { if (markerIsSameVersion(logout_marker_file)) { - gLastExecEvent = LAST_EXEC_LOGOUT_FROZE; + // Either froze, got killed or somehow crash was not caught + gLastExecEvent = LAST_EXEC_LOGOUT_UNKNOWN; LL_INFOS("MarkerFile") << "Logout crash marker '"<< logout_marker_file << "', changing LastExecEvent to LOGOUT_FROZE" << LL_ENDL; } else @@ -4032,6 +4065,22 @@ void LLAppViewer::processMarkerFiles() } LLAPRFile::remove(error_marker_file); } + +#if LL_DARWIN + if (!mSecondInstance && gLastExecEvent != LAST_EXEC_NORMAL) + { + // While windows reports crashes immediately, mac reports next run and + // may take a while to trigger crash report so it has a special file. + // Remove .crash file if exists + std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, + "SecondLife.old"); + std::string crash_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, + "SecondLife.crash"); + LLFile::remove(crash_log_file); + // Rename ".old" log file to ".crash" + LLFile::rename(old_log_file, crash_log_file); + } +#endif } void LLAppViewer::removeMarkerFiles() @@ -4386,6 +4435,8 @@ bool LLAppViewer::initCache() LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL; gSavedSettings.setString("CacheLocation", ""); gSavedSettings.setString("CacheLocationTopFolder", ""); + gSavedSettings.setString("NewCacheLocation", ""); + gSavedSettings.setString("NewCacheLocationTopFolder", ""); } const std::string cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name); @@ -4438,7 +4489,7 @@ bool LLAppViewer::initCache() return true; } -void LLAppViewer::addOnIdleCallback(const boost::function& cb) +void LLAppViewer::addOnIdleCallback(const std::function& cb) { gMainloopWork.post(cb); } @@ -5800,12 +5851,12 @@ void LLAppViewer::forceExceptionThreadCrash() thread->start(); } -void LLAppViewer::initMainloopTimeout(std::string_view state, F32 secs) +void LLAppViewer::initMainloopTimeout(std::string_view state) { if (!mMainloopTimeout) { - mMainloopTimeout = new LLWatchdogTimeout(); - resumeMainloopTimeout(state, secs); + mMainloopTimeout = new LLWatchdogTimeout("mainloop"); + resumeMainloopTimeout(state); } } @@ -5818,17 +5869,11 @@ void LLAppViewer::destroyMainloopTimeout() } } -void LLAppViewer::resumeMainloopTimeout(std::string_view state, F32 secs) +void LLAppViewer::resumeMainloopTimeout(std::string_view state) { if (mMainloopTimeout) { - if (secs < 0.0f) - { - static LLCachedControl mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60.f); - secs = mainloop_timeout; - } - - mMainloopTimeout->setTimeout(secs); + mMainloopTimeout->setTimeout(getMainloopTimeoutSec()); mMainloopTimeout->start(state); } } @@ -5841,23 +5886,33 @@ void LLAppViewer::pauseMainloopTimeout() } } -void LLAppViewer::pingMainloopTimeout(std::string_view state, F32 secs) +void LLAppViewer::pingMainloopTimeout(std::string_view state) { LL_PROFILE_ZONE_SCOPED_CATEGORY_APP; if (mMainloopTimeout) { - if (secs < 0.0f) - { - static LLCachedControl mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60); - secs = mainloop_timeout; - } - - mMainloopTimeout->setTimeout(secs); + mMainloopTimeout->setTimeout(getMainloopTimeoutSec()); mMainloopTimeout->ping(state); } } + +F32 LLAppViewer::getMainloopTimeoutSec() const +{ + if (LLStartUp::getStartupState() == STATE_STARTED + && gAgent.getTeleportState() == LLAgent::TELEPORT_NONE) + { + static LLCachedControl mainloop_started(gSavedSettings, "MainloopTimeoutStarted", 30.f); + return mainloop_started(); + } + else + { + static LLCachedControl mainloop_default(gSavedSettings, "MainloopTimeoutDefault", 120.f); + return mainloop_default(); + } +} + void LLAppViewer::handleLoginComplete() { gLoggedInTime.start(); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 4f2583cb164..6b0d3e0b27c 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -77,6 +77,8 @@ typedef enum LAST_EXEC_BAD_ALLOC, LAST_EXEC_MISSING_FILES, LAST_EXEC_GRAPHICS_INIT, + LAST_EXEC_UNKNOWN, + LAST_EXEC_LOGOUT_UNKNOWN, LAST_EXEC_COUNT } eLastExecEvent; @@ -204,11 +206,13 @@ class LLAppViewer : public LLApp // For thread debugging. // llstartup needs to control init. // llworld, send_agent_pause() also controls pause/resume. - void initMainloopTimeout(std::string_view state, F32 secs = -1.0f); + void initMainloopTimeout(std::string_view state); void destroyMainloopTimeout(); void pauseMainloopTimeout(); - void resumeMainloopTimeout(std::string_view state = "", F32 secs = -1.0f); - void pingMainloopTimeout(std::string_view state, F32 secs = -1.0f); + void resumeMainloopTimeout(std::string_view state = ""); + void pingMainloopTimeout(std::string_view state); + + F32 getMainloopTimeoutSec() const; // Handle the 'login completed' event. // *NOTE:Mani Fix this for login abstraction!! @@ -222,7 +226,7 @@ class LLAppViewer : public LLApp return mOnLoginCompleted.connect(cb); } - void addOnIdleCallback(const boost::function& cb); // add a callback to fire (once) when idle + void addOnIdleCallback(const std::function& cb); // add a callback to fire (once) when idle void initGeneralThread(); void purgeUserDataOnExit() { mPurgeUserDataOnExit = true; } diff --git a/indra/newview/llappviewerlistener.h b/indra/newview/llappviewerlistener.h index 5ade3d3e042..8686d6522e0 100644 --- a/indra/newview/llappviewerlistener.h +++ b/indra/newview/llappviewerlistener.h @@ -30,7 +30,7 @@ #define LL_LLAPPVIEWERLISTENER_H #include "lleventapi.h" -#include +#include class LLAppViewer; class LLSD; @@ -39,7 +39,7 @@ class LLSD; class LLAppViewerListener: public LLEventAPI { public: - typedef boost::function LLAppViewerGetter; + typedef std::function LLAppViewerGetter; /// Bind the LLAppViewer instance to use (e.g. LLAppViewer::instance()). LLAppViewerListener(const LLAppViewerGetter& getter); diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 64b506a3353..0620b625d9b 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -176,7 +176,7 @@ namespace LLAppViewer* app = LLAppViewer::instance(); if (!app->isSecondInstance() && !app->errorMarkerExists()) { - // If marker doesn't exist, create a marker with 'other' code for next launch + // If marker doesn't exist, create a marker with 'other' or 'logout' code for next launch // otherwise don't override existing file // Any unmarked crashes will be considered as freezes if (app->logoutRequestSent()) diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 7dce6270445..9d9948731fa 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -269,11 +269,11 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestAvatarPropertiesCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("requestAvatarPropertiesCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setFollowRedirects(true); std::string finalUrl = cap_url + "/" + avatar_id.asString(); diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 44f35981b01..309bed6f8b2 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -77,9 +77,9 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64 { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("AvatarRenderInfoAccountant", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("AvatarRenderInfoAccountant", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); // Going to request each 15 seconds either way, so don't wait // too long and don't repeat @@ -194,9 +194,9 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("AvatarRenderInfoAccountant", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("AvatarRenderInfoAccountant", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); // Going to request each 60+ seconds, timeout is 30s. // Don't repeat too often, will be sending newer data soon diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 5114c97beb4..c19f7dc1c10 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -187,7 +187,7 @@ class LLChiclet : public LLUICtrl /*virtual*/ boost::signals2::connection setLeftButtonClickCallback( const commit_callback_t& cb); - typedef boost::function + typedef std::function chiclet_size_changed_callback_t; /** diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index 6f0e97a98b9..b349f35921e 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -54,7 +54,7 @@ class LLCOFWearables : public LLPanel LLCOFCallbacks() {}; virtual ~LLCOFCallbacks() {}; - typedef boost::function cof_callback_t; + typedef std::function cof_callback_t; cof_callback_t mAddWearable; cof_callback_t mMoveWearableCloser; diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index f21bae98057..0734b125313 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include "llsdserialize.h" #include "llerror.h" @@ -61,14 +60,7 @@ namespace // List of command-line switches that can't map-to settings variables. // Going forward, we want every new command-line switch to map-to some // settings variable. This list is used to validate that. - const std::set unmapped_options = boost::assign::list_of - ("help") - ("set") - ("setdefault") - ("settings") - ("sessionsettings") - ("usersessionsettings") - ; + const std::set unmapped_options = { "help", "set", "setdefault", "settings", "sessionsettings", "usersessionsettings" }; po::options_description gOptionsDesc; po::positional_options_description gPositionalOptions; @@ -101,7 +93,7 @@ class LLCLPValue : public po::value_semantic_codecvt_helper unsigned mMinTokens; unsigned mMaxTokens; bool mIsComposing; - typedef boost::function1 notify_callback_t; + typedef std::function notify_callback_t; notify_callback_t mNotifyCallback; bool mLastOption; @@ -226,7 +218,7 @@ class LLCLPValue : public po::value_semantic_codecvt_helper // LLCommandLineParser defintions //---------------------------------------------------------------------------- void LLCommandLineParser::addOptionDesc(const std::string& option_name, - boost::function1 notify_callback, + std::function notify_callback, unsigned int token_count, const std::string& description, const std::string& short_name, @@ -255,7 +247,7 @@ void LLCommandLineParser::addOptionDesc(const std::string& option_name, value_desc, description.c_str())); - if(!notify_callback.empty()) + if(notify_callback) { value_desc->setNotifyCallback(notify_callback); } @@ -693,7 +685,7 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG last_option = option_params["last_option"].asBoolean(); } - boost::function1 callback; + std::function callback; if (! option_params.has("map-to")) { // If this option isn't mapped to a settings variable, is it diff --git a/indra/newview/llcommandlineparser.h b/indra/newview/llcommandlineparser.h index 5279d02c0a5..984bcfbad0f 100644 --- a/indra/newview/llcommandlineparser.h +++ b/indra/newview/llcommandlineparser.h @@ -27,7 +27,7 @@ #ifndef LL_LLCOMMANDLINEPARSER_H #define LL_LLCOMMANDLINEPARSER_H -#include +#include // *NOTE:Mani The following is a forward decl of // boost::program_options::command_line_parser @@ -58,7 +58,7 @@ class LLCommandLineParser */ void addOptionDesc( const std::string& option_name, - boost::function1 notify_callback = 0, + std::function notify_callback = nullptr, unsigned int num_tokens = 0, const std::string& description = LLStringUtil::null, const std::string& short_name = LLStringUtil::null, @@ -121,7 +121,7 @@ class LLCommandLineParser * The parser_func takes an input string, and should return a * name/value pair as the result. */ - typedef boost::function1, const std::string&> parser_func; + typedef std::function(const std::string&)> parser_func; void setCustomParser(parser_func f) { mExtraParser = f; } private: diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 552ea75559a..e0236ca6180 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -467,7 +467,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle hfloat std::string url = object->getRegion()->getCapability("UpdateScriptTask"); { - LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(object->getID(), + LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared(object->getID(), inventory->getUUID(), assetId, monocompile ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2, @@ -475,7 +475,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle hfloat inventory->getName(), LLUUID(), experienceId, - boost::bind(&LLFloaterCompileQueue::handleHTTPResponse, pump.getName(), _4))); + boost::bind(&LLFloaterCompileQueue::handleHTTPResponse, pump.getName(), _4)); LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index 951d4800e8c..bcbb166c589 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -98,7 +98,7 @@ class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/ std::string mStartString; bool mMono; - typedef boost::function &, LLInventoryObject*, LLEventPump &)> fnQueueAction_t; + typedef std::function &, LLInventoryObject*, LLEventPump &)> fnQueueAction_t; static void objectScriptProcessingQueueCoro(std::string action, LLHandle hfloater, object_data_list_t objectList, fnQueueAction_t func); }; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 65a068e08d3..4a4985d8ac2 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -157,7 +157,10 @@ void LLConversation::setListenIMFloaterOpened() // if floater is already opened or this conversation doesn't have unread offline messages if (mHasOfflineIMs && !offline_ims_visible) { - mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback(boost::bind(&LLConversation::onIMFloaterShown, this, _1)); + mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback([this](const LLUUID& session_id) + { + onIMFloaterShown(session_id); + }); } else { diff --git a/indra/newview/llconversationloglistitem.cpp b/indra/newview/llconversationloglistitem.cpp index 20d5b0175be..e21a772f671 100644 --- a/indra/newview/llconversationloglistitem.cpp +++ b/indra/newview/llconversationloglistitem.cpp @@ -53,7 +53,10 @@ LLConversationLogListItem::LLConversationLogListItem(const LLConversation* conve if (mConversation->hasOfflineMessages() && !ims_are_read) { - mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback(boost::bind(&LLConversationLogListItem::onIMFloaterShown, this, _1)); + mIMFloaterShowedConnection = LLFloaterIMSession::setIMFloaterShowedCallback([this](const LLUUID& session_id) + { + onIMFloaterShown(session_id); + }); } } diff --git a/indra/newview/lldndbutton.h b/indra/newview/lldndbutton.h index 277c2aad69b..d503b367e1c 100644 --- a/indra/newview/lldndbutton.h +++ b/indra/newview/lldndbutton.h @@ -47,7 +47,7 @@ class LLDragAndDropButton : public LLButton LLDragAndDropButton(const Params& params); - typedef boost::functiongetOrigin(); LLVector3 cam_to_box_offset = point_to_box_offset(cam_pos_from_agent, av_box); mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f)); - mVObjp->updateLOD(); + if (mVObjp) + { + mVObjp->updateLOD(); + } return; } } @@ -936,7 +939,10 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) pos -= camera.getOrigin(); mDistanceWRTCamera = ll_round(pos.magVec(), 0.01f); - mVObjp->updateLOD(); + if (mVObjp) + { + mVObjp->updateLOD(); + } } } @@ -948,6 +954,11 @@ void LLDrawable::updateTexture() return; } + if (!mVObjp) + { + return; + } + if (getNumFaces() != mVObjp->getNumTEs()) { //drawable is transitioning its face count return; diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index a7ac9da6186..6f6faf9909b 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -67,17 +67,8 @@ class LLDrawable public: typedef std::vector face_list_t; - LLDrawable(const LLDrawable& rhs) - : LLViewerOctreeEntryData(rhs) - { - *this = rhs; - } - - const LLDrawable& operator=(const LLDrawable& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } + LLDrawable(const LLDrawable& rhs) = delete; + const LLDrawable& operator=(const LLDrawable& rhs) = delete; static void initClass(); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 87b6ce6cb3a..bc45734e667 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -278,7 +278,7 @@ void LLDrawPoolAlpha::forwardRender(bool rigged) void LLDrawPoolAlpha::renderDebugAlpha() { - if (sShowDebugAlpha) + if (sShowDebugAlpha && !gCubeSnapshot) { gHighlightProgram.bind(); gGL.diffuseColor4f(1, 0, 0, 1); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 90ee95d424b..f0f589e7f45 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -794,7 +794,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - if ((sShaderLevel >= SHADER_LEVEL_CLOTH)) + if (LLPipeline::RenderAvatarCloth) { LLMatrix4 rot_mat; LLViewerCamera::getInstance()->getMatrixToLocal(rot_mat); diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 1a53861a03d..87a87e225ea 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -44,12 +44,6 @@ extern U32 gFrameCount; class LLDrawPoolAvatar : public LLFacePool { public: - enum - { - SHADER_LEVEL_BUMP = 2, - SHADER_LEVEL_CLOTH = 3 - }; - enum { VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 69003f88fd5..6c151351ff9 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -55,8 +55,6 @@ // static LLStandardBumpmap gStandardBumpmapList[TEM_BUMPMAP_COUNT]; -LL::WorkQueue::weak_t LLBumpImageList::sMainQueue; -LL::WorkQueue::weak_t LLBumpImageList::sTexUpdateQueue; LLRenderTarget LLBumpImageList::sRenderTarget; // static @@ -629,8 +627,6 @@ void LLBumpImageList::init() llassert( mDarknessEntries.size() == 0 ); LLStandardBumpmap::restoreGL(); - sMainQueue = LL::WorkQueue::getInstance("mainloop"); - sTexUpdateQueue = LL::WorkQueue::getInstance("LLImageGL"); // Share work queue with tex loader. } void LLBumpImageList::clear() diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h index 15976884ca3..e1a468cd185 100644 --- a/indra/newview/lldrawpoolbump.h +++ b/indra/newview/lldrawpoolbump.h @@ -152,8 +152,6 @@ class LLBumpImageList typedef std::unordered_map > bump_image_map_t; bump_image_map_t mBrightnessEntries; bump_image_map_t mDarknessEntries; - static LL::WorkQueue::weak_t sMainQueue; - static LL::WorkQueue::weak_t sTexUpdateQueue; static LLRenderTarget sRenderTarget; }; diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 305215f5413..e6d0b036e0d 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -32,7 +32,6 @@ #include "llface.h" #include "llimage.h" #include "llrender.h" -#include "llatmosphere.h" #include "llenvironment.h" #include "llglslshader.h" #include "llgl.h" diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 875dac103c8..d942715fff5 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -54,7 +54,6 @@ #include "llregioninfomodel.h" -#include "llatmosphere.h" #include "llagent.h" #include "roles_constants.h" #include "llestateinfomodel.h" @@ -965,54 +964,6 @@ LLSettingsWater::ptr_t LLEnvironment::getCurrentWater() const return pwater; } -void LayerConfigToDensityLayer(const LLSD& layerConfig, DensityLayer& layerOut) -{ - layerOut.constant_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); - layerOut.exp_scale = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); - layerOut.exp_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); - layerOut.linear_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); - layerOut.width = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); -} - -void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky) -{ - settingsOut.m_skyBottomRadius = psky->getSkyBottomRadius(); - settingsOut.m_skyTopRadius = psky->getSkyTopRadius(); - settingsOut.m_sunArcRadians = psky->getSunArcRadians(); - settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); - - LLSD rayleigh = psky->getRayleighConfigs(); - settingsOut.m_rayleighProfile.clear(); - for (LLSD::array_iterator itf = rayleigh.beginArray(); itf != rayleigh.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_rayleighProfile.push_back(layer); - } - - LLSD mie = psky->getMieConfigs(); - settingsOut.m_mieProfile.clear(); - for (LLSD::array_iterator itf = mie.beginArray(); itf != mie.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_mieProfile.push_back(layer); - } - settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); - - LLSD absorption = psky->getAbsorptionConfigs(); - settingsOut.m_absorptionProfile.clear(); - for (LLSD::array_iterator itf = absorption.beginArray(); itf != absorption.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_absorptionProfile.push_back(layer); - } -} - bool LLEnvironment::canAgentUpdateParcelEnvironment() const { LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); @@ -2022,8 +1973,8 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("ResetEnvironment", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string url = gAgent.getRegionCapability("ExtEnvironment"); if (url.empty()) @@ -2070,8 +2021,8 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("ResetEnvironment", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string url = gAgent.getRegionCapability("ExtEnvironment"); if (url.empty()) @@ -2186,8 +2137,8 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, S32 track_no, environmen { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("ResetEnvironment", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string url = gAgent.getRegionCapability("ExtEnvironment"); if (url.empty()) @@ -2743,13 +2694,6 @@ bool LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky) mSky->update(); mBlenderSky.reset(); - if (gAtmosphere) - { - AtmosphericModelSettings settings; - LLEnvironment::getAtmosphericModelSettings(settings, psky); - gAtmosphere->configureAtmosphericModel(settings); - } - return changed; } @@ -3418,8 +3362,8 @@ namespace { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("testExperiencesOnParcelCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("testExperiencesOnParcelCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string url = gAgent.getRegionCapability("ExperienceQuery"); if (url.empty()) diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index f1205a72b7f..217c069705e 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -36,8 +36,6 @@ #include "llsettingswater.h" #include "llsettingsdaycycle.h" -#include "llatmosphere.h" - #include "llglslshader.h" #include @@ -131,8 +129,6 @@ class LLEnvironment : public LLSimpleton LLSettingsSky::ptr_t getCurrentSky() const; LLSettingsWater::ptr_t getCurrentWater() const; - static void getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky); - void update(const LLViewerCamera * cam); static void updateGLVariablesForSettings(LLShaderUniforms* uniforms, const LLSettingsBase::ptr_t &psetting); diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp index a7d18d85ce4..54be045c3d1 100644 --- a/indra/newview/llestateinfomodel.cpp +++ b/indra/newview/llestateinfomodel.cpp @@ -138,8 +138,8 @@ void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EstateChangeInfo", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("EstateChangeInfo", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD body; body["estate_name"] = getName(); diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index 25983f4add3..66a922e288d 100644 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -166,6 +166,14 @@ bool LLEventNotifier::handleResponse(U32 eventId, const LLSD& notification, cons return true; } +bool LLEventNotifier::add(LLEventInfo event) +{ + if (mEventInfoSignal(event)) + return false; + + return add(event.mID, event.mUnixTime, event.mTimeStr, event.mName); +} + bool LLEventNotifier::add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName) { LLEventNotification *new_enp = new LLEventNotification(eventId, eventEpoch, eventDateStr, eventName); @@ -198,20 +206,9 @@ void LLEventNotifier::add(U32 eventId) //static void LLEventNotifier::processEventInfoReply(LLMessageSystem *msg, void **) { - // extract the agent id - LLUUID agent_id; - U32 event_id; - std::string event_name; - std::string eventd_date; - U32 event_time_utc; - - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); - msg->getU32("EventData", "EventID", event_id); - msg->getString("EventData", "Name", event_name); - msg->getString("EventData", "Date", eventd_date); - msg->getU32("EventData", "DateUTC", event_time_utc); - - gEventNotifier.add(event_id, (F64)event_time_utc, eventd_date, event_name); + LLEventInfo info; + info.unpack(msg); + gEventNotifier.add(info); } @@ -296,6 +293,52 @@ void LLEventNotifier::serverPushRequest(U32 event_id, bool add) gAgent.sendReliableMessage(); } +void LLEventInfo::unpack(LLMessageSystem* msg) +{ + U32 event_id; + msg->getU32("EventData", "EventID", event_id); + mID = event_id; + + msg->getString("EventData", "Name", mName); + + msg->getString("EventData", "Category", mCategoryStr); + + msg->getString("EventData", "Date", mTimeStr); + + U32 duration; + msg->getU32("EventData", "Duration", duration); + mDuration = duration; + + U32 date; + msg->getU32("EventData", "DateUTC", date); + mUnixTime = date; + + msg->getString("EventData", "Desc", mDesc); + + std::string buffer; + msg->getString("EventData", "Creator", buffer); + mRunByID = LLUUID(buffer); + + U32 foo; + msg->getU32("EventData", "Cover", foo); + + mHasCover = foo ? true : false; + if (mHasCover) + { + U32 cover; + msg->getU32("EventData", "Amount", cover); + mCover = cover; + } + + msg->getString("EventData", "SimName", mSimName); + + msg->getVector3d("EventData", "GlobalPos", mPosGlobal); + + // Mature content + U32 event_flags; + msg->getU32("EventData", "EventFlags", event_flags); + mEventFlags = event_flags; +} LLEventNotification::LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName) : mEventID(eventId), diff --git a/indra/newview/lleventnotifier.h b/indra/newview/lleventnotifier.h index 030c9abb871..2a9295129d1 100644 --- a/indra/newview/lleventnotifier.h +++ b/indra/newview/lleventnotifier.h @@ -33,6 +33,24 @@ class LLEventNotification; class LLMessageSystem; +struct LLEventInfo +{ + void unpack(LLMessageSystem* msg); + + std::string mName; + U32 mID; + std::string mDesc; + std::string mCategoryStr; + U32 mDuration; + std::string mTimeStr; + LLUUID mRunByID; + std::string mSimName; + LLVector3d mPosGlobal; + F64 mUnixTime; // seconds from 1970 + BOOL mHasCover; + U32 mCover; + U32 mEventFlags; +}; class LLEventNotifier { @@ -42,6 +60,7 @@ class LLEventNotifier void update(); // Notify the user of the event if it's coming up bool add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName); + bool add(LLEventInfo event); void add(U32 eventId); @@ -56,9 +75,13 @@ class LLEventNotifier static void processEventInfoReply(LLMessageSystem *msg, void **); + typedef boost::signals2::signal info_received_signal_t; + boost::signals2::connection setEventInfoCallback(const info_received_signal_t::slot_type& cb) { return mEventInfoSignal.connect(cb); }; + protected: en_map mEventNotifications; - LLFrameTimer mNotificationTimer; + LLFrameTimer mNotificationTimer; + info_received_signal_t mEventInfoSignal; }; diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 86c58a3497b..de3752d879d 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -90,7 +90,7 @@ namespace Details { LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); - mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest); + mHttpRequest = std::make_shared(); mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_LONG_POLL); mSenderIp = sender.getIPandPort(); } @@ -144,7 +144,7 @@ namespace Details void LLEventPollImpl::eventPollCoro(std::string url) { - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EventPoller", mHttpPolicy)); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared("EventPoller", mHttpPolicy); LLSD acknowledge; int errorCount = 0; int counter = mCounter; // saved on the stack for logging. @@ -156,7 +156,7 @@ namespace Details // This is a loop with its own waitToRetry implementation, // so disable retries. - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setRetries(0); LL::WorkQueue::ptr_t main_queue = nullptr; diff --git a/indra/newview/llexperiencelog.cpp b/indra/newview/llexperiencelog.cpp index ce10fba2cac..b86474c5ca0 100644 --- a/indra/newview/llexperiencelog.cpp +++ b/indra/newview/llexperiencelog.cpp @@ -279,6 +279,6 @@ void LLExperienceLog::setNotifyNewEvent( bool val ) } else if( val && !mNotifyConnection.connected()) { - mNotifyConnection = addUpdateSignal(boost::function(LLExperienceLog::notify)); + mNotifyConnection = addUpdateSignal(std::function(LLExperienceLog::notify)); } } diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index 3decd15bbdb..193a42f9f6d 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -44,8 +44,20 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env std::string cmd = findCommand(env_var, override); if (cmd.empty()) { - LL_WARNS() << "Editor command is empty or not set" << LL_ENDL; - return EC_NOT_SPECIFIED; + LL_INFOS() << "Editor command is empty or not set, falling back to OS open handler" << LL_ENDL; +#if LL_WINDOWS + static const std::string os_cmd = "%SystemRoot%\\explorer.exe \"%s\""; +#elif LL_DARWIN + static const std::string os_cmd = "/usr/bin/open \"%s\""; +#elif LL_LINUX + static const std::string os_cmd = "/usr/bin/xdg-open \"%s\""; +#endif + cmd = findCommand("", os_cmd); + if (cmd.empty()) + { + LL_WARNS() << "Failed to find OS open handler \"" << cmd << "\"" << LL_ENDL; + return EC_NOT_SPECIFIED; + } } string_vec_t tokens; diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 65637fbf859..df31e9ea908 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -58,16 +58,8 @@ class alignas(16) LLFace { LL_ALIGN_NEW public: - LLFace(const LLFace& rhs) - { - *this = rhs; - } - - const LLFace& operator=(const LLFace& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } + LLFace(const LLFace& rhs) = delete; + const LLFace& operator=(const LLFace& rhs) = delete; enum EMasks { @@ -127,7 +119,7 @@ class alignas(16) LLFace void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index; } void setWorldMatrix(const LLMatrix4& mat); - const LLTextureEntry* getTextureEntry() const { return mVObjp->getTE(mTEOffset); } + const LLTextureEntry* getTextureEntry() const { return mVObjp ? mVObjp->getTE(mTEOffset) : nullptr; } LLFacePool* getPool() const { return mDrawPoolp; } U32 getPoolType() const { return mPoolType; } diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 377710c170d..98b3ca820b6 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1395,6 +1395,19 @@ bool LLFavoritesBarCtrl::enableSelected(const LLSD& userdata) { return !LLAgentPicksInfo::getInstance()->isPickLimitReached(); } + else if (param == "copy_slurl" + || param == "show_on_map") + { + LLViewerInventoryItem* item = gInventory.getItem(mSelectedItemID); + if (nullptr == item) + return false; // shouldn't happen as it is selected from existing items + + const LLUUID& asset_id = item->getAssetUUID(); + + // Favorites are supposed to be loaded first, it should be here already + LLLandmark* landmark = gLandmarkList.getAsset(asset_id, NULL /*callback*/); + return nullptr != landmark; + } return false; } @@ -1425,10 +1438,17 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) LLVector3d posGlobal; LLLandmarkActions::getLandmarkGlobalPos(mSelectedItemID, posGlobal); + // inventory item and asset exist, otherwise + // enableSelected wouldn't have let it get here, + // only need to check location validity if (!posGlobal.isExactlyZero()) { LLLandmarkActions::getSLURLfromPosGlobal(posGlobal, copy_slurl_to_clipboard_cb); } + else + { + LLNotificationsUtil::add("LandmarkLocationUnknown"); + } } else if (action == "show_on_map") { @@ -1437,10 +1457,20 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) LLVector3d posGlobal; LLLandmarkActions::getLandmarkGlobalPos(mSelectedItemID, posGlobal); - if (!posGlobal.isExactlyZero() && worldmap_instance) + if (worldmap_instance) { - worldmap_instance->trackLocation(posGlobal); - LLFloaterReg::showInstance("world_map", "center"); + // inventory item and asset exist, otherwise + // enableSelected wouldn't have let it get here, + // only need to check location validity + if (!posGlobal.isExactlyZero()) + { + worldmap_instance->trackLocation(posGlobal); + LLFloaterReg::showInstance("world_map", "center"); + } + else + { + LLNotificationsUtil::add("LandmarkLocationUnknown"); + } } } else if (action == "create_pick") diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index bbf67ffb367..e9bee93a191 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -30,7 +30,6 @@ #include #include -#include #include "llfeaturemanager.h" #include "lldir.h" @@ -184,15 +183,15 @@ void LLFeatureList::dump() } } -static const std::vector sGraphicsLevelNames = boost::assign::list_of - ("Low") - ("LowMid") - ("Mid") - ("MidHigh") - ("High") - ("HighUltra") - ("Ultra") -; +static const std::vector sGraphicsLevelNames = { + "Low", + "LowMid", + "Mid", + "MidHigh", + "High", + "HighUltra", + "Ultra" +}; U32 LLFeatureManager::getMaxGraphicsLevel() const { diff --git a/indra/newview/llfilepicker_mac.h b/indra/newview/llfilepicker_mac.h index 77cc8540bca..d0374c5a087 100644 --- a/indra/newview/llfilepicker_mac.h +++ b/indra/newview/llfilepicker_mac.h @@ -42,6 +42,9 @@ std::unique_ptr> doLoadDialog(const std::vector* allowed_types, unsigned int flags); +// doLoadDialogModeless if window does not exists creates a modeless +// window, if it does exist, creates a 'sheet' that does not block +// thread but blocks window interractions void doLoadDialogModeless(const std::vector* allowed_types, unsigned int flags, void (*callback)(bool, std::vector&, void*), diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm index 6cb7c4ad51c..6921cd61017 100644 --- a/indra/newview/llfilepicker_mac.mm +++ b/indra/newview/llfilepicker_mac.mm @@ -114,38 +114,73 @@ void doLoadDialogModeless(const std::vector* allowed_types, @autoreleasepool { - // Note: might need to return and save this panel - // so that it does not close immediately NSOpenPanel *panel = init_panel(allowed_types,flags); + NSWindow *mainWindow = [NSApp mainWindow]; - [panel beginWithCompletionHandler:^(NSModalResponse result) + if (mainWindow) { - std::vector outfiles; - if (result == NSModalResponseOK) + [panel beginSheetModalForWindow:mainWindow + completionHandler:^(NSModalResponse result) { - NSArray *filesToOpen = [panel URLs]; - int i, count = [filesToOpen count]; - - if (count > 0) + std::vector outfiles; + if (result == NSModalResponseOK) { - - for (i=0; i 0) + { + + for (i=0; i outfiles; + if (result == NSModalResponseOK) + { + NSArray *filesToOpen = [panel URLs]; + int i, count = [filesToOpen count]; + + if (count > 0) + { + + for (i=0; i("fetchServerReleaseNotesCoro", LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 08a54b7369b..c7851013c7f 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -34,6 +34,7 @@ #include "llfloaterreg.h" #include "llimview.h" // for gIMMgr #include "lltooldraganddrop.h" // for LLToolDragAndDrop +#include "lltrans.h" #include "llviewercontrol.h" #include "llviewerregion.h" // getCapability() #include "llworld.h" @@ -405,15 +406,50 @@ bool LLFloaterAvatarPicker::visibleItemsSelected() const } /*static*/ -void LLFloaterAvatarPicker::findCoro(std::string url, LLUUID queryID, std::string name) +void LLFloaterAvatarPicker::findByIdCoro(std::string url, LLUUID query_id, LLUUID agent_id, std::string floater_key) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("findByIdCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); - LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL; + httpOpts->setTimeout(AVATAR_PICKER_SEARCH_TIMEOUT); + + LLSD result = httpAdapter->getAndSuspend(httpRequest, url, httpOpts); + + LL_DEBUGS("Agent") << result << LL_ENDL; + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + if (status || (status == LLCore::HttpStatus(HTTP_BAD_REQUEST))) + { + result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); + } + else + { + result["failure_reason"] = status.toString(); + } + + LLFloaterAvatarPicker* floater = + LLFloaterReg::findTypedInstance("avatar_picker", floater_key); + if (floater) + { + floater->processResponse(query_id, result); + } +} + +/*static*/ +void LLFloaterAvatarPicker::findByNameCoro(std::string url, LLUUID queryID, std::string name) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter = std::make_shared("findByNameCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); + + LL_INFOS("HttpCoroutineAdapter", "genericPostCoro", "Agent") << "Generic POST for " << url << LL_ENDL; httpOpts->setTimeout(AVATAR_PICKER_SEARCH_TIMEOUT); @@ -447,6 +483,7 @@ void LLFloaterAvatarPicker::find() std::string text = getChild("Edit")->getValue().asString(); + LLUUID agent_id; size_t separator_index = text.find_first_of(" ._"); if (separator_index != text.npos) { @@ -458,51 +495,92 @@ void LLFloaterAvatarPicker::find() text = first; } } + else if (!text.empty()) + { + agent_id.set(text); + } mQueryID.generate(); + mNumResultsReturned = 0; - std::string url; - url.reserve(128); // avoid a memory allocation or two + getChild("SearchResults")->deleteAllItems(); + getChild("SearchResults")->setCommentText(getString("searching")); + getChildView("ok_btn")->setEnabled(false); - LLViewerRegion* region = gAgent.getRegion(); - if(region) + if (agent_id.notNull()) { - url = region->getCapability("AvatarPickerSearch"); - // Prefer use of capabilities to search on both SLID and display name - if (!url.empty()) + // Search by uuid + // While cache could have been nicer, it neither has a failure callback, nor + // can cleanup in case of an invalid uuid. So we go directly to the capability. + LLViewerRegion* region = gAgent.getRegion(); + if (region) { - // capability urls don't end in '/', but we need one to parse - // query parameters correctly - if (url.size() > 0 && url[url.size()-1] != '/') + std::string url; + url.reserve(128); + url = region->getCapability("GetDisplayNames"); + if (!url.empty()) { - url += "/"; - } - url += "?page_size=100&names="; - std::replace(text.begin(), text.end(), '.', ' '); - url += LLURI::escape(text); - LL_INFOS() << "avatar picker " << url << LL_ENDL; + // capability urls don't end in '/', but we need one to parse + // query parameters correctly + if (url[url.size() - 1] != '/') + { + url += "/"; + } + url += "?ids="; + url += agent_id.asString(); + LL_DEBUGS("Agent") << "avatar picker " << url << LL_ENDL; - LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro", - boost::bind(&LLFloaterAvatarPicker::findCoro, url, mQueryID, getKey().asString())); + LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro", + boost::bind(&LLFloaterAvatarPicker::findByIdCoro, url, mQueryID, agent_id, getKey().asString())); + } + else + { + LLSD content; + content["failure_reason"] = LLTrans::getString("ServerUnavailable"); + processResponse(mQueryID, content); + } } - else + } + else + { + std::string url; + url.reserve(128); // avoid a memory allocation or two + + LLViewerRegion* region = gAgent.getRegion(); + if (region) { - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("AvatarPickerRequest"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->addUUID("QueryID", mQueryID); // not used right now - msg->nextBlock("Data"); - msg->addString("Name", text); - gAgent.sendReliableMessage(); + url = region->getCapability("AvatarPickerSearch"); + // Prefer use of capabilities to search on both SLID and display name + if (!url.empty()) + { + // capability urls don't end in '/', but we need one to parse + // query parameters correctly + if (url.size() > 0 && url[url.size() - 1] != '/') + { + url += "/"; + } + url += "?page_size=100&names="; + std::replace(text.begin(), text.end(), '.', ' '); + url += LLURI::escape(text); + LL_DEBUGS("Agent") << "avatar picker " << url << LL_ENDL; + + LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro", + boost::bind(&LLFloaterAvatarPicker::findByNameCoro, url, mQueryID, getKey().asString())); + } + else + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("AvatarPickerRequest"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->addUUID("QueryID", mQueryID); // not used right now + msg->nextBlock("Data"); + msg->addString("Name", text); + gAgent.sendReliableMessage(); + } } } - getChild("SearchResults")->deleteAllItems(); - getChild("SearchResults")->setCommentText(getString("searching")); - - getChildView("ok_btn")->setEnabled(false); - mNumResultsReturned = 0; } void LLFloaterAvatarPicker::setAllowMultiple(bool allow_multiple) diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index 330f1a12266..1761497f835 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -43,7 +43,7 @@ class LLFloaterAvatarPicker :public LLFloater typedef validate_signal_t::slot_type validate_callback_t; // The callback function will be called with an avatar name and UUID. - typedef boost::function&)> select_callback_t; + typedef std::function&)> select_callback_t; // Call this to select an avatar. static LLFloaterAvatarPicker* show(select_callback_t callback, bool allow_multiple = false, @@ -86,7 +86,8 @@ class LLFloaterAvatarPicker :public LLFloater void populateFriend(); bool visibleItemsSelected() const; // Returns true if any items in the current tab are selected. - static void findCoro(std::string url, LLUUID mQueryID, std::string mName); + static void findByIdCoro(std::string url, LLUUID query_id, LLUUID agent_id, std::string floater_key); + static void findByNameCoro(std::string url, LLUUID mQueryID, std::string mName); void find(); void setAllowMultiple(bool allow_multiple); LLScrollListCtrl* getActiveList(); diff --git a/indra/newview/llfloaterbanduration.h b/indra/newview/llfloaterbanduration.h index 4793b524f7c..0f8944a56a8 100644 --- a/indra/newview/llfloaterbanduration.h +++ b/indra/newview/llfloaterbanduration.h @@ -31,7 +31,7 @@ class LLFloaterBanDuration : public LLFloater { - typedef boost::function select_callback_t; + typedef std::function select_callback_t; public: LLFloaterBanDuration(const LLSD& target); diff --git a/indra/newview/llfloaterbulkupload.cpp b/indra/newview/llfloaterbulkupload.cpp index b898cb28b61..d11e9949f61 100644 --- a/indra/newview/llfloaterbulkupload.cpp +++ b/indra/newview/llfloaterbulkupload.cpp @@ -41,6 +41,7 @@ LLFloaterBulkUpload::LLFloaterBulkUpload(const LLSD& key) mUploadCost = key["upload_cost"].asInteger(); mUploadCount = key["upload_count"].asInteger(); mHas2kTextures = key["has_2k_textures"].asBoolean(); + mDestinationFolderId = key["dest"]; if (key["files"].isArray()) { const LLSD& files = key["files"]; @@ -125,7 +126,7 @@ void LLFloaterBulkUpload::onUpload2KCheckBox() void LLFloaterBulkUpload::onClickUpload() { - do_bulk_upload(mFiles, mAllow2kTextures); + do_bulk_upload(mFiles, mAllow2kTextures, mDestinationFolderId); closeFloater(); } diff --git a/indra/newview/llfloaterbulkupload.h b/indra/newview/llfloaterbulkupload.h index d07dc8eabe4..3d3004d84d6 100644 --- a/indra/newview/llfloaterbulkupload.h +++ b/indra/newview/llfloaterbulkupload.h @@ -59,6 +59,7 @@ class LLFloaterBulkUpload : public LLModalDialog std::vector mFiles; bool mAllow2kTextures = true; bool mHas2kTextures = false; + LLUUID mDestinationFolderId; S32 mUploadCost = 0; S32 mUploadCount = 0; }; diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 392079efe43..3acf28044c0 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -1021,7 +1021,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) std::string desc = floaterp->getChild("description_form")->getValue().asString(); S32 expected_upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); - LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( + LLResourceUploadInfo::ptr_t assetUploadInfo = std::make_shared( floaterp->mTransactionID, LLAssetType::AT_ANIMATION, name, desc, 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, @@ -1029,7 +1029,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost, - floaterp->mDestinationFolderId)); + floaterp->mDestinationFolderId); upload_new_resource(assetUploadInfo); } diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp new file mode 100644 index 00000000000..e062ca7ac6d --- /dev/null +++ b/indra/newview/llfloaterdirectory.cpp @@ -0,0 +1,100 @@ +/** + * @file llfloaterdirectory.cpp + * @brief The legacy "Search" floater + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llfloaterdirectory.h" + +#include "llpaneldirevents.h" +#include "llpaneleventinfo.h" +#include "llpaneldirland.h" +#include "llpaneldirpeople.h" +#include "llpaneldirgroups.h" +#include "llpaneldirplaces.h" +#include "llpaneldirclassified.h" +#include "llpaneldirweb.h" +#include "llscrollbar.h" +#include "llviewercontrol.h" +#include "llpanelavatar.h" +#include "llpanelclassified.h" +#include "llpanelgroup.h" +#include "llpanelplaces.h" +#include "llpanelprofile.h" + +LLFloaterDirectory::LLFloaterDirectory(const std::string& name) +: LLFloater(name), + mPanelAvatarp(nullptr), + mPanelGroupp(nullptr), + mPanelPlacep(nullptr), + mPanelClassifiedp(nullptr), + mPanelEventp(nullptr) +{ +} + +LLFloaterDirectory::~LLFloaterDirectory() +{ +} + +bool LLFloaterDirectory::postBuild() +{ + const std::vector panel_names = { + "panel_dir_classified", + "panel_dir_events", + "panel_dir_places", + "panel_dir_land", + "panel_dir_people", + "panel_dir_groups" }; + + for (const std::string& panel_name : panel_names) + { + if (LLPanelDirBrowser* panel_tab = findChild(panel_name)) + { + panel_tab->setFloaterDirectory(this); + } + } + findChild("panel_dir_web")->setFloaterDirectory(this); + + mPanelAvatarp = findChild("panel_profile_secondlife"); + mPanelAvatarp->setAllowEdit(false); + mPanelGroupp = findChild("panel_group_info_sidetray"); + mPanelGroupp->hideBackBtn(); + mPanelPlacep = findChild("panel_places"); + mPanelPlacep->hideBackBtn(); + mPanelClassifiedp = findChild("panel_classified_info"); + mPanelClassifiedp->setBackgroundVisible(false); + mPanelEventp = findChild("panel_event_info"); + + return true; +} + +void LLFloaterDirectory::hideAllDetailPanels() +{ + if (mPanelAvatarp) mPanelAvatarp->setVisible(false); + if (mPanelGroupp) mPanelGroupp->setVisible(false); + if (mPanelPlacep) mPanelPlacep->setVisible(false); + if (mPanelClassifiedp) mPanelClassifiedp->setVisible(false); + if (mPanelEventp) mPanelEventp->setVisible(false); +} diff --git a/indra/newview/llfloaterdirectory.h b/indra/newview/llfloaterdirectory.h new file mode 100644 index 00000000000..de788443be6 --- /dev/null +++ b/indra/newview/llfloaterdirectory.h @@ -0,0 +1,81 @@ +/** + * @file llfloaterdirectory.h + * @brief The legacy "Search" floater + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLFLOATERDIRECTORY_H +#define LL_LLFLOATERDIRECTORY_H + +#include "llfloater.h" +#include "lltabcontainer.h" + +#include "llpaneldirevents.h" +#include "llpaneldirland.h" +#include "llpaneldirpeople.h" +#include "llpaneldirgroups.h" +#include "llpaneldirplaces.h" +#include "llpaneldirclassified.h" + +class LLDirectoryCore; +class LLPanelDirBrowser; + +class LLPanelDirAdvanced; +class LLPanelDirClassified; +class LLPanelDirEvents; +class LLPanelDirGroups; +class LLPanelDirLand; +class LLPanelDirPeople; +class LLPanelDirPlaces; + +class LLPanelProfileSecondLife; +class LLPanelEventInfo; +class LLPanelGroup; +class LLPanelPlaces; +class LLPanelClassifiedInfo; + +// Floater to find people, places, things +class LLFloaterDirectory : public LLFloater +{ +public: + LLFloaterDirectory(const std::string& name); + /*virtual*/ ~LLFloaterDirectory(); + + void hideAllDetailPanels(); + + bool postBuild() override; + +public: + LLPanelProfileSecondLife* mPanelAvatarp; + LLPanelEventInfo* mPanelEventp; + LLPanelGroup* mPanelGroupp; + LLPanelPlaces* mPanelPlacep; + LLPanelClassifiedInfo* mPanelClassifiedp; + +private: + static LLFloaterDirectory *sInstance; +}; + +//extern BOOL gDisplayEventHack; + +#endif // LL_LLDIRECTORYFLOATER_H diff --git a/indra/newview/llfloateremojipicker.h b/indra/newview/llfloateremojipicker.h index b807adb67da..88d288b1414 100644 --- a/indra/newview/llfloateremojipicker.h +++ b/indra/newview/llfloateremojipicker.h @@ -40,8 +40,8 @@ class LLFloaterEmojiPicker : public LLFloater public: // The callback function will be called with an emoji char. - typedef boost::function pick_callback_t; - typedef boost::function close_callback_t; + typedef std::function pick_callback_t; + typedef std::function close_callback_t; LLFloaterEmojiPicker(const LLSD& key); diff --git a/indra/newview/llfloaterexperiencepicker.h b/indra/newview/llfloaterexperiencepicker.h index 0a001478f1c..d0fb611bd42 100644 --- a/indra/newview/llfloaterexperiencepicker.h +++ b/indra/newview/llfloaterexperiencepicker.h @@ -38,9 +38,9 @@ class LLFloaterExperiencePicker : public LLFloater { public: - typedef boost::function select_callback_t; + typedef std::function select_callback_t; // filter function for experiences, return true if the experience should be hidden. - typedef boost::function filter_function; + typedef std::function filter_function; typedef std::vector filter_list; static LLFloaterExperiencePicker* show( select_callback_t callback, const LLUUID& key, bool allow_multiple, bool close_on_select, filter_list filters, LLView * frustumOrigin); diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index e79055fdaec..999a473a49c 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -171,7 +171,7 @@ void LLFloaterExperiences::onOpen( const LLSD& key ) refreshContents(); return; } - region->setCapabilitiesReceivedCallback(boost::bind(&LLFloaterExperiences::refreshContents, this)); + mCapsReceivedConnection = region->setCapabilitiesReceivedCallback(boost::bind(&LLFloaterExperiences::refreshContents, this)); return; } } @@ -231,6 +231,7 @@ bool LLFloaterExperiences::updatePermissions( const LLSD& permission ) void LLFloaterExperiences::onClose( bool app_quitting ) { + mCapsReceivedConnection.disconnect(); LLEventPumps::instance().obtain("experience_permission").stopListening("LLFloaterExperiences"); LLFloater::onClose(app_quitting); } @@ -365,10 +366,10 @@ void LLFloaterExperiences::retrieveExperienceListCoro(std::string url, { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("retrieveExperienceListCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOptions(new LLCore::HttpOptions); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("retrieveExperienceListCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOptions = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); if (url.empty()) @@ -406,7 +407,7 @@ void LLFloaterExperiences::retrieveExperienceListCoro(std::string url, { const LLSD& ids = result[it->first]; tab->setExperienceList(ids); - if (!cback.empty()) + if (cback != nullptr) { cback(tab, result); } diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h index 5e657767d23..ec5f52d2f7a 100644 --- a/indra/newview/llfloaterexperiences.h +++ b/indra/newview/llfloaterexperiences.h @@ -43,7 +43,7 @@ class LLFloaterExperiences : static LLFloaterExperiences* findInstance(); protected: typedef std::map NameMap_t; - typedef boost::function Callback_t; + typedef std::function Callback_t; void clearFromRecent(const LLSD& ids); void resizeToTabs(); @@ -65,12 +65,13 @@ class LLFloaterExperiences : const std::string &errorNotify, Callback_t cback); private: - typedef boost::function < LLSD(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t, LLCore::HttpRequest::ptr_t, + typedef std::function invokationFn_t; static void retrieveExperienceListCoro(std::string url, LLHandle hparent, NameMap_t tabMapping, std::string errorNotify, Callback_t cback, invokationFn_t invoker); std::vector mPrepurchaseIds; + boost::signals2::scoped_connection mCapsReceivedConnection; }; #endif //LL_LLFLOATEREXPERIENCES_H diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 936096d8fec..21ae98d380d 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -320,15 +320,29 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur if (gesture) { + element["columns"][0]["column"] = "active"; + element["columns"][0]["type"] = "icon"; if (gesture->mPlaying) { font_style = "BOLD"; + element["columns"][0]["value"] = "Activate_Checkmark"; } + + // Only add "playing" if we've got the name, less confusing. JC item_name = gesture->mName; - element["columns"][0]["column"] = "trigger"; - element["columns"][0]["value"] = gesture->mTrigger; - element["columns"][0]["font"]["name"] = "SANSSERIF"; - element["columns"][0]["font"]["style"] = font_style; + if (item && gesture->mPlaying) + { + item_name += " " + getString("playing"); + } + element["columns"][1]["column"] = "name"; + element["columns"][1]["value"] = item_name; + element["columns"][1]["font"]["name"] = "SANSSERIF"; + element["columns"][1]["font"]["style"] = font_style; + + element["columns"][2]["column"] = "trigger"; + element["columns"][2]["value"] = gesture->mTrigger; + element["columns"][2]["font"]["name"] = "SANSSERIF"; + element["columns"][2]["font"]["style"] = font_style; std::string key_string; std::string buffer; @@ -345,45 +359,38 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur gesture->mKey); } - element["columns"][1]["column"] = "shortcut"; - element["columns"][1]["value"] = buffer; - element["columns"][1]["font"]["name"] = "SANSSERIF"; - element["columns"][1]["font"]["style"] = font_style; - // hidden column for sorting - element["columns"][2]["column"] = "key"; - element["columns"][2]["value"] = key_string; - element["columns"][2]["font"]["name"] = "SANSSERIF"; - element["columns"][2]["font"]["style"] = font_style; - - // Only add "playing" if we've got the name, less confusing. JC - if (item && gesture->mPlaying) - { - item_name += " " + getString("playing"); - } - element["columns"][3]["column"] = "name"; - element["columns"][3]["value"] = item_name; + element["columns"][3]["column"] = "key"; + element["columns"][3]["value"] = key_string; element["columns"][3]["font"]["name"] = "SANSSERIF"; element["columns"][3]["font"]["style"] = font_style; + + element["columns"][4]["column"] = "shortcut"; + element["columns"][4]["value"] = buffer; + element["columns"][4]["font"]["name"] = "SANSSERIF"; + element["columns"][4]["font"]["style"] = font_style; } else { - element["columns"][0]["column"] = "trigger"; + element["columns"][0]["column"] = "active"; + element["columns"][0]["type"] = "icon"; element["columns"][0]["value"] = ""; - element["columns"][0]["font"]["name"] = "SANSSERIF"; - element["columns"][0]["font"]["style"] = font_style; - element["columns"][1]["column"] = "shortcut"; - element["columns"][1]["value"] = "---"; + element["columns"][1]["column"] = "name"; + element["columns"][1]["value"] = item_name; element["columns"][1]["font"]["name"] = "SANSSERIF"; element["columns"][1]["font"]["style"] = font_style; - element["columns"][2]["column"] = "key"; - element["columns"][2]["value"] = "~~~"; + element["columns"][2]["column"] = "trigger"; + element["columns"][2]["value"] = ""; element["columns"][2]["font"]["name"] = "SANSSERIF"; element["columns"][2]["font"]["style"] = font_style; - element["columns"][3]["column"] = "name"; - element["columns"][3]["value"] = item_name; + element["columns"][3]["column"] = "key"; + element["columns"][3]["value"] = "~~~"; element["columns"][3]["font"]["name"] = "SANSSERIF"; element["columns"][3]["font"]["style"] = font_style; + element["columns"][4]["column"] = "shortcut"; + element["columns"][4]["value"] = "---"; + element["columns"][4]["font"]["name"] = "SANSSERIF"; + element["columns"][4]["font"]["style"] = font_style; } LL_DEBUGS("Gesture") << "Added gesture [" << item_name << "]" << LL_ENDL; @@ -391,9 +398,18 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM); if(sl_item) { - LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL; - // *TODO find out why ["font"]["style"] does not affect font style - ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style); + if (LLGestureMgr::getInstance()->isGestureActive(item_id)) + { + // If gesture was not yet loaded, will have to set active state here + ((LLScrollListIcon*)sl_item->getColumn(0))->setValue("Activate_Checkmark"); + ((LLScrollListIcon*)sl_item->getColumn(0))->setIconSize(10); + ((LLScrollListText*)sl_item->getColumn(1))->setFontStyle(LLFontGL::BOLD); + } + else + { + ((LLScrollListIcon*)sl_item->getColumn(0))->setValue(""); + ((LLScrollListText*)sl_item->getColumn(1))->setFontStyle(LLFontGL::NORMAL); + } } } diff --git a/indra/newview/llfloatergridstatus.cpp b/indra/newview/llfloatergridstatus.cpp index b6b844b307b..e8e36b5c932 100644 --- a/indra/newview/llfloatergridstatus.cpp +++ b/indra/newview/llfloatergridstatus.cpp @@ -90,10 +90,10 @@ void LLFloaterGridStatus::getGridStatusRSSCoro() LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getGridStatusRSSCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("getGridStatusRSSCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpOpts->setSSLVerifyPeer(false); // We want this data even if SSL fails httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML); diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index be6ced40bf5..93a6deb0a31 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -40,8 +40,9 @@ #include "lluuid.h" #include "llfloater.h" +#include "llevent.h" + #include -#include #include class LLUICtrl; diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index c9248072732..bbff3e4c865 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -280,7 +280,7 @@ void LLFloaterImagePreview::onBtnOK() LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE); fmt_file.write(formatted->getData(), formatted->getDataSize()); - LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( + LLResourceUploadInfo::ptr_t assetUploadInfo = std::make_shared( tid, LLAssetType::AT_TEXTURE, getChild("name_form")->getValue().asString(), getChild("description_form")->getValue().asString(), @@ -289,8 +289,9 @@ void LLFloaterImagePreview::onBtnOK() LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost - )); + expected_upload_cost, + mDestinationFolderId + ); upload_new_resource(assetUploadInfo); } diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index b649514bff8..f0d696361ae 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -907,7 +907,7 @@ class LLChatCommandHandler : public LLCommandHandler { public: // not allowed from outside the app - LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { } + LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_CLICK_ONLY) { } // Your code here bool handle(const LLSD& tokens, diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index c920a3c8989..ec9458ea9be 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -87,7 +87,7 @@ class LLFloaterIMNearbyChatScreenChannel: public LLScreenChannelBase void addChat (LLSD& chat); void arrangeToasts (); - typedef boost::function create_toast_panel_callback_t; + typedef std::function create_toast_panel_callback_t; void setCreatePanelCallback(create_toast_panel_callback_t value) { m_create_toast_panel_callback_t = value;} void onToastDestroyed (LLToast* toast, bool app_quitting); diff --git a/indra/newview/llfloatermodeluploadbase.cpp b/indra/newview/llfloatermodeluploadbase.cpp index ec4f7593ca1..dd53d0ffcf5 100644 --- a/indra/newview/llfloatermodeluploadbase.cpp +++ b/indra/newview/llfloatermodeluploadbase.cpp @@ -66,8 +66,8 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro(std::string url { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("MeshUploadFlag", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("MeshUploadFlag", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp index 0283855f154..8685243867e 100644 --- a/indra/newview/llfloatermyscripts.cpp +++ b/indra/newview/llfloatermyscripts.cpp @@ -93,8 +93,8 @@ void LLFloaterMyScripts::getAttachmentLimitsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("getAttachmentLimitsCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp index e4e7c4ee399..d5e45c09e30 100644 --- a/indra/newview/llfloaterpay.cpp +++ b/indra/newview/llfloaterpay.cpp @@ -127,8 +127,8 @@ const S32 PAY_AMOUNT_NOTIFICATION = 200; LLFloaterPay::LLFloaterPay(const LLSD& key) : LLFloater(key), mCallbackData(), - mCallback(NULL), - mObjectNameText(NULL), + mCallback(nullptr), + mObjectNameText(nullptr), mTargetUUID(key.asUUID()), mTargetIsGroup(false), mHaveName(false) @@ -154,7 +154,7 @@ bool LLFloaterPay::postBuild() { S32 i = 0; - give_money_ptr info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_0)); + give_money_ptr info = std::make_shared(this, PAY_BUTTON_DEFAULT_0); mCallbackData.push_back(info); childSetAction("fastpay 1", boost::bind(LLFloaterPay::onGive, info)); @@ -164,7 +164,7 @@ bool LLFloaterPay::postBuild() mQuickPayInfo[i] = info; ++i; - info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_1)); + info = std::make_shared(this, PAY_BUTTON_DEFAULT_1); mCallbackData.push_back(info); childSetAction("fastpay 5", boost::bind(LLFloaterPay::onGive, info)); @@ -174,7 +174,7 @@ bool LLFloaterPay::postBuild() mQuickPayInfo[i] = info; ++i; - info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_2)); + info = std::make_shared(this, PAY_BUTTON_DEFAULT_2); mCallbackData.push_back(info); childSetAction("fastpay 10", boost::bind(LLFloaterPay::onGive, info)); @@ -184,7 +184,7 @@ bool LLFloaterPay::postBuild() mQuickPayInfo[i] = info; ++i; - info = give_money_ptr(new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_3)); + info = std::make_shared(this, PAY_BUTTON_DEFAULT_3); mCallbackData.push_back(info); childSetAction("fastpay 20", boost::bind(LLFloaterPay::onGive, info)); diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 7311f0deb65..4c3578119ee 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -209,8 +209,8 @@ void LLFloaterPermsDefault::updateCapCoro(std::string url) std::string previousReason; LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("updateCapCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData = LLSD::emptyMap(); postData["default_object_perm_masks"]["Group"] = diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 99161d8d931..c5c1e015387 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -410,11 +410,11 @@ void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bo { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("put_avatar_properties_coro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("put_avatar_properties_coro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setFollowRedirects(true); std::string finalUrl = cap_url + "/" + gAgentID.asString(); @@ -2068,7 +2068,7 @@ class LLPanelPreference::Updater : public LLEventTimer public: - typedef boost::function callback_t; + typedef std::function callback_t; Updater(callback_t cb, F32 period) :LLEventTimer(period), @@ -3511,7 +3511,7 @@ void LLFloaterPreference::collectSearchableItems() LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" ); if( mFilterEdit && pRoot ) { - mSearchData.reset(new ll::prefs::SearchData() ); + mSearchData = std::make_unique(); ll::prefs::TabContainerDataPtr pRootTabcontainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData ); pRootTabcontainer->mTabContainer = pRoot; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 5ec7e94fcc6..4cb6e7be964 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -94,7 +94,6 @@ #include "llmeshrepository.h" #include "llfloaterregionrestarting.h" #include "llpanelexperiencelisteditor.h" -#include #include "llpanelexperiencepicker.h" #include "llexperiencecache.h" #include "llpanelexperiences.h" @@ -4048,8 +4047,8 @@ void LLPanelEstateAccess::updateLists() void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestEstateGetAccessoCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared("requestEstateGetAccessoCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); diff --git a/indra/newview/llfloaterregionrestartschedule.cpp b/indra/newview/llfloaterregionrestartschedule.cpp index 59bcb22dcee..cd699efd5b8 100644 --- a/indra/newview/llfloaterregionrestartschedule.cpp +++ b/indra/newview/llfloaterregionrestartschedule.cpp @@ -272,9 +272,9 @@ void LLFloaterRegionRestartSchedule::requestRegionShcheduleCoro(std::string url, { 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); + httpAdapter = std::make_shared("RegionShcheduleRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); @@ -367,9 +367,9 @@ void LLFloaterRegionRestartSchedule::setRegionShcheduleCoro(std::string url, LLS { 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); + httpAdapter = std::make_shared("RegionShcheduleSetter", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index e2c6305f4f4..7e7eb91636b 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -417,8 +417,8 @@ void LLFloaterReporter::requestAbuseCategoriesCoro(std::string url, LLHandle("requestAbuseCategoriesCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); @@ -860,7 +860,7 @@ void LLFloaterReporter::sendReportViaCaps(std::string url, std::string sshot_url if(!sshot_url.empty()) { // try to upload screenshot - LLResourceUploadInfo::ptr_t uploadInfo(new LLARScreenShotUploader(report, mResourceDatap->mAssetInfo.mUuid, mResourceDatap->mAssetInfo.mType)); + LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared(report, mResourceDatap->mAssetInfo.mUuid, mResourceDatap->mAssetInfo.mType); LLViewerAssetUpload::EnqueueInventoryUpload(sshot_url, uploadInfo); } else diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index b3452a25c5a..58d624a7d09 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -178,8 +178,8 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(std::string url { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getLandScriptResourcesCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("getLandScriptResourcesCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData; @@ -222,8 +222,8 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getLandScriptSummaryCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("getLandScriptSummaryCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); @@ -274,8 +274,8 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getLandScriptDetailsCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("getLandScriptDetailsCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); @@ -487,13 +487,13 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) names_requested.push_back(owner_id); if (is_group_owned) { - gCacheName->getGroup(owner_id, + mGroupNameCacheConnection = gCacheName->getGroup(owner_id, boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache, this, _1, _2)); } else { - LLAvatarNameCache::get(owner_id, + mAvatarNameCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLPanelScriptLimitsRegionMemory::onAvatarNameCache, this, _1, _2)); } diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h index e1eb8cb079d..fe96bfbf3a6 100644 --- a/indra/newview/llfloaterscriptlimits.h +++ b/indra/newview/llfloaterscriptlimits.h @@ -136,6 +136,9 @@ class LLPanelScriptLimitsRegionMemory : public LLPanelScriptLimitsInfo, LLRemote std::vector mObjectListItems; + boost::signals2::scoped_connection mAvatarNameCacheConnection; + boost::signals2::scoped_connection mGroupNameCacheConnection; + void getLandScriptResourcesCoro(std::string url); void getLandScriptSummaryCoro(std::string url); void getLandScriptDetailsCoro(std::string url); diff --git a/indra/newview/llfloatersimplesnapshot.cpp b/indra/newview/llfloatersimplesnapshot.cpp index c0de8ab8116..55b39d91932 100644 --- a/indra/newview/llfloatersimplesnapshot.cpp +++ b/indra/newview/llfloatersimplesnapshot.cpp @@ -54,11 +54,11 @@ void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, L { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("post_profile_image_coro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("post_profile_image_coro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setFollowRedirects(true); LLSD result = httpAdapter->postAndSuspend(httpRequest, cap_url, first_data, httpOpts, httpHeaders); @@ -87,9 +87,9 @@ void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, L // Upload the image - LLCore::HttpRequest::ptr_t uploaderhttpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t uploaderhttpHeaders(new LLCore::HttpHeaders); - LLCore::HttpOptions::ptr_t uploaderhttpOpts(new LLCore::HttpOptions); + LLCore::HttpRequest::ptr_t uploaderhttpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t uploaderhttpHeaders = std::make_shared(); + LLCore::HttpOptions::ptr_t uploaderhttpOpts = std::make_shared(); S64 length; { diff --git a/indra/newview/llfloatersimplesnapshot.h b/indra/newview/llfloatersimplesnapshot.h index 487e77469cc..5620a15d879 100644 --- a/indra/newview/llfloatersimplesnapshot.h +++ b/indra/newview/llfloatersimplesnapshot.h @@ -63,7 +63,7 @@ class LLFloaterSimpleSnapshot : public LLFloaterSnapshotBase void postSave(); - typedef boost::function completion_t; + typedef std::function completion_t; void setComplectionCallback(completion_t callback) { mUploadCompletionCallback = callback; } static void uploadThumbnail(const std::string &file_path, const LLUUID &inventory_id, diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 8eec5b753ad..da4b5097381 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -248,9 +248,9 @@ void LLFloaterTOS::testSiteIsAliveCoro(LLHandle handle, std::string u { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("testSiteIsAliveCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); httpOpts->setHeadersOnly(true); diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h index 3bec4da58d0..82a8c8ac5ae 100644 --- a/indra/newview/llfloatertos.h +++ b/indra/newview/llfloatertos.h @@ -30,7 +30,6 @@ #include "llmodaldialog.h" #include "llassetstorage.h" #include "llmediactrl.h" -#include #include "lleventcoro.h" #include "llcoros.h" diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 2f1857ec613..9696c3d3f8c 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -201,10 +201,10 @@ void LLFloaterURLEntry::getMediaTypeCoro(std::string url, LLHandle pa { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMediaTypeCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("getMediaTypeCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setFollowRedirects(true); httpOpts->setHeadersOnly(true); diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 5300627cec4..b9f19b52474 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -136,7 +136,7 @@ bool LLFindAgentCallingCard::operator()(LLInventoryCategory* cat, LLInventoryIte class LLInitialFriendCardsFetch : public LLInventoryFetchDescendentsObserver { public: - typedef boost::function callback_t; + typedef std::function callback_t; LLInitialFriendCardsFetch(const LLUUID& folder_id, callback_t cb) : diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h index e3bd25aae72..f6c0a991bc7 100644 --- a/indra/newview/llfriendcard.h +++ b/indra/newview/llfriendcard.h @@ -96,7 +96,7 @@ class LLFriendCardsManager void syncFriendCardsFolders(); private: - typedef boost::function callback_t; + typedef std::function callback_t; diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 1bbeba43ec3..550af7af533 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -71,7 +71,7 @@ LLGestureMgr::LLGestureMgr() mLoadingCount(0) { gInventory.addObserver(this); - mListener.reset(new LLGestureListener()); + mListener = std::make_shared(); } diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index 8db36c6d899..e10bc8bbb42 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -54,7 +54,7 @@ class LLGestureMgr : public LLSingleton, public LLInventoryFetchIt ~LLGestureMgr(); public: - typedef boost::function gesture_loaded_callback_t; + typedef std::function gesture_loaded_callback_t; // Maps inventory item_id to gesture typedef std::map item_map_t; typedef std::map callback_map_t; diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 3e4aadc3815..ac8477a615d 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -723,9 +723,9 @@ void LLGLTFMaterialList::modifyMaterialCoro(std::string cap_url, LLSD overrides, { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("modifyMaterialCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("modifyMaterialCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; httpOpts->setFollowRedirects(true); diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp index 5a6e9565aec..ebb9dc3e3c8 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.cpp +++ b/indra/newview/llgltfmaterialpreviewmgr.cpp @@ -462,7 +462,7 @@ bool LLGLTFPreviewTexture::render() // Set up camera and viewport const LLVector3 origin(0.0, 0.0, 0.0); camera.lookAt(origin, object_position); - camera.setAspect((F32)(mFullHeight / mFullWidth)); + camera.setAspect((F32)(mFullWidth / mFullHeight)); const LLRect texture_rect(0, mFullHeight, mFullWidth, 0); camera.setPerspective(NOT_FOR_SELECTION, texture_rect.mLeft, texture_rect.mBottom, texture_rect.getWidth(), texture_rect.getHeight(), false, camera.getNear(), MAX_FAR_CLIP*2.f); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index d53b36e59f0..e0da7622799 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -1975,8 +1975,8 @@ 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); + httpAdapter = std::make_shared("groupMembersRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string finalUrl = url + "?group_id=" + group_id.asString(); @@ -2004,10 +2004,10 @@ void LLGroupMgr::postGroupBanRequestCoro(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); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); - LLCore::HttpOptions::ptr_t httpOptions(new LLCore::HttpOptions); + httpAdapter = std::make_shared("groupMembersRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOptions = std::make_shared(); httpOptions->setFollowRedirects(false); @@ -2141,9 +2141,9 @@ void LLGroupMgr::groupMembersRequestCoro(std::string url, LLUUID group_id, U32 p << ", 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(new LLCore::HttpOptions); + httpAdapter = std::make_shared("groupMembersRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLSD postData = LLSD::emptyMap(); postData["group_id"] = group_id; diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 7cd0171a370..779ed725acb 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -202,9 +202,19 @@ void inventory_offer_handler(LLOfferInfo* info) auto indx = msg.find(" ( http://slurl.com/secondlife/"); if (indx == std::string::npos) { - // try to find new slurl host + // https + indx = msg.find(" ( https://slurl.com/secondlife/"); + } + if (indx == std::string::npos) + { + // try to find new slurl http host indx = msg.find(" ( http://maps.secondlife.com/secondlife/"); } + if (indx == std::string::npos) + { + // try to find new slurl https host + indx = msg.find(" ( https://maps.secondlife.com/secondlife/"); + } if (indx >= 0) { LLStringUtil::truncate(msg, indx); @@ -1551,8 +1561,8 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestOfflineMessagesCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("requestOfflineMessagesCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index bda4afcc04b..ad01e11d483 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -429,8 +429,8 @@ void startConferenceCoro(std::string url, { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ConferenceChatStart", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("ConferenceChatStart", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData; postData["method"] = "start conference"; @@ -478,8 +478,8 @@ void startConferenceCoro(std::string url, void startP2PVoiceCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID otherParticipantId) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("StartP2PVoiceCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared("StartP2PVoiceCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData; postData["method"] = "start p2p voice"; @@ -518,8 +518,8 @@ void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvit { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ConferenceInviteStart", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("ConferenceInviteStart", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData; postData["method"] = "accept invitation"; @@ -636,8 +636,8 @@ void chatterBoxHistoryCoro(std::string url, LLUUID sessionId, std::string from, { // if parameters from, message and timestamp have values, they are a message that opened chat LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ChatHistory", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("ChatHistory", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData; postData["method"] = "fetch history"; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index e322d3ae284..848f28f933a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3316,7 +3316,7 @@ bool move_inv_category_world_to_agent(const LLUUID& object_id, if (drop && accept) { - std::shared_ptr move_inv(new LLMoveInv); + std::shared_ptr move_inv = std::make_shared(); move_inv->mObjectID = object_id; move_inv->mCategoryID = category_id; move_inv->mCallback = callback; @@ -5989,7 +5989,7 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (accept && drop) { LLUUID item_id = inv_item->getUUID(); - std::shared_ptr move_inv (new LLMoveInv()); + std::shared_ptr move_inv = std::make_shared(); move_inv->mObjectID = inv_item->getParentUUID(); two_uuids_t item_pair(mUUID, item_id); move_inv->mMoveList.push_back(item_pair); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index d96adbd1d21..decb2c05287 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -239,7 +239,7 @@ class LLItemBridge : public LLInvFVBridge const LLUUID& uuid) : LLInvFVBridge(inventory, root, uuid) {} - typedef boost::function slurl_callback_t; + typedef std::function slurl_callback_t; virtual void performAction(LLInventoryModel* model, std::string action); virtual void selectItem(); @@ -833,7 +833,7 @@ void rez_attachment(LLViewerInventoryItem* item, bool move_inv_category_world_to_agent(const LLUUID& object_id, const LLUUID& category_id, bool drop, - std::function callback = NULL, + std::function callback = nullptr, void* user_data = NULL, LLInventoryFilter* filter = NULL); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index e6b33453d51..3cc57e851f1 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1758,7 +1758,7 @@ bool sort_alpha(const LLViewerInventoryCategory* cat1, const LLViewerInventoryCa // The only inventory changes that are done is to move and sort folders containing no-copy items to stock folders. // @pending_callbacks - how many callbacks we are waiting for, must be inited before use // @result - true if things validate, false if issues are raised, must be inited before use -typedef boost::function validation_result_callback_t; +typedef std::function validation_result_callback_t; void validate_marketplacelistings( LLInventoryCategory* cat, validation_result_callback_t cb_result, diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 77a2a188773..eba67be3138 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -151,13 +151,13 @@ class LLMarketplaceValidator: public LLSingleton LOG_CLASS(LLMarketplaceValidator); public: - typedef boost::function validation_msg_callback_t; - typedef boost::function validation_done_callback_t; + typedef std::function validation_msg_callback_t; + typedef std::function validation_done_callback_t; void validateMarketplaceListings( const LLUUID &category_id, - validation_done_callback_t cb_done = NULL, - validation_msg_callback_t cb_msg = NULL, + validation_done_callback_t cb_done = nullptr, + validation_msg_callback_t cb_msg = nullptr, bool fix_hierarchy = true, S32 depth = -1); diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index c54af7d9f14..f77088e0b16 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -1816,8 +1816,8 @@ void LLInventoryGallery::paste(const LLUUID& dest, const LLUUID& marketplacelistings_id) { LLHandle handle = getHandle(); - std::function on_copy_callback = NULL; - LLPointer cb = NULL; + std::function on_copy_callback = nullptr; + LLPointer cb = nullptr; if (dest == mFolderID) { on_copy_callback = [handle](const LLUUID& inv_item) @@ -3582,12 +3582,12 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, if (accept && drop) { - std::shared_ptr move_inv (new LLMoveInv()); + std::shared_ptr move_inv = std::make_shared(); move_inv->mObjectID = inv_item->getParentUUID(); std::pair item_pair(folder_id, inv_item->getUUID()); move_inv->mMoveList.push_back(item_pair); - move_inv->mCallback = NULL; - move_inv->mUserData = NULL; + move_inv->mCallback = nullptr; + move_inv->mUserData = nullptr; if (is_move) { warn_move_inventory(object, move_inv); diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 7f53f9998da..a53637a477a 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -44,14 +44,14 @@ class LLGalleryGestureObserver; class LLInventoryGalleryContextMenu; -typedef boost::function callback_t; +typedef std::function callback_t; class LLInventoryGallery : public LLPanel, public LLEditMenuHandler { public: typedef boost::signals2::signal selection_change_signal_t; - typedef boost::function selection_change_callback_t; + typedef std::function selection_change_callback_t; typedef std::deque selection_deque; struct Params diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index eda93e3e79d..fe007a78cd0 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -362,7 +362,7 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata) } else if ("show_on_map" == action) { - boost::function show_on_map_cb = [](LLLandmark* landmark) + std::function show_on_map_cb = [](LLLandmark* landmark) { LLVector3d landmark_global_pos; if (landmark->getGlobalPos(landmark_global_pos)) diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index 73cc9536920..15735ebde36 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -51,6 +51,7 @@ LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p : LLFlatListViewEx(p) , mRefreshState(REFRESH_COMPLETE) , mForceRefresh(false) +, mNeedsArrange(true) { // TODO: mCommitOnSelectionChange is set to "false" in LLFlatListView // but reset to true in all derived classes. This settings might need to @@ -144,6 +145,7 @@ void LLInventoryItemsList::updateSelection() bool LLInventoryItemsList::doIdle() { if (mRefreshState == REFRESH_COMPLETE) return true; // done + LL_PROFILE_ZONE_SCOPED; if (isInVisibleChain() || mForceRefresh || !getFilterSubString().empty()) { @@ -165,7 +167,7 @@ void LLInventoryItemsList::idle(void* user_data) using namespace std::chrono; auto start = steady_clock::now(); - const milliseconds time_limit = milliseconds(3); + const milliseconds time_limit = milliseconds(2); const auto end_time = start + time_limit; S32 max_update_count = 50; @@ -218,8 +220,6 @@ void LLInventoryItemsList::refresh() mRefreshState = REFRESH_LIST_SORT; } - rearrangeItems(); - notifyParentItemsRectChanged(); break; } case REFRESH_LIST_ERASE: @@ -229,10 +229,21 @@ void LLInventoryItemsList::refresh() for (; mRemovedItems.end() != it; ++it) { // don't filter items right away - removeItemByUUID(*it, false); + removeItemByUUID(*it, false /*don't rearrange*/); } mRemovedItems.clear(); - mRefreshState = REFRESH_LIST_SORT; // fix visibility and arrange + mRefreshState = REFRESH_LIST_SORT; // fix visibility + + // Assume that visible items were removed. + if (getVisible()) + { + rearrangeItems(); + notifyParentItemsRectChanged(); + } + else + { + mNeedsArrange = true; + } break; } case REFRESH_LIST_APPEND: @@ -275,18 +286,25 @@ void LLInventoryItemsList::refresh() LLSD action; action.with("match_filter", cur_filter); + bool new_visible_items = false; pairs_const_iterator_t pair_it = panel_list.begin(); for (; pair_it != panel_list.end(); ++pair_it) { item_pair_t* item_pair = *pair_it; if (item_pair->first->getParent() != NULL) { - updateItemVisibility(item_pair->first, action); + new_visible_items |= updateItemVisibility(item_pair->first, action); } } - rearrangeItems(); - notifyParentItemsRectChanged(); + mNeedsArrange |= new_visible_items; + if (mNeedsArrange && getVisible()) + { + // show changes now + rearrangeItems(); + notifyParentItemsRectChanged(); + mNeedsArrange = false; + } if (mAddedItems.size() > 0) { @@ -304,16 +322,33 @@ void LLInventoryItemsList::refresh() { LL_PROFILE_ZONE_NAMED("items_refresh_sort"); // Filter, sort, rearrange and notify parent about shape changes - filterItems(true, true); + if (filterItems(true, true)) + { + mNeedsArrange = false; // just rearranged + } if (mAddedItems.size() == 0) { + if (mNeedsArrange) + { + // Done, last chance to rearrange + rearrangeItems(); + notifyParentItemsRectChanged(); + mNeedsArrange = false; + } // After list building completed, select items that had been requested to select before list was build updateSelection(); mRefreshState = REFRESH_COMPLETE; } else { + if (mNeedsArrange && getVisible()) + { + // show changes now + rearrangeItems(); + notifyParentItemsRectChanged(); + mNeedsArrange = false; + } mRefreshState = REFRESH_LIST_APPEND; } break; @@ -347,6 +382,7 @@ void LLInventoryItemsList::computeDifference( LLPanel* LLInventoryItemsList::createNewItem(LLViewerInventoryItem* item) { + LL_PROFILE_ZONE_SCOPED; if (!item) { LL_WARNS() << "No inventory item. Couldn't create flat list item." << LL_ENDL; diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h index b20c27eec8b..f80d6b31b81 100644 --- a/indra/newview/llinventoryitemslist.h +++ b/indra/newview/llinventoryitemslist.h @@ -117,6 +117,7 @@ class LLInventoryItemsList : public LLFlatListViewEx }; ERefreshStates mRefreshState; + bool mNeedsArrange = true; private: uuid_vec_t mIDs; // IDs of items that were added in refreshList(). diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp index 5fb5b0f23f0..a435a4f7c7c 100644 --- a/indra/newview/llinventorylistitem.cpp +++ b/indra/newview/llinventorylistitem.cpp @@ -69,6 +69,7 @@ LLPanelInventoryListItemBase::Params::Params() LLPanelInventoryListItemBase* LLPanelInventoryListItemBase::create(LLViewerInventoryItem* item) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; LLPanelInventoryListItemBase* list_item = NULL; if (item) { @@ -189,6 +190,7 @@ void LLPanelInventoryListItemBase::setShowWidget(LLUICtrl* ctrl, bool show) bool LLPanelInventoryListItemBase::postBuild() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; LLViewerInventoryItem* inv_item = getItem(); if (inv_item) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 2dfc3b014f5..043fd7003d6 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1037,7 +1037,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, { if (new_category.isNull()) { - if (callback && !callback.empty()) + if (callback) { callback(new_category); } @@ -1064,7 +1064,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, updateCategory(cat); } - if (callback && !callback.empty()) + if (callback) { callback(new_category); } @@ -1107,9 +1107,9 @@ void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inv { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("createNewCategoryCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("createNewCategoryCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); @@ -3257,11 +3257,11 @@ void LLInventoryModel::initHttpRequest() mHttpRequestFG = new LLCore::HttpRequest; mHttpRequestBG = new LLCore::HttpRequest; - mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + mHttpOptions = std::make_shared(); mHttpOptions->setTransferTimeout(300); mHttpOptions->setUseRetryAfter(true); // mHttpOptions->setTrace(2); // Do tracing of requests - mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders); + mHttpHeaders = std::make_shared(); mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_INVENTORY); diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index d28743357e2..2859923df90 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -122,9 +122,8 @@ class LLInventoryModel FetchItemHttpHandler(const LLSD & request_sd); virtual ~FetchItemHttpHandler(); - protected: - FetchItemHttpHandler(const FetchItemHttpHandler &); // Not defined - void operator=(const FetchItemHttpHandler &); // Not defined + FetchItemHttpHandler(const FetchItemHttpHandler&) = delete; + FetchItemHttpHandler& operator=(const FetchItemHttpHandler&) = delete; public: virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); @@ -489,7 +488,7 @@ class LLInventoryModel void createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& name, - inventory_func_type callback = NULL, + inventory_func_type callback = nullptr, const LLUUID& thumbnail_id = LLUUID::null); protected: // Internal methods that add inventory and make sure that all of diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 2cf15549578..1e5f771ba78 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -125,9 +125,8 @@ class BGItemHttpHandler : public LLInventoryModel::FetchItemHttpHandler LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); } -protected: - BGItemHttpHandler(const BGItemHttpHandler&); // Not defined - void operator=(const BGItemHttpHandler&); // Not defined + BGItemHttpHandler(const BGItemHttpHandler&) = delete; + BGItemHttpHandler& operator=(const BGItemHttpHandler&) = delete; }; @@ -159,8 +158,8 @@ class BGFolderHttpHandler : public LLCore::HttpHandler } protected: - BGFolderHttpHandler(const BGFolderHttpHandler&); // Not defined - void operator=(const BGFolderHttpHandler&); // Not defined + BGFolderHttpHandler(const BGFolderHttpHandler&) = delete; + BGFolderHttpHandler& operator=(const BGFolderHttpHandler&) = delete; public: virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse* response); @@ -886,31 +885,34 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc static LLCachedControl ais_batch(gSavedSettings, "BatchSizeAIS3", 20); S32 batch_limit = llclamp(ais_batch(), 1, 40); - for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); - it != categories->end(); - ++it) + if (categories) { - LLViewerInventoryCategory* child_cat = (*it); - if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion() - || child_cat->getFetching() >= target_state) + for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); + it != categories->end(); + ++it) { - continue; - } + LLViewerInventoryCategory* child_cat = (*it); + if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion() + || child_cat->getFetching() >= target_state) + { + continue; + } - if (child_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) - { - // special case, marketplace will fetch that as needed - continue; - } + if (child_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) + { + // special case, marketplace will fetch that as needed + continue; + } - children.emplace_back(child_cat->getUUID()); - mExpectedFolderIds.emplace_back(child_cat->getUUID()); - child_cat->setFetching(target_state); + children.emplace_back(child_cat->getUUID()); + mExpectedFolderIds.emplace_back(child_cat->getUUID()); + child_cat->setFetching(target_state); - if (children.size() >= batch_limit) - { - content_done = false; - break; + if (children.size() >= batch_limit) + { + content_done = false; + break; + } } } @@ -940,14 +942,17 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc // This will have a bit of overlap with onAISContentCalback, // but something else might have downloaded folders, so verify // every child that is complete has it's children done as well - for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); - it != categories->end(); - ++it) + if (categories) { - LLViewerInventoryCategory* child_cat = (*it); - if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion()) + for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); + it != categories->end(); + ++it) { - mFetchFolderQueue.emplace_back(child_cat->getUUID(), FT_RECURSIVE); + LLViewerInventoryCategory* child_cat = (*it); + if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion()) + { + mFetchFolderQueue.emplace_back(child_cat->getUUID(), FT_RECURSIVE); + } } } } @@ -998,12 +1003,15 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc LLInventoryModel::cat_array_t* categories(NULL); LLInventoryModel::item_array_t* items(NULL); gInventory.getDirectDescendentsOf(cat_id, categories, items); - for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); - it != categories->end(); - ++it) + if (categories) { - // not emplace_front to not cause an infinite loop - mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE); + for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); + it != categories->end(); + ++it) + { + // not emplace_front to not cause an infinite loop + mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE); + } } } } @@ -1208,7 +1216,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() if (! url.empty()) { - LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(folder_request_body, recursive_cats)); + LLCore::HttpHandler::ptr_t handler = std::make_shared(folder_request_body, recursive_cats); gInventory.requestPost(false, url, folder_request_body, handler, "Inventory Folder"); } } @@ -1219,7 +1227,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() if (! url.empty()) { - LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(folder_request_body_lib, recursive_cats)); + LLCore::HttpHandler::ptr_t handler = std::make_shared(folder_request_body_lib, recursive_cats); gInventory.requestPost(false, url, folder_request_body_lib, handler, "Library Folder"); } } @@ -1235,7 +1243,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() { LLSD body; body["items"] = item_request_body; - LLCore::HttpHandler::ptr_t handler(new BGItemHttpHandler(body)); + LLCore::HttpHandler::ptr_t handler = std::make_shared(body); gInventory.requestPost(false, url, body, handler, "Inventory Item"); } } @@ -1248,7 +1256,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() { LLSD body; body["items"] = item_request_body_lib; - LLCore::HttpHandler::ptr_t handler(new BGItemHttpHandler(body)); + LLCore::HttpHandler::ptr_t handler = std::make_shared(body); gInventory.requestPost(false, url, body, handler, "Library Item"); } } @@ -1534,7 +1542,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http { LLSD request_body; request_body["folders"] = folders; - LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(request_body, recursive_cats)); + LLCore::HttpHandler::ptr_t handler = std::make_shared(request_body, recursive_cats); gInventory.requestPost(false, url, request_body, handler, "Inventory Folder"); recursive_cats.clear(); folders.clear(); @@ -1544,7 +1552,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http LLSD request_body; request_body["folders"] = folders; - LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(request_body, recursive_cats)); + LLCore::HttpHandler::ptr_t handler = std::make_shared(request_body, recursive_cats); gInventory.requestPost(false, url, request_body, handler, "Inventory Folder"); return; } diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h index 2e9f69ee295..ef6fa06e9fd 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.h +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -53,7 +53,7 @@ class LLInventoryModelBackgroundFetch : public LLSingleton nullary_func_t; + typedef std::function nullary_func_t; // AIS3 only, Fetches folder and everything links inside the folder point to // Intended for outfits void fetchFolderAndLinks(const LLUUID& cat_id, nullary_func_t callback); @@ -78,7 +78,7 @@ class LLInventoryModelBackgroundFetch : public LLSingleton folders_fetched_callback_t; + typedef std::function folders_fetched_callback_t; boost::signals2::connection setFetchCompletionCallback(folders_fetched_callback_t cb); void addRequestAtFront(const LLUUID& id, bool recursive, bool is_category); diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index ac22be9d5af..a50d6b579e0 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -249,7 +249,7 @@ void fetch_items_from_llsd(const LLSD& items_llsd) if (!url.empty()) { body[i]["agent_id"] = gAgent.getID(); - LLCore::HttpHandler::ptr_t handler(new LLInventoryModel::FetchItemHttpHandler(body[i])); + LLCore::HttpHandler::ptr_t handler = std::make_shared(body[i]); gInventory.requestPost(true, url, body[i], handler, (i ? "Library Item" : "Inventory Item")); continue; } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 12d6c445212..99cb9ec8118 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -258,7 +258,7 @@ class LLInventoryCompletionObserver : public LLInventoryObserver class LLInventoryCategoriesObserver : public LLInventoryObserver { public: - typedef boost::function callback_t; + typedef std::function callback_t; LLInventoryCategoriesObserver() {}; virtual void changed(U32 mask); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index a935ede1860..cde87ede9b6 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -113,7 +113,7 @@ class LLInventoryPanelObserver : public LLInventoryObserver class LLInvPanelComplObserver : public LLInventoryCompletionObserver { public: - typedef boost::function callback_t; + typedef std::function callback_t; LLInvPanelComplObserver(callback_t cb) : mCallback(cb) @@ -627,7 +627,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // This could be anything. For now, just refresh the item. if (mask & LLInventoryObserver::INTERNAL) { - if (view_item) + if (view_item && view_item->getViewModelItem()) { view_item->refresh(); } @@ -646,7 +646,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve if (mask & LLInventoryObserver::UPDATE_FAVORITE) { - if (view_item) + if (view_item && view_item->getViewModelItem()) { view_item->refresh(); LLFolderViewFolder* parent = view_item->getParentFolder(); @@ -1595,7 +1595,7 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, bool take_keyboard_foc setSelectionByID(obj_id, take_keyboard_focus); } -void LLInventoryPanel::setSelectCallback(const boost::function& items, bool user_action)>& cb) +void LLInventoryPanel::setSelectCallback(const std::function& items, bool user_action)>& cb) { if (mFolderRoot.get()) { @@ -2762,7 +2762,7 @@ void LLInventorySingleFolderPanel::updateSingleFolderRoot() mFolderRoot.get()->setFollowsAll(); mFolderRoot.get()->addChild(mFolderRoot.get()->mStatusTextBox); - if (!mSelectionCallback.empty()) + if (mSelectionCallback != nullptr) { mFolderRoot.get()->setSelectCallback(mSelectionCallback); } diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 50333709fc6..dc2e304ab35 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -37,6 +37,7 @@ #include "llinventorymodel.h" #include "llscrollcontainer.h" #include "lluictrlfactory.h" +#include #include class LLInvFVBridge; @@ -182,7 +183,7 @@ class LLInventoryPanel : public LLPanel // Call this method to set the selection. void openAllFolders(); void setSelection(const LLUUID& obj_id, bool take_keyboard_focus); - void setSelectCallback(const boost::function& items, bool user_action)>& cb); + void setSelectCallback(const std::function& items, bool user_action)>& cb); void clearSelection(); selected_items_t getSelectedItems() const; @@ -374,7 +375,7 @@ class LLInventoryPanel : public LLPanel virtual LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop); virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge); - boost::function& items, bool user_action)> mSelectionCallback; + std::function& items, bool user_action)> mSelectionCallback; // buildViewsTree does not include some checks and is meant // for recursive use, use buildNewViews() for first call @@ -436,7 +437,7 @@ class LLInventorySingleFolderPanel : public LLInventoryPanel std::list getNavBackwardList() { return mBackwardFolders; } std::list getNavForwardList() { return mForwardFolders; } - typedef boost::function root_changed_callback_t; + typedef std::function root_changed_callback_t; boost::signals2::connection setRootChangedCallback(root_changed_callback_t cb); protected: diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h index 1abf10e1102..0996dfed296 100644 --- a/indra/newview/lllandmarkactions.h +++ b/indra/newview/lllandmarkactions.h @@ -39,8 +39,8 @@ class LLLandmark; class LLLandmarkActions { public: - typedef boost::function slurl_callback_t; - typedef boost::function region_name_and_coords_callback_t; + typedef std::function slurl_callback_t; + typedef std::function region_name_and_coords_callback_t; /** * @brief Fetches landmark LLViewerInventoryItems for the given landmark name. @@ -107,7 +107,7 @@ class LLLandmarkActions * * @return pointer to loaded landmark from gLandmarkList or NULL if landmark does not exist or wasn't loaded. */ - static LLLandmark* getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb = NULL); + static LLLandmark* getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb = nullptr); /** * @brief Performs standard action of copying of SLURL from landmark to user's clipboard. diff --git a/indra/newview/lllandmarklist.h b/indra/newview/lllandmarklist.h index 508148abde5..fb8b5a19608 100644 --- a/indra/newview/lllandmarklist.h +++ b/indra/newview/lllandmarklist.h @@ -27,7 +27,7 @@ #ifndef LL_LLLANDMARKLIST_H #define LL_LLLANDMARKLIST_H -#include +#include #include #include "lllandmark.h" #include "lluuid.h" @@ -40,7 +40,7 @@ class LLInventoryItem; class LLLandmarkList { public: - typedef boost::function loaded_callback_t; + typedef std::function loaded_callback_t; LLLandmarkList() {} ~LLLandmarkList(); @@ -50,7 +50,7 @@ class LLLandmarkList //const LLLandmark* getNext() { return mList.getNextData(); } bool assetExists(const LLUUID& asset_uuid); - LLLandmark* getAsset(const LLUUID& asset_uuid, loaded_callback_t cb = NULL); + LLLandmark* getAsset(const LLUUID& asset_uuid, loaded_callback_t cb = nullptr); static void processGetAssetReply( const LLUUID& uuid, LLAssetType::EType type, diff --git a/indra/newview/lllistcontextmenu.h b/indra/newview/lllistcontextmenu.h index 4b515a3b269..cb2ca5260f3 100644 --- a/indra/newview/lllistcontextmenu.h +++ b/indra/newview/lllistcontextmenu.h @@ -63,7 +63,7 @@ class LLListContextMenu virtual void hide(); protected: - typedef boost::function functor_t; + typedef std::function functor_t; virtual LLContextMenu* createMenu() = 0; diff --git a/indra/newview/lllocationhistory.h b/indra/newview/lllocationhistory.h index ca9b81457c7..34cb83367f0 100644 --- a/indra/newview/lllocationhistory.h +++ b/indra/newview/lllocationhistory.h @@ -29,10 +29,9 @@ #include "llsingleton.h" // for LLSingleton +#include #include #include -#include -#include #include class LLSD; @@ -115,7 +114,7 @@ class LLLocationHistory: public LLSingleton }; typedef std::vector location_list_t; - typedef boost::function history_changed_callback_t; + typedef std::function history_changed_callback_t; typedef boost::signals2::signal history_changed_signal_t; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 41cec4f074e..e9d68723d37 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -80,7 +80,7 @@ std::string construct_start_string(); LLLoginInstance::LLLoginInstance() : - mLoginModule(new LLLogin()), + mLoginModule(std::make_unique()), mNotifications(NULL), mLoginState("offline"), mSaveMFA(true), diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 941b378b14a..54ce51720f7 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -29,7 +29,6 @@ #include "lleventdispatcher.h" #include "lleventapi.h" -#include #include // std::shared_ptr #include "llsecapi.h" class LLLogin; diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 0888f630e8d..9bcfd9e2c02 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -695,24 +695,28 @@ bool LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // handle attachments in local space if (object->isAttachment() && object->mDrawable.notNull()) { - // calculate local version of relative move - LLQuaternion objWorldRotation = object->mDrawable->mXform.getParent()->getWorldRotation(); - objWorldRotation.transQuat(); + LLXform* object_xform_parent = object->mDrawable->mXform.getParent(); + if (object_xform_parent) + { + // calculate local version of relative move + LLQuaternion objWorldRotation = object_xform_parent->getWorldRotation(); + objWorldRotation.transQuat(); - LLVector3 old_position_local = object->getPosition(); - LLVector3 new_position_local = selectNode->mSavedPositionLocal + (clamped_relative_move_f * objWorldRotation); + LLVector3 old_position_local = object->getPosition(); + LLVector3 new_position_local = selectNode->mSavedPositionLocal + (clamped_relative_move_f * objWorldRotation); - //RN: I forget, but we need to do this because of snapping which doesn't often result - // in position changes even when the mouse moves - object->setPosition(new_position_local); - rebuild(object); - gAgentAvatarp->clampAttachmentPositions(); - new_position_local = object->getPosition(); + //RN: I forget, but we need to do this because of snapping which doesn't often result + // in position changes even when the mouse moves + object->setPosition(new_position_local); + rebuild(object); + gAgentAvatarp->clampAttachmentPositions(); + new_position_local = object->getPosition(); - if (selectNode->mIndividualSelection) - { - // counter-translate child objects if we are moving the root as an individual - object->resetChildrenPosition(old_position_local - new_position_local, true); + if (selectNode->mIndividualSelection) + { + // counter-translate child objects if we are moving the root as an individual + object->resetChildrenPosition(old_position_local - new_position_local, true); + } } } else diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 7b8211ded81..ac2f52a2623 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -206,10 +206,10 @@ namespace LLMarketplaceImport { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("marketplacePostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("marketplacePostCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(true); @@ -267,17 +267,17 @@ namespace LLMarketplaceImport { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("marketplaceGetCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("marketplaceGetCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(!sMarketplaceCookie.empty()); if (buildHeaders) { - httpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders); + httpHeaders = std::make_shared(); httpHeaders->append(HTTP_OUT_HEADER_ACCEPT, "*/*"); httpHeaders->append(HTTP_OUT_HEADER_COOKIE, sMarketplaceCookie); @@ -783,9 +783,9 @@ void LLMarketplaceData::getMerchantStatusCoro() { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("getMerchantStatusCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setFollowRedirects(true); @@ -861,9 +861,9 @@ void LLMarketplaceData::getSLMListingsCoro(LLUUID folderId) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("getSLMListingsCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpHeaders->append("Accept", "application/json"); httpHeaders->append("Content-Type", "application/json"); @@ -926,9 +926,9 @@ void LLMarketplaceData::getSingleListingCoro(S32 listingId, LLUUID folderId) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("getSingleListingCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpHeaders->append("Accept", "application/json"); httpHeaders->append("Content-Type", "application/json"); @@ -997,9 +997,9 @@ void LLMarketplaceData::createSLMListingCoro(LLUUID folderId, LLUUID versionId, { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("createSLMListingCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpHeaders->append("Accept", "application/json"); httpHeaders->append("Content-Type", "application/json"); @@ -1071,9 +1071,9 @@ void LLMarketplaceData::updateSLMListingCoro(LLUUID folderId, S32 listingId, LLU { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("updateSLMListingCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpHeaders->append("Accept", "application/json"); httpHeaders->append("Content-Type", "application/json"); @@ -1166,9 +1166,9 @@ void LLMarketplaceData::associateSLMListingCoro(LLUUID folderId, S32 listingId, { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("associateSLMListingCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpHeaders->append("Accept", "application/json"); httpHeaders->append("Content-Type", "application/json"); @@ -1247,9 +1247,9 @@ void LLMarketplaceData::deleteSLMListingCoro(S32 listingId) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("deleteSLMListingCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpHeaders->append("Accept", "application/json"); httpHeaders->append("Content-Type", "application/json"); diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 281743c1d6c..07ed667b0a8 100644 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -28,15 +28,11 @@ #ifndef LL_LLMARKETPLACEFUNCTIONS_H #define LL_LLMARKETPLACEFUNCTIONS_H - -#include -#include -#include - +#include "llsd.h" #include "llsingleton.h" #include "llstring.h" - +#include namespace MarketplaceErrorCodes { diff --git a/indra/newview/llmarketplacenotifications.h b/indra/newview/llmarketplacenotifications.h index a602b930dec..0b03bde16c2 100644 --- a/indra/newview/llmarketplacenotifications.h +++ b/indra/newview/llmarketplacenotifications.h @@ -30,7 +30,7 @@ #include -#include +#include // @@ -48,7 +48,7 @@ namespace LLMarketplaceInventoryNotifications { void update(); - typedef boost::function NoCopyCallbackFunction; + typedef std::function NoCopyCallbackFunction; void addNoCopyNotification(const LLSD& payload, const NoCopyCallbackFunction& cb); }; diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index cac72bb0858..4e14f416e9b 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -494,7 +494,7 @@ bool LLMaterialEditor::postBuild() refreshUploadCost(); } - boost::function changes_callback = [this](LLUICtrl * ctrl, void* userData) + std::function changes_callback = [this](LLUICtrl * ctrl, void* userData) { const U32 *flag = (const U32*)userData; markChangesUnsaved(*flag); @@ -1987,12 +1987,14 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind { // Prespecified material LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + me->mUploadFolder = dest_folder; me->loadMaterial(model_in, filename, index); } else if (model_in.materials.size() == 1) { // Only one material, just load it LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + me->mUploadFolder = dest_folder; me->loadMaterial(model_in, filename, 0); } else @@ -2018,11 +2020,12 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind material_list.push_back(LLTrans::getString("material_batch_import_text")); LLFloaterComboOptions::showUI( - [model_in, filename](const std::string& option, S32 index) + [model_in, filename, dest_folder](const std::string& option, S32 index) { if (index >= 0) // -1 on cancel { LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + me->mUploadFolder = dest_folder; me->loadMaterial(model_in, filename, index); } }, @@ -2448,7 +2451,7 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std:: if (index == model_in.materials.size()) { // bulk upload all the things - upload_bulk({ filename }, LLFilePicker::FFLOAD_MATERIAL, true, LLUUID::null); + upload_bulk({ filename }, LLFilePicker::FFLOAD_MATERIAL, true, mUploadFolder); return; } diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index ee5e5b438eb..723f834d6f1 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -67,7 +67,7 @@ class LLMaterialHttpHandler : public LLHttpSDHandler { public: - typedef boost::function CallbackFunction; + typedef std::function CallbackFunction; typedef std::shared_ptr ptr_t; LLMaterialHttpHandler(const std::string& method, CallbackFunction cback); @@ -137,9 +137,9 @@ LLMaterialMgr::LLMaterialMgr(): { LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); - mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest()); - mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()); - mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()); + mHttpRequest = std::make_shared(); + mHttpHeaders = std::make_shared(); + mHttpOptions = std::make_shared(); mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_MATERIALS); mMaterials.insert(std::pair(LLMaterialID::null, LLMaterialPtr(NULL))); @@ -684,9 +684,9 @@ void LLMaterialMgr::processGetQueue() LLSD postData = LLSD::emptyMap(); postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; - LLCore::HttpHandler::ptr_t handler(new LLMaterialHttpHandler("POST", + LLCore::HttpHandler::ptr_t handler = std::make_shared("POST", boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id) - )); + ); LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '" << capURL << " for " << materialsData.size() << " materials." << "\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; @@ -864,9 +864,9 @@ void LLMaterialMgr::processGetAllQueueCoro(LLUUID regionId) LL_DEBUGS("Materials") << "GET all for region " << regionId << "url " << capURL << LL_ENDL; - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( - new LLCoreHttpUtil::HttpCoroutineAdapter("processGetAllQueue", LLCore::HttpRequest::DEFAULT_POLICY_ID)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter = std::make_shared("processGetAllQueue", LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, capURL); @@ -973,9 +973,9 @@ void LLMaterialMgr::processPutQueue() LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces to region " << itRequest->first->getName() << LL_ENDL; - LLCore::HttpHandler::ptr_t handler (new LLMaterialHttpHandler("PUT", + LLCore::HttpHandler::ptr_t handler = std::make_shared("PUT", boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2) - )); + ); LLCore::HttpHandle handle = LLCoreHttpUtil::requestPutWithLLSD( mHttpRequest, mHttpPolicy, capURL, diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index 83a6e660191..50236587acc 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -172,9 +172,9 @@ LLMediaDataClient::LLMediaDataClient(F32 queue_timer_delay, F32 retry_timer_dela mMaxSortedQueueSize(max_sorted_queue_size), mMaxRoundRobinQueueSize(max_round_robin_queue_size), mQueueTimerIsRunning(false), - mHttpRequest(new LLCore::HttpRequest()), - mHttpHeaders(new LLCore::HttpHeaders()), - mHttpOpts(new LLCore::HttpOptions()), + mHttpRequest(std::make_shared()), + mHttpHeaders(std::make_shared()), + mHttpOpts(std::make_shared()), mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID) { // *TODO: Look up real Policy ID @@ -660,7 +660,7 @@ void LLMediaDataClient::Handler::onFailure(LLCore::HttpResponse * response, LLCo void LLObjectMediaDataClient::fetchMedia(LLMediaDataClientObject *object) { // Create a get request and put it in the queue. - enqueue(Request::ptr_t(new RequestGet(object, this))); + enqueue(std::make_shared(object, this)); } const char *LLObjectMediaDataClient::getCapabilityName() const @@ -880,14 +880,14 @@ LLSD LLObjectMediaDataClient::RequestGet::getPayload() const LLCore::HttpHandler::ptr_t LLObjectMediaDataClient::RequestGet::createHandler() { - return LLCore::HttpHandler::ptr_t(new LLObjectMediaDataClient::Handler(shared_from_this())); + return std::make_shared(shared_from_this()); } void LLObjectMediaDataClient::updateMedia(LLMediaDataClientObject *object) { // Create an update request and put it in the queue. - enqueue(Request::ptr_t(new RequestUpdate(object, this))); + enqueue(std::make_shared(object, this)); } LLObjectMediaDataClient::RequestUpdate::RequestUpdate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc): @@ -917,7 +917,7 @@ LLSD LLObjectMediaDataClient::RequestUpdate::getPayload() const LLCore::HttpHandler::ptr_t LLObjectMediaDataClient::RequestUpdate::createHandler() { // This just uses the base class's responder. - return LLCore::HttpHandler::ptr_t(new LLMediaDataClient::Handler(shared_from_this())); + return std::make_shared(shared_from_this()); } void LLObjectMediaDataClient::Handler::onSuccess(LLCore::HttpResponse * response, const LLSD &content) @@ -1037,7 +1037,7 @@ void LLObjectMediaNavigateClient::navigate(LLMediaDataClientObject *object, U8 t // LL_INFOS("LLMediaDataClient") << "navigate() initiated: " << ll_print_sd(sd_payload) << LL_ENDL; // Create a get request and put it in the queue. - enqueue(Request::ptr_t(new RequestNavigate(object, this, texture_index, url))); + enqueue(std::make_shared(object, this, texture_index, url)); } LLObjectMediaNavigateClient::RequestNavigate::RequestNavigate(LLMediaDataClientObject *obj, LLMediaDataClient *mdc, U8 texture_index, const std::string &url): @@ -1058,7 +1058,7 @@ LLSD LLObjectMediaNavigateClient::RequestNavigate::getPayload() const LLCore::HttpHandler::ptr_t LLObjectMediaNavigateClient::RequestNavigate::createHandler() { - return LLCore::HttpHandler::ptr_t(new LLObjectMediaNavigateClient::Handler(shared_from_this())); + return std::make_shared(shared_from_this()); } void LLObjectMediaNavigateClient::Handler::onSuccess(LLCore::HttpResponse * response, const LLSD &content) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 413f02b723e..c0b1a5326ad 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -654,12 +654,10 @@ class LLMeshHandlerBase : public LLCore::HttpHandler, mRequestedBytes(requested_bytes) {} - virtual ~LLMeshHandlerBase() - {} + virtual ~LLMeshHandlerBase() = default; -protected: - LLMeshHandlerBase(const LLMeshHandlerBase &); // Not defined - void operator=(const LLMeshHandlerBase &); // Not defined + LLMeshHandlerBase(const LLMeshHandlerBase &) = delete; + LLMeshHandlerBase& operator=(const LLMeshHandlerBase&) = delete; public: virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); @@ -693,9 +691,8 @@ class LLMeshHeaderHandler : public LLMeshHandlerBase } virtual ~LLMeshHeaderHandler(); -protected: - LLMeshHeaderHandler(const LLMeshHeaderHandler &); // Not defined - void operator=(const LLMeshHeaderHandler &); // Not defined + LLMeshHeaderHandler(const LLMeshHeaderHandler&) = delete; + LLMeshHeaderHandler& operator=(const LLMeshHeaderHandler&) = delete; public: virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size); @@ -719,9 +716,8 @@ class LLMeshLODHandler : public LLMeshHandlerBase } virtual ~LLMeshLODHandler(); -protected: - LLMeshLODHandler(const LLMeshLODHandler &); // Not defined - void operator=(const LLMeshLODHandler &); // Not defined + LLMeshLODHandler(const LLMeshLODHandler&) = delete; + LLMeshLODHandler& operator=(const LLMeshLODHandler&) = delete; public: virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size); @@ -750,9 +746,8 @@ class LLMeshSkinInfoHandler : public LLMeshHandlerBase } virtual ~LLMeshSkinInfoHandler(); -protected: - LLMeshSkinInfoHandler(const LLMeshSkinInfoHandler &); // Not defined - void operator=(const LLMeshSkinInfoHandler &); // Not defined + LLMeshSkinInfoHandler(const LLMeshSkinInfoHandler&) = delete; + LLMeshSkinInfoHandler& operator=(const LLMeshSkinInfoHandler&) = delete; void processSkin(U8* data, S32 data_size); @@ -778,9 +773,8 @@ class LLMeshDecompositionHandler : public LLMeshHandlerBase {} virtual ~LLMeshDecompositionHandler(); -protected: - LLMeshDecompositionHandler(const LLMeshDecompositionHandler &); // Not defined - void operator=(const LLMeshDecompositionHandler &); // Not defined + LLMeshDecompositionHandler(const LLMeshDecompositionHandler&) = delete; + LLMeshDecompositionHandler& operator=(const LLMeshDecompositionHandler&) = delete; public: virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size); @@ -804,9 +798,8 @@ class LLMeshPhysicsShapeHandler : public LLMeshHandlerBase {} virtual ~LLMeshPhysicsShapeHandler(); -protected: - LLMeshPhysicsShapeHandler(const LLMeshPhysicsShapeHandler &); // Not defined - void operator=(const LLMeshPhysicsShapeHandler &); // Not defined + LLMeshPhysicsShapeHandler(const LLMeshPhysicsShapeHandler&) = delete; + LLMeshPhysicsShapeHandler& operator=(const LLMeshPhysicsShapeHandler&) = delete; public: virtual void processData(LLCore::BufferArray * body, S32 body_offset, U8 * data, S32 data_size); @@ -943,20 +936,20 @@ LLMeshRepoThread::LLMeshRepoThread() mSkinMapMutex = new LLMutex(); mSignal = new LLCondition(); mHttpRequest = new LLCore::HttpRequest; - mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + mHttpOptions = std::make_shared(); mHttpOptions->setTransferTimeout(SMALL_MESH_XFER_TIMEOUT); mHttpOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter")); - mHttpLargeOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + mHttpLargeOptions = std::make_shared(); mHttpLargeOptions->setTransferTimeout(LARGE_MESH_XFER_TIMEOUT); mHttpLargeOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter")); - mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders); + mHttpHeaders = std::make_shared(); mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_VND_LL_MESH); mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_MESH2); mHttpLargePolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_LARGE_MESH); // Lod processing is expensive due to the number of requests // and a need to do expensive cacheOptimize(). - mMeshThreadPool.reset(new LL::ThreadPool("MeshLodProcessing", 2)); + mMeshThreadPool = std::make_unique("MeshLodProcessing", 2); mMeshThreadPool->start(); } @@ -1653,7 +1646,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) if (!http_url.empty()) { - LLMeshHandlerBase::ptr_t handler(new LLMeshSkinInfoHandler(mesh_id, offset, size)); + LLMeshHandlerBase::ptr_t handler = std::make_shared(mesh_id, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { @@ -1761,7 +1754,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) if (!http_url.empty()) { - LLMeshHandlerBase::ptr_t handler(new LLMeshDecompositionHandler(mesh_id, offset, size)); + LLMeshHandlerBase::ptr_t handler = std::make_shared(mesh_id, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { @@ -1860,7 +1853,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) if (!http_url.empty()) { - LLMeshHandlerBase::ptr_t handler(new LLMeshPhysicsShapeHandler(mesh_id, offset, size)); + LLMeshHandlerBase::ptr_t handler = std::make_shared(mesh_id, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { @@ -1988,7 +1981,7 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params) //within the first 4KB //NOTE -- this will break of headers ever exceed 4KB - LLMeshHandlerBase::ptr_t handler(new LLMeshHeaderHandler(mesh_params, 0, MESH_HEADER_SIZE)); + LLMeshHandlerBase::ptr_t handler = std::make_shared(mesh_params, 0, MESH_HEADER_SIZE); LLCore::HttpHandle handle = getByteRange(http_url, 0, MESH_HEADER_SIZE, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { @@ -2164,7 +2157,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) { LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh body for ID " << mesh_id << " - was retrieved from the simulator." << LL_ENDL; - LLMeshHandlerBase::ptr_t handler(new LLMeshLODHandler(mesh_params, lod, offset, size)); + LLMeshHandlerBase::ptr_t handler = std::make_shared(mesh_params, lod, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { @@ -2611,11 +2604,11 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list_t& data mMeshUploadTimeOut = gSavedSettings.getS32("MeshUploadTimeOut"); mHttpRequest = new LLCore::HttpRequest; - mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + mHttpOptions = std::make_shared(); mHttpOptions->setTransferTimeout(mMeshUploadTimeOut); mHttpOptions->setUseRetryAfter(gSavedSettings.getBOOL("MeshUseHttpRetryAfter")); mHttpOptions->setRetries(UPLOAD_RETRY_LIMIT); - mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders); + mHttpHeaders = std::make_shared(); mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicy(LLAppCoreHttp::AP_UPLOADS); } @@ -4321,7 +4314,7 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para else { //first request for this mesh - std::shared_ptr request(new PendingRequestLOD(mesh_params, new_lod)); + std::shared_ptr request = std::make_shared(mesh_params, new_lod); mPendingRequests.emplace_back(request); mLoadingMeshes[new_lod][mesh_id].initData(vobj, request); LLMeshRepository::sLODPending++; @@ -4819,7 +4812,7 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOV else { //first request for this mesh - std::shared_ptr request(new PendingRequestUUID(mesh_id, MESH_REQUEST_SKIN)); + std::shared_ptr request = std::make_shared(mesh_id, MESH_REQUEST_SKIN); mLoadingSkins[mesh_id].initData(requesting_obj, request); mPendingRequests.emplace_back(request); } diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index f6d635f51f8..9157e348332 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -190,7 +190,7 @@ LLMuteList::~LLMuteList() void LLMuteList::cleanupSingleton() { - LLAvatarNameCache::getInstance()->setAccountNameChangedCallback(NULL); + LLAvatarNameCache::getInstance()->setAccountNameChangedCallback(nullptr); } bool LLMuteList::isLinden(const std::string& name) diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index dde85f4d290..ffff21c95c1 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -210,12 +210,12 @@ class LLNameListCtrl boost::signals2::signal mIconClickedSignal; public: - boost::signals2::connection setOnNameListCompleteCallback(boost::function onNameListCompleteCallback) + boost::signals2::connection setOnNameListCompleteCallback(std::function onNameListCompleteCallback) { return mNameListCompleteSignal.connect(onNameListCompleteCallback); } - boost::signals2::connection setIconClickedCallback(boost::function cb) + boost::signals2::connection setIconClickedCallback(std::function cb) { return mIconClickedSignal.connect(cb); } diff --git a/indra/newview/llnotificationlistitem.h b/indra/newview/llnotificationlistitem.h index 2ed90e31b21..b3283ca642c 100644 --- a/indra/newview/llnotificationlistitem.h +++ b/indra/newview/llnotificationlistitem.h @@ -84,7 +84,7 @@ class LLNotificationListItem : public LLPanel virtual void onMouseLeave(S32 x, S32 y, MASK mask); //callbacks - typedef boost::function item_callback_t; + typedef std::function item_callback_t; typedef boost::signals2::signal item_signal_t; item_signal_t mOnItemClose; item_signal_t mOnItemClick; @@ -156,8 +156,8 @@ class LLGroupNotificationListItem LLTextBox* mGroupNameBoxExp; private: - LLGroupNotificationListItem(const LLGroupNotificationListItem &); - LLGroupNotificationListItem & operator=(LLGroupNotificationListItem &); + LLGroupNotificationListItem(const LLGroupNotificationListItem&) = delete; + LLGroupNotificationListItem& operator=(LLGroupNotificationListItem&) = delete; void setGroupName(std::string name); bool updateFromCache(); @@ -175,8 +175,8 @@ class LLGroupInviteNotificationListItem private: friend class LLNotificationListItem; LLGroupInviteNotificationListItem(const Params& p); - LLGroupInviteNotificationListItem(const LLGroupInviteNotificationListItem &); - LLGroupInviteNotificationListItem & operator=(LLGroupInviteNotificationListItem &); + LLGroupInviteNotificationListItem(const LLGroupInviteNotificationListItem&) = delete; + LLGroupInviteNotificationListItem& operator=(LLGroupInviteNotificationListItem&) = delete; void setFee(S32 fee); @@ -202,8 +202,8 @@ class LLGroupNoticeNotificationListItem private: friend class LLNotificationListItem; LLGroupNoticeNotificationListItem(const Params& p); - LLGroupNoticeNotificationListItem(const LLGroupNoticeNotificationListItem &); - LLGroupNoticeNotificationListItem & operator=(LLGroupNoticeNotificationListItem &); + LLGroupNoticeNotificationListItem(const LLGroupNoticeNotificationListItem&) = delete; + LLGroupNoticeNotificationListItem& operator=(LLGroupNoticeNotificationListItem&) = delete; void setSender(std::string sender); void onClickAttachment(); @@ -226,8 +226,8 @@ class LLTransactionNotificationListItem : public LLNotificationListItem private: friend class LLNotificationListItem; LLTransactionNotificationListItem(const Params& p); - LLTransactionNotificationListItem(const LLTransactionNotificationListItem &); - LLTransactionNotificationListItem & operator=(LLTransactionNotificationListItem &); + LLTransactionNotificationListItem(const LLTransactionNotificationListItem&) = delete; + LLTransactionNotificationListItem& operator=(LLTransactionNotificationListItem&) = delete; LLAvatarIconCtrl* mAvatarIcon; LLAvatarIconCtrl* mAvatarIconExp; }; @@ -239,8 +239,8 @@ class LLSystemNotificationListItem : public LLNotificationListItem private: friend class LLNotificationListItem; LLSystemNotificationListItem(const Params& p); - LLSystemNotificationListItem(const LLSystemNotificationListItem &); - LLSystemNotificationListItem & operator=(LLSystemNotificationListItem &); + LLSystemNotificationListItem(const LLSystemNotificationListItem&) = delete; + LLSystemNotificationListItem & operator=(LLSystemNotificationListItem &) = delete; LLIconCtrl* mSystemNotificationIcon; LLIconCtrl* mSystemNotificationIconExp; bool mIsCaution; diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp index 505f276f8c5..29f11f7ca6f 100644 --- a/indra/newview/llnotificationmanager.cpp +++ b/indra/newview/llnotificationmanager.cpp @@ -60,7 +60,7 @@ void LLNotificationManager::init() mChannels.emplace_back(new LLBrowserNotification()); mChannels.emplace_back(new LLIMHandler()); - mChatHandler = std::shared_ptr(new LLFloaterIMNearbyChatHandler()); + mChatHandler = std::make_shared(); } //-------------------------------------------------------------------------- diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index 75bafb87859..5cec35fc880 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -41,7 +41,7 @@ #include "llregistry.h" #include "llviewermessage.h" -typedef boost::function responder_constructor_t; +typedef std::function responder_constructor_t; class LLResponderRegistry : public LLRegistrySingleton { diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 58cd9fab834..32831fcd9bf 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -54,7 +54,7 @@ #include "llvoavatarself.h" #include "llwearableitemslist.h" -static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y); +static bool is_tab_header_clicked(LLOutfitAccordionCtrlTab* tab, S32 y); static const LLOutfitTabNameComparator OUTFIT_TAB_NAME_COMPARATOR; static const LLOutfitTabFavComparator OUTFIT_TAB_FAV_COMPARATOR; @@ -246,7 +246,10 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id) list->setCommitCallback(boost::bind(&LLOutfitsList::onListSelectionChange, this, _1)); // Setting list refresh callback to apply filter on list change. - list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onRefreshComplete, this, _1)); + list->setRefreshCompleteCallback([this, tab](LLUICtrl* ctrl, const LLSD& sd) + { + onRefreshComplete(ctrl, tab); + }); list->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onWearableItemsListRightClick, this, _1, _2, _3)); @@ -294,7 +297,7 @@ void LLOutfitsList::updateRemovedCategory(LLUUID cat_id) if (outfits_iter != mOutfitsMap.end()) { const LLUUID& outfit_id = outfits_iter->first; - LLAccordionCtrlTab* tab = outfits_iter->second; + LLOutfitAccordionCtrlTab* tab = outfits_iter->second; // An outfit is removed from the list. Do the following: // 1. Remove outfit category from observer to stop monitoring its changes. @@ -322,11 +325,11 @@ void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id) { if (mOutfitsMap[prev_id]) { - ((LLOutfitAccordionCtrlTab*)mOutfitsMap[prev_id])->setOutfitSelected(false); + mOutfitsMap[prev_id]->setOutfitSelected(false); } if (mOutfitsMap[base_id]) { - ((LLOutfitAccordionCtrlTab*)mOutfitsMap[base_id])->setOutfitSelected(true); + mOutfitsMap[base_id]->setOutfitSelected(true); } } @@ -370,7 +373,7 @@ void LLOutfitsList::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid) { if (outfit_uuid == iter->first) { - LLAccordionCtrlTab* tab = iter->second; + LLOutfitAccordionCtrlTab* tab = iter->second; if (!tab) continue; LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); @@ -464,7 +467,7 @@ void LLOutfitsList::onCollapseAllFolders() iter != mOutfitsMap.end(); ++iter) { - LLAccordionCtrlTab* tab = iter->second; + LLOutfitAccordionCtrlTab* tab = iter->second; if(tab && tab->isExpanded()) { tab->changeOpenClose(true); @@ -478,7 +481,7 @@ void LLOutfitsList::onExpandAllFolders() iter != mOutfitsMap.end(); ++iter) { - LLAccordionCtrlTab* tab = iter->second; + LLOutfitAccordionCtrlTab* tab = iter->second; if(tab && !tab->isExpanded()) { tab->changeOpenClose(false); @@ -501,7 +504,7 @@ void LLOutfitsList::updateChangedCategoryName(LLViewerInventoryCategory *cat, st if (outfits_iter != mOutfitsMap.end()) { // Update tab name with the new category name. - LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*) outfits_iter->second; + LLOutfitAccordionCtrlTab* tab = outfits_iter->second; if (tab) { tab->setName(name); @@ -554,7 +557,7 @@ void LLOutfitsList::deselectOutfit(const LLUUID& category_id) LLOutfitListBase::deselectOutfit(category_id); } -void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id) +void LLOutfitsList::restoreOutfitSelection(LLOutfitAccordionCtrlTab* tab, const LLUUID& category_id) { // Try restoring outfit selection after filtering. if (mAccordion->getSelectedTab() == tab) @@ -563,23 +566,21 @@ void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID } } -void LLOutfitsList::onRefreshComplete(LLUICtrl* ctrl) +void LLOutfitsList::onRefreshComplete(LLUICtrl* ctrl, LLOutfitAccordionCtrlTab* tab) { if (!ctrl || getFilterSubString().empty()) return; - for (outfits_map_t::iterator - iter = mOutfitsMap.begin(), - iter_end = mOutfitsMap.end(); - iter != iter_end; ++iter) + LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); + if (list != ctrl) { - LLAccordionCtrlTab* tab = iter->second; - if (!tab) continue; - - LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); - if (list != ctrl) continue; - - applyFilterToTab(iter->first, tab, getFilterSubString()); + llassert(false); + LL_WARNS() << "LLOutfitsList::onRefreshComplete: ctrl does not match tab's list!" << LL_ENDL; + return; + } + if (tab->getFilterGeneration() != getFilterGeneration()) + { + applyFilterToTab(tab->getFolderID(), tab, getFilterSubString()); } } @@ -592,7 +593,7 @@ void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, cons while (iter != iter_end) { const LLUUID& category_id = iter->first; - LLAccordionCtrlTab* tab = iter++->second; + LLOutfitAccordionCtrlTab* tab = iter++->second; if (!tab) continue; LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); @@ -631,9 +632,10 @@ void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, cons void LLOutfitsList::applyFilterToTab( const LLUUID& category_id, - LLAccordionCtrlTab* tab, + LLOutfitAccordionCtrlTab* tab, const std::string& filter_substring) { + LL_PROFILE_ZONE_SCOPED; if (!tab) return; LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); if (!list) return; @@ -645,6 +647,7 @@ void LLOutfitsList::applyFilterToTab( LLStringUtil::toUpper(cur_filter); tab->setTitle(tab->getTitle(), cur_filter); + tab->setFilterGeneration(getFilterGeneration()); if (std::string::npos == title.find(cur_filter)) { @@ -768,7 +771,7 @@ void LLOutfitsList::onCOFChanged() outfits_map_t::iterator map_iter = mOutfitsMap.begin(), map_end = mOutfitsMap.end(); while (map_iter != map_end) { - LLAccordionCtrlTab* tab = (map_iter++)->second; + LLOutfitAccordionCtrlTab* tab = (map_iter++)->second; if (!tab) continue; LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); @@ -799,7 +802,7 @@ void LLOutfitsList::sortOutfits() void LLOutfitsList::onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) { - LLAccordionCtrlTab* tab = dynamic_cast(ctrl); + LLOutfitAccordionCtrlTab* tab = dynamic_cast(ctrl); if (mOutfitMenu && is_tab_header_clicked(tab, y) && cat_id.notNull()) { // Focus tab header to trigger tab selection change. @@ -822,7 +825,7 @@ void LLOutfitsList::handleInvFavColorChange() ++iter) { if (!iter->second) continue; - LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*)iter->second; + LLOutfitAccordionCtrlTab* tab = iter->second; // refresh font color tab->setFavorite(tab->getFavorite()); @@ -849,7 +852,7 @@ void LLOutfitsList::onChangeSortOrder(const LLSD& userdata) { for (outfits_map_t::value_type& outfit : mOutfitsMap) { - LLAccordionCtrlTab* tab = outfit.second; + LLOutfitAccordionCtrlTab* tab = outfit.second; const LLUUID& category_id = outfit.first; if (!tab) continue; @@ -890,7 +893,7 @@ LLOutfitListGearMenuBase* LLOutfitsList::createGearMenu() } -bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y) +bool is_tab_header_clicked(LLOutfitAccordionCtrlTab* tab, S32 y) { if(!tab || !tab->getHeaderVisible()) return false; diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 0bf5becb055..bcf7e45696a 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -38,14 +38,13 @@ #include "lltoggleablemenu.h" #include "llviewermenu.h" -class LLAccordionCtrlTab; +class LLOutfitAccordionCtrlTab; class LLInventoryCategoriesObserver; class LLOutfitListGearMenuBase; class LLOutfitListSortMenuBase; class LLWearableItemsList; class LLListContextMenu; - /** * @class LLOutfitTabNameComparator * @@ -76,7 +75,7 @@ class LLOutfitTabFavComparator : public LLAccordionCtrl::LLTabComparator class LLOutfitListBase : public LLPanelAppearanceTab { public: - typedef boost::function selection_change_callback_t; + typedef std::function selection_change_callback_t; typedef boost::signals2::signal selection_change_signal_t; LLOutfitListBase(); @@ -266,7 +265,10 @@ class LLOutfitAccordionCtrlTab : public LLAccordionCtrlTab void setFavorite(bool is_favorite); bool getFavorite() const { return mIsFavorite; } + LLUUID getFolderID() const { return mFolderID; } void setOutfitSelected(bool val); + U32 getFilterGeneration() const { return mFilterGeneration; } + void setFilterGeneration(U32 generation) { mFilterGeneration = generation; } static LLUIImage* sFavoriteIcon; static LLUIColor sFgColor; @@ -284,6 +286,7 @@ class LLOutfitAccordionCtrlTab : public LLAccordionCtrlTab LLUUID mFolderID; bool mIsFavorite = false; bool mIsSelected = false; + U32 mFilterGeneration = 0; }; /** * @class LLOutfitsList @@ -386,20 +389,20 @@ class LLOutfitsList : public LLOutfitListBase * * A tab may be hidden if it doesn't match current filter. */ - void restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id); + void restoreOutfitSelection(LLOutfitAccordionCtrlTab* tab, const LLUUID& category_id); /** * Called upon list refresh event to update tab visibility depending on * the results of applying filter to the title and list items of the tab. */ - void onRefreshComplete(LLUICtrl* ctrl); + void onRefreshComplete(LLUICtrl* ctrl, LLOutfitAccordionCtrlTab* tab); /** * Applies filter to the given tab * * @see applyFilter() */ - void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring); + void applyFilterToTab(const LLUUID& category_id, LLOutfitAccordionCtrlTab* tab, const std::string& filter_substring); /** * Returns true if all selected items can be worn. @@ -426,7 +429,7 @@ class LLOutfitsList : public LLOutfitListBase typedef wearables_lists_map_t::value_type wearables_lists_map_value_t; wearables_lists_map_t mSelectedListsMap; - typedef std::map outfits_map_t; + typedef std::map outfits_map_t; typedef outfits_map_t::value_type outfits_map_value_t; outfits_map_t mOutfitsMap; diff --git a/indra/newview/llpanelappearancetab.cpp b/indra/newview/llpanelappearancetab.cpp index 3ee4ab8e511..ef04d7f13f5 100644 --- a/indra/newview/llpanelappearancetab.cpp +++ b/indra/newview/llpanelappearancetab.cpp @@ -40,6 +40,7 @@ void LLPanelAppearanceTab::setFilterSubString(const std::string& new_string) { std::string old_string = mFilterSubString; mFilterSubString = new_string; + mFilterGeneration++; onFilterSubStringChanged(mFilterSubString, old_string); } @@ -52,6 +53,7 @@ void LLPanelAppearanceTab::checkFilterSubString() { std::string old_string = mFilterSubString; mFilterSubString = sRecentFilterSubString; + mFilterGeneration++; onFilterSubStringChanged(mFilterSubString, old_string); } } diff --git a/indra/newview/llpanelappearancetab.h b/indra/newview/llpanelappearancetab.h index e088c3e6f0f..936fe2aec79 100644 --- a/indra/newview/llpanelappearancetab.h +++ b/indra/newview/llpanelappearancetab.h @@ -48,6 +48,7 @@ class LLPanelAppearanceTab : public LLPanel virtual void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const {} const std::string& getFilterSubString() { return mFilterSubString; } + U32 getFilterGeneration() { return mFilterGeneration; } virtual void updateMenuItemsVisibility() = 0; virtual LLToggleableMenu* getGearMenu() = 0; @@ -63,6 +64,7 @@ class LLPanelAppearanceTab : public LLPanel private: std::string mFilterSubString; + U32 mFilterGeneration = 0; static std::string sRecentFilterSubString; }; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 0e72771bd8c..35624436b38 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -126,11 +126,11 @@ static void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLS { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("put_avatar_properties_coro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("put_avatar_properties_coro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setFollowRedirects(true); std::string finalUrl = cap_url + "/" + agent_id.asString(); diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 7d55ba32651..69f51b03b67 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -263,7 +263,7 @@ void LLPanelBlockedList::callbackBlockByName(const std::string& text) // Constructor/Destructor LLFloaterGetBlockedObjectName::LLFloaterGetBlockedObjectName(const LLSD& key) : LLFloater(key) -, mGetObjectNameCallback(NULL) +, mGetObjectNameCallback(nullptr) { } diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 1f470199ceb..782a44bc5be 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -95,7 +95,7 @@ class LLFloaterGetBlockedObjectName : public LLFloater { friend class LLFloaterReg; public: - typedef boost::function get_object_name_callback_t; + typedef std::function get_object_name_callback_t; bool postBuild() override; diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 449a670de97..aefda39fb97 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -153,8 +153,10 @@ void LLPanelClassifiedInfo::reshape(S32 width, S32 height, bool called_from_pare void LLPanelClassifiedInfo::onOpen(const LLSD& key) { + bool from_search = key.has("from_search") ? key["from_search"].asBoolean() : false; + LLUUID avatar_id = key["classified_creator_id"]; - if(avatar_id.isNull()) + if(avatar_id.isNull() && !from_search) { return; } diff --git a/indra/newview/llpaneldirbrowser.cpp b/indra/newview/llpaneldirbrowser.cpp new file mode 100644 index 00000000000..8c981cad55a --- /dev/null +++ b/indra/newview/llpaneldirbrowser.cpp @@ -0,0 +1,1169 @@ +/** + * @file llpaneldirbrowser.cpp + * @brief Base class for panels in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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$ + */ + +// Base class for the various search panels/results browsers +// in the Find floater. For example, Find > Popular Places +// is derived from this. + +#include "llviewerprecompiledheaders.h" + +#include "llpaneldirbrowser.h" + +// linden library includes +#include "lldir.h" +#include "lleventflags.h" +#include "llqueryflags.h" +#include "message.h" + +// viewer project includes +#include "llagent.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" +#include "llpanelavatar.h" +#include "llpanelgroup.h" +#include "llpanelclassified.h" +#include "llpaneldirevents.h" +#include "llpaneldirland.h" +#include "llproductinforequest.h" +#include "llscrolllistctrl.h" +#include "lltextbox.h" +#include "lltrans.h" +#include "llviewercontrol.h" +#include "llfloaterdirectory.h" +#include "llpanelprofile.h" +#include "llpanelplaces.h" +#include "llpaneleventinfo.h" + + +std::map gDirBrowserInstances; + +LLPanelDirBrowser::LLPanelDirBrowser() +: LLPanel(), + mSearchID(), + mWantSelectID(), + mCurrentSortColumn("name"), + mCurrentSortAscending(true), + mSearchStart(0), + mResultsPerPage(RESULTS_PER_PAGE_DEFAULT), + mResultsReceived(0), + mMinSearchChars(1), + mResultsContents(), + mHaveSearchResults(false), + mDidAutoSelect(true), + mLastResultTimer(), + mFloaterDirectory(nullptr) +{ +} + +bool LLPanelDirBrowser::postBuild() +{ + childSetCommitCallback("results", onCommitList, this); + + mPrevPageBtn = getChild("prev_btn"); + mNextPageBtn = getChild("next_btn"); + + mPrevPageBtn->setClickedCallback([this](LLUICtrl*, const LLSD&){ prevPage(); }); + mPrevPageBtn->setVisible(false); + + mNextPageBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { nextPage(); }); + mNextPageBtn->setVisible(false); + + return true; +} + +LLPanelDirBrowser::~LLPanelDirBrowser() +{ + // Children all cleaned up by default view destructor. + gDirBrowserInstances.erase(mSearchID); +} + +// virtual +void LLPanelDirBrowser::draw() +{ + // HACK: If the results panel has data, we want to select the first + // item. Unfortunately, we don't know when the find is actually done, + // so only do this if it's been some time since the last packet of + // results was received. + if (mLastResultTimer.getElapsedTimeF32() > 0.5) + { + if (!mDidAutoSelect && + !childHasFocus("results")) + { + LLCtrlListInterface *list = childGetListInterface("results"); + if (list) + { + if (list->getCanSelect()) + { + list->selectFirstItem(); // select first item by default + childSetFocus("results", true); + } + // Request specific data from the server + onCommitList(NULL, this); + } + } + mDidAutoSelect = true; + } + + LLPanel::draw(); +} + + +// virtual +void LLPanelDirBrowser::nextPage() +{ + mSearchStart += mResultsPerPage; + mPrevPageBtn->setVisible(true); + + performQuery(); +} + + +// virtual +void LLPanelDirBrowser::prevPage() +{ + mSearchStart -= mResultsPerPage; + mPrevPageBtn->setVisible(mSearchStart > 0); + + performQuery(); +} + + +void LLPanelDirBrowser::resetSearchStart() +{ + mSearchStart = 0; + mNextPageBtn->setVisible(false); + mPrevPageBtn->setVisible(false); +} + +// protected +void LLPanelDirBrowser::updateResultCount() +{ + LLScrollListCtrl* list = getChild("results"); + + S32 result_count = list->getItemCount(); + std::string result_text; + + if (!mHaveSearchResults) result_count = 0; + + if (mNextPageBtn && mNextPageBtn->getVisible()) + { + // Item count be off by a few if bogus items sent from database + // Just use the number of results per page. JC + result_text = llformat(">%d found", mResultsPerPage); + } + else + { + result_text = llformat("%d found", result_count); + } + + childSetValue("result_text", result_text); + + if (result_count == 0) + { + // add none found response + if (list->getItemCount() == 0) + { + list->setCommentText(std::string("None found.")); // *TODO: Translate + list->operateOnAll(LLCtrlListInterface::OP_DESELECT); + } + } + else + { + childEnable("results"); + } +} + +// static +std::string LLPanelDirBrowser::filterShortWords(const std::string source_string, int shortest_word_length, bool& was_filtered) +{ + // degenerate case + if ( source_string.length() < 1 ) + return ""; + + std::stringstream codec( source_string ); + std::string each_word; + std::vector< std::string > all_words; + + while( codec >> each_word ) + all_words.push_back( each_word ); + + std::ostringstream dest_string( "" ); + + was_filtered = false; + + std::vector< std::string >::iterator iter = all_words.begin(); + while( iter != all_words.end() ) + { + if ( (int)(*iter).length() >= shortest_word_length ) + { + dest_string << *iter; + dest_string << " "; + } + else + { + was_filtered = true; + } + + ++iter; + }; + + return dest_string.str(); +} + +void LLPanelDirBrowser::selectByUUID(const LLUUID& id) +{ + LLCtrlListInterface *list = childGetListInterface("results"); + if (!list) return; + bool found = list->setCurrentByID(id); + if (found) + { + // we got it, don't wait for network + // Don't bother looking for this in the draw loop. + mWantSelectID.setNull(); + // Make sure UI updates. + onCommitList(NULL, this); + } + else + { + // waiting for this item from the network + mWantSelectID = id; + } +} + +void LLPanelDirBrowser::selectEventByID(S32 event_id) +{ + if (mFloaterDirectory) + { + if (mFloaterDirectory->mPanelEventp) + { + mFloaterDirectory->mPanelEventp->setVisible(true); + mFloaterDirectory->mPanelEventp->setEventID(event_id); + } + } +} + +void LLPanelDirBrowser::getSelectedInfo(LLUUID* id, S32 *type) +{ + LLCtrlListInterface *list = childGetListInterface("results"); + if (!list) return; + + LLSD id_sd = childGetValue("results"); + + *id = id_sd.asUUID(); + + std::string id_str = id_sd.asString(); + *type = mResultsContents[id_str]["type"]; +} + + +// static +void LLPanelDirBrowser::onCommitList(LLUICtrl* ctrl, void* data) +{ + LLPanelDirBrowser* self = (LLPanelDirBrowser*)data; + LLCtrlListInterface *list = self->childGetListInterface("results"); + if (!list) return; + + // Start with everyone invisible + if (self->mFloaterDirectory) + { + self->mFloaterDirectory->hideAllDetailPanels(); + } + + if (!list->getCanSelect()) + { + return; + } + + std::string id_str = self->childGetValue("results").asString(); + if (id_str.empty()) + { + return; + } + + LLSD item_id = list->getCurrentID(); + S32 type = self->mResultsContents[id_str]["type"]; + if (type == EVENT_CODE) + { + // all but events use the UUID above + item_id = self->mResultsContents[id_str]["event_id"]; + } + //std::string name = self->mResultsContents[id_str]["name"].asString(); + self->showDetailPanel(type, item_id); +} + +void LLPanelDirBrowser::showDetailPanel(S32 type, LLSD id) +{ + switch(type) + { + case AVATAR_CODE: + if (mFloaterDirectory && mFloaterDirectory->mPanelAvatarp) + { + mFloaterDirectory->mPanelAvatarp->setVisible(true); + mFloaterDirectory->mPanelAvatarp->onOpen(id); + mFloaterDirectory->mPanelAvatarp->updateData(); + } + break; + case GROUP_CODE: + if (mFloaterDirectory && mFloaterDirectory->mPanelGroupp) + { + mFloaterDirectory->mPanelGroupp->setVisible(true); + mFloaterDirectory->mPanelGroupp->onOpen(LLSD().with("group_id", id)); + } + break; + case PLACE_CODE: + case FOR_SALE_CODE: + case AUCTION_CODE: + if (mFloaterDirectory && mFloaterDirectory->mPanelPlacep) + { + mFloaterDirectory->mPanelPlacep->setVisible(true); + LLSD key; + key["type"] = "remote_place"; + key["id"]= id; + mFloaterDirectory->mPanelPlacep->onOpen(key); + } + break; + case CLASSIFIED_CODE: + if (mFloaterDirectory && mFloaterDirectory->mPanelClassifiedp) + { + mFloaterDirectory->mPanelClassifiedp->setVisible(true); + LLSD key; + key["classified_id"] = id; + key["from_search"] = true; + mFloaterDirectory->mPanelClassifiedp->onOpen(key); + } + break; + case EVENT_CODE: + { + U32 event_id = (U32)id.asInteger(); + showEvent(event_id); + } + break; + default: + { + LL_WARNS() << "Unknown event type!" << LL_ENDL; + } + break; + } +} + + +void LLPanelDirBrowser::showEvent(const U32 event_id) +{ + // Start with everyone invisible + if (mFloaterDirectory) + { + mFloaterDirectory->hideAllDetailPanels(); + if (mFloaterDirectory->mPanelEventp) + { + mFloaterDirectory->mPanelEventp->setVisible(true); + mFloaterDirectory->mPanelEventp->setEventID(event_id); + } + } +} + +void LLPanelDirBrowser::processDirPeopleReply(LLMessageSystem *msg, void**) +{ + LLUUID query_id; + std::string first_name; + std::string last_name; + LLUUID agent_id; + + msg->getUUIDFast(_PREHASH_QueryData,_PREHASH_QueryID, query_id); + + LLPanelDirBrowser* self = get_if_there(gDirBrowserInstances, query_id, (LLPanelDirBrowser*)NULL); + if (!self) + { + // data from an old query + return; + } + + self->mHaveSearchResults = true; + + LLCtrlListInterface *list = self->childGetListInterface("results"); + if (!list) return; + + if (!list->getCanSelect()) + { + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + self->mResultsContents = LLSD(); + } + + S32 rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies); + self->mResultsReceived += rows; + + rows = self->showNextButton(rows); + + for (S32 i = 0; i < rows; i++) + { + msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_FirstName, first_name, i); + msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_LastName, last_name, i); + msg->getUUIDFast( _PREHASH_QueryReplies,_PREHASH_AgentID, agent_id, i); + // msg->getU8Fast( _PREHASH_QueryReplies,_PREHASH_Online, online, i); + // unused + // msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_Group, group, i); + // msg->getS32Fast( _PREHASH_QueryReplies,_PREHASH_Reputation, reputation, i); + + if (agent_id.isNull()) + { + continue; + } + + LLSD content; + + LLSD row; + row["id"] = agent_id; + + // We don't show online status in the finder anymore, + // so just use the 'offline' icon as the generic 'person' icon + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_avatar_offline.tga"; + + content["type"] = AVATAR_CODE; + + std::string fullname = first_name + " " + last_name; + row["columns"][1]["column"] = "name"; + row["columns"][1]["value"] = fullname; + row["columns"][1]["font"] = "SANSSERIF"; + + content["name"] = fullname; + + list->addElement(row); + self->mResultsContents[agent_id.asString()] = content; + } + + list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending); + self->updateResultCount(); + + // Poke the result received timer + self->mLastResultTimer.reset(); + self->mDidAutoSelect = false; +} + + +void LLPanelDirBrowser::processDirPlacesReply(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + LLUUID query_id; + LLUUID parcel_id; + std::string name; + bool is_for_sale = false; + bool is_auction = false; + F32 dwell; + + msg->getUUID("AgentData", "AgentID", agent_id); + msg->getUUID("QueryData", "QueryID", query_id ); + + if (msg->getNumberOfBlocks("StatusData")) + { + U32 status; + msg->getU32("StatusData", "Status", status); + if (status & STATUS_SEARCH_PLACES_BANNEDWORD) + { + LLNotificationsUtil::add("SearchWordBanned"); + } + } + + LLPanelDirBrowser* self = get_if_there(gDirBrowserInstances, query_id, (LLPanelDirBrowser*)NULL); + if (!self) + { + // data from an old query + return; + } + + self->mHaveSearchResults = true; + + LLCtrlListInterface *list = self->childGetListInterface("results"); + if (!list) return; + + if (!list->getCanSelect()) + { + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + self->mResultsContents = LLSD(); + } + + S32 count = msg->getNumberOfBlocks("QueryReplies"); + self->mResultsReceived += count; + + count = self->showNextButton(count); + + for (S32 i = 0; i < count ; i++) + { + msg->getUUID("QueryReplies", "ParcelID", parcel_id, i); + msg->getString("QueryReplies", "Name", name, i); + msg->getBOOL("QueryReplies", "ForSale", is_for_sale, i); + msg->getBOOL("QueryReplies", "Auction", is_auction, i); + msg->getF32("QueryReplies", "Dwell", dwell, i); + + if (parcel_id.isNull()) + { + continue; + } + + LLSD content; + S32 type; + + LLSD row = self->createLandSale(parcel_id, is_auction, is_for_sale, name, &type); + + content["type"] = type; + content["name"] = name; + + std::string buffer = llformat("%.0f", (F64)dwell); + row["columns"][2]["column"] = "dwell"; + row["columns"][2]["value"] = buffer; + row["columns"][2]["font"] = "SansSerifSmall"; + + list->addElement(row); + self->mResultsContents[parcel_id.asString()] = content; + } + + list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending); + self->updateResultCount(); + + // Poke the result received timer + self->mLastResultTimer.reset(); + self->mDidAutoSelect = false; +} + + +void LLPanelDirBrowser::processDirEventsReply(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + LLUUID query_id; + LLUUID owner_id; + std::string name; + std::string date; + bool show_pg = gSavedSettings.getBOOL("ShowPGEvents"); + bool show_mature = gSavedSettings.getBOOL("ShowMatureEvents"); + bool show_adult = gSavedSettings.getBOOL("ShowAdultEvents"); + + msg->getUUID("AgentData", "AgentID", agent_id); + msg->getUUID("QueryData", "QueryID", query_id ); + + LLPanelDirBrowser* self = get_if_there(gDirBrowserInstances, query_id, (LLPanelDirBrowser*)NULL); + if (!self) + { + return; + } + + if (msg->getNumberOfBlocks("StatusData")) + { + U32 status; + msg->getU32("StatusData", "Status", status); + if (status & STATUS_SEARCH_EVENTS_BANNEDWORD) + { + LLNotificationsUtil::add("SearchWordBanned"); + } + } + + self->mHaveSearchResults = true; + + LLCtrlListInterface *list = self->childGetListInterface("results"); + if (!list) return; + + if (!list->getCanSelect()) + { + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + self->mResultsContents = LLSD(); + } + + S32 rows = msg->getNumberOfBlocks("QueryReplies"); + self->mResultsReceived += rows; + + rows = self->showNextButton(rows); + + for (S32 i = 0; i < rows; i++) + { + U32 event_id; + U32 unix_time; + U32 event_flags; + + msg->getUUID("QueryReplies", "OwnerID", owner_id, i); + msg->getString("QueryReplies", "Name", name, i); + msg->getU32("QueryReplies", "EventID", event_id, i); + msg->getString("QueryReplies", "Date", date, i); + msg->getU32("QueryReplies", "UnixTime", unix_time, i); + msg->getU32("QueryReplies", "EventFlags", event_flags, i); + + // Skip empty events + if (owner_id.isNull()) + { + //RN: should this check event_id instead? + LL_WARNS() << "skipped event due to owner_id null, event_id " << event_id << LL_ENDL; + continue; + } + + // skip events that don't match the flags + // there's no PG flag, so we make sure neither adult nor mature is set + if (((event_flags & (EVENT_FLAG_ADULT | EVENT_FLAG_MATURE)) == EVENT_FLAG_NONE) && !show_pg) + { + //llwarns << "Skipped pg event because we're not showing pg, event_id " << event_id << llendl; + continue; + } + + if ((event_flags & EVENT_FLAG_MATURE) && !show_mature) + { + //llwarns << "Skipped mature event because we're not showing mature, event_id " << event_id << llendl; + continue; + } + + if ((event_flags & EVENT_FLAG_ADULT) && !show_adult) + { + //llwarns << "Skipped adult event because we're not showing adult, event_id " << event_id << llendl; + continue; + } + + LLSD content; + + content["type"] = EVENT_CODE; + content["name"] = name; + content["event_id"] = (S32)event_id; + + LLSD row; + row["id"] = llformat("%u", event_id); + + // Column 0 - event icon + LLUUID image_id; + if (event_flags == EVENT_FLAG_ADULT) + { + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_event_adult.tga"; + } + else if (event_flags == EVENT_FLAG_MATURE) + { + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_event_mature.tga"; + } + else + { + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_event.tga"; + } + + row["columns"][1]["column"] = "name"; + row["columns"][1]["value"] = name; + row["columns"][1]["font"] = "SANSSERIF"; + + row["columns"][2]["column"] = "date"; + row["columns"][2]["value"] = date; + row["columns"][2]["font"] = "SansSerifSmall"; + + row["columns"][3]["column"] = "time"; + row["columns"][3]["value"] = llformat("%u", unix_time); + row["columns"][3]["font"] = "SansSerifSmall"; + + list->addElement(row, ADD_TOP /*ADD_SORTED*/); + + std::string id_str = llformat("%u", event_id); + self->mResultsContents[id_str] = content; + } + + list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending); + self->updateResultCount(); + + // Poke the result received timer + self->mLastResultTimer.reset(); + self->mDidAutoSelect = false; +} + + +// static +void LLPanelDirBrowser::processDirGroupsReply(LLMessageSystem* msg, void**) +{ + S32 i; + + LLUUID query_id; + LLUUID group_id; + std::string group_name; + S32 members; + F32 search_order; + + msg->getUUIDFast(_PREHASH_QueryData,_PREHASH_QueryID, query_id ); + + LLPanelDirBrowser* self = get_if_there(gDirBrowserInstances, query_id, (LLPanelDirBrowser*)NULL); + if (!self) + { + return; + } + + self->mHaveSearchResults = true; + + LLCtrlListInterface *list = self->childGetListInterface("results"); + if (!list) return; + + if (!list->getCanSelect()) + { + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + self->mResultsContents = LLSD(); + } + + S32 rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies); + self->mResultsReceived += rows; + + rows = self->showNextButton(rows); + + for (i = 0; i < rows; i++) + { + msg->getUUIDFast(_PREHASH_QueryReplies, _PREHASH_GroupID, group_id, i ); + msg->getStringFast(_PREHASH_QueryReplies, _PREHASH_GroupName, group_name, i); + msg->getS32Fast(_PREHASH_QueryReplies, _PREHASH_Members, members, i ); + msg->getF32Fast(_PREHASH_QueryReplies, _PREHASH_SearchOrder, search_order, i ); + + if (group_id.isNull()) + { + continue; + } + + LLSD content; + content["type"] = GROUP_CODE; + content["name"] = group_name; + + LLSD row; + row["id"] = group_id; + + LLUUID image_id; + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_group.tga"; + + row["columns"][1]["column"] = "name"; + row["columns"][1]["value"] = group_name; + row["columns"][1]["font"] = "SANSSERIF"; + + row["columns"][2]["column"] = "members"; + row["columns"][2]["value"] = members; + row["columns"][2]["font"] = "SansSerifSmall"; + + row["columns"][3]["column"] = "score"; + row["columns"][3]["value"] = search_order; + + list->addElement(row); + self->mResultsContents[group_id.asString()] = content; + } + list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending); + self->updateResultCount(); + + // Poke the result received timer + self->mLastResultTimer.reset(); + self->mDidAutoSelect = false; +} + + +// static +void LLPanelDirBrowser::processDirClassifiedReply(LLMessageSystem* msg, void**) +{ + S32 i; + S32 num_new_rows; + + LLUUID agent_id; + LLUUID query_id; + + msg->getUUID("AgentData", "AgentID", agent_id); + if (agent_id != gAgent.getID()) + { + LL_WARNS() << "Message for wrong agent " << agent_id + << " in processDirClassifiedReply" << LL_ENDL; + return; + } + + msg->getUUID("QueryData", "QueryID", query_id); + LLPanelDirBrowser* self = get_if_there(gDirBrowserInstances, query_id, (LLPanelDirBrowser*)NULL); + if (!self) + { + return; + } + + if (msg->getNumberOfBlocks("StatusData")) + { + U32 status; + msg->getU32("StatusData", "Status", status); + if (status & STATUS_SEARCH_CLASSIFIEDS_BANNEDWORD) + { + LLNotificationsUtil::add("SearchWordBanned"); + } + } + + self->mHaveSearchResults = true; + + LLCtrlListInterface *list = self->childGetListInterface("results"); + if (!list) return; + + if (!list->getCanSelect()) + { + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + self->mResultsContents = LLSD(); + } + + num_new_rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies); + self->mResultsReceived += num_new_rows; + + num_new_rows = self->showNextButton(num_new_rows); + for (i = 0; i < num_new_rows; i++) + { + LLUUID classified_id; + std::string name; + U32 creation_date = 0; // unix timestamp + U32 expiration_date = 0; // future use + S32 price_for_listing = 0; + msg->getUUID("QueryReplies", "ClassifiedID", classified_id, i); + msg->getString("QueryReplies", "Name", name, i); + msg->getU32("QueryReplies","CreationDate",creation_date,i); + msg->getU32("QueryReplies","ExpirationDate",expiration_date,i); + msg->getS32("QueryReplies","PriceForListing",price_for_listing,i); + + if ( classified_id.notNull() ) + { + self->addClassified(list, classified_id, name, creation_date, price_for_listing); + + LLSD content; + content["type"] = CLASSIFIED_CODE; + content["name"] = name; + self->mResultsContents[classified_id.asString()] = content; + } + } + // The server does the initial sort, by price paid per listing and date. JC + self->updateResultCount(); + + // Poke the result received timer + self->mLastResultTimer.reset(); + self->mDidAutoSelect = false; +} + +void LLPanelDirBrowser::processDirLandReply(LLMessageSystem *msg, void**) +{ + LLUUID agent_id; + LLUUID query_id; + LLUUID parcel_id; + std::string name; + std::string land_sku; + std::string land_type; + bool auction = false; + bool for_sale = false; + S32 sale_price; + S32 actual_area; + + msg->getUUID("AgentData", "AgentID", agent_id); + msg->getUUID("QueryData", "QueryID", query_id ); + + LLPanelDirBrowser* browser = get_if_there(gDirBrowserInstances, query_id, (LLPanelDirBrowser*)NULL); + if (!browser) + { + // data from an old query + return; + } + + // Only handled by LLPanelDirLand + LLPanelDirLand* self = (LLPanelDirLand*)browser; + + self->mHaveSearchResults = true; + + LLCtrlListInterface *list = self->childGetListInterface("results"); + if (!list) return; + + if (!list->getCanSelect()) + { + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + self->mResultsContents = LLSD(); + } + + bool use_price = gSavedSettings.getBOOL("FindLandPrice"); + S32 limit_price = self->childGetValue("priceedit").asInteger(); + + bool use_area = gSavedSettings.getBOOL("FindLandArea"); + S32 limit_area = self->childGetValue("areaedit").asInteger(); + + S32 i; + S32 count = msg->getNumberOfBlocks("QueryReplies"); + self->mResultsReceived += count; + + S32 non_auction_count = 0; + for (i = 0; i < count; i++) + { + msg->getUUID("QueryReplies", "ParcelID", parcel_id, i); + msg->getString("QueryReplies", "Name", name, i); + msg->getBOOL("QueryReplies", "Auction", auction, i); + msg->getBOOL("QueryReplies", "ForSale", for_sale, i); + msg->getS32("QueryReplies", "SalePrice", sale_price, i); + msg->getS32("QueryReplies", "ActualArea", actual_area, i); + + if ( msg->getSizeFast(_PREHASH_QueryReplies, i, _PREHASH_ProductSKU) > 0 ) + { + msg->getStringFast(_PREHASH_QueryReplies, _PREHASH_ProductSKU, land_sku, i); + land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku); + } + else + { + land_sku.clear(); + land_type = LLTrans::getString("land_type_unknown"); + } + + if (parcel_id.isNull()) continue; + + if (use_price && (sale_price > limit_price)) continue; + + if (use_area && (actual_area < limit_area)) continue; + + LLSD content; + S32 type; + + LLSD row = self->createLandSale(parcel_id, auction, for_sale, name, &type); + + content["type"] = type; + content["name"] = name; + content["landtype"] = land_type; + + std::string buffer = "Auction"; + if (!auction) + { + buffer = llformat("%d", sale_price); + non_auction_count++; + } + row["columns"][2]["column"] = "price"; + row["columns"][2]["value"] = buffer; + row["columns"][2]["font"] = "SansSerifSmall"; + + buffer = llformat("%d", actual_area); + row["columns"][3]["column"] = "area"; + row["columns"][3]["value"] = buffer; + row["columns"][3]["font"] = "SansSerifSmall"; + + if (!auction) + { + F32 price_per_meter; + if (actual_area > 0) + { + price_per_meter = (F32)sale_price / (F32)actual_area; + } + else + { + price_per_meter = 0.f; + } + // Prices are usually L$1 - L$10 / meter + buffer = llformat("%.1f", price_per_meter); + row["columns"][4]["column"] = "per_meter"; + row["columns"][4]["value"] = buffer; + row["columns"][4]["font"] = "SansSerifSmall"; + } + else + { + // Auctions start at L$1 per meter + row["columns"][4]["column"] = "per_meter"; + row["columns"][4]["value"] = "1.0"; + row["columns"][4]["font"] = "SansSerifSmall"; + } + + row["columns"][5]["column"] = "landtype"; + row["columns"][5]["value"] = land_type; + row["columns"][5]["font"] = "SansSerifSmall"; + + list->addElement(row); + self->mResultsContents[parcel_id.asString()] = content; + } + + // All auction results are shown on the first page + // But they don't count towards the 100 / page limit + // So figure out the next button here, when we know how many aren't auctions + count = self->showNextButton(non_auction_count); + + self->updateResultCount(); + + // Poke the result received timer + self->mLastResultTimer.reset(); + self->mDidAutoSelect = false; +} + +void LLPanelDirBrowser::addClassified(LLCtrlListInterface *list, const LLUUID& pick_id, const std::string& name, const U32 creation_date, const S32 price_for_listing) +{ + std::string type = llformat("%d", CLASSIFIED_CODE); + + LLSD row; + row["id"] = pick_id; + + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_top_pick.tga"; + + row["columns"][1]["column"] = "name"; + row["columns"][1]["value"] = name; + row["columns"][1]["font"] = "SANSSERIF"; + + row["columns"][2]["column"] = "price"; + row["columns"][2]["value"] = price_for_listing; + row["columns"][2]["font"] = "SansSerifSmall"; + + list->addElement(row); +} + +LLSD LLPanelDirBrowser::createLandSale(const LLUUID& parcel_id, bool is_auction, bool is_for_sale, const std::string& name, S32 *type) +{ + LLSD row; + row["id"] = parcel_id; + LLUUID image_id; + + // Icon and type + if(is_auction) + { + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_auction.tga"; + + *type = AUCTION_CODE; + } + else if (is_for_sale) + { + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_for_sale.tga"; + + *type = FOR_SALE_CODE; + } + else + { + row["columns"][0]["column"] = "icon"; + row["columns"][0]["type"] = "icon"; + row["columns"][0]["value"] = "icon_place.tga"; + + *type = PLACE_CODE; + } + + row["columns"][1]["column"] = "name"; + row["columns"][1]["value"] = name; + row["columns"][1]["font"] = "SANSSERIF"; + + return row; +} + +void LLPanelDirBrowser::setupNewSearch() +{ + LLScrollListCtrl* list = getChild("results"); + + gDirBrowserInstances.erase(mSearchID); + // Make a new query ID + mSearchID.generate(); + + gDirBrowserInstances.emplace(mSearchID, this); + + // ready the list for results + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + list->setCommentText(LLTrans::getString("Searching")); + list->setEnabled(false); + + mResultsReceived = 0; + mHaveSearchResults = false; + + // Set all panels to be invisible + mFloaterDirectory->hideAllDetailPanels(); + + updateResultCount(); +} + + +// static +// called from calssifieds, events, groups, land, people, and places +void LLPanelDirBrowser::onClickSearchCore(void* userdata) +{ + LLPanelDirBrowser* self = (LLPanelDirBrowser*)userdata; + if (!self) return; + + self->resetSearchStart(); + self->performQuery(); +} + + +// static +void LLPanelDirBrowser::sendDirFindQuery( + LLMessageSystem* msg, + const LLUUID& query_id, + const std::string& text, + U32 flags, + S32 query_start) +{ + msg->newMessage("DirFindQuery"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("QueryData"); + msg->addUUID("QueryID", query_id); + msg->addString("QueryText", text); + msg->addU32("QueryFlags", flags); + msg->addS32("QueryStart", query_start); + gAgent.sendReliableMessage(); +} + + +void LLPanelDirBrowser::onKeystrokeName(LLLineEditor* line, void* data) +{ + LLPanelDirBrowser *self = (LLPanelDirBrowser*)data; + if (line->getLength() >= (S32)self->mMinSearchChars) + { + self->setDefaultBtn( "Search" ); + self->childEnable("Search"); + } + else + { + self->setDefaultBtn(); + self->childDisable("Search"); + } +} + +// setup results when shown +void LLPanelDirBrowser::onVisibilityChange(bool new_visibility) +{ + if (new_visibility) + { + onCommitList(NULL, this); + } + LLPanel::onVisibilityChange(new_visibility); +} + +S32 LLPanelDirBrowser::showNextButton(S32 rows) +{ + // HACK: This hack doesn't work for llpaneldirfind (ALL) + // because other data is being returned as well. + if ( getName() != "find_all_old_panel") + { + // HACK: The (mResultsPerPage)+1th entry indicates there are 'more' + bool show_next = (mResultsReceived > mResultsPerPage); + mNextPageBtn->setVisible(show_next); + if (show_next) + { + rows -= (mResultsReceived - mResultsPerPage); + } + } + else + { + // Hide page buttons + mNextPageBtn->setVisible(false); + mPrevPageBtn->setVisible(false); + } + return rows; +} diff --git a/indra/newview/llpaneldirbrowser.h b/indra/newview/llpaneldirbrowser.h new file mode 100644 index 00000000000..f422affc4bd --- /dev/null +++ b/indra/newview/llpaneldirbrowser.h @@ -0,0 +1,167 @@ +/** + * @file llpaneldirbrowser.h + * @brief Base class for panels in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELDIRBROWSER_H +#define LL_LLPANELDIRBROWSER_H + +#include "llpanel.h" + +#include "llframetimer.h" + +class LLMessageSystem; +class LLFloaterDirectory; +class LLLineEditor; + +class LLPanelDirBrowser: public LLPanel +{ +public: + LLPanelDirBrowser(); + virtual ~LLPanelDirBrowser(); + + bool postBuild() override; + void setFloaterDirectory(LLFloaterDirectory* floater) { mFloaterDirectory = floater; } + + // Use to get periodic updates. + void draw() override; + + void onVisibilityChange(bool curVisibilityIn) override; + + // Redo your search for the prev/next page of results + virtual void prevPage(); + virtual void nextPage(); + void resetSearchStart(); + // Do the current query (used by prevPage/nextPage) + virtual void performQuery() {}; + + const LLUUID& getSearchID() const { return mSearchID; } + + // Select the line in the scroll list control with this ID, + // either now or when data arrives from the server. + void selectByUUID(const LLUUID& id); + + void selectEventByID(S32 event_id); + + void getSelectedInfo(LLUUID* id, S32 *type); + + void showDetailPanel(S32 type, LLSD item_id); + // type is EVENT_CODE, PLACE_CODE, etc. from below. + // item_id is integer for events, UUID for all others. + + // from llpaneldirbase + void setupNewSearch(); + + // default handler for clicking the search button resets the + // next/prev state and performs the query. + // Expects a pointer to an LLPanelDirBrowser object. + static void onClickSearchCore(void* userdata); + + // query_start indicates the first result row to + // return, usually 0 or 100 or 200 because the searches + // return a max of 100 rows + static void sendDirFindQuery( + LLMessageSystem* msg, + const LLUUID& query_id, + const std::string& text, + U32 flags, + S32 query_start); + + void showEvent(const U32 event_id); + + static void onCommitList(LLUICtrl* ctrl, void* data); + + static void processDirPeopleReply(LLMessageSystem* msg, void**); + static void processDirPlacesReply(LLMessageSystem* msg, void**); + static void processDirEventsReply(LLMessageSystem* msg, void**); + static void processDirGroupsReply(LLMessageSystem* msg, void**); + static void processDirClassifiedReply(LLMessageSystem* msg, void**); + static void processDirLandReply(LLMessageSystem *msg, void**); + + std::string filterShortWords( const std::string source_string, int shortest_word_length, bool& was_filtered ); + +protected: + void updateResultCount(); + + void addClassified(LLCtrlListInterface *list, const LLUUID& classified_id, const std::string& name, const U32 creation_date, const S32 price_for_listing); + LLSD createLandSale(const LLUUID& parcel_id, bool is_auction, bool is_for_sale, const std::string& name, S32 *type); + + static void onKeystrokeName(LLLineEditor* line, void* data); + + // If this is a search for a panel like "people_panel" (and not the "all" panel) + // optionally show the "Next" button. Return the actual number of + // rows to display. + S32 showNextButton(S32 rows); + +protected: + LLUUID mSearchID; // Unique ID for a pending search + LLUUID mWantSelectID; // scroll item to select on arrival + std::string mCurrentSortColumn; + bool mCurrentSortAscending; + // Some searches return a max of 100 items per page, so we can + // start the search from the 100th item rather than the 0th, etc. + S32 mSearchStart; + // Places is 100 per page, events is 200 per page + S32 mResultsPerPage; + S32 mResultsReceived; + + U32 mMinSearchChars; + + LLSD mResultsContents; + + bool mHaveSearchResults; + bool mDidAutoSelect; + LLFrameTimer mLastResultTimer; + + LLFloaterDirectory* mFloaterDirectory; + LLButton* mPrevPageBtn; + LLButton* mNextPageBtn; +}; + +constexpr S32 RESULTS_PER_PAGE_DEFAULT = 100; +constexpr S32 RESULTS_PER_PAGE_EVENTS = 200; + +// Codes used for sorting by type. +const S32 INVALID_CODE = -1; +const S32 EVENT_CODE = 0; +const S32 PLACE_CODE = 1; +// We no longer show online vs. offline in search result icons. +//const S32 ONLINE_CODE = 2; +//const S32 OFFLINE_CODE = 3; +const S32 AVATAR_CODE = 3; +const S32 GROUP_CODE = 4; +const S32 CLASSIFIED_CODE = 5; +const S32 FOR_SALE_CODE = 6; // for sale place +const S32 AUCTION_CODE = 7; // for auction place +const S32 POPULAR_CODE = 8; // popular by dwell + +// mask values for search flags +const S32 SEARCH_NONE = 0; // should try not to send this to the search engine +const S32 SEARCH_PG = 1; +const S32 SEARCH_MATURE = 2; +const S32 SEARCH_ADULT = 4; + +extern std::map gDirBrowserInstances; + +#endif // LL_LLPANELDIRBROWSER_H diff --git a/indra/newview/llpaneldirclassified.cpp b/indra/newview/llpaneldirclassified.cpp new file mode 100644 index 00000000000..ca625b956b4 --- /dev/null +++ b/indra/newview/llpaneldirclassified.cpp @@ -0,0 +1,109 @@ +/** + * @file llpaneldirclassified.cpp + * @brief Classified panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneldirclassified.h" + +#include "llclassifiedflags.h" + +#include "llfontgl.h" +#include "message.h" +#include "llqueryflags.h" + +#include "llagent.h" +#include "llbutton.h" +#include "llcontrol.h" +#include "llcombobox.h" +#include "llclassifiedinfo.h" +#include "lluiconstants.h" +#include "llpaneldirbrowser.h" +#include "lltextbox.h" + +#include "llcheckboxctrl.h" +#include "llfloaterdirectory.h" +#include "lllineeditor.h" +#include "llsearcheditor.h" +#include "llviewermenu.h" +#include "llnotificationsutil.h" + +static LLPanelInjector t_panel_dir_classified("panel_dir_classified"); + +LLPanelDirClassified::LLPanelDirClassified() +: LLPanelDirBrowser() +{ +} + +bool LLPanelDirClassified::postBuild() +{ + LLPanelDirBrowser::postBuild(); + + childSetAction("Search", onClickSearchCore, this); + setDefaultBtn("Search"); + return true; +} + +LLPanelDirClassified::~LLPanelDirClassified() +{ +} + +void LLPanelDirClassified::performQuery() +{ + static LLUICachedControl inc_pg("ShowPGClassifieds", true); + static LLUICachedControl inc_mature("ShowMatureClassifieds", false); + static LLUICachedControl inc_adult("ShowAdultClassifieds", false); + + if (!(inc_pg || inc_mature || inc_adult)) + { + LLNotificationsUtil::add("NoContentToSearch"); + return; + } + + // This sets mSearchID and clears the list of results + setupNewSearch(); + + // send the message + LLMessageSystem *msg = gMessageSystem; + msg->newMessageFast(_PREHASH_DirClassifiedQuery); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + + bool filter_auto_renew = false; + U32 query_flags = pack_classified_flags_request(filter_auto_renew, inc_pg, + inc_mature && gAgent.canAccessMature(), + inc_adult && gAgent.canAccessAdult()); + U32 category = childGetValue("Category").asInteger(); + + msg->nextBlockFast(_PREHASH_QueryData); + msg->addUUIDFast(_PREHASH_QueryID, mSearchID ); + msg->addStringFast(_PREHASH_QueryText, childGetValue("name").asString()); + msg->addU32Fast(_PREHASH_QueryFlags, query_flags); + msg->addU32Fast(_PREHASH_Category, category); + msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); + + gAgent.sendReliableMessage(); +} diff --git a/indra/newview/llpaneldirclassified.h b/indra/newview/llpaneldirclassified.h new file mode 100644 index 00000000000..6682f739297 --- /dev/null +++ b/indra/newview/llpaneldirclassified.h @@ -0,0 +1,55 @@ +/** + * @file llpaneldirclassified.h + * @brief Classified panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELDIRCLASSIFIED_H +#define LL_LLPANELDIRCLASSIFIED_H + +#include "llpaneldirbrowser.h" + +// UI class forward declarations +class LLButton; +class LLCheckBoxCtrl; +class LLComboBox; +class LLLineEditor; +class LLScrollListCtrl; + +class LLPanelDirClassified : public LLPanelDirBrowser +{ +public: + LLPanelDirClassified(); + /*virtual*/ ~LLPanelDirClassified(); + + bool postBuild(); + + // Request the classifieds from the database + void performQuery(); + +protected: + // onClickNext and onClickPrev are special case searches + static void onClickSearch(void *userdata); +}; + +#endif diff --git a/indra/newview/llpaneldirevents.cpp b/indra/newview/llpaneldirevents.cpp new file mode 100644 index 00000000000..227ed877cdd --- /dev/null +++ b/indra/newview/llpaneldirevents.cpp @@ -0,0 +1,248 @@ +/** + * @file llpaneldirevents.cpp + * @brief Events panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneldirevents.h" + +#include + +// linden library includes +#include "message.h" +#include "llqueryflags.h" + +// viewer project includes +#include "llagent.h" +#include "llviewercontrol.h" +#include "llnotificationsutil.h" +#include "llpaneldirbrowser.h" +#include "llresmgr.h" +#include "lluiconstants.h" +#include "llappviewer.h" + +static LLPanelInjector t_panel_dir_events("panel_dir_events"); + +constexpr S32 DAY_TO_SEC = 24 * 60 * 60; + +LLPanelDirEvents::LLPanelDirEvents() + : LLPanelDirBrowser(), + mDay(0) +{ + // more results per page for this + mResultsPerPage = RESULTS_PER_PAGE_EVENTS; +} + +bool LLPanelDirEvents::postBuild() +{ + LLPanelDirBrowser::postBuild(); + + childSetCommitCallback("date_mode", onDateModeCallback, this); + + childSetAction("back_btn", onBackBtn, this); + childSetAction("forward_btn", onForwardBtn, this); + + childSetCommitCallback("mature", onCommitMature, this); + + childSetAction("Search", LLPanelDirBrowser::onClickSearchCore, this); + setDefaultBtn("Search"); + + onDateModeCallback(NULL, this); + + mCurrentSortColumn = "time"; + + setDay(0); // for today + + return true; +} + +LLPanelDirEvents::~LLPanelDirEvents() +{ +} + +void LLPanelDirEvents::setDay(S32 day) +{ + mDay = day; + + // Get time UTC + time_t utc_time = time_corrected(); + + // Correct for offset + utc_time += day * DAY_TO_SEC; + + // There's only one internal tm buffer. + struct tm* internal_time; + + // Convert to Pacific, based on server's opinion of whether + // it's daylight savings time there. + internal_time = utc_to_pacific_time(utc_time, is_daylight_savings()); + + std::string buffer = llformat("%d/%d", + 1 + internal_time->tm_mon, // Jan = 0 + internal_time->tm_mday); // 2001 = 101 + childSetValue("date_text", buffer); +} + +// virtual +void LLPanelDirEvents::performQuery() +{ + // event_id 0 will perform no delete action. + performQueryOrDelete(0); +} + +void LLPanelDirEvents::performQueryOrDelete(U32 event_id) +{ + S32 relative_day = mDay; + // Update the date field to show the date IN THE SERVER'S + // TIME ZONE, as that is what will be displayed in each event + + // Get time UTC + time_t utc_time = time_corrected(); + + // Correct for offset + utc_time += relative_day * DAY_TO_SEC; + + // There's only one internal tm buffer. + struct tm* internal_time; + + // Convert to Pacific, based on server's opinion of whether + // it's daylight savings time there. + internal_time = utc_to_pacific_time(utc_time, is_daylight_savings()); + + std::string buffer = llformat("%d/%d", + 1 + internal_time->tm_mon, // Jan = 0 + internal_time->tm_mday); // 2001 = 101 + childSetValue("date_text", buffer); + + // Record the relative day so back and forward buttons + // offset from this day. + mDay = relative_day; + + static LLUICachedControl incpg("ShowPGEvents", true); + static LLUICachedControl incmature("ShowMatureEvents", false); + static LLUICachedControl incadult("ShowAdultEvents", false); + + U32 scope = DFQ_DATE_EVENTS; + if (incpg) scope |= DFQ_INC_PG; + if (incmature && gAgent.canAccessMature()) scope |= DFQ_INC_MATURE; + if (incadult && gAgent.canAccessAdult()) scope |= DFQ_INC_ADULT; + + if ( !( scope & (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT ))) + { + LLNotificationsUtil::add("NoContentToSearch"); + return; + } + + setupNewSearch(); + + std::ostringstream params; + + // Date mode for the search + if ("current" == childGetValue("date_mode").asString()) + { + params << "u|"; + } + else + { + params << mDay << "|"; + } + + // Categories are stored in the database in table indra.event_category + // XML must match. + U32 cat_id = childGetValue("category_combo").asInteger(); + + params << cat_id << "|"; + params << childGetValue("event_search_text").asString(); + + // send the message + if (0 == event_id) + { + sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart); + } + else + { + // This delete will also perform a query. + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_EventGodDelete); + + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlockFast(_PREHASH_EventData); + msg->addU32Fast(_PREHASH_EventID, event_id); + + msg->nextBlockFast(_PREHASH_QueryData); + msg->addUUIDFast(_PREHASH_QueryID, mSearchID); + msg->addStringFast(_PREHASH_QueryText, params.str()); + msg->addU32Fast(_PREHASH_QueryFlags, scope); + msg->addS32Fast(_PREHASH_QueryStart, mSearchStart); + gAgent.sendReliableMessage(); + } +} + +// static +void LLPanelDirEvents::onDateModeCallback(LLUICtrl* ctrl, void *data) +{ + LLPanelDirEvents* self = (LLPanelDirEvents*)data; + if (self->childGetValue("date_mode").asString() == "date") + { + self->childEnable("forward_btn"); + self->childEnable("back_btn"); + } + else + { + self->childDisable("forward_btn"); + self->childDisable("back_btn"); + } +} + +// static +void LLPanelDirEvents::onBackBtn(void* data) +{ + LLPanelDirEvents* self = (LLPanelDirEvents*)data; + self->resetSearchStart(); + self->setDay(self->mDay - 1); + self->performQuery(); +} + + +// static +void LLPanelDirEvents::onForwardBtn(void* data) +{ + LLPanelDirEvents* self = (LLPanelDirEvents*)data; + self->resetSearchStart(); + self->setDay(self->mDay + 1); + self->performQuery(); +} + + +// static +void LLPanelDirEvents::onCommitMature(LLUICtrl* ctrl, void* data) +{ + // just perform another search + onClickSearchCore(data); +} diff --git a/indra/newview/llpaneldirevents.h b/indra/newview/llpaneldirevents.h new file mode 100644 index 00000000000..596abc5f0e4 --- /dev/null +++ b/indra/newview/llpaneldirevents.h @@ -0,0 +1,61 @@ +/** + * @file llpaneldirevents.h + * @brief Events panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELDIREVENTS_H +#define LL_LLPANELDIREVENTS_H + +#include "llpaneldirbrowser.h" + +class LLUICtrl; +class LLPanelDirBrowser; + +class LLPanelDirEvents : public LLPanelDirBrowser +{ +public: + LLPanelDirEvents(); + virtual ~LLPanelDirEvents(); + + bool postBuild() override; + + /*virtual*/ void performQuery() override; + + void performQueryOrDelete(U32 event_id); + + // pass 0 for today, 1 for tomorrow + void setDay(S32 day); + +protected: + static void onDateModeCallback(LLUICtrl* ctrl, void *data); + static void onBackBtn(void* data); + static void onForwardBtn(void* data); + static void onCommitMature(LLUICtrl* ctrl, void* data); + +protected: + S32 mDay; // 0 = today, 1 = tomorrow +}; + + +#endif diff --git a/indra/newview/llpaneldirgroups.cpp b/indra/newview/llpaneldirgroups.cpp new file mode 100644 index 00000000000..992d92091cf --- /dev/null +++ b/indra/newview/llpaneldirgroups.cpp @@ -0,0 +1,90 @@ +/** + * @file llpaneldirgroups.cpp + * @brief Groups panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneldirgroups.h" + +#include "llagent.h" +#include "llqueryflags.h" +#include "llviewercontrol.h" +#include "llsearcheditor.h" + +static LLPanelInjector t_panel_dir_groups("panel_dir_groups"); + +LLPanelDirGroups::LLPanelDirGroups() + : LLPanelDirBrowser() +{ + mMinSearchChars = 3; +} + + +bool LLPanelDirGroups::postBuild() +{ + LLPanelDirBrowser::postBuild(); + + //getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirBrowser::onKeystrokeName, _1, _2), NULL); + + childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); + setDefaultBtn( "Search" ); + + return true; +} + +LLPanelDirGroups::~LLPanelDirGroups() +{ +} + +// virtual +void LLPanelDirGroups::performQuery() +{ + if (childGetValue("name").asString().length() < mMinSearchChars) + { + return; + } + + setupNewSearch(); + + // groups + U32 scope = DFQ_GROUPS; + + // Check group mature filter. + if ( !gSavedSettings.getBOOL("ShowMatureGroups") || gAgent.isTeen() ) + { + scope |= DFQ_FILTER_MATURE; + } + + mCurrentSortColumn = "score"; + mCurrentSortAscending = false; + + // send the message + sendDirFindQuery( + gMessageSystem, + mSearchID, + childGetValue("name").asString(), + scope, + mSearchStart); +} diff --git a/indra/newview/llpaneldirgroups.h b/indra/newview/llpaneldirgroups.h new file mode 100644 index 00000000000..1e10353e2ad --- /dev/null +++ b/indra/newview/llpaneldirgroups.h @@ -0,0 +1,45 @@ +/** + * @file llpaneldirgroups.h + * @brief Groups panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 LLPANELDIRGROUPS_H +#define LLPANELDIRGROUPS_H + +#include "llpaneldirbrowser.h" + +class LLPanelDirGroups : public LLPanelDirBrowser +{ +public: + LLPanelDirGroups(); + virtual ~LLPanelDirGroups(); + + /*virtual*/ bool postBuild(); + + /*virtual*/ void performQuery(); + + static void onClickSearch(void *userdata); +}; + +#endif diff --git a/indra/newview/llpaneldirland.cpp b/indra/newview/llpaneldirland.cpp new file mode 100644 index 00000000000..53c58d8fa91 --- /dev/null +++ b/indra/newview/llpaneldirland.cpp @@ -0,0 +1,247 @@ +/** + * @file llpaneldirland.cpp + * @brief Land panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneldirland.h" + +#include "llagent.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" +#include "llqueryflags.h" +#include "llscrolllistctrl.h" +#include "llstatusbar.h" +#include "lltextbox.h" +#include "llviewercontrol.h" +#include "llviewermessage.h" + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +static const char FIND_ALL[] = "All Types"; +static const char FIND_AUCTION[] = "Auction"; +static const char FIND_MAINLANDSALES[] = "Mainland Sales"; +static const char FIND_ESTATESALES[] = "Estate Sales"; + +static LLPanelInjector t_panel_dir_land("panel_dir_land"); + +LLPanelDirLand::LLPanelDirLand() + : LLPanelDirBrowser() +{ +} + +bool LLPanelDirLand::postBuild() +{ + LLPanelDirBrowser::postBuild(); + + childSetValue("type", gSavedSettings.getString("FindLandType")); + + bool adult_enabled = gAgent.canAccessAdult(); + bool mature_enabled = gAgent.canAccessMature(); + childSetVisible("incpg", true); + if (!mature_enabled) + { + childSetValue("incmature", false); + childDisable("incmature"); + } + if (!adult_enabled) + { + childSetValue("incadult", false); + childDisable("incadult"); + } + + childSetCommitCallback("pricecheck", onCommitPrice, this); + childSetCommitCallback("areacheck", onCommitArea, this); + + if (gStatusBar) + { + childSetValue("priceedit", gStatusBar->getBalance()); + } + childSetEnabled("priceedit", gSavedSettings.getBOOL("FindLandPrice")); + LLLineEditor* priceedit = getChild("priceedit"); + priceedit->setPrevalidateInput(LLTextValidate::validateNonNegativeS32); + + childSetEnabled("areaedit", gSavedSettings.getBOOL("FindLandArea")); + LLLineEditor* areaedit = getChild("areaedit"); + areaedit->setPrevalidateInput(LLTextValidate::validateNonNegativeS32); + + childSetAction("Search", onClickSearchCore, this); + setDefaultBtn("Search"); + + mCurrentSortColumn = "per_meter"; + + LLScrollListCtrl* results = getChild("results"); + if (results) + { + results->setSortChangedCallback(boost::bind(&LLPanelDirLand::onClickSort, this)); + results->sortByColumn(mCurrentSortColumn,mCurrentSortAscending); + } + + return true; +} + +LLPanelDirLand::~LLPanelDirLand() +{ + // Children all cleaned up by default view destructor. +} + +void LLPanelDirLand::onClickSort() +{ + performQuery(); +} + +// static +void LLPanelDirLand::onCommitPrice(LLUICtrl* ctrl, void* data) +{ + LLPanelDirLand* self = (LLPanelDirLand*)data; + LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; + + if (!self || !check) return; + self->childSetEnabled("priceedit", check->get()); +} + +// static +void LLPanelDirLand::onCommitArea(LLUICtrl* ctrl, void* data) +{ + LLPanelDirLand* self = (LLPanelDirLand*)data; + LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; + + if (!self || !check) return; + self->childSetEnabled("areaedit", check->get()); +} + +void LLPanelDirLand::performQuery() +{ + static LLUICachedControl inc_pg("ShowPGLand", true); + static LLUICachedControl inc_mature("ShowMatureLand", false); + static LLUICachedControl inc_adult("ShowAdultLand", false); + if (!(inc_pg || inc_mature || inc_adult)) + { + LLNotificationsUtil::add("NoContentToSearch"); + return; + } + + LLMessageSystem* msg = gMessageSystem; + + setupNewSearch(); + + // We could change the UI to allow arbitrary combinations of these options + U32 search_type = ST_ALL; + const std::string& type = childGetValue("type").asString(); + if(!type.empty()) + { + if (FIND_AUCTION == type) search_type = ST_AUCTION; + else if(FIND_MAINLANDSALES == type) search_type = ST_MAINLAND; + else if(FIND_ESTATESALES == type) search_type = ST_ESTATE; + } + + U32 query_flags = 0x0; + if (gAgent.wantsPGOnly()) query_flags |= DFQ_PG_SIMS_ONLY; + + bool adult_enabled = gAgent.canAccessAdult(); + bool mature_enabled = gAgent.canAccessMature(); + + if (inc_pg) + { + query_flags |= DFQ_INC_PG; + } + + if (inc_mature && mature_enabled) + { + query_flags |= DFQ_INC_MATURE; + } + + if (inc_adult && adult_enabled) + { + query_flags |= DFQ_INC_ADULT; + } + + // Add old flags in case we are talking to an old dataserver + if (inc_pg && !inc_mature) + { + query_flags |= DFQ_PG_SIMS_ONLY; + } + + if (!inc_pg && inc_mature) + { + query_flags |= DFQ_MATURE_SIMS_ONLY; + } + + LLScrollListCtrl* list = getChild("results"); + if (list) + { + std::string sort_name = list->getSortColumnName(); + BOOL sort_asc = list->getSortAscending(); + + if (sort_name == "name") + { + query_flags |= DFQ_NAME_SORT; + } + else if (sort_name == "price") + { + query_flags |= DFQ_PRICE_SORT; + } + else if (sort_name == "per_meter") + { + query_flags |= DFQ_PER_METER_SORT; + } + else if (sort_name == "area") + { + query_flags |= DFQ_AREA_SORT; + } + + if (sort_asc) + { + query_flags |= DFQ_SORT_ASC; + } + } + + if (childGetValue("pricecheck").asBoolean()) + { + query_flags |= DFQ_LIMIT_BY_PRICE; + } + + if (childGetValue("areacheck").asBoolean()) + { + query_flags |= DFQ_LIMIT_BY_AREA; + } + + msg->newMessage("DirLandQuery"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("QueryData"); + msg->addUUID("QueryID", getSearchID()); + msg->addU32("QueryFlags", query_flags); + msg->addU32("SearchType", search_type); + msg->addS32("Price", childGetValue("priceedit").asInteger()); + msg->addS32("Area", childGetValue("areaedit").asInteger()); + msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); + gAgent.sendReliableMessage(); +} diff --git a/indra/newview/llpaneldirland.h b/indra/newview/llpaneldirland.h new file mode 100644 index 00000000000..197c4cdc3df --- /dev/null +++ b/indra/newview/llpaneldirland.h @@ -0,0 +1,53 @@ +/** + * @file llpaneldirland.h + * @brief Land panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELDIRLAND_H +#define LL_LLPANELDIRLAND_H + +#include "llpaneldirbrowser.h" + +class LLUICtrl; +class LLPanelDirBrowser; + +class LLPanelDirLand : public LLPanelDirBrowser +{ +public: + LLPanelDirLand(); + /*virtual*/ ~LLPanelDirLand(); + + bool postBuild(); + + void performQuery(); + +protected: + void onClickSort(); + static void onCommitPrice(LLUICtrl* ctrl, void* data); + static void onCommitArea(LLUICtrl* ctrl, void* data); + +}; + + +#endif diff --git a/indra/newview/llpaneldirpeople.cpp b/indra/newview/llpaneldirpeople.cpp new file mode 100644 index 00000000000..6a55e3bc7c5 --- /dev/null +++ b/indra/newview/llpaneldirpeople.cpp @@ -0,0 +1,105 @@ +/** + * @file llpaneldirpeople.cpp + * @brief People panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneldirpeople.h" +#include "llviewerwindow.h" +#include "llsearcheditor.h" + +// viewer project includes +#include "llqueryflags.h" +#include "llnotificationsutil.h" + +static LLPanelInjector t_panel_dir_people("panel_dir_people"); + +LLPanelDirPeople::LLPanelDirPeople() +: LLPanelDirBrowser() +{ + mMinSearchChars = 3; +} + +bool LLPanelDirPeople::postBuild() +{ + LLPanelDirBrowser::postBuild(); + + //getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirBrowser::onKeystrokeName, _1, _2), NULL); + + childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); + setDefaultBtn( "Search" ); + + return true; +} + +LLPanelDirPeople::~LLPanelDirPeople() +{ +} + +// virtual +void LLPanelDirPeople::performQuery() +{ + if (childGetValue("name").asString().length() < mMinSearchChars) + { + return; + } + + // filter short words out of the query string + // and indidate if we did have to filter it + // The shortest username is 2 characters long. + const S32 SHORTEST_WORD_LEN = 2; + bool query_was_filtered = false; + std::string query_string = LLPanelDirBrowser::filterShortWords( + childGetValue("name").asString(), + SHORTEST_WORD_LEN, + query_was_filtered ); + + // possible we threw away all the short words in the query so check length + if ( query_string.length() < mMinSearchChars ) + { + LLNotificationsUtil::add("SeachFilteredOnShortWordsEmpty"); + return; + }; + + // if we filtered something out, display a popup + if ( query_was_filtered ) + { + LLSD args; + args["FINALQUERY"] = query_string; + LLNotificationsUtil::add("SeachFilteredOnShortWords", args); + }; + + setupNewSearch(); + + U32 scope = DFQ_PEOPLE; + + // send the message + sendDirFindQuery( + gMessageSystem, + mSearchID, + query_string, + scope, + mSearchStart); +} diff --git a/indra/newview/llpaneldirpeople.h b/indra/newview/llpaneldirpeople.h new file mode 100644 index 00000000000..a8a7d17cb23 --- /dev/null +++ b/indra/newview/llpaneldirpeople.h @@ -0,0 +1,48 @@ +/** + * @file llpaneldirpeople.h + * @brief People panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELDIRPEOPLE_H +#define LL_LLPANELDIRPEOPLE_H + +#include "llpaneldirbrowser.h" +class LLLineEditor; +class LLFloaterDirectory; + +class LLPanelDirPeople : public LLPanelDirBrowser +{ +public: + LLPanelDirPeople(); + virtual ~LLPanelDirPeople(); + + /*virtual*/ bool postBuild(); + + /*virtual*/ void performQuery(); + + static void onClickSearch(void *userdata); + static void onKeystrokeName(LLLineEditor* line, void* data); +}; + +#endif diff --git a/indra/newview/llpaneldirplaces.cpp b/indra/newview/llpaneldirplaces.cpp new file mode 100644 index 00000000000..2d545660383 --- /dev/null +++ b/indra/newview/llpaneldirplaces.cpp @@ -0,0 +1,185 @@ +/** + * @file llpaneldirplaces.cpp + * @brief Places panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneldirplaces.h" + +#include "message.h" +#include "llparcel.h" +#include "llregionflags.h" +#include "llqueryflags.h" + +#include "llagent.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llfloaterdirectory.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" +#include "llpaneldirbrowser.h" +#include "llsearcheditor.h" +#include "lltextbox.h" +#include "llviewercontrol.h" + +static LLPanelInjector t_panel_dir_people("panel_dir_places"); + +LLPanelDirPlaces::LLPanelDirPlaces() + : LLPanelDirBrowser() +{ + mMinSearchChars = 3; +} + +bool LLPanelDirPlaces::postBuild() +{ + LLPanelDirBrowser::postBuild(); + + //getChild("name")->setKeystrokeCallback(boost::bind(&LLPanelDirBrowser::onKeystrokeName, _1, _2), NULL); + + childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); + setDefaultBtn("Search"); + + mCurrentSortColumn = "dwell"; + mCurrentSortAscending = false; + + return true; +} + +LLPanelDirPlaces::~LLPanelDirPlaces() +{ +} + +// virtual +void LLPanelDirPlaces::performQuery() +{ + std::string place_name = childGetValue("name").asString(); + if (place_name.length() < mMinSearchChars) + { + return; + } + + // "hi " is three chars but not a long-enough search + std::string query_string = place_name; + LLStringUtil::trim( query_string ); + bool query_was_filtered = (query_string != place_name); + + // possible we threw away all the short words in the query so check length + if ( query_string.length() < mMinSearchChars ) + { + LLNotificationsUtil::add("SeachFilteredOnShortWordsEmpty"); + return; + }; + + // if we filtered something out, display a popup + if ( query_was_filtered ) + { + LLSD args; + args["FINALQUERY"] = query_string; + LLNotificationsUtil::add("SeachFilteredOnShortWords", args); + }; + + std::string catstring = childGetValue("Category").asString(); + + // Because LLParcel::C_ANY is -1, must do special check + S32 category = 0; + if (catstring == "any") + { + category = LLParcel::C_ANY; + } + else + { + category = LLParcel::getCategoryFromString(catstring); + } + + U32 flags = 0x0; + bool adult_enabled = gAgent.canAccessAdult(); + bool mature_enabled = gAgent.canAccessMature(); + + static LLUICachedControl inc_pg("ShowPGSims", true); + static LLUICachedControl inc_mature("ShowMatureSims", false); + static LLUICachedControl inc_adult("ShowAdultSims", false); + + if (inc_pg) + { + flags |= DFQ_INC_PG; + } + + if (inc_mature && mature_enabled) + { + flags |= DFQ_INC_MATURE; + } + + if (inc_adult && adult_enabled) + { + flags |= DFQ_INC_ADULT; + } + + if (0x0 == flags) + { + LLNotificationsUtil::add("NoContentToSearch"); + return; + } + + queryCore(query_string, category, flags); +} + +void LLPanelDirPlaces::initialQuery() +{ + // All Linden locations in PG/Mature sims, any name. + U32 flags = DFQ_INC_PG | DFQ_INC_MATURE; + queryCore(LLStringUtil::null, LLParcel::C_LINDEN, flags); +} + +void LLPanelDirPlaces::queryCore(const std::string& name, S32 category, U32 flags) +{ + setupNewSearch(); + +// JC: Sorting by dwell severely impacts the performance of the query. +// Instead of sorting on the dataserver, we sort locally once the results +// are received. +// IW: Re-enabled dwell sort based on new 3-character minimum description +// Hopefully we'll move to next-gen Find before this becomes a big problem + + flags |= DFQ_DWELL_SORT; + + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage("DirPlacesQuery"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("QueryData"); + msg->addUUID("QueryID", getSearchID()); + msg->addString("QueryText", name); + msg->addU32("QueryFlags", flags); + msg->addS8("Category", (S8)category); + // No longer support queries by region name, too many regions + // for combobox, no easy way to do autocomplete. JC + msg->addString("SimName", ""); + msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); + gAgent.sendReliableMessage(); +} + diff --git a/indra/newview/llpaneldirplaces.h b/indra/newview/llpaneldirplaces.h new file mode 100644 index 00000000000..069414ebf54 --- /dev/null +++ b/indra/newview/llpaneldirplaces.h @@ -0,0 +1,51 @@ +/** + * @file llpaneldirplaces.h + * @brief Places panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELDIRPLACES_H +#define LL_LLPANELDIRPLACES_H + +#include "llpaneldirbrowser.h" + +class LLLineEditor; + +class LLPanelDirPlaces : public LLPanelDirBrowser +{ +public: + LLPanelDirPlaces(); + virtual ~LLPanelDirPlaces(); + + bool postBuild() override; + + void performQuery() override; + + // Initially fill in some data for the panel. + void initialQuery(); + +private: + void queryCore(const std::string& name, S32 category, U32 flags); +}; + +#endif diff --git a/indra/newview/llpaneldirweb.cpp b/indra/newview/llpaneldirweb.cpp new file mode 100644 index 00000000000..9e76bb81a65 --- /dev/null +++ b/indra/newview/llpaneldirweb.cpp @@ -0,0 +1,148 @@ +/** + * @file llpaneldirweb.cpp + * @brief Web panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneldirweb.h" + +#include "llagent.h" +#include "llbutton.h" +#include "llfloaterdirectory.h" +#include "lltextbox.h" +#include "llviewercontrol.h" +#include "llweb.h" + +static LLPanelInjector t_panel_dir_web("panel_dir_web"); + +LLPanelDirWeb::LLPanelDirWeb() +: LLPanel(), + mFloaterDirectory(nullptr), + mWebBrowser(nullptr) +{ +} + +bool LLPanelDirWeb::postBuild() +{ + childSetAction("home_btn", onClickHome, this); + + mBtnBack = getChild("back_btn"); + mBtnForward = getChild("forward_btn"); + mStatusBarText = getChild("statusbartext"); + + mBtnBack->setClickedCallback([this](LLUICtrl*, const LLSD&) { mWebBrowser->navigateBack(); }); + mBtnForward->setClickedCallback([this](LLUICtrl*, const LLSD&) { mWebBrowser->navigateForward(); }); + + mWebBrowser = findChild("web_search"); + navigateToDefaultPage(); + mWebBrowser->addObserver(this); + + return true; +} + +void LLPanelDirWeb::draw() +{ + // Asynchronous so we need to keep checking + mBtnBack->setEnabled(mWebBrowser->canNavigateBack()); + mBtnForward->setEnabled(mWebBrowser->canNavigateForward()); + + LLPanel::draw(); +} + +LLPanelDirWeb::~LLPanelDirWeb() +{ +} + +// When we show any browser-based view, we want to hide all +// the right-side XUI detail panels. +// virtual +void LLPanelDirWeb::onVisibilityChange(bool new_visibility) +{ + if (new_visibility && mFloaterDirectory) + { + mFloaterDirectory->hideAllDetailPanels(); + } + LLPanel::onVisibilityChange(new_visibility); +} + +void LLPanelDirWeb::navigateToDefaultPage() +{ + std::string url = gSavedSettings.getString("SearchURL"); + + LLSD subs; + subs["QUERY"] = ""; + subs["TYPE"] = "standard"; + // Default to PG + std::string maturity = "g"; + if (gAgent.prefersAdult()) + { + // PG,Mature,Adult + maturity = "gma"; + } + else if (gAgent.prefersMature()) + { + // PG,Mature + maturity = "gm"; + } + subs["MATURITY"] = maturity; + url = LLWeb::expandURLSubstitutions(url, subs); + mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML); +} + +// static +void LLPanelDirWeb::onClickHome( void* data ) +{ + LLPanelDirWeb* self = (LLPanelDirWeb*)data; + if (!self) + return; + self->navigateToDefaultPage(); +} + +void LLPanelDirWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) +{ + if (event == MEDIA_EVENT_LOCATION_CHANGED) + { + const std::string url = self->getLocation(); + if (url.length()) + mStatusBarText->setText(url); + } + else if (event == MEDIA_EVENT_NAVIGATE_COMPLETE) + { + // we populate the status bar with URLs as they change so clear it now we're done + const std::string end_str = ""; + mStatusBarText->setText(end_str); + } + else if (event == MEDIA_EVENT_STATUS_TEXT_CHANGED) + { + const std::string text = self->getStatusText(); + if (text.length()) + mStatusBarText->setText(text); + } + else if (event == MEDIA_EVENT_LINK_HOVERED) + { + const std::string link = self->getHoverLink(); + mStatusBarText->setText(link); + } +} diff --git a/indra/newview/llpaneldirweb.h b/indra/newview/llpaneldirweb.h new file mode 100644 index 00000000000..db7bdc4a6a7 --- /dev/null +++ b/indra/newview/llpaneldirweb.h @@ -0,0 +1,63 @@ +/** + * @file llpaneldirweb.h + * @brief Web panel in the legacy Search directory. + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELDIRWEB_H +#define LL_LLPANELDIRWEB_H + +#include "llpanel.h" +#include "llmediactrl.h" + +class LLTextBox; +class LLFloaterDirectory; +class LLWebBrowserCtrlObserver; + +class LLPanelDirWeb : public LLPanel, public LLViewerMediaObserver +{ +public: + LLPanelDirWeb(); + ~LLPanelDirWeb(); + + bool postBuild() override; + void onVisibilityChange(bool new_visibility) override; + void draw() override; + + void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override; + + void navigateToDefaultPage(); + + void setFloaterDirectory(LLFloaterDirectory* floater) { mFloaterDirectory = floater; } + +protected: + static void onClickHome( void* data ); + + LLButton* mBtnBack; + LLButton* mBtnForward; + LLTextBox* mStatusBarText; + LLFloaterDirectory* mFloaterDirectory; + LLMediaCtrl* mWebBrowser; +}; + +#endif diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 3d376251ff5..578206a7681 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -35,7 +35,6 @@ #include "llvirtualtrackball.h" #include "llsettingssky.h" #include "llenvironment.h" -#include "llatmosphere.h" #include "llviewercontrol.h" namespace @@ -926,13 +925,6 @@ void LLPanelSettingsSkyDensityTab::updateProfile() mSkySettings->setAbsorptionConfigs(absorption_config); mSkySettings->update(); setIsDirty(); - - if (gAtmosphere) - { - AtmosphericModelSettings atmospheric_settings; - LLEnvironment::getAtmosphericModelSettings(atmospheric_settings, mSkySettings); - gAtmosphere->configureAtmosphericModel(atmospheric_settings); - } } void LLPanelSettingsSkyDensityTab::onRayleighExponentialChanged() diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 282b6d4a0aa..8bcb6e9ec37 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -438,7 +438,7 @@ template const LLEditWearableDictionary::PickerControlEntry* get_picker_entry (const ETextureIndex index) { return NULL; } -typedef boost::function function_t; +typedef std::function function_t; typedef struct PickerControlEntryNamePredicate { diff --git a/indra/newview/llpaneleventinfo.cpp b/indra/newview/llpaneleventinfo.cpp new file mode 100644 index 00000000000..43b20b38510 --- /dev/null +++ b/indra/newview/llpaneleventinfo.cpp @@ -0,0 +1,195 @@ +/** + * @file llpaneleventinfo.cpp + * @brief Info panel for events in the legacy Search + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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 "llpaneleventinfo.h" + +#include "llagent.h" +#include "llbutton.h" +#include "lleventflags.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" +#include "lltextbox.h" +#include "llviewertexteditor.h" +#include "llworldmap.h" + +static LLPanelInjector t_panel_event_info("panel_event_info"); + +LLPanelEventInfo::LLPanelEventInfo() + : LLPanel() +{ +} + +LLPanelEventInfo::~LLPanelEventInfo() +{ + if (mEventInfoConnection.connected()) + { + mEventInfoConnection.disconnect(); + } +} + +bool LLPanelEventInfo::postBuild() +{ + mTBName = getChild("event_name"); + + mTBCategory = getChild("event_category"); + mTBDate = getChild("event_date"); + mTBDuration = getChild("event_duration"); + mTBDesc = getChild("event_desc"); + mTBDesc->setWordWrap(true); + + mTBRunBy = getChild("event_runby"); + mTBLocation = getChild("event_location"); + mTBCover = getChild("event_cover"); + + mTeleportBtn = getChild( "teleport_btn"); + mTeleportBtn->setClickedCallback(boost::bind(&LLPanelEventInfo::onClickTeleport, this)); + + mMapBtn = getChild( "map_btn"); + mMapBtn->setClickedCallback(boost::bind(&LLPanelEventInfo::onClickMap, this)); + + mNotifyBtn = getChild( "notify_btn"); + mNotifyBtn->setClickedCallback(boost::bind(&LLPanelEventInfo::onClickNotify, this)); + + mEventInfoConnection = gEventNotifier.setEventInfoCallback(boost::bind(&LLPanelEventInfo::processEventInfoReply, this, _1)); + + return true; +} + +void LLPanelEventInfo::setEventID(const U32 event_id) +{ + mEventID = event_id; + + if (event_id != 0) + { + sendEventInfoRequest(); + } +} + +void LLPanelEventInfo::sendEventInfoRequest() +{ + LLMessageSystem *msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_EventInfoRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); + msg->nextBlockFast(_PREHASH_EventData); + msg->addU32Fast(_PREHASH_EventID, mEventID); + gAgent.sendReliableMessage(); +} + +bool LLPanelEventInfo::processEventInfoReply(LLEventInfo event) +{ + if (event.mID != getEventID()) + return false; + + mTBName->setText(event.mName); + mTBName->setToolTip(event.mName); + mTBCategory->setText(event.mCategoryStr); + mTBDate->setText(event.mTimeStr); + mTBDesc->setText(event.mDesc); + mTBRunBy->setText(LLSLURL("agent", event.mRunByID, "inspect").getSLURLString()); + + mTBDuration->setText(llformat("%d:%.2d", event.mDuration / 60, event.mDuration % 60)); + + if (!event.mHasCover) + { + mTBCover->setText(getString("none")); + } + else + { + mTBCover->setText(llformat("%d", event.mCover)); + } + + mTBLocation->setText(LLSLURL(event.mSimName, event.mPosGlobal).getSLURLString()); + + if (event.mEventFlags & EVENT_FLAG_MATURE) + { + childSetVisible("event_mature_yes", true); + childSetVisible("event_mature_no", false); + } + else + { + childSetVisible("event_mature_yes", false); + childSetVisible("event_mature_no", true); + } + + if (event.mUnixTime < time_corrected()) + { + mNotifyBtn->setEnabled(false); + } + else + { + mNotifyBtn->setEnabled(true); + } + + if (gEventNotifier.hasNotification(event.mID)) + { + mNotifyBtn->setLabel(getString("dont_notify")); + } + else + { + mNotifyBtn->setLabel(getString("notify")); + } + mEventInfo = event; + return true; +} + +void LLPanelEventInfo::onClickTeleport() +{ + LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance(); + if (world_map) + { + world_map->trackLocation(mEventInfo.mPosGlobal); + gAgent.teleportViaLocation(mEventInfo.mPosGlobal); + } +} + +void LLPanelEventInfo::onClickMap() +{ + LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance(); + if (world_map) + { + world_map->trackLocation(mEventInfo.mPosGlobal); + LLFloaterReg::showInstance("world_map", "center"); + } +} + +void LLPanelEventInfo::onClickNotify() +{ + if (!gEventNotifier.hasNotification(mEventID)) + { + gEventNotifier.add(mEventInfo.mID, mEventInfo.mUnixTime, mEventInfo.mTimeStr, mEventInfo.mName); + mNotifyBtn->setLabel(getString("dont_notify")); + } + else + { + gEventNotifier.remove(mEventInfo.mID); + mNotifyBtn->setLabel(getString("notify")); + } +} diff --git a/indra/newview/llpaneleventinfo.h b/indra/newview/llpaneleventinfo.h new file mode 100644 index 00000000000..4f0e547493d --- /dev/null +++ b/indra/newview/llpaneleventinfo.h @@ -0,0 +1,76 @@ +/** + * @file llpaneleventinfo.h + * @brief Info panel for events in the legacy Search + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, 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_LLPANELEVENTINFO_H +#define LL_LLPANELEVENTINFO_H + +#include "lleventnotifier.h" + +class LLTextBox; +class LLTextEditor; +class LLButton; + +class LLPanelEventInfo : public LLPanel +{ +public: + LLPanelEventInfo(); + /*virtual*/ ~LLPanelEventInfo(); + + /*virtual*/ bool postBuild() override; + + void setEventID(const U32 event_id); + void sendEventInfoRequest(); + + bool processEventInfoReply(LLEventInfo event); + + U32 getEventID() { return mEventID; } + +protected: + void onClickTeleport(); + void onClickMap(); + void onClickNotify(); + +protected: + LLTextBox* mTBName; + LLTextBox* mTBCategory; + LLTextBox* mTBDate; + LLTextBox* mTBDuration; + LLTextEditor* mTBDesc; + + LLTextBox* mTBRunBy; + LLTextBox* mTBLocation; + LLTextBox* mTBCover; + + LLButton* mTeleportBtn; + LLButton* mMapBtn; + LLButton* mNotifyBtn; + + U32 mEventID; + LLEventInfo mEventInfo; + boost::signals2::connection mEventInfoConnection; +}; + +#endif // LL_LLPANELEVENTINFO_H diff --git a/indra/newview/llpanelexperiencelisteditor.h b/indra/newview/llpanelexperiencelisteditor.h index 7ff1ddac5a0..70bc2ecd3cb 100644 --- a/indra/newview/llpanelexperiencelisteditor.h +++ b/indra/newview/llpanelexperiencelisteditor.h @@ -42,7 +42,7 @@ class LLPanelExperienceListEditor : public LLPanel typedef boost::signals2::signal list_changed_signal_t; // filter function for experiences, return true if the experience should be hidden. - typedef boost::function experience_function; + typedef std::function experience_function; typedef std::vector filter_list; typedef LLHandle PickerHandle; LLPanelExperienceListEditor(); diff --git a/indra/newview/llpanelexperiencepicker.h b/indra/newview/llpanelexperiencepicker.h index 72c0b1b74de..5cde0a03fba 100644 --- a/indra/newview/llpanelexperiencepicker.h +++ b/indra/newview/llpanelexperiencepicker.h @@ -39,9 +39,9 @@ class LLPanelExperiencePicker : public LLPanel friend class LLExperienceSearchResponder; friend class LLFloaterExperiencePicker; - typedef boost::function select_callback_t; + typedef std::function select_callback_t; // filter function for experiences, return true if the experience should be hidden. - typedef boost::function filter_function; + typedef std::function filter_function; typedef std::vector filter_list; LLPanelExperiencePicker(); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 182b6489147..de8ab95deea 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1166,26 +1166,22 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool missing_asset = false; { LLGLenum image_format = GL_RGB; + bool has_alpha = false; bool identical_image_format = false; - LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); + LLSelectedTE::getImageFormat(image_format, has_alpha, identical_image_format, missing_asset); if (!missing_asset) { - mIsAlpha = false; + mIsAlpha = has_alpha; switch (image_format) { case GL_RGBA: case GL_ALPHA: - { - mIsAlpha = true; - } - break; - case GL_RGB: break; default: { - LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; + LL_WARNS() << "Unexpected tex format in LLPanelFace..." << LL_ENDL; } break; } @@ -3292,23 +3288,22 @@ void LLPanelFace::onSelectTexture() sendTexture(); LLGLenum image_format; + bool has_alpha; bool identical_image_format = false; bool missing_asset = false; - LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); + LLSelectedTE::getImageFormat(image_format, has_alpha, identical_image_format, missing_asset); - U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; if (!missing_asset) { + U32 alpha_mode = has_alpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; switch (image_format) { case GL_RGBA: case GL_ALPHA: - alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; - break; case GL_RGB: break; default: - LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; + LL_WARNS() << "Unexpected tex format in LLPanelFace..." << LL_ENDL; break; } @@ -5258,12 +5253,13 @@ void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return, false, (LLFace*)nullptr); } -void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face, bool& missing_asset) +void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& has_alpha, bool& identical_face, bool& missing_asset) { struct LLSelectedTEGetmatId : public LLSelectedTEFunctor { LLSelectedTEGetmatId() : mImageFormat(GL_RGB) + , mHasAlpha(false) , mIdentical(true) , mMissingAsset(false) , mFirstRun(true) @@ -5278,6 +5274,10 @@ void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, { format = image->getPrimaryFormat(); missing = image->isMissingAsset(); + if (format == GL_RGBA || format == GL_ALPHA) + { + mHasAlpha = true; + } } if (mFirstRun) @@ -5294,6 +5294,7 @@ void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, return true; } LLGLenum mImageFormat; + bool mHasAlpha; bool mIdentical; bool mMissingAsset; bool mFirstRun; @@ -5301,6 +5302,7 @@ void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); image_format_to_return = func.mImageFormat; + has_alpha = func.mHasAlpha; identical_face = func.mIdentical; missing_asset = func.mMissingAsset; } diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 8a8460204c3..63fee6bab8d 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -697,7 +697,7 @@ class LLPanelFace : public LLPanel { public: static void getFace(class LLFace*& face_to_return, bool& identical_face); - static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face, bool& missing_asset); + static void getImageFormat(LLGLenum& image_format_to_return, bool& has_alpha, bool& identical_face, bool& missing_asset); static void getTexId(LLUUID& id, bool& identical); static void getPbrMaterialId(LLUUID& id, bool& identical, bool& has_pbr, bool& has_faces_without_pbr); static void getObjectScaleS(F32& scale_s, bool& identical); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 65aa1876b07..ecb66f9cea4 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -231,6 +231,12 @@ void LLPanelGroup::onBackBtnClick() } } +void LLPanelGroup::hideBackBtn() +{ + childSetVisible("back", false); + setBackgroundVisible(false); +} + void LLPanelGroup::onBtnRefresh(void* user_data) { LLPanelGroup* self = static_cast(user_data); diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index fa0e1d4104b..b43a93bc400 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -87,6 +87,7 @@ class LLPanelGroup : public LLPanel, const std::string& inventory_name, LLOfferInfo* inventory_offer); + void hideBackBtn(); protected: virtual void update(LLGroupChange gc); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index ed80c8b7320..fe9145bf712 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -183,7 +183,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, : LLPanel(), mCallback(callback), mCallbackData(cb_data), - mListener(new LLPanelLoginListener(this)), + mListener(std::make_unique(this)), mFirstLoginThisInstall(gSavedSettings.getBOOL("FirstLoginThisInstall")), mUsernameLength(0), mPasswordLength(0), diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp index 6e4e9f426d1..68e2808a830 100644 --- a/indra/newview/llpanelmediasettingssecurity.cpp +++ b/indra/newview/llpanelmediasettingssecurity.cpp @@ -220,7 +220,7 @@ const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string& if ( candidate_url.scheme().empty() ) { // build a URL comprised of default scheme and the original fragment - const std::string default_scheme( "http://" ); + const std::string default_scheme( "https://" ); return default_scheme + src_url; }; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 33599357a3e..64e0a8c429c 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -251,7 +251,7 @@ static LLPanelInjector t_people("panel_people"); class LLPanelPeople::Updater { public: - typedef boost::function callback_t; + typedef std::function callback_t; Updater(callback_t cb) : mCallback(cb) { diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 87f05f20286..c380b6860f0 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -517,7 +517,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, std::string parcel_owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString(); mParcelOwner->setText(parcel_owner); - LLAvatarNameCache::get(region->getOwner(), boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mRegionOwnerText)); + mAvatarNameCacheConnection = LLAvatarNameCache::get(region->getOwner(), boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mRegionOwnerText)); mRegionGroupText->setText( getString("none_text")); } @@ -548,7 +548,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); if(auth_buyer_id.notNull()) { - LLAvatarNameCache::get(auth_buyer_id, boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mSaleToText)); + mAvatarNameCacheConnection = LLAvatarNameCache::get(auth_buyer_id, boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mSaleToText)); // Show sales info to a specific person or a group he belongs to. if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id)) diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h index f562be0f5da..0c161198f8a 100644 --- a/indra/newview/llpanelplaceprofile.h +++ b/indra/newview/llpanelplaceprofile.h @@ -118,6 +118,8 @@ class LLPanelPlaceProfile : public LLPanelPlaceInfo LLTextEditor* mResaleText; LLTextBox* mSaleToText; LLAccordionCtrl* mAccordionCtrl; + + boost::signals2::scoped_connection mAvatarNameCacheConnection; }; #endif // LL_LLPANELPLACEPROFILE_H diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 7deb1d9fd42..5435a79e16e 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -651,7 +651,7 @@ void LLPanelPlaces::onFilterEdit(const std::string& search_string, bool force_fi void LLPanelPlaces::onTabSelected() { mActivePanel = dynamic_cast(mTabContainer->getCurrentPanel()); - if (!mActivePanel) + if (!mActivePanel || !mTabsCreated) return; onFilterEdit(mActivePanel->getFilterSubString(), true); @@ -1335,6 +1335,13 @@ LLPanelPlaceInfo* LLPanelPlaces::getCurrentInfoPanel() return NULL; } +void LLPanelPlaces::hideBackBtn() +{ + mPlaceProfileBackBtn->setVisible(false); + setBackgroundVisible(false); + mPlaceProfile->setBackgroundVisible(false); +} + static bool is_agent_in_selected_parcel(LLParcel* parcel) { LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance(); diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index fc04d8d45db..8360380b22a 100644 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -81,6 +81,8 @@ class LLPanelPlaces : public LLPanel /*virtual*/ S32 notifyParent(const LLSD& info); + void hideBackBtn(); + private: void onLandmarkLoaded(LLLandmark* landmark); void onFilterEdit(const std::string& search_string, bool force_filter); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 6ea9cd2b92f..34d2d4d6a51 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -106,11 +106,11 @@ LLUUID post_profile_image(std::string cap_url, const LLSD &first_data, std::stri { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("post_profile_image_coro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("post_profile_image_coro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setFollowRedirects(true); LLSD result = httpAdapter->postAndSuspend(httpRequest, cap_url, first_data, httpOpts, httpHeaders); @@ -138,9 +138,9 @@ LLUUID post_profile_image(std::string cap_url, const LLSD &first_data, std::stri } // Upload the image - LLCore::HttpRequest::ptr_t uploaderhttpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t uploaderhttpHeaders(new LLCore::HttpHeaders); - LLCore::HttpOptions::ptr_t uploaderhttpOpts(new LLCore::HttpOptions); + LLCore::HttpRequest::ptr_t uploaderhttpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t uploaderhttpHeaders = std::make_shared(); + LLCore::HttpOptions::ptr_t uploaderhttpOpts = std::make_shared(); S64 length; { @@ -693,6 +693,7 @@ LLPanelProfileSecondLife::LLPanelProfileSecondLife() , mWaitingForImageUpload(false) , mAllowPublish(false) , mHideAge(false) + , mAllowEdit(true) { } @@ -709,6 +710,10 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife() { mAvatarNameCacheConnection.disconnect(); } + if (mMenuNameCacheConnection.connected()) + { + mMenuNameCacheConnection.disconnect(); + } } bool LLPanelProfileSecondLife::postBuild() @@ -757,14 +762,15 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) LLUUID avatar_id = getAvatarId(); bool own_profile = getSelfProfile(); + bool allow_edit = own_profile && mAllowEdit; mGroupList->setShowNone(!own_profile); - childSetVisible("notes_panel", !own_profile); - childSetVisible("settings_panel", own_profile); - childSetVisible("about_buttons_panel", own_profile); + childSetVisible("notes_panel", !allow_edit); + childSetVisible("settings_panel", allow_edit); + childSetVisible("about_buttons_panel", allow_edit); - if (own_profile) + if (allow_edit) { // Group list control cannot toggle ForAgent loading // Less than ideal, but viewing own profile via search is edge case @@ -789,7 +795,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) mAgentActionMenuButton->setMenu("menu_profile_other.xml", LLMenuButton::MP_BOTTOM_RIGHT); } - mDescriptionEdit->setParseHTML(!own_profile); + mDescriptionEdit->setParseHTML(!allow_edit); if (!own_profile) { @@ -1022,7 +1028,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) if (getSelfProfile()) { mAllowPublish = avatar_data->flags & AVATAR_ALLOW_PUBLISH; - mShowInSearchCombo->setValue(mAllowPublish); + mShowInSearchCombo->setValue(mAllowPublish ? LLSD::Integer(1) : LLSD::Integer(0)); } } @@ -1280,7 +1286,7 @@ void LLPanelProfileSecondLife::setLoaded() { mHideAgeCombo->setEnabled(true); } - mDescriptionEdit->setEnabled(true); + mDescriptionEdit->setEnabled(mAllowEdit); } } @@ -1456,7 +1462,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) } else if (item_name == "edit_display_name") { - LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCacheSetName, this, _1, _2)); + mMenuNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCacheSetName, this, _1, _2)); LLFirstUse::setDisplayName(false); } else if (item_name == "edit_partner") diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index c207a4162a3..c993ec547ae 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -111,6 +111,8 @@ class LLPanelProfileSecondLife void processProperties(void* data, EAvatarProcessorType type) override; + void setAllowEdit(bool allow_edit) { mAllowEdit = allow_edit; } + protected: /** * Process profile related data received from server. @@ -207,8 +209,10 @@ class LLPanelProfileSecondLife bool mWaitingForImageUpload; bool mAllowPublish; bool mHideAge; + bool mAllowEdit; std::string mDescriptionText; boost::signals2::connection mAvatarNameCacheConnection; + boost::signals2::connection mMenuNameCacheConnection; }; diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index b81b8916852..7396f079b0e 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -110,7 +110,11 @@ void LLPanelSnapshotInventory::updateControls(const LLSD& info) void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) { - bool current_window_selected = (getChild(getImageSizeComboName())->getCurrentIndex() == 3); + LLComboBox* combo = getChild(getImageSizeComboName()); + // Current window likely won't ever change position from being the penultimate item + // Custom window is last item + S32 curent_window_index = combo->getItemCount() - 2; + bool current_window_selected = (combo->getCurrentIndex() == curent_window_index); getChild(getWidthSpinnerName())->setVisible(!current_window_selected); getChild(getHeightSpinnerName())->setVisible(!current_window_selected); } diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 3aedde74c69..4fcce50df14 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -466,8 +466,8 @@ void LLPanelWearing::getAttachmentLimitsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("getAttachmentLimitsCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 9ef9c26411d..c6a88dbada4 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -41,7 +41,7 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLFolderViewModelInterface& root_view_model) : LLConversationItemSession(data_source->getSessionID(), root_view_model), mSpeakerMgr(data_source), - mValidateSpeakerCallback(NULL) + mValidateSpeakerCallback(nullptr) { mSpeakerAddListener = new SpeakerAddListener(*this); mSpeakerRemoveListener = new SpeakerRemoveListener(*this); diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 7cb29a6211b..4b4334c6f97 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -27,8 +27,8 @@ #ifndef LL_PARTICIPANTLIST_H #define LL_PARTICIPANTLIST_H -#include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llevent.h" class LLSpeakerMgr; class LLUICtrl; @@ -38,7 +38,7 @@ class LLParticipantList : public LLConversationItemSession LOG_CLASS(LLParticipantList); public: - typedef boost::function validate_speaker_callback_t; + typedef std::function validate_speaker_callback_t; LLParticipantList(LLSpeakerMgr* data_source, LLFolderViewModelInterface& root_view_model); ~LLParticipantList(); diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp index 1366ba6c6ff..8e03492381f 100644 --- a/indra/newview/llpathfindingcharacterlist.cpp +++ b/indra/newview/llpathfindingcharacterlist.cpp @@ -65,7 +65,7 @@ void LLPathfindingCharacterList::parseCharacterListData(const LLSD& pCharacterLi continue; const std::string& uuid(characterDataIter->first); const LLSD& characterData = characterDataIter->second; - LLPathfindingObjectPtr character(new LLPathfindingCharacter(uuid, characterData)); + LLPathfindingObjectPtr character = std::make_shared(uuid, characterData); objectMap.insert(std::pair(uuid, character)); } } diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 2012d7a0946..81efb0a6fce 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -206,7 +206,7 @@ void LLPathfindingLinksetList::parseLinksetListData(const LLSD& pLinksetListData const LLSD& linksetData = linksetDataIter->second; if(linksetData.size() != 0) { - LLPathfindingObjectPtr linksetPtr(new LLPathfindingLinkset(uuid, linksetData)); + LLPathfindingObjectPtr linksetPtr = std::make_shared(uuid, linksetData); objectMap.insert(std::pair(uuid, linksetPtr)); } } diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 84a62b3cbf0..412e25a7b1d 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include "llagent.h" @@ -451,8 +450,8 @@ void LLPathfindingManager::navMeshStatusRequestCoro(std::string url, U64 regionH { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("NavMeshStatusRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("NavMeshStatusRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLViewerRegion *region = LLWorld::getInstance()->getRegionFromHandle(regionHandle); if (!region) @@ -541,8 +540,8 @@ void LLPathfindingManager::navAgentStateRequestCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("NavAgentStateRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("NavAgentStateRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); @@ -569,8 +568,8 @@ void LLPathfindingManager::navMeshRebakeCoro(std::string url, rebake_navmesh_cal { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("NavMeshRebake", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("NavMeshRebake", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData = LLSD::emptyMap(); @@ -598,8 +597,8 @@ void LLPathfindingManager::linksetObjectsCoro(std::string url, LinksetsResponder { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("LinksetObjects", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("LinksetObjects", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result; @@ -634,8 +633,8 @@ void LLPathfindingManager::linksetTerrainCoro(std::string url, LinksetsResponder { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("LinksetTerrain", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("LinksetTerrain", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result; @@ -669,8 +668,8 @@ void LLPathfindingManager::charactersCoro(std::string url, request_id_t requestI { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("LinksetTerrain", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("charactersCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 663cb3cf346..d2092664674 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -27,10 +27,10 @@ #ifndef LL_LLPATHFINDINGMANAGER_H #define LL_LLPATHFINDINGMANAGER_H +#include #include #include -#include #include #include "llpathfindinglinkset.h" @@ -76,21 +76,21 @@ class LLPathfindingManager : public LLSingleton void requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly); typedef U32 request_id_t; - typedef boost::function object_request_callback_t; + typedef std::function object_request_callback_t; void requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const; void requestSetLinksets(request_id_t pRequestId, const LLPathfindingObjectListPtr &pLinksetListPtr, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, object_request_callback_t pLinksetsCallback) const; void requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const; - typedef boost::function agent_state_callback_t; + typedef std::function agent_state_callback_t; typedef boost::signals2::signal agent_state_signal_t; typedef boost::signals2::connection agent_state_slot_t; agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); void requestGetAgentState(); - typedef boost::function rebake_navmesh_callback_t; + typedef std::function rebake_navmesh_callback_t; void requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback); protected: diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index d838a1a51c0..44397c9118b 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -27,9 +27,9 @@ #ifndef LL_LLPATHFINDINGNAVMESH_H #define LL_LLPATHFINDINGNAVMESH_H +#include #include -#include #include #include "llpathfindingnavmeshstatus.h" @@ -54,7 +54,7 @@ class LLPathfindingNavMesh kNavMeshRequestError } ENavMeshRequestStatus; - typedef boost::function navmesh_callback_t; + typedef std::function navmesh_callback_t; typedef boost::signals2::signal navmesh_signal_t; typedef boost::signals2::connection navmesh_slot_t; diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index e770efa0d00..8f7750d4c56 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -27,9 +27,9 @@ #ifndef LL_LLPATHFINDINGNAVMESHZONE_H #define LL_LLPATHFINDINGNAVMESHZONE_H +#include #include -#include #include #include "llpathfindingnavmesh.h" @@ -62,7 +62,7 @@ class LLPathfindingNavMeshZone kNavMeshZoneComplete } ENavMeshZoneStatus; - typedef boost::function navmesh_zone_callback_t; + typedef std::function navmesh_zone_callback_t; typedef boost::signals2::signal navmesh_zone_signal_t; typedef boost::signals2::connection navmesh_zone_slot_t; @@ -81,7 +81,7 @@ class LLPathfindingNavMeshZone protected: private: - typedef boost::function navmesh_location_callback_t; + typedef std::function navmesh_location_callback_t; class NavMeshLocation { public: diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index 79a796dd602..bf27f114f5c 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -27,9 +27,9 @@ #ifndef LL_LLPATHFINDINGOBJECT_H #define LL_LLPATHFINDINGOBJECT_H +#include #include -#include #include #include "llavatarname.h" @@ -61,7 +61,7 @@ class LLPathfindingObject inline bool isGroupOwned() const {return mIsGroupOwned;}; inline const LLVector3& getLocation() const {return mLocation;}; - typedef boost::function name_callback_t; + typedef std::function name_callback_t; typedef boost::signals2::signal name_signal_t; typedef boost::signals2::connection name_connection_t; diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index 61791492e76..57f4aefadf9 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -30,7 +30,6 @@ #include "llpathfindingpathtool.h" -#include #include #include "llagent.h" diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index 189b9d49541..f6b4500f0fa 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -27,7 +27,7 @@ #ifndef LL_LLPATHFINDINGPATHTOOL_H #define LL_LLPATHFINDINGPATHTOOL_H -#include +#include #include #include "llpathinglib.h" @@ -62,7 +62,7 @@ class LLPathfindingPathTool : public LLTool, public LLSingleton path_event_callback_t; + typedef std::function path_event_callback_t; typedef boost::signals2::signal path_event_signal_t; typedef boost::signals2::connection path_event_slot_t; diff --git a/indra/newview/llpbrterrainfeatures.cpp b/indra/newview/llpbrterrainfeatures.cpp index bb771c6963a..d652e23dd5d 100644 --- a/indra/newview/llpbrterrainfeatures.cpp +++ b/indra/newview/llpbrterrainfeatures.cpp @@ -86,9 +86,9 @@ void LLPBRTerrainFeatures::queryRegionCoro(std::string cap_url, LLUUID region_id { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("queryRegionCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("queryRegionCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; httpOpts->setFollowRedirects(true); @@ -159,9 +159,9 @@ void LLPBRTerrainFeatures::modifyRegionCoro(std::string cap_url, LLSD updates, v { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("modifyRegionCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("modifyRegionCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; httpOpts->setFollowRedirects(true); diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp index e06d025f592..1cc311e1b57 100644 --- a/indra/newview/llpersistentnotificationstorage.cpp +++ b/indra/newview/llpersistentnotificationstorage.cpp @@ -141,7 +141,7 @@ void LLPersistentNotificationStorage::loadNotifications() ++notification_it) { LLSD notification_params = *notification_it; - LLNotificationPtr notification(new LLNotification(notification_params)); + LLNotificationPtr notification = std::make_shared(notification_params); LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"])); notification->setResponseFunctor(responder); diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp index cc55b3c8db2..16149b7e33c 100644 --- a/indra/newview/llpopupview.cpp +++ b/indra/newview/llpopupview.cpp @@ -94,8 +94,8 @@ void LLPopupView::draw() LLPanel::draw(); } -bool LLPopupView::handleMouseEvent(boost::function func, - boost::function predicate, +bool LLPopupView::handleMouseEvent(std::function func, + std::function predicate, S32 x, S32 y, bool close_popups) { diff --git a/indra/newview/llpopupview.h b/indra/newview/llpopupview.h index 4a888661850..8c0db623acc 100644 --- a/indra/newview/llpopupview.h +++ b/indra/newview/llpopupview.h @@ -55,7 +55,7 @@ class LLPopupView : public LLPanel popup_list_t getCurrentPopups() { return mPopups; } private: - bool handleMouseEvent(boost::function, boost::function, S32 x, S32 y, bool close_popups); + bool handleMouseEvent(std::function, std::function, S32 x, S32 y, bool close_popups); popup_list_t mPopups; }; #endif //LL_LLROOTVIEW_H diff --git a/indra/newview/llpostcard.h b/indra/newview/llpostcard.h index cfe6f3951d0..11178aa0273 100644 --- a/indra/newview/llpostcard.h +++ b/indra/newview/llpostcard.h @@ -40,7 +40,7 @@ class LLPostCard LOG_CLASS(LLPostCard); public: - typedef boost::function result_callback_t; + typedef std::function result_callback_t; static void setPostResultCallback(result_callback_t cb) { mResultCallback = cb; } static void reportPostResult(bool ok); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index afd58af0563..84455bb6798 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -26,8 +26,6 @@ #include "llviewerprecompiledheaders.h" -#include - #include "llpresetsmanager.h" #include "lldiriterator.h" @@ -250,17 +248,17 @@ void LLPresetsManager::settingChanged() void LLPresetsManager::getControlNames(std::vector& names) { - const std::vector camera_controls = boost::assign::list_of + const std::vector camera_controls = { // From panel_preferences_move.xml - ("CameraAngle") - ("CameraOffsetScale") + "CameraAngle", + "CameraOffsetScale", // From llagentcamera.cpp - ("CameraOffsetBuild") - ("TrackFocusObject") - ("CameraOffsetRearView") - ("FocusOffsetRearView") - ("AvatarSitRotation") - ; + "CameraOffsetBuild", + "TrackFocusObject", + "CameraOffsetRearView", + "FocusOffsetRearView", + "AvatarSitRotation", + }; names = camera_controls; } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 0bbe5402079..a56697117aa 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -58,7 +58,7 @@ class LLScriptMovedObserver; class LLLiveLSLFile : public LLLiveFile { public: - typedef boost::function change_callback_t; + typedef std::function change_callback_t; LLLiveLSLFile(std::string file_path, change_callback_t change_cb); ~LLLiveLSLFile(); diff --git a/indra/newview/llproductinforequest.cpp b/indra/newview/llproductinforequest.cpp index 728cb224312..d962622dfdc 100644 --- a/indra/newview/llproductinforequest.cpp +++ b/indra/newview/llproductinforequest.cpp @@ -70,8 +70,8 @@ void LLProductInfoRequestManager::getLandDescriptionsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("getLandDescriptionsCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index d0aa1af2f31..f89afd38ab6 100644 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -201,8 +201,8 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url, { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("RemoteParcelRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("RemoteParcelRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD bodyData; diff --git a/indra/newview/llsetkeybinddialog.cpp b/indra/newview/llsetkeybinddialog.cpp index 5dbd579b45b..2790705fd88 100644 --- a/indra/newview/llsetkeybinddialog.cpp +++ b/indra/newview/llsetkeybinddialog.cpp @@ -40,7 +40,7 @@ class LLSetKeyBindDialog::Updater : public LLEventTimer { public: - typedef boost::function callback_t; + typedef std::function callback_t; Updater(callback_t cb, F32 period, MASK mask) :LLEventTimer(period), diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 9b6a87e68d5..e696c2dcb5c 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -1064,11 +1064,11 @@ void LLSnapshotLivePreview::saveTexture(bool outfit_snapshot, std::string name) LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY; LLInventoryType::EType inv_type = outfit_snapshot ? LLInventoryType::IT_NONE : LLInventoryType::IT_SNAPSHOT; - LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( + LLResourceUploadInfo::ptr_t assetUploadInfo = std::make_shared( tid, LLAssetType::AT_TEXTURE, res_name, res_desc, 0, folder_type, inv_type, PERM_ALL, LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost, LLUUID::null, !outfit_snapshot)); + expected_upload_cost, LLUUID::null, !outfit_snapshot); upload_new_resource(assetUploadInfo); diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 3aaa3d60e87..d8a94c88354 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -71,16 +71,8 @@ class LLDrawInfo final : public LLRefCount ~LLDrawInfo(); public: - LLDrawInfo(const LLDrawInfo& rhs) - { - *this = rhs; - } - - const LLDrawInfo& operator=(const LLDrawInfo& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } + LLDrawInfo(const LLDrawInfo& rhs) = delete; + const LLDrawInfo& operator=(const LLDrawInfo& rhs) = delete; // return a hash of this LLDrawInfo as a debug color LLColor4U getDebugColor() const; @@ -206,16 +198,8 @@ class LLSpatialGroup : public LLOcclusionCullingGroup friend class LLOctreeStateCheck; public: - LLSpatialGroup(const LLSpatialGroup& rhs) : LLOcclusionCullingGroup(rhs) - { - *this = rhs; - } - - const LLSpatialGroup& operator=(const LLSpatialGroup& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } + LLSpatialGroup(const LLSpatialGroup& rhs) = delete; + const LLSpatialGroup& operator=(const LLSpatialGroup& rhs) = delete; static U32 sNodeCount; static bool sNoDelete; //deletion of spatial groups and draw info not allowed if true diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index b49c0119ed6..f079c70c6cb 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -76,7 +76,7 @@ void LLSpeaker::lookupName() { if (mDisplayName.empty()) { - LLAvatarNameCache::get(mID, boost::bind(&LLSpeaker::onNameCache, this, _1, _2)); // todo: can be group??? + mAvatarNameCacheConnection = LLAvatarNameCache::get(mID, boost::bind(&LLSpeaker::onNameCache, this, _1, _2)); // todo: can be group??? } } @@ -867,9 +867,9 @@ void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("moderationActionCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("moderationActionCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index ad2461f60f7..c3773d2c33c 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -80,6 +80,9 @@ class LLSpeaker : public LLRefCount, public LLOldEvents::LLObservable, public LL bool mIsModerator; bool mModeratorMutedVoice; bool mModeratorMutedText; + +private: + boost::signals2::scoped_connection mAvatarNameCacheConnection; }; class LLSpeakerUpdateSpeakerEvent : public LLOldEvents::LLEvent @@ -138,7 +141,7 @@ class LLSpeakerListChangeEvent : public LLOldEvents::LLEvent class LLSpeakerActionTimer : public LLEventTimer { public: - typedef boost::function action_callback_t; + typedef std::function action_callback_t; typedef std::map action_timers_map_t; typedef action_timers_map_t::value_type action_value_t; typedef action_timers_map_t::const_iterator action_timer_const_iter_t; diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp index 6c252ed31f0..140b63c84d5 100644 --- a/indra/newview/llsplitbutton.cpp +++ b/indra/newview/llsplitbutton.cpp @@ -118,7 +118,7 @@ void LLSplitButton::onItemSelected(LLUICtrl* ctrl) hideButtons(); // call the callback if it exists - if(!mSelectionCallback.empty()) + if(mSelectionCallback != nullptr) { mSelectionCallback(this, ctrl->getName()); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3786a9b1609..59d97943e3c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -122,6 +122,7 @@ #include "llpanellogin.h" #include "llmutelist.h" #include "llavatarpropertiesprocessor.h" +#include "llpaneldirbrowser.h" #include "llpanelgrouplandmoney.h" #include "llpanelgroupnotices.h" #include "llparcel.h" @@ -457,6 +458,32 @@ bool idle_startup() LLStringOps::sAM = LLTrans::getString("dateTimeAM"); LLStringOps::sPM = LLTrans::getString("dateTimePM"); } + else + { + std::wstring utf16str = ll_convert(val); + if (utf16str.size() > 4) + { + LL_DEBUGS("InitInfo") << "Current locale \"" << locale << "\" " + << "has impracitcally long AM/PM time format" << LL_ENDL; + // fallback to declarations in strings.xml + LLStringOps::sAM = LLTrans::getString("dateTimeAM"); + LLStringOps::sPM = LLTrans::getString("dateTimePM"); + } + } + } + + // Some locales (as well some of our own dateTimeAM/PM) return long + // strings for AM/PM which aren't practical to display in the UI. + // Hardcode to "AM"/"PM" in those cases. + std::wstring utf16str = ll_convert(LLStringOps::sAM); + if (utf16str.size() > 4) + { + LLStringOps::sAM = "AM"; + } + utf16str = ll_convert(LLStringOps::sPM); + if (utf16str.size() > 4) + { + LLStringOps::sPM = "PM"; } } @@ -2559,9 +2586,9 @@ void release_notes_coro(const std::string url) LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("releaseNotesCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("releaseNotesCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setHeadersOnly(true); // only making sure it isn't 404 or something like that @@ -2871,6 +2898,13 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply); + msg->setHandlerFunc("DirPlacesReply", LLPanelDirBrowser::processDirPlacesReply); + msg->setHandlerFunc("DirPeopleReply", LLPanelDirBrowser::processDirPeopleReply); + msg->setHandlerFunc("DirEventsReply", LLPanelDirBrowser::processDirEventsReply); + msg->setHandlerFunc("DirGroupsReply", LLPanelDirBrowser::processDirGroupsReply); + msg->setHandlerFunc("DirClassifiedReply", LLPanelDirBrowser::processDirClassifiedReply); + msg->setHandlerFunc("DirLandReply", LLPanelDirBrowser::processDirLandReply); + msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply); msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply); msg->setHandlerFunc("EventInfoReply", LLEventNotifier::processEventInfoReply); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 2727127633d..44bada13c2f 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -305,7 +305,9 @@ void LLStatusBar::refresh() time_t utc_time; utc_time = time_corrected(); - std::string timeStr = getString("time"); + static bool use_24h = gSavedSettings.getBOOL("Use24HourClock"); + std::string timeStr = use_24h ? getString("time") : getString("time_ampm"); + LLSD substitution; substitution["datetime"] = (S32) utc_time; LLStringUtil::format (timeStr, substitution); @@ -713,7 +715,7 @@ void collectChildren( LLMenuGL *aMenu, ll::statusbar::SearchableItemPtr aParentM { LLMenuItemGL *pMenu = aMenu->getItem( i ); - ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem ); + ll::statusbar::SearchableItemPtr pItem = std::make_shared(); pItem->mCtrl = pMenu; pItem->mMenu = pMenu; pItem->mLabel = utf8str_to_wstring( pMenu->ll::ui::SearchableControl::getSearchText() ); @@ -729,8 +731,8 @@ void collectChildren( LLMenuGL *aMenu, ll::statusbar::SearchableItemPtr aParentM void LLStatusBar::collectSearchableItems() { - mSearchData.reset( new ll::statusbar::SearchData ); - ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem ); + mSearchData = std::make_unique(); + ll::statusbar::SearchableItemPtr pItem = std::make_shared(); mSearchData->mRootMenu = pItem; collectChildren( gMenuBarView, pItem ); } diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 5114ee36720..f89ae00c5b0 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -120,8 +120,8 @@ void LLSyntaxIdLSL::fetchKeywordsFileCoro(std::string url, std::string fileSpec) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("fetchKeywordsFileCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::pair::iterator, bool> insrt = mInflightFetches.insert(fileSpec); if (!insrt.second) diff --git a/indra/newview/llsyswellitem.h b/indra/newview/llsyswellitem.h index 0a4e26cb98f..2ad5de816b7 100644 --- a/indra/newview/llsyswellitem.h +++ b/indra/newview/llsyswellitem.h @@ -60,7 +60,7 @@ class LLSysWellItem : public LLPanel virtual void onMouseLeave(S32 x, S32 y, MASK mask); //callbacks - typedef boost::function syswell_item_callback_t; + typedef std::function syswell_item_callback_t; typedef boost::signals2::signal syswell_item_signal_t; syswell_item_signal_t mOnItemClose; syswell_item_signal_t mOnItemClick; diff --git a/indra/newview/llteleporthistory.h b/indra/newview/llteleporthistory.h index b534b136b02..76bd65e7a92 100644 --- a/indra/newview/llteleporthistory.h +++ b/indra/newview/llteleporthistory.h @@ -29,9 +29,9 @@ #include "llsingleton.h" // for LLSingleton +#include #include #include -#include #include #include "llteleporthistorystorage.h" @@ -80,7 +80,7 @@ class LLTeleportHistory: public LLSingleton public: typedef std::vector slurl_list_t; - typedef boost::function history_callback_t; + typedef std::function history_callback_t; typedef boost::signals2::signal history_signal_t; /** diff --git a/indra/newview/llteleporthistorystorage.h b/indra/newview/llteleporthistorystorage.h index 643c4a6bfcf..07da596aab2 100644 --- a/indra/newview/llteleporthistorystorage.h +++ b/indra/newview/llteleporthistorystorage.h @@ -77,7 +77,7 @@ class LLTeleportHistoryStorage: public LLSingleton typedef std::vector slurl_list_t; // removed_index is index of removed item, which replaced by more recent - typedef boost::function history_callback_t; + typedef std::function history_callback_t; typedef boost::signals2::signal history_signal_t; /** diff --git a/indra/newview/llterrainpaintmap.cpp b/indra/newview/llterrainpaintmap.cpp index c7a82013e4e..f95f2481393 100644 --- a/indra/newview/llterrainpaintmap.cpp +++ b/indra/newview/llterrainpaintmap.cpp @@ -107,7 +107,7 @@ bool LLTerrainPaintMap::bakeHeightNoiseIntoPBRPaintMapRGB(const LLViewerRegion& const LLVector3 region_center = LLVector3(region_half_width, region_half_width, 0.0) + region.getOriginAgent(); const LLVector3 camera_origin = LLVector3(0.0f, 0.0f, region_camera_height) + region_center; camera.lookAt(camera_origin, region_center, LLVector3::y_axis); - camera.setAspect(F32(scratch_target.getHeight()) / F32(scratch_target.getWidth())); + camera.setAspect(F32(scratch_target.getWidth()) / F32(scratch_target.getHeight())); const LLRect texture_rect(0, scratch_target.getHeight(), scratch_target.getWidth(), 0); glViewport(texture_rect.mLeft, texture_rect.mBottom, texture_rect.getWidth(), texture_rect.getHeight()); // Manually get modelview matrix from camera orientation. diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index b2f2509e807..52ec8c17c1d 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -166,10 +166,10 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mBlankImageAssetID(blank_image_asset_id), mAllowNoTexture(allow_no_texture), mLabel(label), - mTentativeLabel(NULL), - mResolutionLabel(NULL), + mTentativeLabel(nullptr), + mResolutionLabel(nullptr), mActive( true ), - mFilterEdit(NULL), + mFilterEdit(nullptr), mImmediateFilterPermMask(immediate_filter_perm_mask), mDnDFilterPermMask(dnd_filter_perm_mask), mContextConeOpacity(0.f), @@ -180,10 +180,10 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mMaxDim(S32_MAX), mMinDim(0), mPreviewSettingChanged(false), - mOnFloaterCommitCallback(NULL), - mOnFloaterCloseCallback(NULL), - mSetImageAssetIDCallback(NULL), - mOnUpdateImageStatsCallback(NULL), + mOnFloaterCommitCallback(nullptr), + mOnFloaterCloseCallback(nullptr), + mSetImageAssetIDCallback(nullptr), + mOnUpdateImageStatsCallback(nullptr), mBakeTextureEnabled(false), mLocalTextureEnabled(false), mNoCopyTextureSelected(false), @@ -1090,7 +1090,7 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque r("texture_picker"); LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) : LLUICtrl(p), - mDragCallback(NULL), - mDropCallback(NULL), - mOnCancelCallback(NULL), - mOnCloseCallback(NULL), - mOnSelectCallback(NULL), + mDragCallback(nullptr), + mDropCallback(nullptr), + mOnCancelCallback(nullptr), + mOnCloseCallback(nullptr), + mOnSelectCallback(nullptr), mBorderColor( p.border_color() ), mAllowNoTexture( p.allow_no_texture ), mAllowLocalTexture( true ), diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 467b8d1091a..e0060474cee 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -50,8 +50,8 @@ class LLViewerFetchedTexture; class LLFetchedGLTFMaterial; // used for setting drag & drop callbacks. -typedef boost::function drag_n_drop_callback; -typedef boost::function texture_selected_callback; +typedef std::function drag_n_drop_callback; +typedef std::function texture_selected_callback; // Helper functions for UI that work with picker bool get_is_predefined_texture(LLUUID asset_id); @@ -299,10 +299,10 @@ class LLTextureCtrl ////////////////////////////////////////////////////////////////////////////////////////// // LLFloaterTexturePicker -typedef boost::function floater_commit_callback; -typedef boost::function floater_close_callback; -typedef boost::function set_image_asset_id_callback; -typedef boost::function texture)> set_on_update_image_stats_callback; +typedef std::function floater_commit_callback; +typedef std::function floater_close_callback; +typedef std::function set_image_asset_id_callback; +typedef std::function texture)> set_on_update_image_stats_callback; class LLFloaterTexturePicker : public LLFloater { diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index f7cb0ee7ed8..51ade608272 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -743,10 +743,10 @@ class TFReqSetRegion : public LLTextureFetch::TFRequest : LLTextureFetch::TFRequest(), mRegionHandle(region_handle) {} - TFReqSetRegion & operator=(const TFReqSetRegion &); // Not defined + TFReqSetRegion(const TFReqSetRegion&) = delete; + TFReqSetRegion& operator=(const TFReqSetRegion&) = delete; - virtual ~TFReqSetRegion() - {} + virtual ~TFReqSetRegion() = default; virtual bool doWork(LLTextureFetch * fetcher); @@ -793,7 +793,9 @@ class TFReqSendMetrics : public LLTextureFetch::TFRequest const LLUUID & session_id, const LLUUID & agent_id, LLSD& stats_sd); - TFReqSendMetrics & operator=(const TFReqSendMetrics &); // Not defined + + TFReqSendMetrics(const TFReqSendMetrics&) = delete; + TFReqSendMetrics& operator=(const TFReqSendMetrics&) = delete; virtual ~TFReqSendMetrics(); @@ -2462,13 +2464,13 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mod LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); mHttpRequest = new LLCore::HttpRequest; - mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); - mHttpOptionsWithHeaders = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + mHttpOptions = std::make_shared(); + mHttpOptionsWithHeaders = std::make_shared(); mHttpOptionsWithHeaders->setWantHeaders(true); - mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders); + mHttpHeaders = std::make_shared(); mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_IMAGE_X_J2C); mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_TEXTURE); - mHttpMetricsHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders); + mHttpMetricsHeaders = std::make_shared(); mHttpMetricsHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); mHttpMetricsPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_REPORTING); mHttpHighWater = HTTP_NONPIPE_REQUESTS_HIGH_WATER; @@ -3572,7 +3574,7 @@ TFReqSendMetrics::TFReqSendMetrics(const std::string & caps_url, mSessionID(session_id), mAgentID(agent_id), mStatsSD(stats_sd), - mHandler(new AssetReportHandler) + mHandler(std::make_shared()) {} diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 0f871dc1bb5..3c939a88e57 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -117,7 +117,7 @@ LLToast::LLToast(const LLToast::Params& p) mIsFading(false), mIsHovered(false) { - mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs)); + mTimer = std::make_unique(this, p.lifetime_secs); buildFromFile("panel_toast.xml"); @@ -140,7 +140,7 @@ LLToast::LLToast(const LLToast::Params& p) } // init callbacks if present - if(!p.on_delete_toast().empty()) + if (p.on_delete_toast() != nullptr) { mOnDeleteToastSignal.connect(p.on_delete_toast()); } diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index cf116bfadf5..a73f7820ba8 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -75,7 +75,7 @@ class LLToast : public LLModalDialog, public LLInstanceTracker friend class LLToastLifeTimer; public: - typedef boost::function toast_callback_t; + typedef std::function toast_callback_t; typedef boost::signals2::signal toast_signal_t; typedef boost::signals2::signal toast_hover_check_signal_t; diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h index 0f1574f2d53..6c79674d765 100644 --- a/indra/newview/lltoolpipette.h +++ b/indra/newview/lltoolpipette.h @@ -34,7 +34,6 @@ #include "lltool.h" #include "lltextureentry.h" -#include #include class LLViewerObject; diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 72e30bd765a..dcd1582eb9b 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -155,10 +155,10 @@ void LLTranslationAPIHandler::verifyKeyCoro(LLTranslate::EService service, LLSD { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("getMerchantStatusCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); std::string user_agent = stringize( @@ -199,7 +199,7 @@ void LLTranslationAPIHandler::verifyKeyCoro(LLTranslate::EService service, LLSD bOk = false; } - if (!fnc.empty()) + if (fnc != nullptr) { fnc(service, bOk, parseResult); } @@ -210,10 +210,10 @@ void LLTranslationAPIHandler::translateMessageCoro(LanguagePair_t fromTo, std::s { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getMerchantStatusCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("getMerchantStatusCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); std::string user_agent = stringize( @@ -275,7 +275,7 @@ void LLTranslationAPIHandler::translateMessageCoro(LanguagePair_t fromTo, std::s LLStringUtil::replaceString(translation, "&", "&"); LLStringUtil::replaceString(translation, "'", "'"); - if (!success.empty()) + if (success != nullptr) success(translation, detected_lang); } else @@ -291,7 +291,7 @@ void LLTranslationAPIHandler::translateMessageCoro(LanguagePair_t fromTo, std::s } LL_WARNS() << "Translation request failed: " << err_msg << LL_ENDL; - if (!failure.empty()) + if (failure != nullptr) failure(status, err_msg); } } diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index 0ad769b27fe..14372cf4068 100644 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -28,10 +28,10 @@ #define LL_LLTRANSLATE_H #include "llbufferstream.h" -#include - #include "llsingleton.h" +#include + class LLTranslationAPIHandler; /** * Entry point for machine translation services. @@ -59,9 +59,9 @@ public : SERVICE_DEEPL, } EService; - typedef boost::function KeyVerificationResult_fn; - typedef boost::function TranslationSuccess_fn; - typedef boost::function TranslationFailure_fn; + typedef std::function KeyVerificationResult_fn; + typedef std::function TranslationSuccess_fn; + typedef std::function TranslationFailure_fn; /** * Translate given text. diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp index de0ed645ebd..871bf36ed33 100644 --- a/indra/newview/llurllineeditorctrl.cpp +++ b/indra/newview/llurllineeditorctrl.cpp @@ -84,7 +84,9 @@ void LLURLLineEditor::copyEscapedURLToClipboard() const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length)); LLWString text_to_copy; // *HACK: Because LLSLURL is currently broken we cannot use it to check if unescaped_text is a valid SLURL (see EXT-8335). - if (LLStringUtil::startsWith(unescaped_text, "http://") || LLStringUtil::startsWith(unescaped_text, "secondlife://")) // SLURL + if (LLStringUtil::startsWith(unescaped_text, "https://") + || LLStringUtil::startsWith(unescaped_text, "http://") + || LLStringUtil::startsWith(unescaped_text, "secondlife://")) // SLURL text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text)); else // human-readable location text_to_copy = utf8str_to_wstring(unescaped_text); diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index de395da285a..297d0a70ffb 100644 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -182,7 +182,7 @@ class LLViewerAssetStats : public LLStopWatchControlsMixin LLViewerAssetStats(const LLViewerAssetStats &); // Default destructor is correct. - LLViewerAssetStats & operator=(const LLViewerAssetStats &); // Not defined + LLViewerAssetStats& operator=(const LLViewerAssetStats&) = delete; // Clear all metrics data. This leaves the currently-active region // in place but with zero'd data for all metrics. All other regions diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 255cfc998a6..141f370ecb1 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -68,7 +68,7 @@ class LLViewerAssetRequest : public LLAssetRequest { } - LLViewerAssetRequest & operator=(const LLViewerAssetRequest &); // Not defined + LLViewerAssetRequest& operator=(const LLViewerAssetRequest&) = delete; // Default assignment operator valid // virtual @@ -502,9 +502,9 @@ void LLViewerAssetStorage::assetRequestCoro( LLCore::HttpRequest::policy_t httpPolicy(LLAppCoreHttp::AP_TEXTURE); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("assetRequestCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("assetRequestCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts); diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 7d5386110d4..65a69acc88f 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -300,17 +300,19 @@ void LLResourceUploadInfo::assignDefaults() { mDescription = "(No Description)"; } - - if (mAssetType == LLAssetType::AT_GLTF || - mAssetType == LLAssetType::AT_GLTF_BIN) + if (mFolderId.isNull()) // don't overwrite if destination is already specified { - mFolderId = LLUUID::null; - } - else - { - mFolderId = gInventory.findUserDefinedCategoryUUIDForType( - (mDestinationFolderType == LLFolderType::FT_NONE) ? - (LLFolderType::EType)mAssetType : mDestinationFolderType); + if (mAssetType == LLAssetType::AT_GLTF || + mAssetType == LLAssetType::AT_GLTF_BIN) + { + mFolderId = LLUUID::null; + } + else + { + mFolderId = gInventory.findUserDefinedCategoryUUIDForType( + (mDestinationFolderType == LLFolderType::FT_NONE) ? + (LLFolderType::EType)mAssetType : mDestinationFolderType); + } } } @@ -862,8 +864,8 @@ LLUUID LLViewerAssetUpload::EnqueueInventoryUpload(const std::string &url, const void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id, std::string url, LLResourceUploadInfo::ptr_t uploadInfo) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOptions(new LLCore::HttpOptions); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOptions = std::make_shared(); httpOptions->setTimeout(LL_ASSET_UPLOAD_TIMEOUT_SEC); LLSD result = uploadInfo->prepareUpload(); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 75cc76fee6d..8b4b508d7c5 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -871,6 +871,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderShadowDetail", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderDeferredSSAO", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderPerformanceTest", handleRenderPerfTestChanged); + setting_setup_signal_listener(gSavedSettings, "RenderAvatarCloth", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "ChatFontSize", handleChatFontSizeChanged); setting_setup_signal_listener(gSavedSettings, "ConsoleMaxLines", handleConsoleMaxLinesChanged); setting_setup_signal_listener(gSavedSettings, "UploadBakedTexOld", handleUploadBakedTexOldChanged); diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index 243d4dec0e3..c174c495ec1 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -104,9 +104,9 @@ void LLViewerDisplayName::setDisplayNameCoro(const std::string& cap_url, const L { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("SetDisplayNameCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("SetDisplayNameCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); // People API can return localized error messages. Indicate our // language preference via header. diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 3b35ca8db1b..ab5235c3ad2 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -67,6 +67,7 @@ #include "llfloatercreatelandmark.h" #include "llfloaterdeleteprefpreset.h" #include "llfloaterdestinations.h" +#include "llfloaterdirectory.h" #include "llfloaterdisplayname.h" #include "llfloatereditextdaycycle.h" #include "llfloateremojipicker.h" @@ -231,7 +232,8 @@ class LLFloaterOpenHandler : public LLCommandHandler "upload_model", "upload_script", "upload_sound", - "bulk_upload" + "bulk_upload", + "legacy_search" }; return std::find(blacklist_clicked.begin(), blacklist_clicked.end(), fl_name) == blacklist_clicked.end(); } @@ -283,7 +285,8 @@ class LLFloaterOpenHandler : public LLCommandHandler "upload_script", "upload_sound", "bulk_upload", - "slapp_test" + "slapp_test", + "legacy_search" }; return std::find(blacklist_untrusted.begin(), blacklist_untrusted.end(), fl_name) == blacklist_untrusted.end(); } @@ -504,6 +507,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("simple_snapshot", "floater_simple_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("legacy_search", "floater_directory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("profile", "floater_profile.xml",(LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("guidebook", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("slapp_test", "floater_test_slapp.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index ea3088613fa..3c79f0b21c9 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -63,13 +63,13 @@ const LLKeyData agent_control_lbutton(CLICK_LEFT, KEY_NONE, MASK_NONE, true); struct LLKeybindFunctionData { - LLKeybindFunctionData(boost::function function, bool global) + LLKeybindFunctionData(std::function function, bool global) : mFunction(function), mIsGlobal(global) { } - boost::function mFunction; + std::function mFunction; // todo: might be good idea to make this into enum, like: global/inworld/menu bool mIsGlobal; }; @@ -1165,8 +1165,8 @@ bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) { size_t index; - typedef boost::function function_t; - function_t function = NULL; + typedef std::function function_t; + function_t function = nullptr; std::string name; // Allow remapping of F2-F12 @@ -1255,8 +1255,8 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name) { size_t index; - typedef boost::function function_t; - function_t function = NULL; + typedef std::function function_t; + function_t function = nullptr; if (mouse == CLICK_LEFT && mask == MASK_NONE diff --git a/indra/newview/llviewerinput.h b/indra/newview/llviewerinput.h index 50b2c4ab9f3..80ba99e2019 100644 --- a/indra/newview/llviewerinput.h +++ b/indra/newview/llviewerinput.h @@ -38,7 +38,7 @@ class LLWindow; class LLNamedFunction { public: - LLNamedFunction() : mFunction(NULL) { }; + LLNamedFunction() : mFunction(nullptr) { }; ~LLNamedFunction() { }; std::string mName; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ec5381ddfc7..efa3f5cd1e5 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -491,7 +491,7 @@ void LLViewerInventoryItem::fetchFromServer(void) const body["items"][0]["owner_id"] = mPermissions.getOwner(); body["items"][0]["item_id"] = mUUID; - LLCore::HttpHandler::ptr_t handler(new LLInventoryModel::FetchItemHttpHandler(body)); + LLCore::HttpHandler::ptr_t handler = std::make_shared(body); gInventory.requestPost(true, url, body, handler, "Inventory Item"); } } @@ -1712,7 +1712,7 @@ void create_new_item(const std::string& name, LLAssetType::EType asset_type, LLInventoryType::EType inv_type, U32 next_owner_perm, - std::function created_cb = NULL) + std::function created_cb = nullptr) { std::string desc; LLViewerAssetType::generateDescriptionFor(asset_type, desc); @@ -1836,7 +1836,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const L parent_id = gInventory.getRootFolderID(); } - std::function callback_cat_created = NULL; + std::function callback_cat_created = nullptr; if (panel) { LLHandle handle = panel->getHandle(); diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 0dfbf0cceda..a42bdaa2b0a 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -284,9 +284,9 @@ class AddFavoriteLandmarkCallback : public LLInventoryCallback LLUUID mTargetLandmarkId; }; -typedef boost::function inventory_func_type; -typedef boost::function llsd_func_type; -typedef boost::function nullary_func_type; +typedef std::function inventory_func_type; +typedef std::function llsd_func_type; +typedef std::function nullary_func_type; void no_op_inventory_func(const LLUUID&); // A do-nothing inventory_func void no_op_llsd_func(const LLSD&); // likewise for LLSD @@ -470,7 +470,7 @@ void menu_create_inventory_item(LLInventoryPanel* root, const LLSD& userdata, const LLUUID& default_parent_uuid = LLUUID::null); -void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const LLSD& userdata, const LLUUID& default_parent_uuid = LLUUID::null, std::function folder_created_cb = NULL); +void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const LLSD& userdata, const LLUUID& default_parent_uuid = LLUUID::null, std::function folder_created_cb = nullptr); void slam_inventory_folder(const LLUUID& folder_id, const LLSD& contents, diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 8edb21956f5..c4d87d7e16e 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -36,7 +36,6 @@ #include "lltoolmgr.h" #include "llselectmgr.h" #include "llviewermenu.h" -#include "llviewerwindow.h" #include "llwindow.h" #include "llagent.h" #include "llagentcamera.h" @@ -1161,7 +1160,7 @@ void LLViewerJoystick::moveAvatar(bool reset) void LLViewerJoystick::moveFlycam(bool reset) { static LLQuaternion sFlycamRotation; - static LLVector3 sFlycamPosition; + static LLVector3d sFlycamPosition; static F32 sFlycamZoom; if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED @@ -1184,7 +1183,7 @@ void LLViewerJoystick::moveFlycam(bool reset) bool in_build_mode = LLToolMgr::getInstance()->inBuildMode(); if (reset || mResetFlag) { - sFlycamPosition = LLViewerCamera::getInstance()->getOrigin(); + sFlycamPosition = gAgentCamera.getCameraPositionGlobal(); sFlycamRotation = LLViewerCamera::getInstance()->getQuaternion(); sFlycamZoom = LLViewerCamera::getInstance()->getView(); @@ -1287,7 +1286,7 @@ void LLViewerJoystick::moveFlycam(bool reset) } } - sFlycamPosition += LLVector3(sDelta) * sFlycamRotation; + sFlycamPosition += LLVector3d(sDelta[VX], sDelta[VY], sDelta[VZ]) * sFlycamRotation; LLMatrix3 rot_mat(sDelta[3], sDelta[4], sDelta[5]); sFlycamRotation = LLQuaternion(rot_mat)*sFlycamRotation; @@ -1322,7 +1321,8 @@ void LLViewerJoystick::moveFlycam(bool reset) LLMatrix3 mat(sFlycamRotation); LLViewerCamera::getInstance()->setView(sFlycamZoom); - LLViewerCamera::getInstance()->setOrigin(sFlycamPosition); + LLVector3 new_camera_pos = gAgent.getPosAgentFromGlobal(sFlycamPosition); + LLViewerCamera::getInstance()->setOrigin(new_camera_pos); LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]); LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]); LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 8f229850c02..bb956d455fd 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1223,7 +1223,7 @@ bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& na ///////////////////////////////////////////////////////////////////////////////////////// LLCore::HttpHeaders::ptr_t LLViewerMedia::getHttpHeaders() { - LLCore::HttpHeaders::ptr_t headers(new LLCore::HttpHeaders); + LLCore::HttpHeaders::ptr_t headers = std::make_shared(); headers->append(HTTP_OUT_HEADER_ACCEPT, "*/*"); headers->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_XML); @@ -1299,10 +1299,10 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getOpenIDCookieCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("getOpenIDCookieCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpOpts->setFollowRedirects(true); httpOpts->setWantHeaders(true); @@ -1441,10 +1441,10 @@ void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidTok { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("openIDSetupCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("openIDSetupCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); httpOpts->setWantHeaders(true); @@ -2715,10 +2715,10 @@ void LLViewerMediaImpl::mimeDiscoveryCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("mimeDiscoveryCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpAdapter = std::make_shared("mimeDiscoveryCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); // Increment our refcount so that we do not go away while the coroutine is active. this->ref(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 34a3745222e..abaf8135301 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8999,6 +8999,17 @@ class LLViewHighlightTransparent : public view_listener_t } }; +class LLViewHighlightTransparentProbe : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gSavedSettings.setBOOL("RenderReflectionProbeShowTransparent", !gSavedSettings.getBOOL("RenderReflectionProbeShowTransparent")); + // invisible objects skip building their render batches unless sShowDebugAlpha is true, so rebuild batches whenever toggling this flag + gPipeline.rebuildDrawInfo(); + return true; + } +}; + class LLViewCheckHighlightTransparent : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9742,6 +9753,7 @@ void initialize_menus() view_listener_t::addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter"); view_listener_t::addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); view_listener_t::addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent"); + view_listener_t::addMenu(new LLViewHighlightTransparentProbe(), "View.HighlightTransparentProbe"); view_listener_t::addMenu(new LLViewToggleRenderType(), "View.ToggleRenderType"); view_listener_t::addMenu(new LLViewShowHUDAttachments(), "View.ShowHUDAttachments"); view_listener_t::addMenu(new LLZoomer(1.2f), "View.ZoomOut"); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 801ff3c2122..772abb03730 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -530,7 +530,7 @@ void upload_single_file( return; } -void do_bulk_upload(std::vector filenames, bool allow_2k) +void do_bulk_upload(std::vector filenames, bool allow_2k, const LLUUID& dest) { for (std::vector::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter) { @@ -642,7 +642,7 @@ void do_bulk_upload(std::vector filenames, bool allow_2k) LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_TEXTURE, LLFileSystem::WRITE); fmt_file.write(formatted->getData(), formatted->getDataSize()); - LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( + LLResourceUploadInfo::ptr_t assetUploadInfo = std::make_shared( tid, LLAssetType::AT_TEXTURE, asset_name, asset_name, 0, @@ -650,15 +650,16 @@ void do_bulk_upload(std::vector filenames, bool allow_2k) LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - LLAgentBenefitsMgr::current().getTextureUploadCost(raw_image->getWidth(), raw_image->getHeight()) - )); + LLAgentBenefitsMgr::current().getTextureUploadCost(raw_image->getWidth(), raw_image->getHeight()), + dest + ); upload_new_resource(assetUploadInfo); } } else { - LLNewFileResourceUploadInfo* info_p = new LLNewFileResourceUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared( filename, asset_name, asset_name, 0, @@ -666,8 +667,8 @@ void do_bulk_upload(std::vector filenames, bool allow_2k) LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost); - LLResourceUploadInfo::ptr_t uploadInfo(info_p); + expected_upload_cost, + dest); upload_new_resource(uploadInfo); } @@ -687,14 +688,14 @@ void do_bulk_upload(std::vector filenames, bool allow_2k) // Todo: // 1. Decouple bulk upload from material editor // 2. Take into account possiblity of identical textures - LLMaterialEditor::uploadMaterialFromModel(filename, model, i); + LLMaterialEditor::uploadMaterialFromModel(filename, model, i, dest); } } } } } -void do_bulk_upload(std::vector filenames, bool allow_2k, const LLSD& notification, const LLSD& response) +void do_bulk_upload(std::vector filenames, bool allow_2k, const LLSD& notification, const LLSD& response, const LLUUID& dest) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option != 0) @@ -703,7 +704,7 @@ void do_bulk_upload(std::vector filenames, bool allow_2k, const LLS return; } - do_bulk_upload(filenames, allow_2k); + do_bulk_upload(filenames, allow_2k, dest); } bool get_bulk_upload_expected_cost( diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 8f7df48a2e8..e40dd84bc96 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -72,7 +72,7 @@ bool get_bulk_upload_expected_cost( S32& bvh_count, S32& textures_2k_count); -void do_bulk_upload(std::vector filenames, bool allow_2k); +void do_bulk_upload(std::vector filenames, bool allow_2k, const LLUUID &dest_folder); void upload_single_file( const std::vector& filenames, diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e9f6d7175e2..36e8e27800f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -162,8 +162,8 @@ void accept_friendship_coro(std::string url, LLSD notification) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("friendshipResponceErrorProcessing", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("friendshipResponceErrorProcessing", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); if (url.empty()) { LL_WARNS("Friendship") << "Empty capability!" << LL_ENDL; @@ -212,8 +212,8 @@ void decline_friendship_coro(std::string url, LLSD notification, S32 option) } LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("friendshipResponceErrorProcessing", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("friendshipResponceErrorProcessing", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD payload = notification["payload"]; url += "?from=" + payload["from_id"].asString(); @@ -570,8 +570,8 @@ void response_group_invitation_coro(std::string url, LLUUID group_id, bool notif LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("responseGroupInvitation", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("responseGroupInvitation", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD payload; payload["group"] = group_id; @@ -1558,6 +1558,7 @@ void LLOfferInfo::sendReceiveResponse(bool accept, const LLUUID &destination_fol if (mTransactionID.isNull()) { // Not provided, message won't work + LL_WARNS("Messaging") << "Missing transaction id, response for " << mIM << " won't work" << LL_ENDL; return; } @@ -1600,6 +1601,8 @@ void LLOfferInfo::sendReceiveResponse(bool accept, const LLUUID &destination_fol msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 1)); msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(destination_folder_id.mData), sizeof(destination_folder_id.mData)); + + LL_DEBUGS("Messaging") << "Processing" << (U8)(im + 1) << " with transaction id " << mTransactionID << LL_ENDL; } else { @@ -2014,7 +2017,7 @@ bool lure_callback(const LLSD& notification, const LLSD& response) if (notification_ptr) { - LLNotificationFormPtr modified_form(new LLNotificationForm(*notification_ptr->getForm())); + LLNotificationFormPtr modified_form = std::make_shared(*notification_ptr->getForm()); modified_form->setElementEnabled("Teleport", false); modified_form->setElementEnabled("Cancel", false); notification_ptr->updateForm(modified_form); diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 52f383faa96..00743909f06 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -36,9 +36,10 @@ #include "llnotifications.h" #include "llextendedstatus.h" -#include #include +#include + // // Forward declarations // @@ -216,7 +217,7 @@ class LLViewerMessage : public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLViewerMessage); public: - typedef boost::function teleport_started_callback_t; + typedef std::function teleport_started_callback_t; typedef boost::signals2::signal teleport_started_signal_t; boost::signals2::connection setTeleportStartedCallback(teleport_started_callback_t cb); @@ -264,7 +265,7 @@ class LLOfferInfo : public LLNotificationResponderInterface std::string getSanitizedDescription(); void sendReceiveResponse(bool accept, const LLUUID &destination_folder_id); - typedef boost::function respond_function_t; + typedef std::function respond_function_t; typedef std::map respond_function_map_t; respond_function_map_t mRespondFunctions; diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index f11fa09ce94..890580ddff2 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -69,7 +69,7 @@ const std::string MAIN_GRID_LOGIN_URI = "https://login.agni.lindenlab.com/cgi-bi const std::string SL_UPDATE_QUERY_URL = "https://update.secondlife.com/update"; -const std::string MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/"; +const std::string MAIN_GRID_SLURL_BASE = "https://maps.secondlife.com/secondlife/"; const std::string SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app"; const std::string MAIN_GRID_WEB_PROFILE_URL = "https://my.secondlife.com/"; @@ -281,7 +281,7 @@ bool LLGridManager::addGrid(LLSD& grid_data) // Populate to the default values if (!grid_data.has(GRID_LOGIN_PAGE_VALUE)) { - grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/"; + grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("https://") + grid + "/app/login/"; } if (!grid_data.has(GRID_HELPER_URI_VALUE)) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ed4856df114..1675c44c5ce 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2988,8 +2988,8 @@ void LLViewerObject::fetchInventoryFromCapCoro(const LLUUID task_inv) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TaskInventoryRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("TaskInventoryRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); std::string url = obj->mRegionp->getCapability("RequestTaskInventory") + "?task_id=" + obj->mID.asString(); // If we already have a copy of the inventory then add it so the server won't re-send something we already have. // We expect this case to crop up in the case of failed inventory mutations, but it might happen otherwise as well. @@ -7235,7 +7235,7 @@ void LLAlphaObject::getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender void LLStaticViewerObject::updateDrawable(bool force_damped) { // Force an immediate rebuild on any update - if (mDrawable.notNull()) + if (mDrawable.notNull() && mDrawable->getVObj()) { mDrawable->updateXform(true); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index fb9e5fd0a98..1b38fed3bb8 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1055,8 +1055,8 @@ void LLViewerObjectList::fetchObjectCostsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("fetchObjectCostsCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); @@ -1179,8 +1179,8 @@ void LLViewerObjectList::fetchPhisicsFlagsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("fetchPhisicsFlagsCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD idList; U32 objectIndex = 0; diff --git a/indra/newview/llviewerparcelaskplay.h b/indra/newview/llviewerparcelaskplay.h index 720daa2e5d0..563fb130111 100644 --- a/indra/newview/llviewerparcelaskplay.h +++ b/indra/newview/llviewerparcelaskplay.h @@ -38,7 +38,7 @@ class LLViewerParcelAskPlay : public LLSingleton void cleanupSingleton() override; public: // functor expects functor(region_id, parcel_id, url, play/stop) - typedef boost::function ask_callback; + typedef std::function ask_callback; void askToPlay(const LLUUID ®ion_id, const S32 &parcel_id, const std::string &url, ask_callback cb); void cancelNotification(); diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 1925cd23ed2..8439283eb09 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -33,9 +33,10 @@ #include "llparcelselection.h" #include "llui.h" -#include #include +#include + class LLUUID; class LLMessageSystem; class LLParcel; @@ -79,9 +80,9 @@ class LLViewerParcelMgr : public LLSingleton ~LLViewerParcelMgr(); public: - typedef boost::function teleport_finished_callback_t; + typedef std::function teleport_finished_callback_t; typedef boost::signals2::signal teleport_finished_signal_t; - typedef boost::function teleport_failed_callback_t; + typedef std::function teleport_failed_callback_t; typedef boost::signals2::signal teleport_failed_signal_t; static void cleanupGlobals(); diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index b556aef768c..6dead0cf823 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -76,12 +76,12 @@ LLViewerPart::LLViewerPart() : mPartID(0), mLastUpdateTime(0.f), mSkipOffset(0.f), - mVPCallback(NULL), - mImagep(NULL) + mVPCallback(nullptr), + mImagep(nullptr) { - mPartSourcep = NULL; - mParent = NULL; - mChild = NULL; + mPartSourcep = nullptr; + mParent = nullptr; + mChild = nullptr; ++LLViewerPartSim::sParticleCount2 ; } diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 5700d8b2784..f6ee00cb25c 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -125,7 +125,6 @@ #include "llpanel.h" #include "llfloater.h" -#include #include #include #include diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a085bc4d914..cd70f8f9b98 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -252,8 +252,8 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("BaseCapabilitiesRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("BaseCapabilitiesRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result; LLViewerRegion *regionp = NULL; @@ -406,8 +406,8 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("BaseCapabilitiesRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("BaseCapabilitiesRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result; LLViewerRegion *regionp = NULL; @@ -540,8 +540,8 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("BaseCapabilitiesRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("requestSimulatorFeatureCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLViewerRegion *regionp = NULL; S32 attemptNumber = 0; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 244e2b7835c..b3ec8579071 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -295,10 +295,10 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface typedef LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t httpCallback_t; bool requestPostCapability(const std::string &capName, LLSD &postData, - httpCallback_t cbSuccess = NULL, - httpCallback_t cbFailure = NULL); - bool requestGetCapability(const std::string &capName, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL); - bool requestDelCapability(const std::string &capName, httpCallback_t cbSuccess = NULL, httpCallback_t cbFailure = NULL); + httpCallback_t cbSuccess = nullptr, + httpCallback_t cbFailure = nullptr); + bool requestGetCapability(const std::string& capName, httpCallback_t cbSuccess = nullptr, httpCallback_t cbFailure = nullptr); + bool requestDelCapability(const std::string& capName, httpCallback_t cbSuccess = nullptr, httpCallback_t cbFailure = nullptr); /// implements LLCapabilityProvider /*virtual*/ const LLHost& getHost() const; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 0c912e8dbc5..27865f75980 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -37,7 +37,6 @@ #include "llrender.h" #include "llenvironment.h" #include "llerrorcontrol.h" -#include "llatmosphere.h" #include "llworld.h" #include "llsky.h" @@ -582,6 +581,7 @@ void LLViewerShaderMgr::setShaders() unloadShaders(); LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow"); + LLPipeline::RenderAvatarCloth = gSavedSettings.getBOOL("RenderAvatarCloth"); if (gViewerWindow) { @@ -2357,7 +2357,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + gDeferredAvatarProgram.clearPermutations(); add_common_permutations(&gDeferredAvatarProgram); + gDeferredAvatarProgram.addPermutation("AVATAR_CLOTH", LLPipeline::RenderAvatarCloth ? "1" : "0"); success = gDeferredAvatarProgram.createShader(); llassert(success); @@ -3562,7 +3564,7 @@ bool LLViewerShaderMgr::loadShadersInterface() std::string LLViewerShaderMgr::getShaderDirPrefix(void) { - return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/class"); + return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders", "class"); } void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 6f79532ec32..11ca3098fd2 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1111,7 +1111,6 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time) imagep->postCreateTexture(); imagep->mCreatePending = false; - mCreateTextureList.pop(); if (imagep->hasGLTexture() && imagep->getDiscardLevel() < imagep->getDesiredDiscardLevel() && (imagep->getDesiredDiscardLevel() <= MAX_DISCARD_LEVEL)) @@ -1123,6 +1122,8 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time) imagep->scaleDown(); } + mCreateTextureList.pop(); + if (create_timer.getElapsedTimeF32() > max_time) { break; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 5fed98dfe46..187cfc97922 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -86,6 +86,7 @@ #include "raytrace.h" // newview includes +#include "llaccordionctrl.h" #include "llbox.h" #include "llchicletbar.h" #include "llconsole.h" @@ -1883,8 +1884,9 @@ LLViewerWindow::LLViewerWindow(const Params& p) // pass its value right now. Instead, pass it a nullary function that // will, when we later need it, return the value of gKeyboard. // boost::lambda::var() constructs such a functor on the fly. - mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard))); - mViewerWindowListener.reset(new LLViewerWindowListener(this)); + LLWindowListener::KeyboardGetter getter = [](){ return gKeyboard; }; + mWindowListener = std::make_unique(this, getter); + mViewerWindowListener = std::make_unique(this); mSystemChannel.reset(new LLNotificationChannel("System", "Visible", LLNotificationFilters::includeEverything)); mCommunicationChannel.reset(new LLCommunicationChannel("Communication", "Visible")); @@ -3427,6 +3429,8 @@ void LLViewerWindow::updateUI() LLConsole::updateClass(); + // execute postponed arrange calls + LLAccordionCtrl::updateClass(); // animate layout stacks so we have up to date rect for world view LLLayoutStack::updateClass(); @@ -6126,7 +6130,7 @@ bool LLViewerWindow::getUIVisibility() // LLPickInfo::LLPickInfo() : mKeyMask(MASK_NONE), - mPickCallback(NULL), + mPickCallback(nullptr), mPickType(PICK_INVALID), mWantSurfaceInfo(false), mObjectFace(-1), @@ -6137,7 +6141,7 @@ LLPickInfo::LLPickInfo() mNormal(), mTangent(), mBinormal(), - mHUDIcon(NULL), + mHUDIcon(nullptr), mPickTransparent(false), mPickRigged(false), mPickParticle(false) diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 61aa84394c2..f3c7ef32898 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -48,9 +48,10 @@ #include "lltrace.h" #include "llsnapshotmodel.h" -#include #include +#include + class LLView; class LLViewerObject; class LLUUID; @@ -238,7 +239,7 @@ class LLViewerWindow : public LLWindowCallbacks const std::map& args); // signal on update of WorldView rect - typedef boost::function world_rect_callback_t; + typedef std::function world_rect_callback_t; typedef boost::signals2::signal world_rect_signal_t; world_rect_signal_t mOnWorldViewRectUpdated; boost::signals2::connection setOnWorldViewRectUpdated(world_rect_callback_t cb) { return mOnWorldViewRectUpdated.connect(cb); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c6a7a590343..438f84d6255 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3300,7 +3300,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() void LLVOAvatar::idleUpdateWindEffect() { // update wind effect - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)) + if (LLPipeline::RenderAvatarCloth) { F32 hover_strength = 0.f; F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast; @@ -4422,10 +4422,10 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time) LLVector3 pelvisDir( mRoot->getWorldMatrix().getFwdRow4().mV ); - const F32 AVATAR_PELVIS_ROTATE_THRESHOLD_SLOW = 60.0f; - const F32 AVATAR_PELVIS_ROTATE_THRESHOLD_FAST = 2.0f; + static LLCachedControl s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow", 60.0); + static LLCachedControl s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast", 2.0); - F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, AVATAR_PELVIS_ROTATE_THRESHOLD_SLOW, AVATAR_PELVIS_ROTATE_THRESHOLD_FAST); + F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast); if (self_in_mouselook) { diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 653c7e82ebe..e5c14a34a5d 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2211,9 +2211,9 @@ void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("appearanceChangeMetrics", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("appearanceChangeMetrics", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); S32 currentSequence = mMetricSequence; if (S32_MAX == ++mMetricSequence) @@ -2735,7 +2735,7 @@ void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) // Dereferencing the previous callback will cause // updateAppearanceFromCOF to be called, whenever all refs // have resolved. - gAgentAvatarp->mEndCustomizeCallback = NULL; + gAgentAvatarp->mEndCustomizeCallback = nullptr; } } diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index fdd39a0e303..86d08b86581 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -736,7 +736,7 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group) void LLVOGrass::updateDrawable(bool force_damped) { // Force an immediate rebuild on any update - if (mDrawable.notNull()) + if (mDrawable.notNull() && mDrawable->getVObj()) { mDrawable->updateXform(true); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index fbe896ac27d..b941d356a10 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -610,8 +610,8 @@ void LLVoiceChannelGroup::voiceCallCapCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("voiceCallCapCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("voiceCallCapCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD postData; postData["method"] = "call"; diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index bf119638d38..18e1d609872 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -57,7 +57,7 @@ class LLVoiceChannel : public LLVoiceClientStatusObserver typedef boost::signals2::signal state_changed_signal_t; // on current channel changed signal - typedef boost::function channel_changed_callback_t; + typedef std::function channel_changed_callback_t; typedef boost::signals2::signal channel_changed_signal_t; static channel_changed_signal_t sCurrentVoiceChannelChangedSignal; static boost::signals2::connection setCurrentVoiceChannelChangedCallback(channel_changed_callback_t cb, bool at_front = false); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 8792ae3285a..d132cbfa36d 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -1164,9 +1164,9 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("voiceAccountProvision", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + httpAdapter = std::make_shared("voiceAccountProvision", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); int retryCount(0); LLSD result; @@ -1576,8 +1576,8 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo() LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("parcelVoiceInfoRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("parcelVoiceInfoRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->postAndSuspend(httpRequest, url, LLSD()); @@ -4620,7 +4620,7 @@ LLVivoxVoiceClient::participantStatePtr_t LLVivoxVoiceClient::sessionState::addP if(!result) { // participant isn't already in one list or the other. - result.reset(new participantState(useAlternateURI?mSIPURI:uri)); + result = std::make_shared(useAlternateURI?mSIPURI:uri); mParticipantsByURI.insert(participantMap::value_type(result->mURI, result)); mParticipantsChanged = true; diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index fba7098906a..3efcd763e31 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -699,6 +699,7 @@ void LLWebRTCVoiceClient::setCaptureDevice(const std::string& name) { if (mWebRTCDeviceInterface) { + LL_DEBUGS("Voice") << "new capture device is " << name << LL_ENDL; mWebRTCDeviceInterface->setCaptureDevice(name); } } @@ -727,6 +728,9 @@ void LLWebRTCVoiceClient::OnDevicesChangedImpl(const llwebrtc::LLWebRTCVoiceDevi return; } LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE; + + LL_DEBUGS("Voice") << "Reiniting " << LL_ENDL; + std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice"); std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice"); @@ -789,6 +793,7 @@ void LLWebRTCVoiceClient::setRenderDevice(const std::string& name) { if (mWebRTCDeviceInterface) { + LL_DEBUGS("Voice") << "new render device is " << name << LL_ENDL; mWebRTCDeviceInterface->setRenderDevice(name); } } @@ -1304,7 +1309,7 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::ad if (!result) { // participant isn't already in one list or the other. - result.reset(new participantState(agent_id, region)); + result = std::make_shared(agent_id, region); mParticipantsByUUID.insert(participantUUIDMap::value_type(agent_id, result)); result->mAvatarID = agent_id; } @@ -2168,7 +2173,7 @@ bool LLWebRTCVoiceClient::estateSessionState::processConnectionStates() // Only connect if the region supports WebRTC voice server type if (isRegionWebRTCEnabled(neighbor)) { - connectionPtr_t connection(new LLVoiceWebRTCSpatialConnection(neighbor, INVALID_PARCEL_ID, mChannelID)); + connectionPtr_t connection = std::make_shared(neighbor, INVALID_PARCEL_ID, mChannelID); mWebRTCConnections.push_back(connection); connection->setMuteMic(mMuted); // mute will be set for primary connection when that connection comes up @@ -2445,11 +2450,11 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro(connectionPtr_t connection) body["viewer_session"] = connection->mViewerSession; body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( - new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::processIceUpdatesCoro", - LLCore::HttpRequest::DEFAULT_POLICY_ID)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = + std::make_shared("LLVoiceWebRTCAdHocConnection::processIceUpdatesCoro", + LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); @@ -2659,11 +2664,11 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio body["viewer_session"] = connection->mViewerSession; body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( - new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::breakVoiceConnection", - LLCore::HttpRequest::DEFAULT_POLICY_ID)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = + std::make_shared("LLVoiceWebRTCAdHocConnection::breakVoiceConnection", + LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); @@ -2728,11 +2733,11 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() } body["channel_type"] = "local"; body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( - new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::requestVoiceConnection", - LLCore::HttpRequest::DEFAULT_POLICY_ID)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = + std::make_shared("LLVoiceWebRTCAdHocConnection::requestVoiceConnection", + LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); @@ -3338,11 +3343,11 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection() body["channel_type"] = "multiagent"; body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( - new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::requestVoiceConnection", - LLCore::HttpRequest::DEFAULT_POLICY_ID)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = + std::make_shared("LLVoiceWebRTCAdHocConnection::requestVoiceConnection", + LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); httpOpts->setWantHeaders(true); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index aa230f46361..9c0f4baf28b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2693,10 +2693,10 @@ void LLVOVolume::mediaNavigateBounceBack(U8 texture_index) if (mep && impl) { std::string url = mep->getCurrentURL(); - // Look for a ":", if not there, assume "http://" + // Look for a ":", if not there, assume "https://" if (!url.empty() && std::string::npos == url.find(':')) { - url = "http://" + url; + url = "https://" + url; } // If the url we're trying to "bounce back" to is either empty or not // allowed by the whitelist, try the home url. If *that* doesn't work, @@ -2704,10 +2704,10 @@ void LLVOVolume::mediaNavigateBounceBack(U8 texture_index) if (url.empty() || !mep->checkCandidateUrl(url)) { url = mep->getHomeURL(); - // Look for a ":", if not there, assume "http://" + // Look for a ":", if not there, assume "https://" if (!url.empty() && std::string::npos == url.find(':')) { - url = "http://" + url; + url = "https://" + url; } } if (url.empty() || !mep->checkCandidateUrl(url)) @@ -5911,6 +5911,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } else { + static LLCachedControl render_reflection_object(gSavedSettings, "RenderReflectionProbeShowTransparent", false); F32 alpha; if (is_pbr) { @@ -5925,7 +5926,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) drawablep->setState(LLDrawable::HAS_ALPHA); add_face(sAlphaFaces, alpha_count, facep); } - else if (LLDrawPoolAlpha::sShowDebugAlpha || + else if ((LLDrawPoolAlpha::sShowDebugAlpha && (render_reflection_object || !vobj->isReflectionProbe())) || (gPipeline.sRenderHighlight && !drawablep->getParent() && //only root objects are highlighted with red color in this case drawablep->getVObj() && drawablep->getVObj()->flagScripted() && diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 4528ad012d1..132cbf4fcd9 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -83,7 +83,7 @@ void LLWebProfile::setAuthCookie(const std::string& cookie) /*static*/ LLCore::HttpHeaders::ptr_t LLWebProfile::buildDefaultHeaders() { - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + LLCore::HttpHeaders::ptr_t httpHeaders = std::make_shared(); LLSD headers = LLViewerMedia::getInstance()->getHeaders(); for (LLSD::map_iterator it = headers.beginMap(); it != headers.endMap(); ++it) @@ -100,9 +100,9 @@ void LLWebProfile::uploadImageCoro(LLPointer image, std::strin { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared("uploadImageCoro", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared(); LLCore::HttpHeaders::ptr_t httpHeaders; if (dynamic_cast(image.get()) == 0) diff --git a/indra/newview/llwebprofile.h b/indra/newview/llwebprofile.h index a9cfa102c0a..5b3f3f2ce10 100644 --- a/indra/newview/llwebprofile.h +++ b/indra/newview/llwebprofile.h @@ -51,7 +51,7 @@ class LLWebProfile LOG_CLASS(LLWebProfile); public: - typedef boost::function status_callback_t; + typedef std::function status_callback_t; static void uploadImage(LLPointer image, const std::string& caption, bool add_location); static void setAuthCookie(const std::string& cookie); diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index ebcdd537a5a..6d234a9a34e 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -41,9 +41,9 @@ #include "llrootview.h" #include "llsdutil.h" #include "stringize.h" +#include #include #include -#include LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& kbgetter) : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"), @@ -54,7 +54,7 @@ LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& "Given [\"keysym\"], [\"keycode\"] or [\"char\"], inject the specified "; std::string keyExplain = "(integer keycode values, or keysym string from any addKeyName() call in\n" - "http://bitbucket.org/lindenlab/viewer-release/src/tip/indra/llwindow/llkeyboard.cpp )\n"; + "https://github.com/secondlife/viewer/blob/develop/indra/llwindow/llkeyboard.cpp )\n"; std::string mask = "Specify optional [\"mask\"] as an array containing any of \"CTL\", \"ALT\",\n" "\"SHIFT\" or \"MAC_CONTROL\"; the corresponding modifier bits will be combined\n" @@ -69,7 +69,7 @@ LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")\n"; std::string paramsExplain = "[\"path\"] is as for LLUI::getInstance()->resolvePath(), described in\n" - "http://bitbucket.org/lindenlab/viewer-release/src/tip/indra/llui/llui.h\n" + "https://github.com/secondlife/viewer/blob/develop/indra/llui/llui.h\n" "If you omit [\"path\"], you must specify both [\"x\"] and [\"y\"].\n" "If you specify [\"path\"] without both [\"x\"] and [\"y\"], will synthesize (x, y)\n" "in the center of the LLView selected by [\"path\"].\n" @@ -352,7 +352,7 @@ struct WhichButton: public StringLookup }; static WhichButton buttons; -typedef boost::function MouseFunc; +typedef std::function MouseFunc; // Wrap a function returning 'void' to return 'true' instead. I'm sure there's // a more generic way to accomplish this, but generically handling the @@ -363,7 +363,7 @@ typedef boost::function MouseFunc; // seem to overload comma the same way; or at least not with bind().) class MouseFuncTrue { - typedef boost::function MouseFuncVoid; + typedef std::function MouseFuncVoid; MouseFuncVoid mFunc; public: @@ -463,9 +463,9 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) // Instantiate a TemporaryDrilldownFunc to route incoming mouse events // to the target LLView*. But put it on the heap since "path" is - // optional. Nonetheless, manage it with a boost::scoped_ptr so it + // optional. Nonetheless, manage it with a std::unique_ptr so it // will be destroyed when we leave. - tempfunc.reset(new LLView::TemporaryDrilldownFunc(llview::TargetEvent(target))); + tempfunc = std::make_unique(llview::TargetEvent(target)); } // The question of whether the requested LLView actually handled the @@ -484,11 +484,11 @@ void LLWindowListener::mouseDown(LLSD const & request) if (actions.valid) { // Normally you can pass NULL to an LLWindow* without compiler - // complaint, but going through boost::bind() evidently + // complaint, but going through std::bind() evidently // bypasses that special case: it only knows you're trying to pass an // int to a pointer. Explicitly cast NULL to the desired pointer type. - mouseEvent(boost::bind(actions.down, mWindow, - static_cast(NULL), _1, _2), + mouseEvent(std::bind(actions.down, mWindow, + static_cast(NULL), std::placeholders::_1, std::placeholders::_2), request); } } @@ -498,8 +498,7 @@ void LLWindowListener::mouseUp(LLSD const & request) Actions actions(buttons.lookup(request["button"])); if (actions.valid) { - mouseEvent(boost::bind(actions.up, mWindow, - static_cast(NULL), _1, _2), + mouseEvent(std::bind(actions.up, mWindow, static_cast(NULL), std::placeholders::_1, std::placeholders::_2), request); } } @@ -511,8 +510,8 @@ void LLWindowListener::mouseMove(LLSD const & request) // void, whereas mouseEvent() accepts a function returning bool -- and // uses that bool return. Use MouseFuncTrue to construct a callable that // returns bool anyway. - mouseEvent(MouseFuncTrue(boost::bind(&LLWindowCallbacks::handleMouseMove, mWindow, - static_cast(NULL), _1, _2)), + mouseEvent(MouseFuncTrue(std::bind(&LLWindowCallbacks::handleMouseMove, mWindow, static_cast(NULL), std::placeholders::_1, + std::placeholders::_2)), request); } diff --git a/indra/newview/llwindowlistener.h b/indra/newview/llwindowlistener.h index 207f64c8c02..9908a9c451e 100644 --- a/indra/newview/llwindowlistener.h +++ b/indra/newview/llwindowlistener.h @@ -28,7 +28,7 @@ #define LL_LLWINDOWLISTENER_H #include "lleventapi.h" -#include +#include class LLKeyboard; class LLViewerWindow; @@ -36,7 +36,7 @@ class LLViewerWindow; class LLWindowListener : public LLEventAPI { public: - typedef boost::function KeyboardGetter; + typedef std::function KeyboardGetter; LLWindowListener(LLViewerWindow * window, const KeyboardGetter& kbgetter); void getInfo(LLSD const & evt); diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index 4e3a7a8788c..aabcb2e5149 100644 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -101,8 +101,8 @@ void LLEnvironmentRequest::environmentRequestCoro(std::string url, LLEnvironment LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); S32 requestId = ++LLEnvironmentRequest::sLastRequest; LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EnvironmentRequest", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("EnvironmentRequest", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->getAndSuspend(httpRequest, url); @@ -193,8 +193,8 @@ void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content, LLE { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EnvironmentApply", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + httpAdapter = std::make_shared("EnvironmentApply", httpPolicy); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared(); LLSD result = httpAdapter->postAndSuspend(httpRequest, url, content); diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index aab19a4d5fd..68e7f3ee29f 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -28,7 +28,6 @@ #define LL_LLWORLDMAP_H #include "llworldmipmap.h" -#include #include "v3dmath.h" #include "lluuid.h" diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index c60d075e0c1..e81e6b45966 100644 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -43,7 +43,7 @@ LLWorldMapMessage::LLWorldMapMessage() : mSLURLRegionName(), mSLURLRegionHandle(0), mSLURL(), - mSLURLCallback(0), + mSLURLCallback(nullptr), mSLURLTeleport(false) { } @@ -215,14 +215,14 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) // Handle the SLURL callback if any url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback; - if(callback != NULL) + if (callback != nullptr) { U64 handle = to_region_handle(x_world, y_world); // Check if we reached the requested region if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0) || (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle)) { - LLWorldMapMessage::getInstance()->mSLURLCallback = NULL; + LLWorldMapMessage::getInstance()->mSLURLCallback = nullptr; LLWorldMapMessage::getInstance()->mSLURLRegionName.clear(); LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0; diff --git a/indra/newview/llworldmapmessage.h b/indra/newview/llworldmapmessage.h index 357d31ccc1b..87ae935bb95 100644 --- a/indra/newview/llworldmapmessage.h +++ b/indra/newview/llworldmapmessage.h @@ -27,7 +27,7 @@ #ifndef LL_LLWORLDMAPMESSAGE_H #define LL_LLWORLDMAPMESSAGE_H -#include "boost/function.hpp" +#include // Handling of messages (send and process) as well as SLURL callback if necessary class LLMessageSystem; @@ -38,7 +38,7 @@ class LLWorldMapMessage : public LLSingleton ~LLWorldMapMessage(); public: - typedef boost::function + typedef std::function url_callback_t; // Process incoming answers to map stuff requests diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp index 92e6c88752d..758615a7302 100644 --- a/indra/newview/llxmlrpclistener.cpp +++ b/indra/newview/llxmlrpclistener.cpp @@ -241,7 +241,7 @@ class Poller } LLSD http_params = command.get("http_params"); - mTransaction.reset(new LLXMLRPCTransaction(mUri, mMethod, request_params, http_params)); + mTransaction = std::make_unique(mUri, mMethod, request_params, http_params); mPreviousStatus = mTransaction->status(NULL); // Now ensure that we get regular callbacks to poll for completion. diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 7fbcb5fc048..7b0bf6f251c 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -50,13 +50,6 @@ #include "llappviewer.h" #include "lltrans.h" -#include "boost/move/unique_ptr.hpp" - -namespace boost -{ - using ::boost::movelib::unique_ptr; // move unique_ptr into the boost namespace. -} - // Static instance of LLXMLRPCListener declared here so that every time we // bring in this code, we instantiate a listener. If we put the static // instance of LLXMLRPCListener into llxmlrpclistener.cpp, the linker would @@ -194,11 +187,11 @@ LLXMLRPCTransaction::Impl::Impl if (!mHttpRequest) { - mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest); + mHttpRequest = std::make_shared(); } // LLRefCounted starts with a 1 ref, so don't add a ref in the smart pointer - httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()); + httpOpts = std::make_shared(); // Delay between repeats will start from 5 sec and grow to 20 sec with each repeat httpOpts->setMinBackoff((LLCore::HttpTime)5E6L); @@ -221,7 +214,7 @@ LLXMLRPCTransaction::Impl::Impl httpOpts->setSSLVerifyHost(vefifySSLCert ? 2 : 0); // LLRefCounted starts with a 1 ref, so don't add a ref in the smart pointer - httpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()); + httpHeaders = std::make_shared(); httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML); @@ -244,7 +237,7 @@ LLXMLRPCTransaction::Impl::Impl body->append(request.c_str(), request.size()); - mHandler = LLXMLRPCTransaction::Handler::ptr_t(new Handler(mHttpRequest, this)); + mHandler = std::make_shared(mHttpRequest, this); mPostH = mHttpRequest->requestPost(LLCore::HttpRequest::DEFAULT_POLICY_ID, mURI, body.get(), httpOpts, httpHeaders, mHandler); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fc66e9283e0..d2aebfbce53 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -218,6 +218,7 @@ S32 LLPipeline::RenderBufferVisualization; bool LLPipeline::RenderMirrors; S32 LLPipeline::RenderHeroProbeUpdateRate; S32 LLPipeline::RenderHeroProbeConservativeUpdateMultiplier; +bool LLPipeline::RenderAvatarCloth; LLTrace::EventStatHandle LLPipeline::sStatBatchSize("renderbatchsize"); const U32 LLPipeline::MAX_PREVIEW_WIDTH = 512; @@ -601,6 +602,7 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderMirrors"); connectRefreshCachedSettingsSafe("RenderHeroProbeUpdateRate"); connectRefreshCachedSettingsSafe("RenderHeroProbeConservativeUpdateMultiplier"); + connectRefreshCachedSettingsSafe("RenderAvatarCloth"); LLPointer cntrl_ptr = gSavedSettings.getControl("CollectFontVertexBuffers"); if (cntrl_ptr.notNull()) @@ -1133,6 +1135,7 @@ void LLPipeline::refreshCachedSettings() RenderMirrors = gSavedSettings.getBOOL("RenderMirrors"); RenderHeroProbeUpdateRate = gSavedSettings.getS32("RenderHeroProbeUpdateRate"); RenderHeroProbeConservativeUpdateMultiplier = gSavedSettings.getS32("RenderHeroProbeConservativeUpdateMultiplier"); + RenderAvatarCloth = gSavedSettings.getBOOL("RenderAvatarCloth"); sReflectionProbesEnabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionsEnabled") && gSavedSettings.getBOOL("RenderReflectionsEnabled"); RenderSpotLight = nullptr; @@ -2952,7 +2955,7 @@ void LLPipeline::markMoved(LLDrawable *drawablep, bool damped_motion) void LLPipeline::markShift(LLDrawable *drawablep) { - if (!drawablep || drawablep->isDead()) + if (!drawablep || drawablep->isDead() || !drawablep->getVObj()) { return; } @@ -2986,7 +2989,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset) iter != mShiftList.end(); iter++) { LLDrawable *drawablep = *iter; - if (drawablep->isDead()) + if (drawablep->isDead() || !drawablep->getVObj()) { continue; } @@ -8347,34 +8350,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ bindReflectionProbes(shader); - if (gAtmosphere) - { - // bind precomputed textures necessary for calculating sun and sky luminance - channel = shader.enableTexture(LLShaderMgr::TRANSMITTANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); - } - - channel = shader.enableTexture(LLShaderMgr::SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); - } - - channel = shader.enableTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); - } - - channel = shader.enableTexture(LLShaderMgr::ILLUMINANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); - } - } - /*if (gCubeSnapshot) { // we only really care about the first two values, but the shader needs increasing separation between clip planes shader.uniform4f(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1.f, 64.f, 128.f, 256.f); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index dff0af46e20..c051306385e 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -1087,6 +1087,7 @@ class LLPipeline static bool RenderMirrors; static S32 RenderHeroProbeUpdateRate; static S32 RenderHeroProbeConservativeUpdateMultiplier; + static bool RenderAvatarCloth; }; void render_bbox(const LLVector3 &min, const LLVector3 &max); diff --git a/indra/newview/skins/default/textures/icon_auction.tga b/indra/newview/skins/default/textures/icon_auction.tga new file mode 100644 index 00000000000..d121833b475 Binary files /dev/null and b/indra/newview/skins/default/textures/icon_auction.tga differ diff --git a/indra/newview/skins/default/textures/icon_event.tga b/indra/newview/skins/default/textures/icon_event.tga new file mode 100644 index 00000000000..7805dbce60e Binary files /dev/null and b/indra/newview/skins/default/textures/icon_event.tga differ diff --git a/indra/newview/skins/default/textures/icon_event_adult.tga b/indra/newview/skins/default/textures/icon_event_adult.tga new file mode 100644 index 00000000000..c344fb1e788 Binary files /dev/null and b/indra/newview/skins/default/textures/icon_event_adult.tga differ diff --git a/indra/newview/skins/default/textures/icon_event_mature.tga b/indra/newview/skins/default/textures/icon_event_mature.tga new file mode 100644 index 00000000000..61c879bc923 Binary files /dev/null and b/indra/newview/skins/default/textures/icon_event_mature.tga differ diff --git a/indra/newview/skins/default/textures/icon_place.tga b/indra/newview/skins/default/textures/icon_place.tga new file mode 100644 index 00000000000..2170c984994 Binary files /dev/null and b/indra/newview/skins/default/textures/icon_place.tga differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index d650e7e791b..ff5737ab49a 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -837,8 +837,14 @@ with the same filename but different name + + + + + + diff --git a/indra/newview/skins/default/xui/da/panel_status_bar.xml b/indra/newview/skins/default/xui/da/panel_status_bar.xml index 6e7bdfc1884..a976c3f17a6 100644 --- a/indra/newview/skins/default/xui/da/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/da/panel_status_bar.xml @@ -12,7 +12,7 @@ BÃ¥ndbredde - + [hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] diff --git a/indra/newview/skins/default/xui/de/panel_status_bar.xml b/indra/newview/skins/default/xui/de/panel_status_bar.xml index 0829814220e..7e305fb16b7 100644 --- a/indra/newview/skins/default/xui/de/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/de/panel_status_bar.xml @@ -6,7 +6,7 @@ Bandbreite - + [hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] diff --git a/indra/newview/skins/default/xui/en/floater_directory.xml b/indra/newview/skins/default/xui/en/floater_directory.xml new file mode 100644 index 00000000000..3274474337d --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_directory.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_gesture.xml b/indra/newview/skins/default/xui/en/floater_gesture.xml index 832716c6004..51e740d687a 100644 --- a/indra/newview/skins/default/xui/en/floater_gesture.xml +++ b/indra/newview/skins/default/xui/en/floater_gesture.xml @@ -34,10 +34,14 @@ multi_select="true" top="20" name="gesture_list"> + + width="143" /> + + - + + + + name="Capture 360"> @@ -1551,6 +1556,18 @@ function="World.EnvPreset" + + + + + + name="Object-Object Occlusion"> @@ -3486,6 +3502,16 @@ function="World.EnvPreset" function="Advanced.HandleAttachedLightParticles" parameter="RenderAttachedParticles" /> + + + + diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index dbd513afe8b..d0261a930c1 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2465,6 +2465,17 @@ You already have a landmark for this location. fail + +Viewer wasn't able to get region's location. Region might be temporarily unavailable or was removed. + + fail + + + + Searching... + + + None Found. + + + Enter search terms: + + + + + + + + + + + + + + + + + + + + +