diff --git a/.hgtags b/.hgtags index 37f7f52848..4e5f3061ec 100755 --- a/.hgtags +++ b/.hgtags @@ -552,3 +552,4 @@ e9d350764dfbf5a46229e627547ef5c1b1eeef00 4.0.2-release 0a5de9ec2cb868f367501024d8d6958c20869053 4.0.4-release 450de775fff66a011be1a001acd117cc623c445d 4.0.5-release 4070611edd95eb3a683d1cd97c4c07fe67793812 4.0.6-release +33981d8130f031597b4c7f4c981b18359afb61a0 4.0.7-release diff --git a/build.sh b/build.sh index fd4b911fc5..185b7c9592 100755 --- a/build.sh +++ b/build.sh @@ -16,12 +16,6 @@ # * The special style in which python is invoked is intentional to permit # use of a native python install on windows - which requires paths in DOS form -check_for() -{ - if [ -e "$2" ]; then found_dict='FOUND'; else found_dict='MISSING'; fi - echo "$1 ${found_dict} '$2' " 1>&2 -} - build_dir_Darwin() { echo build-darwin-i386 @@ -101,13 +95,14 @@ pre_build() && [ -r "$master_message_template_checkout/message_template.msg" ] \ && template_verifier_master_url="-DTEMPLATE_VERIFIER_MASTER_URL=file://$master_message_template_checkout/message_template.msg" - "$autobuild" configure -c $variant -- \ + "$autobuild" configure --quiet -c $variant -- \ -DPACKAGE:BOOL=ON \ -DRELEASE_CRASH_REPORTING:BOOL=ON \ -DVIEWER_CHANNEL:STRING="\"$viewer_channel\"" \ -DGRID:STRING="\"$viewer_grid\"" \ -DLL_TESTS:BOOL="$run_tests" \ - -DTEMPLATE_VERIFIER_OPTIONS:STRING="$template_verifier_options" $template_verifier_master_url + -DTEMPLATE_VERIFIER_OPTIONS:STRING="$template_verifier_options" $template_verifier_master_url \ + || fatal "$variant configuration failed" end_section "Configure $variant" } @@ -146,52 +141,46 @@ build() local variant="$1" if $build_viewer then - "$autobuild" build --no-configure -c $variant - build_ok=$? - + "$autobuild" build --no-configure -c $variant || fatal "failed building $variant" + # Run build extensions - if [ $build_ok -eq 0 -a -d ${build_dir}/packages/build-extensions ]; then - for extension in ${build_dir}/packages/build-extensions/*.sh; do + if [ $build_ok -eq 0 -a -d ${build_dir}/packages/build-extensions ] + then + for extension in ${build_dir}/packages/build-extensions/*.sh + do begin_section "Extension $extension" . $extension end_section "Extension $extension" - if [ $build_ok -ne 0 ]; then - break - fi done fi # *TODO: Make this a build extension. - package_llphysicsextensions_tpv - tpvlib_build_ok=$? - if [ $build_ok -eq 0 -a $tpvlib_build_ok -eq 0 ] - then + package_llphysicsextensions_tpv || fatal "failed building llphysicsextensions packages" + + echo true >"$build_dir"/build_ok + else + echo "Skipping build due to configuration build_viewer=${build_viewer}" echo true >"$build_dir"/build_ok - else - echo false >"$build_dir"/build_ok - fi fi } -# Check to see if we were invoked from the wrapper, if not, re-exec ourselves from there -if [ "x$arch" = x ] +################################################################ +# Start of the actual script +################################################################ + +# Check to see if we were invoked from the master buildscripts wrapper, if not, fail +if [ "x${BUILDSCRIPTS_SUPPORT_FUNCTIONS}" = x ] then - top=`hg root` - if [ -x "$top/../buildscripts/hg/bin/build.sh" ] - then - exec "$top/../buildscripts/hg/bin/build.sh" "$top" - else - cat <&2 exit 1 - fi fi # Check to see if we're skipping the platform -eval '$build_'"$arch" || pass +if ! eval '$build_'"$arch" +then + record_event "building on architecture $arch is disabled" + pass +fi # ensure AUTOBUILD is in native path form for child processes AUTOBUILD="$(native_path "$AUTOBUILD")" @@ -204,7 +193,7 @@ then fi # load autobuild provided shell functions and variables -eval "$("$autobuild" source_environment)" +eval "$("$autobuild" --quiet source_environment)" # something about the additional_packages mechanism messes up buildscripts results.py on Linux # since we don't care about those packages on Linux, just zero it out, yes - a HACK @@ -235,14 +224,13 @@ do begin_section "Initialize $variant Build Directory" rm -rf "$build_dir" - mkdir -p "$build_dir" mkdir -p "$build_dir/tmp" end_section "Initialize $variant Build Directory" if pre_build "$variant" "$build_dir" then begin_section "Build $variant" - build "$variant" "$build_dir" 2>&1 | tee -a "$build_log" | sed -n 's/^ *\(##teamcity.*\)/\1/p' + build "$variant" "$build_dir" if `cat "$build_dir/build_ok"` then case "$variant" in @@ -255,7 +243,7 @@ do then record_dependencies_graph # defined in buildscripts/hg/bin/build.sh else - record_event "TBD - no dependency graph for linux (probable python version dependency)" 1>&2 + record_event "TBD - no dependency graph for linux (probable python version dependency)" fi end_section "Autobuild metadata" else @@ -306,11 +294,10 @@ then dch --force-bad-version \ --distribution unstable \ --newversion "${VIEWER_VERSION}" \ - "Automated build #$build_id, repository $branch revision $revision." \ - >> "$build_log" 2>&1 + "Automated build #$build_id, repository $branch revision $revision." # build the debian package - $pkg_default_debuild_command >>"$build_log" 2>&1 || record_failure "\"$pkg_default_debuild_command\" failed." + $pkg_default_debuild_command || record_failure "\"$pkg_default_debuild_command\" failed." # Unmangle the changelog file hg revert debian/changelog @@ -372,10 +359,10 @@ EOF end_section "Upload Debian Repository" else - echo debian build not enabled + record_event "debian build not enabled" fi else - echo skipping debian build due to failed build. + record_event "skipping debian build due to failed build" fi fi @@ -389,7 +376,7 @@ then package=$(installer_$arch) if [ x"$package" = x ] || test -d "$package" then - # Coverity doesn't package, so it's ok, anything else is fail + record_event "??? mystery event $package // $build_coverity" succeeded=$build_coverity else # Upload base package. @@ -441,12 +428,12 @@ then fi end_section Upload Installer else - echo skipping upload of installer + record_event "skipping upload of installer" fi else - echo skipping upload of installer due to failed build. + record_event "skipping upload of installer due to failed build" fi # The branch independent build.sh script invoking this script will finish processing diff --git a/doc/contributions.txt b/doc/contributions.txt index a5f161e234..ccb91ed14d 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -68,13 +68,10 @@ Alejandro Rosenthal Aleric Inglewood OPEN-38 SNOW-240 - SNOW-477 SNOW-522 SNOW-626 - SNOW-744 SNOW-756 SNOW-764 - SNOW-766 SNOW-800 VWR-10001 VWR-10579 @@ -100,8 +97,11 @@ Aleric Inglewood VWR-24366 VWR-24519 VWR-24520 + SNOW-84 + SNOW-477 + SNOW-744 + SNOW-766 STORM-163 - STORM-864 STORM-955 STORM-960 STORM-1793 @@ -187,12 +187,17 @@ Ansariel Hiller STORM-1984 STORM-1979 STORM-2083 - STORM-2094 STORM-2105 MAINT-5533 + STORM-2094 MAINT-5756 MAINT-4677 MAINT-2199 + MAINT-6300 + MAINT-6397 + MAINT-6432 + STORM-2133 + MAINT-6511 Aralara Rajal Arare Chantilly CHUIBUG-191 @@ -1388,9 +1393,6 @@ Tofu Buzzard SH-2477 STORM-1684 STORM-1819 - STORM-1921 - STORM-1927 - STORM-1928 Tony Kembia Tonya Souther STORM-1905 diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp index 60721977cd..7ea42a3fc0 100644 --- a/indra/llcommon/indra_constants.cpp +++ b/indra/llcommon/indra_constants.cpp @@ -60,6 +60,10 @@ const LLUUID IMG_SMOKE_POOF ("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On d const LLUUID IMG_BIG_EXPLOSION_1 ("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver const LLUUID IMG_BIG_EXPLOSION_2 ("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver +const LLUUID IMG_ALPHA_GRAD ("e97cf410-8e61-7005-ec06-629eba4cd1fb"); // VIEWER +const LLUUID IMG_ALPHA_GRAD_2D ("38b86f85-2575-52a9-a531-23108d8da837"); // VIEWER +const LLUUID IMG_TRANSPARENT ("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); // VIEWER + const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index b484b18d4f..4866da0e78 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -200,6 +200,10 @@ LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF; LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1; LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2; +LL_COMMON_API extern const LLUUID IMG_ALPHA_GRAD; +LL_COMMON_API extern const LLUUID IMG_ALPHA_GRAD_2D; +LL_COMMON_API extern const LLUUID IMG_TRANSPARENT; + LL_COMMON_API extern const LLUUID IMG_BLOOM1; LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL; LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL; diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f3b8999883..c45db3b185 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -576,6 +576,33 @@ std::string utf8str_truncate(const std::string& utf8str, const S32 max_len) } } +std::string utf8str_symbol_truncate(const std::string& utf8str, const S32 symbol_len) +{ + if (0 == symbol_len) + { + return std::string(); + } + if ((S32)utf8str.length() <= symbol_len) + { + return utf8str; + } + else + { + int len = 0, byteIndex = 0; + const char* aStr = utf8str.c_str(); + size_t origSize = utf8str.size(); + + for (byteIndex = 0; len < symbol_len && byteIndex < origSize; byteIndex++) + { + if ((aStr[byteIndex] & 0xc0) != 0x80) + { + len += 1; + } + } + return utf8str.substr(0, byteIndex); + } +} + std::string utf8str_substChar( const std::string& utf8str, const llwchar target_char, diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 1364a08949..9a24087fcd 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -564,6 +564,17 @@ LL_COMMON_API S32 utf8str_compare_insensitive( const std::string& lhs, const std::string& rhs); +/** +* @brief Properly truncate a utf8 string to a maximum character count. +* +* If symbol_len is longer than the string passed in, the return +* value == utf8str. +* @param utf8str A valid utf8 string to truncate. +* @param symbol_len The maximum number of symbols in the return value. +* @return Returns a valid utf8 string with symbol count <= max_len. +*/ +LL_COMMON_API std::string utf8str_symbol_truncate(const std::string& utf8str, const S32 symbol_len); + /** * @brief Replace all occurences of target_char with replace_char * diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index f7a815057b..809583557a 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -793,6 +793,7 @@ const U8* LLImageBase::getData() const if(mBadBufferAllocation) { LL_WARNS() << "Bad memory allocation for the image buffer!" << LL_ENDL ; + return NULL; } return mData; @@ -802,7 +803,8 @@ U8* LLImageBase::getData() { if(mBadBufferAllocation) { - LL_WARNS() << "Bad memory allocation for the image buffer!" << LL_ENDL ; + LL_WARNS() << "Bad memory allocation for the image buffer!" << LL_ENDL; + return NULL; } return mData; @@ -914,30 +916,30 @@ void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components) sGlobalRawMemory += getDataSize(); } -BOOL LLImageRaw::resize(U16 width, U16 height, S8 components) +bool LLImageRaw::resize(U16 width, U16 height, S8 components) { if ((getWidth() == width) && (getHeight() == height) && (getComponents() == components)) { - return TRUE; + return true; } // Reallocate the data buffer. deleteData(); allocateDataSize(width,height,components); - return TRUE; + return true; } -BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, - const U8 *data, U32 stride, BOOL reverse_y) +bool LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, + const U8 *data, U32 stride, bool reverse_y) { if (!getData()) { - return FALSE; + return false; } if (!data) { - return FALSE; + return false; } // Should do some simple bounds checking @@ -952,7 +954,7 @@ BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, data + from_offset, getComponents()*width); } - return TRUE; + return true; } void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) @@ -1007,7 +1009,7 @@ void LLImageRaw::verticalFlip() } -void LLImageRaw::expandToPowerOfTwo(S32 max_dim, BOOL scale_image) +void LLImageRaw::expandToPowerOfTwo(S32 max_dim, bool scale_image) { // Find new sizes S32 new_width = expandDimToPowerOfTwo(getWidth(), max_dim); @@ -1016,7 +1018,7 @@ void LLImageRaw::expandToPowerOfTwo(S32 max_dim, BOOL scale_image) scale( new_width, new_height, scale_image ); } -void LLImageRaw::contractToPowerOfTwo(S32 max_dim, BOOL scale_image) +void LLImageRaw::contractToPowerOfTwo(S32 max_dim, bool scale_image) { // Find new sizes S32 new_width = contractDimToPowerOfTwo(getWidth(), MIN_IMAGE_SIZE); @@ -1416,7 +1418,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) } -BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) +bool LLImageRaw::scale( S32 new_width, S32 new_height, bool scale_image_data ) { llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); @@ -1425,7 +1427,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) if( (old_width == new_width) && (old_height == new_height) ) { - return TRUE; // Nothing to do. + return true; // Nothing to do. } // Reallocate the data buffer. @@ -1465,7 +1467,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) U8 *new_data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), new_data_size); if(NULL == new_data) { - return FALSE; + return false; } bilinear_scale(getData(), old_width, old_height, getComponents(), old_width*getComponents(), new_data, new_width, new_height, getComponents(), new_width*getComponents()); @@ -1505,7 +1507,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) } } - return TRUE ; + return true ; } void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ) @@ -1824,7 +1826,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip ifs.read ((char*)buffer, length); ifs.close(); - BOOL success; + bool success; success = image->updateData(); if (success) @@ -2000,7 +2002,7 @@ S32 LLImageFormatted::calcDiscardLevelBytes(S32 bytes) //---------------------------------------------------------------------------- // Subclasses that can handle more than 4 channels should override this function. -BOOL LLImageFormatted::decodeChannels(LLImageRaw* raw_image,F32 decode_time, S32 first_channel, S32 max_channel) +bool LLImageFormatted::decodeChannels(LLImageRaw* raw_image,F32 decode_time, S32 first_channel, S32 max_channel) { llassert( (first_channel == 0) && (max_channel == 4) ); return decode( raw_image, decode_time ); // Loads first 4 channels by default. @@ -2054,7 +2056,7 @@ void LLImageFormatted::sanityCheck() //---------------------------------------------------------------------------- -BOOL LLImageFormatted::copyData(U8 *data, S32 size) +bool LLImageFormatted::copyData(U8 *data, S32 size) { if ( data && ((data != getData()) || (size != getDataSize())) ) { @@ -2062,7 +2064,7 @@ BOOL LLImageFormatted::copyData(U8 *data, S32 size) allocateData(size); memcpy(getData(), data, size); /* Flawfinder: ignore */ } - return TRUE; + return true; } // LLImageFormatted becomes the owner of data @@ -2098,7 +2100,7 @@ void LLImageFormatted::appendData(U8 *data, S32 size) //---------------------------------------------------------------------------- -BOOL LLImageFormatted::load(const std::string &filename, int load_size) +bool LLImageFormatted::load(const std::string &filename, int load_size) { resetLastError(); @@ -2114,12 +2116,12 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) if (!apr_file) { setLastError("Unable to open file for reading", filename); - return FALSE; + return false; } if (file_size == 0) { setLastError("File is empty",filename); - return FALSE; + return false; } // Constrain the load size to acceptable values @@ -2127,7 +2129,7 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) { load_size = file_size; } - BOOL res; + bool res; U8 *data = allocateData(load_size); apr_size_t bytes_read = load_size; apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read @@ -2135,7 +2137,7 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) { deleteData(); setLastError("Unable to read file",filename); - res = FALSE; + res = false; } else { @@ -2145,7 +2147,7 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) return res; } -BOOL LLImageFormatted::save(const std::string &filename) +bool LLImageFormatted::save(const std::string &filename) { resetLastError(); @@ -2154,15 +2156,15 @@ BOOL LLImageFormatted::save(const std::string &filename) if (!outfile.getFileHandle()) { setLastError("Unable to open file for writing", filename); - return FALSE; + return false; } outfile.write(getData(), getDataSize()); outfile.close() ; - return TRUE; + return true; } -// BOOL LLImageFormatted::save(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type) +// bool LLImageFormatted::save(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type) // Depricated to remove VFS dependency. // Use: // LLVFile::writeFile(image->getData(), image->getDataSize(), vfs, uuid, type); diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 089cbeb811..f62aa69b2a 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -206,11 +206,11 @@ public: /*virtual*/ U8* allocateData(S32 size = -1); /*virtual*/ U8* reallocateData(S32 size); - BOOL resize(U16 width, U16 height, S8 components); + bool resize(U16 width, U16 height, S8 components); //U8 * getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const; - BOOL setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, - const U8 *data, U32 stride = 0, BOOL reverse_y = FALSE); + bool setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, + const U8 *data, U32 stride = 0, bool reverse_y = false); void clear(U8 r=0, U8 g=0, U8 b=0, U8 a=255); @@ -219,10 +219,10 @@ public: static S32 biasedDimToPowerOfTwo(S32 curr_dim, S32 max_dim = MAX_IMAGE_SIZE); static S32 expandDimToPowerOfTwo(S32 curr_dim, S32 max_dim = MAX_IMAGE_SIZE); static S32 contractDimToPowerOfTwo(S32 curr_dim, S32 min_dim = MIN_IMAGE_SIZE); - void expandToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE); - void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE); + void expandToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, bool scale_image = true); + void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, bool scale_image = true); void biasedScaleToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE); - BOOL scale( S32 new_width, S32 new_height, BOOL scale_image = TRUE ); + bool scale( S32 new_width, S32 new_height, bool scale_image = true ); // Fill the buffer with a constant color void fill( const LLColor4U& color ); @@ -324,23 +324,23 @@ public: // getRawDiscardLevel() by default returns mDiscardLevel, but may be overridden (LLImageJ2C) virtual S8 getRawDiscardLevel() { return mDiscardLevel; } - BOOL load(const std::string& filename, int load_size = 0); - BOOL save(const std::string& filename); + bool load(const std::string& filename, int load_size = 0); + bool save(const std::string& filename); - virtual BOOL updateData() = 0; // pure virtual + virtual bool updateData() = 0; // pure virtual void setData(U8 *data, S32 size); void appendData(U8 *data, S32 size); // Loads first 4 channels. - virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time) = 0; + virtual bool decode(LLImageRaw* raw_image, F32 decode_time) = 0; // Subclasses that can handle more than 4 channels should override this function. - virtual BOOL decodeChannels(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); + virtual bool decodeChannels(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); - virtual BOOL encode(const LLImageRaw* raw_image, F32 encode_time) = 0; + virtual bool encode(const LLImageRaw* raw_image, F32 encode_time) = 0; S8 getCodec() const; - BOOL isDecoding() const { return mDecoding ? TRUE : FALSE; } - BOOL isDecoded() const { return mDecoded ? TRUE : FALSE; } + bool isDecoding() const { return mDecoding; } + bool isDecoded() const { return mDecoded; } void setDiscardLevel(S8 discard_level) { mDiscardLevel = discard_level; } S8 getDiscardLevel() const { return mDiscardLevel; } S8 getLevels() const { return mLevels; } @@ -351,7 +351,7 @@ public: virtual void setLastError(const std::string& message, const std::string& filename = std::string()); protected: - BOOL copyData(U8 *data, S32 size); // calls updateData() + bool copyData(U8 *data, S32 size); // calls updateData() protected: S8 mCodec; diff --git a/indra/llimage/llimagebmp.cpp b/indra/llimage/llimagebmp.cpp index d64b5b46c8..e20e1192ed 100644 --- a/indra/llimage/llimagebmp.cpp +++ b/indra/llimage/llimagebmp.cpp @@ -78,7 +78,7 @@ LLImageBMP::LLImageBMP() mColorPalette( NULL ), mBitmapOffset( 0 ), mBitsPerPixel( 0 ), - mOriginAtTop( FALSE ) + mOriginAtTop( false ) { mBitfieldMask[0] = 0; mBitfieldMask[1] = 0; @@ -92,7 +92,7 @@ LLImageBMP::~LLImageBMP() } -BOOL LLImageBMP::updateData() +bool LLImageBMP::updateData() { resetLastError(); @@ -101,7 +101,7 @@ BOOL LLImageBMP::updateData() if (!mdata || (0 == getDataSize())) { setLastError("Uninitialized instance of LLImageBMP"); - return FALSE; + return false; } // Read the bitmap headers in order to get all the useful info @@ -120,12 +120,12 @@ BOOL LLImageBMP::updateData() if ((mdata[0] != 'B') || (mdata[1] != 'A')) { setLastError("OS/2 bitmap array BMP files are not supported"); - return FALSE; + return false; } else { setLastError("Does not appear to be a bitmap file"); - return FALSE; + return false; } } @@ -160,12 +160,12 @@ BOOL LLImageBMP::updateData() llendianswizzleone(header.mNumColors); llendianswizzleone(header.mNumColorsImportant); - BOOL windows_nt_version = FALSE; - BOOL windows_95_version = FALSE; + bool windows_nt_version = false; + bool windows_95_version = false; if( 12 == header.mSize ) { setLastError("Windows 2.x and OS/2 1.x BMP files are not supported"); - return FALSE; + return false; } else if( 40 == header.mSize ) @@ -173,7 +173,7 @@ BOOL LLImageBMP::updateData() if( 3 == header.mCompression ) { // Windows NT - windows_nt_version = TRUE; + windows_nt_version = true; } else { @@ -184,32 +184,32 @@ BOOL LLImageBMP::updateData() if( 12 <= header.mSize && 64 <= header.mSize ) { setLastError("OS/2 2.x BMP files are not supported"); - return FALSE; + return false; } else if( 108 == header.mSize ) { // BITMAPV4HEADER - windows_95_version = TRUE; + windows_95_version = true; } else if( 108 < header.mSize ) { // BITMAPV5HEADER or greater // Should work as long at Microsoft maintained backwards compatibility (which they did in V4 and V5) - windows_95_version = TRUE; + windows_95_version = true; } S32 width = header.mWidth; S32 height = header.mHeight; if (height < 0) { - mOriginAtTop = TRUE; + mOriginAtTop = true; height = -height; } else { - mOriginAtTop = FALSE; + mOriginAtTop = false; } mBitsPerPixel = header.mBitsPerPixel; @@ -228,10 +228,10 @@ BOOL LLImageBMP::updateData() case 16: // Started work on 16, but doesn't work yet // These are legal, but we don't support them yet. setLastError("Unsupported bit depth"); - return FALSE; + return false; default: setLastError("Unrecognized bit depth"); - return FALSE; + return false; } setSize(width, height, components); @@ -244,11 +244,11 @@ BOOL LLImageBMP::updateData() case 1: setLastError("8 bit RLE compression not supported."); - return FALSE; + return false; case 2: setLastError("4 bit RLE compression not supported."); - return FALSE; + return false; case 3: // Windows NT or Windows 95 @@ -256,7 +256,7 @@ BOOL LLImageBMP::updateData() default: setLastError("Unsupported compression format."); - return FALSE; + return false; } //////////////////////////////////////////////////////////////////// @@ -267,13 +267,13 @@ BOOL LLImageBMP::updateData() if( (16 != header.mBitsPerPixel) && (32 != header.mBitsPerPixel) ) { setLastError("Bitfield encoding requires 16 or 32 bits per pixel."); - return FALSE; + return false; } if( 0 != header.mNumColors ) { setLastError("Bitfield encoding is not compatible with a color table."); - return FALSE; + return false; } @@ -322,15 +322,15 @@ BOOL LLImageBMP::updateData() if (!mColorPalette) { LL_WARNS() << "Out of memory in LLImageBMP::updateData(), size: " << color_palette_size << LL_ENDL; - return FALSE; + return false; } memcpy( mColorPalette, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE + extension_size, color_palette_size ); /* Flawfinder: ignore */ } - return TRUE; + return true; } -BOOL LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -341,7 +341,7 @@ BOOL LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) if (!mdata || (0 == getDataSize())) { setLastError("llimagebmp trying to decode an image with no data!"); - return FALSE; + return false; } raw_image->resize(getWidth(), getHeight(), 3); @@ -349,7 +349,7 @@ BOOL LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) U8* src = mdata + mBitmapOffset; U8* dst = raw_image->getData(); - BOOL success = FALSE; + bool success = false; switch( mBitsPerPixel ) { @@ -393,7 +393,7 @@ U32 LLImageBMP::countTrailingZeros( U32 m ) } -BOOL LLImageBMP::decodeColorMask16( U8* dst, U8* src ) +bool LLImageBMP::decodeColorMask16( U8* dst, U8* src ) { llassert( 16 == mBitsPerPixel ); @@ -426,10 +426,10 @@ BOOL LLImageBMP::decodeColorMask16( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::decodeColorMask32( U8* dst, U8* src ) +bool LLImageBMP::decodeColorMask32( U8* dst, U8* src ) { // Note: alpha is not supported @@ -445,7 +445,7 @@ BOOL LLImageBMP::decodeColorMask32( U8* dst, U8* src ) if (getWidth() * getHeight() * 4 > getDataSize() - mBitmapOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } S32 src_row_span = getWidth() * 4; @@ -469,11 +469,11 @@ BOOL LLImageBMP::decodeColorMask32( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::decodeColorTable8( U8* dst, U8* src ) +bool LLImageBMP::decodeColorTable8( U8* dst, U8* src ) { llassert( (8 == mBitsPerPixel) && (mColorPaletteColors >= 256) ); @@ -482,7 +482,7 @@ BOOL LLImageBMP::decodeColorTable8( U8* dst, U8* src ) if ((getWidth() * getHeight()) + getHeight() * alignment_bytes > getDataSize() - mBitmapOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } for( S32 row = 0; row < getHeight(); row++ ) @@ -499,11 +499,11 @@ BOOL LLImageBMP::decodeColorTable8( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) +bool LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) { llassert( 24 == mBitsPerPixel ); llassert( 3 == getComponents() ); @@ -512,7 +512,7 @@ BOOL LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) if ((getWidth() * getHeight() * 3) + getHeight() * alignment_bytes > getDataSize() - mBitmapOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } for( S32 row = 0; row < getHeight(); row++ ) @@ -528,10 +528,10 @@ BOOL LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) +bool LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); @@ -563,7 +563,7 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) // Allocate the new buffer for the data. if(!allocateData(file_bytes)) //memory allocation failed { - return FALSE ; + return false ; } magic[0] = 'B'; magic[1] = 'M'; @@ -663,5 +663,5 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) } } - return TRUE; + return true; } diff --git a/indra/llimage/llimagebmp.h b/indra/llimage/llimagebmp.h index db0b45def0..6a5fa4697d 100644 --- a/indra/llimage/llimagebmp.h +++ b/indra/llimage/llimagebmp.h @@ -40,15 +40,15 @@ public: LLImageBMP(); /*virtual*/ std::string getExtension() { return std::string("bmp"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); protected: - BOOL decodeColorTable8( U8* dst, U8* src ); - BOOL decodeColorMask16( U8* dst, U8* src ); - BOOL decodeTruecolor24( U8* dst, U8* src ); - BOOL decodeColorMask32( U8* dst, U8* src ); + bool decodeColorTable8( U8* dst, U8* src ); + bool decodeColorMask16( U8* dst, U8* src ); + bool decodeTruecolor24( U8* dst, U8* src ); + bool decodeColorMask32( U8* dst, U8* src ); U32 countTrailingZeros( U32 m ); @@ -58,7 +58,7 @@ protected: S32 mBitmapOffset; S32 mBitsPerPixel; U32 mBitfieldMask[4]; // rgba - BOOL mOriginAtTop; + bool mOriginAtTop; }; #endif diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index 04e0e752eb..0ec83415a0 100644 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -172,7 +172,7 @@ LLImageDXT::~LLImageDXT() } // virtual -BOOL LLImageDXT::updateData() +bool LLImageDXT::updateData() { resetLastError(); @@ -182,7 +182,7 @@ BOOL LLImageDXT::updateData() if (!data || !data_size) { setLastError("LLImageDXT uninitialized"); - return FALSE; + return false; } S32 width, height, miplevelmax; @@ -216,7 +216,7 @@ BOOL LLImageDXT::updateData() discard = llmin(discard, miplevelmax); setDiscardLevel(discard); - return TRUE; + return true; } // discard: 0 = largest (last) mip @@ -257,7 +257,7 @@ void LLImageDXT::setFormat() } // virtual -BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) +bool LLImageDXT::decode(LLImageRaw* raw_image, F32 time) { // *TODO: Test! This has been tweaked since its intial inception, // but we don't use it any more! @@ -266,7 +266,7 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) if (mFileFormat >= FORMAT_DXT1 && mFileFormat <= FORMAT_DXR5) { LL_WARNS() << "Attempt to decode compressed LLImageDXT to Raw (unsupported)" << LL_ENDL; - return FALSE; + return false; } S32 width = getWidth(), height = getHeight(); @@ -286,16 +286,16 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) if ((!getData()) || (data + image_size > getData() + getDataSize())) { setLastError("LLImageDXT trying to decode an image with not enough data!"); - return FALSE; + return false; } raw_image->resize(width, height, ncomponents); memcpy(raw_image->getData(), data, image_size); /* Flawfinder: ignore */ - return TRUE; + return true; } -BOOL LLImageDXT::getMipData(LLPointer& raw, S32 discard) +bool LLImageDXT::getMipData(LLPointer& raw, S32 discard) { if (discard < 0) { @@ -310,10 +310,10 @@ BOOL LLImageDXT::getMipData(LLPointer& raw, S32 discard) S32 height = 0; calcDiscardWidthHeight(discard, mFileFormat, width, height); raw = new LLImageRaw(data, width, height, getComponents()); - return TRUE; + return true; } -BOOL LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_mips) +bool LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_mips) { llassert_always(raw_image); @@ -395,11 +395,11 @@ BOOL LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_ prev_mipdata = mipdata; } - return TRUE; + return true; } // virtual -BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time) +bool LLImageDXT::encode(const LLImageRaw* raw_image, F32 time) { return encodeDXT(raw_image, time, false); } diff --git a/indra/llimage/llimagedxt.h b/indra/llimage/llimagedxt.h index a8756ba8ed..a4a9bcf99c 100644 --- a/indra/llimage/llimagedxt.h +++ b/indra/llimage/llimagedxt.h @@ -93,21 +93,21 @@ protected: /*virtual*/ ~LLImageDXT(); private: - BOOL encodeDXT(const LLImageRaw* raw_image, F32 decode_time, bool explicit_mips); + bool encodeDXT(const LLImageRaw* raw_image, F32 decode_time, bool explicit_mips); public: LLImageDXT(); /*virtual*/ std::string getExtension() { return std::string("dxt"); } - /*virtual*/ BOOL updateData(); + /*virtual*/ bool updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); /*virtual*/ S32 calcHeaderSize(); /*virtual*/ S32 calcDataSize(S32 discard_level = 0); - BOOL getMipData(LLPointer& raw, S32 discard=-1); + bool getMipData(LLPointer& raw, S32 discard=-1); void setFormat(); S32 getMipOffset(S32 discard); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 13d1268071..43d6f730ff 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -31,18 +31,13 @@ #include "llmath.h" #include "llmemory.h" #include "llsd.h" +#include -typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); -typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); -typedef const char* (*EngineInfoLLImageJ2CFunction)(); - -// Declare the prototype for theses functions here. Their functionality -// will be implemented in other files which define a derived LLImageJ2CImpl -// but only ONE static library which has the implementation for these -// functions should ever be included. +// Declare the prototype for this factory function here. It is implemented in +// other files which define a LLImageJ2CImpl subclass, but only ONE static +// library which has the implementation for this function should ever be +// linked. LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl(); -void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl); -const char* fallbackEngineInfoLLImageJ2CImpl(); // Test data gathering handle LLImageCompressionTester* LLImageJ2C::sTesterp = NULL ; @@ -51,17 +46,20 @@ const std::string sTesterName("ImageCompressionTester"); //static std::string LLImageJ2C::getEngineInfo() { - return fallbackEngineInfoLLImageJ2CImpl(); + // All known LLImageJ2CImpl implementation subclasses are cheap to + // construct. + boost::scoped_ptr impl(fallbackCreateLLImageJ2CImpl()); + return impl->getEngineInfo(); } LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mMaxBytes(0), mRawDiscardLevel(-1), mRate(DEFAULT_COMPRESSION_RATE), - mReversible(FALSE), + mReversible(false), mAreaUsedForDataSizeCalcs(0) { - mImpl = fallbackCreateLLImageJ2CImpl(); + mImpl.reset(fallbackCreateLLImageJ2CImpl()); claimMem(mImpl); // Clear data size table @@ -83,13 +81,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), } // virtual -LLImageJ2C::~LLImageJ2C() -{ - if ( mImpl ) - { - fallbackDestroyLLImageJ2CImpl(mImpl); - } -} +LLImageJ2C::~LLImageJ2C() {} // virtual void LLImageJ2C::resetLastError() @@ -111,16 +103,16 @@ S8 LLImageJ2C::getRawDiscardLevel() return mRawDiscardLevel; } -BOOL LLImageJ2C::updateData() +bool LLImageJ2C::updateData() { - BOOL res = TRUE; + bool res = true; resetLastError(); // Check to make sure that this instance has been initialized with data if (!getData() || (getDataSize() < 16)) { setLastError("LLImageJ2C uninitialized"); - res = FALSE; + res = false; } else { @@ -142,29 +134,29 @@ BOOL LLImageJ2C::updateData() return res; } -BOOL LLImageJ2C::initDecode(LLImageRaw &raw_image, int discard_level, int* region) +bool LLImageJ2C::initDecode(LLImageRaw &raw_image, int discard_level, int* region) { setDiscardLevel(discard_level != -1 ? discard_level : 0); return mImpl->initDecode(*this,raw_image,discard_level,region); } -BOOL LLImageJ2C::initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +bool LLImageJ2C::initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) { return mImpl->initEncode(*this,raw_image,blocks_size,precincts_size,levels); } -BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time) +bool LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time) { return decodeChannels(raw_imagep, decode_time, 0, 4); } -// Returns TRUE to mean done, whether successful or not. -BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count ) +// Returns true to mean done, whether successful or not. +bool LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count ) { LLTimer elapsed; - BOOL res = TRUE; + bool res = true; resetLastError(); @@ -172,13 +164,13 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir if (!getData() || (getDataSize() < 16)) { setLastError("LLImageJ2C uninitialized"); - res = TRUE; // done + res = true; // done } else { // Update the raw discard level updateRawDiscardLevel(); - mDecoding = TRUE; + mDecoding = true; res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count); } @@ -191,7 +183,7 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir } else { - mDecoding = FALSE; + mDecoding = false; } } @@ -210,7 +202,7 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir tester->updateDecompressionStats(elapsed.getElapsedTimeF32()) ; if (res) { - // The whole data stream is finally decompressed when res is returned as TRUE + // The whole data stream is finally decompressed when res is returned as true tester->updateDecompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; } } @@ -219,17 +211,17 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir } -BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time) +bool LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time) { return encode(raw_imagep, NULL, encode_time); } -BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time) +bool LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time) { LLTimer elapsed; resetLastError(); - BOOL res = mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible); + bool res = mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible); if (!mLastError.empty()) { LLImage::setLastError(mLastError); @@ -245,7 +237,7 @@ BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, tester->updateCompressionStats(elapsed.getElapsedTimeF32()) ; if (res) { - // The whole data stream is finally compressed when res is returned as TRUE + // The whole data stream is finally compressed when res is returned as true tester->updateCompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; } } @@ -348,15 +340,15 @@ void LLImageJ2C::setMaxBytes(S32 max_bytes) mMaxBytes = max_bytes; } -void LLImageJ2C::setReversible(const BOOL reversible) +void LLImageJ2C::setReversible(const bool reversible) { mReversible = reversible; } -BOOL LLImageJ2C::loadAndValidate(const std::string &filename) +bool LLImageJ2C::loadAndValidate(const std::string &filename) { - BOOL res = TRUE; + bool res = true; resetLastError(); @@ -372,12 +364,12 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) if (!apr_file) { setLastError("Unable to open file for reading", filename); - res = FALSE; + res = false; } else if (file_size == 0) { setLastError("File is empty",filename); - res = FALSE; + res = false; } else { @@ -395,7 +387,7 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) { FREE_MEM(LLImageBase::getPrivatePool(), data); setLastError("Unable to read entire file"); - res = FALSE; + res = false; } else { @@ -412,21 +404,21 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) } -BOOL LLImageJ2C::validate(U8 *data, U32 file_size) +bool LLImageJ2C::validate(U8 *data, U32 file_size) { resetLastError(); setData(data, file_size); - BOOL res = updateData(); + bool res = updateData(); if ( res ) { // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { setLastError("LLImageJ2C uninitialized"); - res = FALSE; + res = false; } else { @@ -443,7 +435,7 @@ BOOL LLImageJ2C::validate(U8 *data, U32 file_size) void LLImageJ2C::decodeFailed() { - mDecoding = FALSE; + mDecoding = false; } void LLImageJ2C::updateRawDiscardLevel() diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index ce8195940d..e196f7479e 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -30,6 +30,7 @@ #include "llimage.h" #include "llassettype.h" #include "llmetricperformancetester.h" +#include // JPEG2000 : compression rate used in j2c conversion. const F32 DEFAULT_COMPRESSION_RATE = 1.f/8.f; @@ -47,10 +48,10 @@ public: // Base class overrides /*virtual*/ std::string getExtension() { return std::string("j2c"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw *raw_imagep, F32 decode_time); - /*virtual*/ BOOL decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count); - /*virtual*/ BOOL encode(const LLImageRaw *raw_imagep, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw *raw_imagep, F32 decode_time); + /*virtual*/ bool decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count); + /*virtual*/ bool encode(const LLImageRaw *raw_imagep, F32 encode_time); /*virtual*/ S32 calcHeaderSize(); /*virtual*/ S32 calcDataSize(S32 discard_level = 0); /*virtual*/ S32 calcDiscardLevelBytes(S32 bytes); @@ -59,17 +60,17 @@ public: /*virtual*/ void resetLastError(); /*virtual*/ void setLastError(const std::string& message, const std::string& filename = std::string()); - BOOL initDecode(LLImageRaw &raw_image, int discard_level, int* region); - BOOL initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels); + bool initDecode(LLImageRaw &raw_image, int discard_level, int* region); + bool initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels); // Encode with comment text - BOOL encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0); + bool encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0); - BOOL validate(U8 *data, U32 file_size); - BOOL loadAndValidate(const std::string &filename); + bool validate(U8 *data, U32 file_size); + bool loadAndValidate(const std::string &filename); // Encode accessors - void setReversible(const BOOL reversible); // Use non-lossy? + void setReversible(const bool reversible); // Use non-lossy? void setMaxBytes(S32 max_bytes); S32 getMaxBytes() const { return mMaxBytes; } @@ -93,8 +94,8 @@ protected: S8 mRawDiscardLevel; F32 mRate; - BOOL mReversible; - LLImageJ2CImpl *mImpl; + bool mReversible; + boost::scoped_ptr mImpl; std::string mLastError; // Image compression/decompression tester @@ -111,23 +112,25 @@ protected: // Return value: // true: image size and number of channels was determined // false: error on decode - virtual BOOL getMetadata(LLImageJ2C &base) = 0; + virtual bool getMetadata(LLImageJ2C &base) = 0; // Decode the raw image optionally aborting (to continue later) after // decode_time seconds. Decode at most max_channel_count and start // decoding channel first_channel. // Return value: // true: decoding complete (even if it failed) // false: time expired while decoding - virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0; - virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, - BOOL reversible=FALSE) = 0; - virtual BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL) = 0; - virtual BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0) = 0; + virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0; + virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, + bool reversible=false) = 0; + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL) = 0; + virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0) = 0; + + virtual std::string getEngineInfo() const = 0; friend class LLImageJ2C; }; -#define LINDEN_J2C_COMMENT_PREFIX "LL_" +#define LINDEN_J2C_COMMENT_PREFIX "LL_" // Used by LLAppearanceUtility // // This class is used for performance data gathering only. diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index 8b8b529738..5c372eb0e7 100644 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -45,7 +45,7 @@ LLImageJPEG::~LLImageJPEG() delete[] mOutputBuffer; } -BOOL LLImageJPEG::updateData() +bool LLImageJPEG::updateData() { resetLastError(); @@ -53,7 +53,7 @@ BOOL LLImageJPEG::updateData() if (!getData() || (0 == getDataSize())) { setLastError("Uninitialized instance of LLImageJPEG"); - return FALSE; + return false; } //////////////////////////////////////// @@ -79,7 +79,7 @@ BOOL LLImageJPEG::updateData() if(setjmp(sSetjmpBuffer)) { jpeg_destroy_decompress(&cinfo); - return FALSE; + return false; } try { @@ -106,7 +106,7 @@ BOOL LLImageJPEG::updateData() //////////////////////////////////////// // Step 3: read file parameters with jpeg_read_header() - jpeg_read_header( &cinfo, TRUE ); + jpeg_read_header( &cinfo, true ); // Data set by jpeg_read_header setSize(cinfo.image_width, cinfo.image_height, 3); // Force to 3 components (RGB) @@ -115,13 +115,13 @@ BOOL LLImageJPEG::updateData() // More data set by jpeg_read_header cinfo.num_components; cinfo.jpeg_color_space; // Colorspace of image - cinfo.saw_JFIF_marker; // TRUE if a JFIF APP0 marker was seen + cinfo.saw_JFIF_marker; // true if a JFIF APP0 marker was seen cinfo.JFIF_major_version; // Version information from JFIF marker cinfo.JFIF_minor_version; // cinfo.density_unit; // Resolution data from JFIF marker cinfo.X_density; cinfo.Y_density; - cinfo.saw_Adobe_marker; // TRUE if an Adobe APP14 marker was seen + cinfo.saw_Adobe_marker; // true if an Adobe APP14 marker was seen cinfo.Adobe_transform; // Color transform code from Adobe marker */ } @@ -129,13 +129,13 @@ BOOL LLImageJPEG::updateData() { jpeg_destroy_decompress(&cinfo); - return FALSE; + return false; } //////////////////////////////////////// // Step 4: Release JPEG decompression object jpeg_destroy_decompress(&cinfo); - return TRUE; + return true; } // Initialize source --- called by jpeg_read_header @@ -154,7 +154,7 @@ boolean LLImageJPEG::decodeFillInputBuffer( j_decompress_ptr cinfo ) // Should never get here, since we provide the entire buffer up front. ERREXIT(cinfo, JERR_INPUT_EMPTY); - return TRUE; + return true; } // Skip data --- used to skip over a potentially large amount of @@ -182,7 +182,7 @@ void LLImageJPEG::decodeTermSource (j_decompress_ptr cinfo) // Returns true when done, whether or not decode was successful. -BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -192,7 +192,7 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) if (!getData() || (0 == getDataSize())) { setLastError("LLImageJPEG trying to decode an image with no data!"); - return TRUE; // done + return true; // done } S32 row_stride = 0; @@ -220,7 +220,7 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) if(setjmp(sSetjmpBuffer)) { jpeg_destroy_decompress(&cinfo); - return TRUE; // done + return true; // done } try { @@ -247,11 +247,11 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) //////////////////////////////////////// // Step 3: read file parameters with jpeg_read_header() - jpeg_read_header(&cinfo, TRUE); + jpeg_read_header(&cinfo, true); // We can ignore the return value from jpeg_read_header since // (a) suspension is not possible with our data source, and - // (b) we passed TRUE to reject a tables-only JPEG file as an error. + // (b) we passed true to reject a tables-only JPEG file as an error. // See libjpeg.doc for more info. setSize(cinfo.image_width, cinfo.image_height, 3); // Force to 3 components (RGB) @@ -314,7 +314,7 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) catch (int) { jpeg_destroy_decompress(&cinfo); - return TRUE; // done + return true; // done } // Check to see whether any corrupt-data warnings occurred @@ -322,10 +322,10 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) { // TODO: extract the warning to find out what went wrong. setLastError( "Unable to decode JPEG image."); - return TRUE; // done + return true; // done } - return TRUE; + return true; } @@ -344,11 +344,11 @@ void LLImageJPEG::encodeInitDestination ( j_compress_ptr cinfo ) // // In typical applications, this should write the entire output buffer // (ignoring the current state of next_output_byte & free_in_buffer), -// reset the pointer & count to the start of the buffer, and return TRUE +// reset the pointer & count to the start of the buffer, and return true // indicating that the buffer has been dumped. // // In applications that need to be able to suspend compression due to output -// overrun, a FALSE return indicates that the buffer cannot be emptied now. +// overrun, a false return indicates that the buffer cannot be emptied now. // In this situation, the compressor will return to its caller (possibly with // an indication that it has not accepted all the supplied scanlines). The // application should resume compression after it has made more room in the @@ -357,7 +357,7 @@ void LLImageJPEG::encodeInitDestination ( j_compress_ptr cinfo ) // // When suspending, the compressor will back up to a convenient restart point // (typically the start of the current MCU). next_output_byte & free_in_buffer -// indicate where the restart point will be if the current call returns FALSE. +// indicate where the restart point will be if the current call returns false. // Data beyond this point will be regenerated after resumption, so do not // write it out when emptying the buffer externally. @@ -374,7 +374,7 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) if (!new_buffer) { LL_WARNS() << "Out of memory in LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ), size: " << new_buffer_size << LL_ENDL; - return FALSE; + return false; } memcpy( new_buffer, self->mOutputBuffer, self->mOutputBufferSize ); /* Flawfinder: ignore */ delete[] self->mOutputBuffer; @@ -386,7 +386,7 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) self->mOutputBufferSize = new_buffer_size; self->claimMem(new_buffer_size); - return TRUE; + return true; } // Terminate destination --- called by jpeg_finish_compress @@ -466,11 +466,11 @@ void LLImageJPEG::errorOutputMessage( j_common_ptr cinfo ) std::string error = buffer ; LLImage::setLastError(error); - BOOL is_decode = (cinfo->is_decompressor != 0); + bool is_decode = (cinfo->is_decompressor != 0); LL_WARNS() << "LLImageJPEG " << (is_decode ? "decode " : "encode ") << " failed: " << buffer << LL_ENDL; } -BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) +bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) { llassert_always(raw_image); @@ -483,7 +483,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) break; default: setLastError("Unable to encode a JPEG image that doesn't have 1 or 3 components."); - return FALSE; + return false; } setSize(raw_image->getWidth(), raw_image->getHeight(), raw_image->getComponents()); @@ -537,7 +537,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) mOutputBuffer = NULL; disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; - return FALSE; + return false; } try @@ -582,7 +582,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) break; default: setLastError("Unable to encode a JPEG image that doesn't have 1 or 3 components."); - return FALSE; + return false; } // Now use the library's routine to set default compression parameters. @@ -591,15 +591,15 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) jpeg_set_defaults(&cinfo); // Now you can set any non-default parameters you wish to. - jpeg_set_quality(&cinfo, mEncodeQuality, TRUE ); // limit to baseline-JPEG values + jpeg_set_quality(&cinfo, mEncodeQuality, true ); // limit to baseline-JPEG values //////////////////////////////////////// // Step 4: Start compressor // - // TRUE ensures that we will write a complete interchange-JPEG file. - // Pass TRUE unless you are very sure of what you're doing. + // true ensures that we will write a complete interchange-JPEG file. + // Pass true unless you are very sure of what you're doing. - jpeg_start_compress(&cinfo, TRUE); + jpeg_start_compress(&cinfo, true); //////////////////////////////////////// // Step 5: while (scan lines remain to be written) @@ -653,8 +653,8 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) mOutputBuffer = NULL; disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 2142660c81..7a849a8421 100644 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -51,9 +51,9 @@ public: LLImageJPEG(S32 quality = 75); /*virtual*/ std::string getExtension() { return std::string("jpg"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); void setEncodeQuality( S32 q ) { mEncodeQuality = q; } // on a scale from 1 to 100 S32 getEncodeQuality() { return mEncodeQuality; } @@ -73,7 +73,7 @@ public: static void errorEmitMessage(j_common_ptr cinfo, int msg_level); static void errorOutputMessage(j_common_ptr cinfo); - static BOOL decompress(LLImageJPEG* imagep); + static bool decompress(LLImageJPEG* imagep); protected: U8* mOutputBuffer; // temp buffer used during encoding diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index f4a6979e77..05cf887f44 100644 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -47,7 +47,7 @@ LLImagePNG::~LLImagePNG() // Virtual // Parse PNG image information and set the appropriate // width, height and component (channel) information. -BOOL LLImagePNG::updateData() +bool LLImagePNG::updateData() { resetLastError(); @@ -55,7 +55,7 @@ BOOL LLImagePNG::updateData() if (!getData() || (0 == getDataSize())) { setLastError("Uninitialized instance of LLImagePNG"); - return FALSE; + return false; } // Decode the PNG data and extract sizing information @@ -63,25 +63,25 @@ BOOL LLImagePNG::updateData() if (!pngWrapper.isValidPng(getData())) { setLastError("LLImagePNG data does not have a valid PNG header!"); - return FALSE; + return false; } LLPngWrapper::ImageInfo infop; if (! pngWrapper.readPng(getData(), getDataSize(), NULL, &infop)) { setLastError(pngWrapper.getErrorMessage()); - return FALSE; + return false; } setSize(infop.mWidth, infop.mHeight, infop.mComponents); - return TRUE; + return true; } // Virtual // Decode an in-memory PNG image into the raw RGB or RGBA format // used within SecondLife. -BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -91,7 +91,7 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) if (!getData() || (0 == getDataSize())) { setLastError("LLImagePNG trying to decode an image with no data!"); - return FALSE; + return false; } // Decode the PNG data into the raw image @@ -99,21 +99,21 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) if (!pngWrapper.isValidPng(getData())) { setLastError("LLImagePNG data does not have a valid PNG header!"); - return FALSE; + return false; } if (! pngWrapper.readPng(getData(), getDataSize(), raw_image)) { setLastError(pngWrapper.getErrorMessage()); - return FALSE; + return false; } - return TRUE; + return true; } // Virtual // Encode the in memory RGB image into PNG format. -BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) +bool LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); @@ -133,7 +133,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) { setLastError(pngWrapper.getErrorMessage()); delete[] tmpWriteBuffer; - return FALSE; + return false; } // Resize internal buffer and copy from temp @@ -141,7 +141,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) if(allocateData(encodedSize)) memcpy(getData(), tmpWriteBuffer, encodedSize); else - LL_WARNS() << "allocateData() falied." << LL_ENDL; + LL_WARNS() << "allocateData() failed." << LL_ENDL; delete[] tmpWriteBuffer; diff --git a/indra/llimage/llimagepng.h b/indra/llimage/llimagepng.h index 1fbd850a2e..ef16f2996f 100644 --- a/indra/llimage/llimagepng.h +++ b/indra/llimage/llimagepng.h @@ -38,9 +38,9 @@ public: LLImagePNG(); /*virtual*/ std::string getExtension() { return std::string("png"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); }; #endif diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index e650905e4a..d2ff19fbb0 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -61,7 +61,7 @@ LLImageTGA::LLImageTGA() mColorMapStart( 0 ), mColorMapLength( 0 ), mColorMapBytesPerEntry( 0 ), - mIs15Bit( FALSE ), + mIs15Bit( false ), mAttributeBits(0), mColorMapDepth(0), @@ -94,7 +94,7 @@ LLImageTGA::LLImageTGA(const std::string& file_name) mColorMapStart( 0 ), mColorMapLength( 0 ), mColorMapBytesPerEntry( 0 ), - mIs15Bit( FALSE ) + mIs15Bit( false ) { loadFile(file_name); } @@ -104,7 +104,7 @@ LLImageTGA::~LLImageTGA() delete [] mColorMap; } -BOOL LLImageTGA::updateData() +bool LLImageTGA::updateData() { resetLastError(); @@ -112,7 +112,7 @@ BOOL LLImageTGA::updateData() if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA uninitialized"); - return FALSE; + return false; } // Pull image information from the header... @@ -185,13 +185,13 @@ BOOL LLImageTGA::updateData() case 0: // No image data included in file setLastError("Unable to load file. TGA file contains no image data."); - return FALSE; + return false; case 1: // Colormapped uncompressed if( 8 != mPixelSize ) { setLastError("Unable to load file. Colormapped images must have 8 bits per pixel."); - return FALSE; + return false; } break; case 2: @@ -202,7 +202,7 @@ BOOL LLImageTGA::updateData() if( 8 != mPixelSize ) { setLastError("Unable to load file. Monochrome images must have 8 bits per pixel."); - return FALSE; + return false; } break; case 9: @@ -216,12 +216,12 @@ BOOL LLImageTGA::updateData() if( 8 != mPixelSize ) { setLastError("Unable to load file. Monochrome images must have 8 bits per pixel."); - return FALSE; + return false; } break; default: setLastError("Unable to load file. Unrecoginzed TGA image type."); - return FALSE; + return false; } // discard the ID field, if any @@ -266,8 +266,8 @@ BOOL LLImageTGA::updateData() mColorMap = new U8[ color_map_bytes ]; if (!mColorMap) { - LL_WARNS() << "Out of Memory in BOOL LLImageTGA::updateData(), size: " << color_map_bytes << LL_ENDL; - return FALSE; + LL_WARNS() << "Out of Memory in bool LLImageTGA::updateData(), size: " << color_map_bytes << LL_ENDL; + return false; } memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); /* Flawfinder: ignore */ } @@ -302,28 +302,28 @@ BOOL LLImageTGA::updateData() // if( mAttributeBits != 8 ) // { // setLastError("Unable to load file. 32 bit TGA image does not have 8 bits of alpha."); -// return FALSE; +// return false; // } mAttributeBits = 8; break; case 15: case 16: components = 3; - mIs15Bit = TRUE; // 16th bit is used for Targa hardware interupts and is ignored. + mIs15Bit = true; // 16th bit is used for Targa hardware interupts and is ignored. break; case 8: components = 1; break; default: setLastError("Unable to load file. Unknown pixel size."); - return FALSE; + return false; } setSize(width, height, components); - return TRUE; + return true; } -BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -331,7 +331,7 @@ BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA trying to decode an image with no data!"); - return FALSE; + return false; } // Copy everything after the header. @@ -348,18 +348,18 @@ BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) (getComponents() != 4) ) { setLastError("TGA images with a number of components other than 1, 3, and 4 are not supported."); - return FALSE; + return false; } if( mOriginRightBit ) { setLastError("TGA images with origin on right side are not supported."); - return FALSE; + return false; } - BOOL flipped = (mOriginTopBit != 0); - BOOL rle_compressed = ((mImageType & 0x08) != 0); + bool flipped = (mOriginTopBit != 0); + bool rle_compressed = ((mImageType & 0x08) != 0); if( mColorMap ) { @@ -371,15 +371,15 @@ BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) } } -BOOL LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) +bool LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, bool rle, bool flipped ) { // Handle out of memory situations a bit more graceful than a crash if( !raw_image || raw_image->isBufferInvalid() ) - return FALSE; + return false; // - BOOL success = FALSE; - BOOL alpha_opaque = FALSE; + bool success = false; + bool alpha_opaque = false; if( rle ) { @@ -414,7 +414,7 @@ BOOL LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped } else { - BOOL alpha_opaque; + bool alpha_opaque; success = decodeTruecolorNonRle( raw_image, alpha_opaque ); if (alpha_opaque && raw_image->getComponents() == 4) { @@ -440,9 +440,9 @@ BOOL LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped } -BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaque ) +bool LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, bool &alpha_opaque ) { - alpha_opaque = TRUE; + alpha_opaque = true; // Origin is the bottom left U8* dst = raw_image->getData(); @@ -452,7 +452,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - mDataOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } if (getComponents() == 4) @@ -466,7 +466,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu dst[3] = src[3]; // Alpha if (dst[3] != 255) { - alpha_opaque = FALSE; + alpha_opaque = false; } dst += 4; src += 4; @@ -500,7 +500,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu memcpy(dst, src, pixels); /* Flawfinder: ignore */ } - return TRUE; + return true; } void LLImageTGA::decodeColorMapPixel8( U8* dst, const U8* src ) @@ -533,7 +533,7 @@ void LLImageTGA::decodeColorMapPixel32( U8* dst, const U8* src ) } -BOOL LLImageTGA::decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) +bool LLImageTGA::decodeColorMap( LLImageRaw* raw_image, bool rle, bool flipped ) { // Handle out of memory situations a bit more graceful than a crash if( !raw_image || raw_image->isBufferInvalid() ) @@ -545,7 +545,7 @@ BOOL LLImageTGA::decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) if( 8 != mPixelSize ) { - return FALSE; + return false; } U8* src = getData() + mDataOffset; @@ -559,7 +559,7 @@ BOOL LLImageTGA::decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) case 2: pixel_decoder = &LLImageTGA::decodeColorMapPixel15; break; case 3: pixel_decoder = &LLImageTGA::decodeColorMapPixel24; break; case 4: pixel_decoder = &LLImageTGA::decodeColorMapPixel32; break; - default: llassert(0); return FALSE; + default: llassert(0); return false; } if( rle ) @@ -628,12 +628,12 @@ BOOL LLImageTGA::decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) } } - return TRUE; + return true; } -BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) +bool LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); @@ -657,7 +657,7 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) mImageType = 2; break; default: - return FALSE; + return false; } // Color map stuff (unsupported) @@ -693,7 +693,7 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) bytes_per_pixel = 4; break; default: - return FALSE; + return false; } mPixelSize = U8(bytes_per_pixel * 8); // 8, 16, 24, 32 bits per pixel @@ -780,13 +780,13 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) break; } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque ) +bool LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, bool &alpha_opaque ) { llassert( getComponents() == 4 ); - alpha_opaque = TRUE; + alpha_opaque = true; U8* dst = raw_image->getData(); U32* dst_pixels = (U32*) dst; @@ -803,7 +803,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -814,7 +814,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque // Encoded (duplicate-pixel) block if (src + 3 >= last_src) - return FALSE; + return false; rgba_byte_p[0] = src[2]; rgba_byte_p[1] = src[1]; @@ -822,7 +822,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque rgba_byte_p[3] = src[3]; if (rgba_byte_p[3] != 255) { - alpha_opaque = FALSE; + alpha_opaque = false; } src += 4; @@ -841,7 +841,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque do { if (src + 3 >= last_src) - return FALSE; + return false; ((U8*)dst_pixels)[0] = src[2]; ((U8*)dst_pixels)[1] = src[1]; @@ -849,7 +849,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque ((U8*)dst_pixels)[3] = src[3]; if (src[3] != 255) { - alpha_opaque = FALSE; + alpha_opaque = false; } src += 4; dst_pixels++; @@ -859,10 +859,10 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque } } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) +bool LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) { llassert( getComponents() == 3 ); llassert( mIs15Bit ); @@ -878,7 +878,7 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -890,7 +890,7 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; decodeTruecolorPixel15( dst, src ); // slow dst += 3; @@ -905,7 +905,7 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; decodeTruecolorPixel15( dst, src ); dst += 3; @@ -916,12 +916,12 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) } } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) +bool LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) { llassert( getComponents() == 3 ); @@ -936,7 +936,7 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -948,7 +948,7 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; dst[0] = src[2]; dst[1] = src[1]; dst[2] = src[0]; @@ -964,7 +964,7 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; dst[0] = src[2]; dst[1] = src[1]; @@ -977,11 +977,11 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) } } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) +bool LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) { llassert( getComponents() == 1 ); @@ -996,7 +996,7 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -1005,7 +1005,7 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) if( block_header_byte & 0x80 ) { if (src >= last_src) - return FALSE; + return false; // Encoded (duplicate-pixel) block memset( dst, *src, block_pixel_count ); @@ -1018,7 +1018,7 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) do { if (src >= last_src) - return FALSE; + return false; *dst = *src; dst++; @@ -1029,13 +1029,13 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) } } - return TRUE; + return true; } // Decoded and process the image for use in avatar gradient masks. // Processing happens during the decode for speed. -BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight ) +bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight ) { llassert_always(raw_image); @@ -1058,7 +1058,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA trying to decode an image with no data!"); - return FALSE; + return false; } // Only works for unflipped monochrome RLE images @@ -1066,7 +1066,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight { LL_WARNS() << "LLImageTGA trying to alpha-gradient process an image that's not a standard RLE, one component image" << LL_ENDL; LL_WARNS() << "getComponents(): " << getComponents() << " mImageType: " << mImageType << " mOriginTopBit:" << mOriginTopBit << " mOriginRightBit: " << mOriginRightBit << LL_ENDL; - return FALSE; + return false; } raw_image->resize(getWidth(), getHeight(), getComponents()); @@ -1152,7 +1152,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight } } } - return TRUE; + return true; } // Reads a .tga file and creates an LLImageTGA with its data. diff --git a/indra/llimage/llimagetga.h b/indra/llimage/llimagetga.h index 5da3525149..b1f34dcdad 100644 --- a/indra/llimage/llimagetga.h +++ b/indra/llimage/llimagetga.h @@ -41,25 +41,25 @@ public: LLImageTGA(const std::string& file_name); /*virtual*/ std::string getExtension() { return std::string("tga"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time=0.0); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time=0.0); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time=0.0); - BOOL decodeAndProcess(LLImageRaw* raw_image, F32 domain, F32 weight); + bool decodeAndProcess(LLImageRaw* raw_image, F32 domain, F32 weight); private: - BOOL decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped ); + bool decodeTruecolor( LLImageRaw* raw_image, bool rle, bool flipped ); - BOOL decodeTruecolorRle8( LLImageRaw* raw_image ); - BOOL decodeTruecolorRle15( LLImageRaw* raw_image ); - BOOL decodeTruecolorRle24( LLImageRaw* raw_image ); - BOOL decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque ); + bool decodeTruecolorRle8( LLImageRaw* raw_image ); + bool decodeTruecolorRle15( LLImageRaw* raw_image ); + bool decodeTruecolorRle24( LLImageRaw* raw_image ); + bool decodeTruecolorRle32( LLImageRaw* raw_image, bool &alpha_opaque ); void decodeTruecolorPixel15( U8* dst, const U8* src ); - BOOL decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaque ); + bool decodeTruecolorNonRle( LLImageRaw* raw_image, bool &alpha_opaque ); - BOOL decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ); + bool decodeColorMap( LLImageRaw* raw_image, bool rle, bool flipped ); void decodeColorMapPixel8(U8* dst, const U8* src); void decodeColorMapPixel15(U8* dst, const U8* src); @@ -100,7 +100,7 @@ private: S32 mColorMapLength; S32 mColorMapBytesPerEntry; - BOOL mIs15Bit; + bool mIs15Bit; static const U8 s5to8bits[32]; }; diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 67d22714db..5215771c0a 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -33,23 +33,16 @@ #include "lltimer.h" //#include "llmemory.h" -const char* fallbackEngineInfoLLImageJ2CImpl() -{ - static std::string version_string = - std::string("OpenJPEG: " OPENJPEG_VERSION ", Runtime: ") - + opj_version(); - return version_string.c_str(); -} - +// Factory function: see declaration in llimagej2c.cpp LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl() { return new LLImageJ2COJ(); } -void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl) +std::string LLImageJ2COJ::getEngineInfo() const { - delete impl; - impl = NULL; + return std::string("OpenJPEG: " OPENJPEG_VERSION ", Runtime: ") + + opj_version(); } // Return string from message, eliminating final \n if present @@ -107,19 +100,19 @@ LLImageJ2COJ::~LLImageJ2COJ() { } -BOOL LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) +bool LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) { // No specific implementation for this method in the OpenJpeg case - return FALSE; + return false; } -BOOL LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) { // No specific implementation for this method in the OpenJpeg case - return FALSE; + return false; } -BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) +bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { // texture comment metadata reader U8* c_data = base.getData(); @@ -222,7 +215,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } - return TRUE; // done + return true; // done } // sometimes we get bad data out of the cache - check to see if the decode succeeded @@ -232,8 +225,8 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod { // if we didn't get the discard level we're expecting, fail opj_image_destroy(image); - base.mDecoding = FALSE; - return TRUE; + base.mDecoding = false; + return true; } } @@ -245,7 +238,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } - return TRUE; + return true; } // Copy image data into our raw image format (instead of the separate channel format @@ -292,18 +285,18 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << LL_ENDL; opj_image_destroy(image); - return TRUE; // done + return true; // done } } /* free image data structure */ opj_image_destroy(image); - return TRUE; // done + return true; // done } -BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, BOOL reversible) +bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible) { const S32 MAX_COMPS = 5; opj_cparameters_t parameters; /* compression parameters */ @@ -424,7 +417,7 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con { opj_cio_close(cio); LL_DEBUGS("Texture") << "Failed to encode image." << LL_ENDL; - return FALSE; + return false; } codestream_length = cio_tell(cio); @@ -443,7 +436,7 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con /* free image data */ opj_image_destroy(image); - return TRUE; + return true; } inline S32 extractLong4( U8 const *aBuffer, int nOffset ) @@ -503,7 +496,7 @@ bool getMetadataFast( LLImageJ2C &aImage, S32 &aW, S32 &aH, S32 &aComps ) return true; } -BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) +bool LLImageJ2COJ::getMetadata(LLImageJ2C &base) { // // FIXME: We get metadata by decoding the ENTIRE image. @@ -519,7 +512,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) if ( getMetadataFast( base, width, height, img_components ) ) { base.setSize(width, height, img_components); - return TRUE; + return true; } // Do it the old and slow way, decode the image with openjpeg @@ -578,7 +571,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) if(!image) { LL_WARNS() << "ERROR -> getMetadata: failed to decode image!" << LL_ENDL; - return FALSE; + return false; } // Copy image data into our raw image format (instead of the separate channel format @@ -591,5 +584,5 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) /* free image data structure */ opj_image_destroy(image); - return TRUE; + return true; } diff --git a/indra/llimagej2coj/llimagej2coj.h b/indra/llimagej2coj/llimagej2coj.h index 40ad4edb00..5c6193944e 100644 --- a/indra/llimagej2coj/llimagej2coj.h +++ b/indra/llimagej2coj/llimagej2coj.h @@ -35,12 +35,13 @@ public: LLImageJ2COJ(); virtual ~LLImageJ2COJ(); protected: - /*virtual*/ BOOL getMetadata(LLImageJ2C &base); - /*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); - /*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, - BOOL reversible = FALSE); - /*virtual*/ BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); - /*virtual*/ BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); + virtual bool getMetadata(LLImageJ2C &base); + virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); + virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, + bool reversible = false); + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); + virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); + virtual std::string getEngineInfo() const; }; #endif diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index fe9ebf7af9..4bffe586f6 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -73,42 +73,17 @@ private: void set_default_colour_weights(kdu_params *siz); // Various missing prototypes LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl(); -void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl); -const char* fallbackEngineInfoLLImageJ2CImpl(); -void ll_kdu_error(void); // -const char* engineInfoLLImageJ2CKDU() -{ - static std::string version = llformat("KDU %s", KDU_CORE_VERSION); - return version.c_str(); -} - -LLImageJ2CKDU* createLLImageJ2CKDU() -{ - return new LLImageJ2CKDU(); -} - -void destroyLLImageJ2CKDU(LLImageJ2CKDU* kdu) -{ - delete kdu; - kdu = NULL; -} - +// Factory function: see declaration in llimagej2c.cpp LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl() { return new LLImageJ2CKDU(); } -void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl) +std::string LLImageJ2CKDU::getEngineInfo() const { - delete impl; - impl = NULL; -} - -const char* fallbackEngineInfoLLImageJ2CImpl() -{ - return engineInfoLLImageJ2CKDU(); + return llformat("KDU %s", KDU_CORE_VERSION); } class LLKDUDecodeState @@ -120,11 +95,11 @@ public: // ~LLKDUDecodeState(); - BOOL processTileDecode(F32 decode_time, BOOL limit_time = TRUE); + bool processTileDecode(F32 decode_time, bool limit_time = true); private: S32 mNumComponents; - BOOL mUseYCC; + bool mUseYCC; kdu_dims mDims; kdu_sample_allocator mAllocator; kdu_tile_comp mComps[4]; @@ -138,75 +113,85 @@ private: S32 mRowGap; }; -void ll_kdu_error( void ) -{ - // *FIX: This exception is bad, bad, bad. It gets thrown from a - // destructor which can lead to immediate program termination! - throw "ll_kdu_error() throwing an exception"; -} - // Stuff for new kdu error handling -class LLKDUMessageWarning : public kdu_message +class LLKDUMessage: public kdu_message { public: - /*virtual*/ void put_text(const char *s); - /*virtual*/ void put_text(const kdu_uint16 *s); + LLKDUMessage(const std::string& type): + mType(type) + {} - static LLKDUMessageWarning sDefaultMessage; -}; - -class LLKDUMessageError : public kdu_message -{ -public: - /*virtual*/ void put_text(const char *s); - /*virtual*/ void put_text(const kdu_uint16 *s); - /*virtual*/ void flush(bool end_of_message = false); - static LLKDUMessageError sDefaultMessage; -}; - -void LLKDUMessageWarning::put_text(const char *s) -{ - LL_INFOS() << "KDU Warning: " << s << LL_ENDL; -} - -void LLKDUMessageWarning::put_text(const kdu_uint16 *s) -{ - LL_INFOS() << "KDU Warning: " << s << LL_ENDL; -} - -void LLKDUMessageError::put_text(const char *s) -{ - // - LL_INFOS_ONCE("LLImageJ2CKDU") << "KDU Error: " << s << LL_ENDL; -} - -void LLKDUMessageError::put_text(const kdu_uint16 *s) -{ - LL_INFOS() << "KDU Error: " << s << LL_ENDL; -} - -void LLKDUMessageError::flush(bool end_of_message) -{ - if (end_of_message) + virtual void put_text(const char *s) { - throw "KDU throwing an exception"; + LL_INFOS() << "KDU " << mType << ": " << s << LL_ENDL; } -} -LLKDUMessageWarning LLKDUMessageWarning::sDefaultMessage; -LLKDUMessageError LLKDUMessageError::sDefaultMessage; -static bool kdu_message_initialized = false; + virtual void put_text(const kdu_uint16 *s) + { + // The previous implementation simply streamed 's' to the log. So + // either this put_text() override was never called -- or it produced + // some baffling log messages -- because I assert that streaming a + // const kdu_uint16* to a std::ostream will display only the hex value + // of the pointer. + LL_INFOS() << "KDU " << mType << ": " + << utf16str_to_utf8str(llutf16string(s)) << LL_ENDL; + } + +private: + std::string mType; +}; + +struct LLKDUMessageWarning : public LLKDUMessage +{ + LLKDUMessageWarning(): + LLKDUMessage("Warning") + { + kdu_customize_warnings(this); + } +}; +// Instantiating LLKDUMessageWarning calls kdu_customize_warnings() with the +// new instance. Make it static so this only happens once. +static LLKDUMessageWarning sWarningHandler; + +struct LLKDUMessageError : public LLKDUMessage +{ + LLKDUMessageError(): + LLKDUMessage("Error") + { + kdu_customize_errors(this); + } + + virtual void flush(bool end_of_message = false) + { + // According to the documentation nat found: + // http://pirlwww.lpl.arizona.edu/resources/guide/software/Kakadu/html_pages/globals__kdu$mize_errors.html + // "If a kdu_error object is destroyed, handler→flush will be called with + // an end_of_message argument equal to true and the process will + // subsequently be terminated through exit. The termination may be + // avoided, however, by throwing an exception from within the message + // terminating handler→flush call." + // So throwing an exception here isn't arbitrary: we MUST throw an + // exception if we want to recover from a KDU error. + if (end_of_message) + { + throw "KDU throwing an exception"; + } + } +}; +// Instantiating LLKDUMessageError calls kdu_customize_errors() with the new +// instance. Make it static so this only happens once. +static LLKDUMessageError sErrorHandler; LLImageJ2CKDU::LLImageJ2CKDU() : LLImageJ2CImpl(), -mInputp(NULL), -mCodeStreamp(NULL), -mTPosp(NULL), -mTileIndicesp(NULL), -mRawImagep(NULL), -mDecodeState(NULL), -mBlocksSize(-1), -mPrecinctsSize(-1), -mLevels(0) + mInputp(), + mCodeStreamp(), + mTPosp(), + mTileIndicesp(), + mRawImagep(NULL), + mDecodeState(), + mBlocksSize(-1), + mPrecinctsSize(-1), + mLevels(0) { } @@ -218,7 +203,7 @@ LLImageJ2CKDU::~LLImageJ2CKDU() // Stuff for new simple decode void transfer_bytes(kdu_byte *dest, kdu_line_buf &src, int gap, int precision); -void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode) +void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode) { S32 data_size = base.getDataSize(); S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); @@ -226,38 +211,27 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECod // // Initialization // - if (!kdu_message_initialized) - { - kdu_message_initialized = true; - kdu_customize_errors(&LLKDUMessageError::sDefaultMessage); - kdu_customize_warnings(&LLKDUMessageWarning::sDefaultMessage); - } - - if (mCodeStreamp) - { - mCodeStreamp->destroy(); - delete mCodeStreamp; - mCodeStreamp = NULL; - } + mCodeStreamp.reset(); if (!mInputp && base.getData()) { // The compressed data has been loaded // Setup the source for the codestream - mInputp = new LLKDUMemSource(base.getData(), data_size); + mInputp.reset(new LLKDUMemSource(base.getData(), data_size)); } if (mInputp) { + // This is LLKDUMemSource::reset(), not boost::scoped_ptr::reset(). mInputp->reset(); } - mCodeStreamp = new kdu_codestream; - mCodeStreamp->create(mInputp); + mCodeStreamp->create(mInputp.get()); // Set the maximum number of bytes to use from the codestream - // *TODO: This seems to be wrong. The base class should have no idea of how j2c compression works so no - // good way of computing what's the byte range to be used. + // *TODO: This seems to be wrong. The base class should have no idea of + // how j2c compression works so no good way of computing what's the byte + // range to be used. mCodeStreamp->set_max_bytes(max_bytes,true); // If you want to flip or rotate the image for some reason, change @@ -314,42 +288,26 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECod if (!keep_codestream) { - mCodeStreamp->destroy(); - delete mCodeStreamp; - mCodeStreamp = NULL; - delete mInputp; - mInputp = NULL; + mCodeStreamp.reset(); + mInputp.reset(); } } void LLImageJ2CKDU::cleanupCodeStream() { - delete mInputp; - mInputp = NULL; - - delete mDecodeState; - mDecodeState = NULL; - - if (mCodeStreamp) - { - mCodeStreamp->destroy(); - delete mCodeStreamp; - mCodeStreamp = NULL; - } - - delete mTPosp; - mTPosp = NULL; - - delete mTileIndicesp; - mTileIndicesp = NULL; + mInputp.reset(); + mDecodeState.reset(); + mCodeStreamp.reset(); + mTPosp.reset(); + mTileIndicesp.reset(); } -BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) +bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) { return initDecode(base,raw_image,0.0f,MODE_FAST,0,4,discard_level,region); } -BOOL LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +bool LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) { mPrecinctsSize = precincts_size; if (mPrecinctsSize != -1) @@ -373,10 +331,10 @@ BOOL LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int bloc mLevels = llclamp(mLevels,MIN_DECOMPOSITION_LEVELS,MAX_DECOMPOSITION_LEVELS); base.setLevels(mLevels); } - return TRUE; + return true; } -BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level, int* region) +bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level, int* region) { base.resetLastError(); @@ -388,7 +346,7 @@ BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco //findDiscardLevelsBoundaries(base); base.updateRawDiscardLevel(); - setupCodeStream(base, TRUE, mode); + setupCodeStream(base, true, mode); mRawImagep = &raw_image; mCodeStreamp->change_appearance(false, true, false); @@ -423,12 +381,12 @@ BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco if (!mTileIndicesp) { - mTileIndicesp = new kdu_dims; + mTileIndicesp.reset(new kdu_dims); } mCodeStreamp->get_valid_tiles(*mTileIndicesp); if (!mTPosp) { - mTPosp = new kdu_coords; + mTPosp.reset(new kdu_coords); mTPosp->y = 0; mTPosp->x = 0; } @@ -436,32 +394,32 @@ BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco catch (const char* msg) { base.setLastError(ll_safe_string(msg)); - return FALSE; + return false; } catch (...) { base.setLastError("Unknown J2C error"); - return FALSE; + return false; } - return TRUE; + return true; } -// Returns TRUE to mean done, whether successful or not. -BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) +// Returns true to mean done, whether successful or not. +bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { ECodeStreamMode mode = MODE_FAST; LLTimer decode_timer; - if (!mCodeStreamp) + if (!mCodeStreamp->exists()) { if (!initDecode(base, raw_image, decode_time, mode, first_channel, max_channel_count)) { // Initializing the J2C decode failed, bail out. cleanupCodeStream(); - return TRUE; // done + return true; // done } } @@ -480,6 +438,13 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco // Now we are ready to walk through the tiles processing them one-by-one. kdu_byte *buffer = raw_image.getData(); + if (!buffer) + { + base.setLastError("Memory error"); + base.decodeFailed(); + cleanupCodeStream(); + return true; // done + } while (mTPosp->y < mTileIndicesp->size.y) { @@ -517,8 +482,8 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels; // KDU 7.3.2 upgrade - // mDecodeState = new LLKDUDecodeState(tile, buf, row_gap); - mDecodeState = new LLKDUDecodeState(tile, buf, row_gap, *mCodeStreamp); + // mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap)); + mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap, mCodeStreamp.get())); // } @@ -527,14 +492,13 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco // This is where we do the actual decode. If we run out of time, return false. if (mDecodeState->processTileDecode(remaining_time, (decode_time > 0.0f))) { - delete mDecodeState; - mDecodeState = NULL; + mDecodeState.reset(); } else { // Not finished decoding yet. // setLastError("Ran out of time while decoding"); - return FALSE; + return false; } } catch (const char* msg) @@ -542,14 +506,14 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco base.setLastError(ll_safe_string(msg)); base.decodeFailed(); cleanupCodeStream(); - return TRUE; // done + return true; // done } catch (...) { base.setLastError( "Unknown J2C error" ); base.decodeFailed(); cleanupCodeStream(); - return TRUE; // done + return true; // done } @@ -561,11 +525,11 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco cleanupCodeStream(); - return TRUE; + return true; } -BOOL LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, BOOL reversible) +bool LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible) { // Declare and set simple arguments bool transpose = false; @@ -734,36 +698,36 @@ BOOL LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, co catch(const char* msg) { base.setLastError(ll_safe_string(msg)); - return FALSE; + return false; } catch( ... ) { base.setLastError( "Unknown J2C error" ); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL LLImageJ2CKDU::getMetadata(LLImageJ2C &base) +bool LLImageJ2CKDU::getMetadata(LLImageJ2C &base) { // *FIX: kdu calls our callback function if there's an error, and // then bombs. To regain control, we throw an exception, and // catch it here. try { - setupCodeStream(base, FALSE, MODE_FAST); - return TRUE; + setupCodeStream(base, false, MODE_FAST); + return true; } catch (const char* msg) { base.setLastError(ll_safe_string(msg)); - return FALSE; + return false; } catch (...) { base.setLastError( "Unknown J2C error" ); - return FALSE; + return false; } } @@ -771,6 +735,8 @@ BOOL LLImageJ2CKDU::getMetadata(LLImageJ2C &base) /* STATIC copy_block */ /*****************************************************************************/ +/*==========================================================================*| +// Only called by copy_tile(), which is itself commented out static void copy_block(kdu_block *in, kdu_block *out) { if (in->K_max_prime != out->K_max_prime) @@ -799,11 +765,14 @@ static void copy_block(kdu_block *in, kdu_block *out) out->set_max_bytes(num_bytes,false); memcpy(out->byte_buffer,in->byte_buffer,(size_t) num_bytes); } +|*==========================================================================*/ /*****************************************************************************/ /* STATIC copy_tile */ /*****************************************************************************/ +/*==========================================================================*| +// Only called by findDiscardLevelsBoundaries(), which is itself commented out static void copy_tile(kdu_tile tile_in, kdu_tile tile_out, int tnum_in, int tnum_out, kdu_params *siz_in, kdu_params *siz_out, int skip_components, @@ -860,10 +829,13 @@ copy_tile(kdu_tile tile_in, kdu_tile tile_out, int tnum_in, int tnum_out, } } } +|*==========================================================================*/ // Find the block boundary for each discard level in the input image. // We parse the input blocks and copy them in a temporary output stream. // For the moment, we do nothing more that parsing the raw list of blocks and outputing result. +/*==========================================================================*| +// See comments in header file for why this is commented out. void LLImageJ2CKDU::findDiscardLevelsBoundaries(LLImageJ2C &base) { // We need the number of levels in that image before starting. @@ -873,7 +845,7 @@ void LLImageJ2CKDU::findDiscardLevelsBoundaries(LLImageJ2C &base) { //std::cout << "Parsing discard level = " << discard_level << std::endl; // Create the input codestream object. - setupCodeStream(base, TRUE, MODE_FAST); + setupCodeStream(base, true, MODE_FAST); mCodeStreamp->apply_input_restrictions(0, 4, discard_level, 0, NULL); mCodeStreamp->set_max_bytes(KDU_LONG_MAX,true); siz_params *siz_in = mCodeStreamp->access_siz(); @@ -968,6 +940,7 @@ void LLImageJ2CKDU::findDiscardLevelsBoundaries(LLImageJ2C &base) } return; } +|*==========================================================================*/ void set_default_colour_weights(kdu_params *siz) { @@ -1241,7 +1214,7 @@ LLKDUDecodeState::~LLKDUDecodeState() mTile.close(); } -BOOL LLKDUDecodeState::processTileDecode(F32 decode_time, BOOL limit_time) +bool LLKDUDecodeState::processTileDecode(F32 decode_time, bool limit_time) /* Decompresses a tile, writing the data into the supplied byte buffer. The buffer contains interleaved image components, if there are any. Although you may think of the buffer as belonging entirely to this tile, @@ -1273,11 +1246,11 @@ separation between consecutive rows in the real buffer. */ { if (limit_time && decode_timer.getElapsedTimeF32() > decode_time) { - return FALSE; + return false; } } } - return TRUE; + return true; } // kdc_flow_control diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h index 6206259f2e..d408c388cf 100644 --- a/indra/llkdu/llimagej2ckdu.h +++ b/indra/llkdu/llimagej2ckdu.h @@ -53,6 +53,8 @@ #endif #include "kdu_sample_processing.h" +#include +#include // KDU >= 7.5.0 uses namespaces for nicer encapsulation. To avoid cluttering this all over LLs source we're going with this. #if KDU_MAJOR_VERSION >= 7 && KDU_MINOR_VERSION >= 5 @@ -76,43 +78,73 @@ public: virtual ~LLImageJ2CKDU(); protected: - /*virtual*/ BOOL getMetadata(LLImageJ2C &base); - /*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); - /*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, - BOOL reversible=FALSE); - /*virtual*/ BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); - /*virtual*/ BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); - void findDiscardLevelsBoundaries(LLImageJ2C &base); + virtual bool getMetadata(LLImageJ2C &base); + virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); + virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, + bool reversible=false); + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); + virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); + virtual std::string getEngineInfo() const; private: - BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level = -1, int* region = NULL); - void setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode); + bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level = -1, int* region = NULL); + void setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode); void cleanupCodeStream(); + // This method was public, but the only call to it is commented out in our + // own initDecode() method. I (nat 2016-08-04) don't know what it does or + // why. Even if it should be uncommented, it should probably still be + // private. +// void findDiscardLevelsBoundaries(LLImageJ2C &base); + +public: + // Helper class to hold a kdu_codestream, which is a handle to the + // underlying implementation object. When CodeStreamHolder is reset() or + // destroyed, it calls kdu_codestream::destroy() -- which kdu_codestream + // itself does not. + // + // Call through it like a smart pointer using operator->(). + // + // Every RAII class must be noncopyable. For this we don't need move + // support. + class CodeStreamHolder: public boost::noncopyable + { + public: + ~CodeStreamHolder() + { + reset(); + } + + void reset() + { + if (mCodeStream.exists()) + { + mCodeStream.destroy(); + } + } + + kdu_codestream* operator->() { return &mCodeStream; } + kdu_codestream& get() { return mCodeStream; } + + private: + kdu_codestream mCodeStream; + }; + +private: // Encode variable - LLKDUMemSource *mInputp; - kdu_codestream *mCodeStreamp; - kdu_coords *mTPosp; // tile position - kdu_dims *mTileIndicesp; + boost::scoped_ptr mInputp; + CodeStreamHolder mCodeStreamp; + boost::scoped_ptr mTPosp; // tile position + boost::scoped_ptr mTileIndicesp; int mBlocksSize; int mPrecinctsSize; int mLevels; // Temporary variables for in-progress decodes... + // We don't own this LLImageRaw. We're simply pointing to an instance + // passed into initDecode(). LLImageRaw *mRawImagep; - LLKDUDecodeState *mDecodeState; + boost::scoped_ptr mDecodeState; }; -#if LL_WINDOWS -# define LLSYMEXPORT __declspec(dllexport) -#elif LL_LINUX -# define LLSYMEXPORT __attribute__ ((visibility("default"))) -#else -# define LLSYMEXPORT -#endif - -extern "C" LLSYMEXPORT const char* engineInfoLLImageJ2CKDU(); -extern "C" LLSYMEXPORT LLImageJ2CKDU* createLLImageJ2CKDU(); -extern "C" LLSYMEXPORT void destroyLLImageJ2CKDU(LLImageJ2CKDU* kdu); - #endif diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp index 0605fad068..e8b550baa6 100644 --- a/indra/llkdu/tests/llimagej2ckdu_test.cpp +++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp @@ -60,7 +60,7 @@ LLImageRaw::~LLImageRaw() { } U8* LLImageRaw::allocateData(S32 ) { return NULL; } void LLImageRaw::deleteData() { } U8* LLImageRaw::reallocateData(S32 ) { return NULL; } -BOOL LLImageRaw::resize(U16, U16, S8) { return TRUE; } // this method always returns TRUE... +bool LLImageRaw::resize(U16, U16, S8) { return true; } // this method always returns true... LLImageBase::LLImageBase() : LLTrace::MemTrackable("LLImageBase"), @@ -89,8 +89,8 @@ LLImageFormatted::~LLImageFormatted() { } U8* LLImageFormatted::allocateData(S32 ) { return NULL; } S32 LLImageFormatted::calcDataSize(S32 ) { return 0; } S32 LLImageFormatted::calcDiscardLevelBytes(S32 ) { return 0; } -BOOL LLImageFormatted::decodeChannels(LLImageRaw*, F32, S32, S32) { return FALSE; } -BOOL LLImageFormatted::copyData(U8 *, S32) { return TRUE; } // this method always returns TRUE... +bool LLImageFormatted::decodeChannels(LLImageRaw*, F32, S32, S32) { return false; } +bool LLImageFormatted::copyData(U8 *, S32) { return true; } // this method always returns true... void LLImageFormatted::deleteData() { } void LLImageFormatted::dump() { } U8* LLImageFormatted::reallocateData(S32 ) { return NULL; } @@ -103,14 +103,14 @@ LLImageJ2C::~LLImageJ2C() { } S32 LLImageJ2C::calcDataSize(S32 ) { return 0; } S32 LLImageJ2C::calcDiscardLevelBytes(S32 ) { return 0; } S32 LLImageJ2C::calcHeaderSize() { return 0; } -BOOL LLImageJ2C::decode(LLImageRaw*, F32) { return FALSE; } -BOOL LLImageJ2C::decodeChannels(LLImageRaw*, F32, S32, S32 ) { return FALSE; } +bool LLImageJ2C::decode(LLImageRaw*, F32) { return false; } +bool LLImageJ2C::decodeChannels(LLImageRaw*, F32, S32, S32 ) { return false; } void LLImageJ2C::decodeFailed() { } -BOOL LLImageJ2C::encode(const LLImageRaw*, F32) { return FALSE; } +bool LLImageJ2C::encode(const LLImageRaw*, F32) { return false; } S8 LLImageJ2C::getRawDiscardLevel() { return 0; } void LLImageJ2C::resetLastError() { } void LLImageJ2C::setLastError(const std::string&, const std::string&) { } -BOOL LLImageJ2C::updateData() { return FALSE; } +bool LLImageJ2C::updateData() { return false; } void LLImageJ2C::updateRawDiscardLevel() { } LLKDUMemIn::LLKDUMemIn(const U8*, const U32, const U16, const U16, const U8, siz_params*) { } @@ -212,12 +212,12 @@ namespace tut { public: // Provides public access to some protected methods for testing - BOOL callGetMetadata(LLImageJ2C &base) { return getMetadata(base); } - BOOL callDecodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) + bool callGetMetadata(LLImageJ2C &base) { return getMetadata(base); } + bool callDecodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { return decodeImpl(base, raw_image, decode_time, first_channel, max_channel_count); } - BOOL callEncodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text) + bool callEncodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text) { return encodeImpl(base, raw_image, comment_text); } @@ -254,10 +254,10 @@ namespace tut void llimagej2ckdu_object_t::test<1>() { LLImageJ2C* image = new LLImageJ2C(); - BOOL res = mImage->callGetMetadata(*image); - // Trying to set up a data stream with all NIL values and stubbed KDU will "work" and return TRUE - // Note that is linking with KDU, that call will throw an exception and fail, returning FALSE - ensure("getMetadata() test failed", res == TRUE); + bool res = mImage->callGetMetadata(*image); + // Trying to set up a data stream with all NIL values and stubbed KDU will "work" and return true + // Note that is linking with KDU, that call will throw an exception and fail, returning false + ensure("getMetadata() test failed", res); } // Test 2 : test decodeImpl() @@ -266,9 +266,9 @@ namespace tut { LLImageJ2C* image = new LLImageJ2C(); LLImageRaw* raw = new LLImageRaw(); - BOOL res = mImage->callDecodeImpl(*image, *raw, 0.0, 0, 0); - // Decoding returns TRUE whenever there's nothing else to do, including if decoding failed, so we'll get TRUE here - ensure("decodeImpl() test failed", res == TRUE); + bool res = mImage->callDecodeImpl(*image, *raw, 0.0, 0, 0); + // Decoding returns true whenever there's nothing else to do, including if decoding failed, so we'll get true here + ensure("decodeImpl() test failed", res); } // Test 3 : test encodeImpl() @@ -277,8 +277,8 @@ namespace tut { LLImageJ2C* image = new LLImageJ2C(); LLImageRaw* raw = new LLImageRaw(); - BOOL res = mImage->callEncodeImpl(*image, *raw, NULL); - // Encoding returns TRUE unless an exception was raised, so we'll get TRUE here though nothing really was done - ensure("encodeImpl() test failed", res == TRUE); + bool res = mImage->callEncodeImpl(*image, *raw, NULL); + // Encoding returns true unless an exception was raised, so we'll get true here though nothing really was done + ensure("encodeImpl() test failed", res); } } diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 4be677a4b0..0f23754096 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -181,6 +181,10 @@ protected: // Map of known bad assets typedef std::map toxic_asset_map_t; +// *TODO: these typedefs are passed into the VFS via a legacy C function pointer +// future project would be to convert these to C++ callables (std::function<>) so that +// we can use bind and remove the userData parameter. +// typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); diff --git a/indra/llmessage/llavatarname.cpp b/indra/llmessage/llavatarname.cpp index c5c1aa34bc..94441136e3 100644 --- a/indra/llmessage/llavatarname.cpp +++ b/indra/llmessage/llavatarname.cpp @@ -173,7 +173,7 @@ void LLAvatarName::setExpires(F64 expires) mExpires = LLFrameTimer::getTotalSeconds() + expires; } -std::string LLAvatarName::getCompleteName() const +std::string LLAvatarName::getCompleteName(bool use_parentheses) const { std::string name; if (sUseDisplayNames) @@ -221,7 +221,14 @@ std::string LLAvatarName::getCompleteName() const name = mDisplayName; if(sUseUsernames) { - name += " (" + mUsername + ")"; + if(use_parentheses) + { + name += " (" + mUsername + ")"; + } + else + { + name += " [ " + mUsername + " ]"; + } } } } @@ -265,7 +272,7 @@ std::string LLAvatarName::getDisplayName() const } } -std::string LLAvatarName::getUserName() const +std::string LLAvatarName::getUserName(bool lowercase) const { std::string name; if (mLegacyLastName.empty() || (mLegacyLastName == "Resident")) @@ -283,7 +290,15 @@ std::string LLAvatarName::getUserName() const } else { - name = mLegacyFirstName + " " + mLegacyLastName; + if(lowercase) + { + name = mLegacyFirstName + "." + mLegacyLastName; + LLStringUtil::toLower(name); + } + else + { + name = mLegacyFirstName + " " + mLegacyLastName; + } } return name; } diff --git a/indra/llmessage/llavatarname.h b/indra/llmessage/llavatarname.h index 16d88f28f8..1686fd676b 100644 --- a/indra/llmessage/llavatarname.h +++ b/indra/llmessage/llavatarname.h @@ -73,7 +73,7 @@ public: // For normal names, returns "James Linden (james.linden)" // When display names are disabled returns just "James Linden" - std::string getCompleteName() const; + std::string getCompleteName(bool use_parentheses = true) const; // Returns "James Linden" or "bobsmith123 Resident" for backwards // compatibility with systems like voice and muting @@ -88,7 +88,7 @@ public: // Returns "James Linden" or "bobsmith123 Resident" // Used where we explicitely prefer or need a non UTF-8 legacy (ASCII) name // Also used for backwards compatibility with systems like voice and muting - std::string getUserName() const; + std::string getUserName(bool lowercase = false) const; // FIRE-6659 - Returns the same as getUserName() but honors sTrimResidentSurname std::string getUserNameForDisplay() const; diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 56b5c1a7fd..1b7ee50d31 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -2301,7 +2301,11 @@ std::string LLDAELoader::getElementLabel(daeElement *element) // retrieve index to distinguish items inside same parent size_t ind = 0; parent->getChildren().find(element, ind); - index_string = "_" + boost::lexical_cast(ind); + + if (ind > 0) + { + index_string = "_" + boost::lexical_cast(ind); + } // if parent has a name or ID, use it std::string name = parent->getAttribute("name"); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 618cc206a1..beb0256080 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1422,12 +1422,9 @@ void LLFloater::setMinimized(BOOL minimize) } mMinimized = FALSE; - + setFrontmost(); // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); - - // FIRE-7530: Make sure, an un-minimized floater goes to the front - setFrontmost(); } make_ui_sound("UISndWindowClose"); @@ -1676,6 +1673,7 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) // FIRE-11724: Snooze group chat if(offerClickToButton(x, y, mask, BUTTON_SNOOZE)) return TRUE; + setFrontmost(TRUE, FALSE); // Otherwise pass to drag handle for movement return mDragHandle->handleMouseDown(x, y, mask); } @@ -1750,7 +1748,7 @@ void LLFloater::setVisibleAndFrontmost(BOOL take_focus,const LLSD& key) } } -void LLFloater::setFrontmost(BOOL take_focus) +void LLFloater::setFrontmost(BOOL take_focus, BOOL restore) { LLMultiFloater* hostp = getHost(); if (hostp) @@ -1766,7 +1764,7 @@ void LLFloater::setFrontmost(BOOL take_focus) LLFloaterView * parent = dynamic_cast( getParent() ); if (parent) { - parent->bringToFront(this, take_focus); + parent->bringToFront(this, take_focus, restore); } // Make sure to set the appropriate transparency type (STORM-732). @@ -2424,10 +2422,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - // Prefer dynamic_cast over c-style cast - //LLFloater* floaterp = (LLFloater*)viewp; LLFloater* floaterp = dynamic_cast(viewp); - // if (floaterp->isDependent()) { // dependents are moved with their "dependee" @@ -2484,15 +2479,11 @@ void LLFloaterView::restoreAll() // make sure all subwindows aren't minimized for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { - // Possible fix for crash on disconnect - //LLFloater* floaterp = (LLFloater*)*child_it; - //floaterp->setMinimized(FALSE); LLFloater* floaterp = dynamic_cast(*child_it); if (floaterp) { floaterp->setMinimized(FALSE); } - // } // *FIX: make sure dependents are restored @@ -2566,7 +2557,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF } -void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus) +void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore) { if (!child) return; @@ -2650,7 +2641,12 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus) { sendChildToFront(child); } - child->setMinimized(FALSE); + + if(restore) + { + child->setMinimized(FALSE); + } + if (give_focus && !gFocusMgr.childHasKeyboardFocus(child)) { child->setFocus(TRUE); @@ -2828,10 +2824,7 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom) ++child_it) //loop floaters { // Examine minimized children. - // Prefer dynamic_cast over c-style cast - //LLFloater* floater = (LLFloater*)((LLView*)*child_it); LLFloater* floater = dynamic_cast(*child_it); - // if(floater->isMinimized()) { LLRect r = floater->getRect(); @@ -2886,10 +2879,7 @@ void LLFloaterView::closeAllChildren(bool app_quitting) continue; } - // FIRE-14349: Crash in LLPanelEditWearable::isDirty() due to memory corruption? - //LLFloater* floaterp = (LLFloater*)viewp; LLFloater* floaterp = dynamic_cast(viewp); - // // Attempt to close floater. This will cause the "do you want to save" // dialogs to appear. @@ -2955,11 +2945,7 @@ BOOL LLFloaterView::allChildrenClosed() // by setting themselves invisible) for (child_list_const_iter_t it = getChildList()->begin(); it != getChildList()->end(); ++it) { - // Prefer dynamic_cast over c-style cast - //LLView* viewp = *it; - //LLFloater* floaterp = (LLFloater*)viewp; LLFloater* floaterp = dynamic_cast(*it); - // if (floaterp->getVisible() && !floaterp->isDead() && floaterp->isCloseable()) { @@ -3243,10 +3229,7 @@ void LLFloaterView::syncFloaterTabOrder() // otherwise, make sure the focused floater is in the front of the child list for ( child_list_const_reverse_iter_t child_it = getChildList()->rbegin(); child_it != getChildList()->rend(); ++child_it) { - // Prefer dynamic_cast over c-style cast - //LLFloater* floaterp = (LLFloater*)*child_it; LLFloater* floaterp = dynamic_cast(*child_it); - // if (gFocusMgr.childHasKeyboardFocus(floaterp)) { bringToFront(floaterp, FALSE); @@ -3268,10 +3251,7 @@ LLFloater* LLFloaterView::getParentFloater(LLView* viewp) const if (parentp == this) { - // FIRE-14349: Crash in LLPanelEditWearable::isDirty() due to memory corruption? - //return (LLFloater*)viewp; return dynamic_cast(viewp); - // } return NULL; diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 0363b1b7fa..ab09aa965b 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -320,7 +320,7 @@ public: /*virtual*/ void setVisible(BOOL visible); // do not override /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); // do not override - void setFrontmost(BOOL take_focus = TRUE); + void setFrontmost(BOOL take_focus = TRUE, BOOL restore = TRUE); virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); // Defaults to false. @@ -561,7 +561,7 @@ public: void setCycleMode(BOOL mode) { mFocusCycleMode = mode; } BOOL getCycleMode() const { return mFocusCycleMode; } - void bringToFront( LLFloater* child, BOOL give_focus = TRUE ); + void bringToFront( LLFloater* child, BOOL give_focus = TRUE, BOOL restore = TRUE ); void highlightFocusedFloater(); void unhighlightFocusedFloater(); void focusFrontFloater(); diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index a0b42fe2cf..acf214a87c 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1689,9 +1689,9 @@ void LLFolderView::update() if (mNeedsAutoSelect) { LL_RECORD_BLOCK_TIME(FTM_AUTO_SELECT); - // select new item only if a filtered item not currently selected + // select new item only if a filtered item not currently selected and there was a selection LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); - if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->getViewModelItem()->potentiallyVisible())) + if (!mAutoSelectOverride && selected_itemp && !selected_itemp->getViewModelItem()->potentiallyVisible()) { // these are named variables to get around gcc not binding non-const references to rvalues // and functor application is inherently non-const to allow for stateful functors diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 8425b4f927..c166c97d87 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -247,6 +247,8 @@ public: bool useLabelSuffix() { return mUseLabelSuffix; } virtual void updateMenu(); + void finishRenamingItem( void ); + // Note: We may eventually have to move that method up the hierarchy to LLFolderViewItem. LLHandle getHandle() const { return getDerivedHandle(); } @@ -260,7 +262,6 @@ protected: void commitRename( const LLSD& data ); void onRenamerLost(); - void finishRenamingItem( void ); void closeRenamer( void ); bool selectFirstItem(); diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 734125fb03..ae48df7c6b 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -138,6 +138,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mIsSelected( FALSE ), mIsCurSelection( FALSE ), mSelectPending(FALSE), + mIsItemCut(false), + mCutGeneration(0), mLabelStyle( LLFontGL::NORMAL ), mHasVisibleChildren(FALSE), mIsFolderComplete(true), @@ -761,6 +763,19 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L return mIsCurSelection; } +/*virtual*/ bool LLFolderViewItem::isFadeItem() +{ + LLClipboard& clipboard = LLClipboard::instance(); + if (mCutGeneration != clipboard.getGeneration()) + { + mCutGeneration = clipboard.getGeneration(); + mIsItemCut = clipboard.isCutMode() + && ((getParentFolder() && getParentFolder()->isFadeItem()) + || getViewModelItem()->isCutToClipboard()); + } + return mIsItemCut; +} + void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &focusOutlineColor, const LLUIColor &mouseOverColor) { @@ -942,14 +957,12 @@ void LLFolderViewItem::draw() } LLColor4 color = (mIsSelected && filled) ? mFontHighlightColor : mFontColor; - // Re-apply FIRE-6714: Don't move objects to trash during cut&paste - // Don't hide cut items in inventory - if (!getRoot()->getFolderViewModel()->getFilter().checkClipboard(getViewModelItem())) - { - // Fade out item color to indicate it's being cut - color.mV[VALPHA] *= 0.5f; - } - // Re-apply FIRE-6714: Don't move objects to trash during cut&paste + + if (isFadeItem()) + { + // Fade out item color to indicate it's being cut + color.mV[VALPHA] *= 0.5f; + } drawLabel(font, text_left, y, color, right_x); // Special for protected items @@ -967,7 +980,7 @@ void LLFolderViewItem::draw() // if (!mLabelSuffix.empty()) { - font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, + font->renderUTF8( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); } diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 7073c97f41..00a4856481 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -125,8 +125,11 @@ protected: mIsMouseOverTitle, mAllowWear, mAllowDrop, - mSelectPending; - + mSelectPending, + mIsItemCut; + + S32 mCutGeneration; + LLUIColor mFontColor; LLUIColor mFontHighlightColor; @@ -154,6 +157,7 @@ protected: virtual void addFolder(LLFolderViewFolder*) { } virtual bool isHighlightAllowed(); virtual bool isHighlightActive(); + virtual bool isFadeItem(); virtual bool isFlashing() { return false; } virtual void setFlashState(bool) { } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 6a12c6f5a5..f838d2f736 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -83,8 +83,6 @@ public: // +-------------------------------------------------------------------+ virtual bool check(const LLFolderViewModelItem* item) = 0; virtual bool checkFolder(const LLFolderViewModelItem* folder) const = 0; - // For clipboard highlighting - virtual bool checkClipboard(const LLFolderViewModelItem* item) = 0; virtual void setEmptyLookupMessage(const std::string& message) = 0; virtual std::string getEmptyLookupMessage() const = 0; @@ -191,6 +189,7 @@ public: virtual BOOL isItemCopyable() const = 0; virtual BOOL copyToClipboard() const = 0; virtual BOOL cutToClipboard() = 0; + virtual bool isCutToClipboard() { return false; }; virtual BOOL isClipboardPasteable() const = 0; virtual void pasteFromClipboard() = 0; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 86e17401d5..a1f268d312 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -417,12 +417,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text) if (mMaxLengthChars) { - LLWString truncated_wstring = utf8str_to_wstring(truncated_utf8); - if (truncated_wstring.size() > (U32)mMaxLengthChars) - { - truncated_wstring = truncated_wstring.substr(0, mMaxLengthChars); - } - mText.assign(wstring_to_utf8str(truncated_wstring)); + mText.assign(utf8str_symbol_truncate(truncated_utf8, mMaxLengthChars)); } if (all_selected) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 23c02a545f..37b8c0bb1b 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -199,6 +199,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) : LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)), mURLClickSignal(NULL), mIsFriendSignal(NULL), + mIsObjectBlockedSignal(NULL), mMaxTextByteLength( p.max_text_length ), mFont(p.font), mFontShadow(p.font_shadow), @@ -298,9 +299,8 @@ LLTextBase::~LLTextBase() { mSegments.clear(); delete mURLClickSignal; - // Properly free the signals delete mIsFriendSignal; - // + delete mIsObjectBlockedSignal; } void LLTextBase::initFromParams(const LLTextBase::Params& p) @@ -2064,6 +2064,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url)); registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url, true)); registrar.add("Url.Block", boost::bind(&LLUrlAction::blockObject, url)); + registrar.add("Url.Unblock", boost::bind(&LLUrlAction::unblockObject, url)); registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url)); registrar.add("Url.AddFriend", boost::bind(&LLUrlAction::addFriend, url)); @@ -2119,6 +2120,19 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) removeFriendButton->setEnabled(isFriend); } } + + if (mIsObjectBlockedSignal) + { + bool is_blocked = *(*mIsObjectBlockedSignal)(LLUUID(LLUrlAction::getObjectId(url)), LLUrlAction::getObjectName(url)); + LLView* blockButton = mPopupMenu->getChild("block_object"); + LLView* unblockButton = mPopupMenu->getChild("unblock_object"); + + if (blockButton && unblockButton) + { + blockButton->setVisible(!is_blocked); + unblockButton->setVisible(is_blocked); + } + } if (mPopupMenu) { @@ -3257,6 +3271,15 @@ boost::signals2::connection LLTextBase::setIsFriendCallback(const is_friend_sign return mIsFriendSignal->connect(cb); } +boost::signals2::connection LLTextBase::setIsObjectBlockedCallback(const is_blocked_signal_t::slot_type& cb) +{ + if (!mIsObjectBlockedSignal) + { + mIsObjectBlockedSignal = new is_blocked_signal_t(); + } + return mIsObjectBlockedSignal->connect(cb); +} + // // LLTextSegment // diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 7b45946adc..5eef7476ea 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -292,6 +292,7 @@ public: friend class LLUICtrlFactory; typedef boost::signals2::signal is_friend_signal_t; + typedef boost::signals2::signal is_blocked_signal_t; struct LineSpacingParams : public LLInitParam::ChoiceBlock { @@ -500,6 +501,7 @@ public: virtual void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo); boost::signals2::connection setURLClickedCallback(const commit_signal_t::slot_type& cb); boost::signals2::connection setIsFriendCallback(const is_friend_signal_t::slot_type& cb); + boost::signals2::connection setIsObjectBlockedCallback(const is_blocked_signal_t::slot_type& cb); void setWordWrap(bool wrap); LLScrollContainer* getScrollContainer() const { return mScroller; } @@ -750,6 +752,7 @@ protected: // Used to check if user with given ID is avatar's friend is_friend_signal_t* mIsFriendSignal; + is_blocked_signal_t* mIsObjectBlockedSignal; LLUIString mLabel; // text label that is visible when no user text provided // Optional icon position diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp index fff04b34f2..f6b2ee1dc0 100644 --- a/indra/llui/lltextutil.cpp +++ b/indra/llui/lltextutil.cpp @@ -56,6 +56,26 @@ void LLTextUtil::textboxSetHighlightedVal(LLTextBox *txtbox, const LLStyle::Para txtbox->appendText(text.substr(hl_begin + hl_len), false, normal_style); } +void LLTextUtil::textboxSetGreyedVal(LLTextBox *txtbox, const LLStyle::Params& normal_style, const std::string& text, const std::string& greyed) +{ + static LLUIColor sGreyedTextColor = LLUIColorTable::instance().getColor("Gray", LLColor4::grey); + + size_t greyed_begin = 0, greyed_len = greyed.size(); + + if (greyed_len == 0 || (greyed_begin = text.find(greyed)) == std::string::npos) + { + txtbox->setText(text, normal_style); + return; + } + + LLStyle::Params greyed_style = normal_style; + greyed_style.color = sGreyedTextColor; + txtbox->setText(LLStringUtil::null); // clear text + txtbox->appendText(text.substr(0, greyed_begin), false, normal_style); + txtbox->appendText(text.substr(greyed_begin, greyed_len), false, greyed_style); + txtbox->appendText(text.substr(greyed_begin + greyed_len), false, normal_style); +} + const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str) { static const std::string PHONE_SEPARATOR = LLUI::sSettingGroups["config"]->getString("AvalinePhoneSeparator"); diff --git a/indra/llui/lltextutil.h b/indra/llui/lltextutil.h index 1be81ffd62..a9c143e445 100644 --- a/indra/llui/lltextutil.h +++ b/indra/llui/lltextutil.h @@ -52,6 +52,12 @@ namespace LLTextUtil const std::string& text, const std::string& hl); + void textboxSetGreyedVal( + LLTextBox *txtbox, + const LLStyle::Params& normal_style, + const std::string& text, + const std::string& greyed); + /** * Formats passed phone number to be more human readable. * diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index 6ca424725e..7bb9495db9 100644 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp @@ -232,6 +232,16 @@ void LLUrlAction::blockObject(std::string url) } } +void LLUrlAction::unblockObject(std::string url) +{ + std::string object_id = getObjectId(url); + std::string object_name = getObjectName(url); + if (LLUUID::validate(object_id)) + { + executeSLURL("secondlife:///app/agent/" + object_id + "/unblock/" + object_name); + } +} + // FSSlurlCommand support LLUUID LLUrlAction::extractUuidFromSlurl(const std::string& url) { diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index edc100da0f..73ecf85129 100644 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -83,6 +83,7 @@ public: static void addFriend(std::string url); static void removeFriend(std::string url); static void blockObject(std::string url); + static void unblockObject(std::string url); // FSSlurlCommand support static LLUUID extractUuidFromSlurl(const std::string& url); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 6c06f8a914..12185ee71f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -643,6 +643,11 @@ void LLView::onVisibilityChange ( BOOL new_visibility ) BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); BOOST_FOREACH(LLView* viewp, mChildList) { + if (!viewp) + { + continue; + } + // only views that are themselves visible will have their overall visibility affected by their ancestors old_visibility=viewp->getVisible(); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index aab04249ad..664f1a0a62 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1595,13 +1595,10 @@ list(APPEND viewer_HEADER_FILES ${CMAKE_CURRENT_BINARY_DIR}/fsversionvalues.h) source_group("CMake Rules" FILES ViewerInstall.cmake) +#summary.json creation moved to viewer_manifest.py MAINT-6413 # the viewer_version.txt file created here is for passing to viewer_manifest and autobuild -# the summary.json file is created for the benefit of the TeamCity builds, where -# it is used to provide descriptive information to the build results page file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt" "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}\n") -file(WRITE "${CMAKE_BINARY_DIR}/summary.json" - "{\"Type\":\"viewer\",\"Version\":\"${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}\"}\n") set_source_files_properties( llversioninfo.cpp tests/llversioninfo_test.cpp diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 3f5fd747ed..bd84d34b70 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -41,7 +41,7 @@ tooltip_ref="Command_Build_Tooltip" execute_function="Build.Toggle" execute_parameters="build" - is_enabled_function="Build.Enabled" + is_enabled_function="Build.EnabledOrActive" is_enabled_parameters="build" is_running_function="Floater.IsOpen" is_running_parameters="build" diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5b5ce05d02..3e8fd45695 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5753,6 +5753,17 @@ Value 1 + QueueInventoryFetchTimeout + + Comment + Max time llcompilequeue will wait for inventory fetch to complete (in seconds) + Persist + 1 + Type + F32 + Value + 300.0 + FindLandArea Comment @@ -13736,6 +13747,28 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + FriendsListHideUsernames + + Comment + Show both Display name and Username in Friend list + Persist + 1 + Type + Boolean + Value + 0 + + NearbyListHideUsernames + + Comment + Show both Display name and Username in Nearby list + Persist + 1 + Type + Boolean + Value + 0 + NearbyListShowIcons Comment @@ -16367,6 +16400,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + UpdaterShowReleaseNotes + + Comment + Enables displaying of the Release notes in a web floater after update. + Persist + 1 + Type + Boolean + Value + 0 + UploadBakedTexOld Comment diff --git a/indra/newview/fonts/fonts.xml b/indra/newview/fonts/fonts.xml index 77aaf03dbd..9bd2f9f6e9 100644 --- a/indra/newview/fonts/fonts.xml +++ b/indra/newview/fonts/fonts.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fonts/fonts_deja_vu_all_caps.xml b/indra/newview/fonts/fonts_deja_vu_all_caps.xml index 6f741abc31..e3901a7470 100644 --- a/indra/newview/fonts/fonts_deja_vu_all_caps.xml +++ b/indra/newview/fonts/fonts_deja_vu_all_caps.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fonts/fonts_droid.xml b/indra/newview/fonts/fonts_droid.xml index a90db0b89e..bc9a1f677c 100644 --- a/indra/newview/fonts/fonts_droid.xml +++ b/indra/newview/fonts/fonts_droid.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fonts/fonts_dyslexia.xml b/indra/newview/fonts/fonts_dyslexia.xml index 2965df39d3..0b7c4aa13b 100644 --- a/indra/newview/fonts/fonts_dyslexia.xml +++ b/indra/newview/fonts/fonts_dyslexia.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fonts/fonts_liberation.xml b/indra/newview/fonts/fonts_liberation.xml index 156b420647..c30f15a89c 100644 --- a/indra/newview/fonts/fonts_liberation.xml +++ b/indra/newview/fonts/fonts_liberation.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fonts/fonts_mobi.xml b/indra/newview/fonts/fonts_mobi.xml index fe49a08c22..bc892879c6 100644 --- a/indra/newview/fonts/fonts_mobi.xml +++ b/indra/newview/fonts/fonts_mobi.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fonts/fonts_roboto.xml b/indra/newview/fonts/fonts_roboto.xml index b346943f73..cab758adf8 100644 --- a/indra/newview/fonts/fonts_roboto.xml +++ b/indra/newview/fonts/fonts_roboto.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fonts/fonts_ubuntu.xml b/indra/newview/fonts/fonts_ubuntu.xml index 2e83b57696..84ba831f6a 100644 --- a/indra/newview/fonts/fonts_ubuntu.xml +++ b/indra/newview/fonts/fonts_ubuntu.xml @@ -15,6 +15,7 @@ ヒラギノ角ゴシック W3.ttc ヒラギノ角ゴ Pro W3.otf ヒラギノ角ゴ ProN W3.otf + ヒラギノ明朝 ProN W3.ttc AppleSDGothicNeo.ttc diff --git a/indra/newview/fschathistory.cpp b/indra/newview/fschathistory.cpp index cee2e21b77..1e832201b3 100644 --- a/indra/newview/fschathistory.cpp +++ b/indra/newview/fschathistory.cpp @@ -172,6 +172,10 @@ public: LLMuteList::getInstance()->add(LLMute(getAvatarId(), mFrom, LLMute::OBJECT)); LLPanelBlockedList::showPanelAndSelect(getAvatarId()); } + else if (level == "unblock") + { + LLMuteList::getInstance()->remove(LLMute(getAvatarId(), mFrom, LLMute::OBJECT)); + } else if (level == "map") { std::string url = "secondlife://" + mObjectData["slurl"].asString(); @@ -184,6 +188,20 @@ public: } } + bool onObjectIconContextMenuItemVisible(const LLSD& userdata) + { + std::string level = userdata.asString(); + if (level == "is_blocked") + { + return LLMuteList::getInstance()->isMuted(getAvatarId(), mFrom, LLMute::flagTextChat); + } + else if (level == "not_blocked") + { + return !LLMuteList::getInstance()->isMuted(getAvatarId(), mFrom, LLMute::flagTextChat); + } + return false; + } + void onAvatarIconContextMenuItemClicked(const LLSD& userdata) { std::string level = userdata.asString(); @@ -310,6 +328,7 @@ public: registrar.add("AvatarIcon.Action", boost::bind(&FSChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2)); registrar_enable.add("AvatarIcon.Check", boost::bind(&FSChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2)); registrar.add("ObjectIcon.Action", boost::bind(&FSChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2)); + registrar_enable.add("ObjectIcon.Visible", boost::bind(&FSChatHistoryHeader::onObjectIconContextMenuItemVisible, this, _2)); LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mPopupMenuHandleAvatar = menu->getHandle(); @@ -844,7 +863,9 @@ FSChatHistory::FSChatHistory(const FSChatHistory::Params& p) mScrollToBottom(false), mUnreadChatSources(0) { - mLineSpacingPixels=llclamp(gSavedSettings.getS32("FSFontChatLineSpacingPixels"),0,36); + mLineSpacingPixels = llclamp(gSavedSettings.getS32("FSFontChatLineSpacingPixels"), 0, 36); + + setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0)); } LLSD FSChatHistory::getValue() const diff --git a/indra/newview/fsfloaterplacedetails.cpp b/indra/newview/fsfloaterplacedetails.cpp index 0cd83e9bec..8ca6081b39 100644 --- a/indra/newview/fsfloaterplacedetails.cpp +++ b/indra/newview/fsfloaterplacedetails.cpp @@ -916,4 +916,26 @@ void FSFloaterPlaceDetails::changedParcelSelection() updateVerbs(); } +void FSFloaterPlaceDetails::updateEstateName(const std::string& name) +{ + if (mPanelPlaceInfo) + { + mPanelPlaceInfo->updateEstateName(name); + } +} +void FSFloaterPlaceDetails::updateEstateOwnerName(const std::string& name) +{ + if (mPanelPlaceInfo) + { + mPanelPlaceInfo->updateEstateOwnerName(name); + } +} + +void FSFloaterPlaceDetails::updateCovenantText(const std::string &text) +{ + if (mPanelPlaceInfo) + { + mPanelPlaceInfo->updateCovenantText(text); + } +} diff --git a/indra/newview/fsfloaterplacedetails.h b/indra/newview/fsfloaterplacedetails.h index 3cb4c85594..d25eeae55c 100644 --- a/indra/newview/fsfloaterplacedetails.h +++ b/indra/newview/fsfloaterplacedetails.h @@ -65,6 +65,10 @@ public: static void showPlaceDetails(const LLSD& key); + void updateEstateName(const std::string& name); + void updateEstateOwnerName(const std::string& name); + void updateCovenantText(const std::string &text); + private: enum ePlaceDisplayInfo { diff --git a/indra/newview/fspanellogin.cpp b/indra/newview/fspanellogin.cpp index a6134f7d27..2690b69fbe 100644 --- a/indra/newview/fspanellogin.cpp +++ b/indra/newview/fspanellogin.cpp @@ -1026,7 +1026,7 @@ void FSPanelLogin::updateServer() loadLoginPage(); #ifdef OPENSIM - sInstance->getChild("password_edit")->setMaxTextLength(LLGridManager::getInstance()->isInSecondLife() ? MAX_PASSWORD_SL : MAX_PASSWORD_OPENSIM); + sInstance->getChild("password_edit")->setMaxTextChars(LLGridManager::getInstance()->isInSecondLife() ? MAX_PASSWORD_SL : MAX_PASSWORD_OPENSIM); #endif } catch (LLInvalidGridName ex) diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index fd582f5e3c..b7f1b00724 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -710,6 +710,7 @@ Function un.ProgramFiles %%DELETE_FILES%% # Optional/obsolete files. Delete won't fail if they don't exist. +Delete "$INSTDIR\autorun.bat" Delete "$INSTDIR\dronesettings.ini" Delete "$INSTDIR\message_template.msg" Delete "$INSTDIR\newview.pdb" @@ -741,6 +742,16 @@ FOLDERFOUND: NOFOLDER: +MessageBox MB_YESNO $(DeleteRegistryKeysMB) IDYES DeleteKeys IDNO NoDelete + +DeleteKeys: + DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Classes\x-grid-location-info" + DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Classes\secondlife" + DeleteRegKey HKEY_CLASSES_ROOT "x-grid-location-info" + DeleteRegKey HKEY_CLASSES_ROOT "secondlife" + +NoDelete: + FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/indra/newview/installers/windows/lang_da.nsi b/indra/newview/installers/windows/lang_da.nsi index 87cbb7878d..f9fd770307 100644 Binary files a/indra/newview/installers/windows/lang_da.nsi and b/indra/newview/installers/windows/lang_da.nsi differ diff --git a/indra/newview/installers/windows/lang_de.nsi b/indra/newview/installers/windows/lang_de.nsi index b726bfdf17..9e4d072422 100644 Binary files a/indra/newview/installers/windows/lang_de.nsi and b/indra/newview/installers/windows/lang_de.nsi differ diff --git a/indra/newview/installers/windows/lang_en-us.nsi b/indra/newview/installers/windows/lang_en-us.nsi index 6e49575f88..83df5d4f82 100644 Binary files a/indra/newview/installers/windows/lang_en-us.nsi and b/indra/newview/installers/windows/lang_en-us.nsi differ diff --git a/indra/newview/installers/windows/lang_es.nsi b/indra/newview/installers/windows/lang_es.nsi index 8215a70330..7915ada30e 100644 Binary files a/indra/newview/installers/windows/lang_es.nsi and b/indra/newview/installers/windows/lang_es.nsi differ diff --git a/indra/newview/installers/windows/lang_fr.nsi b/indra/newview/installers/windows/lang_fr.nsi index 3a377ff6c0..3afeba000a 100644 Binary files a/indra/newview/installers/windows/lang_fr.nsi and b/indra/newview/installers/windows/lang_fr.nsi differ diff --git a/indra/newview/installers/windows/lang_it.nsi b/indra/newview/installers/windows/lang_it.nsi index 96da714f6c..c823dc5099 100644 Binary files a/indra/newview/installers/windows/lang_it.nsi and b/indra/newview/installers/windows/lang_it.nsi differ diff --git a/indra/newview/installers/windows/lang_ja.nsi b/indra/newview/installers/windows/lang_ja.nsi index 66ba4bf97e..8d1dbe8c22 100644 Binary files a/indra/newview/installers/windows/lang_ja.nsi and b/indra/newview/installers/windows/lang_ja.nsi differ diff --git a/indra/newview/installers/windows/lang_pl.nsi b/indra/newview/installers/windows/lang_pl.nsi index c3d4106a49..30fc056ae1 100644 Binary files a/indra/newview/installers/windows/lang_pl.nsi and b/indra/newview/installers/windows/lang_pl.nsi differ diff --git a/indra/newview/installers/windows/lang_pt-br.nsi b/indra/newview/installers/windows/lang_pt-br.nsi index d3711c3656..b1042fc7fb 100644 Binary files a/indra/newview/installers/windows/lang_pt-br.nsi and b/indra/newview/installers/windows/lang_pt-br.nsi differ diff --git a/indra/newview/installers/windows/lang_ru.nsi b/indra/newview/installers/windows/lang_ru.nsi index 1cece26e38..ea36af93a3 100644 Binary files a/indra/newview/installers/windows/lang_ru.nsi and b/indra/newview/installers/windows/lang_ru.nsi differ diff --git a/indra/newview/installers/windows/lang_tr.nsi b/indra/newview/installers/windows/lang_tr.nsi index b58f927185..d4e21b8a5c 100644 Binary files a/indra/newview/installers/windows/lang_tr.nsi and b/indra/newview/installers/windows/lang_tr.nsi differ diff --git a/indra/newview/installers/windows/lang_zh.nsi b/indra/newview/installers/windows/lang_zh.nsi index 266a42d91f..5378ad9de1 100644 Binary files a/indra/newview/installers/windows/lang_zh.nsi and b/indra/newview/installers/windows/lang_zh.nsi differ diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 38d83ef90b..ea6ab5d52f 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1418,6 +1418,8 @@ bool LLAppViewer::init() // Init debug rects LLView::sDebugRects = gSavedSettings.getBOOL("DebugViews"); + showReleaseNotesIfRequired(); + return true; } @@ -4141,6 +4143,11 @@ std::string LLAppViewer::getViewerInfoString() const support << '\n' << LLTrans::getString("AboutTraffic", args); } + // SLT timestamp + LLSD substitution; + substitution["datetime"] = (S32)time(NULL);//(S32)time_corrected(); + support << "\n" << LLTrans::getString("AboutTime", substitution); + return support.str(); } @@ -6731,6 +6738,18 @@ void LLAppViewer::launchUpdater() // LLAppViewer::instance()->forceQuit(); } +/** +* Check if user is running a new version of the viewer. +* Display the Release Notes if it's not overriden by the "UpdaterShowReleaseNotes" setting. +*/ +void LLAppViewer::showReleaseNotesIfRequired() +{ + if (LLVersionInfo::getChannelAndVersion() != gLastRunVersion && gSavedSettings.getBOOL("UpdaterShowReleaseNotes")) + { + LLSD info(getViewerInfo()); + LLWeb::loadURLInternal(info["VIEWER_RELEASE_NOTES_URL"]); + } +} //virtual void LLAppViewer::setMasterSystemAudioMute(bool mute) diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 6e1159c504..7e7ae580b9 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -264,6 +264,8 @@ private: void sendLogoutRequest(); void disconnectViewer(); + + void showReleaseNotesIfRequired(); // *FIX: the app viewer class should be some sort of singleton, no? // Perhaps its child class is the singleton and this should be an abstract base. diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 4ef00f9c73..5037e4ac5f 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -642,6 +642,57 @@ void LLAvatarActions::kick(const LLUUID& id) LLNotifications::instance().add("KickUser", LLSD(), payload, handleKick); } +// static +void LLAvatarActions::freezeAvatar(const LLUUID& id) +{ + std::string fullname; + gCacheName->getFullName(id, fullname); + LLSD payload; + payload["avatar_id"] = id; + + if (!fullname.empty()) + { + LLSD args; + args["AVATAR_NAME"] = fullname; + LLNotificationsUtil::add("FreezeAvatarFullname", args, payload, handleFreezeAvatar); + } + else + { + LLNotificationsUtil::add("FreezeAvatar", LLSD(), payload, handleFreezeAvatar); + } +} + +// static +void LLAvatarActions::ejectAvatar(const LLUUID& id, bool ban_enabled) +{ + std::string fullname; + gCacheName->getFullName(id, fullname); + LLSD payload; + payload["avatar_id"] = id; + payload["ban_enabled"] = ban_enabled; + LLSD args; + if (!fullname.empty()) + { + args["AVATAR_NAME"] = fullname; + } + + if (ban_enabled) + { + LLNotificationsUtil::add("EjectAvatarFullname", args, payload, handleEjectAvatar); + } + else + { + if (!fullname.empty()) + { + LLNotificationsUtil::add("EjectAvatarFullnameNoBan", args, payload, handleEjectAvatar); + } + else + { + LLNotificationsUtil::add("EjectAvatarNoBan", LLSD(), payload, handleEjectAvatar); + } + } +} + // static void LLAvatarActions::freeze(const LLUUID& id) { @@ -649,7 +700,6 @@ void LLAvatarActions::freeze(const LLUUID& id) payload["avatar_id"] = id; LLNotifications::instance().add("FreezeUser", LLSD(), payload, handleFreeze); } - // static void LLAvatarActions::unfreeze(const LLUUID& id) { @@ -1477,10 +1527,77 @@ bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response) } return false; } -bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response) + +bool LLAvatarActions::handleFreezeAvatar(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); + if (0 == option || 1 == option) + { + U32 flags = 0x0; + if (1 == option) + { + // unfreeze + flags |= 0x1; + } + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage("FreezeUser"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("Data"); + msg->addUUID("TargetID", avatar_id ); + msg->addU32("Flags", flags ); + gAgent.sendReliableMessage(); + } + return false; +} + +bool LLAvatarActions::handleEjectAvatar(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (2 == option) + { + return false; + } + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean(); + + if (0 == option) + { + LLMessageSystem* msg = gMessageSystem; + U32 flags = 0x0; + msg->newMessage("EjectUser"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID() ); + msg->addUUID("SessionID", gAgent.getSessionID() ); + msg->nextBlock("Data"); + msg->addUUID("TargetID", avatar_id ); + msg->addU32("Flags", flags ); + gAgent.sendReliableMessage(); + } + else if (ban_enabled) + { + LLMessageSystem* msg = gMessageSystem; + + U32 flags = 0x1; + msg->newMessage("EjectUser"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID() ); + msg->addUUID("SessionID", gAgent.getSessionID() ); + msg->nextBlock("Data"); + msg->addUUID("TargetID", avatar_id ); + msg->addU32("Flags", flags ); + gAgent.sendReliableMessage(); + } + return false; +} + +bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); if (option == 0) { LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); @@ -1497,6 +1614,7 @@ bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& respons } return false; } + bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 0a795126a5..7b995fc65c 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -183,6 +183,9 @@ public: */ static void inviteToGroup(const LLUUID& id); + static void freezeAvatar(const LLUUID& id); + + static void ejectAvatar(const LLUUID& id, bool ban_enabled = false); /** * Kick avatar off grid */ @@ -322,6 +325,8 @@ private: static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static bool handleRemove(const LLSD& notification, const LLSD& response); static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id); + static bool handleFreezeAvatar(const LLSD& notification, const LLSD& response); + static bool handleEjectAvatar(const LLSD& notification, const LLSD& response); static bool handleKick(const LLSD& notification, const LLSD& response); static bool handleFreeze(const LLSD& notification, const LLSD& response); static bool handleUnfreeze(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 36aec75413..8406fb9fa2 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -185,6 +185,7 @@ LLAvatarList::LLAvatarList(const Params& p) , mShowProfileBtn(p.show_profile_btn) , mShowSpeakingIndicator(p.show_speaking_indicator) , mShowPermissions(p.show_permissions_granted) +, mShowCompleteName(false) // [RLVa:KB] - Checked: RLVa-1.2.0 , mRlvCheckShowNames(false) // [/RLVa:KB] @@ -251,6 +252,11 @@ void LLAvatarList::setShowIcons(std::string param_name) mShowIcons = gSavedSettings.getBOOL(mIconParamName); } +std::string LLAvatarList::getAvatarName(LLAvatarName av_name) +{ + return mShowCompleteName? av_name.getCompleteName(false) : av_name.getDisplayName(); +} + // Update voice volume slider on RLVa shownames restriction update void LLAvatarList::updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type) { @@ -397,7 +403,7 @@ void LLAvatarList::refresh() have_names &= LLAvatarNameCache::get(buddy_id, &av_name); // FIRE-12750: Name filter not working correctly - //if (!have_filter || findInsensitive(av_name.getDisplayName(), mNameFilter)) + //if (!have_filter || findInsensitive(getAvatarName(av_name), mNameFilter)) if (!have_filter || findInsensitive(getNameForDisplay(buddy_id, av_name, mShowDisplayName, mShowUsername, mRlvCheckShowNames), mNameFilter)) // { @@ -419,7 +425,7 @@ void LLAvatarList::refresh() { // Always show usernames on avatar lists // The passed name is not used as of 21-01-2014 - //std::string display_name = av_name.getDisplayName(); + //std::string display_name = getAvatarName(av_name); //addNewItem(buddy_id, // display_name.empty() ? waiting_str : display_name, // LLAvatarTracker::instance().isBuddyOnline(buddy_id)); @@ -453,7 +459,7 @@ void LLAvatarList::refresh() LLAvatarName av_name; have_names &= LLAvatarNameCache::get(buddy_id, &av_name); // FIRE-12750: Name filter not working correctly - //if (!findInsensitive(av_name.getDisplayName(), mNameFilter)) + //if (!findInsensitive(getAvatarName(av_name), mNameFilter)) if (!findInsensitive(getNameForDisplay(buddy_id, av_name, mShowDisplayName, mShowUsername, mRlvCheckShowNames), mNameFilter)) // { @@ -509,6 +515,7 @@ void LLAvatarList::updateAvatarNames() for( std::vector::const_iterator it = items.begin(); it != items.end(); it++) { LLAvatarListItem* item = static_cast(*it); + item->setShowCompleteName(mShowCompleteName); item->updateAvatarName(); } mNeedUpdateNames = false; @@ -529,7 +536,7 @@ bool LLAvatarList::filterHasMatches() // When the name will be loaded the filter will be applied again(in refresh()). // FIRE-12750: Name filter not working correctly - //if (have_name && !findInsensitive(av_name.getDisplayName(), mNameFilter)) + //if (have_name && !findInsensitive(getAvatarName(av_name), mNameFilter)) if (have_name && !findInsensitive(getNameForDisplay(buddy_id, av_name, mShowDisplayName, mShowUsername, mRlvCheckShowNames), mNameFilter)) // { @@ -585,6 +592,7 @@ S32 LLAvatarList::notifyParent(const LLSD& info) void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos) { LLAvatarListItem* item = new LLAvatarListItem(); + item->setShowCompleteName(mShowCompleteName); // [RLVa:KB] - Checked: RLVa-1.2.0 item->setRlvCheckShowNames(mRlvCheckShowNames); // [/RLVa:KB] diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 924100a3f4..2bbf5a1d86 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -94,6 +94,7 @@ public: void setShowIcons(std::string param_name); bool getIconsVisible() const { return mShowIcons; } const std::string getIconParamName() const{return mIconParamName;} + std::string getAvatarName(LLAvatarName av_name); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -124,6 +125,8 @@ public: void addAvalineItem(const LLUUID& item_id, const LLUUID& session_id, const std::string& item_name); void handleDisplayNamesOptionChanged(); + void setShowCompleteName(bool show) { mShowCompleteName = show;}; + protected: void refresh(); @@ -151,6 +154,7 @@ private: bool mShowVoiceVolume; bool mShowSpeakingIndicator; bool mShowPermissions; + bool mShowCompleteName; // [RLVa:KB] - RLVa-1.2.0 bool mRlvCheckShowNames; // [/RLVa:KB] diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 5d4e59aad9..bc0813c34a 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -92,8 +92,10 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) mRlvCheckShowNames(false), // [/RLVa:KB] mShowPermissions(false), + mShowCompleteName(false), mHovered(false), mAvatarNameCacheConnection(), + mGreyOutUsername(""), mShowVoiceVolume(false), mShowDisplayName(true), mShowUsername(true) @@ -574,14 +576,31 @@ void LLAvatarListItem::updateAvatarName() void LLAvatarListItem::setNameInternal(const std::string& name, const std::string& highlight) { + // Commented out because horrible LL implementation - we control it via global display name settings! + //if(mShowCompleteName && highlight.empty()) + //{ + // LLTextUtil::textboxSetGreyedVal(mAvatarName, mAvatarNameStyle, name, mGreyOutUsername); + //} + //else + //{ + // LLTextUtil::textboxSetHighlightedVal(mAvatarName, mAvatarNameStyle, name, highlight); + //} LLTextUtil::textboxSetHighlightedVal(mAvatarName, mAvatarNameStyle, name, highlight); + // } void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) { mAvatarNameCacheConnection.disconnect(); -// setAvatarName(av_name.getDisplayName()); -// setAvatarToolTip(av_name.getUserName()); + //mGreyOutUsername = ""; + //std::string name_string = mShowCompleteName? av_name.getCompleteName(false) : av_name.getDisplayName(); + //if(av_name.getCompleteName() != av_name.getUserName()) + //{ + // mGreyOutUsername = "[ " + av_name.getUserName(true) + " ]"; + // LLStringUtil::toLower(mGreyOutUsername); + //} + //setAvatarName(name_string); + //setAvatarToolTip(av_name.getUserName()); // [RLVa:KB] - Checked: RLVa-1.2.2 // Centralized in LLAvatarList::getNameForDisplay! bool fRlvCanShowName = (!mRlvCheckShowNames) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, mAvatarId)); diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index bc8b3d5d6c..3b4b6f50f7 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -116,6 +116,7 @@ public: void setShowPermissions(bool show); void showLastInteractionTime(bool show); void setAvatarIconVisible(bool visible); + void setShowCompleteName(bool show) { mShowCompleteName = show;}; // [RLVa:KB] - Checked: RLVa-1.2.0 void setRlvCheckShowNames(bool fRlvCheckShowNames); void updateRlvRestrictions(); @@ -263,6 +264,9 @@ private: /// true when the mouse pointer is hovering over this item bool mHovered; + bool mShowCompleteName; + std::string mGreyOutUsername; + void fetchAvatarName(); boost::signals2::connection mAvatarNameCacheConnection; diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 1f5784bf73..9b8feba76e 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -169,6 +169,10 @@ public: LLFloaterSidePanelContainer::showPanel("people", "panel_people", LLSD().with("people_panel_tab_name", "blocked_panel").with("blocked_to_select", getAvatarId())); } + else if (level == "unblock") + { + LLMuteList::getInstance()->remove(LLMute(getAvatarId(), mFrom, LLMute::OBJECT)); + } else if (level == "map") { std::string url = "secondlife://" + mObjectData["slurl"].asString(); @@ -182,6 +186,20 @@ public: } + bool onObjectIconContextMenuItemVisible(const LLSD& userdata) + { + std::string level = userdata.asString(); + if (level == "is_blocked") + { + return LLMuteList::getInstance()->isMuted(getAvatarId(), mFrom, LLMute::flagTextChat); + } + else if (level == "not_blocked") + { + return !LLMuteList::getInstance()->isMuted(getAvatarId(), mFrom, LLMute::flagTextChat); + } + return false; + } + void onAvatarIconContextMenuItemClicked(const LLSD& userdata) { std::string level = userdata.asString(); @@ -288,6 +306,7 @@ public: registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2)); registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2)); registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2)); + registrar_enable.add("ObjectIcon.Visible", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemVisible, this, _2)); LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mPopupMenuHandleAvatar = menu->getHandle(); @@ -772,6 +791,8 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p) editor_params.trusted_content = false; mEditor = LLUICtrlFactory::create(editor_params, this); mEditor->setIsFriendCallback(LLAvatarActions::isFriend); + mEditor->setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0)); + } LLSD LLChatHistory::getValue() const diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 45660cbbad..04c2c7b072 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -61,11 +61,77 @@ #include "llviewerassetupload.h" #include "llcorehttputil.h" -// LSL Preprocessor + +// [LSL PreProc] #include "fslslpreproc.h" #include "llsdutil.h" // +namespace +{ + + const std::string QUEUE_EVENTPUMP_NAME("ScriptActionQueue"); + + + class ObjectInventoryFetcher: public LLVOInventoryListener + { + public: + typedef boost::shared_ptr ptr_t; + + ObjectInventoryFetcher(LLEventPump &pump, LLViewerObject* object, void* user_data) : + mPump(pump), + LLVOInventoryListener() + { + registerVOInventoryListener(object, this); + } + + virtual void inventoryChanged(LLViewerObject* object, + LLInventoryObject::object_list_t* inventory, + S32 serial_num, + void* user_data); + + void fetchInventory() + { + requestVOInventory(); + } + + const LLInventoryObject::object_list_t & getInventoryList() const { return mInventoryList; } + + private: + LLInventoryObject::object_list_t mInventoryList; + LLEventPump & mPump; + }; + + class HandleScriptUserData + { + public: + // [LSL PreProc] + //HandleScriptUserData(const std::string &pumpname) : + // mPumpname(pumpname) + //{ } + HandleScriptUserData(const std::string &pumpname, LLScriptQueueData* data) : + mPumpname(pumpname), + mData(data) + { } + HandleScriptUserData() + { } + // + + const std::string &getPumpName() const { return mPumpname; } + + // [LSL PreProc] + LLScriptQueueData* getData() const { return mData; } + + private: + std::string mPumpname; + + // [LSL PreProc] + LLScriptQueueData* mData; + }; + + +} + // *NOTE$: A minor specialization of LLScriptAssetUpload, it does not require a buffer // (and does not save a buffer to the vFS) and it finds the compile queue window and // displays a compiling message. @@ -92,7 +158,12 @@ public: LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", LLSD(mQueueId)); if (queue) { - std::string message = std::string("Compiling \"") + getScriptName() + std::string("\"..."); + // Translation fixes + //std::string message = std::string("Compiling \"") + getScriptName() + std::string("\"..."); + LLStringUtil::format_map_t args; + args["OBJECT_NAME"] = getScriptName(); + std::string message = queue->getString("Compiling", args); + // queue->getChild("queue output")->addSimpleElement(message, ADD_BOTTOM); } @@ -114,7 +185,7 @@ private: /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -// LSL Preprocessor, moved to header +// [LSL PreProc] moved to header #if 0 struct LLScriptQueueData { @@ -157,47 +228,6 @@ BOOL LLFloaterScriptQueue::postBuild() return TRUE; } -// This is the callback method for the viewer object currently being -// worked on. -// NOT static, virtual! -void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object, - LLInventoryObject::object_list_t* inv, - S32, - void* q_id) -{ - LL_INFOS() << "LLFloaterScriptQueue::inventoryChanged() for object " - << viewer_object->getID() << LL_ENDL; - - //Remove this listener from the object since its - //listener callback is now being executed. - - //We remove the listener here because the function - //removeVOInventoryListener removes the listener from a ViewerObject - //which it internally stores. - - //If we call this further down in the function, calls to handleInventory - //and nextObject may update the internally stored viewer object causing - //the removal of the incorrect listener from an incorrect object. - - //Fixes SL-6119:Recompile scripts fails to complete - removeVOInventoryListener(); - - if (viewer_object && inv && (viewer_object->getID() == mCurrentObjectID) ) - { - handleInventory(viewer_object, inv); - } - else - { - // something went wrong... - // note that we're not working on this one, and move onto the - // next object in the list. - LL_WARNS() << "No inventory for " << mCurrentObjectID - << LL_ENDL; - nextObject(); - } -} - - // static void LLFloaterScriptQueue::onCloseBtn(void* user_data) { @@ -205,9 +235,10 @@ void LLFloaterScriptQueue::onCloseBtn(void* user_data) self->closeFloater(); } -void LLFloaterScriptQueue::addObject(const LLUUID& id) +void LLFloaterScriptQueue::addObject(const LLUUID& id, std::string name) { - mObjectIDs.push_back(id); + ObjectData obj = { id, name }; + mObjectList.push_back(obj); } BOOL LLFloaterScriptQueue::start() @@ -220,12 +251,12 @@ BOOL LLFloaterScriptQueue::start() LLStringUtil::format_map_t args; args["[START]"] = mStartString; - args["[COUNT]"] = llformat ("%d", mObjectIDs.count()); + args["[COUNT]"] = llformat ("%d", mObjectList.size()); buffer = getString ("Starting", args); getChild("queue output")->addSimpleElement(buffer); - return nextObject();*/ + return startQueue();*/ } bool LLFloaterScriptQueue::onScriptModifyConfirmation(const LLSD& notification, const LLSD& response) @@ -239,7 +270,7 @@ bool LLFloaterScriptQueue::onScriptModifyConfirmation(const LLSD& notification, LLStringUtil::format_map_t args; args["[START]"] = mStartString; - args["[COUNT]"] = llformat ("%d", mObjectIDs.size()); + args["[COUNT]"] = llformat ("%d", mObjectList.size()); buffer = getString ("Starting", args); getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); @@ -247,87 +278,37 @@ bool LLFloaterScriptQueue::onScriptModifyConfirmation(const LLSD& notification, return startQueue(); } +void LLFloaterScriptQueue::addProcessingMessage(const std::string &message, const LLSD &args) +{ + std::string buffer(LLTrans::getString(message, args)); + + getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); +} + +void LLFloaterScriptQueue::addStringMessage(const std::string &message) +{ + getChild("queue output")->addSimpleElement(message, ADD_BOTTOM); +} + + BOOL LLFloaterScriptQueue::isDone() const { - return (mCurrentObjectID.isNull() && (mObjectIDs.size() == 0)); + return (mCurrentObjectID.isNull() && (mObjectList.size() == 0)); } -// go to the next object. If no objects left, it falls out silently -// and waits to be killed by the window being closed. -BOOL LLFloaterScriptQueue::nextObject() -{ - U32 count; - BOOL successful_start = FALSE; - do - { - count = mObjectIDs.size(); - LL_INFOS() << "LLFloaterScriptQueue::nextObject() - " << count - << " objects left to process." << LL_ENDL; - mCurrentObjectID.setNull(); - if(count > 0) - { - successful_start = popNext(); - } - LL_INFOS() << "LLFloaterScriptQueue::nextObject() " - << (successful_start ? "successful" : "unsuccessful") - << LL_ENDL; - } while((mObjectIDs.size() > 0) && !successful_start); - if(isDone() && !mDone) - { - mDone = true; - getChild("queue output")->addSimpleElement(getString("Done"), ADD_BOTTOM); - getChildView("close")->setEnabled(TRUE); - } - return successful_start; -} - -// returns true if the queue has started, otherwise false. This -// method pops the top object off of the queue. -BOOL LLFloaterScriptQueue::popNext() -{ - // get the first element off of the container, and attempt to get - // the inventory. - BOOL rv = FALSE; - S32 count = mObjectIDs.size(); - if(mCurrentObjectID.isNull() && (count > 0)) - { - mCurrentObjectID = mObjectIDs.at(0); - LL_INFOS() << "LLFloaterScriptQueue::popNext() - mCurrentID: " - << mCurrentObjectID << LL_ENDL; - mObjectIDs.erase(mObjectIDs.begin()); - LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID); - if(obj) - { - LL_INFOS() << "LLFloaterScriptQueue::popNext() requesting inv for " - << mCurrentObjectID << LL_ENDL; - LLUUID* id = new LLUUID(getKey().asUUID()); - registerVOInventoryListener(obj,id); - requestVOInventory(); - rv = TRUE; - } - } - return rv; -} - -BOOL LLFloaterScriptQueue::startQueue() -{ - return nextObject(); -} - - ///---------------------------------------------------------------------------- /// Class LLFloaterCompileQueue ///---------------------------------------------------------------------------- LLFloaterCompileQueue::LLFloaterCompileQueue(const LLSD& key) : LLFloaterScriptQueue(key) - , mLSLProc(NULL) // Script Preprocessor + , mLSLProc(NULL) // [LSL PreProc] { setTitle(LLTrans::getString("CompileQueueTitle")); setStartString(LLTrans::getString("CompileQueueStart")); // mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(key.asUUID())); - // Script Preprocessor + // [LSL PreProc] static LLCachedControl _NACL_LSLPreprocessor(gSavedSettings, "_NACL_LSLPreprocessor"); if(_NACL_LSLPreprocessor) { @@ -337,8 +318,8 @@ LLFloaterCompileQueue::LLFloaterCompileQueue(const LLSD& key) } LLFloaterCompileQueue::~LLFloaterCompileQueue() -{ - // Script Preprocessor +{ + // [LSL PreProc] delete mLSLProc; } @@ -348,7 +329,7 @@ void LLFloaterCompileQueue::experienceIdsReceived( const LLSD& content ) { mExperienceIds.insert(it->asUUID()); } - nextObject(); +// nextObject(); } BOOL LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const @@ -356,103 +337,758 @@ BOOL LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const return mExperienceIds.find(id) != mExperienceIds.end(); } +// //Attempt to record this asset ID. If it can not be inserted into the set +// //then it has already been processed so return false. +// bool LLFloaterCompileQueue::checkAssetId(const LLUUID &assetId) +// { +// std::pair result = mAssetIds.insert(assetId); +// return result.second; +// } -void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, - LLInventoryObject::object_list_t* inv) +void LLFloaterCompileQueue::handleHTTPResponse(std::string pumpName, const LLSD &expresult) { - // find all of the lsl, leaving off duplicates. We'll remove - // all matching asset uuids on compilation success. + LLEventPumps::instance().post(pumpName, expresult); +} - typedef std::multimap > uuid_item_map; - uuid_item_map asset_item_map; +// *TODO: handleSCriptRetrieval is passed into the VFS via a legacy C function pointer +// future project would be to convert these to C++ callables (std::function<>) so that +// we can use bind and remove the userData parameter. +// +void LLFloaterCompileQueue::handleScriptRetrieval(LLVFS *vfs, const LLUUID& assetId, + LLAssetType::EType type, void* userData, S32 status, LLExtStat extStatus) +{ + LLSD result(LLSD::emptyMap()); - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); - LLInventoryObject::object_list_t::const_iterator end = inv->end(); - for ( ; it != end; ++it) + result["asset_id"] = assetId; + if (status) + { + result["error"] = status; + + if (status == LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE) + { + result["message"] = LLTrans::getString("CompileQueueProblemDownloading") + (":"); + result["alert"] = LLTrans::getString("CompileQueueScriptNotFound"); + } + else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) + { + result["message"] = LLTrans::getString("CompileQueueInsufficientPermFor") + (":"); + result["alert"] = LLTrans::getString("CompileQueueInsufficientPermDownload"); + } + else + { + result["message"] = LLTrans::getString("CompileQueueUnknownFailure"); + } + + // [LSL PreProc] + // LSL PreProc error case + delete ((HandleScriptUserData *)userData)->getData(); + } + // [LSL PreProc] + else if (gSavedSettings.getBOOL("_NACL_LSLPreprocessor")) { - if((*it)->getType() == LLAssetType::AT_LSL_TEXT) + LLScriptQueueData* data = ((HandleScriptUserData *)userData)->getData(); + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", data->mQueueID); + + if (queue && queue->mLSLProc) { - LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - // Check permissions before allowing the user to retrieve data. - if (item->getPermissions().allowModifyBy(gAgent.getID(), gAgent.getGroupID()) && - item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) ) - { - LLPointer script = new LLViewerInventoryItem(item); - mCurrentScripts.push_back(script); - asset_item_map.insert(std::make_pair(item->getAssetUUID(), item)); - } - } - } + LLVFile file(vfs, assetId, type); + S32 file_length = file.getSize(); + std::vector script_data(file_length + 1); + file.read((U8*)&script_data[0], file_length); + // put a EOS at the end + script_data[file_length] = 0; - if (asset_item_map.empty()) - { - // There are no scripts in this object. move on. - nextObject(); + LLStringUtil::format_map_t args; + args["SCRIPT"] = data->mItem->getName(); + LLFloaterCompileQueue::scriptLogMessage(data, LLTrans::getString("CompileQueuePreprocessing", args)); + + queue->mLSLProc->preprocess_script(assetId, data, type, LLStringExplicit(&script_data[0])); + } + result["preproc"] = true; } - else - { - // request all of the assets. - uuid_item_map::iterator iter; - for(iter = asset_item_map.begin(); iter != asset_item_map.end(); iter++) + // LSL Preprocessor + + LLEventPumps::instance().post(((HandleScriptUserData *)userData)->getPumpName(), result); + +} + +/*static*/ +void LLFloaterCompileQueue::processExperienceIdResults(LLSD result, LLUUID parent) +{ + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", parent); + if (!queue) + return; + + queue->experienceIdsReceived(result["experience_ids"]); + + LLHandle hFloater(queue->getDerivedHandle()); + + fnQueueAction_t fn = boost::bind(LLFloaterCompileQueue::processScript, + queue->getDerivedHandle(), _1, _2, _3); + + + LLCoros::instance().launch("ScriptQueueCompile", boost::bind(LLFloaterScriptQueue::objectScriptProcessingQueueCoro, + queue->mStartString, + hFloater, + queue->mObjectList, + fn)); + +} + +bool LLFloaterCompileQueue::processScript(LLHandle hfloater, + const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump) +{ + LLSD result; + LLFloaterCompileQueue *that = hfloater.get(); + bool monocompile = that->mMono; + F32 fetch_timeout = gSavedSettings.getF32("QueueInventoryFetchTimeout"); + + if (!that) + return false; + + // Initial test to see if we can (or should) attempt to compile the script. + LLInventoryItem *item = dynamic_cast(inventory); + { + + if (!item->getPermissions().allowModifyBy(gAgent.getID(), gAgent.getGroupID()) || + !item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID())) + { + // Translation fixes + //std::string buffer = "Skipping: " + item->getName() + "(Permissions)"; + LLStringUtil::format_map_t args; + args["OBJECT_NAME"] = item->getName(); + std::string buffer = that->getString("SkippingPermissions", args); + // + that->addStringMessage(buffer); + return true; + } + +// if (!that->checkAssetId(item->getAssetUUID())) +// { +// std::string buffer = "Skipping: " + item->getName() + "(Repeat)"; +// that->addStringMessage(buffer); +// return true; +// } + } + that = NULL; + + // Attempt to retrieve the experience + LLUUID experienceId; + { + // FIRE-17688: Recompile scripts not working on OpenSim + //LLExperienceCache::instance().fetchAssociatedExperience(inventory->getParentUUID(), inventory->getUUID(), + // boost::bind(&LLFloaterCompileQueue::handleHTTPResponse, pump.getName(), _1)); + + //result = llcoro::suspendUntilEventOnWithTimeout(pump, fetch_timeout, + // LLSD().with("timeout", LLSD::Boolean(true))); + if (object->getRegion() && object->getRegion()->isCapabilityAvailable("GetMetadata")) { - LLInventoryItem *itemp = iter->second; - LLScriptQueueData* datap = new LLScriptQueueData(getKey().asUUID(), - viewer_object->getID(), itemp); + LLExperienceCache::instance().fetchAssociatedExperience(inventory->getParentUUID(), inventory->getUUID(), + boost::bind(&LLFloaterCompileQueue::handleHTTPResponse, pump.getName(), _1)); - // FIRE-17688: Recompile scripts not working on OpenSim - // LLExperienceCache::instance().fetchAssociatedExperience(itemp->getParentUUID(), itemp->getUUID(), - // boost::bind(&LLFloaterCompileQueue::requestAsset, datap, _1)); - if (viewer_object->getRegion() && viewer_object->getRegion()->isCapabilityAvailable("GetMetadata")) - { - LLExperienceCache::instance().fetchAssociatedExperience(itemp->getParentUUID(), itemp->getUUID(), - boost::bind(&LLFloaterCompileQueue::requestAsset, datap, _1)); - } - else - { - requestAsset(datap, LLSD()); - } - // + result = llcoro::suspendUntilEventOnWithTimeout(pump, fetch_timeout, + LLSD().with("timeout", LLSD::Boolean(true))); } + else + { + result = LLSD(); + } + // + + that = hfloater.get(); + if (!that) + { + return false; + } + + if (result.has("timeout") && result["timeout"].asBoolean()) + { + LLStringUtil::format_map_t args; + args["[OBJECT_NAME]"] = inventory->getName(); + std::string buffer = that->getString("Timeout", args); + that->addStringMessage(buffer); + return true; + } + + if (result.has(LLExperienceCache::EXPERIENCE_ID)) + { + experienceId = result[LLExperienceCache::EXPERIENCE_ID].asUUID(); + if (!that->hasExperience(experienceId)) + { + that->addProcessingMessage("CompileNoExperiencePerm", LLSD() + .with("SCRIPT", inventory->getName()) + .with("EXPERIENCE", result[LLExperienceCache::NAME].asString())); + return true; + } + } + + } + that = NULL; + + { + // [LSL PreProc] + //HandleScriptUserData userData(pump.getName()); + HandleScriptUserData userData; + if (gSavedSettings.getBOOL("_NACL_LSLPreprocessor")) + { + // Need to dump some stuff into an LLScriptQueueData struct for the LSL PreProc. + LLScriptQueueData* datap = new LLScriptQueueData(hfloater.get()->getKey().asUUID(), object->getID(), item); + userData = HandleScriptUserData(pump.getName(), datap); + } + else + { + userData = HandleScriptUserData(pump.getName(), NULL); + } + // + + + // request the asset + gAssetStorage->getInvItemAsset(LLHost(), + gAgent.getID(), + gAgent.getSessionID(), + item->getPermissions().getOwner(), + object->getID(), + item->getUUID(), + item->getAssetUUID(), + item->getType(), + &LLFloaterCompileQueue::handleScriptRetrieval, + &userData); + + result = llcoro::suspendUntilEventOnWithTimeout(pump, fetch_timeout, + LLSD().with("timeout", LLSD::Boolean(true))); + } + + that = hfloater.get(); + if (!that) + { + return false; + } + + if (result.has("timeout")) + { + if (result.has("timeout") && result["timeout"].asBoolean()) + { + LLStringUtil::format_map_t args; + args["[OBJECT_NAME]"] = inventory->getName(); + std::string buffer = that->getString("Timeout", args); + that->addStringMessage(buffer); + return true; + } + } + + if (result.has("error")) + { + LL_WARNS("SCRIPTQ") << "Inventory fetch returned with error. Code: " << result["error"].asString() << LL_ENDL; + std::string buffer = result["message"].asString() + " " + inventory->getName(); + that->addStringMessage(buffer); + + if (result.has("alert")) + { + LLSD args; + args["MESSAGE"] = result["alert"].asString(); + LLNotificationsUtil::add("SystemMessage", args); + } + return true; + } + + // [LSL PreProc] + if (result.has("preproc")) + { + // LSL Preprocessor handles it from here on + return true; } + // + + LLUUID assetId = result["asset_id"]; + that = NULL; + + + std::string url = object->getRegion()->getCapability("UpdateScriptTask"); + + + { + LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(object->getID(), + inventory->getUUID(), + assetId, + monocompile ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2, + true, + inventory->getName(), + LLUUID(), + experienceId, + boost::bind(&LLFloaterCompileQueue::handleHTTPResponse, pump.getName(), _4))); + + LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); + } + + result = llcoro::suspendUntilEventOnWithTimeout(pump, fetch_timeout, LLSD().with("timeout", LLSD::Boolean(true))); + + that = hfloater.get(); + if (!that) + { + return false; + } + + if (result.has("timeout")) + { + if (result.has("timeout") && result["timeout"].asBoolean()) + { + LLStringUtil::format_map_t args; + args["[OBJECT_NAME]"] = inventory->getName(); + std::string buffer = that->getString("Timeout", args); + that->addStringMessage(buffer); + return true; + } + } + + // Bytecode save completed + if (result["compiled"]) + { + std::string buffer = std::string("Compilation of \"") + inventory->getName() + std::string("\" succeeded"); + + //that->addStringMessage(buffer); + LL_INFOS() << buffer << LL_ENDL; + // Translation fixes + LLStringUtil::format_map_t args; + args["OBJECT_NAME"] = inventory->getName(); + that->addStringMessage(that->getString("CompileSuccess", args)); + // + } + else + { + LLSD compile_errors = result["errors"]; + // Translation fixes + //std::string buffer = std::string("Compilation of \"") + inventory->getName() + std::string("\" failed:"); + LLStringUtil::format_map_t args; + args["OBJECT_NAME"] = inventory->getName(); + std::string buffer = that->getString("CompileFailure", args); + // + that->addStringMessage(buffer); + for (LLSD::array_const_iterator line = compile_errors.beginArray(); + line < compile_errors.endArray(); line++) + { + std::string str = line->asString(); + str.erase(std::remove(str.begin(), str.end(), '\n'), str.end()); + + that->addStringMessage(str); + } + LL_INFOS() << result["errors"] << LL_ENDL; + } + + return true; +} + +bool LLFloaterCompileQueue::startQueue() +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url = region->getCapability("GetCreatorExperiences"); + if (!lookup_url.empty()) + { + LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t success = + boost::bind(&LLFloaterCompileQueue::processExperienceIdResults, _1, getKey().asUUID()); + + LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t failure = + boost::bind(&LLFloaterCompileQueue::processExperienceIdResults, LLSD(), getKey().asUUID()); + + LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpGet(lookup_url, + success, failure); + return TRUE; + } + } + + return true; } -void LLFloaterCompileQueue::requestAsset( LLScriptQueueData* datap, const LLSD& experience ) +///---------------------------------------------------------------------------- +/// Class LLFloaterResetQueue +///---------------------------------------------------------------------------- + +LLFloaterResetQueue::LLFloaterResetQueue(const LLSD& key) + : LLFloaterScriptQueue(key) { - LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", datap->mQueueID); - if(!queue) - { - delete datap; - return; - } - if(experience.has(LLExperienceCache::EXPERIENCE_ID)) - { - datap->mExperienceId=experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); - if(!queue->hasExperience(datap->mExperienceId)) - { - std::string buffer = LLTrans::getString("CompileNoExperiencePerm", LLSD::emptyMap() - .with("SCRIPT", datap->mItem->getName()) - .with("EXPERIENCE", experience[LLExperienceCache::NAME].asString())); - - queue->getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); - queue->removeItemByItemID(datap->mItem->getUUID()); - delete datap; - return; - } - } - //LL_INFOS() << "ITEM NAME 2: " << names.get(i) << LL_ENDL; - gAssetStorage->getInvItemAsset(datap->mHost, - gAgent.getID(), - gAgent.getSessionID(), - datap->mItem->getPermissions().getOwner(), - datap->mTaskId, - datap->mItem->getUUID(), - datap->mItem->getAssetUUID(), - datap->mItem->getType(), - LLFloaterCompileQueue::scriptArrived, - (void*)datap); + setTitle(LLTrans::getString("ResetQueueTitle")); + setStartString(LLTrans::getString("ResetQueueStart")); } +LLFloaterResetQueue::~LLFloaterResetQueue() +{ +} + +bool LLFloaterResetQueue::resetObjectScripts(LLHandle hfloater, + const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump) +{ + LLFloaterScriptQueue *that = hfloater.get(); + if (that) + { + std::string buffer; + buffer = that->getString("Resetting") + (": ") + inventory->getName(); + that->addStringMessage(buffer); + } + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ScriptReset); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Script); + msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); + msg->addUUIDFast(_PREHASH_ItemID, inventory->getUUID()); + msg->sendReliable(object->getRegion()->getHost()); + + return true; +} + +bool LLFloaterResetQueue::startQueue() +{ + fnQueueAction_t fn = boost::bind(LLFloaterResetQueue::resetObjectScripts, + getDerivedHandle(), _1, _2, _3); + + LLCoros::instance().launch("ScriptResetQueue", boost::bind(LLFloaterScriptQueue::objectScriptProcessingQueueCoro, + mStartString, + getDerivedHandle(), + mObjectList, + fn)); + + return true; +} + +///---------------------------------------------------------------------------- +/// Class LLFloaterRunQueue +///---------------------------------------------------------------------------- + +LLFloaterRunQueue::LLFloaterRunQueue(const LLSD& key) + : LLFloaterScriptQueue(key) +{ + setTitle(LLTrans::getString("RunQueueTitle")); + setStartString(LLTrans::getString("RunQueueStart")); +} + +LLFloaterRunQueue::~LLFloaterRunQueue() +{ +} + +bool LLFloaterRunQueue::runObjectScripts(LLHandle hfloater, + const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump) +{ + LLFloaterScriptQueue *that = hfloater.get(); + if (that) + { + std::string buffer; + buffer = that->getString("Running") + (": ") + inventory->getName(); + that->addStringMessage(buffer); + } + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_SetScriptRunning); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Script); + msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); + msg->addUUIDFast(_PREHASH_ItemID, inventory->getUUID()); + msg->addBOOLFast(_PREHASH_Running, TRUE); + msg->sendReliable(object->getRegion()->getHost()); + + return true; +} + +bool LLFloaterRunQueue::startQueue() +{ + LLHandle hFloater(getDerivedHandle()); + fnQueueAction_t fn = boost::bind(LLFloaterRunQueue::runObjectScripts, hFloater, _1, _2, _3); + + LLCoros::instance().launch("ScriptRunQueue", boost::bind(LLFloaterScriptQueue::objectScriptProcessingQueueCoro, + mStartString, + hFloater, + mObjectList, + fn)); + + return true; +} + + +///---------------------------------------------------------------------------- +/// Class LLFloaterNotRunQueue +///---------------------------------------------------------------------------- + +LLFloaterNotRunQueue::LLFloaterNotRunQueue(const LLSD& key) + : LLFloaterScriptQueue(key) +{ + setTitle(LLTrans::getString("NotRunQueueTitle")); + setStartString(LLTrans::getString("NotRunQueueStart")); +} + +LLFloaterNotRunQueue::~LLFloaterNotRunQueue() +{ +} + +bool LLFloaterNotRunQueue::stopObjectScripts(LLHandle hfloater, + const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump) +{ + LLFloaterScriptQueue *that = hfloater.get(); + if (that) + { + std::string buffer; + buffer = that->getString("NotRunning") + (": ") + inventory->getName(); + that->addStringMessage(buffer); + } + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_SetScriptRunning); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Script); + msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); + msg->addUUIDFast(_PREHASH_ItemID, inventory->getUUID()); + msg->addBOOLFast(_PREHASH_Running, FALSE); + msg->sendReliable(object->getRegion()->getHost()); + + return true; +} + +bool LLFloaterNotRunQueue::startQueue() +{ + LLHandle hFloater(getDerivedHandle()); + + fnQueueAction_t fn = boost::bind(&LLFloaterNotRunQueue::stopObjectScripts, hFloater, _1, _2, _3); + LLCoros::instance().launch("ScriptQueueNotRun", boost::bind(LLFloaterScriptQueue::objectScriptProcessingQueueCoro, + mStartString, + hFloater, + mObjectList, + fn)); + + return true; +} + +// Delete scripts +///---------------------------------------------------------------------------- +/// Class LLFloaterDeleteQueue +///---------------------------------------------------------------------------- + +LLFloaterDeleteQueue::LLFloaterDeleteQueue(const LLSD& key) + : LLFloaterScriptQueue(key) +{ + setTitle(LLTrans::getString("DeleteQueueTitle")); + setStartString(LLTrans::getString("DeleteQueueStart")); +} + +LLFloaterDeleteQueue::~LLFloaterDeleteQueue() +{ +} + +bool LLFloaterDeleteQueue::deleteObjectScripts(LLHandle hfloater, + const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump) +{ + LLFloaterScriptQueue *that = hfloater.get(); + if (that) + { + std::string buffer; + buffer = that->getString("Deleting") + (": ") + inventory->getName(); + that->addStringMessage(buffer); + } + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RemoveTaskInventory); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_InventoryData); + msg->addU32Fast(_PREHASH_LocalID, object->getLocalID()); + msg->addUUIDFast(_PREHASH_ItemID, inventory->getUUID()); + msg->sendReliable(object->getRegion()->getHost()); + + return true; +} + + +bool LLFloaterDeleteQueue::startQueue() +{ + LLHandle hFloater(getDerivedHandle()); + + fnQueueAction_t fn = boost::bind(&LLFloaterDeleteQueue::deleteObjectScripts, hFloater, _1, _2, _3); + LLCoros::instance().launch("ScriptDeleteQueue", boost::bind(LLFloaterScriptQueue::objectScriptProcessingQueueCoro, + mStartString, + hFloater, + mObjectList, + fn)); + + return true; +} + +// Delete scripts + +///---------------------------------------------------------------------------- +/// Local function definitions +///---------------------------------------------------------------------------- +void ObjectInventoryFetcher::inventoryChanged(LLViewerObject* object, + LLInventoryObject::object_list_t* inventory, S32 serial_num, void* user_data) +{ + mInventoryList.clear(); + mInventoryList.assign(inventory->begin(), inventory->end()); + + mPump.post(LLSD().with("changed", LLSD::Boolean(true))); + +} + +void LLFloaterScriptQueue::objectScriptProcessingQueueCoro(std::string action, LLHandle hfloater, + object_data_list_t objectList, fnQueueAction_t func) +{ + LLCoros::set_consuming(true); + LLFloaterScriptQueue * floater(NULL); + LLEventMailDrop maildrop(QUEUE_EVENTPUMP_NAME, true); + F32 fetch_timeout = gSavedSettings.getF32("QueueInventoryFetchTimeout"); + +// floater = hfloater.get(); +// floater->addProcessingMessage("Starting", +// LLSD() +// .with("[START]", action) +// .with("[COUNT]", LLSD::Integer(objectList.size()))); +// floater = NULL; + + for (object_data_list_t::iterator itObj(objectList.begin()); (itObj != objectList.end()); ++itObj) + { + bool firstForObject = true; + LLUUID object_id = (*itObj).mObjectId; + LL_INFOS("SCRIPTQ") << "Next object in queue with ID=" << object_id.asString() << LL_ENDL; + + LLPointer obj = gObjectList.findObject(object_id); + LLInventoryObject::object_list_t inventory; + if (obj) + { + ObjectInventoryFetcher::ptr_t fetcher(new ObjectInventoryFetcher(maildrop, obj, NULL)); + + fetcher->fetchInventory(); + + floater = hfloater.get(); + if (floater) + { + LLStringUtil::format_map_t args; + args["[OBJECT_NAME]"] = (*itObj).mObjectName; + floater->addStringMessage(floater->getString("LoadingObjInv", args)); + } + + LLSD result = llcoro::suspendUntilEventOnWithTimeout(maildrop, fetch_timeout, + LLSD().with("timeout", LLSD::Boolean(true))); + + if (result.has("timeout") && result["timeout"].asBoolean()) + { + LL_WARNS("SCRIPTQ") << "Unable to retrieve inventory for object " << object_id.asString() << + ". Skipping to next object." << LL_ENDL; + + // floater could have been closed + floater = hfloater.get(); + if (floater) + { + LLStringUtil::format_map_t args; + args["[OBJECT_NAME]"] = (*itObj).mObjectName; + floater->addStringMessage(floater->getString("Timeout", args)); + } + + continue; + } + + inventory.assign(fetcher->getInventoryList().begin(), fetcher->getInventoryList().end()); + } + else + { + LL_WARNS("SCRIPTQ") << "Unable to retrieve object with ID of " << object_id << + ". Skipping to next." << LL_ENDL; + continue; + } + + // TODO: Get the name of the object we are looking at here so that we can display it below. + //std::string objName = (dynamic_cast(obj.get()))->getName(); + LL_DEBUGS("SCRIPTQ") << "Object has " << inventory.size() << " items." << LL_ENDL; + + for (LLInventoryObject::object_list_t::iterator itInv = inventory.begin(); + itInv != inventory.end(); ++itInv) + { + floater = hfloater.get(); + if (!floater) + { + LL_WARNS("SCRIPTQ") << "Script Queue floater closed! Canceling remaining ops" << LL_ENDL; + break; + } + + // note, we have a smart pointer to the obj above... but if we didn't we'd check that + // it still exists here. + + if (((*itInv)->getType() == LLAssetType::AT_LSL_TEXT)) + { + LL_DEBUGS("SCRIPTQ") << "Inventory item " << (*itInv)->getUUID().asString() << "\"" << (*itInv)->getName() << "\"" << LL_ENDL; + if (firstForObject) + { + //floater->addStringMessage(objName + ":"); + firstForObject = false; + } + + if (!func(obj, (*itInv), maildrop)) + { + continue; + } + } + + llcoro::suspend(); + } + // Just test to be sure the floater is still present before calling the func + if (!hfloater.get()) + { + LL_WARNS("SCRIPTQ") << "Script Queue floater dismissed." << LL_ENDL; + break; + } + + } + + floater = hfloater.get(); + if (floater) + { + // Translation fixes + //floater->addStringMessage("Done"); + floater->addStringMessage(floater->getString("Done")); + // + floater->getChildView("close")->setEnabled(TRUE); + } +} + +// [LSL PreProc] +class LLScriptAssetUploadWithId: public LLScriptAssetUpload +{ +public: + LLScriptAssetUploadWithId( LLUUID taskId, LLUUID itemId, TargetType_t targetType, + bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish ) + : LLScriptAssetUpload( taskId, itemId, targetType, isRunning, exerienceId, buffer, finish), + mScriptName(scriptName), + mQueueId(queueId) + { + } + + virtual LLSD prepareUpload() + { + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", LLSD(mQueueId)); + if (queue) + { + LLStringUtil::format_map_t args; + args["OBJECT_NAME"] = getScriptName(); + std::string message = queue->getString("Compiling", args); + + queue->getChild("queue output")->addSimpleElement(message, ADD_BOTTOM); + } + + return LLBufferedAssetUploadInfo::prepareUpload(); + } + + std::string getScriptName() const { return mScriptName; } + +private: + void setScriptName(const std::string &scriptName) { mScriptName = scriptName; } + + LLUUID mQueueId; + std::string mScriptName; +}; + /*static*/ void LLFloaterCompileQueue::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, std::string scriptName, LLUUID queueId) { @@ -485,393 +1121,6 @@ void LLFloaterCompileQueue::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID } } -// This is the callback for when each script arrives -// static -void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status) -{ - LL_INFOS() << "LLFloaterCompileQueue::scriptArrived()" << LL_ENDL; - LLScriptQueueData* data = (LLScriptQueueData*)user_data; - if(!data) - { - return; - } - LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", data->mQueueID); - - std::string buffer; - if(queue && (0 == status)) - { - LLViewerObject* object = gObjectList.findObject(data->mTaskId); - if (object) - { - // LSL Preprocessor - static LLCachedControl _NACL_LSLPreprocessor(gSavedSettings,"_NACL_LSLPreprocessor", 0); - if(queue->mLSLProc && _NACL_LSLPreprocessor) - { - LLVFile file(vfs, asset_id, type); - S32 file_length = file.getSize(); - std::vector script_data(file_length+1); - file.read((U8*)&script_data[0], file_length); - // put a EOS at the end - script_data[file_length] = 0; - - LLFloaterCompileQueue::scriptLogMessage(data, "Preprocessing: " + data->mItem->getName()); - - queue->mLSLProc->preprocess_script(asset_id, data, type, LLStringExplicit(&script_data[0])); - return; - } - // LSL Preprocessor - - std::string url = object->getRegion()->getCapability("UpdateScriptTask"); - std::string scriptName = data->mItem->getName(); - - LLBufferedAssetUploadInfo::taskUploadFinish_f proc = boost::bind(&LLFloaterCompileQueue::finishLSLUpload, _1, _2, _3, _4, - scriptName, data->mQueueID); - - LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(data->mTaskId, data->mItem->getUUID(), asset_id, - (queue->mMono) ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2, - true, scriptName, data->mQueueID, data->mExperienceId, proc)); - - LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); - } - } - else - { - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) - { - LLSD args; - args["MESSAGE"] = LLTrans::getString("CompileQueueScriptNotFound"); - LLNotificationsUtil::add("SystemMessage", args); - - buffer = LLTrans::getString("CompileQueueProblemDownloading") + (": ") + data->mItem->getName(); - } - else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) - { - LLSD args; - args["MESSAGE"] = LLTrans::getString("CompileQueueInsufficientPermDownload"); - LLNotificationsUtil::add("SystemMessage", args); - - buffer = LLTrans::getString("CompileQueueInsufficientPermFor") + (": ") + data->mItem->getName(); - } - else - { - buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mItem->getName(); - } - - LL_WARNS() << "Problem downloading script asset." << LL_ENDL; - if(queue) queue->removeItemByItemID(data->mItem->getUUID()); - } - if(queue && (buffer.size() > 0)) - { - queue->getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); - } - delete data; -} - - -///---------------------------------------------------------------------------- -/// Class LLFloaterResetQueue -///---------------------------------------------------------------------------- - -LLFloaterResetQueue::LLFloaterResetQueue(const LLSD& key) - : LLFloaterScriptQueue(key) -{ - setTitle(LLTrans::getString("ResetQueueTitle")); - setStartString(LLTrans::getString("ResetQueueStart")); -} - -LLFloaterResetQueue::~LLFloaterResetQueue() -{ -} - -void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv) -{ - // find all of the lsl, leaving off duplicates. We'll remove - // all matching asset uuids on compilation success. - - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); - LLInventoryObject::object_list_t::const_iterator end = inv->end(); - for ( ; it != end; ++it) - { - if((*it)->getType() == LLAssetType::AT_LSL_TEXT) - { - LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); - - if (object) - { - LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - std::string buffer; - buffer = getString("Resetting") + (": ") + item->getName(); - getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ScriptReset); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Script); - msg->addUUIDFast(_PREHASH_ObjectID, viewer_obj->getID()); - msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID()); - msg->sendReliable(object->getRegion()->getHost()); - } - } - } - - nextObject(); -} - -///---------------------------------------------------------------------------- -/// Class LLFloaterRunQueue -///---------------------------------------------------------------------------- - -LLFloaterRunQueue::LLFloaterRunQueue(const LLSD& key) - : LLFloaterScriptQueue(key) -{ - setTitle(LLTrans::getString("RunQueueTitle")); - setStartString(LLTrans::getString("RunQueueStart")); -} - -LLFloaterRunQueue::~LLFloaterRunQueue() -{ -} - -void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv) -{ - // find all of the lsl, leaving off duplicates. We'll remove - // all matching asset uuids on compilation success. - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); - LLInventoryObject::object_list_t::const_iterator end = inv->end(); - for ( ; it != end; ++it) - { - if((*it)->getType() == LLAssetType::AT_LSL_TEXT) - { - LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); - - if (object) - { - LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLScrollListCtrl* list = getChild("queue output"); - std::string buffer; - buffer = getString("Running") + (": ") + item->getName(); - list->addSimpleElement(buffer, ADD_BOTTOM); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_SetScriptRunning); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Script); - msg->addUUIDFast(_PREHASH_ObjectID, viewer_obj->getID()); - msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID()); - msg->addBOOLFast(_PREHASH_Running, TRUE); - msg->sendReliable(object->getRegion()->getHost()); - } - } - } - - nextObject(); -} - -///---------------------------------------------------------------------------- -/// Class LLFloaterNotRunQueue -///---------------------------------------------------------------------------- - -LLFloaterNotRunQueue::LLFloaterNotRunQueue(const LLSD& key) - : LLFloaterScriptQueue(key) -{ - setTitle(LLTrans::getString("NotRunQueueTitle")); - setStartString(LLTrans::getString("NotRunQueueStart")); -} - -LLFloaterNotRunQueue::~LLFloaterNotRunQueue() -{ -} - -void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) -{ - LL_INFOS() << "LLFloaterCompileQueue::removeItemByAssetID()" << LL_ENDL; - for(S32 i = 0; i < mCurrentScripts.size(); ) - { - if(asset_id == mCurrentScripts.at(i)->getUUID()) - { - vector_replace_with_last(mCurrentScripts, mCurrentScripts.begin() + i); - } - else - { - ++i; - } - } - if(mCurrentScripts.empty()) - { - nextObject(); - } -} - -BOOL LLFloaterCompileQueue::startQueue() -{ - LLViewerRegion* region = gAgent.getRegion(); - if (region) - { - std::string lookup_url=region->getCapability("GetCreatorExperiences"); - if(!lookup_url.empty()) - { - LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t success = - boost::bind(&LLFloaterCompileQueue::processExperienceIdResults, _1, getKey().asUUID()); - - LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t failure = - boost::bind(&LLFloaterCompileQueue::processExperienceIdResults, LLSD(), getKey().asUUID()); - - LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpGet(lookup_url, - success, failure); - return TRUE; - } - } - return nextObject(); -} - -/*static*/ -void LLFloaterCompileQueue::processExperienceIdResults(LLSD result, LLUUID parent) -{ - LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", parent); - if (!queue) - return; - - queue->experienceIdsReceived(result["experience_ids"]); -} - -void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv) -{ - // find all of the lsl, leaving off duplicates. We'll remove - // all matching asset uuids on compilation success. - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); - LLInventoryObject::object_list_t::const_iterator end = inv->end(); - for ( ; it != end; ++it) - { - if((*it)->getType() == LLAssetType::AT_LSL_TEXT) - { - LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); - - if (object) - { - LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLScrollListCtrl* list = getChild("queue output"); - std::string buffer; - buffer = getString("NotRunning") + (": ") +item->getName(); - list->addSimpleElement(buffer, ADD_BOTTOM); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_SetScriptRunning); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Script); - msg->addUUIDFast(_PREHASH_ObjectID, viewer_obj->getID()); - msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID()); - msg->addBOOLFast(_PREHASH_Running, FALSE); - msg->sendReliable(object->getRegion()->getHost()); - } - } - } - - nextObject(); -} - -// Delete scripts -///---------------------------------------------------------------------------- -/// Class LLFloaterDeleteQueue -///---------------------------------------------------------------------------- - -LLFloaterDeleteQueue::LLFloaterDeleteQueue(const LLSD& key) - : LLFloaterScriptQueue(key) -{ - setTitle(LLTrans::getString("DeleteQueueTitle")); - setStartString(LLTrans::getString("DeleteQueueStart")); -} - -LLFloaterDeleteQueue::~LLFloaterDeleteQueue() -{ -} - -void LLFloaterDeleteQueue::handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv) -{ - // find all of the lsl, leaving off duplicates. We'll remove - // all matching asset uuids on compilation success. - std::vector names; - - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); - LLInventoryObject::object_list_t::const_iterator end = inv->end(); - for ( ; it != end; ++it) - { - if((*it)->getType() == LLAssetType::AT_LSL_TEXT) - { - LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); - - if (object) - { - LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - std::string buffer; - buffer = getString("Deleting") + (": ") + item->getName(); - getChild("queue output")->addSimpleElement(buffer); - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_RemoveTaskInventory); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addU32Fast(_PREHASH_LocalID, viewer_obj->getLocalID()); - msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID()); - msg->sendReliable(object->getRegion()->getHost()); - } - } - } - - nextObject(); -} -// Delete scripts - -///---------------------------------------------------------------------------- -/// Local function definitions -///---------------------------------------------------------------------------- - -// LSL Preprocessor - -class LLScriptAssetUploadWithId: public LLScriptAssetUpload -{ -public: - LLScriptAssetUploadWithId( LLUUID taskId, LLUUID itemId, TargetType_t targetType, - bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish ) - : LLScriptAssetUpload( taskId, itemId, targetType, isRunning, exerienceId, buffer, finish), - mScriptName(scriptName), - mQueueId(queueId) - { - } - - virtual LLSD prepareUpload() - { - LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", LLSD(mQueueId)); - if (queue) - { - std::string message = std::string("Compiling \"") + getScriptName() + std::string("\"..."); - - queue->getChild("queue output")->addSimpleElement(message, ADD_BOTTOM); - } - - return LLBufferedAssetUploadInfo::prepareUpload(); - } - - std::string getScriptName() const { return mScriptName; } - -private: - void setScriptName(const std::string &scriptName) { mScriptName = scriptName; } - - LLUUID mQueueId; - std::string mScriptName; -}; - // This is the callback after the script has been processed by preproc // static void LLFloaterCompileQueue::scriptPreprocComplete(const LLUUID& asset_id, LLScriptQueueData* data, LLAssetType::EType type, const std::string& script_text) diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index 2d580328dd..15be8ef12d 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -37,7 +37,9 @@ #include "llviewerinventory.h" -// LSL Preprocessor +#include "llevents.h" + +// [LSL PreProc] class FSLSLPreprocessor; struct LLScriptQueueData @@ -65,7 +67,7 @@ struct LLScriptQueueData // scripts manipulated. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener +class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/ { public: LLFloaterScriptQueue(const LLSD& key); @@ -76,23 +78,17 @@ public: void setMono(bool mono) { mMono = mono; } // addObject() accepts an object id. - void addObject(const LLUUID& id); + void addObject(const LLUUID& id, std::string name); // start() returns TRUE if the queue has started, otherwise FALSE. BOOL start(); -protected: - // This is the callback method for the viewer object currently - // being worked on. - /*virtual*/ void inventoryChanged(LLViewerObject* obj, - LLInventoryObject::object_list_t* inv, - S32 serial_num, - void* queue); - - // This is called by inventoryChanged - virtual void handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv) = 0; + void addProcessingMessage(const std::string &message, const LLSD &args); + void addStringMessage(const std::string &message); + std::string getStartString() const { return mStartString; } + +protected: static void onCloseBtn(void* user_data); bool onScriptModifyConfirmation(const LLSD& notification, const LLSD& response); @@ -100,12 +96,7 @@ protected: // returns true if this is done BOOL isDone() const; - virtual BOOL startQueue(); - - // go to the next object. If no objects left, it falls out - // silently and waits to be killed by the deleteIfDone() callback. - BOOL nextObject(); - BOOL popNext(); + virtual bool startQueue() = 0; void setStartString(const std::string& s) { mStartString = s; } @@ -115,12 +106,23 @@ protected: LLButton* mCloseBtn; // Object Queue - std::vector mObjectIDs; + struct ObjectData + { + LLUUID mObjectId; + std::string mObjectName; + }; + typedef std::vector object_data_list_t; + + object_data_list_t mObjectList; LLUUID mCurrentObjectID; bool mDone; std::string mStartString; bool mMono; + + typedef boost::function &, LLInventoryObject*, LLEventPump &)> fnQueueAction_t; + static void objectScriptProcessingQueueCoro(std::string action, LLHandle hfloater, object_data_list_t objectList, fnQueueAction_t func); + }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -141,43 +143,32 @@ class LLFloaterCompileQueue : public LLFloaterScriptQueue { friend class LLFloaterReg; public: - // remove any object in mScriptScripts with the matching uuid. - void removeItemByItemID(const LLUUID& item_id); void experienceIdsReceived( const LLSD& content ); BOOL hasExperience(const LLUUID& id)const; - // LSL Preprocessor + // [LSL PreProc] + static void finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, std::string scriptName, LLUUID queueId); static void scriptPreprocComplete(const LLUUID& asset_id, LLScriptQueueData* data, LLAssetType::EType type, const std::string& script_text); static void scriptLogMessage(LLScriptQueueData* data, std::string message); protected: LLFloaterCompileQueue(const LLSD& key); virtual ~LLFloaterCompileQueue(); - // This is called by inventoryChanged - virtual void handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv); + virtual bool startQueue(); - static void requestAsset(struct LLScriptQueueData* datap, const LLSD& experience); + static bool processScript(LLHandle hfloater, const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump); - - static void finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, std::string scriptName, LLUUID queueId); - - // This is the callback for when each script arrives - static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status); - - virtual BOOL startQueue(); -protected: - LLViewerInventoryItem::item_array_t mCurrentScripts; + //bool checkAssetId(const LLUUID &assetId); + static void handleHTTPResponse(std::string pumpName, const LLSD &expresult); + static void handleScriptRetrieval(LLVFS *vfs, const LLUUID& assetId, LLAssetType::EType type, void* userData, S32 status, LLExtStat extStatus); private: static void processExperienceIdResults(LLSD result, LLUUID parent); - + //uuid_list_t mAssetIds; // list of asset IDs processed. uuid_list_t mExperienceIds; - // LSL Preprocessor + // [LSL PreProc] FSLSLPreprocessor* mLSLProc; }; @@ -194,9 +185,9 @@ protected: LLFloaterResetQueue(const LLSD& key); virtual ~LLFloaterResetQueue(); - // This is called by inventoryChanged - virtual void handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv); + static bool resetObjectScripts(LLHandle hfloater, const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump); + + virtual bool startQueue(); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -211,10 +202,10 @@ class LLFloaterRunQueue : public LLFloaterScriptQueue protected: LLFloaterRunQueue(const LLSD& key); virtual ~LLFloaterRunQueue(); - - // This is called by inventoryChanged - virtual void handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv); + + static bool runObjectScripts(LLHandle hfloater, const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump); + + virtual bool startQueue(); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -230,9 +221,9 @@ protected: LLFloaterNotRunQueue(const LLSD& key); virtual ~LLFloaterNotRunQueue(); - // This is called by inventoryChanged - virtual void handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv); + static bool stopObjectScripts(LLHandle hfloater, const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump); + + virtual bool startQueue(); }; // Delete scripts @@ -249,9 +240,9 @@ protected: LLFloaterDeleteQueue(const LLSD& key); virtual ~LLFloaterDeleteQueue(); - // This is called by inventoryChanged - virtual void handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv); + static bool deleteObjectScripts(LLHandle hfloater, const LLPointer &object, LLInventoryObject* inventory, LLEventPump &pump); + + virtual bool startQueue(); }; // Delete scripts diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index f4baa9fc3c..640f1a4144 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -243,8 +243,6 @@ public: bool check(const LLFolderViewModelItem* item) { return true; } bool checkFolder(const LLFolderViewModelItem* folder) const { return true; } - // For clipboard highlighting - bool checkClipboard(const LLFolderViewModelItem* item) { return true; } void setEmptyLookupMessage(const std::string& message) { } std::string getEmptyLookupMessage() const { return mEmpty; } bool showAllResults() const { return true; } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 0a432f24e0..5bc6864cd2 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -62,9 +62,6 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : LLFacePool(POOL_TERRAIN), mTexturep(texturep) { - U32 format = GL_ALPHA8; - U32 int_format = GL_ALPHA; - // Hack! // Attempt to speed up things a little @@ -75,23 +72,13 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : sDetailScale = 1.f/RenderTerrainScale; sDetailMode = RenderTerrainDetail(); // + mAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD); - mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", - FTT_LOCAL_FILE, - TRUE, LLGLTexture::BOOST_UI, - LLViewerTexture::FETCHED_TEXTURE, - format, int_format, - LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); //gGL.getTexUnit(0)->bind(mAlphaRampImagep.get()); mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); - m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c", - FTT_LOCAL_FILE, - TRUE, LLGLTexture::BOOST_UI, - LLViewerTexture::FETCHED_TEXTURE, - format, int_format, - LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); + m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD_2D); //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index b706b1b1de..573da0318f 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -40,10 +40,10 @@ #include "llcorehttputil.h" #include "lleventfilter.h" -#include "llsdutil.h" // for ll_pretty_print_sd - #include "boost/make_shared.hpp" +#include "llsdutil.h" // for ll_pretty_print_sd + namespace LLEventPolling { namespace Details diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 83595afa29..639a516397 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -814,3 +814,62 @@ void LLFeatureManager::applyBaseMasks() maskFeatures("safe"); } } + +LLSD LLFeatureManager::getRecommendedSettingsMap() +{ + // Create the map and fill it with the hardware recommended settings. + // It's needed to create an initial Default graphics preset (MAINT-6435). + // The process is similar to the one LLFeatureManager::applyRecommendedSettings() does. + + LLSD map(LLSD::emptyMap()); + + loadGPUClass(); + U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5)); + LL_INFOS("RenderInit") << "Getting the map of recommended settings for level " << level << LL_ENDL; + + applyBaseMasks(); + std::string features(isValidGraphicsLevel(level) ? getNameForGraphicsLevel(level) : "Low"); + + maskFeatures(features); + + LLControlVariable* ctrl = gSavedSettings.getControl("RenderQualityPerformance"); // include the quality value for correct preset loading + map["RenderQualityPerformance"]["Value"] = (LLSD::Integer)level; + map["RenderQualityPerformance"]["Comment"] = ctrl->getComment();; + map["RenderQualityPerformance"]["Persist"] = 1; + map["RenderQualityPerformance"]["Type"] = LLControlGroup::typeEnumToString(ctrl->type()); + + + + for (feature_map_t::iterator mIt = mFeatures.begin(); mIt != mFeatures.end(); ++mIt) + { + LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first); + if (ctrl == NULL) + { + LL_WARNS() << "AHHH! Control setting " << mIt->first << " does not exist!" << LL_ENDL; + continue; + } + + if (ctrl->isType(TYPE_BOOLEAN)) + { + map[mIt->first]["Value"] = (LLSD::Boolean)getRecommendedValue(mIt->first); + } + else if (ctrl->isType(TYPE_S32) || ctrl->isType(TYPE_U32)) + { + map[mIt->first]["Value"] = (LLSD::Integer)getRecommendedValue(mIt->first); + } + else if (ctrl->isType(TYPE_F32)) + { + map[mIt->first]["Value"] = (LLSD::Real)getRecommendedValue(mIt->first); + } + else + { + LL_WARNS() << "AHHH! Control variable is not a numeric type!" << LL_ENDL; + continue; + } + map[mIt->first]["Comment"] = ctrl->getComment();; + map[mIt->first]["Persist"] = 1; + map[mIt->first]["Type"] = LLControlGroup::typeEnumToString(ctrl->type()); + } + + return map; +} diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index 12ea691b49..c3d87cea0b 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -157,7 +157,9 @@ public: // load the dynamic GPU/feature table from a website void fetchHTTPTables(); - + + LLSD getRecommendedSettingsMap(); + protected: bool loadGPUClass(); diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index ee7364e37f..81fd263f6d 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -550,7 +550,8 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command) LLInventoryItem* item = gInventory.getItem(*it); if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE) { - LLClipboard::instance().addToClipboard(item->getUUID(),LLAssetType::AT_GESTURE); + LLWString item_name = utf8str_to_wstring(item->getName()); + LLClipboard::instance().addToClipboard(item_name, 0, item_name.size()); } } } diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index e2fed73c0a..bfe543a76a 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -737,13 +737,32 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, toast_msg = tmp_chat.mText; } - //Don't show nearby toast, if conversation is visible and selected // [FS communication UI] + //bool chat_overlaps = false; + //if(nearby_chat->getChatHistory()) + //{ + // LLRect chat_rect = nearby_chat->getChatHistory()->calcScreenRect(); + // for (std::list::const_iterator child_iter = gFloaterView->getChildList()->begin(); + // child_iter != gFloaterView->getChildList()->end(); ++child_iter) + // { + // LLView *view = *child_iter; + // const LLRect& rect = view->getRect(); + // if(view->isInVisibleChain() && (rect.overlaps(chat_rect))) + // { + // if(!nearby_chat->getChatHistory()->hasAncestor(view)) + // { + // chat_overlaps = true; + // } + // break; + // } + // } + //} + ////Don't show nearby toast, if conversation is visible and selected //if ((nearby_chat->hasFocus()) || // (LLFloater::isVisible(nearby_chat) && nearby_chat->isTornOff() && !nearby_chat->isMinimized()) || - // ((im_box->getSelectedSession().isNull() && - // ((LLFloater::isVisible(im_box) && !im_box->isMinimized() && im_box->isFrontmost()) - // || (LLFloater::isVisible(nearby_chat) && !nearby_chat->isMinimized() && nearby_chat->isFrontmost()))))) + // ((im_box->getSelectedSession().isNull() && !chat_overlaps && + // ((LLFloater::isVisible(im_box) && !nearby_chat->isTornOff() && !im_box->isMinimized()) + // || (LLFloater::isVisible(nearby_chat) && nearby_chat->isTornOff() && !nearby_chat->isMinimized()))))) //{ // if(nearby_chat->isMessagePaneExpanded()) // { diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 032ed8172a..3d52f44e39 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -1096,6 +1096,12 @@ void LLFloaterIMSessionTab::saveCollapsedState() gSavedPerAccountSettings.setBOOL("NearbyChatIsNotCollapsed", isMessagePaneExpanded()); } } + +LLView* LLFloaterIMSessionTab::getChatHistory() +{ + return mChatHistory; +} + BOOL LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask ) { BOOL handled = FALSE; diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 2db150369c..1e60531035 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -105,6 +105,8 @@ public: void restoreFloater(); void saveCollapsedState(); + LLView* getChatHistory(); + protected: // callback for click on any items of the visual states menu diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 135bbb335e..4a5732aecf 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -42,6 +42,8 @@ #include "llfloaterperms.h" #include "llviewercontrol.h" #include "llviewermenufile.h" // upload_new_resource() +#include "llstatusbar.h" // can_afford_transaction() +#include "llnotificationsutil.h" #include "lluictrlfactory.h" #include "llstring.h" #include "lleconomy.h" @@ -161,12 +163,15 @@ void LLFloaterNameDesc::onBtnOK( ) LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). - void *nruserdata = NULL; - std::string display_name = LLStringUtil::null; - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + if (can_afford_transaction(expected_upload_cost)) + { + void *nruserdata = NULL; + std::string display_name = LLStringUtil::null; + + LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( mFilenameAndPath, - getChild("name_form")->getValue().asString(), + getChild("name_form")->getValue().asString(), getChild("description_form")->getValue().asString(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms("Uploads"), @@ -174,7 +179,14 @@ void LLFloaterNameDesc::onBtnOK( ) LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost)); - upload_new_resource(uploadInfo, callback, nruserdata); + upload_new_resource(uploadInfo, callback, nruserdata); + } + else + { + LLSD args; + args["COST"] = llformat("%d", expected_upload_cost); + LLNotificationsUtil::add("ErrorTextureCannotAfford", args); + } closeFloater(false); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 9f998347c8..d35751962a 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -430,6 +430,11 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->getChild("object_bonus_spin")->setValue(LLSD(object_bonus_factor) ); panel->getChild("access_combo")->setValue(LLSD(sim_access) ); + LLPanelRegionGeneralInfo* panel_general = LLFloaterRegionInfo::getPanelGeneral(); + if (panel) + { + panel_general->setObjBonusFactor(object_bonus_factor); + } // detect teen grid for maturity @@ -499,6 +504,16 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() return panel; } +// static +LLPanelRegionGeneralInfo* LLFloaterRegionInfo::getPanelGeneral() +{ + LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); + if (!floater) return NULL; + LLTabContainer* tab = floater->getChild("region_panels"); + LLPanelRegionGeneralInfo* panel = (LLPanelRegionGeneralInfo*)tab->getChild("General"); + return panel; +} + // static LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain() { @@ -764,7 +779,42 @@ BOOL LLPanelRegionGeneralInfo::postBuild() childSetAction("im_btn", onClickMessage, this); // childSetAction("manage_telehub_btn", onClickManageTelehub, this); - return LLPanelRegionInfo::postBuild(); + LLUICtrl* apply_btn = findChild("apply_btn"); + if (apply_btn) + { + apply_btn->setCommitCallback(boost::bind(&LLPanelRegionGeneralInfo::onBtnSet, this)); + } + + refresh(); + return TRUE; +} + +void LLPanelRegionGeneralInfo::onBtnSet() +{ + if(mObjBonusFactor == getChild("object_bonus_spin")->getValue().asReal()) + { + if (sendUpdate()) + { + disableButton("apply_btn"); + } + } + else + { + LLNotificationsUtil::add("ChangeObjectBonusFactor", LLSD(), LLSD(), boost::bind(&LLPanelRegionGeneralInfo::onChangeObjectBonus, this, _1, _2)); + } +} + +bool LLPanelRegionGeneralInfo::onChangeObjectBonus(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + if (sendUpdate()) + { + disableButton("apply_btn"); + } + } + return false; } void LLPanelRegionGeneralInfo::onClickKick() diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 0145adac42..2a6095dffa 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -98,6 +98,7 @@ public: static LLPanelEstateCovenant* getPanelCovenant(); static LLPanelRegionTerrainInfo* getPanelRegionTerrain(); static LLPanelRegionExperiences* getPanelExperiences(); + static LLPanelRegionGeneralInfo* getPanelGeneral(); // Aurora Sim - Region Settings Panel static LLPanelRegionOpenSettingsInfo* getPanelOpenSettings(); // Aurora Sim - Region Settings Panel @@ -209,6 +210,9 @@ public: // LLPanel virtual BOOL postBuild(); + void onBtnSet(); + void setObjBonusFactor(F32 object_bonus_factor) {mObjBonusFactor = object_bonus_factor;} + protected: virtual BOOL sendUpdate(); void onClickKick(); @@ -217,6 +221,9 @@ protected: bool onKickAllCommit(const LLSD& notification, const LLSD& response); static void onClickMessage(void* userdata); bool onMessageCommit(const LLSD& notification, const LLSD& response); + bool onChangeObjectBonus(const LLSD& notification, const LLSD& response); + + F32 mObjBonusFactor; }; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 89980f125a..3a963827e0 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1631,6 +1631,20 @@ void LLFloaterSnapshot::postPanelSwitch() // } +// static +void LLFloaterSnapshot::inventorySaveFailed() +{ + LLFloaterSnapshot* instance = findInstance(); + if (!instance) + { + llassert(instance != NULL); + return; + } + + instance->impl.updateControls(instance); + instance->impl.setStatus(Impl::STATUS_FINISHED, false, "inventory"); +} + // static LLPointer LLFloaterSnapshot::getImageData() { diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index e9f3bb5509..bd72df6caa 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -64,6 +64,7 @@ public: // static void postSave(); static void postPanelSwitch(); + static void inventorySaveFailed(); static LLPointer getImageData(); static const LLVector3d& getPosTakenGlobal(); static void setAgentEmail(const std::string& email); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 57172b0c5b..b6b4dd6433 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1270,10 +1270,10 @@ F32 LLFloaterWorldMap::getDistanceToDestination(const LLVector3d &destination, } -void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui) +void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui, BOOL dest_reached) { LLCtrlListInterface *list = mListSearchResults; - if (list) + if (list && (!dest_reached || (list->getItemCount() == 1))) { list->operateOnAll(LLCtrlListInterface::OP_DELETE); } diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 23e3854419..8564e99d91 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -114,7 +114,7 @@ public: // A z_attenuation of 0.0f collapses the distance into the X-Y plane F32 getDistanceToDestination(const LLVector3d& pos_global, F32 z_attenuation = 0.5f) const; - void clearLocationSelection(BOOL clear_ui = FALSE); + void clearLocationSelection(BOOL clear_ui = FALSE, BOOL dest_reached = FALSE); void clearAvatarSelection(BOOL clear_ui = FALSE); void clearLandmarkSelection(BOOL clear_ui = FALSE); diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp index bd4bae7b02..079975b8c7 100644 --- a/indra/newview/llinspectremoteobject.cpp +++ b/indra/newview/llinspectremoteobject.cpp @@ -197,7 +197,7 @@ void LLInspectRemoteObject::update() getChild("map_btn")->setEnabled(! mSLurl.empty()); // disable the Block button if we don't have the object ID (will this ever happen?) - getChild("block_btn")->setEnabled(! mObjectID.isNull()); + getChild("block_btn")->setEnabled(!mObjectID.isNull() && !LLMuteList::getInstance()->isMuted(mObjectID)); // [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) | Added: RLVa-1.2.0f if ( (rlv_handler_t::isEnabled()) && (RlvStrings::getString(RLV_STRING_HIDDEN_REGION) == mSLurl) ) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 8263611355..cbf926bdc6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -309,6 +309,16 @@ BOOL LLInvFVBridge::cutToClipboard() return FALSE; } +// virtual +bool LLInvFVBridge::isCutToClipboard() +{ + if (LLClipboard::instance().isCutMode()) + { + return LLClipboard::instance().isOnClipboard(mUUID); + } + return false; +} + // Callback for cutToClipboard if DAMA required... BOOL LLInvFVBridge::callback_cutToClipboard(const LLSD& notification, const LLSD& response) { @@ -330,10 +340,7 @@ BOOL LLInvFVBridge::perform_cutToClipboard() if (obj && isItemMovable() && isItemRemovable()) { LLClipboard::instance().setCutMode(true); - BOOL added_to_clipboard = LLClipboard::instance().addToClipboard(mUUID); - // Re-apply FIRE-6714: Don't move objects to trash during cut&paste - //removeObject(&gInventory, mUUID); // Always perform the remove even if the object couldn't make it to the clipboard - return added_to_clipboard; + return LLClipboard::instance().addToClipboard(mUUID); } return FALSE; } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index fdcda55a23..fc972a5266 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -119,6 +119,7 @@ public: // [/SL:KB] virtual BOOL copyToClipboard() const; virtual BOOL cutToClipboard(); + virtual bool isCutToClipboard(); virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteableAsLink() const; virtual void pasteFromClipboard() {} diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 171dd13466..78d1c3eee6 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -117,18 +117,12 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) { const LLFolderViewModelItemInventory* listener = dynamic_cast(item); - // Clipboard cut items are *always* filtered so we need this value upfront - // FIRE-6714: Don't move objects to trash during cut&paste - // Don't hide cut items in inventory - //const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); - const BOOL passed_clipboard = TRUE; - // FIRE-6714: Don't move objects to trash during cut&paste // If it's a folder and we're showing all folders, return automatically. const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)) { - return passed_clipboard; + return true; } // Multi-substring inventory search @@ -190,7 +184,6 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) passed = passed && checkAgainstFilterType(listener); passed = passed && checkAgainstPermissions(listener); passed = passed && checkAgainstFilterLinks(listener); - passed = passed && passed_clipboard; return passed; } @@ -200,13 +193,8 @@ bool LLInventoryFilter::check(const LLInventoryItem* item) const bool passed_string = (mFilterSubString.size() ? item->getName().find(mFilterSubString) != std::string::npos : true); const bool passed_filtertype = checkAgainstFilterType(item); const bool passed_permissions = checkAgainstPermissions(item); - // FIRE-6714: Don't move objects to trash during cut&paste - // Don't hide cut items in inventory - //const bool passed_clipboard = checkAgainstClipboard(item->getUUID()); - const bool passed_clipboard = true; - // Don't filter cut items - return passed_filtertype && passed_permissions && passed_clipboard && passed_string; + return passed_filtertype && passed_permissions && passed_string; } bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const @@ -225,17 +213,10 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const { - // Always check against the clipboard - // FIRE-6714: Don't move objects to trash during cut&paste - // Don't hide cut items in inventory - //const BOOL passed_clipboard = checkAgainstClipboard(folder_id); - const BOOL passed_clipboard = TRUE; - // FIRE-6714: Don't move objects to trash during cut&paste - // we're showing all folders, overriding filter if (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS) { - return passed_clipboard; + return true; } // when applying a filter, matching folders get their contents downloaded first @@ -301,7 +282,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const LLViewerInventoryItem* item = gInventory.getItem(folder_id); if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER) { - return passed_clipboard; + return true; } if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY) @@ -316,7 +297,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const return false; } - return passed_clipboard; + return true; } bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInventory* listener) const @@ -541,19 +522,6 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const return true; } -// For clipboard highlighting -bool LLInventoryFilter::checkClipboard(const LLFolderViewModelItem* item) -{ - const LLFolderViewModelItemInventory* listener = dynamic_cast(item); - if (!listener) - { - return true; - } - - return checkAgainstClipboard(listener->getUUID()); -} -// - bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewModelItemInventory* listener) const { if (!listener) return FALSE; diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 9a8fac4ad3..f7c17a64ab 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -245,8 +245,6 @@ public: // +-------------------------------------------------------------------+ bool check(const LLFolderViewModelItem* listener); bool check(const LLInventoryItem* item); - // For clipboard highlighting - bool checkClipboard(const LLFolderViewModelItem* item); bool checkFolder(const LLFolderViewModelItem* listener) const; bool checkFolder(const LLUUID& folder_id) const; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 48d19ca7b2..38b67f60b6 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -295,7 +295,11 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc LL_INFOS("SLM") << "Unlist and clear version folder as the version folder is not at the right place anymore!!" << LL_ENDL; LLMarketplaceData::instance().setVersionFolder(listing_uuid, LLUUID::null,1); } - else if (version_folder_uuid.notNull() && LLMarketplaceData::instance().getActivationState(version_folder_uuid) && (count_descendants_items(version_folder_uuid) == 0) && !LLMarketplaceData::instance().isUpdating(version_folder_uuid,version_depth)) + else if (version_folder_uuid.notNull() + && gInventory.isCategoryComplete(version_folder_uuid) + && LLMarketplaceData::instance().getActivationState(version_folder_uuid) + && (count_descendants_items(version_folder_uuid) == 0) + && !LLMarketplaceData::instance().isUpdating(version_folder_uuid,version_depth)) { LL_INFOS("SLM") << "Unlist as the version folder is empty of any item!!" << LL_ENDL; LLNotificationsUtil::add("AlertMerchantVersionFolderEmpty"); diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index b0c104a2e3..e689687655 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -76,6 +76,9 @@ // #include "fsfloaterplacedetails.h" +#include "llmenuoptionpathfindingrebakenavmesh.h" +#include "llpathfindingmanager.h" + //============================================================================ /* * "ADD LANDMARK" BUTTON UPDATING LOGIC @@ -1280,6 +1283,18 @@ bool LLLocationInputCtrl::onLocationContextMenuItemEnabled(const LLSD& userdata) return false; } +void LLLocationInputCtrl::callbackRebakeRegion(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // OK + { + if (LLPathfindingManager::getInstance() != NULL) + { + LLMenuOptionPathfindingRebakeNavmesh::getInstance()->sendRequestRebakeNavmesh(); + } + } +} + void LLLocationInputCtrl::onParcelIconClick(EParcelIcon icon) { switch (icon) @@ -1298,6 +1313,16 @@ void LLLocationInputCtrl::onParcelIconClick(EParcelIcon icon) break; case PATHFINDING_DIRTY_ICON: // Pathfinding rebake functions + //if (LLPathfindingManager::getInstance() != NULL) + //{ + // LLMenuOptionPathfindingRebakeNavmesh *rebakeInstance = LLMenuOptionPathfindingRebakeNavmesh::getInstance(); + // if (rebakeInstance && rebakeInstance->canRebakeRegion() && (rebakeInstance->getMode() == LLMenuOptionPathfindingRebakeNavmesh::kRebakeNavMesh_Available)) + // { + // LLNotificationsUtil::add("PathfindingDirtyRebake", LLSD(), LLSD(), + // boost::bind(&LLLocationInputCtrl::callbackRebakeRegion, this, _1, _2)); + // break; + // } + //} // LLNotificationsUtil::add("PathfindingDirty"); LLNotificationsUtil::add("PathfindingDirty",LLSD(),LLSD(),boost::bind(&LLLocationInputCtrl::rebakeRegionCallback,this,_1,_2)); // diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 91cd817268..ce28db675c 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -170,6 +170,7 @@ private: // callbacks bool onLocationContextMenuItemEnabled(const LLSD& userdata); void onLocationContextMenuItemClicked(const LLSD& userdata); + void callbackRebakeRegion(const LLSD& notification, const LLSD& response); void onParcelIconClick(EParcelIcon icon); void createNavMeshStatusListenerForCurrentRegion(); diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 82dfef8a2c..bf00a895ce 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -1075,7 +1075,7 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im, const LLSD& parse_params std::string stuff = matches[IDX_STUFF]; boost::match_results name_and_text; if (!boost::regex_match(stuff, name_and_text, NAME_AND_TEXT)) return false; - + bool has_name = name_and_text[IDX_NAME].matched; std::string name = name_and_text[IDX_NAME]; @@ -1144,7 +1144,6 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im, const LLSD& parse_params im[LL_IM_FROM] = name; } - im[LL_IM_TEXT] = name_and_text[IDX_TEXT]; return true; //parsed name and message text, maybe have a timestamp too } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index b583dd58ec..2af4020fad 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3974,7 +3974,7 @@ LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id) { LLMutexLock lock(mHeaderMutex); mesh_header_map::iterator iter = mMeshHeader.find(mesh_id); - if (iter != mMeshHeader.end()) + if (iter != mMeshHeader.end() && mMeshHeaderSize[mesh_id] > 0) { return iter->second; } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 6248720774..2febe44317 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -214,6 +214,7 @@ BOOL LLPanelMainInventory::postBuild() LLInventoryPanel* recent_items_panel = getChild("Recent Items"); if (recent_items_panel) { + // assign default values until we will be sure that we have setting to restore recent_items_panel->setSinceLogoff(TRUE); // Recent items panel should save sort order // recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE); @@ -278,6 +279,8 @@ BOOL LLPanelMainInventory::postBuild() //recent_items_panel->getFilter().fromParams(p); recent_items_panel->getFilter().fromParams(p.filter); // + // We do that earlier already + //recent_items_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER)); // Recent items panel doesn't filter empty folders until filter floater has been opened LLInventoryFilter& recent_filter = recent_items_panel->getFilter(); @@ -503,7 +506,14 @@ void LLPanelMainInventory::setSortBy(const LLSD& userdata) getActivePanel()->setSortOrder(sort_order_mask); // Recent items panel should save sort order - // gSavedSettings.setU32("InventorySortOrder", sort_order_mask); + //if ("Recent Items" == getActivePanel()->getName()) + //{ + // gSavedSettings.setU32("RecentItemsSortOrder", sort_order_mask); + //} + //else + //{ + // gSavedSettings.setU32("InventorySortOrder", sort_order_mask); + //} gSavedSettings.setU32(getActivePanel()->mSortOrderSetting, sort_order_mask); // } @@ -1530,6 +1540,15 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) // } +void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility ) +{ + if(!new_visibility) + { + mMenuAdd->setVisible(FALSE); + getActivePanel()->getRootFolder()->finishRenamingItem(); + } +} + bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) { LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 9087b61643..a4d2e4f66a 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -74,6 +74,7 @@ public: std::string& tooltip_msg); /*virtual*/ void changed(U32); /*virtual*/ void draw(); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); LLInventoryPanel* getPanel() { return mActivePanel; } LLInventoryPanel* getActivePanel() { return mActivePanel; } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 00aadae38f..91d6164a2e 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -670,12 +670,14 @@ BOOL LLPanelPeople::postBuild() //mOnlineFriendList->showPermissions("FriendsListShowPermissions"); mOnlineFriendList->showPermissions(true); // Firestorm radar + mOnlineFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames")); mAllFriendList->setNoItemsCommentText(getString("no_friends")); mAllFriendList->setShowIcons("FriendsListShowIcons"); // Firestorm radar //mAllFriendList->showPermissions("FriendsListShowPermissions"); mAllFriendList->showPermissions(true); // Firestorm radar + mAllFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames")); LLPanel* nearby_tab = getChild(NEARBY_TAB_NAME); // Firestorm radar @@ -692,6 +694,7 @@ BOOL LLPanelPeople::postBuild() //mNearbyList->setNoItemsMsg(getString("no_one_near")); //mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near")); //mNearbyList->setShowIcons("NearbyListShowIcons"); + //mNearbyList->setShowCompleteName(!gSavedSettings.getBOOL("NearbyListHideUsernames")); // Firestorm radar // [RLVa:KB] - Checked: RLVa-1.2.0 // Externalized to FSRadar @@ -1545,6 +1548,16 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata) mAllFriendList->showPermissions(show_permissions); mOnlineFriendList->showPermissions(show_permissions); } + else if (chosen_item == "view_usernames") + { + bool hide_usernames = !gSavedSettings.getBOOL("FriendsListHideUsernames"); + gSavedSettings.setBOOL("FriendsListHideUsernames", hide_usernames); + + mAllFriendList->setShowCompleteName(!hide_usernames); + mAllFriendList->handleDisplayNamesOptionChanged(); + mOnlineFriendList->setShowCompleteName(!hide_usernames); + mOnlineFriendList->handleDisplayNamesOptionChanged(); + } } void LLPanelPeople::onGroupsViewSortMenuItemClicked(const LLSD& userdata) @@ -1577,6 +1590,14 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata) { setSortOrder(mNearbyList, E_SORT_BY_DISTANCE); } + else if (chosen_item == "view_usernames") + { + bool hide_usernames = !gSavedSettings.getBOOL("NearbyListHideUsernames"); + gSavedSettings.setBOOL("NearbyListHideUsernames", hide_usernames); + + mNearbyList->setShowCompleteName(!hide_usernames); + mNearbyList->handleDisplayNamesOptionChanged(); + } } bool LLPanelPeople::onNearbyViewSortMenuItemCheck(const LLSD& userdata) diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index e38eaaf802..735cebb599 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -39,9 +39,14 @@ #include "llavataractions.h" #include "llcallingcard.h" // for LLAvatarTracker #include "lllogchat.h" +#include "llparcel.h" #include "llviewermenu.h" // for gMenuHolder #include "llconversationmodel.h" #include "llviewerobjectlist.h" +#include "llviewerparcelmgr.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" +#include "roles_constants.h" #include "llinventorybridge.h" // CHUI merge // [RLVa:KB] - Checked: RLVa-2.0.1 #include "rlvactions.h" @@ -85,12 +90,23 @@ LLContextMenu* PeopleContextMenu::createMenu() registrar.add("Avatar.InviteToGroup", boost::bind(&LLAvatarActions::inviteToGroup, id)); registrar.add("Avatar.TeleportRequest", boost::bind(&PeopleContextMenu::requestTeleport, this)); registrar.add("Avatar.Calllog", boost::bind(&LLAvatarActions::viewChatHistory, id)); + // Circumvent LL screw up + //registrar.add("Avatar.Freeze", boost::bind(&LLAvatarActions::freezeAvatar, id)); + //registrar.add("Avatar.Eject", boost::bind(&PeopleContextMenu::eject, this)); + registrar.add("Avatar.Freeze", boost::bind(&LLAvatarActions::landFreeze, id)); + registrar.add("Avatar.Eject", boost::bind(&LLAvatarActions::landEject, id)); + // + // Firestorm additions registrar.add("Avatar.GroupInvite", boost::bind(&LLAvatarActions::inviteToGroup, id)); registrar.add("Avatar.AddToContactSet", boost::bind(&PeopleContextMenu::addToContactSet, this)); // [FS:CR] enable_registrar.add("Avatar.EnableItem", boost::bind(&PeopleContextMenu::enableContextMenuItem, this, _2)); enable_registrar.add("Avatar.CheckItem", boost::bind(&PeopleContextMenu::checkContextMenuItem, this, _2)); + // Circumvent LL screw up + //enable_registrar.add("Avatar.EnableFreezeEject", boost::bind(&PeopleContextMenu::enableFreezeEject, this, _2)); + enable_registrar.add("Avatar.EnableFreezeEject", boost::bind(&LLAvatarActions::canLandFreezeOrEject, id)); + // // create the context menu from the XUI menu = createFromFile("menu_people_nearby.xml"); @@ -296,6 +312,50 @@ bool PeopleContextMenu::checkContextMenuItem(const LLSD& userdata) return false; } +bool PeopleContextMenu::enableFreezeEject(const LLSD& userdata) +{ + if((gAgent.getID() == mUUIDs.front()) || (mUUIDs.size() != 1)) + { + return false; + } + + const LLUUID& id = mUUIDs.front(); + + // Use avatar_id if available, otherwise default to right-click avatar + LLVOAvatar* avatar = NULL; + if (id.notNull()) + { + LLViewerObject* object = gObjectList.findObject(id); + if (object) + { + if( !object->isAvatar() ) + { + object = NULL; + } + avatar = (LLVOAvatar*) object; + } + } + if (!avatar) return false; + + // Gods can always freeze + if (gAgent.isGodlike()) return true; + + // Estate owners / managers can freeze + // Parcel owners can also freeze + const LLVector3& pos = avatar->getPositionRegion(); + const LLVector3d& pos_global = avatar->getPositionGlobal(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel(); + LLViewerRegion* region = avatar->getRegion(); + if (!region) return false; + + bool new_value = region->isOwnedSelf(pos); + if (!new_value || region->isOwnedGroup(pos)) + { + new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN); + } + return new_value; +} + void PeopleContextMenu::requestTeleport() { // boost::bind cannot recognize overloaded method LLAvatarActions::teleportRequest(), @@ -325,6 +385,39 @@ void PeopleContextMenu::offerTeleport() // LLAvatarActions::offerTeleport(mUUIDs); } +void PeopleContextMenu::eject() +{ + if((gAgent.getID() == mUUIDs.front()) || (mUUIDs.size() != 1)) + { + return; + } + + const LLUUID& id = mUUIDs.front(); + + // Use avatar_id if available, otherwise default to right-click avatar + LLVOAvatar* avatar = NULL; + if (id.notNull()) + { + LLViewerObject* object = gObjectList.findObject(id); + if (object) + { + if( !object->isAvatar() ) + { + object = NULL; + } + avatar = (LLVOAvatar*) object; + } + } + if (!avatar) return; + LLSD payload; + payload["avatar_id"] = avatar->getID(); + std::string fullname = avatar->getFullname(); + + const LLVector3d& pos = avatar->getPositionGlobal(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel(); + LLAvatarActions::ejectAvatar(id ,LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED)); +} + void PeopleContextMenu::startConference() { uuid_vec_t uuids; @@ -402,6 +495,8 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags) items.push_back(std::string("share")); items.push_back(std::string("pay")); items.push_back(std::string("block_unblock")); + items.push_back(std::string("freeze")); + items.push_back(std::string("eject")); } hide_context_entries(menu, items, disabled_items); diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h index bc060bd737..c0417f808e 100644 --- a/indra/newview/llpanelpeoplemenus.h +++ b/indra/newview/llpanelpeoplemenus.h @@ -49,7 +49,9 @@ protected: private: bool enableContextMenuItem(const LLSD& userdata); bool checkContextMenuItem(const LLSD& userdata); + bool enableFreezeEject(const LLSD& userdata); void offerTeleport(); + void eject(); void startConference(); void requestTeleport(); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 48a80c766d..d1e49c5b99 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -208,6 +208,16 @@ public: return true; } + if (verb == "unblock") + { + if (params.size() > 2) + { + const std::string object_name = params[2].asString(); + LLMute mute(avatar_id, object_name, LLMute::OBJECT); + LLMuteList::getInstance()->remove(mute); + } + return true; + } return false; } }; diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 1a4a0acd37..9a8f1bf7ad 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -34,6 +34,8 @@ #include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model #include "llpanelsnapshot.h" #include "llviewercontrol.h" // gSavedSettings +#include "llstatusbar.h" // can_afford_transaction() +#include "llnotificationsutil.h" // FIRE-10537 - Temp texture uploads aren't functional on SSB regions #include "llagent.h" @@ -125,8 +127,19 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) void LLPanelSnapshotInventory::onSend() { - LLFloaterSnapshot::saveTexture(); - LLFloaterSnapshot::postSave(); + S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + if (can_afford_transaction(expected_upload_cost)) + { + LLFloaterSnapshot::saveTexture(); + LLFloaterSnapshot::postSave(); + } + else + { + LLSD args; + args["COST"] = llformat("%d", expected_upload_cost); + LLNotificationsUtil::add("ErrorPhotoCannotAfford", args); + LLFloaterSnapshot::inventorySaveFailed(); + } } // Store settings at logout diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 168919a4e0..1b085ad82e 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -126,6 +126,7 @@ protected: registrar.add("Wearing.EditItem", boost::bind(handleMultiple, edit_item, mUUIDs)); registrar.add("Wearing.EditOutfit", boost::bind(&edit_outfit)); // [/SL:KB] + registrar.add("Wearing.ShowOriginal", boost::bind(show_item_original, mUUIDs.front())); registrar.add("Wearing.TakeOff", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs)); registrar.add("Wearing.Detach", @@ -203,6 +204,7 @@ protected: menu->setItemEnabled("detach", !rlv_blocked); // [/RLVa:KB] menu->setItemVisible("edit_outfit_separator", allow_take_off || allow_detach); + menu->setItemVisible("show_original", mUUIDs.size() == 1); } }; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index dec8629946..3c5c258ce7 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -38,6 +38,7 @@ #include "llviewercontrol.h" #include "llfloaterpreference.h" #include "llfloaterreg.h" +#include "llfeaturemanager.h" #include "quickprefs.h" LLPresetsManager::LLPresetsManager() @@ -71,7 +72,7 @@ void LLPresetsManager::createMissingDefault() LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL; // Write current graphic settings as the default - savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); + savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT, true); } else { @@ -150,7 +151,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam presets = mPresetNames; } -bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name) +bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault) { if (LLTrans::getString(PRESETS_DEFAULT) == name) { @@ -162,12 +163,11 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n if(PRESETS_GRAPHIC == subdirectory) { - gSavedSettings.setString("PresetGraphicActive", name); - // Graphic preset controls independent from XUI //LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - //if (instance) + //if (instance && !createDefault) //{ + // gSavedSettings.setString("PresetGraphicActive", name); // instance->getControlNames(name_list); // LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL; // name_list.push_back("PresetGraphicActive"); @@ -176,7 +176,11 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n //{ // LL_WARNS() << "preferences floater instance not found" << LL_ENDL; //} - name_list = mGraphicPresetControls; + if (!createDefault) + { + gSavedSettings.setString("PresetGraphicActive", name); + name_list = mGraphicPresetControls; + } // } else if(PRESETS_CAMERA == subdirectory) @@ -189,23 +193,58 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL; } - if (name_list.size() > 1) // if the active preset name is the only thing in the list, don't save the list + if (name_list.size() > 1 // if the active preset name is the only thing in the list, don't save the list + || (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC)) // or create a default graphics preset from hw recommended settings { // make an empty llsd LLSD paramsData(LLSD::emptyMap()); - for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) + if (createDefault) { - std::string ctrl_name = *it; - LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); - std::string comment = ctrl->getComment(); - std::string type = LLControlGroup::typeEnumToString(ctrl->type()); - LLSD value = ctrl->getValue(); + paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap(); + if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0) + { + mIsLoadingPreset = true; // Graphic preset controls independent from XUI + // use the recommended setting as an initial one (MAINT-6435) + gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger()); + mIsLoadingPreset = false; // Graphic preset controls independent from XUI + } - paramsData[ctrl_name]["Comment"] = comment; - paramsData[ctrl_name]["Persist"] = 1; - paramsData[ctrl_name]["Type"] = type; - paramsData[ctrl_name]["Value"] = value; + // Graphic preset controls independent from XUI + // Add the controls not in feature table to the default preset with their current value + for (std::vector::iterator it = mGraphicPresetControls.begin(); it != mGraphicPresetControls.end(); ++it) + { + std::string ctrl_name = *it; + if (!paramsData.has(ctrl_name)) + { + LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); + std::string comment = ctrl->getComment(); + std::string type = LLControlGroup::typeEnumToString(ctrl->type()); + LLSD value = ctrl->getValue(); + + paramsData[ctrl_name]["Comment"] = comment; + paramsData[ctrl_name]["Persist"] = 1; + paramsData[ctrl_name]["Type"] = type; + paramsData[ctrl_name]["Value"] = value; + } + } + // + } + else + { + for (std::vector::iterator it = name_list.begin(); it != name_list.end(); ++it) + { + std::string ctrl_name = *it; + LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get(); + std::string comment = ctrl->getComment(); + std::string type = LLControlGroup::typeEnumToString(ctrl->type()); + LLSD value = ctrl->getValue(); + + paramsData[ctrl_name]["Comment"] = comment; + paramsData[ctrl_name]["Persist"] = 1; + paramsData[ctrl_name]["Type"] = type; + paramsData[ctrl_name]["Value"] = value; + } } std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); @@ -222,10 +261,12 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL; - gSavedSettings.setString("PresetGraphicActive", name); - - // signal interested parties - triggerChangeSignal(); + if (!createDefault) + { + gSavedSettings.setString("PresetGraphicActive", name); + // signal interested parties + triggerChangeSignal(); + } } else { diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 350fa15867..aca7ed2dd2 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -56,7 +56,7 @@ public: static std::string getPresetsDir(const std::string& subdirectory); void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option); - bool savePreset(const std::string& subdirectory, std::string name); + bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false); void loadPreset(const std::string& subdirectory, std::string name); bool deletePreset(const std::string& subdirectory, std::string name); diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index e705be8c7c..9eaeb51cca 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -101,7 +101,8 @@ BOOL LLPreviewNotecard::postBuild() if (item) { getChild("desc")->setValue(item->getDescription()); - getChildView("Delete")->setEnabled(true); + BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); + getChildView("Delete")->setEnabled(!source_library); } getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); @@ -248,6 +249,7 @@ void LLPreviewNotecard::loadAsset() BOOL is_owner = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE); BOOL allow_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); BOOL allow_modify = canModify(mObjectUUID, item); + BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID()); if (allow_copy || gAgent.isGodlike()) { @@ -317,7 +319,7 @@ void LLPreviewNotecard::loadAsset() getChildView("lock")->setVisible( TRUE); } - if(allow_modify || is_owner) + if((allow_modify || is_owner) && !source_library) { getChildView("Delete")->setEnabled(TRUE); } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index ced1e88a47..d6596ba99d 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -40,6 +40,7 @@ #include "llimagetga.h" #include "llimagepng.h" #include "llinventory.h" +#include "llinventorymodel.h" #include "llnotificationsutil.h" #include "llresmgr.h" #include "lltrans.h" @@ -170,18 +171,22 @@ BOOL LLPreviewTexture::postBuild() childSetCommitCallback("save_tex_btn", onSaveAsBtn, this); getChildView("save_tex_btn")->setVisible(canSaveAs()); // Ansariel: No need to show the save button if we can't save anyway getChildView("save_tex_btn")->setEnabled(canSaveAs()); - - if (!mCopyToInv) - { - const LLInventoryItem* item = getItem(); - - if (item) - { - childSetCommitCallback("desc", LLPreview::onText, this); - getChild("desc")->setValue(item->getDescription()); - getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); - } - } + + const LLInventoryItem* item = getItem(); + if (item) + { + if (!mCopyToInv) + { + childSetCommitCallback("desc", LLPreview::onText, this); + getChild("desc")->setValue(item->getDescription()); + getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); + } + BOOL source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); + if (source_library) + { + getChildView("Discard")->setEnabled(false); + } + } // Fill in ratios list with common aspect ratio values mRatiosList.clear(); @@ -979,6 +984,15 @@ void LLPreviewTexture::loadAsset() // check that we can copy inworld items into inventory getChildView("Keep")->setEnabled(mIsCopyable); } + else + { + // check that we can remove item + BOOL source_library = gInventory.isObjectDescendentOf(mItemUUID, gInventory.getLibraryRootFolderID()); + if (source_library) + { + getChildView("Discard")->setEnabled(false); + } + } } LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus() diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2b2cad4d61..b1ea292fa7 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1010,6 +1010,11 @@ bool idle_startup() gRememberPassword = gSavedSettings.getBOOL("RememberPassword"); show_connect_box = TRUE; } + + //setup map of datetime strings to codes and slt & local time offset from utc + // *TODO: Does this need to be here? + LLStringOps::setupDatetimeInfo(false); + // Go to the next startup state LLStartUp::setStartupState( STATE_BROWSER_INIT ); return FALSE; @@ -1626,9 +1631,6 @@ bool idle_startup() LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done); } } - //setup map of datetime strings to codes and slt & local time offset from utc - // *TODO: Does this need to be here? - LLStringOps::setupDatetimeInfo (false); // Wait for notification confirmation //transition_back_to_login_panel(emsg.str()); LLStartUp::setStartupState(STATE_LOGIN_CONFIRM_NOTIFICATON); @@ -4132,6 +4134,13 @@ bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y { time_t now = time(NULL); gUTCOffset = (server_utc_time - now); + + // Print server timestamp + LLSD substitution; + substitution["datetime"] = (S32)server_utc_time; + std::string timeStr = "[month, datetime, slt] [day, datetime, slt] [year, datetime, slt] [hour, datetime, slt]:[min, datetime, slt]:[second, datetime, slt]"; + LLStringUtil::format(timeStr, substitution); + LL_INFOS("AppInit") << "Server SLT timestamp: " << timeStr << ". Server-viewer time offset before correction: " << gUTCOffset << "s" << LL_ENDL; } } diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 73b6b8230b..ad7b861a9d 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -212,6 +212,21 @@ void LLToast::hide() } } +/*virtual*/ +void LLToast::setFocus(BOOL b) +{ + if (b && !hasFocus() && mPanel) + { + LLModalDialog::setFocus(TRUE); + // mostly for buttons + mPanel->setFocus(TRUE); + } + else + { + LLModalDialog::setFocus(b); + } +} + void LLToast::onFocusLost() { if(mWrapperPanel && !isBackgroundVisible()) diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index f02d7c2a1a..cd92189012 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -150,6 +150,8 @@ public: // virtual void hide(); + /*virtual*/ void setFocus(BOOL b); + /*virtual*/ void onFocusLost(); /*virtual*/ void onFocusReceived(); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index ddc01d9a27..cb4e84cb1b 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -44,8 +44,8 @@ // [FS communication UI] //#include "llfloaterimsession.h" #include "fsfloaterim.h" +#include "llmutelist.h" // [FS communication UI] -#include "llavataractions.h" const S32 BOTTOM_PAD = VPAD * 3; const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding @@ -107,7 +107,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); } // for the scriptdialog buttons we use fixed button size. This is a limit! - if (!mIsScriptDialog && font->getWidth(form_element["text"].asString()) > BUTTON_WIDTH) + if (!mIsScriptDialog && font->getWidth(form_element["text"].asString()) > (BUTTON_WIDTH-2*HPAD)) { p.rect.width = 1; p.auto_resize = true; @@ -164,7 +164,11 @@ void LLToastNotifyPanel::updateButtonsLayout(const std::vectorsecond; LLRect btn_rect(btn->getRect()); - if (left + btn_rect.getWidth() > max_width)// whether there is still some place for button+h_pad in the mControlPanel + if (buttons.size() == 1) // for the one-button forms, center that button + { + left = (max_width - btn_rect.getWidth()) / 2; + } + else if (left + btn_rect.getWidth() > max_width)// whether there is still some place for button+h_pad in the mControlPanel { // looks like we need to add button to the next row left = 0; @@ -328,6 +332,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) mTextBox->setContentTrusted(is_content_trusted); mTextBox->setValue(mNotification->getMessage()); mTextBox->setIsFriendCallback(LLAvatarActions::isFriend); + mTextBox->setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0)); // Script dialog colors if (mIsScriptDialog) diff --git a/indra/newview/lltoastscriptquestion.cpp b/indra/newview/lltoastscriptquestion.cpp index 91ba8c0247..7a3a1d8fd7 100644 --- a/indra/newview/lltoastscriptquestion.cpp +++ b/indra/newview/lltoastscriptquestion.cpp @@ -54,6 +54,19 @@ BOOL LLToastScriptQuestion::postBuild() return TRUE; } + +// virtual +void LLToastScriptQuestion::setFocus(BOOL b) +{ + LLToastPanel::setFocus(b); + // toast can fade out and disappear with focus ON, so reset to default anyway + LLButton* dfbutton = getDefaultButton(); + if (dfbutton && dfbutton->getVisible() && dfbutton->getEnabled()) + { + dfbutton->setFocus(b); + } +} + void LLToastScriptQuestion::snapToMessageHeight() { LLTextBox* mMessage = getChild("top_info_message"); @@ -118,6 +131,12 @@ void LLToastScriptQuestion::createButtons() button->setRect(rect); buttons_width += rect.getWidth() + LEFT_PAD; + + if (form_element.has("default") && form_element["default"].asBoolean()) + { + button->setFocus(TRUE); + setDefaultBtn(button); + } } } } diff --git a/indra/newview/lltoastscriptquestion.h b/indra/newview/lltoastscriptquestion.h index 3a557f60f6..a756f88415 100644 --- a/indra/newview/lltoastscriptquestion.h +++ b/indra/newview/lltoastscriptquestion.h @@ -39,6 +39,8 @@ public: virtual BOOL postBuild(); virtual ~LLToastScriptQuestion(){}; + /*virtual*/ void setFocus(BOOL b); + private: void snapToMessageHeight(); diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index dc8c407670..40dd71e0ee 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -89,6 +89,7 @@ LLToolMgr::LLToolMgr() // [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d | Ansa: Changed because of FIRE-5552 LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&RlvUIEnabler::isBuildEnabled)); // [/RLVa:KB] + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.EnabledOrActive", boost::bind(&LLToolMgr::buildEnabledOrActive, this)); LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Marketplace.Enabled", boost::bind(&LLToolMgr::canAccessMarketplace, this)); LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Marketplace.Toggle", boost::bind(&LLToolMgr::toggleMarketplace, this, _2)); @@ -270,18 +271,18 @@ bool LLToolMgr::canEdit() return LLViewerParcelMgr::getInstance()->allowAgentBuild(); } +bool LLToolMgr::buildEnabledOrActive() +{ + // RLVa check + //return inEdit() || canEdit(); + return inEdit() || RlvUIEnabler::isBuildEnabled(); + // +} + void LLToolMgr::toggleBuildMode(const LLSD& sdname) { const std::string& param = sdname.asString(); -// [RLVa:KB] - Checked: 2012-04-26 (RLVa-1.4.6) | Added: RLVa-1.4.6 | Ansa: Changed because of FIRE-5552 - //if (param == "build" && !canEdit()) - if (param == "build" && !RlvUIEnabler::isBuildEnabled()) -// [/RLVa:KB] - { - return; - } - // FIRE-15653: Prevent cheating around @editobj restriction //LLFloaterReg::toggleInstanceOrBringToFront("build"); if (param == "toggleonly") @@ -293,6 +294,13 @@ void LLToolMgr::toggleBuildMode(const LLSD& sdname) LLFloaterReg::toggleInstanceOrBringToFront("build"); } // +// [RLVa:KB] - Checked: 2012-04-26 (RLVa-1.4.6) | Added: RLVa-1.4.6 | Ansa: Changed because of FIRE-5552 + //if (param == "build" && !canEdit()) + if (param == "build" && !RlvUIEnabler::isBuildEnabled()) +// [/RLVa:KB] + { + return; + } bool build_visible = LLFloaterReg::instanceVisible("build"); if (build_visible) diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index 8dfd3dd1bf..483b2c58d1 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -54,6 +54,7 @@ public: bool inEdit(); bool canEdit(); + bool buildEnabledOrActive(); bool canAccessMarketplace(); // [RLVa:KB] - Checked: 2012-04-26 (RLVa-1.4.6) | Added: RLVa-1.4.6 | Ansa: Changed because of FIRE-5552 void toggleBuildMode(const LLSD& sdname = LLSD()); diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index f1cff3cc44..b087587a75 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -198,11 +198,11 @@ void LLTracker::render3D() if (dist < DESTINATION_REACHED_RADIUS) { // Disable stop tracking when closing in - //instance()->stopTrackingLocation(); + //instance()->stopTrackingLocation(FALSE,TRUE); // Always disable tracker if we're not using the avatar tracker of the radar if (fsDisableTrackerAtCloseIn || instance()->mTrackingLocationType != LLTracker::LOCATION_AVATAR) { - instance()->stopTrackingLocation(); + instance()->stopTrackingLocation(FALSE,TRUE); } else { @@ -725,13 +725,13 @@ void LLTracker::stopTrackingLandmark(BOOL clear_ui) } -void LLTracker::stopTrackingLocation(BOOL clear_ui) +void LLTracker::stopTrackingLocation(BOOL clear_ui, BOOL dest_reached) { purgeBeaconText(); mTrackedLocationName.assign(""); mIsTrackingLocation = FALSE; mTrackedPositionGlobal.zeroVec(); - gFloaterWorldMap->clearLocationSelection(clear_ui); + gFloaterWorldMap->clearLocationSelection(clear_ui, dest_reached); mTrackingStatus = TRACKING_NOTHING; mTrackingLocationType = LOCATION_NOTHING; } diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index e3dab5b7b6..86d7dd2f52 100644 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -121,7 +121,7 @@ protected: void stopTrackingAll(BOOL clear_ui = FALSE); void stopTrackingAvatar(BOOL clear_ui = FALSE); - void stopTrackingLocation(BOOL clear_ui = FALSE); + void stopTrackingLocation(BOOL clear_ui = FALSE, BOOL dest_reached = FALSE); void stopTrackingLandmark(BOOL clear_ui = FALSE); //void drawMarker(const LLVector3d& pos_global, const LLColor4& color); Exodus' mouselook combat feature diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 2135829b87..2e632c48c3 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -861,5 +861,12 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res } } + // Let the Snapshot floater know we have failed uploading. + LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot"); + if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_snapshot) + { + floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "inventory"))); + } + } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 68759effc6..b507683c96 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -777,7 +777,8 @@ BOOL LLViewerKeyboard::handleKey(KEY translated_key, MASK translated_mask, BOOL if(mKeysSkippedByUI.find(translated_key) != mKeysSkippedByUI.end()) { mKeyHandledByUI[translated_key] = FALSE; - LL_INFOS("Keyboard Handling") << "Key wasn't handled by UI!" << LL_ENDL; + //LL_INFOS("Keyboard Handling") << "Key wasn't handled by UI!" << LL_ENDL; + LL_INFOS_ONCE("Keyboard Handling") << "Key wasn't handled by UI!" << LL_ENDL; // Change log message to not print out every time } else { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 7e07683f96..1c2b25ac6d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8624,20 +8624,25 @@ bool enable_avatar_call() namespace { - struct QueueObjects : public LLSelectedObjectFunctor + struct QueueObjects : public LLSelectedNodeFunctor { BOOL scripted; BOOL modifiable; LLFloaterScriptQueue* mQueue; QueueObjects(LLFloaterScriptQueue* q) : mQueue(q), scripted(FALSE), modifiable(FALSE) {} - virtual bool apply(LLViewerObject* obj) + virtual bool apply(LLSelectNode* node) { + LLViewerObject* obj = node->getObject(); + if (!obj) + { + return true; + } scripted = obj->flagScripted(); modifiable = obj->permModify(); if( scripted && modifiable ) { - mQueue->addObject(obj->getID()); + mQueue->addObject(obj->getID(), node->mName); return false; } else @@ -8653,7 +8658,7 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& msg) QueueObjects func(q); LLSelectMgr *mgr = LLSelectMgr::getInstance(); LLObjectSelectionHandle selectHandle = mgr->getSelection(); - bool fail = selectHandle->applyToObjects(&func); + bool fail = selectHandle->applyToNodes(&func); if(fail) { if ( !func.scripted ) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 8c2f16f9ae..071cc96f81 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -9598,6 +9598,15 @@ void process_covenant_reply(LLMessageSystem* msg, void**) panel->updateEstateOwnerName(owner_name); } + // Standalone location profile floater + FSFloaterPlaceDetails* fs_floater = LLFloaterReg::findTypedInstance("fs_placedetails", LLSD().with("type", "agent")); + if (fs_floater) + { + fs_floater->updateEstateName(estate_name); + fs_floater->updateEstateOwnerName(owner_name); + } + // + // standard message, not from system std::string last_modified; if (covenant_timestamp == 0) @@ -9728,6 +9737,14 @@ void onCovenantLoadComplete(LLVFS *vfs, { panel->updateCovenantText(covenant_text); } + + // Standalone location profile floater + FSFloaterPlaceDetails* fs_floater = LLFloaterReg::findTypedInstance("fs_placedetails", LLSD().with("type", "agent")); + if (fs_floater) + { + fs_floater->updateCovenantText(covenant_text); + } + // } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c94939ea8d..8a842e9297 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -273,21 +273,16 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) } S32 id = ++mHttpResponderID; - // Increment after posting (progress showing wrong attempt otherwise) - //++mSeedCapAttempts; LLSD capabilityNames = LLSD::emptyArray(); buildCapabilityNames(capabilityNames); LL_INFOS("AppInit", "Capabilities") << "Requesting seed from " << url - // Increment after posting (progress showing wrong attempt otherwise) - // << " (attempt #" << mSeedCapAttempts << ")" << LL_ENDL; << " (attempt #" << mSeedCapAttempts + 1 << ")" << LL_ENDL; regionp = NULL; result = httpAdapter->postAndSuspend(httpRequest, url, capabilityNames); - // Increment after posting (progress showing wrong attempt otherwise) ++mSeedCapAttempts; regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index b12b24e4ad..5eb3172ee8 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2010,7 +2010,8 @@ bool LLViewerFetchedTexture::updateFetch() static LLCachedControl textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled", false); static LLCachedControl sCameraMotionThreshold(gSavedSettings,"TextureCameraMotionThreshold", 0.2f); static LLCachedControl sCameraMotionBoost(gSavedSettings,"TextureCameraMotionBoost", 3); - if(textures_decode_disabled) + if(textures_decode_disabled || + (gUseWireframe && mBoostLevel < LLGLTexture::BOOST_AVATAR_BAKED_SELF)) // don't fetch the surface textures in wireframe mode { return false; } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index ae0876785c..ec211a4e06 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -174,13 +174,27 @@ void LLViewerTextureList::doPreloadImages() mImagePreloads.insert(image); } image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, - 0,0,LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); + 0, 0, IMG_TRANSPARENT); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - + image = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, + GL_ALPHA8, GL_ALPHA, IMG_ALPHA_GRAD); + if (image) + { + image->setAddressMode(LLTexUnit::TAM_CLAMP); + mImagePreloads.insert(image); + } + image = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, + GL_ALPHA8, GL_ALPHA, IMG_ALPHA_GRAD_2D); + if (image) + { + image->setAddressMode(LLTexUnit::TAM_CLAMP); + mImagePreloads.insert(image); + } + LLPointer img_blak_square_tex(new LLImageRaw(2, 2, 3)); memset(img_blak_square_tex->getData(), 0, img_blak_square_tex->getDataSize()); LLPointer img_blak_square(new LLViewerFetchedTexture(img_blak_square_tex, FTT_DEFAULT, FALSE)); @@ -191,7 +205,7 @@ void LLViewerTextureList::doPreloadImages() static std::string get_texture_list_name() { - return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "texture_list_" + gSavedSettings.getString("LoginLocation") + ".xml"); + return gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "texture_list_" + gSavedSettings.getString("LoginLocation") + "." + gDirUtilp->getUserName() + ".xml"); } void LLViewerTextureList::doPrefetchImages() @@ -297,7 +311,7 @@ void LLViewerTextureList::shutdown() break; } - if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty()) + if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "").empty()) { std::string filename = get_texture_list_name(); llofstream file; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0c437617ae..519351575b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8671,7 +8671,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // No backsies zone - if we get here, the message should be valid and usable, will be processed. LL_INFOS("Avatar") << "Processing appearance message version " << thisAppearanceVersion << LL_ENDL; - if (isSelf()) + //if (isSelf()) // FIRE-19851: [BUG-37637] DebugAvatarAppearanceMessage incorrectly reports all avatars received COF version as -1 { // Note: // locally the COF is maintained via LLInventoryModel::accountForUpdate diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 5890fa9a86..c5360bfd5e 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -477,10 +477,7 @@ void LLVivoxVoiceClient::connectorCreate() void LLVivoxVoiceClient::connectorShutdown() { - // Voice fix - //if(!mConnectorEstablished) if(mConnectorEstablished) - // { std::ostringstream stream; stream @@ -6858,8 +6855,6 @@ void LLVivoxProtocolParser::EndTag(const char *tag) { const std::string& string = textBuffer; - std::cerr << tag << ": " << textBuffer << std::endl; - responseDepth--; if (ignoringTags) diff --git a/indra/newview/skins/default/xui/de/floater_fs_avatar_render_settings.xml b/indra/newview/skins/default/xui/de/floater_fs_avatar_render_settings.xml index 58f8fa6abc..66aaef51eb 100644 --- a/indra/newview/skins/default/xui/de/floater_fs_avatar_render_settings.xml +++ b/indra/newview/skins/default/xui/de/floater_fs_avatar_render_settings.xml @@ -4,7 +4,7 @@ Niemals - Immer + Komplett diff --git a/indra/newview/skins/default/xui/de/floater_script_queue.xml b/indra/newview/skins/default/xui/de/floater_script_queue.xml index d1facd2d15..cf1031330c 100644 --- a/indra/newview/skins/default/xui/de/floater_script_queue.xml +++ b/indra/newview/skins/default/xui/de/floater_script_queue.xml @@ -15,8 +15,26 @@ Läuft nicht + + Zeitüberschreitung: [OBJECT_NAME] + + + Lade Inhalt von: [OBJECT_NAME] + Wird gelöscht + + Übersprungen: [OBJECT_NAME] (Berechtigungen) + + + Kompiliere „[OBJECT_NAME]“... + + + Kompilierung von „[OBJECT_NAME]“ erfolgreich + + + Kompilierung von „[OBJECT_NAME]“ fehlgeschlagen: +