diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 176a458f9..000000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/.gitignore b/.gitignore index 7c302ed85..01cad3637 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -/installed.xml -/indra/llcommon/llversionviewer.h /indra/build-* /indra/tools/vstool/obj/ *.aps @@ -12,13 +10,14 @@ /indra/viewer-* /indra/newview/vivox-runtime/ /indra/newview/dbghelp.dll +indra/newview/res/viewer_icon.* +indra/newview/res-sdl/viewer_icon.* /libraries/ /lib/ *.pyc *.orig *.rej *.bak -*~ *.DS_Store /LICENSES/ /edited-files.txt @@ -26,12 +25,5 @@ qtcreator-build/ /.pc /build-* /viewer-* -/indra/newview/res/viewerRes.rc -/indra/newview/res/viewerRes_bc.rc -/indra/newview/English.lproj/InfoPlist.strings -/indra/newview/linux_tools/handle_secondlifeprotocol.sh -/indra/newview/linux_tools/install.sh -/indra/newview/linux_tools/refresh_desktop_app_entry.sh -/indra/newview/linux_tools/wrapper.sh diff --git a/AscentChangelog.txt b/AscentChangelog.txt deleted file mode 100644 index d7c9aff00..000000000 --- a/AscentChangelog.txt +++ /dev/null @@ -1,81 +0,0 @@ -->> Features implemented in Ascent: - -In-World: -------------------------------------------------- -* Alpha skins and Tattoo Layers -* Inventory Pre-caching -* Avatar Radar -* Multiple Attachment Points -* Idle time of avatars around you (Not perfect) -* Client tags/coloring for various clients, and extra client definitions -* Force Away button to fake being away if you really want to avoid someone :V -* Double-Click teleport (Not all the functionality of Emerald yet) -Preferences (Options are in Ascent Options): -* Disable Look At -* Disable Point At and beam end -* Fetch inventory in background on login (No waiting for caching when searching) -* Display your client tag to yourself -* Display your client tag color to yourself -* Rez objects as land group when possible -* Some settings can now be saved per account after changing an option in the preferences. Currently affected settings: - Edit Beam color - Client Tag Color -Communication Window: -- Friend List: - * Friend List Online/Total counts (Not perfect) - * Shows what rights your friends have given you (Mod, See on map, Online) - -Chat Bar: -* Emerald-style Chatbar as Commandline (See Preferences) -* MU-style poses. -* OOC Auto-close. - -Instant Messages: -* MU-style poses. -* OOC Auto-close. - -Advanced -> Ascent: -* Fake Away Status -* Force Ground Sit (Lets you sit anywhere) -* Phantom Avatar (Prevents you visually from being pushed.) -* Toggle IM Notification (Ability to hide '%n is typing...' notification from being sent.) -* Close All Dialogs -* Message Log -* Message Builder -* Sound Explorer -* Asset Blacklist -* AO options - -Object Pie Menus: -* Measure: Select on one object, then another, to get the exact distance between the two -* Data: Reports prim rotation and position in a format usable in LSL scripts. -* Script Counter - -Self Pie Menu: -* Animation Explorer - -Agent Pie Menus: -* Script Counter -* Copy Agent UUID -* Debug - -Parcel Window: -------------------------------------------------- -- General tab: -- Objects tab: - * In Sim/Online/Offline indicators for Parcel Object Owner listings (Online is currently wonky - This is an issue with SL, Emerald has the same problem.) - -Build Window: -------------------------------------------------- -- General tab: - * Last Owner shown in Build "General" Tab - * Group object is set to has a "View" button to see the group's profile - * Copy Object Key button -- Build Tab: - * Copy/Paste Position buttons - * Copy/Paste Size buttons - * Copy/Paste Rotation buttons - * Copy/Paste Primitive Parameters buttons - -Known issues: -Online/Total counts in the friends list sometimes go haywire. Not often or by a large margin, but it happens. \ No newline at end of file diff --git a/autobuild.xml b/autobuild.xml new file mode 100644 index 000000000..b3f547659 --- /dev/null +++ b/autobuild.xml @@ -0,0 +1,3228 @@ + + + + installables + + SDL + + copyright + Copyright (c) 2004, 2006-2013 Sam Lantinga + description + Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. + license + lgpl + license_file + LICENSES/SDL.txt + name + SDL + platforms + + linux + + archive + + hash + 8da309d24fb0bad8eaaa667fb04c6dc7 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-sdl-update/rev/290561/arch/Linux/installer/SDL-1.2.15-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 5c8df43ff04799f3f675b8a0f328f184 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/SDL-1.2.15-linux64-201603241005.tar.bz2 + + name + linux64 + + + version + 1.2.15 + + apr_suite + + copyright + Copyright © 2012 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. + description + Apache portable runtime project + license + Apache 2.0 + license_file + LICENSES/apr_suite.txt + name + apr_suite + platforms + + darwin + + archive + + hash + 1eca2a268913083596127b46570779ab + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/apr_suite-1.5.2-darwin-201511222106.tar.bz2 + + name + darwin + + linux + + archive + + hash + f38c966a430012dc157fdc104f23a59b + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/259951/arch/Linux/installer/apr_suite-1.4.5-linux-20120618.tar.bz2 + + name + linux + + linux64 + + archive + + hash + cd30af9b015c373bed5062b1642a1b3e + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/apr_suite-1.5.2-linux64-201603240800.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 76186b09770cab66dba6586cb1d2123f + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/apr_suite-1.5.2-windows-201603261507.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 586739a99e1366cd9e270dc7c9a4e519 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/apr_suite-1.5.2-windows64-201603261452.tar.bz2 + + name + windows64 + + + version + 1.5.2 + + ares + + copyright + Copyright 1998 by the Massachusetts Institute of Technology. + description + C-ares, an asynchronous resolver library. + license + c-ares + license_file + LICENSES/c-ares.txt + name + ares + platforms + + darwin + + archive + + hash + 9a42795b21203afe858db16703929436 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/ares-1.10.0-darwin-201511222040.tar.bz2 + + name + darwin + + linux + + archive + + hash + 92f6a454d90b5740a38fb68e369cc13e + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-ares-update/rev/290399/arch/Linux/installer/ares-1.10.0-linux-20140529.tar.bz2 + + name + linux + + linux64 + + archive + + hash + bef927b60affa6b5c0520f45c56b5cb3 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/ares-1.10.0-linux64-201603240702.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 0c01eb6ae9b92365ace8e70cf3999bfc + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/ares-1.10.0-windows-201601150954.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 6da2b095ad9616d8a8eae9a6a5b3f2c4 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/ares-1.10.0-windows64-201512122047.tar.bz2 + + name + windows64 + + + version + 1.10.0 + + boost + + copyright + (see individual source files) + description + Boost C++ Libraries + license + boost 1.0 + license_file + LICENSES/boost.txt + name + boost + platforms + + darwin + + archive + + hash + 5e6a0930ca5c9e3c26970ac8589a538c + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/boost-1.59.0-darwin-201601091139.tar.bz2 + + name + darwin + + linux + + archive + + hash + 2f076eae296600a1b810ce375dc4b42d + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-boost-update/rev/290566/arch/Linux/installer/boost-1.55.0-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 74a88afa7ff50462059c17321f91a359 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/boost-1.60.0-linux64-201603241316.tar.bz2 + + name + linux64 + + windows + + archive + + hash + d606e5c39d13f2c23d23ac498520cbac + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/boost-1.60.0-windows-201601152308.tar.bz2 + + name + windows + + windows64 + + archive + + hash + f2ff62721cffd4556d18cbec67152de1 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/boost-1.60.0-windows64-201601160313.tar.bz2 + + name + windows64 + + + version + 1.60.0 + + colladadom + + copyright + Copyright 2006 Sony Computer Entertainment Inc. + license + SCEA + license_file + LICENSES/collada.txt + name + colladadom + platforms + + darwin + + archive + + hash + d6e279fb5ce9093c89819803be5562db + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/colladadom-2.3-darwin-201601091204.tar.bz2 + + name + darwin + + linux + + archive + + hash + bdec5fe5fd008da4328f84115128ee61 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-colladadom-update/rev/290576/arch/Linux/installer/colladadom-2.3-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + c84d1be467d7198103d905f710fa31d3 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/colladadom-2.3-linux64-201603241731.tar.bz2 + + name + linux + + windows + + archive + + hash + 90a37cec15019bff53a165b90f0180a7 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/colladadom-2.3-windows-201601152346.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 46e48bcb7643c4819bf6f35f518a0db7 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/colladadom-2.3-windows64-201601160353.tar.bz2 + + name + windows64 + + + version + 2.3 + + curl + + copyright + Copyright (c) 1996 - 2016, Daniel Stenberg, (daniel@haxx.se). + description + Library for transferring data specified with URL syntax + license + curl + license_file + LICENSES/curl.txt + name + curl + platforms + + darwin + + archive + + hash + cc59e267a98b1b433574470a07737609 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/curl-7.48.0-darwin-201603231616.tar.bz2 + + name + darwin + + linux + + archive + + hash + 06149da3d7a34adf40853f813ae55328 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-curl-update/rev/295367/arch/Linux/installer/curl-7.38.0-linux-20141010.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 24a88e015ee9c1806e7aeb46887d38f5 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/curl-7.48.0-linux64-201603240914.tar.bz2 + + name + linux64 + + windows + + archive + + hash + f20491b59795d311cf8d730556cd141e + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/curl-7.48.0-windows-201603231720.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 86feef4905c2e46a9cbdc7a1df23d83f + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/curl-7.48.0-windows64-201603231658.tar.bz2 + + name + windows64 + + + version + 7.48.0 + + dbus-glib + + copyright + Copyright (C) Red Hat Inc. + description + D-Bus bindings for glib + license + Academic Free License v. 2.1 + license_file + LICENSES/dbus-glib.txt + name + dbus-glib + platforms + + linux + + archive + + hash + 94b058b9a81114dc4567bd78e4335425 + url + http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/dbus_glib-0.76-linux-20110310.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 84e51f2e14db023be5419e74ab3b51d3 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/dbus_glib-0.76-linux64-201501030130.tar.bz2 + + name + linux64 + + + version + 0.76 + + dictionaries + + copyright + Copyright 2014 Apache OpenOffice software + description + Spell checking dictionaries to bundled into the viewer + license + various open source + license_file + LICENSES/dictionaries.txt + name + dictionaries + platforms + + common + + archive + + hash + 078604ad9373fe35081a7d3e4892ae41 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/common/lib/dictionaries-1-common-201412301501.tar.bz2 + + name + common + + + version + 1 + + expat + + copyright + Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper - Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. + description + Expat is an XML parser library written in C + license + expat + license_file + LICENSES/expat.txt + name + expat + platforms + + darwin + + archive + + hash + fc3e46e4737b326b0ca926534ddce9f3 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/expat-2.1.1-darwin-201603271445.tar.bz2 + + name + darwin + + linux + + archive + + hash + 9bd79781b58e556ab1c36084ec4a1c0c + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-expat/rev/221695/arch/Linux/installer/expat-2.0.1-linux-20110219.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 3ed12f7d7b1a3bda07a3c6d8227a3bf2 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/expat-2.1.1-linux64-201603232308.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 454170939e4d1ba07060b73d6f81b9fc + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/expat-2.1.1-windows-201603261409.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 0cf6f4529ade22b7ae78da5d6303ed87 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/expat-2.1.1-windows64-201603261406.tar.bz2 + + name + windows64 + + + version + 2.1.1 + + fmodstudio + + copyright + FMOD Studio, copyright © Firelight Technologies Pty, Ltd., 1994-2015. + description + FMOD Studio audio system library + license + fmodstudio + license_file + LICENSES/fmodstudio.txt + name + fmodstudio + platforms + + darwin + + archive + + hash + ef91e9966ffd6303a8805146c046c659 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/fmodstudio-1.08.00-darwin-201603070723.tar.bz2 + + name + darwin + + linux + + archive + + hash + 1331456a3df95294eaf44fab990f62cd + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux/lib/fmodstudio-1.06.07-linux-201507231333.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 47f5754929fed18fd5ffff8cda2d84e2 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/fmodstudio-1.08.00-linux64-201603232053.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 6548495a886b385c238167f4d5e6182d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib/fmodstudio-1.08.00-windows-201603070824.tar.bz2 + + name + windows + + windows64 + + archive + + hash + b80d49fd91e407fc8ab8afb3fcb4b138 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib/fmodstudio-1.08.00-windows64-201603070822.tar.bz2 + + name + windows64 + + + version + 1.08.00 + + fontconfig + + copyright + Copyright (C) 2000,2001,2002,2003,2004,2006,2007 Keith Packard, 2005 Patrick Lam, 2009 Roozbeh Pournader, 2008,2009 Red Hat, Inc., 2008 Danilo Šegan, 2012 Google, Inc. + description + Fontconfig is a library for configuring and customizing font access. + license + bsd + license_file + LICENSES/fontconfig.txt + name + fontconfig + platforms + + linux + + archive + + hash + 2843c48e6c84a51e3d6aa05dace4c8c0 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-fontconfig-update/rev/290569/arch/Linux/installer/fontconfig-2.11.0-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 25726244f5bcd05f412514b030098c3c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/fontconfig-2.11.0-linux64-201603241804.tar.bz2 + + name + linux64 + + + version + 2.11.0 + + freeglut + + copyright + Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. + description + freeglut is a completely OpenSourced alternative to the OpenGL Utility Toolkit (GLUT) library. + license + freeglut + license_file + LICENSES/freeglut.txt + name + freeglut + platforms + + windows + + archive + + hash + f98709114cedcdfdce69c9df6a4ac2f4 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/freeglut-3.0.0-windows-201601151006.tar.bz2 + + name + windows + + windows64 + + archive + + hash + f281e5b16b380c3e3a77aafa47ba5500 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/freeglut-3.0.0-windows64-201512130218.tar.bz2 + + name + windows64 + + + version + 3.0.0 + + freetype + + copyright + Copyright 2006-2016 by David Turner, Robert Wilhelm, and Werner Lemberg. + description + Font rendering library + license + FreeType + license_file + LICENSES/freetype.txt + name + freetype + platforms + + darwin + + archive + + hash + 8d41fe8cb821e7e080160586a53feec8 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/freetype-2.6.1-darwin-201511222222.tar.bz2 + + name + darwin + + linux + + archive + + hash + 52f87a65cc61ec4b05721c079d015b19 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-freetype-update/rev/290557/arch/Linux/installer/freetype-2.4.4-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + b10ba0775b9f1033daf580a2cb55789d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/freetype-2.6.3-linux64-201603241755.tar.bz2 + + name + linux64 + + windows + + archive + + hash + e5be5197f12f9ca8078ba9ce4f1bce10 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/freetype-2.6.3-windows-201603011805.tar.bz2 + + name + windows + + windows64 + + archive + + hash + e8c0acbe631d7a4cb1a2890b90e5bc8c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/freetype-2.6.3-windows64-201603011807.tar.bz2 + + name + windows64 + + + version + 2.6.3 + + glext + + copyright + Copyright (c) 2013-2014 The Khronos Group Inc. + description + glext headers define function prototypes and constants for OpenGL extensions + license + MIT + license_file + LICENSES/glext.txt + name + glext + platforms + + common + + archive + + hash + c00da9333b1bd0f9cc121ebc365fe360 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/common/lib/glext-20150325-common-201504222056.tar.bz2 + + name + common + + + version + 20150325 + + glh-linear + + copyright + Copyright (c) 2000 Cass Everitt + description + glh - is a platform-indepenedent C++ OpenGL helper library + license + BSD + license_file + LICENSES/glh-linear.txt + name + glh-linear + platforms + + common + + archive + + hash + fed9e6e9de1ea8210b0519f54df81bef + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/common/lib/glh_linear-0.0.0-common-201412301528.tar.bz2 + + name + common + + + version + 0.0.0 + + glod + + copyright + Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia. All rights reserved. + description + Geometric Level of Detail library + license + GLOD Open-Source License 1.0 + license_file + LICENSES/glod.txt + name + glod + platforms + + darwin + + archive + + hash + 6c6b3b06a4305c2da0aad1de132e6a07 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/glod-1.0pre4-darwin-201511222034.tar.bz2 + + name + darwin + + linux + + archive + + hash + 176736c52b3cde6ca8e7d9e173d91731 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-glod/rev/268002/arch/Linux/installer/glod-1.0pre4-linux-20121212.tar.bz2 + + name + linux + + linux64 + + archive + + hash + f7172928ba2201d4b9aeb2c70d7a55b9 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/glod-1.0pre4-linux64-201603240031.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 05134ab3cf05fbfb4bed996b53a0d472 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/glod-1.0pre4-windows-201601151027.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 2da9e546e4f574ec79ea8962f2c962da + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/glod-1.0pre4-windows64-201512092328.tar.bz2 + + name + windows64 + + + version + 1.0pre4 + + google_breakpad + + copyright + Copyright (c) 2006, Google Inc. + description + Breakpad is a crossplatform library for capturing crash callstacks and runtime data. + license + BSD + license_file + LICENSES/google_breakpad.txt + name + google_breakpad + platforms + + darwin + + archive + + hash + 9f963eb1728e6d5077d4feba805d4896 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/google_breakpad-9e60a27-darwin-201511222009.tar.bz2 + + name + darwin + + linux + + archive + + hash + 52257e5eb166a0b69c9c0c38f6e1920e + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-breakpad/rev/273079/arch/Linux/installer/google_breakpad-0.0.0-rev1099-linux-20130329.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 3709a51d4d5dff5ec0c4656623eaa05d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/google_breakpad-9e60a27-linux64-201603240004.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 19147e19b5cfaaaeb83ff1d9025c06df + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/google_breakpad-9e60a27-windows-201601151025.tar.bz2 + + name + windows + + windows64 + + archive + + hash + e74e54c2042b1539a81012501e4b67af + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/google_breakpad-9e60a27-windows64-201512101817.tar.bz2 + + name + windows64 + + + version + 9e60a27 + + gperftools + + copyright + Copyright (c) 2005, Google Inc. + description + Fast, multi-threaded malloc() and nifty performance analysis tools + license + BSD + license_file + LICENSES/gperftools.txt + name + gperftools + platforms + + linux + + archive + + hash + 8aedfdcf670348c18a9991ae1b384a61 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-perftools/rev/262672/arch/Linux/installer/gperftools-2.0-linux-20120727.tar.bz2 + + name + linux + + windows + + archive + + hash + e81d9e4526ceac49f1532d6518085985 + url + https://bitbucket.org/alchemyviewer/publiclibs/downloads/gperftools-2.1-windows-20140120.tar.bz2 + + name + windows + + windows64 + + archive + + hash + da6ec7472ed69fe3231eb95432a789d9 + url + https://bitbucket.org/alchemyviewer/publiclibs/downloads/gperftools-2.2-windows64-20140605.tar.bz2 + + name + windows + + + version + 2.0.297263 + + gstreamer + + copyright + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + license + LGPL + license_file + LICENSES/gstreamer.txt + name + gstreamer + platforms + + common + + archive + + hash + df57a59e832f9e3ca8ba31e37e383dfb + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/common/lib/gstreamer-0.10.6.201501032013-common-201501032013.tar.bz2 + + name + common + + + version + 0.10.6.201501032013 + + gtk-atk-pango-glib + + copyright + Copyright various(See license file) + description + gtk-atk-pango-glib + license + lgpl + license_file + LICENSES/gtk-atk-pango-glib.txt + name + gtk-atk-pango-glib + platforms + + linux + + archive + + hash + 03694ade27f53199229c03cbbda89214 + url + http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/gtk-atk-pango-glib-linux-20101001.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 9678056c5ad714aa7ba1ba4ffcb09859 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/gtk_atk_pango_glib-0.0.2-linux64-201603241949.tar.bz2 + + name + linux64 + + + version + 0.0.2 + + jpeglib + + copyright + Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. + description + JPEG encoding, decoding library + license + libjpeg-turbo + license_file + LICENSES/jpeglib.txt + name + jpeglib + platforms + + darwin + + archive + + hash + 5cf289747de86451b6a956adea468ac7 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/jpeglib-1.4.2-darwin-201511222055.tar.bz2 + + name + darwin + + linux + + archive + + hash + dcca1db348831cdb7c6b26dc4076c597 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-jpeglib/rev/224895/arch/Linux/installer/jpeglib-8c-linux-20110323.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 256812a20a66081e05578f91bab5b3e4 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/jpeglib-1.4.2-linux64-201603240711.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 581db1bb70a7f6b9a6718121d22597a9 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/jpeglib-1.4.2-windows-201601151022.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 982395e50a36334899b900d563003b83 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/jpeglib-1.4.2-windows64-201512092307.tar.bz2 + + name + windows64 + + + version + 1.4.2 + + jsoncpp + + copyright + Copyright (c) 2007-2010 by Baptiste Lepilleur + description + JsonCpp is an implementation of a JSON (http://json.org) reader and writer in C++. + license + Public Domain + license_file + LICENSES/jsoncpp.txt + name + jsoncpp + platforms + + darwin + + archive + + hash + 3243745940e8419f93abf39fd3358158 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/jsoncpp-1.6.5-darwin-201511222000.tar.bz2 + + name + darwin + + linux + + archive + + hash + 840cd9455638c0ea52c613cfddd07d5b + url + http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/jsoncpp-0.5.0-linux-20110315.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 3ebbace19eb931d9236432ba537c3727 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/jsoncpp-1.6.5-linux64-201603232323.tar.bz2 + + name + linux64 + + windows + + archive + + hash + de7bd51771d3d45185c4977e6aec3a37 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/jsoncpp-1.6.5-windows-201601151019.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 4cfc311430b84c8a9eba472fd4469f2e + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/jsoncpp-1.6.5-windows64-201512092309.tar.bz2 + + name + windows64 + + + version + 1.6.5 + + libhunspell + + copyright + See hunspell.txt + description + Spell checking library + license + LGPL + license_file + LICENSES/hunspell.txt + name + libhunspell + platforms + + darwin + + archive + + hash + c897e44b3f5ac33436a028e6e3a5b29b + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/libhunspell-1.3.3-darwin-201511222015.tar.bz2 + + name + darwin + + linux + + archive + + hash + 0c432d2626aea2e91a56335879c92965 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-hunspell/rev/259874/arch/Linux/installer/libhunspell-1.3.2-linux-20120616.tar.bz2 + + name + linux + + linux64 + + archive + + hash + f58652f3217c1e897e9051aa19d99139 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/libhunspell-1.3.3-linux64-201603240026.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 440a81e502be320c789337653ad1af7c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/libhunspell-1.3.3-windows-201601151018.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 202ec606e90c6a705bc075c334d76f86 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/libhunspell-1.3.3-windows64-201512100002.tar.bz2 + + name + windows64 + + + version + 1.3.3 + + libidn + + copyright + Copyright (C) 2002-2013 Simon Josefsson + description + Libidn's purpose is to encode and decode internationalized domain names. + license + LGPL + license_file + LICENSES/libidn.txt + name + libidn + platforms + + darwin + + archive + + hash + 4c1f76a59c9abd7590b60b1507c16540 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/libidn-1.32-darwin-201511222141.tar.bz2 + + name + darwin + + linux64 + + archive + + hash + e3d59bdb4418f50365fbae7a866b4e23 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/libidn-1.32-linux64-201603240734.tar.bz2 + + name + linux64 + + + version + 1.32 + + libndofdev + + copyright + Copyright (c) 2007, 3Dconnexion, Inc. - All rights reserved. + description + 3DConnexion SDK + license + BSD + license_file + LICENSES/libndofdev.txt + name + libndofdev + platforms + + darwin + + archive + + hash + 1d542606b146462cdfdc47a94f14eaf5 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/libndofdev-0.1-darwin-201504232110.tar.bz2 + + name + darwin + + windows + + archive + + hash + 1bed832715f068e3363ba90a0415092f + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/libndofdev-0.1-windows-201601151016.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 37da82fd6de8673a46c2c0860b54d6bf + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/libndofdev-0.1-windows64-201512122040.tar.bz2 + + name + windows64 + + + version + 0.1 + + libndofdev-open + + copyright + Copyright (c) 2008, Jan Ciger (jan.ciger (at) gmail.com) + description + 3DConnection SDK + license + BSD + license_file + LICENSES/libndofdev.txt + name + libndofdev-open + platforms + + linux64 + + archive + + hash + d3fd1dab78123c39391b0afb372e5cf1 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/libndofdev_open-0.8-linux64-201603241018.tar.bz2 + + name + linux64 + + + version + 0.8 + + libpng + + copyright + Copyright (c) 2004, 2006-2016 Glenn Randers-Pehrson + description + PNG Reference library + license + libpng + license_file + LICENSES/libpng.txt + name + libpng + platforms + + darwin + + archive + + hash + 7c315d3fee9f9bf7e36c4251c41fa378 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/libpng-1.6.19-darwin-201511222146.tar.bz2 + + name + darwin + + linux + + archive + + hash + 3368a25b361c22a03f7ec7e0f8d5ff9d + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-libpng-update/rev/290558/arch/Linux/installer/libpng-1.6.8-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + cd64cda7107b967279d5af03b0d46a8f + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/libpng-1.6.21-linux64-201603240933.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 5e7b3ea13fec60f6c9a8965a390cfbd5 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/libpng-1.6.21-windows-201603011800.tar.bz2 + + name + windows + + windows64 + + archive + + hash + b2f166e496fc19958777c92ffd032331 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/libpng-1.6.21-windows64-201603011809.tar.bz2 + + name + windows64 + + + version + 1.6.21 + + libxml2 + + copyright + Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. + description + Libxml2 is the XML C parser and toolkit developed for the Gnome project. + license + MIT + license_file + LICENSES/libxml2.txt + name + libxml2 + platforms + + darwin + + archive + + hash + 242ffec9e9f8fca818b750c578eba0dd + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/libxml2-2.9.3-darwin-201511222121.tar.bz2 + + name + darwin + + linux + + archive + + hash + 7eb90f075730f8d7d176f8fb7bad5ef5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-libxml-update/rev/290562/arch/Linux/installer/libxml2-2.9.1-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 61351b10787b06045a70c905a58ca2f6 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/libxml2-2.9.3-linux64-201603241216.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 6f1e3fcceab669df5c3d1c66821b2f24 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/libxml2-2.9.3-windows-201601151053.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 4453be9f68208147e4a7d508db677583 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/libxml2-2.9.3-windows64-201512122133.tar.bz2 + + name + windows64 + + + version + 2.9.3 + + llceflib + + copyright + Copyright (c) 2014-2015, Linden Research, Inc. + description + LLCefLib implements a headless web browser, rendering modern web content to a memory buffer and providing an API for injecting mouse and keyboard events. It uses the Chromium Embedded Framework (https://bitbucket.org/chromiumembedded/cef) + license + LGPL + license_file + LICENSES/llceflib.txt + name + llceflib + platforms + + darwin + + archive + + hash + 9551150830531abc405888066437e2c2 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/llceflib-3.2526.1364.gf6bf57b-darwin-201601160847.tar.bz2 + + name + darwin + + linux64 + + archive + + hash + 0e7613b2e038e18488452c2a9882144d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/llceflib-3.2526.1373.gb660893-linux64-201603281900.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 30bbc702d7533f8e2c56bdd0f5f22b59 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/llceflib-3.2526.1364.gf6bf57b-windows-201601160235.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 230e4ccb442bd538eabe2167f351a20d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/llceflib-3.2526.1364.gf6bf57b-windows64-201601160304.tar.bz2 + + name + windows64 + + + version + 3.2526.1373.gb660893 + + llphysicsextensions_stub + + copyright + Copyright (c) 2010, Linden Research, Inc. + license + internal + license_file + LICENSES/llphysicsextensions.txt + name + llphysicsextensions_stub + platforms + + darwin + + archive + + hash + 1175977a191ffc936fd0ccca433c8278 + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llphysicsextensions-stub_llphysicsextensions-update/rev/298370/arch/Darwin/installer/llphysicsextensions_stub-1.0.298370-darwin-298370.tar.bz2 + + name + darwin + + linux + + archive + + hash + d13d7927692eab2d6a63e36166b72a8a + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llphysicsextensions-stub_llphysicsextensions-update/rev/298370/arch/Linux/installer/llphysicsextensions_stub-1.0.298370-linux-298370.tar.bz2 + + name + linux + + linux64 + + archive + + hash + aa8a2f25e8629cf5e6a96cc0eb93de8e + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llphysicsextensions-stub/rev/263415/arch/Linux/installer/llphysicsextensions_stub-0.3-linux-20120814.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 9594f6fd79ee924fe675a4a23e30516e + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llphysicsextensions-stub_llphysicsextensions-update/rev/298370/arch/CYGWIN/installer/llphysicsextensions_stub-1.0.298370-windows-298370.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 50d7ea325063219a86d9439ce7458582 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib/llphysicsextensions_stub-1.0.298370-windows64-298370.tar.bz2 + + name + windows64 + + + version + 1.0.298370 + + mesa + + license + mesa + license_file + LICENSES/mesa.txt + name + mesa + platforms + + linux + + archive + + hash + 22c50a5d362cad311b4f413cfcffbba2 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/mesa_3p-update-mesa/rev/297294/arch/Linux/installer/mesa-7.11.1.297294-linux-297294.tar.bz2 + + name + linux + + + version + 7.11.1.297294 + + nvapi + + copyright + Copyright (c) 2007- 2014 NVIDIA Corporation. All rights reserved. + license + nvapi + license_file + LICENSES/nvapi.txt + name + nvapi + platforms + + windows + + archive + + hash + 347b0204795b11a982934fec640a4fd5 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/nvapi-R361-windows-201601151015.tar.bz2 + + name + windows + + windows64 + + archive + + hash + c26ef36ab5a91b9b39cf74b6fb087197 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/nvapi-R352-windows64-201512130127.tar.bz2 + + name + windows64 + + + version + R361 + + ogg_vorbis + + copyright + Copyright (c) 2002, Xiph.org Foundation + description + Audio encoding library + license + ogg-vorbis + license_file + LICENSES/ogg-vorbis.txt + name + ogg_vorbis + platforms + + darwin + + archive + + hash + 83959618755a09d1af245e402f4b6232 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/ogg_vorbis-1.3.2-1.3.5-darwin-201511222036.tar.bz2 + + name + darwin + + linux + + archive + + hash + 71eaa462eb0bf8842277a3436483a354 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-ogvorbis/rev/229529/arch/Linux/installer/ogg_vorbis-1.2.2-1.3.2-linux-20110511.tar.bz2 + + name + linux + + linux64 + + archive + + hash + d847ea384530e0bbb3774065dbdae65c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/ogg_vorbis-1.3.2-1.3.5-linux64-201603240037.tar.bz2 + + name + linux64 + + windows + + archive + + hash + e8c42c8ee03d570fa5e7fb88e7e1bc92 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/ogg_vorbis-1.3.2-1.3.5-windows-201601151012.tar.bz2 + + name + windows + + windows64 + + archive + + hash + c22591d8db9dc3353e4d3dc3d1a2b264 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/ogg_vorbis-1.3.2-1.3.5-windows64-201512122053.tar.bz2 + + name + windows64 + + + version + 1.3.2-1.3.5 + + openal + + copyright + Creative Labs + description + OpenAL is a cross-platform 3D audio API appropriate for use with gaming applications and many other types of audio applications. + license + lgpl + license_file + LICENSES/openal.txt + name + openal + platforms + + darwin + + archive + + hash + 4c0dd5385dbd8787d134e5e91f82f04a + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/openal-1.16.0-1.1.0-darwin-201412160747.tar.bz2 + + name + darwin + + linux + + archive + + hash + fccdca18a950ac9363c6fb39118b80e1 + hash_algorithm + md5 + url + http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/openal-3ad86a1c-linux-20110114.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 7fea13f8caab7bf9184e0790eab9c2f3 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/openal-1.17.2-1.1.0-linux64-201603232035.tar.bz2 + + name + linux64 + + windows + + archive + + hash + fa39ac8fe3714599293563fb7f964fca + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib/openal-1.16.0-1.1.0-windows-201504270536.tar.bz2 + + name + windows + + windows64 + + archive + + hash + fec29528320a2a67ffa7b3900135592d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib/openal-1.16.0-1.1.0-windows64-201504270534.tar.bz2 + + name + windows64 + + + version + 1.16.0-1.1.0 + + openssl + + copyright + Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved; Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + description + Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) Library + license + openssl + license_file + LICENSES/openssl.txt + name + openssl + platforms + + darwin + + archive + + hash + d415e218a7f3d0d1e3dd4f99d6129e6c + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/openssl-1.0.2g-darwin-201603010806.tar.bz2 + + name + darwin + + linux + + archive + + hash + 0665c18f8cdbe2f90cb0a2f088cfe1a6 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-openssl-update/rev/290662/arch/Linux/installer/openssl-1.0.1h-linux-20140605.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 2a50dcb704f6af595fff44defc4b65df + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/openssl-1.0.2g-linux64-201603240821.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 91b9fa570258f627a9265452d9e65231 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/openssl-1.0.2g-windows-201603011823.tar.bz2 + + name + windows + + windows64 + + archive + + hash + ec86d96ffcbdc10e715e27b4b0bbda43 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/openssl-1.0.2g-windows64-201603011842.tar.bz2 + + name + windows64 + + + version + 1.0.2g + + quicktime + + copyright + 2010 Apple + description + QuickTime 7.3 SDK for Windows + license + unknown + license_file + LICENSES/quicktime.txt + name + quicktime + platforms + + windows + + archive + + hash + 66600ab94087d295e48e326ec8961ac5 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib/quicktime-7.3-windows-201504280653.tar.bz2 + + name + windows + + + version + 7.3 + + slvoice + + copyright + 2010 Vivox, including audio coding using Polycom¨ Siren14TM (ITU-T Rec. G.722.1 Annex C) + description + Vivox SDK components + license + Mixed + license_file + LICENSES/slvoice.txt + name + slvoice + platforms + + darwin + + archive + + hash + 68a8fab5ad3a180487598d3a3e0d57b1 + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/slvoice_3p-update-slvoice/rev/298329/arch/Darwin/installer/slvoice-4.6.0017.21209.298329-darwin-298329.tar.bz2 + + name + darwin + + linux + + archive + + hash + 9f60e56aba35ec90b3045e9d049ac284 + url + http://depot.alchemyviewer.org/pub/linux/lib/slvoice-4.5.0009.17865-linux-20141214.tar.bz2 + + name + linux + + linux64 + + archive + + hash + df43d3df49296bfe93996ec537b9eddf + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/slvoice-4.6.0009.20030-linux64-201501031918.tar.bz2 + + name + linux64 + + windows + + archive + + hash + 399afab7047e6fa62e7b2fb1768059ea + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/slvoice_3p-update-slvoice/rev/298329/arch/CYGWIN/installer/slvoice-4.6.0017.21209.298329-windows-298329.tar.bz2 + + name + windows + + windows64 + + archive + + hash + dabbc146137c13ec2ea026aa69e1f045 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib/slvoice-4.6.0017.21209.298329-windows64-298329.tar.bz2 + + name + windows64 + + + version + 4.6.0017.21209.298329 + + tut + + copyright + Copyright 2002-2006 Vladimir Dyuzhev, Copyright 2007 Denis Kononenko, Copyright 2008-2009 Michał Rzechonek + description + TUT is a small and portable unit test framework for C++. + license + bsd + license_file + LICENSES/tut.txt + name + tut + platforms + + common + + archive + + hash + 56601f1217ccd206829e8834e5a1253b + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/common/lib/tut-2008.11.30-common-201504282317.tar.bz2 + + name + common + + + version + 2008.11.30 + + uriparser + + copyright + Copyright (C) 2007, Weijia Song <songweijia@gmail.com>, Sebastian Pipping <webmaster@hartwork.org> + description + uriparser is a strictly RFC 3986 compliant URI parsing and handling library written in C. uriparser is cross-platform, fast, supports Unicode and is licensed under the New BSD license. + license + New BSD license + license_file + LICENSES/uriparser.txt + name + uriparser + platforms + + darwin + + archive + + hash + 364cbc9a049acb2a0d2cd6719a02adf0 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/uriparser-0.8.4-darwin-201511221948.tar.bz2 + + name + darwin + + linux + + archive + + hash + 34306fb90364b182dc770375140d8557 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-uriparser/rev/294298/arch/Linux/installer/uriparser-0.8.0.1-linux-20140918.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 69224d9285e5a26fc7a9aca5d3da7543 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/uriparser-0.8.4-linux64-201603240044.tar.bz2 + + name + linux64 + + windows + + archive + + hash + f9f82fbd29751a969e9ab55a1f33ac7b + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/uriparser-0.8.4-windows-201601151009.tar.bz2 + + name + windows + + windows64 + + archive + + hash + dae3118551880f593f8ee907c122f097 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/uriparser-0.8.4-windows64-201512081840.tar.bz2 + + name + windows64 + + + version + 0.8.4 + + vcredist + + copyright + Copyright (c) Microsoft Corporation. All rights reserved. + description + The Visual Studio C and C++ runtime redistributable + license + Proprietary + license_file + LICENSES/vcredist.txt + name + vcredist + platforms + + windows + + archive + + hash + 960953da9ab7c335a0f4f97e9bf8341c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/vcredist-14.0.23506.0-windows-201601191536.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 918588215463f36836eeefd9d3891868 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/vcredist-14.0.23506.0-windows64-201601191536.tar.bz2 + + name + windows64 + + + version + 14.0.23506.0 + + xmlrpc-epi + + copyright + Copyright: (C) 2000 Epinions, Inc. + description + XMLRPC Library + license + xmlrpc-epi + license_file + LICENSES/xmlrpc-epi.txt + name + xmlrpc-epi + platforms + + darwin + + archive + + hash + 408e34531c6a8ac20ccc8c917435071f + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/xmlrpc_epi-0.54.2-darwin-201603271451.tar.bz2 + + name + darwin + + linux + + archive + + hash + 174ab797440157956eda7061dae37564 + url + http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/xmlrpc_epi-0.54.1-linux-20110314.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 0465334ff0f1d57cf354867fd21ee137 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/xmlrpc_epi-0.54.2-linux64-201603240753.tar.bz2 + + name + linux64 + + windows + + archive + + hash + b41376a689fb4c9e9846d838283fdc5d + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/xmlrpc_epi-0.54.2-windows-201601151034.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 1afa5a6bdbc5689e14120628dc0fc124 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/xmlrpc_epi-0.54.2-windows64-201603261459.tar.bz2 + + name + windows64 + + + version + 0.54.2 + + zlib + + copyright + Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + description + Zlib Data Compression Library + license + zlib + license_file + LICENSES/zlib.txt + name + zlib + platforms + + darwin + + archive + + hash + 635ee875ba478b17b6c64d9698cdf0dd + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/zlib-1.2.8-darwin-201511221937.tar.bz2 + + name + darwin + + linux + + archive + + hash + 63a62bb3cbef2aad3cca49cb6f2d0aeb + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3pl_3p-zlib-update/rev/290556/arch/Linux/installer/zlib-1.2.8-linux-20140602.tar.bz2 + + name + linux + + linux64 + + archive + + hash + 1eaee9888043648d5f09716b771dcb4b + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib-trusty/zlib-1.2.8-linux64-201603240746.tar.bz2 + + name + linux64 + + windows + + archive + + hash + a26a7a9d550dc6988528e2e70bb5e85b + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/zlib-1.2.8-windows-201601150945.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 5b3a58a6a939e83f94137171b7f814de + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/zlib-1.2.8-windows64-201512071625.tar.bz2 + + name + windows64 + + + version + 1.2.8 + + + package_description + + copyright + Copyright (c) 2010-2016, Singularity Viewer Team + description + Singularity Viewer + license + LGPL + license_file + docs/LICENSE-source.txt + name + Singularity Viewer + platforms + + common + + configurations + + RelWithDebInfo + + configure + + arguments + + ../indra + + command + cmake + options + + -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo + -DWORD_SIZE:STRING=32 + -DROOT_PROJECT_NAME:STRING=Singularity + -DINSTALL_PROPRIETARY=FALSE + + + name + RelWithDebInfo + + Release + + configure + + arguments + + ../indra + + command + cmake + options + + -DCMAKE_BUILD_TYPE:STRING=Release + -DWORD_SIZE:STRING=32 + -DROOT_PROJECT_NAME:STRING=Singularity + -DINSTALL_PROPRIETARY=FALSE + + + name + Release + + + name + common + + darwin + + build_directory + build-darwin-i386 + configurations + + RelWithDebInfo + + build + + command + xcodebuild + options + + -configuration RelWithDebInfo + -project Singularity.xcodeproj + + + configure + + options + + -G + 'Xcode' + + + default + True + name + RelWithDebInfo + + Release + + build + + command + xcodebuild + options + + -configuration Release + -project Singularity.xcodeproj + -DENABLE_SIGNING:BOOL=YES + -DSIGNING_IDENTITY:STRING="Developer ID Application: Linden Research, Inc." + + + configure + + options + + -G + 'Xcode' + + + name + Release + + + name + darwin + + linux + + build_directory + build-linux-i686 + configurations + + RelWithDebInfo + + build + + command + make + options + + -j 7 + + + configure + + options + + -G + 'Unix Makefiles' + + + default + True + name + RelWithDebInfo + + Release + + build + + command + make + options + + -j 7 + + + configure + + options + + -G + 'Unix Makefiles' + + + name + Release + + + name + linux + + linux64 + + build_directory + build-linux-x86_64 + configurations + + RelWithDebInfo + + build + + command + make + options + + -j 7 + + + configure + + options + + -G + 'Unix Makefiles' + -DWORD_SIZE:STRING=64 + + + default + True + name + RelWithDebInfo + + Release + + build + + command + make + options + + -j 7 + + + configure + + options + + -G + 'Unix Makefiles' + -DWORD_SIZE:STRING=64 + + + name + Release + + + name + linux64 + + windows + + build_directory + build-vc140 + configurations + + RelWithDebInfo + + build + + arguments + + Singularity.sln + + command + msbuild.exe + options + + /p:Configuration=RelWithDebInfo + /p:Platform=Win32 + /t:Build + /p:useenv=true + /verbosity:normal + /m + + + configure + + arguments + + ..\indra + && + ..\indra\tools\vstool\VSTool.exe + --solution + Singularity.sln + --config + RelWithDebInfo + --startup + singularity-bin + + options + + -G + "Visual Studio 14" + -DCMAKE_SYSTEM_VERSION="10.0.10586.0" + -DINSTALL_PROPRIETARY=FALSE + + + default + True + name + RelWithDebInfo + + Release + + build + + arguments + + Singularity.sln + + command + msbuild.exe + options + + /p:Configuration=Release + /p:Platform=Win32 + /t:Build + /p:useenv=true + /verbosity:normal + /m + + + configure + + arguments + + ..\indra + && + ..\indra\tools\vstool\VSTool.exe + --solution + Singularity.sln + --config + Release + --startup + singularity-bin + + options + + -G + "Visual Studio 14" + -DCMAKE_SYSTEM_VERSION="10.0.10586.0" + -DINSTALL_PROPRIETARY=FALSE + + + name + Release + + + name + windows + + windows64 + + build_directory + build-vc140-x86_64 + configurations + + RelWithDebInfo + + build + + arguments + + Singularity.sln + + command + msbuild.exe + options + + /p:Configuration=RelWithDebInfo + /p:Platform=x64 + /t:Build + /p:useenv=true + /verbosity:normal + /m + + + configure + + arguments + + ..\indra + && + ..\indra\tools\vstool\VSTool.exe + --solution + Singularity.sln + --config + RelWithDebInfo + --startup + singularity-bin + + options + + -G + "Visual Studio 14 Win64" + -DCMAKE_SYSTEM_VERSION="10.0.10586.0" + -DWORD_SIZE:STRING=64 + -DINSTALL_PROPRIETARY=FALSE + + + default + True + name + RelWithDebInfo + + Release + + build + + arguments + + Singularity.sln + + command + msbuild.exe + options + + /p:Configuration=Release + /p:Platform=x64 + /t:Build + /p:useenv=true + /verbosity:normal + /m + + + configure + + arguments + + ..\indra + && + ..\indra\tools\vstool\VSTool.exe + --solution + Singularity.sln + --config + Release + --startup + singularity-bin + + options + + -G + "Visual Studio 14 Win64" + -DCMAKE_SYSTEM_VERSION="10.0.10586.0" + -DWORD_SIZE:STRING=64 + -DINSTALL_PROPRIETARY=FALSE + + + name + Release + + + name + windows64 + + + version_file + newview/viewer_version.txt + + type + autobuild + version + 1.3 + + diff --git a/doc/asset_urls.txt b/doc/asset_urls.txt deleted file mode 100644 index e42a45c89..000000000 --- a/doc/asset_urls.txt +++ /dev/null @@ -1,5 +0,0 @@ -SLASSET_LIBS_WIN32=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-win32-libs-oss-viewer-1.23.4.0.zip -SLASSET_MD5=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/md5sums-oss-viewer-1.23.4.0.txt -SLASSET_LIBS_DARWIN=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-darwin-libs-oss-viewer-1.23.4.0.tar.gz -SLASSET_ART=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-artwork-oss-viewer-1.23.4.0.zip -SLASSET_LIBS_LINUXI386=http://automated-builds-secondlife-com.s3.amazonaws.com/oss-viewer/export/slviewer-linux-libs-oss-viewer-1.23.4.0.tar.gz diff --git a/doc/releasenotes-where.txt b/doc/releasenotes-where.txt deleted file mode 100644 index 4af586690..000000000 --- a/doc/releasenotes-where.txt +++ /dev/null @@ -1,5 +0,0 @@ -For full release notes, see: - http://wiki.secondlife.com/wiki/Release_Notes - -For a log of viewer changes, see: - doc/viewer-changes.txt diff --git a/doc/viewer-changes.txt b/doc/viewer-changes.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index 8694c0dcc..59735a520 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -3,19 +3,12 @@ # cmake_minimum_required should appear before any # other commands to guarantee full compatibility # with the version specified - -cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) - -# Eventually the third-party support modules (cmake/*.cmake) should -# know the full path to all libraries. Until that happens we need -# per-configuration link directory "libraries//lib/debug" for -# Debug and "libraries//lib/release" for Release, -# RelWithDebInfo, and MinSizeRel. CMake 2.6 does not directly support -# per-configuration link directory specification. However, we can set -# CMP0003 to OLD and link to one library (apr) on a per-configuration -# basis to convince CMake to add the proper link directory. This line -# can be removed when we use full paths for all libraries. -#cmake_policy(SET CMP0003 OLD) +## prior to 2.8, the add_custom_target commands used in setting the version did not work correctly +if(WIN32) + cmake_minimum_required(VERSION 3.4 FATAL_ERROR) +else() + cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) +endif() set(ROOT_PROJECT_NAME "Singularity" CACHE STRING "The root project/makefile/solution name. Defaults to Singularity.") @@ -24,26 +17,12 @@ project(${ROOT_PROJECT_NAME}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(Variables) - -# Load versions now. Install locations need them. include(BuildVersion) -include(UnixInstall) -if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release CACHE STRING +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type. One of: Debug Release RelWithDebInfo" FORCE) -endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - -# Create a 'prepare' target in which to perform setup actions. This -# must be the first target created so other targets can depend on it. -if(NOT STANDALONE) - # We prepare prebuilt binaries when not building standalone. - set(prepare_depends ${CMAKE_BINARY_DIR}/prepare/prebuilt) -endif(NOT STANDALONE) -if(WINDOWS) - set(prepare_depends ${prepare_depends} copy_win_libs) -endif(WINDOWS) -add_custom_target(prepare DEPENDS ${prepare_depends}) +endif (NOT CMAKE_BUILD_TYPE) add_subdirectory(cmake) add_subdirectory(${LIBS_OPEN_PREFIX}aistatemachine) @@ -66,12 +45,6 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llvfs) add_subdirectory(${LIBS_OPEN_PREFIX}llwindow) add_subdirectory(${LIBS_OPEN_PREFIX}llxml) -if(STANDALONE) - add_subdirectory(${LIBS_OPEN_PREFIX}llqtwebkit) -endif(STANDALONE) - -#add_subdirectory(${LIBS_OPEN_PREFIX}lscript) - if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) add_subdirectory(${LIBS_CLOSED_PREFIX}copy_win_scripts) endif (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) @@ -83,42 +56,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llui) # viewer plugins directory add_subdirectory(${LIBS_OPEN_PREFIX}plugins) -# llplugin testbed code (is this the right way to include it?) -#if (NOT LINUX) -# add_subdirectory(${VIEWER_PREFIX}test_apps/llplugintest) -#endif (NOT LINUX) - add_subdirectory(${VIEWER_PREFIX}newview/statemachine) add_subdirectory(${VIEWER_PREFIX}newview) -add_dependencies(viewer secondlife-bin) +add_dependencies(viewer singularity-bin) -# The use_prebuilt_binary macro in cmake/Prebuilt.cmake records -# packages in the PREBUILT property of the 'prepare' target. -get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT) - -# Create a script to download the needed binaries. -configure_file(${CMAKE_SOURCE_DIR}/cmake/DownloadPrebuilt.cmake.in - ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake @ONLY) - -# Drive the download script at build time. Depend on 'install.xml' -# to aqcuire new binaries when needed. -add_custom_command( - COMMENT "Obtaining prebuilt binaries..." - OUTPUT ${CMAKE_BINARY_DIR}/prepare/prebuilt - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake - DEPENDS ${CMAKE_SOURCE_DIR}/../install.xml - ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake - ) - - -if(WINDOWS) - configure_file(${CMAKE_SOURCE_DIR}/cmake/CopyWinLibs.cmake.in - ${CMAKE_BINARY_DIR}/CopyWinLibs.cmake @ONLY) - add_custom_command( - COMMENT "Copying prebuilt libraries to viewer executable directory" - OUTPUT ${CMAKE_BINARY_DIR}/CopyWinLibs - COMMAND ${CMAKE_COMMAND} -DCUR_CONFIG:STRING=${CMAKE_CFG_INTDIR} -P ${CMAKE_BINARY_DIR}/CopyWinLibs.cmake - DEPENDS ${CMAKE_BINARY_DIR}/prepare/prebuilt ${CMAKE_BINARY_DIR}/CopyWinLibs.cmake - ) - add_custom_target(copy_win_libs DEPENDS ${CMAKE_BINARY_DIR}/CopyWinLibs) -endif(WINDOWS) \ No newline at end of file diff --git a/indra/aistatemachine/CMakeLists.txt b/indra/aistatemachine/CMakeLists.txt index 806261201..791ff9d25 100644 --- a/indra/aistatemachine/CMakeLists.txt +++ b/indra/aistatemachine/CMakeLists.txt @@ -39,5 +39,3 @@ set_source_files_properties(${aistatemachine_HEADER_FILES} list(APPEND aistatemachine_SOURCE_FILES ${aistatemachine_HEADER_FILES}) add_library (aistatemachine ${aistatemachine_SOURCE_FILES}) -add_dependencies(aistatemachine prepare) - diff --git a/indra/aistatemachine/aistatemachinethread.h b/indra/aistatemachine/aistatemachinethread.h index 193c2e0d4..bf70be6c7 100644 --- a/indra/aistatemachine/aistatemachinethread.h +++ b/indra/aistatemachine/aistatemachinethread.h @@ -34,6 +34,7 @@ #include "aistatemachine.h" #include "llthread.h" #include "aithreadsafe.h" +#include #ifdef EXAMPLE_CODE // undefined @@ -235,7 +236,7 @@ class AIStateMachineThread : public AIStateMachineThreadBase { /*virtual*/ const char* getName() const { #define STRIZE(arg) #arg - return "AIStateMachineThread<"STRIZE(THREAD_IMPL)">"; + return (boost::format("%1%%2%%3%") % "AIStateMachineThread<" % STRIZE(THREAD_IMPL) % ">").str().c_str(); #undef STRIZE } diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 139a10b3c..4e1e6cb49 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -40,22 +40,6 @@ set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING # Platform-specific compilation flags. if (WINDOWS) - # Various libs are compiler specific, generate some variables here we can just use - # when we require them instead of reimplementing the test each time. - if (MSVC10) - set(MSVC_DIR 10.0) - set(MSVC_SUFFIX 100) - elseif (MSVC12) - set(MSVC_DIR 12.0) - set(MSVC_SUFFIX 120) - endif (MSVC10) - - # Remove default /Zm1000 flag that cmake inserts - string (REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - - # Always use /Zm140 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm140") - # Don't build DLLs. set(BUILD_SHARED_LIBS OFF) @@ -65,61 +49,78 @@ if (WINDOWS) "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP" CACHE STRING "C++ compiler release-with-debug options" FORCE) set(CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP /fp:fast -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0" + "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /Zo /MD /MP /Ob2 /Zc:inline /fp:fast -D_ITERATOR_DEBUG_LEVEL=0" CACHE STRING "C++ compiler release options" FORCE) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${LL_C_FLAGS} /O2 /Zi /MD /MP /fp:fast" CACHE STRING "C compiler release options" FORCE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") + + if (WORD_SIZE EQUAL 32) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") + endif (WORD_SIZE EQUAL 32) + + if (USE_LTO) + if(INCREMENTAL_LINK) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG:INCREMENTAL") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG:INCREMENTAL") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG:INCREMENTAL") + else(INCREMENTAL_LINK) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG") + endif(INCREMENTAL_LINK) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG") + elseif (INCREMENTAL_LINK) + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL /VERBOSE:INCR") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL /VERBOSE:INCR") + else () + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /INCREMENTAL:NO") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /INCREMENTAL:NO") + endif () set(CMAKE_CXX_STANDARD_LIBRARIES "") set(CMAKE_C_STANDARD_LIBRARIES "") add_definitions( /DLL_WINDOWS=1 + /DNOMINMAX /DUNICODE - /D_UNICODE + /D_UNICODE /GS /TP /W3 /c /Zc:forScope - /Zc:wchar_t- + /Zc:rvalueCast + /Zc:wchar_t /nologo /Oy- + /Zm140 + /wd4267 + /wd4244 ) - - # SSE2 is implied on win64 - if(WORD_SIZE EQUAL 32) - add_definitions(/arch:SSE2 /D_ATL_XP_TARGETING) - else(WORD_SIZE EQUAL 32) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4267 /wd4250 /wd4244") - endif(WORD_SIZE EQUAL 32) + + if (USE_LTO) + add_compile_options( + /GL + /Gy + /Gw + ) + endif (USE_LTO) if (WORD_SIZE EQUAL 32) - # configure win32 API for windows XP+ compatibility - set(WINVER "0x0501" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)") - add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}") - else (WORD_SIZE EQUAL 32) - # configure win32 API for windows vista+ compatibility - set(WINVER "0x0600" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)") - add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}") + add_compile_options(/arch:SSE2) endif (WORD_SIZE EQUAL 32) - # Use special XP-compatible toolchain on 32-bit builds - if (MSVC12 AND (WORD_SIZE EQUAL 32)) - set(CMAKE_GENERATOR_TOOLSET "v120xp") - endif (MSVC12 AND (WORD_SIZE EQUAL 32)) - - # Are we using the crummy Visual Studio KDU build workaround? if (NOT DISABLE_FATAL_WARNINGS) add_definitions(/WX) endif (NOT DISABLE_FATAL_WARNINGS) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO") - SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO") - + # configure win32 API for windows Vista+ compatibility + set(WINVER "0x0600" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)") + add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}") endif (WINDOWS) set (GCC_EXTRA_OPTIMIZATIONS "-ffast-math") @@ -140,7 +141,10 @@ if (LINUX) -pthread ) - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2") # Don't catch SIGCHLD in our base application class for the viewer # some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! @@ -195,16 +199,14 @@ if (LINUX) # End of hacks. - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") - if (NOT STANDALONE) # this stops us requiring a really recent glibc at runtime add_definitions(-fno-stack-protector) endif (NOT STANDALONE) if (${ARCH} STREQUAL "x86_64") - add_definitions(-DLINUX64=1 -pipe) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops") + add_definitions(-pipe) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math") else (${ARCH} STREQUAL "x86_64") @@ -219,11 +221,6 @@ if (LINUX) set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -mfpmath=sse,387 -msse2 ${GCC_EXTRA_OPTIMIZATIONS}") endif (${ARCH} STREQUAL "x86_64") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - if (NOT STANDALONE) - # this stops us requiring a really recent glibc at runtime - add_definitions(-fno-stack-protector) - endif (NOT STANDALONE) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}${MARCH_FLAG} -fno-inline -msse2") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}${MARCH_FLAG} -fno-inline -msse2") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}${MARCH_FLAG} -msse2") @@ -231,12 +228,6 @@ if (LINUX) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - - if (NOT STANDALONE) - # this stops us requiring a really recent glibc at runtime - add_definitions(-fno-stack-protector) - endif (NOT STANDALONE) - if (NOT STANDALONE) set(MARCH_FLAG " -axsse4.1 -msse2") endif (NOT STANDALONE) @@ -316,13 +307,14 @@ if (STANDALONE) add_definitions(-DLL_STANDALONE=1) else (STANDALONE) set(${ARCH}_linux_INCLUDES - ELFIO atk-1.0 + cairo glib-2.0 + gdk-pixbuf-2.0 gstreamer-0.10 gtk-2.0 - freetype2 pango-1.0 + pixman-1 ) endif (STANDALONE) diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake index c47363aa1..447470a15 100644 --- a/indra/cmake/APR.cmake +++ b/indra/cmake/APR.cmake @@ -1,4 +1,3 @@ -include(BerkeleyDB) include(Linking) include(Prebuilt) @@ -13,39 +12,41 @@ if (STANDALONE) else (STANDALONE) use_prebuilt_binary(apr_suite) if (WINDOWS) + if (LLCOMMON_LINK_SHARED) + set(APR_selector "lib") + else (LLCOMMON_LINK_SHARED) + set(APR_selector "") + endif (LLCOMMON_LINK_SHARED) set(APR_LIBRARIES - debug libapr-1.lib - optimized libapr-1.lib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apr-1.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apr-1.lib ) set(APRICONV_LIBRARIES - debug libapriconv-1.lib - optimized libapriconv-1.lib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}apriconv-1.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}apriconv-1.lib ) set(APRUTIL_LIBRARIES - debug libaprutil-1.lib - optimized libaprutil-1.lib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES} + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/${APR_selector}aprutil-1.lib ${APRICONV_LIBRARIES} ) + if(NOT LLCOMMON_LINK_SHARED) + list(APPEND APR_LIBRARIES Rpcrt4) + endif(NOT LLCOMMON_LINK_SHARED) elseif (DARWIN) - set(APR_LIBRARIES - debug libapr-1.0.dylib - optimized libapr-1.0.dylib - ) - set(APRUTIL_LIBRARIES - debug libaprutil-1.dylib - optimized libaprutil-1.dylib - ) + if (LLCOMMON_LINK_SHARED) + set(APR_selector "0.dylib") + set(APRUTIL_selector "0.dylib") + else (LLCOMMON_LINK_SHARED) + set(APR_selector "a") + set(APRUTIL_selector "a") + endif (LLCOMMON_LINK_SHARED) + set(APR_LIBRARIES libapr-1.${APR_selector}) + set(APRUTIL_LIBRARIES libaprutil-1.${APRUTIL_selector}) set(APRICONV_LIBRARIES iconv) else (WINDOWS) set(APR_LIBRARIES apr-1) set(APRUTIL_LIBRARIES aprutil-1) set(APRICONV_LIBRARIES iconv) endif (WINDOWS) - set(APR_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include/apr-1 - ${LIBS_PREBUILT_LEGACY_DIR}/include/apr-1 - ) - - if (LINUX) - list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES}) - endif (LINUX) + set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/apr-1) endif (STANDALONE) diff --git a/indra/cmake/Audio.cmake b/indra/cmake/Audio.cmake index 27633ff72..131d20b18 100644 --- a/indra/cmake/Audio.cmake +++ b/indra/cmake/Audio.cmake @@ -8,11 +8,8 @@ if (STANDALONE) pkg_check_modules(VORBISENC REQUIRED vorbisenc) pkg_check_modules(VORBISFILE REQUIRED vorbisfile) else (STANDALONE) - use_prebuilt_binary(ogg-vorbis) - set(VORBIS_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + use_prebuilt_binary(ogg_vorbis) + set(VORBIS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) set(VORBISENC_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) set(VORBISFILE_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS}) diff --git a/indra/cmake/BerkeleyDB.cmake b/indra/cmake/BerkeleyDB.cmake deleted file mode 100644 index 5b885c6a7..000000000 --- a/indra/cmake/BerkeleyDB.cmake +++ /dev/null @@ -1,20 +0,0 @@ -include(Prebuilt) - -set(DB_FIND_QUIETLY ON) -set(DB_FIND_REQUIRED ON) - -if (STANDALONE) - include(FindBerkeleyDB) -else (STANDALONE) - if (LINUX) - # Need to add dependency pthread explicitely to support ld.gold. - use_prebuilt_binary(db) - set(DB_LIBRARIES db-5.1 pthread) - else (LINUX) - set(DB_LIBRARIES db-4.2) - endif (LINUX) - set(DB_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) -endif (STANDALONE) diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake index 0421b1c9e..844d5dc49 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -11,11 +11,8 @@ if (STANDALONE) find_package(Boost 1.51.0 COMPONENTS date_time filesystem program_options regex system thread wave context) else (STANDALONE) use_prebuilt_binary(boost) - set(Boost_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) - set(Boost_VERSION "1.52") + set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + set(Boost_VERSION "1.60") if (WINDOWS) set(Boost_CONTEXT_LIBRARY diff --git a/indra/cmake/BuildPackagesInfo.cmake b/indra/cmake/BuildPackagesInfo.cmake new file mode 100644 index 000000000..a764e9b42 --- /dev/null +++ b/indra/cmake/BuildPackagesInfo.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- +# Construct the version and copyright information based on package data. +include(Python) +include(Variables) + +add_custom_command(OUTPUT packages-info.txt + COMMENT "Generating packages-info.txt for the about box" + MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/../autobuild.xml + DEPENDS ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py -p=${AUTOBUILD_PLATFORM_NAME} > packages-info.txt + ) diff --git a/indra/cmake/BuildVersion.cmake b/indra/cmake/BuildVersion.cmake index 457a1bb16..81a228706 100644 --- a/indra/cmake/BuildVersion.cmake +++ b/indra/cmake/BuildVersion.cmake @@ -1,81 +1,54 @@ # -*- cmake -*- +# Construct the viewer version number based on the indra/VIEWER_VERSION file -# Read version components from the header file. -file(STRINGS ${LIBS_OPEN_DIR}/llcommon/llversionviewer.h.in lines - REGEX " LL_VERSION_") -foreach(line ${lines}) - string(REGEX REPLACE ".*LL_VERSION_([A-Z]+).*" "\\1" comp "${line}") - string(REGEX REPLACE ".* = ([0-9]+);.*" "\\1" value "${line}") - set(v${comp} "${value}") -endforeach(line) +if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/newview/ + set(VIEWER_VERSION_BASE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/newview/VIEWER_VERSION.txt") -execute_process( - COMMAND git rev-list HEAD - OUTPUT_VARIABLE GIT_REV_LIST_STR - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_STRIP_TRAILING_WHITESPACE -) + if ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) + file(STRINGS ${VIEWER_VERSION_BASE_FILE} VIEWER_SHORT_VERSION REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+") + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VIEWER_VERSION_MAJOR ${VIEWER_SHORT_VERSION}) + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" VIEWER_VERSION_MINOR ${VIEWER_SHORT_VERSION}) + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" VIEWER_VERSION_PATCH ${VIEWER_SHORT_VERSION}) -if(GIT_REV_LIST_STR) - string(REPLACE "\n" ";" GIT_REV_LIST ${GIT_REV_LIST_STR}) -else() - string(REPLACE "\n" ";" GIT_REV_LIST "") -endif() + if (DEFINED ENV{revision}) + set(VIEWER_VERSION_REVISION $ENV{revision}) + message("Revision (from environment): ${VIEWER_VERSION_REVISION}") -if(GIT_REV_LIST) - list(LENGTH GIT_REV_LIST vBUILD) -else() - set(vBUILD 99) -endif() + else (DEFINED ENV{revision}) + execute_process( + COMMAND git rev-list HEAD + OUTPUT_VARIABLE GIT_REV_LIST_STR + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE + ) -configure_file( - ${CMAKE_SOURCE_DIR}/llcommon/llversionviewer.h.in - ${CMAKE_SOURCE_DIR}/llcommon/llversionviewer.h -) + if(GIT_REV_LIST_STR) + string(REPLACE "\n" ";" GIT_REV_LIST ${GIT_REV_LIST_STR}) + else() + string(REPLACE "\n" ";" GIT_REV_LIST "") + endif() -if (WINDOWS) - configure_file( - ${CMAKE_SOURCE_DIR}/newview/res/viewerRes.rc.in - ${CMAKE_SOURCE_DIR}/newview/res/viewerRes.rc - ) -endif (WINDOWS) + if(GIT_REV_LIST) + list(LENGTH GIT_REV_LIST VIEWER_VERSION_REVISION) + else(GIT_REV_LIST) + set(VIEWER_VERSION_REVISION 99) + endif(GIT_REV_LIST) + endif (DEFINED ENV{revision}) + message("Building '${VIEWER_CHANNEL}' Version ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}") + else ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) + message(SEND_ERROR "Cannot get viewer version from '${VIEWER_VERSION_BASE_FILE}'") + endif ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) -if (DARWIN) - configure_file( - ${CMAKE_SOURCE_DIR}/newview/English.lproj/InfoPlist.strings.in - ${CMAKE_SOURCE_DIR}/newview/English.lproj/InfoPlist.strings - ) -endif (DARWIN) - -if (LINUX) - configure_file( - ${CMAKE_SOURCE_DIR}/newview/linux_tools/wrapper.sh.in - ${CMAKE_SOURCE_DIR}/newview/linux_tools/wrapper.sh - @ONLY - ) - configure_file( - ${CMAKE_SOURCE_DIR}/newview/linux_tools/handle_secondlifeprotocol.sh.in - ${CMAKE_SOURCE_DIR}/newview/linux_tools/handle_secondlifeprotocol.sh - @ONLY - ) - configure_file( - ${CMAKE_SOURCE_DIR}/newview/linux_tools/install.sh.in - ${CMAKE_SOURCE_DIR}/newview/linux_tools/install.sh - @ONLY - ) - configure_file( - ${CMAKE_SOURCE_DIR}/newview/linux_tools/refresh_desktop_app_entry.sh.in - ${CMAKE_SOURCE_DIR}/newview/linux_tools/refresh_desktop_app_entry.sh - @ONLY - ) -endif (LINUX) - - -# Compose the version. -set(${ROOT_PROJECT_NAME}_VERSION "${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}") -if (${ROOT_PROJECT_NAME}_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$") - message(STATUS "Version is ${${ROOT_PROJECT_NAME}_VERSION}") -else (${ROOT_PROJECT_NAME}_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$") - message(FATAL_ERROR "Could not determine version (${${ROOT_PROJECT_NAME}_VERSION})") -endif (${ROOT_PROJECT_NAME}_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$") + if ("${VIEWER_VERSION_REVISION}" STREQUAL "") + message("Ultimate fallback, revision was blank or not set: will use 0") + set(VIEWER_VERSION_REVISION 0) + endif ("${VIEWER_VERSION_REVISION}" STREQUAL "") + set(VIEWER_CHANNEL_VERSION_DEFINES + "LL_VIEWER_CHANNEL=\"${VIEWER_CHANNEL}\"" + "LL_VIEWER_VERSION_MAJOR=${VIEWER_VERSION_MAJOR}" + "LL_VIEWER_VERSION_MINOR=${VIEWER_VERSION_MINOR}" + "LL_VIEWER_VERSION_PATCH=${VIEWER_VERSION_PATCH}" + "LL_VIEWER_VERSION_BUILD=${VIEWER_VERSION_REVISION}" + ) +endif (NOT DEFINED VIEWER_SHORT_VERSION) diff --git a/indra/cmake/CARes.cmake b/indra/cmake/CARes.cmake index 062b283c1..02fad1f55 100644 --- a/indra/cmake/CARes.cmake +++ b/indra/cmake/CARes.cmake @@ -20,8 +20,5 @@ else (STANDALONE) else (WINDOWS) set(CARES_LIBRARIES cares) endif (WINDOWS) - set(CARES_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/ares - ${LIBS_PREBUILT_LEGACY_DIR}/include/ares - ) + set(CARES_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/ares) endif (STANDALONE) diff --git a/indra/cmake/CEFPlugin.cmake b/indra/cmake/CEFPlugin.cmake new file mode 100644 index 000000000..1b4c20ed3 --- /dev/null +++ b/indra/cmake/CEFPlugin.cmake @@ -0,0 +1,45 @@ +# -*- cmake -*- +include(Linking) +include(Prebuilt) + +if (USESYSTEMLIBS) + set(CEFPLUGIN OFF CACHE BOOL + "CEFPLUGIN support for the llplugin/llmedia test apps.") +else (USESYSTEMLIBS) + use_prebuilt_binary(llceflib) + set(CEFPLUGIN ON CACHE BOOL + "CEFPLUGIN support for the llplugin/llmedia test apps.") + set(CEF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/cef) +endif (USESYSTEMLIBS) + +if (WINDOWS) + set(CEF_PLUGIN_LIBRARIES + libcef.lib + libcef_dll_wrapper.lib + llceflib.lib + ) +elseif (DARWIN) + FIND_LIBRARY(APPKIT_LIBRARY AppKit) + if (NOT APPKIT_LIBRARY) + message(FATAL_ERROR "AppKit not found") + endif() + + FIND_LIBRARY(CEF_LIBRARY "Chromium Embedded Framework" ${ARCH_PREBUILT_DIRS_RELEASE}) + if (NOT CEF_LIBRARY) + message(FATAL_ERROR "CEF not found") + endif() + + set(CEF_PLUGIN_LIBRARIES + ${ARCH_PREBUILT_DIRS_RELEASE}/libcef_dll_wrapper.a + ${ARCH_PREBUILT_DIRS_RELEASE}/libLLCefLib.a + ${APPKIT_LIBRARY} + ${CEF_LIBRARY} + ) + +elseif (LINUX) + set(CEF_PLUGIN_LIBRARIES + llceflib + cef_dll_wrapper + cef + ) +endif (WINDOWS) diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index c6d716fed..18a58fcba 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -12,36 +12,30 @@ set(cmake_SOURCE_FILES APR.cmake Audio.cmake BasicPluginBase.cmake - BerkeleyDB.cmake Boost.cmake BuildVersion.cmake CARes.cmake + CEFPlugin.cmake CMakeCopyIfDifferent.cmake CURL.cmake Colladadom.cmake ConfigurePkgConfig.cmake - CopyBackToSource.cmake - CopyWinLibs.cmake + Copy3rdPartyLibs.cmake Cwdebug.cmake DBusGlib.cmake - DirectX.cmake - DownloadPrebuilt.cmake.in - ELFIO.cmake + DeploySharedLibs.cmake EXPAT.cmake ExamplePlugin.cmake - FMODEX.cmake FMODSTUDIO.cmake FindAPR.cmake - FindBerkeleyDB.cmake + FindAutobuild.cmake FindCARes.cmake FindColladadom.cmake - FindELFIO.cmake FindGLOD.cmake FindGoogleBreakpad.cmake FindGooglePerfTools.cmake FindHunSpell.cmake FindJsonCpp.cmake - FindLLQtWebkit.cmake FindNDOF.cmake FindOpenJPEG.cmake FindTut.cmake @@ -71,8 +65,8 @@ set(cmake_SOURCE_FILES LLPrimitive.cmake LLPhysicsExtensions.cmake LLSharedLibs.cmake - LLQtWebkit.cmake LLRender.cmake + LLSharedLibs.cmake LLUI.cmake LLVFS.cmake LLWindow.cmake @@ -91,7 +85,6 @@ set(cmake_SOURCE_FILES Prebuilt.cmake PulseAudio.cmake Python.cmake - Qt4.cmake QuickTimePlugin.cmake RunBuildTest.cmake StateMachine.cmake @@ -101,7 +94,7 @@ set(cmake_SOURCE_FILES UnixInstall.cmake Variables.cmake ViewerMiscLibs.cmake - WebKitLibPlugin.cmake + WinManifest.cmake XmlRpcEpi.cmake ZLIB.cmake ) @@ -110,7 +103,6 @@ source_group("Shared Rules" FILES ${cmake_SOURCE_FILES}) set(master_SOURCE_FILES ../CMakeLists.txt - ../develop.py ) source_group("Master Rules" FILES ${master_SOURCE_FILES}) diff --git a/indra/cmake/CURL.cmake b/indra/cmake/CURL.cmake index 8463d6531..557436cb7 100644 --- a/indra/cmake/CURL.cmake +++ b/indra/cmake/CURL.cmake @@ -13,13 +13,8 @@ else (STANDALONE) debug libcurld optimized libcurl) else (WINDOWS) - set(CURL_LIBRARIES curl) - if(LINUX AND WORD_SIZE EQUAL 64) - list(APPEND CURL_LIBRARIES idn) - endif(LINUX AND WORD_SIZE EQUAL 64) + use_prebuilt_binary(libidn) + set(CURL_LIBRARIES curl idn) endif (WINDOWS) - set(CURL_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (STANDALONE) diff --git a/indra/cmake/Colladadom.cmake b/indra/cmake/Colladadom.cmake index afc8bcce0..e4eb71af0 100644 --- a/indra/cmake/Colladadom.cmake +++ b/indra/cmake/Colladadom.cmake @@ -10,49 +10,22 @@ if (STANDALONE) include (FindColladadom) else (STANDALONE) use_prebuilt_binary(colladadom) - - if (NOT WINDOWS AND NOT LINUX) - use_prebuilt_binary(pcre) - endif (NOT WINDOWS AND NOT LINUX) - - if (NOT DARWIN AND NOT WINDOWS) - use_prebuilt_binary(libxml) - endif (NOT DARWIN AND NOT WINDOWS) - set(COLLADADOM_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/collada - ${LIBS_PREBUILT_DIR}/include/collada/1.4 - ${LIBS_PREBUILT_LEGACY_DIR}/include/collada - ${LIBS_PREBUILT_LEGACY_DIR}/include/collada/1.4 - ) + ${LIBS_PREBUILT_DIR}/include/collada + ${LIBS_PREBUILT_DIR}/include/collada/1.4 + ) if (WINDOWS) - if(MSVC12) - use_prebuilt_binary(pcre) - use_prebuilt_binary(libxml) - set(COLLADADOM_LIBRARIES - debug libcollada14dom23-sd - optimized libcollada14dom23-s - libxml2_a - debug pcrecppd - optimized pcrecpp - debug pcred - optimized pcre - ${BOOST_SYSTEM_LIBRARIES} - ) - else(MSVC12) - add_definitions(-DDOM_DYNAMIC) - set(COLLADADOM_LIBRARIES - debug libcollada14dom22-d - optimized libcollada14dom22 - ) - endif(MSVC12) - else (WINDOWS) - set(COLLADADOM_LIBRARIES - collada14dom - minizip - xml2 - ) + set(COLLADADOM_LIBRARIES + debug libcollada14dom23-sd + optimized libcollada14dom23-s + ) + else(WINDOWS) + set(COLLADADOM_LIBRARIES + debug collada14dom-d + optimized collada14dom + minizip + ) endif (WINDOWS) endif (STANDALONE) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake new file mode 100644 index 000000000..0f3c98785 --- /dev/null +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -0,0 +1,241 @@ +# -*- cmake -*- + +# The copy_win_libs folder contains file lists and a script used to +# copy dlls, exes and such needed to run the SecondLife from within +# VisualStudio. + +include(CMakeCopyIfDifferent) +include(Linking) + +################################################################### +# set up platform specific lists of files that need to be copied +################################################################### +if(WINDOWS) + set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}/Debug") + set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo") + set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}/Release") + + #******************************* + # VIVOX - *NOTE: no debug version + set(vivox_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") + set(vivox_files + SLVoice.exe + ca-bundle.crt + libsndfile-1.dll + vivoxplatform.dll + vivoxsdk.dll + ortp.dll + zlib1.dll + vivoxoal.dll + ) + + #******************************* + # Misc shared libs + + set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}") + set(debug_files + libapr-1.dll + libaprutil-1.dll + libapriconv-1.dll + ssleay32.dll + libeay32.dll + glod.dll + libhunspell.dll + ) + + set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") + set(release_files + libapr-1.dll + libaprutil-1.dll + libapriconv-1.dll + ssleay32.dll + libeay32.dll + glod.dll + libhunspell.dll + ) + + if(NOT DISABLE_TCMALLOC) + set(debug_files ${debug_files} libtcmalloc_minimal-debug.dll) + set(release_files ${release_files} libtcmalloc_minimal.dll) + endif(NOT DISABLE_TCMALLOC) + + if (FMODSTUDIO) + if(WORD_SIZE STREQUAL 64) + set(debug_files ${debug_files} fmodL64.dll) + set(release_files ${release_files} fmod64.dll) + else(WORD_SIZE STREQUAL 64) + set(debug_files ${debug_files} fmodL.dll) + set(release_files ${release_files} fmod.dll) + endif(WORD_SIZE STREQUAL 64) + endif (FMODSTUDIO) +elseif(DARWIN) + set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}/Debug/Resources") + set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/Resources") + set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}/Release/Resources") + + set(vivox_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") + set(vivox_files + SLVoice + ca-bundle.crt + libsndfile.dylib + libvivoxoal.dylib + libortp.dylib + libvivoxplatform.dylib + libvivoxsdk.dylib + ) + set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}") + set(debug_files + ) + set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") + set(release_files + libapr-1.0.dylib + libapr-1.dylib + libaprutil-1.0.dylib + libaprutil-1.dylib + libexception_handler.dylib + libexpat.1.5.2.dylib + libexpat.dylib + libGLOD.dylib + libhunspell-1.3.0.dylib + libndofdev.dylib + ) + + if (FMODSTUDIO) + set(debug_files ${debug_files} libfmodL.dylib) + set(release_files ${release_files} libfmod.dylib) + endif (FMODSTUDIO) + +elseif(LINUX) + # linux is weird, multiple side by side configurations aren't supported + # and we don't seem to have any debug shared libs built yet anyways... + set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}") + set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}") + set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}") + + set(vivox_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") + set(vivox_files + libsndfile.so.1 + libortp.so + libvivoxoal.so.1 + libvivoxplatform.so + libvivoxsdk.so + SLVoice + # ca-bundle.crt #No cert for linux. It is actually still 3.2SDK. + ) + # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables + # or ARCH_PREBUILT_DIRS + set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}") + set(debug_files + ) + # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables + # or ARCH_PREBUILT_DIRS + set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") + # *FIX - figure out what to do with duplicate libalut.so here -brad + set(release_files + libapr-1.so.0 + libaprutil-1.so.0 + libatk-1.0.so + libexpat.so + libexpat.so.1 + libfreetype.so.6.12.3 + libfreetype.so.6 + libfreetype.so + libGLOD.so + libgmodule-2.0.so + libgobject-2.0.so + libopenal.so + libfontconfig.so.1.8.0 + libfontconfig.so.1 + libfontconfig.so + ) + + if (USE_TCMALLOC) + set(release_files ${release_files} "libtcmalloc_minimal.so") + endif (USE_TCMALLOC) + + if (FMODSTUDIO) + set(debug_files ${debug_files} "libfmodL.so") + set(release_files ${release_files} "libfmod.so") + endif (FMODSTUDIO) + +else(WINDOWS) + message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...") + set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux") + set(vivox_files "") + # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables + # or ARCH_PREBUILT_DIRS + set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/debug") + set(debug_files "") + # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables + # or ARCH_PREBUILT_DIRS + set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/release") + set(release_files "") + + set(debug_llkdu_src "") + set(debug_llkdu_dst "") + set(release_llkdu_src "") + set(release_llkdu_dst "") + set(relwithdebinfo_llkdu_dst "") +endif(WINDOWS) + + +################################################################ +# Done building the file lists, now set up the copy commands. +################################################################ + +copy_if_different( + ${vivox_src_dir} + "${SHARED_LIB_STAGING_DIR_DEBUG}" + out_targets + ${vivox_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) + +copy_if_different( + ${vivox_src_dir} + "${SHARED_LIB_STAGING_DIR_RELEASE}" + out_targets + ${vivox_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) + +copy_if_different( + ${vivox_src_dir} + "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}" + out_targets + ${vivox_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) + + + +copy_if_different( + ${debug_src_dir} + "${SHARED_LIB_STAGING_DIR_DEBUG}" + out_targets + ${debug_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) + +copy_if_different( + ${release_src_dir} + "${SHARED_LIB_STAGING_DIR_RELEASE}" + out_targets + ${release_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) + +copy_if_different( + ${release_src_dir} + "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}" + out_targets + ${release_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) + +if(NOT USESYSTEMLIBS) + add_custom_target( + stage_third_party_libs ALL + DEPENDS ${third_party_targets} + ) +endif(NOT USESYSTEMLIBS) diff --git a/indra/cmake/CopyBackToSource.cmake b/indra/cmake/CopyBackToSource.cmake deleted file mode 100644 index d09a216e8..000000000 --- a/indra/cmake/CopyBackToSource.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -*- cmake -*- -# Copies a binary back to the source directory - -MACRO(COPY_BACK_TO_SOURCE target) - SET(FROM $) - SET(TO ${CMAKE_CURRENT_SOURCE_DIR}) - #MESSAGE("TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}") - ADD_CUSTOM_COMMAND( - TARGET ${target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO} - DEPENDS ${FROM} - COMMENT "Copying ${target} to ${CMAKE_CURRENT_BINARY_DIR}" - ) -ENDMACRO(COPY_BACK_TO_SOURCE) - - diff --git a/indra/cmake/CopyWinLibs.cmake.in b/indra/cmake/CopyWinLibs.cmake.in deleted file mode 100644 index 16be776d6..000000000 --- a/indra/cmake/CopyWinLibs.cmake.in +++ /dev/null @@ -1,181 +0,0 @@ -# -*- cmake -*- - -# The copy_win_libs folder contains file lists and a script used to -# copy dlls, exes and such needed to run the SecondLife from within -# VisualStudio. - -set(LIBS_PREBUILT_DIR "@LIBS_PREBUILT_DIR@") -set(LIBS_PREBUILT_LEGACY_DIR "@LIBS_PREBUILT_LEGACY_DIR@") -set(MSVC10 "@MSVC10@") -set(WORD_SIZE "@WORD_SIZE@") - -set(LIBS_RELEASE_DIR - ${LIBS_PREBUILT_DIR}/lib/release - ${LIBS_PREBUILT_LEGACY_DIR}/lib/release - ) -set(LIBS_DEBUG_DIR - ${LIBS_PREBUILT_DIR}/lib/debug - ${LIBS_PREBUILT_LEGACY_DIR}/lib/debug - ) - -function(copy_files paths names dest) - string(FIND ${dest} ${CUR_CONFIG} idx) - if(${idx} LESS 0) - return() - endif(${idx} LESS 0) - foreach(f ${names}) - foreach(p ${paths}) - set(from_file "${p}/${f}") - set(to_dest "${CMAKE_BINARY_DIR}/newview/${dest}/") - if(EXISTS ${from_file}) - message("Copying ${from_file} to ${to_dest}") - if(NOT EXISTS ${to_dest}) - execute_process(COMMAND md "${to_dest}") - endif(NOT EXISTS ${to_dest}) - execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${from_file}" "${to_dest}${f}" RESULT_VARIABLE result) - if(${result}) - message(SEND_ERROR "Unsuccessful.") - endif(${result}) - set(found 1) - break() - endif(EXISTS ${from_file}) - endforeach(p) - if(NOT found) - message(SEND_ERROR "Failed to find library: ${f}") - endif(NOT found) - endforeach(f) -endfunction(copy_files) - -set(vivox_files - ca-bundle.crt - libsndfile-1.dll - ortp.dll - SLVoice.exe - vivoxoal.dll - vivoxplatform.dll - vivoxsdk.dll - zlib1.dll - ) -copy_files("${LIBS_RELEASE_DIR}" "${vivox_files}" "Release" ) -copy_files("${LIBS_RELEASE_DIR}" "${vivox_files}" "RelWithDebInfo") -copy_files("${LIBS_DEBUG_DIR}" "${vivox_files}" "Debug") - -set(release_files - libhunspell.dll - libapr-1.dll - libaprutil-1.dll - libapriconv-1.dll - libeay32.dll - ssleay32.dll - glod.dll - qtcore4.dll - ) -copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "Release") -copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "RelWithDebInfo") -copy_files("${LIBS_DEBUG_DIR}" "${release_files}" "Debug") - -if(MSVC10) - copy_files("${LIBS_DEBUG_DIR}" "libcollada14dom22-d.dll" "Debug") -endif(MSVC10) - -if(WORD_SIZE EQUAL 32) -set(release_files - libcollada14dom22.dll - libtcmalloc_minimal.dll - ) - copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "Release") - copy_files("${LIBS_RELEASE_DIR}" "${release_files}" "RelWithDebInfo") -endif(WORD_SIZE EQUAL 32) - -set(plugins_release_files - libeay32.dll - qtcore4.dll - qtgui4.dll - qtnetwork4.dll - qtopengl4.dll - qtwebkit4.dll - ssleay32.dll - qtxmlpatterns4.dll - ) -copy_files("${LIBS_RELEASE_DIR}" "${plugins_release_files}" "Release/llplugin") -copy_files("${LIBS_RELEASE_DIR}" "${plugins_release_files}" "RelWithDebInfo/llplugin") -if(0) - copy_files("${LIBS_RELEASE_DIR}" "${plugin_release_files}" "../test_apps/llplugintest/Release") - copy_files("${LIBS_RELEASE_DIR}" "${plugin_release_files}" "../test_apps/llplugintest/RelWithDebInfo") -endif(0) - -# Debug config runtime files required for the plugins -set(plugins_debug_files - libeay32.dll - qtcored4.dll - qtguid4.dll - qtnetworkd4.dll - qtopengld4.dll - qtwebkitd4.dll - ssleay32.dll - qtxmlpatternsd4.dll - ) -copy_files("${LIBS_DEBUG_DIR}" "${plugins_debug_files}" "Debug/llplugin") -if(0) - copy_files("${LIBS_DEBUG_DIR}" "${plugins_debug_files}" "../test_apps/llplugintest/Debug") -endif(0) - -# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins) -set(plugin_image_release_files - qgif4.dll - qico4.dll - qjpeg4.dll - qmng4.dll - qsvg4.dll - qtiff4.dll - ) -copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "Release/llplugin/imageformats") -copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "RelWithDebInfo/llplugin/imageformats") -if(0) - copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "../test_apps/llplugintest/imageformats/Release") - copy_files("${LIBS_RELEASE_DIR}/imageformats" "${plugin_image_release_files}" "../test_apps/llplugintest/imageformats/RelWithDebInfo") -endif(0) - - -# Debug config runtime files required for the plugin test mule (Qt image format plugins) -set(plugin_image_debug_files - qgifd4.dll - qicod4.dll - qjpegd4.dll - qmngd4.dll - qsvgd4.dll - qtiffd4.dll - ) -copy_files("${LIBS_DEBUG_DIR}/imageformats" "${plugin_image_debug_files}" "Debug/llplugin/imageformats") -if(0) - copy_files("${LIBS_DEBUG_DIR}/imageformats" "${plugin_image_debug_files}" "../test_apps/llplugintest/imageformats/Debug") -endif(0) - -# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins) -set(plugin_codec_release_files - qcncodecs4.dll - qjpcodecs4.dll - qkrcodecs4.dll - qtwcodecs4.dll - ) -copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "Release/llplugin/codecs") -copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "RelWithDebInfo/llplugin/codecs") -if(0) - copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "../test_apps/llplugintest/codecs/Release") - copy_files("${LIBS_RELEASE_DIR}/codecs" "${plugin_codec_release_files}" "../test_apps/llplugintest/codecs/RelWithDebInfo") -endif(0) - -# Debug config runtime files required for the plugin test mule (Qt image format plugins) -set(plugin_codec_debug_files - qcncodecsd4.dll - qjpcodecsd4.dll - qkrcodecsd4.dll - qtwcodecsd4.dll - ) -copy_files("${LIBS_DEBUG_DIR}/codecs" "${plugin_codec_debug_files}" "Debug/llplugin/codecs") -if(0) - copy_files("${LIBS_DEBUG_DIR}/codecs" "${plugin_codec_debug_files}" "../test_apps/llplugintest/codecs/Debug") -endif(0) - - - diff --git a/indra/cmake/DBusGlib.cmake b/indra/cmake/DBusGlib.cmake index cb1b3a302..266ea297a 100644 --- a/indra/cmake/DBusGlib.cmake +++ b/indra/cmake/DBusGlib.cmake @@ -7,12 +7,11 @@ if (STANDALONE) pkg_check_modules(DBUSGLIB REQUIRED dbus-glib-1) elseif (LINUX) - use_prebuilt_binary(dbusglib) + use_prebuilt_binary(dbus-glib) set(DBUSGLIB_FOUND ON FORCE BOOL) set(DBUSGLIB_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/dbus - ${LIBS_PREBUILT_LEGACY_DIR}/include/dbus - ) + ${LIBS_PREBUILT_DIR}/include/dbus + ) # We don't need to explicitly link against dbus-glib itself, because # the viewer probes for the system's copy at runtime. set(DBUSGLIB_LIBRARIES diff --git a/indra/cmake/DeploySharedLibs.cmake b/indra/cmake/DeploySharedLibs.cmake new file mode 100644 index 000000000..41b7e6a5b --- /dev/null +++ b/indra/cmake/DeploySharedLibs.cmake @@ -0,0 +1,70 @@ +# DeploySharedLibs.cmake +# This is a script to be run at build time! Its not part of the cmake configuration! +# See indra/cmake/LLSharedLibs.cmake for a macro that simplifies adding a command to a target to run this script. + +# This script requires a few cmake variable to be set on the command line: +# BIN_NAME= The full path the the binary to search for dependecies. +# SEARCH_DIRS= The full paths to dirs to search for dependencies. +# DST_PATH= The full path where the dependecies will be copied. +get_filename_component(current_dir ${CMAKE_CURRENT_LIST_FILE} PATH) +include(GetPrerequisites) + +message("Getting recursive dependencies for file: ${BIN_NAME}") + +set(EXCLUDE_SYSTEM 1) +set(RECURSE 0) +get_filename_component(EXE_PATH ${BIN_NAME} PATH) + +get_prerequisites( ${BIN_NAME} RESULTS ${EXCLUDE_SYSTEM} ${RECURSE} "${EXE_PATH}" "${SEARCH_DIRS}" ) + +foreach(DEP ${RESULTS}) + Message("Processing dependency: ${DEP}") + get_filename_component(DEP_FILE ${DEP} NAME) + set(DEP_FILES ${DEP_FILES} ${DEP_FILE}) +endforeach(DEP) + +if(DEP_FILES) + list(REMOVE_DUPLICATES DEP_FILES) +endif(DEP_FILES) + +foreach(DEP_FILE ${DEP_FILES}) + if(FOUND_FILES) + list(FIND FOUND_FILES ${DEP_FILE} FOUND) + else(FOUND_FILES) + set(FOUND -1) + endif(FOUND_FILES) + + if(FOUND EQUAL -1) + find_path(DEP_PATH ${DEP_FILE} PATHS ${SEARCH_DIRS} NO_DEFAULT_PATH) + if(DEP_PATH) + set(FOUND_FILES ${FOUND_FILES} "${DEP_PATH}/${DEP_FILE}") + set(DEP_PATH NOTFOUND) #reset DEP_PATH for the next find_path call. + else(DEP_PATH) + set(MISSING_FILES ${MISSING_FILES} ${DEP_FILE}) + endif(DEP_PATH) + endif(FOUND EQUAL -1) +endforeach(DEP_FILE) + +if(MISSING_FILES) + message("Missing:") + foreach(FILE ${MISSING_FILES}) + message(" ${FILE}") + endforeach(FILE) + message("Searched in:") + foreach(SEARCH_DIR ${SEARCH_DIRS}) + message(" ${SEARCH_DIR}") + endforeach(SEARCH_DIR) + message(FATAL_ERROR "Failed") +endif(MISSING_FILES) + +if(FOUND_FILES) + foreach(FILE ${FOUND_FILES}) + get_filename_component(DST_FILE ${FILE} NAME) + set(DST_FILE "${DST_PATH}/${DST_FILE}") + message("Copying ${FILE} to ${DST_FILE}") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST_FILE} + ) + endforeach(FILE ${FOUND_FILES}) +endif(FOUND_FILES) +message("Success!") diff --git a/indra/cmake/DirectX.cmake b/indra/cmake/DirectX.cmake deleted file mode 100644 index 56547bb7d..000000000 --- a/indra/cmake/DirectX.cmake +++ /dev/null @@ -1,82 +0,0 @@ -# -*- cmake -*- - -include(Variables) - -if (WINDOWS) - if (WORD_SIZE EQUAL 32) - set (DIRECTX_ARCHITECTURE x86) - elseif (WORD_SIZE EQUAL 64) - set (DIRECTX_ARCHITECTURE x64) - else (WORD_SIZE EQUAL 32) - set (DIRECTX_ARCHITECTURE x86) - endif (WORD_SIZE EQUAL 32) - - SET(program_files $ENV{ProgramW6432}) - if(NOT program_files) - SET(program_files $ENV{ProgramFiles}) - endif(NOT program_files) - SET(program_files_x86 "ProgramFiles(x86)") - SET(program_files_x86 $ENV{${program_files_x86}}) - - find_path(DIRECTX_ROOT_DIR Include/dxdiag.h - PATHS - "$ENV{DXSDK_DIR}" - "${program_files}/Microsoft DirectX SDK (June 2010)" - "${program_files_x86}/Microsoft DirectX SDK (June 2010)" - "${program_files}/Microsoft DirectX SDK (February 2010)" - "${program_files_x86}/Microsoft DirectX SDK (February 2010)" - "${program_files}/Microsoft DirectX SDK (March 2009)" - "${program_files_x86}/Microsoft DirectX SDK (March 2009)" - "${program_files}/Microsoft DirectX SDK (August 2008)" - "${program_files_x86}/Microsoft DirectX SDK (August 2008)" - "${program_files}/Microsoft DirectX SDK (June 2008)" - "${program_files_x86}/Microsoft DirectX SDK (June 2008)" - "${program_files}/Microsoft DirectX SDK (March 2008)" - "${program_files_x86}/Microsoft DirectX SDK (March 2008)" - "${program_files}/Microsoft DirectX SDK (November 2007)" - "${program_files_x86}/Microsoft DirectX SDK (November 2007)" - "${program_files}/Microsoft DirectX SDK (August 2007)" - "${program_files_x86}/Microsoft DirectX SDK (August 2007)" - ) - - if (DIRECTX_ROOT_DIR) - set (DIRECTX_INCLUDE_DIR "${DIRECTX_ROOT_DIR}/Include") - set (DIRECTX_LIBRARY_DIR "${DIRECTX_ROOT_DIR}/Lib/${DIRECTX_ARCHITECTURE}") - else (DIRECTX_ROOT_DIR) - find_path (WIN_KIT_ROOT_DIR Include/um/windows.h - PATHS - "${program_files}/Windows Kits/8.1" - "${program_files_x86}/Windows Kits/8.1" - "${program_files}/Windows Kits/8.0" - "${program_files_x86}/Windows Kits/8.0" - ) - - find_path (WIN_KIT_LIB_DIR dxguid.lib - "${WIN_KIT_ROOT_DIR}/Lib/winv6.3/um/${DIRECTX_ARCHITECTURE}" - "${WIN_KIT_ROOT_DIR}/Lib/Win8/um/${DIRECTX_ARCHITECTURE}" - ) - - if (WIN_KIT_ROOT_DIR AND WIN_KIT_LIB_DIR) - set (DIRECTX_INCLUDE_DIR "${WIN_KIT_ROOT_DIR}/Include/um" "${WIN_KIT_ROOT_DIR}/Include/shared") - set (DIRECTX_LIBRARY_DIR "${WIN_KIT_LIB_DIR}") - endif (WIN_KIT_ROOT_DIR AND WIN_KIT_LIB_DIR) - endif (DIRECTX_ROOT_DIR) - - if (DIRECTX_INCLUDE_DIR) - include_directories(${DIRECTX_INCLUDE_DIR}) - if (DIRECTX_FIND_QUIETLY) - message(STATUS "Found DirectX include: ${DIRECTX_INCLUDE_DIR}") - endif (DIRECTX_FIND_QUIETLY) - else (DIRECTX_INCLUDE_DIR) - message(FATAL_ERROR "Could not find DirectX SDK Include") - endif (DIRECTX_INCLUDE_DIR) - - if (DIRECTX_LIBRARY_DIR) - if (DIRECTX_FIND_QUIETLY) - message(STATUS "Found DirectX include: ${DIRECTX_LIBRARY_DIR}") - endif (DIRECTX_FIND_QUIETLY) - else (DIRECTX_LIBRARY_DIR) - message(FATAL_ERROR "Could not find DirectX SDK Libraries") - endif (DIRECTX_LIBRARY_DIR) - -endif (WINDOWS) diff --git a/indra/cmake/DownloadPrebuilt.cmake.in b/indra/cmake/DownloadPrebuilt.cmake.in deleted file mode 100644 index 5b67fedd4..000000000 --- a/indra/cmake/DownloadPrebuilt.cmake.in +++ /dev/null @@ -1,45 +0,0 @@ -# This script drives download of prebuilt packages during the build. -# The top-level CMakeLists.txt configures packages and tool locations. -set(packages "@PREBUILT_PACKAGES@") -set(python "@PYTHON_EXECUTABLE@") -set(install_dir "@CMAKE_BINARY_DIR@/packages") -set(scp "@SCP_EXECUTABLE@") -set(scripts_dir "@SCRIPTS_DIR@") -set(sentinel_dir "@CMAKE_BINARY_DIR@/prepare") -set(prebuilt_type "@PREBUILT_TYPE@") - -# In proprietary mode we use scp for download. -set(proprietary "@INSTALL_PROPRIETARY@") -if(proprietary) - set(scp_option "--scp=${scp}") - set(proprietary_message " proprietary") -endif(proprietary) - -foreach(package ${packages}) - if(${install_dir}/install.xml IS_NEWER_THAN ${sentinel_dir}/${package}_installed) - # This package is missing or out of date. - message(STATUS "Obtaining${proprietary_message} prebuilt '${package}'") - execute_process( - COMMAND ${python} install.py -p${prebuilt_type} --install-dir=${install_dir} --installed-manifest=${install_dir}/installed.xml ${scp_option} ${package} - WORKING_DIRECTORY ${scripts_dir} - RESULT_VARIABLE result - ) - if(result STREQUAL 0) - # Write a sentinel to avoid attempting a download again. - file(WRITE ${sentinel_dir}/${package}_installed "Obtained '${package}'") - else(result STREQUAL 0) - # Remove the sentinel to ensure a download is attempted again. - file(REMOVE ${sentinel_dir}/prebuilt - ${sentinel_dir}/${package}_installed) - message(FATAL_ERROR - "Failed to download or unpack prebuilt '${package}'. " - "Process returned: ${result}") - endif(result STREQUAL 0) - else(${install_dir}/install.xml IS_NEWER_THAN ${sentinel_dir}/${package}_installed) - # This package is ready. - message(STATUS "Prebuilt '${package}' is up-to-date") - endif(${install_dir}/install.xml IS_NEWER_THAN ${sentinel_dir}/${package}_installed) -endforeach(package) - -# Store a sentinel to avoid running this script unnecessarily. -file(WRITE ${sentinel_dir}/prebuilt "All prebuilts obtained successfully\n") diff --git a/indra/cmake/ELFIO.cmake b/indra/cmake/ELFIO.cmake deleted file mode 100644 index 8de2c36d4..000000000 --- a/indra/cmake/ELFIO.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -set(ELFIO_FIND_QUIETLY ON) - -if (STANDALONE) - include(FindELFIO) -elseif (LINUX) - use_prebuilt_binary(elfio) - set(ELFIO_LIBRARIES ELFIO) - set(ELFIO_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) - set(ELFIO_FOUND "YES") -endif (STANDALONE) - -if (ELFIO_FOUND) - add_definitions(-DLL_ELFBIN=1) -else (ELFIO_FOUND) - set(ELFIO_INCLUDE_DIR "") -endif (ELFIO_FOUND) diff --git a/indra/cmake/EXPAT.cmake b/indra/cmake/EXPAT.cmake index bafe1a91e..d11c6a9af 100644 --- a/indra/cmake/EXPAT.cmake +++ b/indra/cmake/EXPAT.cmake @@ -9,16 +9,9 @@ if (STANDALONE) else (STANDALONE) use_prebuilt_binary(expat) if (WINDOWS) - if (MSVC12) - set(EXPAT_LIBRARIES expat) - else (MSVC12) - set(EXPAT_LIBRARIES libexpatMT) - endif (MSVC12) + set(EXPAT_LIBRARIES expat) else (WINDOWS) set(EXPAT_LIBRARIES expat) endif (WINDOWS) - set(EXPAT_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + set(EXPAT_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (STANDALONE) diff --git a/indra/cmake/FMODEX.cmake b/indra/cmake/FMODEX.cmake deleted file mode 100644 index ae95866c4..000000000 --- a/indra/cmake/FMODEX.cmake +++ /dev/null @@ -1,116 +0,0 @@ -# -*- cmake -*- - -include(Linking) - -if (FMODEX AND FMODSTUDIO) - message( FATAL_ERROR "You can not enable two FMOD variants at the same time." ) -endif (FMODEX AND FMODSTUDIO) - -unset(FMOD_LIBRARY_RELEASE CACHE) -unset(FMOD_LIBRARY_DEBUG CACHE) -unset(FMOD_INCLUDE_DIR CACHE) - -set(FMOD_EXTERNAL_LIB OFF) - -if(STANDALONE OR WINDOWS) - if (NOT FMODEX_SDK_DIR AND WINDOWS) - GET_FILENAME_COMPONENT(REG_DIR [HKEY_CURRENT_USER\\Software\\FMOD\ Programmers\ API\ Windows] ABSOLUTE) - set(FMODEX_SDK_DIR ${REG_DIR} CACHE PATH "Path to the FMOD Ex SDK." FORCE) - endif (NOT FMODEX_SDK_DIR AND WINDOWS) - if(NOT FMODEX_SDK_DIR AND STANDALONE) - message(FATAL_ERROR "FMODEX_SDK_DIR not set!") - endif(NOT FMODEX_SDK_DIR AND STANDALONE) -endif(STANDALONE OR WINDOWS) - -if(FMODEX_SDK_DIR) - set(fmod_lib_paths "${FMODEX_SDK_DIR}/api" "${FMODEX_SDK_DIR}/api/lib" ) - set(fmod_inc_paths "${FMODEX_SDK_DIR}/api/inc") - - if(WINDOWS) - set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES .dll) - endif(WINDOWS) - if(WORD_SIZE EQUAL 64) - find_library(FMOD_LIBRARY_RELEASE fmodex64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - find_library(FMOD_LIBRARY_DEBUG fmodexL64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - else(WORD_SIZE EQUAL 64)#Check if CMAKE_FIND_LIBRARY_PREFIXES is set to 'lib' for darwin. - find_library(FMOD_LIBRARY_RELEASE fmodex PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - find_library(FMOD_LIBRARY_DEBUG fmodexL PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - endif(WORD_SIZE EQUAL 64) - if(WINDOWS) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) - if(WORD_SIZE EQUAL 64) - find_library(FMOD_LINK_LIBRARY_RELEASE fmodex64_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - find_library(FMOD_LINK_LIBRARY_DEBUG fmodexL64_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - else(WORD_SIZE EQUAL 64)#Check if CMAKE_FIND_LIBRARY_PREFIXES is set to 'lib' for darwin. - find_library(FMOD_LINK_LIBRARY_RELEASE fmodex_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - find_library(FMOD_LINK_LIBRARY_DEBUG fmodexL_vc PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - endif(WORD_SIZE EQUAL 64) - else(WINDOWS) - set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE}) - set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG}) - endif(WINDOWS) - find_path(FMOD_INCLUDE_DIR fmod.hpp ${fmod_inc_paths}) - if(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) - if(STANDALONE) - message(FATAL_ERROR "Provided FMODEX_SDK_DIR path not found '{$FMODEX_SDK_DIR}'") - else(STANDALONE) - message(STATUS "Provided FMODEX_SDK_DIR path not found '${FMODEX_SDK_DIR}'. Falling back to prebuilts") - endif(STANDALONE) - else(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) - message(STATUS "Using system-provided FMOD Ex Libraries") - set(FMOD_EXTERNAL_LIB ON) - endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) -endif (FMODEX_SDK_DIR) - -if (NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) - if(WINDOWS) - set(lib_suffix .dll) - elseif(DARWIN) - set(lib_suffix .dylib) - else(WINDOWS) - set(lib_suffix .so) - endif(WINDOWS) - if(WINDOWS) - if(WORD_SIZE EQUAL 64) - set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/fmodex64${lib_suffix}) - set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/fmodexL64${lib_suffix}) - else(WORD_SIZE EQUAL 64) - set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/fmodex${lib_suffix}) - set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/fmodexL${lib_suffix}) - endif(WORD_SIZE EQUAL 64) - else(WINDOWS) - if(WORD_SIZE EQUAL 64) - set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/libfmodex64${lib_suffix}) - set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/libfmodex64L${lib_suffix}) - else(WORD_SIZE EQUAL 64) - set(FMOD_LIBRARY_RELEASE ${LIBS_PREBUILT_DIR}/lib/release/libfmodex${lib_suffix}) - set(FMOD_LIBRARY_DEBUG ${LIBS_PREBUILT_DIR}/lib/debug/libfmodexL${lib_suffix}) - endif(WORD_SIZE EQUAL 64) - endif(WINDOWS) - set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE}) - set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG}) - if(WINDOWS) - string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE}) - string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG}) - endif(WINDOWS) - use_prebuilt_binary(fmodex) - set(FMOD_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include/fmodex) -endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) - -if(FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR) - set(FMOD ON) - if (NOT FMOD_LIBRARY_DEBUG) #Use release library in debug configuration if debug library is absent. - set(FMOD_LIBRARY_DEBUG ${FMOD_LIBRARY_RELEASE}) - endif (NOT FMOD_LIBRARY_DEBUG) -else (FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR) - message(STATUS "No support for FMOD EX audio (need to set FMODEX_SDK_DIR?)") - set(FMOD OFF) - set(FMODEX OFF) -endif (FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR) - -if (FMOD) - message(STATUS "Building with FMOD Ex audio support") - set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODEX") -endif (FMOD) diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index fac23b3d3..8d8e796c1 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -1,70 +1,8 @@ # -*- cmake -*- -include(Linking) - -if (FMODEX AND FMODSTUDIO) - message( FATAL_ERROR "You can not enable two FMOD variants at the same time." ) -endif (FMODEX AND FMODSTUDIO) - -unset(FMOD_LIBRARY_RELEASE CACHE) -unset(FMOD_LIBRARY_DEBUG CACHE) -unset(FMOD_INCLUDE_DIR CACHE) - -set(FMOD_EXTERNAL_LIB OFF) - -if(STANDALONE OR WINDOWS) - if (NOT FMODSTUDIO_SDK_DIR AND WINDOWS) - #GET_FILENAME_COMPONENT(REG_DIR [HKEY_CURRENT_USER\\Software\\FMOD\ Studio\ API\ Windows] ABSOLUTE) - #set(FMODSTUDIO_SDK_DIR ${REG_DIR} CACHE PATH "Path to the FMOD Studio SDK." FORCE) - endif (NOT FMODSTUDIO_SDK_DIR AND WINDOWS) - if(NOT FMODSTUDIO_SDK_DIR AND STANDALONE) - message(FATAL_ERROR "FMODSTUDIO_SDK_DIR not set!") - endif(NOT FMODSTUDIO_SDK_DIR AND STANDALONE) -endif(STANDALONE OR WINDOWS) - -if(FMODSTUDIO_SDK_DIR) - if(LINUX AND WORD_SIZE EQUAL 32) - set(fmod_lib_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/lib/x86" ) - elseif(LINUX) - set(fmod_lib_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/lib/x86_64") - else(LINUX AND WORD_SIZE EQUAL 32) - set(fmod_lib_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/lib") - endif(LINUX AND WORD_SIZE EQUAL 32) - set(fmod_inc_paths "${FMODSTUDIO_SDK_DIR}/api/lowlevel/inc") - - if(WINDOWS) - set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES .dll) - endif(WINDOWS) - if(WORD_SIZE EQUAL 64 AND WINDOWS) - find_library(FMOD_LIBRARY_RELEASE fmod64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - find_library(FMOD_LIBRARY_DEBUG fmodL64 PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - else(WORD_SIZE EQUAL 64 AND WINDOWS)#Check if CMAKE_FIND_LIBRARY_PREFIXES is set to 'lib' for darwin. - find_library(FMOD_LIBRARY_RELEASE fmod PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - find_library(FMOD_LIBRARY_DEBUG fmodL PATHS ${fmod_lib_paths} NO_DEFAULT_PATH) - endif(WORD_SIZE EQUAL 64 AND WINDOWS) - if(WINDOWS) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) - string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE}) - string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG}) - else(WINDOWS) - set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE}) - set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG}) - endif(WINDOWS) - find_path(FMOD_INCLUDE_DIR fmod.hpp ${fmod_inc_paths}) - if(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) - if(STANDALONE) - message(FATAL_ERROR "Provided FMODSTUDIO_SDK_DIR path not found '{$FMODSTUDIO_SDK_DIR}'") - else(STANDALONE) - message(STATUS "Provided FMODSTUDIO_SDK_DIR path not found '${FMODSTUDIO_SDK_DIR}'. Falling back to prebuilts") - endif(STANDALONE) - else(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) - message(STATUS "Using system-provided FMOD Studio Libraries") - set(FMOD_EXTERNAL_LIB ON) - endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) -endif (FMODSTUDIO_SDK_DIR) - -if (NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) +include(Variables) +if (FMODSTUDIO) + use_prebuilt_binary(fmodstudio) if(WINDOWS) set(lib_suffix .dll) elseif(DARWIN) @@ -86,14 +24,19 @@ if (NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) endif(WINDOWS) set(FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE}) set(FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG}) + if(WINDOWS) string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_RELEASE ${FMOD_LIBRARY_RELEASE}) string(REPLACE ".dll" "_vc.lib" FMOD_LINK_LIBRARY_DEBUG ${FMOD_LIBRARY_DEBUG}) endif(WINDOWS) - use_prebuilt_binary(fmodstudio) - set(FMOD_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include/fmodstudio) -endif(NOT FMOD_LIBRARY_RELEASE OR NOT FMOD_INCLUDE_DIR) + + set (FMOD_LIBRARY + debug ${FMOD_LINK_LIBRARY_DEBUG} + optimized ${FMOD_LINK_LIBRARY_RELEASE} + ) + + set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodstudio) +endif(FMODSTUDIO) if(FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR) set(FMOD ON) @@ -108,5 +51,6 @@ endif (FMOD_LIBRARY_RELEASE AND FMOD_INCLUDE_DIR) if (FMOD) message(STATUS "Building with FMOD Studio audio support") - set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODSTUDIO") + set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODSTUDIO=1") endif (FMOD) + diff --git a/indra/cmake/FindAutobuild.cmake b/indra/cmake/FindAutobuild.cmake new file mode 100644 index 000000000..ea5ad6d10 --- /dev/null +++ b/indra/cmake/FindAutobuild.cmake @@ -0,0 +1,43 @@ +# -*- cmake -*- +# +# Find the autobuild tool +# +# Output variables: +# +# AUTOBUILD_EXECUTABLE - path to autobuild executable + + + +IF (NOT AUTOBUILD_EXECUTABLE) + + # If cmake was executed by autobuild, autobuild will have set the AUTOBUILD env var + IF (DEFINED ENV{AUTOBUILD}) + SET(AUTOBUILD_EXECUTABLE $ENV{AUTOBUILD}) + ELSE (DEFINED ENV{AUTOBUILD}) + IF(WIN32) + SET(AUTOBUILD_EXE_NAMES autobuild.exe autobuild.cmd) + ELSE(WIN32) + SET(AUTOBUILD_EXE_NAMES autobuild) + ENDIF(WIN32) + + SET(AUTOBUILD_EXECUTABLE) + FIND_PROGRAM( + AUTOBUILD_EXECUTABLE + NAMES ${AUTOBUILD_EXE_NAMES} + PATHS + ENV PATH + ${CMAKE_SOURCE_DIR}/.. + ${CMAKE_SOURCE_DIR}/../.. + ${CMAKE_SOURCE_DIR}/../../.. + PATH_SUFFIXES "/autobuild/bin/" + ) + ENDIF (DEFINED ENV{AUTOBUILD}) + + IF (NOT AUTOBUILD_EXECUTABLE) + IF (AUTOBUILD_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find autobuild executable") + ENDIF (AUTOBUILD_FIND_REQUIRED) + ENDIF (NOT AUTOBUILD_EXECUTABLE) + + MARK_AS_ADVANCED(AUTOBUILD_EXECUTABLE) +ENDIF (NOT AUTOBUILD_EXECUTABLE) diff --git a/indra/cmake/FindBerkeleyDB.cmake b/indra/cmake/FindBerkeleyDB.cmake deleted file mode 100644 index 2d633c74e..000000000 --- a/indra/cmake/FindBerkeleyDB.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# -*- cmake -*- - -# - Find BerkeleyDB -# Find the BerkeleyDB includes and library -# This module defines -# DB_INCLUDE_DIR, where to find db.h, etc. -# DB_LIBRARIES, the libraries needed to use BerkeleyDB. -# DB_FOUND, If false, do not try to use BerkeleyDB. -# also defined, but not for general use are -# DB_LIBRARY, where to find the BerkeleyDB library. - -FIND_PATH(DB_INCLUDE_DIR db.h -/usr/local/include/db4 -/usr/local/include -/usr/include/db4 -/usr/include -) - -SET(DB_NAMES ${DB_NAMES} db) -FIND_LIBRARY(DB_LIBRARY - NAMES ${DB_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (DB_LIBRARY AND DB_INCLUDE_DIR) - SET(DB_LIBRARIES ${DB_LIBRARY}) - SET(DB_FOUND "YES") -ELSE (DB_LIBRARY AND DB_INCLUDE_DIR) - SET(DB_FOUND "NO") -ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR) - - -IF (DB_FOUND) - IF (NOT DB_FIND_QUIETLY) - MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}") - ENDIF (NOT DB_FIND_QUIETLY) -ELSE (DB_FOUND) - IF (DB_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library") - ENDIF (DB_FIND_REQUIRED) -ENDIF (DB_FOUND) - -# Deprecated declarations. -SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH) - -MARK_AS_ADVANCED( - DB_LIBRARY - DB_INCLUDE_DIR - ) diff --git a/indra/cmake/FindELFIO.cmake b/indra/cmake/FindELFIO.cmake deleted file mode 100644 index 8a5421ab9..000000000 --- a/indra/cmake/FindELFIO.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# -*- cmake -*- - -# - Find ELFIO -# Find the ELFIO includes and library -# This module defines -# ELFIO_INCLUDE_DIR, where to find elfio.h, etc. -# ELFIO_LIBRARIES, the libraries needed to use ELFIO. -# ELFIO_FOUND, If false, do not try to use ELFIO. -# also defined, but not for general use are -# ELFIO_LIBRARY, where to find the ELFIO library. - -FIND_PATH(ELFIO_INCLUDE_DIR ELFIO/ELFIO.h -/usr/local/include -/usr/include -) - -SET(ELFIO_NAMES ${ELFIO_NAMES} ELFIO) -FIND_LIBRARY(ELFIO_LIBRARY - NAMES ${ELFIO_NAMES} - PATHS /usr/lib /usr/local/lib - ) - -IF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) - SET(ELFIO_LIBRARIES ${ELFIO_LIBRARY}) - SET(ELFIO_FOUND "YES") -ELSE (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) - SET(ELFIO_FOUND "NO") -ENDIF (ELFIO_LIBRARY AND ELFIO_INCLUDE_DIR) - - -IF (ELFIO_FOUND) - IF (NOT ELFIO_FIND_QUIETLY) - MESSAGE(STATUS "Found ELFIO: ${ELFIO_LIBRARIES}") - ENDIF (NOT ELFIO_FIND_QUIETLY) -ELSE (ELFIO_FOUND) - IF (ELFIO_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find ELFIO library") - ENDIF (ELFIO_FIND_REQUIRED) -ENDIF (ELFIO_FOUND) - -# Deprecated declarations. -SET (NATIVE_ELFIO_INCLUDE_PATH ${ELFIO_INCLUDE_DIR} ) -GET_FILENAME_COMPONENT (NATIVE_ELFIO_LIB_PATH ${ELFIO_LIBRARY} PATH) - -MARK_AS_ADVANCED( - ELFIO_LIBRARY - ELFIO_INCLUDE_DIR - ) diff --git a/indra/cmake/FindLLQtWebkit.cmake b/indra/cmake/FindLLQtWebkit.cmake deleted file mode 100644 index 731ae67d7..000000000 --- a/indra/cmake/FindLLQtWebkit.cmake +++ /dev/null @@ -1,62 +0,0 @@ -# -*- cmake -*- - -# - Find llqtwebkit -# Find the llqtwebkit includes and library -# This module defines -# LLQTWEBKIT_INCLUDE_DIR, where to find llqtwebkit.h, etc. -# LLQTWEBKIT_LIBRARY, the llqtwebkit library with full path. -# LLQTWEBKIT_FOUND, If false, do not try to use llqtwebkit. -# also defined, but not for general use are -# LLQTWEBKIT_LIBRARIES, the libraries needed to use llqtwebkit. -# LLQTWEBKIT_LIBRARY_DIRS, where to find the llqtwebkit library. -# LLQTWEBKIT_DEFINITIONS - You should add_definitions(${LLQTWEBKIT_DEFINITIONS}) -# before compiling code that includes llqtwebkit library files. - -# Try to use pkg-config first. -# This allows to have two different libllqtwebkit packages installed: -# one for viewer 2.x and one for viewer 1.x. -include(FindPkgConfig) -if (PKG_CONFIG_FOUND) - if (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION) - set(_PACKAGE_ARGS libllqtwebkit>=${LLQtWebkit_FIND_VERSION} REQUIRED) - else (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION) - set(_PACKAGE_ARGS libllqtwebkit) - endif (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION) - if (NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8") - # As virtually nobody will have a pkg-config file for this, do this check always quiet. - # Unfortunately cmake 2.8 or higher is required for pkg_check_modules to have a 'QUIET'. - set(_PACKAGE_ARGS ${_PACKAGE_ARGS} QUIET) - endif () - pkg_check_modules(LLQTWEBKIT ${_PACKAGE_ARGS}) -endif (PKG_CONFIG_FOUND) -set(LLQTWEBKIT_DEFINITIONS ${LLQTWEBKIT_CFLAGS_OTHER}) - -find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_INCLUDE_DIRS}) - -find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS}) - -if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) # If pkg-config couldn't find it, pretend we don't have pkg-config. - set(LLQTWEBKIT_LIBRARIES llqtwebkit) - get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH) -endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) - -# Handle the QUIETLY and REQUIRED arguments and set LLQTWEBKIT_FOUND -# to TRUE if all listed variables are TRUE. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - LLQTWEBKIT - DEFAULT_MSG - LLQTWEBKIT_LIBRARY - LLQTWEBKIT_INCLUDE_DIR - LLQTWEBKIT_LIBRARIES - LLQTWEBKIT_LIBRARY_DIRS - ) - -mark_as_advanced( - LLQTWEBKIT_LIBRARY - LLQTWEBKIT_INCLUDE_DIR - LLQTWEBKIT_LIBRARIES - LLQTWEBKIT_LIBRARY_DIRS - LLQTWEBKIT_DEFINITIONS - ) - diff --git a/indra/cmake/FreeType.cmake b/indra/cmake/FreeType.cmake index 5cca587cf..2d6025f3a 100644 --- a/indra/cmake/FreeType.cmake +++ b/indra/cmake/FreeType.cmake @@ -7,18 +7,7 @@ if (STANDALONE) pkg_check_modules(FREETYPE REQUIRED freetype2) else (STANDALONE) use_prebuilt_binary(freetype) - if(MSVC12) - set(FREETYPE_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/freetype2 - ${LIBS_PREBUILT_LEGACY_DIR}/include/freetype2 - ) - else(MSVC12) - set(FREETYPE_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) - endif (MSVC12) - + set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/freetype2) set(FREETYPE_LIBRARIES freetype) endif (STANDALONE) diff --git a/indra/cmake/GLOD.cmake b/indra/cmake/GLOD.cmake index d688db2fe..73881e17a 100644 --- a/indra/cmake/GLOD.cmake +++ b/indra/cmake/GLOD.cmake @@ -7,10 +7,8 @@ set(GLOD_FIND_REQUIRED ON) if (STANDALONE) include(FindGLOD) else (STANDALONE) - use_prebuilt_binary(GLOD) - set(GLOD_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) - set(GLOD_LIBRARIES glod) + use_prebuilt_binary(glod) + + set(GLOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glod) + set(GLOD_LIBRARIES GLOD) endif (STANDALONE) diff --git a/indra/cmake/GStreamer010Plugin.cmake b/indra/cmake/GStreamer010Plugin.cmake index 9fdf60eba..c9b071d1e 100644 --- a/indra/cmake/GStreamer010Plugin.cmake +++ b/indra/cmake/GStreamer010Plugin.cmake @@ -1,30 +1,9 @@ # -*- cmake -*- include(Prebuilt) - -if (STANDALONE) include(FindPkgConfig) - pkg_check_modules(GSTREAMER010 REQUIRED gstreamer-0.10) pkg_check_modules(GSTREAMER010_PLUGINS_BASE REQUIRED gstreamer-plugins-base-0.10) -else (STANDALONE) - - # Possibly libxml and glib should have their own .cmake file instead... - use_prebuilt_binary(glib) # gstreamer needs glib - use_prebuilt_binary(libxml) - use_prebuilt_binary(gstreamer) - set(GSTREAMER010_FOUND ON FORCE BOOL) - set(GSTREAMER010_PLUGINS_BASE_FOUND ON FORCE BOOL) - set(GSTREAMER010_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/gstreamer-0.10 - ${LIBS_PREBUILT_DIR}/includeg/lib-2.0 - ${LIBS_PREBUILT_DIR}/include/libxml2 - ${LIBS_PREBUILT_LEGACY_DIR}/include/gstreamer-0.10 - ${LIBS_PREBUILT_LEGACY_DIR}/include/glib-2.0 - ${LIBS_PREBUILT_LEGACY_DIR}/include/libxml2 - ) - -endif (STANDALONE) if (WINDOWS) # We don't need to explicitly link against gstreamer itself, because diff --git a/indra/cmake/Hunspell.cmake b/indra/cmake/Hunspell.cmake index 3ea97afdf..25b06092b 100644 --- a/indra/cmake/Hunspell.cmake +++ b/indra/cmake/Hunspell.cmake @@ -4,16 +4,12 @@ include(Prebuilt) if (STANDALONE) include(FindHunSpell) else (STANDALONE) - use_prebuilt_binary(hunspell) - - set(HUNSPELL_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include/hunspell - ${LIBS_PREBUILT_LEGACY_DIR}/include/hunspell - ) + use_prebuilt_binary(libhunspell) - if (LINUX OR DARWIN) - set(HUNSPELL_LIBRARY hunspell-1.3) - else (LINUX OR DARWIN) - set(HUNSPELL_LIBRARY libhunspell) - endif (LINUX OR DARWIN) + if (LINUX OR DARWIN) + set(HUNSPELL_LIBRARY hunspell-1.3) + else (LINUX OR DARWIN) + set(HUNSPELL_LIBRARY libhunspell) + endif (LINUX OR DARWIN) + set(HUNSPELL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/hunspell) endif (STANDALONE) diff --git a/indra/cmake/JPEG.cmake b/indra/cmake/JPEG.cmake index 2fe1beb51..fd04fcce1 100644 --- a/indra/cmake/JPEG.cmake +++ b/indra/cmake/JPEG.cmake @@ -19,8 +19,5 @@ else (STANDALONE) elseif (WINDOWS) set(JPEG_LIBRARIES jpeglib) endif (LINUX) - set(JPEG_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (STANDALONE) diff --git a/indra/cmake/JsonCpp.cmake b/indra/cmake/JsonCpp.cmake index 3ab859d4d..4bde364ce 100644 --- a/indra/cmake/JsonCpp.cmake +++ b/indra/cmake/JsonCpp.cmake @@ -10,22 +10,13 @@ if (STANDALONE) else (STANDALONE) use_prebuilt_binary(jsoncpp) if (WINDOWS) - if(MSVC12) - set(JSONCPP_LIBRARIES - debug json_vc${MSVC_SUFFIX}debug_libmt.lib - optimized json_vc${MSVC_SUFFIX}_libmt) - else(MSVC12) - set(JSONCPP_LIBRARIES - debug json_vc${MSVC_SUFFIX}d - optimized json_vc${MSVC_SUFFIX}) - endif(MSVC12) + set(JSONCPP_LIBRARIES + debug jsoncppd.lib + optimized jsoncpp.lib) elseif (DARWIN) set(JSONCPP_LIBRARIES json_linux-gcc-4.0.1_libmt) elseif (LINUX) set(JSONCPP_LIBRARIES jsoncpp) endif (WINDOWS) - set(JSONCPP_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include/jsoncpp - ${LIBS_PREBUILT_LEGACY_DIR}/include/jsoncpp - ) + set(JSONCPP_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/) endif (STANDALONE) diff --git a/indra/cmake/LLAudio.cmake b/indra/cmake/LLAudio.cmake index 440032967..1f5fd63ed 100644 --- a/indra/cmake/LLAudio.cmake +++ b/indra/cmake/LLAudio.cmake @@ -1,6 +1,7 @@ # -*- cmake -*- include(Audio) +include(OPENAL) set(LLAUDIO_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llaudio diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake index b1bb1b6a9..6cc325495 100644 --- a/indra/cmake/LLCommon.cmake +++ b/indra/cmake/LLCommon.cmake @@ -28,7 +28,7 @@ else (LINUX) set(LLCOMMON_LIBRARIES llcommon) endif (LINUX) -set(LLCOMMON_LINK_SHARED ON CACHE BOOL "Build the llcommon target as a shared library.") +set(LLCOMMON_LINK_SHARED OFF CACHE BOOL "Build the llcommon target as a shared library.") if(LLCOMMON_LINK_SHARED) add_definitions(-DLL_COMMON_LINK_SHARED=1) endif(LLCOMMON_LINK_SHARED) diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index dd1d806d5..ee465dc8b 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -1,22 +1,32 @@ # -*- cmake -*- +# these should be moved to their own cmake file +include(Prebuilt) +include(Boost) include(Colladadom) + +use_prebuilt_binary(libxml2) + set(LLPRIMITIVE_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llprimitive ${COLLADADOM_INCLUDE_DIRS} ) if (WINDOWS) - set(LLPRIMITIVE_LIBRARIES - debug llprimitive - optimized llprimitive - ${COLLADADOM_LIBRARIES} - ) + set(LLPRIMITIVE_LIBRARIES + llprimitive + ${COLLADADOM_LIBRARIES} + libxml2_a + ${BOOST_SYSTEM_LIBRARIES} + ) else (WINDOWS) - set(LLPRIMITIVE_LIBRARIES - llprimitive - ${COLLADADOM_LIBRARIES} - ) + set(LLPRIMITIVE_LIBRARIES + llprimitive + ${COLLADADOM_LIBRARIES} + ${BOOST_SYSTEM_LIBRARIES} + minizip + xml2 + ) endif (WINDOWS) diff --git a/indra/cmake/LLQtWebkit.cmake b/indra/cmake/LLQtWebkit.cmake deleted file mode 100644 index cec7e22e9..000000000 --- a/indra/cmake/LLQtWebkit.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -*- cmake -*- - -if (STANDALONE) - set(LLQTWEBKIT_INCLUDE_DIR - ${LIBS_OPEN_DIR}/llqtwebkit - ) - - set(LLQTWEBKIT_LIBRARY - llqtwebkit - ) -endif (STANDALONE) diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake index 982b2d3f7..4ba1d4c02 100644 --- a/indra/cmake/LLSharedLibs.cmake +++ b/indra/cmake/LLSharedLibs.cmake @@ -1,13 +1,12 @@ # ll_deploy_sharedlibs_command # target_exe: the cmake target of the executable for which the shared libs will be deployed. macro(ll_deploy_sharedlibs_command target_exe) - SET(OUTPUT_PATH $) - + set(OUTPUT_PATH $) + if(DARWIN) SET_TEST_PATH(SEARCH_DIRS) get_target_property(IS_BUNDLE ${target_exe} MACOSX_BUNDLE) if(IS_BUNDLE) - # If its a bundle the exe is not in the target location, this should find it. set(OUTPUT_PATH ${OUTPUT_PATH}/../Resources) endif(IS_BUNDLE) elseif(WINDOWS) @@ -38,8 +37,7 @@ macro(ll_stage_sharedlib DSO_TARGET) # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests. set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR}) if(NOT WINDOWS) - - SET(DSO_PATH $) + get_target_property(DSO_PATH ${DSO_TARGET} LOCATION) get_filename_component(DSO_FILE ${DSO_PATH} NAME) if(DARWIN) set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources) diff --git a/indra/cmake/LLWindow.cmake b/indra/cmake/LLWindow.cmake index c5de9d269..fee7f288c 100644 --- a/indra/cmake/LLWindow.cmake +++ b/indra/cmake/LLWindow.cmake @@ -14,18 +14,10 @@ if (STANDALONE) ) else (STANDALONE) if (LINUX) - use_prebuilt_binary(mesa) use_prebuilt_binary(SDL) set (SDL_FOUND TRUE) - set (SDL_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) - if(WORD_SIZE EQUAL 64) - set (SDL_LIBRARY SDL) - else(WORD_SIZE EQUAL 64) - set (SDL_LIBRARY SDL directfb fusion direct) - endif(WORD_SIZE EQUAL 64) + set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) + set (SDL_LIBRARY SDL) endif (LINUX) endif (STANDALONE) diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index a0ce0f6f1..43ec796dd 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -1,42 +1,50 @@ # -*- cmake -*- + if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") include(Variables) -if (NOT STANDALONE) +set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) +set(ARCH_PREBUILT_DIRS_PLUGINS ${AUTOBUILD_INSTALL_DIR}/plugins) +set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release) +set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug) +if (WINDOWS) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) +elseif (LINUX) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib) + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin) +elseif (DARWIN) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) + set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs") +endif (WINDOWS) - if(CMAKE_BUILD_TYPE) - string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) - endif(CMAKE_BUILD_TYPE) +# Autobuild packages must provide 'release' versions of libraries, but may provide versions for +# specific build types. AUTOBUILD_LIBS_INSTALL_DIRS lists first the build type directory and then +# the 'release' directory (as a default fallback). +# *NOTE - we have to take special care to use CMAKE_CFG_INTDIR on IDE generators (like mac and +# windows) and CMAKE_BUILD_TYPE on Makefile based generators (like linux). The reason for this is +# that CMAKE_BUILD_TYPE is essentially meaningless at configuration time for IDE generators and +# CMAKE_CFG_INTDIR is meaningless at build time for Makefile generators +if(WINDOWS OR DARWIN) + # the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us + # fortunately both windows and darwin are case insensitive filesystems so this works. + set(AUTOBUILD_LIBS_INSTALL_DIRS "${AUTOBUILD_INSTALL_DIR}/lib/") +else(WINDOWS OR DARWIN) + # else block is for linux and any other makefile based generators + string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) + set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER}) +endif(WINDOWS OR DARWIN) - if(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode") - # the cmake xcode and VS generators implicitly append ${CMAKE_CFG_INTDIR} to the library paths for us - # fortunately both windows and darwin are case insensitive filesystems so this works. - set(ARCH_PREBUILT_LINK_DIRS - ${LIBS_PREBUILT_DIR}/lib - ${LIBS_PREBUILT_LEGACY_DIR}/lib - ) - else(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode") - # else block is for linux and any other makefile based generators - set(ARCH_PREBUILT_LINK_DIRS - ${LIBS_PREBUILT_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER} - ${LIBS_PREBUILT_LEGACY_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER} - ) - endif(WINDOWS OR ${CMAKE_GENERATOR} MATCHES "Xcode") +if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") + # When we're building something other than Release, append the + # packages/lib/release directory to deal with autobuild packages that don't + # provide (e.g.) lib/debug libraries. + list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE}) +endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") - if (NOT "${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release") - # When we're building something other than Release, append the - # packages/lib/release directory to deal with autobuild packages that don't - # provide (e.g.) lib/debug libraries. - list(APPEND ARCH_PREBUILT_LINK_DIRS - ${LIBS_PREBUILT_DIR}/lib/release - ${LIBS_PREBUILT_LEGACY_DIR}/lib/release - ) - endif (NOT "${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release") -endif (NOT STANDALONE) - -link_directories(${ARCH_PREBUILT_LINK_DIRS}) +link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS}) if (LINUX) set(DL_LIBRARY dl) @@ -46,10 +54,11 @@ else (LINUX) set(PTHREAD_LIBRARY "") endif (LINUX) -if (WINDOWS) +if (WINDOWS) set(WINDOWS_LIBRARIES advapi32 shell32 + ole32 ws2_32 mswsock psapi diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index d7fb4e686..20c1e9787 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -7,7 +7,11 @@ if (STANDALONE) message(STATUS "Building without N-DoF joystick support") endif(NOT NDOF_FOUND) else (STANDALONE) - use_prebuilt_binary(ndofdev) + if (WINDOWS OR DARWIN) + use_prebuilt_binary(libndofdev) + elseif (LINUX) + use_prebuilt_binary(libndofdev-open) + endif (WINDOWS OR DARWIN) if (WINDOWS) set(NDOF_LIBRARY libndofdev) @@ -15,10 +19,11 @@ else (STANDALONE) set(NDOF_LIBRARY ndofdev) endif (WINDOWS) - set(NDOF_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include/ndofdev - ${LIBS_PREBUILT_LEGACY_DIR}/include/ndofdev - ) + if (WINDOWS) + set(NDOF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include) + else (WINDOWS) + set(NDOF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/ndofdev) + endif (WINDOWS) set(NDOF_FOUND 1) endif (STANDALONE) @@ -26,6 +31,8 @@ if (NDOF_FOUND) add_definitions(-DLIB_NDOF=1) include_directories(${NDOF_INCLUDE_DIR}) else (NDOF_FOUND) + message(STATUS "Building without N-DoF joystick support") set(NDOF_INCLUDE_DIR "") set(NDOF_LIBRARY "") endif (NDOF_FOUND) + diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 39ab8210d..7f98cbbc4 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -16,16 +16,13 @@ if (OPENAL) pkg_check_modules(OPENAL_LIB REQUIRED openal) pkg_check_modules(FREEALUT_LIB REQUIRED freealut) else (STANDALONE) - use_prebuilt_binary(openal-soft) + use_prebuilt_binary(openal) endif (STANDALONE) set(OPENAL_LIBRARIES openal alut ) - set(OPENAL_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + set(OPENAL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (OPENAL) if (OPENAL) diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake index d363e6af3..2860a800e 100644 --- a/indra/cmake/OpenSSL.cmake +++ b/indra/cmake/OpenSSL.cmake @@ -7,16 +7,13 @@ set(OpenSSL_FIND_REQUIRED ON) if (STANDALONE OR USE_SYSTEM_OPENSSL) include(FindOpenSSL) else (STANDALONE OR USE_SYSTEM_OPENSSL) - use_prebuilt_binary(openSSL) + use_prebuilt_binary(openssl) if (WINDOWS) set(OPENSSL_LIBRARIES ssleay32 libeay32) else (WINDOWS) set(OPENSSL_LIBRARIES ssl) endif (WINDOWS) - set(OPENSSL_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (STANDALONE OR USE_SYSTEM_OPENSSL) if (LINUX) diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake index fb71c3067..3d02a5e4f 100644 --- a/indra/cmake/PNG.cmake +++ b/indra/cmake/PNG.cmake @@ -9,11 +9,7 @@ if (STANDALONE) else (STANDALONE) use_prebuilt_binary(libpng) if (WINDOWS) - if(MSVC12) - set(PNG_LIBRARIES libpng16) - else(MSVC12) - set(PNG_LIBRARIES libpng15) - endif(MSVC12) + set(PNG_LIBRARIES libpng16) elseif(DARWIN) set(PNG_LIBRARIES png15) else(LINUX) @@ -36,15 +32,5 @@ else (STANDALONE) set(PNG_LIBRARIES png16) endif () endif() - if (WINDOWS) - set(PNG_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/${PNG_LIBRARIES} - ${LIBS_PREBUILT_LEGACY_DIR}/include/${PNG_LIBRARIES} - ) - else (WINDOWS) - set(PNG_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/lib${PNG_LIBRARIES} - ${LIBS_PREBUILT_LEGACY_DIR}/include/lib${PNG_LIBRARIES} - ) - endif (WINDOWS) + set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng16) endif (STANDALONE) diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake index 2295a7574..38e24f13d 100644 --- a/indra/cmake/Prebuilt.cmake +++ b/indra/cmake/Prebuilt.cmake @@ -3,14 +3,64 @@ if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES") +include(FindAutobuild) +include(Variables) +if(INSTALL_PROPRIETARY) + include(FindSCP) +endif(INSTALL_PROPRIETARY) + +set(PREBUILD_TRACKING_DIR ${AUTOBUILD_INSTALL_DIR}/cmake_tracking) +# For the library installation process; +# see cmake/Prebuild.cmake for the counterpart code. +if ("${CMAKE_SOURCE_DIR}/../autobuild.xml" IS_NEWER_THAN "${PREBUILD_TRACKING_DIR}/sentinel_installed") + file(MAKE_DIRECTORY ${PREBUILD_TRACKING_DIR}) + file(WRITE ${PREBUILD_TRACKING_DIR}/sentinel_installed "0") +endif ("${CMAKE_SOURCE_DIR}/../autobuild.xml" IS_NEWER_THAN "${PREBUILD_TRACKING_DIR}/sentinel_installed") + +# The use_prebuilt_binary macro handles automated installation of package +# dependencies using autobuild. The goal is that 'autobuild install' should +# only be run when we know we need to install a new package. This should be +# the case in a clean checkout, or if autobuild.xml has been updated since the +# last run (encapsulated by the file ${PREBUILD_TRACKING_DIR}/sentinel_installed), +# or if a previous attempt to install the package has failed (the exit status +# of previous attempts is serialized in the file +# ${PREBUILD_TRACKING_DIR}/${_binary}_installed) macro (use_prebuilt_binary _binary) - if(NOT STANDALONE) - get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT) - list(FIND PREBUILT_PACKAGES ${_binary} _index) - if(_index LESS 0) - set_property(TARGET prepare APPEND PROPERTY PREBUILT ${_binary}) - endif(_index LESS 0) - endif(NOT STANDALONE) + if (NOT DEFINED USESYSTEMLIBS_${_binary}) + set(USESYSTEMLIBS_${_binary} ${USESYSTEMLIBS}) + endif (NOT DEFINED USESYSTEMLIBS_${_binary}) + + if (NOT USESYSTEMLIBS_${_binary}) + if("${${_binary}_installed}" STREQUAL "" AND EXISTS "${PREBUILD_TRACKING_DIR}/${_binary}_installed") + file(READ ${PREBUILD_TRACKING_DIR}/${_binary}_installed "${_binary}_installed") + if(DEBUG_PREBUILT) + message(STATUS "${_binary}_installed: \"${${_binary}_installed}\"") + endif(DEBUG_PREBUILT) + endif("${${_binary}_installed}" STREQUAL "" AND EXISTS "${PREBUILD_TRACKING_DIR}/${_binary}_installed") + + if(${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0) + if(DEBUG_PREBUILT) + message("cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install + --install-dir=${AUTOBUILD_INSTALL_DIR} + ${_binary} ") + endif(DEBUG_PREBUILT) + execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}" + install + --install-dir=${AUTOBUILD_INSTALL_DIR} + -p ${AUTOBUILD_PLATFORM_NAME} + ${_binary} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE ${_binary}_installed + ) + file(WRITE ${PREBUILD_TRACKING_DIR}/${_binary}_installed "${${_binary}_installed}") + endif(${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0) + + if(NOT ${_binary}_installed EQUAL 0) + message(FATAL_ERROR + "Failed to download or unpack prebuilt '${_binary}'." + " Process returned ${${_binary}_installed}.") + endif (NOT ${_binary}_installed EQUAL 0) + endif (NOT USESYSTEMLIBS_${_binary}) endmacro (use_prebuilt_binary _binary) endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/PulseAudio.cmake b/indra/cmake/PulseAudio.cmake index 62e2bf9b2..360a97105 100644 --- a/indra/cmake/PulseAudio.cmake +++ b/indra/cmake/PulseAudio.cmake @@ -1,7 +1,7 @@ # -*- cmake -*- include(Prebuilt) -set(PULSEAUDIO ON CACHE BOOL "Build with PulseAudio support, if available.") +set(PULSEAUDIO OFF CACHE BOOL "Build with PulseAudio support, if available.") if (PULSEAUDIO) if (STANDALONE) @@ -13,9 +13,8 @@ if (PULSEAUDIO) use_prebuilt_binary(pulseaudio) set(PULSEAUDIO_FOUND ON FORCE BOOL) set(PULSEAUDIO_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + ${LIBS_PREBUILT_DIR}/include + ) # We don't need to explicitly link against pulseaudio itself, because # the viewer probes for the system's copy at runtime. set(PULSEAUDIO_LIBRARIES diff --git a/indra/cmake/Qt4.cmake b/indra/cmake/Qt4.cmake deleted file mode 100644 index 37d2799a2..000000000 --- a/indra/cmake/Qt4.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -if (STANDALONE) - set(Qt4_FIND_REQUIRED ON) - - include(FindQt4) - - find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtNetwork QtOpenGL QtWebKit REQUIRED) - include(${QT_USE_FILE}) - add_definitions(${QT_DEFINITIONS}) -endif (STANDALONE) diff --git a/indra/cmake/QuickTimePlugin.cmake b/indra/cmake/QuickTimePlugin.cmake index 171213d42..899a043e8 100644 --- a/indra/cmake/QuickTimePlugin.cmake +++ b/indra/cmake/QuickTimePlugin.cmake @@ -1,9 +1,11 @@ # -*- cmake -*- -if(INSTALL_PROPRIETARY) +if(INSTALL_PROPRIETARY OR USE_QUICKTIME_PREBUILT) include(Prebuilt) - use_prebuilt_binary(quicktime) -endif(INSTALL_PROPRIETARY) + if (WINDOWS) + use_prebuilt_binary(quicktime) + endif (WINDOWS) +endif(INSTALL_PROPRIETARY OR USE_QUICKTIME_PREBUILT) if (DARWIN) include(CMakeFindFrameworks) @@ -23,15 +25,13 @@ elseif (WINDOWS AND WORD_SIZE EQUAL 32) find_library(DEBUG_QUICKTIME_LIBRARY qtmlclient PATHS - ${LIBS_PREBUILT_DIR}/lib/debug - ${LIBS_PREBUILT_LEGACY_DIR}/lib/debug + ${ARCH_PREBUILT_DIRS_DEBUG} "${QUICKTIME_SDK_DIR}\\libraries" ) find_library(RELEASE_QUICKTIME_LIBRARY qtmlclient PATHS - ${LIBS_PREBUILT_DIR}/lib/release - ${LIBS_PREBUILT_LEGACY_DIR}/lib/release + ${ARCH_PREBUILT_DIRS_RELEASE} "${QUICKTIME_SDK_DIR}\\libraries" ) @@ -45,7 +45,6 @@ elseif (WINDOWS AND WORD_SIZE EQUAL 32) include_directories( ${LIBS_PREBUILT_DIR}/include/quicktime - ${LIBS_PREBUILT_LEGACY_DIR}/include/quicktime "${QUICKTIME_SDK_DIR}\\CIncludes" ) endif (DARWIN) diff --git a/indra/cmake/TemplateCheck.cmake b/indra/cmake/TemplateCheck.cmake index 3b73dc82d..2fada2eda 100644 --- a/indra/cmake/TemplateCheck.cmake +++ b/indra/cmake/TemplateCheck.cmake @@ -8,7 +8,7 @@ macro (check_message_template _target) PRE_LINK COMMAND ${PYTHON_EXECUTABLE} ARGS ${SCRIPTS_DIR}/template_verifier.py - --mode=development --cache_master - COMMENT "Verifying message template" + --mode=development --cache_master --master_url=${TEMPLATE_VERIFIER_MASTER_URL} ${TEMPLATE_VERIFIER_OPTIONS} + COMMENT "Verifying message template - See http://wiki.secondlife.com/wiki/Template_verifier.py" ) endmacro (check_message_template) diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake index 697ac4288..a6ee77d7f 100644 --- a/indra/cmake/UI.cmake +++ b/indra/cmake/UI.cmake @@ -1,5 +1,6 @@ # -*- cmake -*- include(Prebuilt) +include(FreeType) if (STANDALONE) include(FindPkgConfig) @@ -32,11 +33,10 @@ if (STANDALONE) endforeach(pkg) else (STANDALONE) if (LINUX) - use_prebuilt_binary(glib) # gtk-etc needs glib use_prebuilt_binary(gtk-atk-pango-glib) set(UI_LIBRARIES atk-1.0 - X11 + cairo gdk-x11-2.0 gdk_pixbuf-2.0 Xinerama @@ -48,25 +48,19 @@ else (STANDALONE) gtk-x11-2.0 pango-1.0 pangoft2-1.0 - pangox-1.0 pangoxft-1.0 pangocairo-1.0 + pixman-1 + X11 + ${FREETYPE_LIBRARIES} ) endif (LINUX) include_directories ( - ${LIBS_PREBUILT_DIR}/packages/include - ${LIBS_PREBUILT_DIR}/packages/include/cairo - ${LIBS_PREBUILT_DIR}/packages/include/pixman-1 - ${LIBS_PREBUILT_LEGACY_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include/cairo - ${LIBS_PREBUILT_LEGACY_DIR}/include/pixman-1 + ${LIBS_PREBUILT_DIR}/include ) foreach(include ${${LL_ARCH}_INCLUDES}) - include_directories( - ${LIBS_PREBUILT_DIR}/include/${include} - ${LIBS_PREBUILT_LEGACY_DIR}/include/${include} - ) + include_directories(${LIBS_PREBUILT_DIR}/include/${include}) endforeach(include) endif (STANDALONE) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 5b9890d5b..ed2f43e01 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -23,26 +23,62 @@ set(LIBS_CLOSED_PREFIX) set(LIBS_OPEN_PREFIX) set(SCRIPTS_PREFIX ../scripts) set(VIEWER_PREFIX) +set(INTEGRATION_TESTS_PREFIX) +set(LL_TESTS OFF CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation)") + +# Compiler and toolchain options +set(DISABLE_TCMALLOC OFF CACHE BOOL "Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)") +set(DISABLE_FATAL_WARNINGS TRUE CACHE BOOL "Set this to FALSE to enable fatal warnings.") +option(INCREMENTAL_LINK "Use incremental linking or incremental LTCG for LTO on win32 builds (enable for faster links on some machines)" OFF) +option(USE_LTO "Enable Whole Program Optimization and related folding and binary reduction routines" OFF) + +if(LIBS_CLOSED_DIR) + file(TO_CMAKE_PATH "${LIBS_CLOSED_DIR}" LIBS_CLOSED_DIR) +else(LIBS_CLOSED_DIR) + set(LIBS_CLOSED_DIR ${CMAKE_SOURCE_DIR}/${LIBS_CLOSED_PREFIX}) +endif(LIBS_CLOSED_DIR) +if(LIBS_COMMON_DIR) + file(TO_CMAKE_PATH "${LIBS_COMMON_DIR}" LIBS_COMMON_DIR) +else(LIBS_COMMON_DIR) + set(LIBS_COMMON_DIR ${CMAKE_SOURCE_DIR}/${LIBS_OPEN_PREFIX}) +endif(LIBS_COMMON_DIR) +set(LIBS_OPEN_DIR ${LIBS_COMMON_DIR}) -set(LIBS_CLOSED_DIR ${CMAKE_SOURCE_DIR}/${LIBS_CLOSED_PREFIX}) -set(LIBS_OPEN_DIR ${CMAKE_SOURCE_DIR}/${LIBS_OPEN_PREFIX}) set(SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/${SCRIPTS_PREFIX}) set(VIEWER_DIR ${CMAKE_SOURCE_DIR}/${VIEWER_PREFIX}) -set(DISABLE_TCMALLOC OFF CACHE BOOL "Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc)") -set(LL_TESTS OFF CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation)") -set(DISABLE_FATAL_WARNINGS TRUE CACHE BOOL "Set this to FALSE to enable fatal warnings.") + +set(AUTOBUILD_INSTALL_DIR ${CMAKE_BINARY_DIR}/packages) + +set(LIBS_PREBUILT_DIR ${AUTOBUILD_INSTALL_DIR} CACHE PATH + "Location of prebuilt libraries.") + +if (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake) + # We use this as a marker that you can try to use the proprietary libraries. + set(INSTALL_PROPRIETARY ON CACHE BOOL "Install proprietary binaries") +endif (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake) +set(TEMPLATE_VERIFIER_OPTIONS "" CACHE STRING "Options for scripts/template_verifier.py") +set(TEMPLATE_VERIFIER_MASTER_URL "http://bitbucket.org/lindenlab/master-message-template/raw/tip/message_template.msg" CACHE STRING "Location of the master message template") + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING + "Build type. One of: Debug Release RelWithDebInfo" FORCE) +endif (NOT CMAKE_BUILD_TYPE) if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(WINDOWS ON BOOL FORCE) - if (WORD_SIZE EQUAL 32) - set(ARCH i686) + if (WORD_SIZE EQUAL 64) + set(ARCH x86_64 CACHE STRING "Viewer Architecture") + set(LL_ARCH ${ARCH}_win64) + set(LL_ARCH_DIR ${ARCH}-win64) + set(WORD_SIZE 64) + set(AUTOBUILD_PLATFORM_NAME "windows64") + else (WORD_SIZE EQUAL 64) + set(ARCH i686 CACHE STRING "Viewer Architecture") set(LL_ARCH ${ARCH}_win32) set(LL_ARCH_DIR ${ARCH}-win32) - elseif (WORD_SIZE EQUAL 64) - set(ARCH x86_64) - set(LL_ARCH ${ARCH}_win) - set(LL_ARCH_DIR ${ARCH}-win) - endif (WORD_SIZE EQUAL 32) + set(WORD_SIZE 32) + set(AUTOBUILD_PLATFORM_NAME "windows") + endif (WORD_SIZE EQUAL 64) endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -51,17 +87,26 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # If someone has specified a word size, use that to determine the # architecture. Otherwise, let the architecture specify the word size. if (WORD_SIZE EQUAL 32) + #message(STATUS "WORD_SIZE is 32") set(ARCH i686) + set(AUTOBUILD_PLATFORM_NAME "linux") elseif (WORD_SIZE EQUAL 64) + #message(STATUS "WORD_SIZE is 64") set(ARCH x86_64) + set(AUTOBUILD_PLATFORM_NAME "linux64") else (WORD_SIZE EQUAL 32) - if(CMAKE_SIZEOF_VOID_P MATCHES 4) - set(ARCH i686) - set(WORD_SIZE 32) - else(CMAKE_SIZEOF_VOID_P MATCHES 4) - set(ARCH x86_64) + #message(STATUS "WORD_SIZE is UNDEFINED") + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + message(STATUS "Size of void pointer is detected as 8; ARCH is 64-bit") set(WORD_SIZE 64) - endif(CMAKE_SIZEOF_VOID_P MATCHES 4) + set(AUTOBUILD_PLATFORM_NAME "linux64") + elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) + message(STATUS "Size of void pointer is detected as 4; ARCH is 32-bit") + set(WORD_SIZE 32) + set(AUTOBUILD_PLATFORM_NAME "linux") + else() + message(FATAL_ERROR "Unkown Architecture!") + endif (CMAKE_SIZEOF_VOID_P EQUAL 8) endif (WORD_SIZE EQUAL 32) if (NOT STANDALONE AND MULTIARCH_HACK) @@ -98,25 +143,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") COMMAND sh -c "xcodebuild -version | grep Xcode | cut -d ' ' -f2 | cut -d'.' -f1-2" OUTPUT_VARIABLE XCODE_VERSION ) string(REGEX REPLACE "(\r?\n)+$" "" XCODE_VERSION "${XCODE_VERSION}") - -# # To support a different SDK update these Xcode settings: -# if (XCODE_VERSION GREATER 4.9) # (Which would be 5.0+) -# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) -# set(CMAKE_OSX_SYSROOT macosx10.9) -# else (XCODE_VERION GREATER 4.9) -# if (XCODE_VERSION GREATER 4.5) -# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7) -# set(CMAKE_OSX_SYSROOT macosx10.8) -# else (XCODE_VERSION GREATER 4.5) -# if (XCODE_VERSION GREATER 4.2) -# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6) -# set(CMAKE_OSX_SYSROOT macosx10.7) -# else (XCODE_VERSION GREATER 4.2) -# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6) -# set(CMAKE_OSX_SYSROOT macosx10.7) -# endif (XCODE_VERSION GREATER 4.2) -# endif (XCODE_VERSION GREATER 4.5) -# endif (XCODE_VERSION GREATER 4.9) # Hardcode SDK we build against until we can test and allow newer ones # as autodetected in the code above @@ -151,38 +177,19 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(LL_ARCH_DIR universal-darwin) endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -set(LIBS_PREBUILT_DIR ${CMAKE_BINARY_DIR}/packages CACHE PATH - "Location of prebuilt libraries.") - -set(LIBS_PREBUILT_LEGACY_DIR ${CMAKE_BINARY_DIR}/packages/libraries/${LL_ARCH_DIR} CACHE PATH - "Legacy location of prebuilt libraries.") - -if (WINDOWS AND WORD_SIZE EQUAL 32) - set(PREBUILT_TYPE windows) -elseif (WINDOWS AND WORD_SIZE EQUAL 64) - set(PREBUILT_TYPE windows64) -elseif(DARWIN) - set(PREBUILT_TYPE darwin) -elseif(LINUX AND WORD_SIZE EQUAL 32) - set(PREBUILT_TYPE linux) -elseif(LINUX AND WORD_SIZE EQUAL 64) - set(PREBUILT_TYPE linux64) -endif(WINDOWS AND WORD_SIZE EQUAL 32) - # Default deploy grid set(GRID agni CACHE STRING "Target Grid") -set(VIEWER_CHANNEL "Singularity" CACHE STRING "Viewer Channel Name") -set(VIEWER_LOGIN_CHANNEL "${VIEWER_CHANNEL}" CACHE STRING "Fake login channel for A/B Testing") -set(VIEWER_BRANDING_ID "singularity" CACHE STRING "Viewer branding id (currently secondlife|snowglobe)") +set(VIEWER_CHANNEL "Singularity Test" CACHE STRING "Viewer Channel Name") -# *TODO: break out proper Branding-secondlife.cmake, Branding-snowglobe.cmake, etc -string(REGEX REPLACE " +" "" VIEWER_CHANNEL_ONE_WORD "${VIEWER_CHANNEL}") -set(VIEWER_BRANDING_NAME "${VIEWER_CHANNEL_ONE_WORD}") -set(VIEWER_BRANDING_NAME_CAMELCASE "${VIEWER_CHANNEL_ONE_WORD}") +set(ENABLE_SIGNING OFF CACHE BOOL "Enable signing the viewer") +set(SIGNING_IDENTITY "" CACHE STRING "Specifies the signing identity to use, if necessary.") +set(VERSION_BUILD "0" CACHE STRING "Revision number passed in from the outside") set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.") +set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header directives where supported.") + source_group("CMake Rules" FILES CMakeLists.txt) endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index 275b840a0..71bf0bd0b 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -2,12 +2,8 @@ include(Prebuilt) if (NOT STANDALONE) - use_prebuilt_binary(vivox) + use_prebuilt_binary(slvoice) if(LINUX) - use_prebuilt_binary(libuuid) - if (${ARCH} STREQUAL "x86_64") - use_prebuilt_binary(32bitcompatibilitylibs) - endif (${ARCH} STREQUAL "x86_64") use_prebuilt_binary(fontconfig) endif(LINUX) else (NOT STANDALONE) diff --git a/indra/cmake/WebKitLibPlugin.cmake b/indra/cmake/WebKitLibPlugin.cmake deleted file mode 100644 index 8551aa163..000000000 --- a/indra/cmake/WebKitLibPlugin.cmake +++ /dev/null @@ -1,64 +0,0 @@ -# -*- cmake -*- -include(Linking) -include(Prebuilt) -include(LLQtWebkit) -include(Qt4) - -if (STANDALONE) - set(WEBKITLIBPLUGIN OFF CACHE BOOL - "WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.") -else (STANDALONE) - use_prebuilt_binary(llqtwebkit) - set(WEBKITLIBPLUGIN ON CACHE BOOL - "WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.") -endif (STANDALONE) - -if (WINDOWS) - set(WEBKIT_PLUGIN_LIBRARIES - debug llqtwebkitd - debug QtWebKitd4 - debug QtOpenGLd4 - debug QtNetworkd4 - debug QtGuid4 - debug QtCored4 - debug qtmaind - optimized llqtwebkit - optimized QtWebKit4 - optimized QtOpenGL4 - optimized QtNetwork4 - optimized QtGui4 - optimized QtCore4 - optimized qtmain - ) -elseif (DARWIN) - set(WEBKIT_PLUGIN_LIBRARIES - debug libllqtwebkit.dylib - optimized libllqtwebkit.dylib - ) -elseif (LINUX) - if (STANDALONE) - set(WEBKIT_PLUGIN_LIBRARIES ${LLQTWEBKIT_LIBRARY} ${QT_LIBRARIES} ${QT_PLUGIN_LIBRARIES}) - else (STANDALONE) - set(WEBKIT_PLUGIN_LIBRARIES - llqtwebkit - QtWebKit - QtOpenGL - QtNetwork - QtGui - QtCore - crypto - ssl -# qgif -# qjpeg - jpeg - fontconfig - X11 - Xrender - Xext - GL - ) - if (CMAKE_SIZEOF_VOID_P EQUAL 4) # Singu TODO: update webkit - set(WEBKIT_PLUGIN_LIBRARIES ${WEBKIT_PLUGIN_LIBRARIES} jscore) - endif (CMAKE_SIZEOF_VOID_P EQUAL 4) - endif (STANDALONE) -endif (WINDOWS) diff --git a/indra/cmake/WinManifest.cmake b/indra/cmake/WinManifest.cmake new file mode 100644 index 000000000..39f4def75 --- /dev/null +++ b/indra/cmake/WinManifest.cmake @@ -0,0 +1,17 @@ +# - Embeds a specific manifest file in a Windows binary +# Defines the following: +# EMBED_MANIFEST - embed manifest in a windows binary with mt +# Parameters - _target is the target file, type - 1 for EXE, 2 for DLL + + MACRO(EMBED_MANIFEST _target type) + ADD_CUSTOM_COMMAND( + TARGET ${_target} + POST_BUILD + COMMAND "mt.exe" + ARGS + -manifest \"${CMAKE_SOURCE_DIR}\\tools\\manifests\\compatibility.manifest\" + -inputresource:\"$\"\;\#${type} + -outputresource:\"$\"\;\#${type} + COMMENT "Adding compatibility manifest to ${_target}" + ) + ENDMACRO(EMBED_MANIFEST _target type) diff --git a/indra/cmake/XmlRpcEpi.cmake b/indra/cmake/XmlRpcEpi.cmake index 2c93fd20c..5d59c90db 100644 --- a/indra/cmake/XmlRpcEpi.cmake +++ b/indra/cmake/XmlRpcEpi.cmake @@ -8,9 +8,13 @@ if (STANDALONE) include(FindXmlRpcEpi) else (STANDALONE) use_prebuilt_binary(xmlrpc-epi) - set(XMLRPCEPI_LIBRARIES xmlrpc-epi) - set(XMLRPCEPI_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include - ${LIBS_PREBUILT_LEGACY_DIR}/include - ) + if (WINDOWS) + set(XMLRPCEPI_LIBRARIES + debug xmlrpc-epid + optimized xmlrpc-epi + ) + else (WINDOWS) + set(XMLRPCEPI_LIBRARIES xmlrpc-epi) + endif (WINDOWS) + set(XMLRPCEPI_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) endif (STANDALONE) diff --git a/indra/cmake/ZLIB.cmake b/indra/cmake/ZLIB.cmake index 3384c55ee..5b38fc1af 100644 --- a/indra/cmake/ZLIB.cmake +++ b/indra/cmake/ZLIB.cmake @@ -13,13 +13,25 @@ else (STANDALONE) set(ZLIB_LIBRARIES debug zlibd optimized zlib) + elseif (LINUX) + # + # When we have updated static libraries in competition with older + # shared libraries and we want the former to win, we need to do some + # extra work. The *_PRELOAD_ARCHIVES settings are invoked early + # and will pull in the entire archive to the binary giving it + # priority in symbol resolution. Beware of cmake moving the + # achive load itself to another place on the link command line. If + # that happens, you can try something like -Wl,-lz here to hide + # the archive. Also be aware that the linker will not tolerate a + # second whole-archive load of the archive. See viewer's + # CMakeLists.txt for more information. + # + set(ZLIB_PRELOAD_ARCHIVES -Wl,--whole-archive z -Wl,--no-whole-archive) + set(ZLIB_LIBRARIES z) else (WINDOWS) set(ZLIB_LIBRARIES z) endif (WINDOWS) if (WINDOWS OR LINUX) - set(ZLIB_INCLUDE_DIRS - ${LIBS_PREBUILT_DIR}/include/zlib - ${LIBS_PREBUILT_LEGACY_DIR}/include/zlib - ) + set(ZLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/zlib) endif (WINDOWS OR LINUX) endif (STANDALONE) diff --git a/indra/cmake/cmake_dummy.cpp b/indra/cmake/cmake_dummy.cpp index 25191e2a1..ae4475a73 100644 --- a/indra/cmake/cmake_dummy.cpp +++ b/indra/cmake/cmake_dummy.cpp @@ -1,30 +1,24 @@ /** * @file cmake_dummy.cpp * - * $LicenseInfo:firstyear=2008&license=viewergpl$ - * - * Copyright (c) 2008-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/copy_win_scripts/start-client.py b/indra/copy_win_scripts/start-client.py index 5f7ff2f29..5699f5273 100644 --- a/indra/copy_win_scripts/start-client.py +++ b/indra/copy_win_scripts/start-client.py @@ -1,4 +1,28 @@ #!/usr/bin/env python +"""\ +@file start-client.py + +$LicenseInfo:firstyear=2010&license=viewerlgpl$ +Second Life Viewer Source Code +Copyright (C) 2010-2011, Linden Research, Inc. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; +version 2.1 of the License only. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +$/LicenseInfo$ +""" import sys, getopt import os import llstart diff --git a/indra/develop.py b/indra/develop.py deleted file mode 100755 index 018003c87..000000000 --- a/indra/develop.py +++ /dev/null @@ -1,941 +0,0 @@ -#!/usr/bin/env python -# -# @file develop.py -# @authors Bryan O'Sullivan, Mark Palange, Aaron Brashears -# @brief Fire and forget script to appropriately configure cmake for SL. -# -# $LicenseInfo:firstyear=2007&license=viewergpl$ -# -# Copyright (c) 2007-2009, Linden Research, Inc. -# -# Second Life Viewer Source Code -# The source code in this file ("Source Code") is provided by Linden Lab -# to you under the terms of the GNU General Public License, version 2.0 -# ("GPL"), unless you have obtained a separate licensing agreement -# ("Other License"), formally executed by you and Linden Lab. Terms of -# the GPL can be found in doc/GPL-license.txt in this distribution, or -# online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 -# -# There are special exceptions to the terms and conditions of the GPL as -# it is applied to this Source Code. View the full text of the exception -# in the file doc/FLOSS-exception.txt in this software distribution, or -# online at -# http://secondlifegrid.net/programs/open_source/licensing/flossexception -# -# By copying, modifying or distributing this software, you acknowledge -# that you have read and understood your obligations described above, -# and agree to abide by those obligations. -# -# ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO -# WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, -# COMPLETENESS OR PERFORMANCE. -# $/LicenseInfo$ - - -import errno -import getopt -import os -import random -import re -import shutil -import socket -import sys -import commands -import shlex - -class CommandError(Exception): - pass - -def mkdir(path): - try: - os.mkdir(path) - return path - except OSError, err: - if err.errno != errno.EEXIST or not os.path.isdir(path): - raise - -def prettyprint_path_for_cmake(path): - if 'a' <= path[0] <= 'z' and path[1] == ':': - # CMake wants DOS drive letters to be in uppercase. The above - # condition never asserts on platforms whose full path names - # always begin with a slash, so we don't need to test whether - # we are running on Windows. - path = path[0].upper() + path[1:] - return path - -def getcwd(): - return prettyprint_path_for_cmake(os.getcwd()) - -source_indra = prettyprint_path_for_cmake(os.path.dirname(os.path.realpath(__file__))) - -def quote(opts): - return '"' + '" "'.join([ opt.replace('"', '') for opt in opts ]) + '"' - -class PlatformSetup(object): - generator = None - build_types = {} - for t in ('Debug', 'Release', 'RelWithDebInfo'): - build_types[t.lower()] = t - - build_type = build_types['relwithdebinfo'] - standalone = 'OFF' - unattended = 'OFF' - universal = 'OFF' - project_name = 'Singularity' - distcc = True - cmake_opts = [] - word_size = 32 - using_express = False - - def __init__(self): - self.script_dir = os.path.realpath( - os.path.dirname(__import__(__name__).__file__)) - - def os(self): - '''Return the name of the OS.''' - - raise NotImplemented('os') - - def arch(self): - '''Return the CPU architecture.''' - - return None - - def platform(self): - '''Return a stringified two-tuple of the OS name and CPU - architecture.''' - - ret = self.os() - if self.arch(): - ret += '-' + self.arch() - return ret - - def build_dirs(self): - '''Return the top-level directories in which builds occur. - This can return more than one directory, e.g. if doing a - 32-bit viewer and server build on Linux.''' - - if(os.path.basename(os.path.normpath(os.getcwd())) == 'indra'): - prefix = '../' - else: - prefix = '' - - return [prefix+'build-' + self.platform()] - - def cmake_commandline(self, src_dir, build_dir, opts, simple): - '''Return the command line to run cmake with.''' - - args = dict( - dir=src_dir, - generator=self.generator, - opts=quote(opts), - standalone=self.standalone, - unattended=self.unattended, - word_size=self.word_size, - type=self.build_type.upper(), - ) - #if simple: - # return 'cmake %(opts)s %(dir)r' % args - return ('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s ' - '-DSTANDALONE:BOOL=%(standalone)s ' - '-DUNATTENDED:BOOL=%(unattended)s ' - '-DWORD_SIZE:STRING=%(word_size)s ' - '-G %(generator)r %(opts)s %(dir)r' % args) - - def run_cmake(self, args=[]): - '''Run cmake.''' - - # do a sanity check to make sure we have a generator - if not hasattr(self, 'generator'): - raise "No generator available for '%s'" % (self.__name__,) - cwd = getcwd() - created = [] - try: - for d in self.build_dirs(): - simple = True - if mkdir(d): - created.append(d) - simple = False - try: - os.chdir(d) - cmd = self.cmake_commandline(source_indra, d, args, simple) - print 'Running %r in %r' % (cmd, d) - self.run(cmd, 'cmake') - finally: - os.chdir(cwd) - except: - # If we created a directory in which to run cmake and - # something went wrong, the directory probably just - # contains garbage, so delete it. - os.chdir(cwd) - for d in created: - print 'Cleaning %r' % d - shutil.rmtree(d) - raise - - def parse_build_opts(self, arguments): - opts, targets = getopt.getopt(arguments, 'D:o:', ['option=']) - build_opts = [] - for o, a in opts: - if o in ('-o', '--option'): - build_opts.append(a) - return build_opts, targets - - def run_build(self, opts, targets): - '''Build the default targets for this platform.''' - - raise NotImplemented('run_build') - - def cleanup(self): - '''Delete all build directories.''' - - cleaned = 0 - for d in self.build_dirs(): - if os.path.isdir(d): - print 'Cleaning %r' % d - shutil.rmtree(d) - cleaned += 1 - if not cleaned: - print 'Nothing to clean up!' - - def is_internal_tree(self): - '''Indicate whether we are building in an internal source tree.''' - - return os.path.isdir(os.path.join(self.script_dir, 'newsim')) - - def find_in_path(self, name, defval=None, basename=False): - for ext in self.exe_suffixes: - name_ext = name + ext - if os.sep in name_ext: - path = os.path.abspath(name_ext) - if os.access(path, os.X_OK): - return [basename and os.path.basename(path) or path] - for p in os.getenv('PATH', self.search_path).split(os.pathsep): - path = os.path.join(p, name_ext) - if os.access(path, os.X_OK): - return [basename and os.path.basename(path) or path] - if defval: - return [defval] - return [] - - -class UnixSetup(PlatformSetup): - '''Generic Unixy build instructions.''' - - search_path = '/usr/bin:/usr/local/bin' - exe_suffixes = ('',) - - def __init__(self): - PlatformSetup.__init__(self) - super(UnixSetup, self).__init__() - self.generator = 'Unix Makefiles' - - def os(self): - return 'unix' - - def arch(self): - cpu = os.uname()[-1] - if cpu.endswith('386'): - cpu = 'i386' - elif cpu.endswith('86'): - cpu = 'i686' - elif cpu in ('athlon',): - cpu = 'i686' - elif cpu == 'Power Macintosh': - cpu = 'ppc' - elif cpu == 'x86_64' and self.word_size == 32: - cpu = 'i686' - return cpu - - def run(self, command, name=None): - '''Run a program. If the program fails, raise an exception.''' - ret = os.system(command) - if ret: - if name is None: - name = command.split(None, 1)[0] - if os.WIFEXITED(ret): - st = os.WEXITSTATUS(ret) - if st == 127: - event = 'was not found' - else: - event = 'exited with status %d' % st - elif os.WIFSIGNALED(ret): - event = 'was killed by signal %d' % os.WTERMSIG(ret) - else: - event = 'died unexpectedly (!?) with 16-bit status %d' % ret - raise CommandError('the command %r %s' % - (name, event)) - - -class LinuxSetup(UnixSetup): - def __init__(self): - UnixSetup.__init__(self) - super(LinuxSetup, self).__init__() - try: - self.debian_sarge = open('/etc/debian_version').read().strip() == '3.1' - except: - self.debian_sarge = False - - def os(self): - return 'linux' - - def build_dirs(self): - return [PlatformSetup.build_dirs(self)[0]+'-'+self.build_type.lower()] - - def cmake_commandline(self, src_dir, build_dir, opts, simple): - args = dict( - dir=src_dir, - generator=self.generator, - opts=quote(opts), - standalone=self.standalone, - unattended=self.unattended, - type=self.build_type.upper(), - project_name=self.project_name, - word_size=self.word_size, - cxx="g++" - ) - - cmd = (('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s ' - '-G %(generator)r -DSTANDALONE:BOOL=%(standalone)s ' - '-DWORD_SIZE:STRING=%(word_size)s ' - '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' - '%(opts)s %(dir)r') - % args) - if 'CXX' not in os.environ: - args.update({'cmd':cmd}) - cmd = ('CXX=%(cxx)r %(cmd)s' % args) - return cmd - - def run_build(self, opts, targets): - job_count = None - - for i in range(len(opts)): - if opts[i].startswith('-j'): - try: - job_count = int(opts[i][2:]) - except ValueError: - try: - job_count = int(opts[i+1]) - except ValueError: - job_count = True - - def get_cpu_count(): - count = 0 - for line in open('/proc/cpuinfo'): - if re.match(r'processor\s*:', line): - count += 1 - return count - - def localhost(): - count = get_cpu_count() - return 'localhost/' + str(count), count - - def get_distcc_hosts(): - try: - hosts = [] - name = os.getenv('DISTCC_DIR', '/etc/distcc') + '/hosts' - for l in open(name): - l = l[l.find('#')+1:].strip() - if l: hosts.append(l) - return hosts - except IOError: - return (os.getenv('DISTCC_HOSTS', '').split() or - [localhost()[0]]) - - def count_distcc_hosts(): - cpus = 0 - hosts = 0 - for host in get_distcc_hosts(): - m = re.match(r'.*/(\d+)', host) - hosts += 1 - cpus += m and int(m.group(1)) or 1 - return hosts, cpus - - def mk_distcc_hosts(basename, range, num_cpus): - '''Generate a list of LL-internal machines to build on.''' - loc_entry, cpus = localhost() - hosts = [loc_entry] - dead = [] - stations = [s for s in xrange(range) if s not in dead] - random.shuffle(stations) - hosts += ['%s%d.lindenlab.com/%d,lzo' % (basename, s, num_cpus) for s in stations] - cpus += 2 * len(stations) - return ' '.join(hosts), cpus - - if job_count is None: - hosts, job_count = count_distcc_hosts() - if hosts == 1: - hostname = socket.gethostname() - if hostname.startswith('station'): - hosts, job_count = mk_distcc_hosts('station', 36, 2) - os.environ['DISTCC_HOSTS'] = hosts - if hostname.startswith('eniac'): - hosts, job_count = mk_distcc_hosts('eniac', 71, 2) - os.environ['DISTCC_HOSTS'] = hosts - if job_count > 4: - job_count = 4; - opts.extend(['-j', str(job_count)]) - - if targets: - targets = ' '.join(targets) - else: - targets = 'all' - - for d in self.build_dirs(): - cmd = 'make -C %r %s %s' % (d, ' '.join(opts), targets) - print 'Running %r' % cmd - self.run(cmd) - - -class DarwinSetup(UnixSetup): - def __init__(self): - UnixSetup.__init__(self) - super(DarwinSetup, self).__init__() - self.generator = 'Xcode' - - def os(self): - return 'darwin' - - def arch(self): - if self.universal == 'ON': - return 'universal' - else: - return UnixSetup.arch(self) - - def build_dirs(self): - if(self.generator == 'Xcode'): - return PlatformSetup.build_dirs(self) - else: - return [PlatformSetup.build_dirs(self)[0]+'-'+self.build_type.lower()] - - def cmake_commandline(self, src_dir, build_dir, opts, simple): - args = dict( - dir=src_dir, - generator=self.generator, - opts=quote(opts), - standalone=self.standalone, - word_size=self.word_size, - unattended=self.unattended, - project_name=self.project_name, - universal='', - type='', - ) - if(self.generator != 'Xcode'): - args['type'] = '-DCMAKE_BUILD_TYPE=%s' % self.build_type.upper() - if self.universal == 'ON': - args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386;ppc\'' - #if simple: - # return 'cmake %(opts)s %(dir)r' % args - return ('cmake -G %(generator)r ' - '%(type)s ' - '-DSTANDALONE:BOOL=%(standalone)s ' - '-DUNATTENDED:BOOL=%(unattended)s ' - '-DWORD_SIZE:STRING=%(word_size)s ' - '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' - '%(universal)s ' - '%(opts)s %(dir)r' % args) - - def run_build(self, opts, targets): - if(self.generator != 'Xcode'): - if targets: - targets = ' '.join(targets) - else: - targets = 'all' - - for d in self.build_dirs(): - cmd = 'make -C %r %s %s' % (d, ' '.join(opts), targets) - print 'Running %r' % cmd - self.run(cmd) - return - - cwd = getcwd() - if targets: - targets = ' '.join(['-target ' + repr(t) for t in targets]) - else: - targets = '' - cmd = ('xcodebuild -configuration %s %s %s' % - (self.build_type, ' '.join(opts), targets)) - for d in self.build_dirs(): - try: - os.chdir(d) - print 'Running %r in %r' % (cmd, d) - self.run(cmd) - finally: - os.chdir(cwd) - - -class WindowsSetup(PlatformSetup): - gens = { - 'vc100' : { - 'gen' : r'Visual Studio 10', - 'ver' : r'10.0' - }, - 'vc120' : { - 'gen' : r'Visual Studio 12', - 'ver' : r'12.0' - } - } - - gens['vs2010'] = gens['vc100'] - gens['vs2013'] = gens['vc120'] - - search_path = r'C:\windows' - exe_suffixes = ('.exe', '.bat', '.com') - - def __init__(self): - PlatformSetup.__init__(self) - super(WindowsSetup, self).__init__() - self._generator = None - self.incredibuild = False - - def _get_generator(self): - if self._generator is None: - for version in 'vc100'.split(): - if self.find_visual_studio(version): - self._generator = version - print 'Building with ', self.gens[version]['gen'] - break - else: - print >> sys.stderr, 'Cannot find a Visual Studio installation, testing for express editions' - for version in 'vc100'.split(): - if self.find_visual_studio_express(version): - self._generator = version - self.using_express = True - print 'Building with ', self.gens[version]['gen'] , "Express edition" - break - else: - for version in 'vc100'.split(): - if self.find_visual_studio_express_single(version): - self._generator = version - self.using_express = True - print 'Building with ', self.gens[version]['gen'] , "Express edition" - break - else: - print >> sys.stderr, 'Cannot find any Visual Studio installation' - sys.exit(1) - return self._generator - - def _set_generator(self, gen): - self._generator = gen - - generator = property(_get_generator, _set_generator) - - def get_gen_str(self, gen): - if gen is None: - gen = self._generator - return self.gens[gen.lower()]['ver'] - - def os(self): - return 'win32' - - def build_dirs(self): - if(os.path.basename(os.path.normpath(os.getcwd())) == 'indra'): - prefix = '../' - else: - prefix = '' - - if self.word_size == 64: - return [prefix+'build-' + self.generator + '-Win64'] - else: - return [prefix+'build-' + self.generator] - - def cmake_commandline(self, src_dir, build_dir, opts, simple): - args = dict( - dir=src_dir, - generator=self.gens[self.generator.lower()]['gen'], - opts=quote(opts), - standalone=self.standalone, - unattended=self.unattended, - project_name=self.project_name, - word_size=self.word_size, - ) - if self.word_size == 64: - args["generator"] += r' Win64' - - #if simple: - # return 'cmake %(opts)s "%(dir)s"' % args - return ('cmake -G "%(generator)s" ' - '-DSTANDALONE:BOOL=%(standalone)s ' - '-DUNATTENDED:BOOL=%(unattended)s ' - '-DWORD_SIZE:STRING=%(word_size)s ' - '-DROOT_PROJECT_NAME:STRING=\"%(project_name)s\" ' - '%(opts)s "%(dir)s"' % args) - - def get_HKLM_registry_value(self, key_str, value_str): - import _winreg - reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) - key = _winreg.OpenKey(reg, key_str) - value = _winreg.QueryValueEx(key, value_str)[0] - print 'Found: %s' % value - return value - - def find_visual_studio(self, gen=None): - gen = self.get_gen_str(gen) - value_str = (r'EnvironmentDirectory') - key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VS' % - gen) - print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % - (key_str, value_str)) - try: - return self.get_HKLM_registry_value(key_str, value_str) - except WindowsError, err: - key_str = (r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%s\Setup\VS' % - gen) - - try: - return self.get_HKLM_registry_value(key_str, value_str) - except: - print >> sys.stderr, "Didn't find ", self.gens[gen]['gen'] - return '' - - def find_msbuild(self, gen=None): - gen = self.get_gen_str(gen) - - key_str = (r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0') - - print ('Checking MSBuild support for vs ver = %s' % gen) - if not self.get_HKLM_registry_value(key_str+'\\'+gen, "VCTargetsPath"): - return (None, None) - print ('Reading MSBuild location from HKEY_LOCAL_MACHINE\%s\MSBuildToolsPath' % - key_str) - print key_str - try: - return (self.get_HKLM_registry_value(key_str, 'MSBuildToolsPath'), gen) - except WindowsError, err: - key_str = (r'SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\%s' % - gen) - - try: - return (self.get_HKLM_registry_value(key_str, 'MSBuildToolsPath'), gen) - except WindowsError, err: - print 'Didn\'t find msbuild' - return (None, None) - - def find_visual_studio_express(self, gen=None): - gen = self.get_gen_str(gen) - try: - import _winreg - key_str = (r'SOFTWARE\Microsoft\VCEXpress\%s\Setup\VC' % - gen) - value_str = (r'ProductDir') - print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % - (key_str, value_str)) - print key_str - - reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) - key = _winreg.OpenKey(reg, key_str) - value = _winreg.QueryValueEx(key, value_str)[0]+"IDE" - print 'Found: %s' % value - return value - except WindowsError, err: - print >> sys.stderr, "Didn't find ", gen - return '' - - def find_visual_studio_express_single(self, gen=None): - gen = self.get_gen_str(gen) - try: - import _winreg - key_str = (r'SOFTWARE\Microsoft\VCEXpress\%s_Config\Setup\VC' % - gen) - value_str = (r'ProductDir') - print ('Reading VS environment from HKEY_CURRENT_USER\%s\%s' % - (key_str, value_str)) - print key_str - - reg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER) - key = _winreg.OpenKey(reg, key_str) - value = _winreg.QueryValueEx(key, value_str)[0]+"IDE" - print 'Found: %s' % value - return value - except WindowsError, err: - print >> sys.stderr, "Didn't find ", gen - return '' - - def get_build_cmd(self): - if self.incredibuild: - config = self.build_type - if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]: - config = '\"%s|Win32\"' % config - - return "buildconsole \"%s.sln\" /build %s" % (self.project_name, config), None - environment = self.find_visual_studio() - if environment == '': - environment = self.find_visual_studio_express() - if environment == '': - environment = self.find_visual_studio_express_single() - if environment == '': - print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio?" - else: - build_dirs=self.build_dirs() - print >> sys.stderr, "\nSolution generation complete, it can can now be found in:", build_dirs[0] - print >> sys.stderr, "\nAs you are using an Express Visual Studio, the build step cannot be automated" - print >> sys.stderr, "\nPlease see https://wiki.secondlife.com/wiki/Microsoft_Visual_Studio#Extra_steps_for_Visual_Studio_Express_editions for Visual Studio Express specific information" - exit(0) - - msbuild_dir, tool_ver = self.find_msbuild() - - if msbuild_dir is not None and tool_ver is not None: - return ('\"%smsbuild.exe\" \"%s.sln\" /p:configuration=%s /p:VisualStudioVersion=%s' % - (msbuild_dir, self.project_name, self.build_type, tool_ver)), True - - # devenv.com is CLI friendly, devenv.exe... not so much. - return ('"%sdevenv.com" \"%s.sln\" /build %s' % - (self.find_visual_studio(), self.project_name, self.build_type)), None - - def run(self, command, name=None): - '''Run a program. If the program fails, raise an exception.''' - ret = os.system('\"'+command+'\"') - if ret: - if name is None: - name = os.path.normpath(shlex.split(command.encode('utf8'),posix=False)[0].strip('"')) - - path = self.find_in_path(name) - if not path: - ret = 'was not found' - else: - ret = 'exited with status %d' % ret - raise CommandError('the command %r %s' % - (name, ret)) - - def run_cmake(self, args=[]): - '''Override to add the vstool.exe call after running cmake.''' - PlatformSetup.run_cmake(self, args) - if self.unattended == 'OFF': - if self.using_express == False: - self.run_vstool() - - def run_vstool(self): - for build_dir in self.build_dirs(): - stamp = os.path.join(build_dir, 'vstool.txt') - try: - prev_build = open(stamp).read().strip() - except IOError: - prev_build = '' - if prev_build == self.build_type: - # Only run vstool if the build type has changed. - continue - - if(os.path.basename(os.path.normpath(os.getcwd())) == 'indra'): - tool_path = os.path.join('tools','vstool','VSTool.exe') - else: - tool_path = os.path.join('indra','tools','vstool','VSTool.exe') - vstool_cmd = (tool_path + - ' --solution \"' + - os.path.join(build_dir,'%s.sln' % self.project_name) + - '\" --config ' + self.build_type + - ' --startup secondlife-bin') - print 'Running vstool %r in %r' % (vstool_cmd, getcwd()) - self.run(vstool_cmd) - print >> open(stamp, 'w'), self.build_type - - def run_build(self, opts, targets): - cwd = getcwd() - build_cmd, msbuild = self.get_build_cmd() - - for d in self.build_dirs(): - try: - os.chdir(d) - if targets: - if msbuild: - cmd = '%s /target:%s %s' % (build_cmd, ';'.join(targets), ' '.join(opts)) - print 'Running build(targets) %r in %r' % (cmd, d) - self.run(cmd) - else: - for t in targets: - cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts)) - print 'Running build(targets) %r in %r' % (cmd, d) - self.run(cmd) - else: - cmd = '%s %s' % (build_cmd, ' '.join(opts)) - print 'Running build %r in %r' % (cmd, d) - self.run(cmd) - finally: - os.chdir(cwd) - -class CygwinSetup(WindowsSetup): - def __init__(self): - super(CygwinSetup, self).__init__() - self.generator = 'vc80' - - def cmake_commandline(self, src_dir, build_dir, opts, simple): - dos_dir = commands.getoutput("cygpath -w %s" % src_dir) - args = dict( - dir=dos_dir, - generator=self.gens[self.generator.lower()]['gen'], - opts=quote(opts), - standalone=self.standalone, - unattended=self.unattended, - project_name=self.project_name, - word_size=self.word_size, - ) - if self.word_size == 64: - args["generator"] += r' Win64' - #if simple: - # return 'cmake %(opts)s "%(dir)s"' % args - return ('cmake -G "%(generator)s" ' - '-DUNATTENDED:BOOl=%(unattended)s ' - '-DSTANDALONE:BOOL=%(standalone)s ' - '-DWORD_SIZE:STRING=%(word_size)s ' - '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' - '%(opts)s "%(dir)s"' % args) - - def run(self, command, name=None): - '''Run a program. If the program fails, raise an exception.''' - ret = os.system(command) - if ret: - if name is None: - name = os.path.normpath(shlex.split(command.encode('utf8'),posix=False)[0].strip('"')) - - path = self.find_in_path(name) - if not path: - ret = 'was not found' - else: - ret = 'exited with status %d' % ret - raise CommandError('the command %r %s' % - (name, ret)) - - -setup_platform = { - 'darwin': DarwinSetup, - 'linux2': LinuxSetup, - 'linux3': LinuxSetup, - 'win32' : WindowsSetup, - 'cygwin' : CygwinSetup - } - - -usage_msg = ''' -Usage: develop.py [options] [command [command-options]] - -Options: - -h | --help print this help message - --standalone build standalone, without Linden prebuild libraries - --unattended build unattended, do not invoke any tools requiring - a human response - --universal build a universal binary on Mac OS X (unsupported) - -t | --type=NAME build type ("Debug", "Release", or "RelWithDebInfo") - -m32 | -m64 build architecture (32-bit or 64-bit) - -N | --no-distcc disable use of distcc - -G | --generator=NAME generator name - Windows: VC100 (VS2010) (default) - Mac OS X: Xcode (default), Unix Makefiles - Linux: Unix Makefiles (default), KDevelop3 - -p | --project=NAME set the root project name. (Doesn't effect makefiles) - -Commands: - build configure and build default target - clean delete all build directories, does not affect sources - configure configure project by running cmake (default if none given) - printbuilddirs print the build directory that will be used - -Command-options for "configure": - We use cmake variables to change the build configuration. - -DPACKAGE:BOOL=ON Create "package" target to make installers - -DLL_TESTS:BOOL=OFF Don't generate unit test projects - -DEXAMPLEPLUGIN:BOOL=OFF Don't generate example plugin project - -DDISABLE_TCMALLOC:BOOL=ON Disable linkage of TCMalloc. (64bit builds automatically disable TCMalloc) - -DRELEASE_CRASH_REPORTING:BOOL=ON Enable Google Breakpad crash reporting - -DFMODSTUDIO:BOOL=ON Use FMOD Studio audio libraries - -DFMODEX:BOOL=ON Use FMOD Ex audio libraries - -Examples: - Set up a Visual Studio 2010 project with "package" target: - develop.py -G vc100 configure -DPACKAGE:BOOL=ON -''' - -def main(arguments): - setup = setup_platform[sys.platform]() - try: - opts, args = getopt.getopt( - arguments, - '?hNt:p:G:m:', - ['help', 'standalone', 'no-distcc', 'unattended', 'type=', 'incredibuild', 'generator=', 'project=']) - except getopt.GetoptError, err: - print >> sys.stderr, 'Error:', err - print >> sys.stderr, """ -Note: You must pass -D options to cmake after the "configure" command -For example: develop.py configure -DSERVER:BOOL=OFF""" - print >> sys.stderr, usage_msg.strip() - sys.exit(1) - - for o, a in opts: - if o in ('-?', '-h', '--help'): - print usage_msg.strip() - sys.exit(0) - elif o in ('--standalone',): - setup.standalone = 'ON' - elif o in ('--unattended',): - setup.unattended = 'ON' - elif o in ('-m',): - if a in ('32', '64'): - setup.word_size = int(a) - else: - print >> sys.stderr, 'Error: unknown word size', repr(a) - print >> sys.stderr, 'Supported word sizes: 32, 64' - sys.exit(1) - elif o in ('-t', '--type'): - try: - setup.build_type = setup.build_types[a.lower()] - except KeyError: - print >> sys.stderr, 'Error: unknown build type', repr(a) - print >> sys.stderr, 'Supported build types:' - types = setup.build_types.values() - types.sort() - for t in types: - print ' ', t - sys.exit(1) - elif o in ('-G', '--generator'): - setup.generator = a - elif o in ('-N', '--no-distcc'): - setup.distcc = False - elif o in ('-p', '--project'): - setup.project_name = a - elif o in ('--incredibuild'): - setup.incredibuild = True - else: - print >> sys.stderr, 'INTERNAL ERROR: unhandled option', repr(o) - sys.exit(1) - if not args: - setup.run_cmake() - return - try: - cmd = args.pop(0) - if cmd in ('cmake', 'configure'): - setup.run_cmake(args) - elif cmd == 'build': - if os.getenv('DISTCC_DIR') is None: - distcc_dir = os.path.join(getcwd(), '.distcc') - if not os.path.exists(distcc_dir): - os.mkdir(distcc_dir) - print "setting DISTCC_DIR to %s" % distcc_dir - os.environ['DISTCC_DIR'] = distcc_dir - else: - print "DISTCC_DIR is set to %s" % os.getenv('DISTCC_DIR') - for d in setup.build_dirs(): - if not os.path.exists(d): - raise CommandError('run "develop.py cmake" first') - setup.run_cmake() - opts, targets = setup.parse_build_opts(args) - setup.run_build(opts, targets) - elif cmd == 'clean': - if args: - raise CommandError('clean takes no arguments') - setup.cleanup() - elif cmd == 'printbuilddirs': - for d in setup.build_dirs(): - print >> sys.stdout, d - else: - print >> sys.stderr, 'Error: unknown subcommand', repr(cmd) - print >> sys.stderr, "(run 'develop.py --help' for help)" - sys.exit(1) - except getopt.GetoptError, err: - print >> sys.stderr, 'Error with %r subcommand: %s' % (cmd, err) - sys.exit(1) - - -if __name__ == '__main__': - try: - main(sys.argv[1:]) - except CommandError, err: - print >> sys.stderr, 'Error:', err - sys.exit(1) diff --git a/indra/lib/python/indra/ipc/httputil.py b/indra/lib/python/indra/ipc/httputil.py index c4ac0a379..d53f34a77 100644 --- a/indra/lib/python/indra/ipc/httputil.py +++ b/indra/lib/python/indra/ipc/httputil.py @@ -1,3 +1,24 @@ +#!/usr/bin/python +## $LicenseInfo:firstyear=2011&license=viewerlgpl$ +## Second Life Viewer Source Code +## Copyright (C) 2011, Linden Research, Inc. +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; +## version 2.1 of the License only. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +## $/LicenseInfo$ import warnings diff --git a/indra/lib/python/indra/ipc/siesta_test.py b/indra/lib/python/indra/ipc/siesta_test.py index 177ea710d..a35eed246 100644 --- a/indra/lib/python/indra/ipc/siesta_test.py +++ b/indra/lib/python/indra/ipc/siesta_test.py @@ -1,3 +1,24 @@ +#!/usr/bin/python +## $LicenseInfo:firstyear=2011&license=viewerlgpl$ +## Second Life Viewer Source Code +## Copyright (C) 2011, Linden Research, Inc. +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; +## version 2.1 of the License only. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +## $/LicenseInfo$ from indra.base import llsd, lluuid from indra.ipc import siesta import datetime, math, unittest diff --git a/indra/lib/python/indra/util/fastest_elementtree.py b/indra/lib/python/indra/util/fastest_elementtree.py index 3e2189c4e..4fcf662dd 100644 --- a/indra/lib/python/indra/util/fastest_elementtree.py +++ b/indra/lib/python/indra/util/fastest_elementtree.py @@ -36,7 +36,6 @@ $/LicenseInfo$ # Using cElementTree might cause some unforeseen problems, so here's a # convenient off switch. - use_celementree = True try: diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 0059faa2e..8d9656778 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -41,6 +41,14 @@ import tarfile import errno import subprocess +class ManifestError(RuntimeError): + """Use an exception more specific than generic Python RuntimeError""" + pass + +class MissingError(ManifestError): + """You specified a file that doesn't exist""" + pass + def path_ancestors(path): drive, path = os.path.splitdrive(os.path.normpath(path)) result = [] @@ -76,31 +84,9 @@ def get_default_platform(dummy): 'darwin':'darwin' }[sys.platform] -def get_default_version(srctree): - # look up llversion.h and parse out the version info - paths = [os.path.join(srctree, x, 'llversionviewer.h') for x in ['llcommon', '../llcommon', '../../indra/llcommon.h']] - for p in paths: - if os.path.exists(p): - contents = open(p, 'r').read() - major = re.search("LL_VERSION_MAJOR\s=\s([0-9]+)", contents).group(1) - minor = re.search("LL_VERSION_MINOR\s=\s([0-9]+)", contents).group(1) - patch = re.search("LL_VERSION_PATCH\s=\s([0-9]+)", contents).group(1) - build = re.search("LL_VERSION_BUILD\s=\s([0-9]+)", contents).group(1) - return major, minor, patch, build - -def get_channel(srctree): - # look up llversionserver.h and parse out the version info - paths = [os.path.join(srctree, x, 'llversionviewer.h') for x in ['llcommon', '../llcommon', '../../indra/llcommon.h']] - for p in paths: - if os.path.exists(p): - contents = open(p, 'r').read() - channel = re.search("LL_CHANNEL\s=\s\"(.+)\";\s*$", contents, flags = re.M).group(1) - return channel - - DEFAULT_SRCTREE = os.path.dirname(sys.argv[0]) -DEFAULT_CHANNEL = 'Second Life Release' -DEFAULT_CHANNEL_SNOWGLOBE = 'Snowglobe Release' +CHANNEL_VENDOR_BASE = 'Singularity' +RELEASE_CHANNEL = CHANNEL_VENDOR_BASE + ' Release' ARGUMENTS=[ dict(name='actions', @@ -121,27 +107,19 @@ ARGUMENTS=[ On Linux this would try to use Linux_i686Manifest.""", default=""), dict(name='build', description='Build directory.', default=DEFAULT_SRCTREE), - dict(name='buildtype', description="""The build type used. ('Debug', 'Release', or 'RelWithDebInfo') - Default is Release """, - default="Release"), - dict(name='branding_id', description="""Identifier for the branding set to - use. Currently, 'secondlife' or 'snowglobe')""", - default='secondlife'), + dict(name='buildtype', description='Build type (i.e. Debug, Release, RelWithDebInfo).', default=None), dict(name='configuration', - description="""The build configuration used. Only used on OS X for - now, but it could be used for other platforms as well.""", - default="Universal"), + description="""The build configuration used.""", + default="Release"), dict(name='dest', description='Destination directory.', default=DEFAULT_SRCTREE), dict(name='grid', - description="""Which grid the client will try to connect to. Even - though it's not strictly a grid, 'firstlook' is also an acceptable - value for this parameter.""", - default=""), + description="""Which grid the client will try to connect to.""", + default=None), dict(name='channel', description="""The channel to use for updates, packaging, settings name, etc.""", - default=get_channel), - dict(name='login_channel', - description="""The channel to use for login handshake/updates only.""", + default='CHANNEL UNSET'), + dict(name='channel_suffix', + description="""Addition to the channel for packaging and channel value, but not application name (used internally)""", default=None), dict(name='installer_name', description=""" The name of the file that the installer should be @@ -166,12 +144,12 @@ ARGUMENTS=[ contain the name of the final package in a form suitable for use by a .bat file.""", default=None), - dict(name='version', - description="""This specifies the version of Second Life that is - being packaged up.""", - default=get_default_version), - dict(name='extra_libraries', - description="""List of extra libraries to include in package""", + dict(name='versionfile', + description="""The name of a file containing the full version number."""), + dict(name='signature', + description="""This specifies an identity to sign the viewer with, if any. + If no value is supplied, the default signature will be used, if any. Currently + only used on Mac OS X.""", default=None) ] @@ -193,8 +171,9 @@ def usage(srctree=""): arg['description'] % nd) def main(): - print "cwd:", os.getcwd() - print " ".join(sys.argv) +## import itertools +## print ' '.join((("'%s'" % item) if ' ' in item else item) +## for item in itertools.chain([sys.executable], sys.argv)) option_names = [arg['name'] + '=' for arg in ARGUMENTS] option_names.append('help') options, remainder = getopt.getopt(sys.argv[1:], "", option_names) @@ -231,12 +210,17 @@ def main(): args[arg['name']] = default # fix up version - if isinstance(args.get('version'), str): - args['version'] = args['version'].split('.') - - # default and agni are default - if args['grid'] in ['default', 'agni']: - args['grid'] = '' + if isinstance(args.get('versionfile'), str): + try: # read in the version string + vf = open(args['versionfile'], 'r') + args['version'] = vf.read().strip().split('.') + except: + print "Unable to read versionfile '%s'" % args['versionfile'] + raise + + # unspecified, default, and agni are default + if args['grid'] in ['', 'default', 'agni']: + args['grid'] = None if 'actions' in args: args['actions'] = args['actions'].split() @@ -245,15 +229,101 @@ def main(): for opt in args: print "Option:", opt, "=", args[opt] + # pass in sourceid as an argument now instead of an environment variable + try: + args['sourceid'] = os.environ["sourceid"] + except KeyError: + args['sourceid'] = "" + + # Build base package. + touch = args.get('touch') + if touch: + print 'Creating base package' + args['package_id'] = "" # base package has no package ID wm = LLManifest.for_platform(args['platform'], args.get('arch'))(args) wm.do(*args['actions']) + # Store package file for later if making touched file. + base_package_file = "" + if touch: + print 'Created base package ', wm.package_file + base_package_file = "" + wm.package_file + # handle multiple packages if set + try: + additional_packages = os.environ["additional_packages"] + except KeyError: + additional_packages = "" + if additional_packages: + # Determine destination prefix / suffix for additional packages. + base_dest_postfix = args['dest'] + base_dest_prefix = "" + base_dest_parts = args['dest'].split(os.sep) + if len(base_dest_parts) > 1: + base_dest_postfix = base_dest_parts[len(base_dest_parts) - 1] + base_dest_prefix = base_dest_parts[0] + i = 1 + while i < len(base_dest_parts) - 1: + base_dest_prefix = base_dest_prefix + os.sep + base_dest_parts[i] + i = i + 1 + # Determine touched prefix / suffix for additional packages. + base_touch_postfix = "" + base_touch_prefix = "" + if touch: + base_touch_postfix = touch + base_touch_parts = touch.split('/') + if "arwin" in args['platform']: + if len(base_touch_parts) > 1: + base_touch_postfix = base_touch_parts[len(base_touch_parts) - 1] + base_touch_prefix = base_touch_parts[0] + i = 1 + while i < len(base_touch_parts) - 1: + base_touch_prefix = base_touch_prefix + '/' + base_touch_parts[i] + i = i + 1 + else: + if len(base_touch_parts) > 2: + base_touch_postfix = base_touch_parts[len(base_touch_parts) - 2] + '/' + base_touch_parts[len(base_touch_parts) - 1] + base_touch_prefix = base_touch_parts[0] + i = 1 + while i < len(base_touch_parts) - 2: + base_touch_prefix = base_touch_prefix + '/' + base_touch_parts[i] + i = i + 1 + # Store base channel name. + base_channel_name = args['channel'] + # Build each additional package. + package_id_list = additional_packages.split(" ") + args['channel'] = base_channel_name + for package_id in package_id_list: + try: + if package_id + "_viewer_channel_suffix" in os.environ: + args['channel_suffix'] = os.environ[package_id + "_viewer_channel_suffix"] + else: + args['channel_suffix'] = None + if package_id + "_sourceid" in os.environ: + args['sourceid'] = os.environ[package_id + "_sourceid"] + else: + args['sourceid'] = None + args['dest'] = base_dest_prefix + os.sep + package_id + os.sep + base_dest_postfix + except KeyError: + sys.stderr.write("Failed to create package for package_id: %s" % package_id) + sys.stderr.flush() + continue + if touch: + print 'Creating additional package for "', package_id, '" in ', args['dest'] + wm = LLManifest.for_platform(args['platform'], args.get('arch'))(args) + wm.do(*args['actions']) + if touch: + print 'Created additional package ', wm.package_file, ' for ', package_id + faketouch = base_touch_prefix + '/' + package_id + '/' + base_touch_postfix + fp = open(faketouch, 'w') + fp.write('set package_file=%s\n' % wm.package_file) + fp.close() + # Write out the package file in this format, so that it can easily be called # and used in a .bat file - yeah, it sucks, but this is the simplest... touch = args.get('touch') if touch: fp = open(touch, 'w') - fp.write('set package_file=%s\n' % wm.package_file) + fp.write('set package_file=%s\n' % base_package_file) fp.close() print 'touched', touch return 0 @@ -269,8 +339,8 @@ class LLManifest(object): __metaclass__ = LLManifestRegistry manifests = {} def for_platform(self, platform, arch = None): - if arch and platform != "windows": - platform = platform + '_' + arch + if arch: + platform = platform + '_' + arch + '_' return self.manifests[platform.lower()] for_platform = classmethod(for_platform) @@ -280,26 +350,15 @@ class LLManifest(object): self.file_list = [] self.excludes = [] self.actions = [] - self.src_prefix = list([args['source']]) - self.artwork_prefix = list([args['artwork']]) - self.build_prefix = list([args['build']]) - self.alt_build_prefix = list([args['build']]) - self.dst_prefix = list([args['dest']]) + self.src_prefix = [args['source']] + self.artwork_prefix = [args['artwork']] + self.build_prefix = [args['build']] + self.dst_prefix = [args['dest']] self.created_paths = [] self.package_name = "Unknown" - - def default_grid(self): - return self.args.get('grid', None) == '' + def default_channel(self): - return self.args.get('channel', None) == DEFAULT_CHANNEL - - def default_channel_for_brand(self): - if self.viewer_branding_id()=='secondlife': - return self.args.get('channel', None) == DEFAULT_CHANNEL - elif self.viewer_branding_id()=="snowglobe": - return self.args.get('channel', None) == DEFAULT_CHANNEL_SNOWGLOBE - else: - return True + return self.args.get('channel', None) == RELEASE_CHANNEL def construct(self): """ Meant to be overriden by LLManifest implementors with code that @@ -311,7 +370,7 @@ class LLManifest(object): in the file list by path().""" self.excludes.append(glob) - def prefix(self, src='', build=None, dst=None, alt_build=None): + def prefix(self, src='', build=None, dst=None): """ Pushes a prefix onto the stack. Until end_prefix is called, all relevant method calls (esp. to path()) will prefix paths with the entire prefix stack. Source and destination @@ -322,15 +381,10 @@ class LLManifest(object): dst = src if build is None: build = src - if alt_build is None: - alt_build = build - self.src_prefix.append(src) self.artwork_prefix.append(src) self.build_prefix.append(build) self.dst_prefix.append(dst) - self.alt_build_prefix.append(alt_build) - return True # so that you can wrap it in an if to get indentation def end_prefix(self, descr=None): @@ -343,30 +397,25 @@ class LLManifest(object): src = self.src_prefix.pop() artwork = self.artwork_prefix.pop() build = self.build_prefix.pop() - alt_build_prefix = self.alt_build_prefix.pop() dst = self.dst_prefix.pop() if descr and not(src == descr or build == descr or dst == descr): raise ValueError, "End prefix '" + descr + "' didn't match '" +src+ "' or '" +dst + "'" def get_src_prefix(self): """ Returns the current source prefix.""" - return os.path.relpath(os.path.normpath(os.path.join(*self.src_prefix))) + return os.path.join(*self.src_prefix) def get_artwork_prefix(self): """ Returns the current artwork prefix.""" - return os.path.relpath(os.path.normpath(os.path.join(*self.artwork_prefix))) + return os.path.join(*self.artwork_prefix) def get_build_prefix(self): """ Returns the current build prefix.""" - return os.path.relpath(os.path.normpath(os.path.join(*self.build_prefix))) - - def get_alt_build_prefix(self): - """ Returns the current alternate source prefix.""" - return os.path.relpath(os.path.normpath(os.path.join(*self.alt_build_prefix))) + return os.path.join(*self.build_prefix) def get_dst_prefix(self): """ Returns the current destination prefix.""" - return os.path.relpath(os.path.normpath(os.path.join(*self.dst_prefix))) + return os.path.join(*self.dst_prefix) def src_path_of(self, relpath): """Returns the full path to a file or directory specified @@ -383,25 +432,45 @@ class LLManifest(object): relative to the destination directory.""" return os.path.join(self.get_dst_prefix(), relpath) + def ensure_src_dir(self, reldir): + """Construct the path for a directory relative to the + source path, and ensures that it exists. Returns the + full path.""" + path = os.path.join(self.get_src_prefix(), reldir) + self.cmakedirs(path) + return path + + def ensure_dst_dir(self, reldir): + """Construct the path for a directory relative to the + destination path, and ensures that it exists. Returns the + full path.""" + path = os.path.join(self.get_dst_prefix(), reldir) + self.cmakedirs(path) + return path + def run_command(self, command): """ Runs an external command, and returns the output. Raises - an exception if the command reurns a nonzero status code. For - debugging/informational purpoases, prints out the command's + an exception if the command returns a nonzero status code. For + debugging/informational purposes, prints out the command's output as it is received.""" print "Running command:", command - fd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + sys.stdout.flush() + child = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + shell=True) lines = [] while True: - lines.append(fd.stdout.readline()) + lines.append(child.stdout.readline()) if lines[-1] == '': break else: - print lines[-1].rstrip('\n'), + print lines[-1], output = ''.join(lines) - if fd.returncode: - raise RuntimeError( + child.stdout.close() + status = child.wait() + if status: + raise ManifestError( "Command %s returned non-zero status (%s) \noutput:\n%s" - % (command, fd.returncode, output) ) + % (command, status, output) ) return output def created_path(self, path): @@ -409,14 +478,24 @@ class LLManifest(object): a) verify that you really have created it b) schedule it for cleanup""" if not os.path.exists(path): - raise RuntimeError, "Should be something at path " + path + raise ManifestError, "Should be something at path " + path self.created_paths.append(path) - def put_in_file(self, contents, dst): + def put_in_file(self, contents, dst, src=None): # write contents as dst - f = open(self.dst_path_of(dst), "wb") - f.write(contents) - f.close() + dst_path = self.dst_path_of(dst) + f = open(dst_path, "wb") + try: + f.write(contents) + finally: + f.close() + + # Why would we create a file in the destination tree if not to include + # it in the installer? The default src=None (plus the fact that the + # src param is last) is to preserve backwards compatibility. + if src: + self.file_list.append([src, dst_path]) + return dst_path def replace_in(self, src, dst=None, searchdict={}): if dst == None: @@ -436,11 +515,7 @@ class LLManifest(object): # ensure that destination path exists self.cmakedirs(os.path.dirname(dst)) self.created_paths.append(dst) - if not os.path.isdir(src): - self.ccopy(src,dst) - else: - # src is a dir - self.ccopytree(src,dst) + self.ccopymumble(src, dst) else: print "Doesn't exist:", src @@ -479,30 +554,29 @@ class LLManifest(object): if method is not None: method(src, dst) self.file_list.append([src, dst]) - return [dst] + return 1 else: sys.stdout.write(" (excluding %r, %r)" % (src, dst)) sys.stdout.flush() - return [] + return 0 def process_directory(self, src, dst): if not self.includes(src, dst): sys.stdout.write(" (excluding %r, %r)" % (src, dst)) sys.stdout.flush() - return [] + return 0 names = os.listdir(src) self.cmakedirs(dst) errors = [] - found_files = [] count = 0 for name in names: srcname = os.path.join(src, name) dstname = os.path.join(dst, name) if os.path.isdir(srcname): - found_files.extend(self.process_directory(srcname, dstname)) + count += self.process_directory(srcname, dstname) else: - found_files.extend(self.process_file(srcname, dstname)) - return found_files + count += self.process_file(srcname, dstname) + return count def includes(self, src, dst): if src: @@ -520,28 +594,38 @@ class LLManifest(object): else: os.remove(path) - def ccopy(self, src, dst): - """ Copy a single file or symlink. Uses filecmp to skip copying for existing files.""" + def ccopymumble(self, src, dst): + """Copy a single symlink, file or directory.""" if os.path.islink(src): linkto = os.readlink(src) - if os.path.islink(dst) or os.path.exists(dst): + if os.path.islink(dst) or os.path.isfile(dst): os.remove(dst) # because symlinking over an existing link fails + elif os.path.isdir(dst): + shutil.rmtree(dst) os.symlink(linkto, dst) + elif os.path.isdir(src): + self.ccopytree(src, dst) else: - # Don't recopy file if it's up-to-date. - # If we seem to be not not overwriting files that have been - # updated, set the last arg to False, but it will take longer. - if os.path.exists(dst) and filecmp.cmp(src, dst, True): - return - # only copy if it's not excluded - if self.includes(src, dst): - try: - os.unlink(dst) - except OSError, err: - if err.errno != errno.ENOENT: - raise + self.ccopyfile(src, dst) + # XXX What about devices, sockets etc.? + # YYY would we put such things into a viewer package?! - shutil.copy2(src, dst) + def ccopyfile(self, src, dst): + """ Copy a single file. Uses filecmp to skip copying for existing files.""" + # Don't recopy file if it's up-to-date. + # If we seem to be not not overwriting files that have been + # updated, set the last arg to False, but it will take longer. + if os.path.exists(dst) and filecmp.cmp(src, dst, True): + return + # only copy if it's not excluded + if self.includes(src, dst): + try: + os.unlink(dst) + except OSError, err: + if err.errno != errno.ENOENT: + raise + + shutil.copy2(src, dst) def ccopytree(self, src, dst): """Direct copy of shutil.copytree with the additional @@ -557,15 +641,11 @@ class LLManifest(object): srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: - if os.path.isdir(srcname): - self.ccopytree(srcname, dstname) - else: - self.ccopy(srcname, dstname) - # XXX What about devices, sockets etc.? + self.ccopymumble(srcname, dstname) except (IOError, os.error), why: errors.append((srcname, dstname, why)) if errors: - raise RuntimeError, errors + raise ManifestError, errors def cmakedirs(self, path): @@ -582,11 +662,25 @@ class LLManifest(object): if os.path.exists(f): return f # didn't find it, return last item in list - if list: + if len(list) > 0: return list[-1] else: return None + def contents_of_tar(self, src_tar, dst_dir): + """ Extracts the contents of the tarfile (specified + relative to the source prefix) into the directory + specified relative to the destination directory.""" + self.check_file_exists(src_tar) + tf = tarfile.open(self.src_path_of(src_tar), 'r') + for member in tf.getmembers(): + tf.extract(member, self.ensure_dst_dir(dst_dir)) + # TODO get actions working on these dudes, perhaps we should extract to a temporary directory and then process_directory on it? + self.file_list.append([src_tar, + self.dst_path_of(os.path.join(dst_dir,member.name))]) + tf.close() + + def wildcard_regex(self, src_glob, dst_glob): src_re = re.escape(src_glob) src_re = src_re.replace('\*', '([-a-zA-Z0-9._ ]*)') @@ -597,7 +691,12 @@ class LLManifest(object): i = i+1 return re.compile(src_re), dst_temp - wildcard_pattern = re.compile('\*') + def check_file_exists(self, path): + if not os.path.exists(path) and not os.path.islink(path): + raise MissingError("Path %s doesn't exist" % (os.path.abspath(path),)) + + + wildcard_pattern = re.compile(r'\*') def expand_globs(self, src, dst): src_list = glob.glob(src) src_re, d_template = self.wildcard_regex(src.replace('\\', '/'), @@ -624,43 +723,53 @@ class LLManifest(object): return self.path(os.path.join(path, file), file) def path(self, src, dst=None): + sys.stdout.write("Processing %s => %s ... " % (src, dst)) sys.stdout.flush() if src == None: - raise RuntimeError("No source file, dst is " + dst) + raise ManifestError("No source file, dst is " + dst) if dst == None: dst = src dst = os.path.join(self.get_dst_prefix(), dst) - sys.stdout.write("Processing %s => %s ... " % (src, dst)) - count = 0 - is_glob = False - found_files = [] - # look under each prefix for matching paths. Paths are normalized so './../blah' will match '../blah/../blah/' - paths = set([os.path.normpath(os.path.join(self.get_src_prefix(), src)), - os.path.normpath(os.path.join(self.get_artwork_prefix(), src)), - os.path.normpath(os.path.join(self.get_build_prefix(), src)), - os.path.normpath(os.path.join(self.get_alt_build_prefix(), src))] - ) - for path in paths: - if self.wildcard_pattern.search(path): - is_glob = True - for s,d in self.expand_globs(path, dst): + def try_path(src): + # expand globs + count = 0 + if self.wildcard_pattern.search(src): + for s,d in self.expand_globs(src, dst): assert(s != d) - found_files.extend(self.process_file(s, d)) + count += self.process_file(s, d) else: + # if we're specifying a single path (not a glob), + # we should error out if it doesn't exist + self.check_file_exists(src) # if it's a directory, recurse through it - if os.path.isdir(path): - found_files.extend(self.process_directory(path, dst)) - elif os.path.exists(path): - found_files.extend(self.process_file(path, dst)) + if os.path.isdir(src): + count += self.process_directory(src, dst) + else: + count += self.process_file(src, dst) + return count - # if we're specifying a single path (not a glob), - # we should error out if it doesn't exist - if not found_files and not is_glob: - raise RuntimeError("No files match %s\n" % str(paths)) + for pfx in self.get_src_prefix(), self.get_artwork_prefix(), self.get_build_prefix(): + try: + count = try_path(os.path.join(pfx, src)) + except MissingError: + # If src isn't a wildcard, and if that file doesn't exist in + # this pfx, try next pfx. + count = 0 + continue - print "%d files" % len(found_files) - return found_files + # Here try_path() didn't raise MissingError. Did it process any files? + if count: + break + # Even though try_path() didn't raise MissingError, it returned 0 + # files. src is probably a wildcard meant for some other pfx. Loop + # back to try the next. + + print "%d files" % count + + # Let caller check whether we processed as many files as expected. In + # particular, let caller notice 0. + return count def do(self, *actions): self.actions = actions diff --git a/indra/lib/python/uuid.py b/indra/lib/python/uuid.py index 0bc21a35f..e956383cc 100644 --- a/indra/lib/python/uuid.py +++ b/indra/lib/python/uuid.py @@ -1,3 +1,24 @@ +#!/usr/bin/python +## $LicenseInfo:firstyear=2011&license=viewerlgpl$ +## Second Life Viewer Source Code +## Copyright (C) 2011, Linden Research, Inc. +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; +## version 2.1 of the License only. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +## $/LicenseInfo$ r"""UUID objects (universally unique identifiers) according to RFC 4122. This module provides immutable UUID objects (class UUID) and the functions diff --git a/indra/libpathing/CMakeLists.txt b/indra/libpathing/CMakeLists.txt index 35086c716..2ab424822 100644 --- a/indra/libpathing/CMakeLists.txt +++ b/indra/libpathing/CMakeLists.txt @@ -30,5 +30,3 @@ set_source_files_properties(${libpathing_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) add_library(nd_Pathing STATIC ${libpathing_SOURCE_FILES} ${libpathing_HEADER_FILES} ) -add_dependencies(nd_Pathing prepare) - diff --git a/indra/libpathing/llpathinglib.cpp b/indra/libpathing/llpathinglib.cpp index 19c0bff0f..041311de9 100644 --- a/indra/libpathing/llpathinglib.cpp +++ b/indra/libpathing/llpathinglib.cpp @@ -1,4 +1,3 @@ -#include "sys.h" #include "llpathinglib.h" void LLPathingLib::initSystem() diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 45962d898..0dbd6f3de 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -86,10 +86,10 @@ LLAssetType::EType LLWearable::getAssetType() const return LLWearableType::getAssetType(mType); } -BOOL LLWearable::exportFile(LLFILE* fp) const +BOOL LLWearable::exportFile(const std::string& filename) const { - llofstream ofs(fp); - return exportStream(ofs); + llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); + return ofs.is_open() && exportStream(ofs); } // virtual @@ -105,13 +105,13 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const output_stream << mDescription << "\n"; // permissions - if( !mPermissions.exportStream( output_stream ) ) + if( !mPermissions.exportLegacyStream( output_stream ) ) { return FALSE; } // sale info - if( !mSaleInfo.exportStream( output_stream ) ) + if( !mSaleInfo.exportLegacyStream( output_stream ) ) { return FALSE; } @@ -193,7 +193,7 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp) if (layer_set) { - layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); + layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); } else { @@ -201,10 +201,11 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp) } } -LLWearable::EImportResult LLWearable::importFile(LLFILE* fp, LLAvatarAppearance* avatarp ) +LLWearable::EImportResult LLWearable::importFile(const std::string& filename, + LLAvatarAppearance* avatarp ) { - llifstream ifs(fp); - return importStream(ifs, avatarp); + llifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary); + return (! ifs.is_open())? FAILURE : importStream(ifs, avatarp); } // virtual @@ -287,7 +288,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, LL_WARNS() << "Bad Wearable asset: missing valid permissions" << LL_ENDL; return LLWearable::FAILURE; } - if( !mPermissions.importStream( input_stream ) ) + if( !mPermissions.importLegacyStream( input_stream ) ) { return LLWearable::FAILURE; } @@ -312,7 +313,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // up the vast majority of the tasks. BOOL has_perm_mask = FALSE; U32 perm_mask = 0; - if( !mSaleInfo.importStream(input_stream, has_perm_mask, perm_mask) ) + if( !mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask) ) { return LLWearable::FAILURE; } diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index 3ffcc7516..d9527b9e9 100644 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -82,8 +82,8 @@ public: SUCCESS, BAD_HEADER }; - BOOL exportFile(LLFILE* file) const; - EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp ); + BOOL exportFile(const std::string& filename) const; + EImportResult importFile(const std::string& filename, LLAvatarAppearance* avatarp ); virtual BOOL exportStream( std::ostream& output_stream ) const; virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ); diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt index 25970a99a..f6ea97d07 100644 --- a/indra/llaudio/CMakeLists.txt +++ b/indra/llaudio/CMakeLists.txt @@ -5,12 +5,7 @@ project(llaudio) include(00-Common) include(Audio) include(LLAudio) -if (FMODSTUDIO) - include(FMODSTUDIO) -endif (FMODSTUDIO) -if (FMODEX) - include(FMODEX) -endif (FMODEX) +include(FMODSTUDIO) include(OPENAL) include(LLCommon) include(LLMath) @@ -68,20 +63,6 @@ if (FMODSTUDIO) ) endif (FMODSTUDIO) -if (FMODEX) - list(APPEND llaudio_SOURCE_FILES - llaudioengine_fmodex.cpp - lllistener_fmodex.cpp - llstreamingaudio_fmodex.cpp - ) - - list(APPEND llaudio_HEADER_FILES - llaudioengine_fmodex.h - lllistener_fmodex.h - llstreamingaudio_fmodex.h - ) -endif (FMODEX) - if (OPENAL) list(APPEND llaudio_SOURCE_FILES llaudioengine_openal.cpp @@ -100,5 +81,3 @@ set_source_files_properties(${llaudio_HEADER_FILES} list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) add_library (llaudio ${llaudio_SOURCE_FILES}) -add_dependencies(llaudio prepare) - diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp deleted file mode 100644 index 8b71012ba..000000000 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ /dev/null @@ -1,1027 +0,0 @@ -/** - * @file audioengine_FMODEX.cpp - * @brief Implementation of LLAudioEngine class abstracting the audio support as a FMOD 3D implementation - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llstreamingaudio.h" -#include "llstreamingaudio_fmodex.h" - -#include "llaudioengine_fmodex.h" -#include "lllistener_fmodex.h" - -#include "llerror.h" -#include "llmath.h" -#include "llrand.h" - -#include "fmod.hpp" -#include "fmod_errors.h" -#include "lldir.h" -#include "llapr.h" - -#include "sound_ids.h" - -#if LL_WINDOWS //Some ugly code to make missing fmodex.dll not cause a fatal error. -#define WIN32_LEAN_AND_MEAN -#include "windows.h" -#include -#pragma comment(lib, "delayimp.lib") - -bool attemptDelayLoad() -{ - __try - { -#if defined(_WIN64) - if( FAILED( __HrLoadAllImportsForDll( "fmodex64.dll" ) ) ) - return false; -#else - if( FAILED( __HrLoadAllImportsForDll( "fmodex.dll" ) ) ) - return false; -#endif - } - __except( EXCEPTION_EXECUTE_HANDLER ) - { - return false; - } - return true; -} -#endif - -static bool sVerboseDebugging = false; - -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels); - -FMOD::ChannelGroup *LLAudioEngine_FMODEX::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; - -//This class is designed to keep track of all sound<->channel assocations. -//Used to verify validity of sound and channel pointers, as well as catch cases were sounds -//are released with active channels still attached. -class CFMODSoundChecks -{ - typedef std::map > active_sounds_t; - typedef std::set dead_sounds_t; - typedef std::map active_channels_t; - typedef std::map dead_channels_t; - - active_sounds_t mActiveSounds; - dead_sounds_t mDeadSounds; - active_channels_t mActiveChannels; - dead_channels_t mDeadChannels; -public: - enum STATUS - { - ACTIVE, - DEAD, - UNKNOWN - }; - STATUS getPtrStatus(LLAudioChannel* channel) - { - if(!channel) - return UNKNOWN; - return getPtrStatus(dynamic_cast(channel)->mChannelp); - } - STATUS getPtrStatus(LLAudioBuffer* sound) - { - if(!sound) - return UNKNOWN; - return getPtrStatus(dynamic_cast(sound)->mSoundp); - } - STATUS getPtrStatus(FMOD::Channel* channel) - { - if(!channel) - return UNKNOWN; - else if(mActiveChannels.find(channel) != mActiveChannels.end()) - return ACTIVE; - else if(mDeadChannels.find(channel) != mDeadChannels.end()) - return DEAD; - return UNKNOWN; - } - STATUS getPtrStatus(FMOD::Sound* sound) - { - if(!sound) - return UNKNOWN; - if(mActiveSounds.find(sound) != mActiveSounds.end()) - return ACTIVE; - else if(mDeadSounds.find(sound) != mDeadSounds.end()) - return DEAD; - return UNKNOWN; - } - void addNewSound(FMOD::Sound* sound) - { - assertActiveState(sound,true,false); - - mDeadSounds.erase(sound); - mActiveSounds.insert(std::make_pair(sound,std::set())); - } - void removeSound(FMOD::Sound* sound) - { - assertActiveState(sound,true); - - active_sounds_t::const_iterator it = mActiveSounds.find(sound); - llassert(it != mActiveSounds.end()); - if(it != mActiveSounds.end()) - { - if(!it->second.empty()) - { - LL_WARNS("AudioImpl") << "Removing sound " << sound << " with attached channels: \n"; - for(std::set::iterator it2 = it->second.begin(); it2 != it->second.end();++it2) - { - switch(getPtrStatus(*it2)) - { - case ACTIVE: - LL_CONT << " Channel " << *it2 << " ACTIVE\n"; - break; - case DEAD: - LL_CONT << " Channel " << *it2 << " DEAD\n"; - break; - default: - LL_CONT << " Channel " << *it2 << " UNKNOWN\n"; - } - } - LL_CONT << LL_ENDL; - } - llassert(it->second.empty()); - mDeadSounds.insert(sound); - mActiveSounds.erase(sound); - } - } - void addNewChannelToSound(FMOD::Sound* sound,FMOD::Channel* channel) - { - assertActiveState(sound,true); - assertActiveState(channel,true,false); - - mActiveSounds[sound].insert(channel); - mActiveChannels.insert(std::make_pair(channel,sound)); - } - void removeChannel(FMOD::Channel* channel) - { - assertActiveState(channel,true); - - active_channels_t::const_iterator it = mActiveChannels.find(channel); - llassert(it != mActiveChannels.end()); - if(it != mActiveChannels.end()) - { -#ifdef SHOW_ASSERT - STATUS status = getPtrStatus(it->second); - llassert(status != DEAD); - llassert(status != UNKNOWN); -#endif - - active_sounds_t::iterator it2 = mActiveSounds.find(it->second); - llassert(it2 != mActiveSounds.end()); - if(it2 != mActiveSounds.end()) - { - it2->second.erase(channel); - } - mDeadChannels.insert(*it); - mActiveChannels.erase(channel); - } - } - - template - void assertActiveState(T ptr, bool try_log=false, bool active=true) - { -#ifndef SHOW_ASSERT - if(try_log && sVerboseDebugging) -#endif - { - CFMODSoundChecks::STATUS chan = getPtrStatus(ptr); - if(try_log && sVerboseDebugging) - { - if(active) - { - if(chan == CFMODSoundChecks::DEAD) - LL_WARNS("AudioImpl") << __FUNCTION__ << ": Using unexpectedly dead " << typeid(T*).name() << " " << ptr << LL_ENDL; - else if(chan == CFMODSoundChecks::UNKNOWN) - LL_WARNS("AudioImpl") << __FUNCTION__ << ": Using unexpectedly unknown " << typeid(T*).name() << " " << ptr << LL_ENDL; - } - else if(chan == CFMODSoundChecks::ACTIVE) - LL_WARNS("AudioImpl") << __FUNCTION__ << ": Using unexpectedly active " << typeid(T*).name() << " " << ptr << LL_ENDL; - } - llassert( active == (chan == CFMODSoundChecks::ACTIVE) ); - } - } -} gSoundCheck; - -LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler, bool verbose_debugging) -{ - sVerboseDebugging = verbose_debugging; - mInited = false; - mWindGen = NULL; - mWindDSP = NULL; - mSystem = NULL; - mEnableProfiler = enable_profiler; -} - - -LLAudioEngine_FMODEX::~LLAudioEngine_FMODEX() -{ -} - - -inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) -{ - if(result == FMOD_OK) - return false; - LL_WARNS("AudioImpl") << string << " Error: " << FMOD_ErrorString(result) << LL_ENDL; - return true; -} - -void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - if(type & FMOD_MEMORY_STREAM_DECODE) - { - LL_INFOS("AudioImpl") << "Decode buffer size: " << size << LL_ENDL; - } - else if(type & FMOD_MEMORY_STREAM_FILE) - { - LL_INFOS("AudioImpl") << "Stream buffer size: " << size << LL_ENDL; - } - return new char[size]; -} -void* F_STDCALL decode_realloc(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - memset(ptr,0,size); - return ptr; -} -void F_STDCALL decode_dealloc(void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - delete[] (char*)ptr; -} - -bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata) -{ - -#if LL_WINDOWS - if(!attemptDelayLoad()) - return false; -#endif - - U32 version = 0; - FMOD_RESULT result; - - LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL; - - //result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE); - //if(Check_FMOD_Error(result, "FMOD::Memory_Initialize")) - // return false; - - result = FMOD::System_Create(&mSystem); - if(Check_FMOD_Error(result, "FMOD::System_Create")) - return false; - - //will call LLAudioEngine_FMODEX::allocateListener, which needs a valid mSystem pointer. - LLAudioEngine::init(num_channels, userdata); - - result = mSystem->getVersion(&version); - Check_FMOD_Error(result, "FMOD::System::getVersion"); - - if (version < FMOD_VERSION) - { - LL_WARNS("AppInit") << "Error : You are using the wrong FMOD Ex version (" << version - << ")! You should be using FMOD Ex" << FMOD_VERSION << LL_ENDL; - } - -// result = mSystem->setSoftwareFormat(44100, FMOD_SOUND_FORMAT_PCM16, 0, 0, FMOD_DSP_RESAMPLER_LINEAR); -// Check_FMOD_Error(result,"FMOD::System::setSoftwareFormat"); - - // In this case, all sounds, PLUS wind and stream will be software. - result = mSystem->setSoftwareChannels(num_channels + 2); - Check_FMOD_Error(result,"FMOD::System::setSoftwareChannels"); - - U32 fmod_flags = FMOD_INIT_NORMAL; - if(mEnableProfiler) - { - fmod_flags |= FMOD_INIT_ENABLE_PROFILE; - } - -#if LL_LINUX - bool audio_ok = false; - - if (!audio_ok) - { - if (NULL == getenv("LL_BAD_FMOD_PULSEAUDIO")) /*Flawfinder: ignore*/ - { - LL_DEBUGS("AppInit") << "Trying PulseAudio audio output..." << LL_ENDL; - if((result = mSystem->setOutput(FMOD_OUTPUTTYPE_PULSEAUDIO)) == FMOD_OK && - (result = mSystem->init(num_channels + 2, fmod_flags, 0)) == FMOD_OK) - { - LL_DEBUGS("AppInit") << "PulseAudio output initialized OKAY" << LL_ENDL; - audio_ok = true; - } - else - { - Check_FMOD_Error(result, "PulseAudio audio output FAILED to initialize"); - } - } - else - { - LL_DEBUGS("AppInit") << "PulseAudio audio output SKIPPED" << LL_ENDL; - } - } - if (!audio_ok) - { - if (NULL == getenv("LL_BAD_FMOD_ALSA")) /*Flawfinder: ignore*/ - { - LL_DEBUGS("AppInit") << "Trying ALSA audio output..." << LL_ENDL; - if((result = mSystem->setOutput(FMOD_OUTPUTTYPE_ALSA)) == FMOD_OK && - (result = mSystem->init(num_channels + 2, fmod_flags, 0)) == FMOD_OK) - { - LL_DEBUGS("AppInit") << "ALSA audio output initialized OKAY" << LL_ENDL; - audio_ok = true; - } - else - { - Check_FMOD_Error(result, "ALSA audio output FAILED to initialize"); - } - } - else - { - LL_DEBUGS("AppInit") << "ALSA audio output SKIPPED" << LL_ENDL; - } - } - if (!audio_ok) - { - if (NULL == getenv("LL_BAD_FMOD_OSS")) /*Flawfinder: ignore*/ - { - LL_DEBUGS("AppInit") << "Trying OSS audio output..." << LL_ENDL; - if((result = mSystem->setOutput(FMOD_OUTPUTTYPE_OSS)) == FMOD_OK && - (result = mSystem->init(num_channels + 2, fmod_flags, 0)) == FMOD_OK) - { - LL_DEBUGS("AppInit") << "OSS audio output initialized OKAY" << LL_ENDL; - audio_ok = true; - } - else - { - Check_FMOD_Error(result, "OSS audio output FAILED to initialize"); - } - } - else - { - LL_DEBUGS("AppInit") << "OSS audio output SKIPPED" << LL_ENDL; - } - } - if (!audio_ok) - { - LL_WARNS("AppInit") << "Overall audio init failure." << LL_ENDL; - return false; - } - - // We're interested in logging which output method we - // ended up with, for QA purposes. - FMOD_OUTPUTTYPE output_type; - if(!Check_FMOD_Error(mSystem->getOutput(&output_type), "FMOD::System::getOutput")) - { - switch (output_type) - { - case FMOD_OUTPUTTYPE_NOSOUND: - LL_INFOS("AppInit") << "Audio output: NoSound" << LL_ENDL; break; - case FMOD_OUTPUTTYPE_PULSEAUDIO: - LL_INFOS("AppInit") << "Audio output: PulseAudio" << LL_ENDL; break; - case FMOD_OUTPUTTYPE_ALSA: - LL_INFOS("AppInit") << "Audio output: ALSA" << LL_ENDL; break; - case FMOD_OUTPUTTYPE_OSS: - LL_INFOS("AppInit") << "Audio output: OSS" << LL_ENDL; break; - default: - LL_INFOS("AppInit") << "Audio output: Unknown!" << LL_ENDL; break; - }; - } -#else // LL_LINUX - - // initialize the FMOD engine - result = mSystem->init( num_channels + 2, fmod_flags, 0); - if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) - { - /* - Ok, the speaker mode selected isn't supported by this soundcard. Switch it - back to stereo... - */ - result = mSystem->setSpeakerMode(FMOD_SPEAKERMODE_STEREO); - Check_FMOD_Error(result,"Error falling back to stereo mode"); - /* - ... and re-init. - */ - result = mSystem->init( num_channels + 2, fmod_flags, 0); - } - if(Check_FMOD_Error(result, "Error initializing FMOD Ex")) - return false; -#endif - - if (mEnableProfiler) - { - Check_FMOD_Error(mSystem->createChannelGroup("None", &mChannelGroups[AUDIO_TYPE_NONE]), "FMOD::System::createChannelGroup"); - Check_FMOD_Error(mSystem->createChannelGroup("SFX", &mChannelGroups[AUDIO_TYPE_SFX]), "FMOD::System::createChannelGroup"); - Check_FMOD_Error(mSystem->createChannelGroup("UI", &mChannelGroups[AUDIO_TYPE_UI]), "FMOD::System::createChannelGroup"); - Check_FMOD_Error(mSystem->createChannelGroup("Ambient", &mChannelGroups[AUDIO_TYPE_AMBIENT]), "FMOD::System::createChannelGroup"); - } - - // set up our favourite FMOD-native streaming audio implementation if none has already been added - if (!getStreamingAudioImpl()) // no existing implementation added - setStreamingAudioImpl(new LLStreamingAudio_FMODEX(mSystem)); - - LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init() FMOD Ex initialized correctly" << LL_ENDL; - - int r_numbuffers, r_samplerate, r_channels, r_bits; - unsigned int r_bufferlength; - char r_name[256]; - FMOD_SPEAKERMODE speaker_mode; - if (!Check_FMOD_Error(mSystem->getDSPBufferSize(&r_bufferlength, &r_numbuffers), "FMOD::System::getDSPBufferSize") && - !Check_FMOD_Error(mSystem->getSoftwareFormat(&r_samplerate, NULL, &r_channels, NULL, NULL, &r_bits), "FMOD::System::getSoftwareFormat") && - !Check_FMOD_Error(mSystem->getDriverInfo(0, r_name, 255, 0), "FMOD::System::getDriverInfo") && - !Check_FMOD_Error(mSystem->getSpeakerMode(&speaker_mode), "FMOD::System::getSpeakerMode")) - { - std::string speaker_mode_str = "unknown"; - switch(speaker_mode) - { - #define SPEAKER_MODE_CASE(MODE) case MODE: speaker_mode_str = #MODE; break; - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_RAW) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_MONO) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_STEREO) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_QUAD) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_SURROUND) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_5POINT1) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_7POINT1) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_SRS5_1_MATRIX) - SPEAKER_MODE_CASE(FMOD_SPEAKERMODE_MYEARS) - default:; - #undef SPEAKER_MODE_CASE - } - - r_name[255] = '\0'; - int latency = 1000.0 * r_bufferlength * r_numbuffers /r_samplerate; - - LL_INFOS("AppInit") << "FMOD device: "<< r_name << "\n" - << "Output mode: "<< speaker_mode_str << "\n" - << "FMOD Ex parameters: " << r_samplerate << " Hz * " << r_channels << " * " <getVersion(&version), "FMOD::System::getVersion")) - { - return llformat("FMOD Ex %1x.%02x.%02x", version >> 16, version >> 8 & 0x000000FF, version & 0x000000FF); - } - } - return "FMODEx"; -} - - -void LLAudioEngine_FMODEX::allocateListener(void) -{ - mListenerp = (LLListener *) new LLListener_FMODEX(mSystem); - if (!mListenerp) - { - LL_WARNS("AudioImpl") << "Listener creation failed" << LL_ENDL; - } -} - - -void LLAudioEngine_FMODEX::shutdown() -{ - LL_INFOS("AudioImpl") << "About to LLAudioEngine::shutdown()" << LL_ENDL; - LLAudioEngine::shutdown(); - - LL_INFOS("AudioImpl") << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << LL_ENDL; - if ( mSystem ) // speculative fix for MAINT-2657 - { - LL_INFOS("AudioImpl") << "LLAudioEngine_FMODEX::shutdown() Requesting FMOD Ex system closure" << LL_ENDL; - Check_FMOD_Error(mSystem->close(), "FMOD::System::close"); - LL_INFOS("AudioImpl") << "LLAudioEngine_FMODEX::shutdown() Requesting FMOD Ex system release" << LL_ENDL; - Check_FMOD_Error(mSystem->release(), "FMOD::System::release"); - } - LL_INFOS("AudioImpl") << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << LL_ENDL; - - delete mListenerp; - mListenerp = NULL; -} - - -LLAudioBuffer * LLAudioEngine_FMODEX::createBuffer() -{ - return new LLAudioBufferFMODEX(mSystem); -} - - -LLAudioChannel * LLAudioEngine_FMODEX::createChannel() -{ - return new LLAudioChannelFMODEX(mSystem); -} - -bool LLAudioEngine_FMODEX::initWind() -{ - mNextWindUpdate = 0.0; - - cleanupWind(); - - - FMOD_DSP_DESCRIPTION dspdesc; - memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION)); //Set everything to zero - strncpy(dspdesc.name,"Wind Unit", sizeof(dspdesc.name)); //Set name to "Wind Unit" - dspdesc.channels=2; - dspdesc.read = &windCallback; //Assign callback. - if(Check_FMOD_Error(mSystem->createDSP(&dspdesc, &mWindDSP), "FMOD::createDSP") || !mWindDSP) - return false; - - float frequency = 44100; - if (!Check_FMOD_Error(mWindDSP->getDefaults(&frequency,0,0,0), "FMOD::DSP::getDefaults")) - { - mWindGen = new LLWindGen((U32)frequency); - if (!Check_FMOD_Error(mWindDSP->setUserData((void*)mWindGen), "FMOD::DSP::setUserData") && - !Check_FMOD_Error(mSystem->playDSP(FMOD_CHANNEL_FREE, mWindDSP, false, 0), "FMOD::System::playDSP")) - return true; //Success - } - - cleanupWind(); - return false; -} - - -void LLAudioEngine_FMODEX::cleanupWind() -{ - if (mWindDSP) - { - Check_FMOD_Error(mWindDSP->remove(), "FMOD::DSP::remove"); - Check_FMOD_Error(mWindDSP->release(), "FMOD::DSP::release"); - mWindDSP = NULL; - } - - delete mWindGen; - mWindGen = NULL; -} - - -//----------------------------------------------------------------------- -void LLAudioEngine_FMODEX::updateWind(LLVector3 wind_vec, F32 camera_height_above_water) -{ - LLVector3 wind_pos; - F64 pitch; - F64 center_freq; - - if (!mEnableWind) - { - return; - } - - if (mWindUpdateTimer.checkExpirationAndReset(LL_WIND_UPDATE_INTERVAL)) - { - - // wind comes in as Linden coordinate (+X = forward, +Y = left, +Z = up) - // need to convert this to the conventional orientation DS3D and OpenAL use - // where +X = right, +Y = up, +Z = backwards - - wind_vec.setVec(-wind_vec.mV[1], wind_vec.mV[2], -wind_vec.mV[0]); - - // cerr << "Wind update" << endl; - - pitch = 1.0 + mapWindVecToPitch(wind_vec); - center_freq = 80.0 * pow(pitch,2.5*(mapWindVecToGain(wind_vec)+1.0)); - - mWindGen->mTargetFreq = (F32)center_freq; - mWindGen->mTargetGain = (F32)mapWindVecToGain(wind_vec) * mMaxWindGain; - mWindGen->mTargetPanGainR = (F32)mapWindVecToPan(wind_vec); - } -} - -//----------------------------------------------------------------------- -void LLAudioEngine_FMODEX::setInternalGain(F32 gain) -{ - if (!mInited) - { - return; - } - - gain = llclamp( gain, 0.0f, 1.0f ); - - FMOD::ChannelGroup *master_group; - if(Check_FMOD_Error(mSystem->getMasterChannelGroup(&master_group), "FMOD::System::getMasterChannelGroup")) - return; - master_group->setVolume(gain); - - LLStreamingAudioInterface *saimpl = getStreamingAudioImpl(); - if ( saimpl ) - { - // fmod likes its streaming audio channel gain re-asserted after - // master volume change. - saimpl->setGain(saimpl->getGain()); - } -} - -// -// LLAudioChannelFMODEX implementation -// - -LLAudioChannelFMODEX::LLAudioChannelFMODEX(FMOD::System *system) : LLAudioChannel(), mSystemp(system), mChannelp(NULL), mLastSamplePos(0) -{ -} - - -LLAudioChannelFMODEX::~LLAudioChannelFMODEX() -{ - if(sVerboseDebugging) - LL_DEBUGS("AudioImpl") << "Destructing Audio Channel. mChannelp = " << mChannelp << LL_ENDL; - - cleanup(); -} - -static FMOD_RESULT F_CALLBACK channel_callback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *commanddata1, void *commanddata2) -{ - if(type == FMOD_CHANNEL_CALLBACKTYPE_END) - { - FMOD::Channel* chan = reinterpret_cast(channel); - LLAudioChannelFMODEX* audio_channel = NULL; - chan->getUserData((void**)&audio_channel); - if(audio_channel) - { - audio_channel->onRelease(); - } - } - return FMOD_OK; -} - -void LLAudioChannelFMODEX::onRelease() -{ - llassert(mChannelp); - if(sVerboseDebugging) - LL_DEBUGS("AudioImpl") << "Fmod signaled channel release for channel " << mChannelp << LL_ENDL; - gSoundCheck.removeChannel(mChannelp); - mChannelp = NULL; //Null out channel here so cleanup doesn't try to redundantly stop it. - cleanup(); -} - -bool LLAudioChannelFMODEX::updateBuffer() -{ - if (LLAudioChannel::updateBuffer()) - { - // Base class update returned true, which means the channel buffer was changed, and not is null. - - // Grab the FMOD sample associated with the buffer - FMOD::Sound *soundp = ((LLAudioBufferFMODEX*)mCurrentBufferp)->getSound(); - if (!soundp) - { - // This is bad, there should ALWAYS be a sound associated with a legit - // buffer. - LL_ERRS("AudioImpl") << "No FMOD sound!" << LL_ENDL; - return false; - } - - // Actually play the sound. Start it off paused so we can do all the necessary - // setup. - if(!mChannelp) - { - FMOD_RESULT result = getSystem()->playSound(FMOD_CHANNEL_FREE, soundp, true, &mChannelp); - Check_FMOD_Error(result, "FMOD::System::playSound"); - if(result == FMOD_OK) - { - if(sVerboseDebugging) - LL_DEBUGS("AudioImpl") << "Created channel " << mChannelp << " for sound " << soundp << LL_ENDL; - - gSoundCheck.addNewChannelToSound(soundp,mChannelp); - mChannelp->setCallback(&channel_callback); - mChannelp->setUserData(this); - } - } - } - - // If we have a source for the channel, we need to update its gain. - if (mCurrentSourcep && mChannelp) - { - FMOD_RESULT result; - - gSoundCheck.assertActiveState(this); - result = mChannelp->setVolume(getSecondaryGain() * mCurrentSourcep->getGain()); - Check_FMOD_Error(result, "FMOD::Channel::setVolume"); - result = mChannelp->setMode(mCurrentSourcep->isLoop() ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF); - Check_FMOD_Error(result, "FMOD::Channel::setMode"); - } - - return true; -} - - -void LLAudioChannelFMODEX::update3DPosition() -{ - if (!mChannelp) - { - // We're not actually a live channel (i.e., we're not playing back anything) - return; - } - - LLAudioBufferFMODEX *bufferp = (LLAudioBufferFMODEX *)mCurrentBufferp; - if (!bufferp) - { - // We don't have a buffer associated with us (should really have been picked up - // by the above if. - return; - } - - gSoundCheck.assertActiveState(this); - - if (mCurrentSourcep->isAmbient()) - { - // Ambient sound, don't need to do any positional updates. - set3DMode(false); - } - else - { - // Localized sound. Update the position and velocity of the sound. - set3DMode(true); - - LLVector3 float_pos; - float_pos.setVec(mCurrentSourcep->getPositionGlobal()); - FMOD_RESULT result = mChannelp->set3DAttributes((FMOD_VECTOR*)float_pos.mV, (FMOD_VECTOR*)mCurrentSourcep->getVelocity().mV); - Check_FMOD_Error(result, "FMOD::Channel::set3DAttributes"); - } -} - - -void LLAudioChannelFMODEX::updateLoop() -{ - if (!mChannelp) - { - // May want to clear up the loop/sample counters. - return; - } - - gSoundCheck.assertActiveState(this); - - // - // Hack: We keep track of whether we looped or not by seeing when the - // sample position looks like it's going backwards. Not reliable; may - // yield false negatives. - // - U32 cur_pos; - Check_FMOD_Error(mChannelp->getPosition(&cur_pos,FMOD_TIMEUNIT_PCMBYTES),"FMOD::Channel::getPosition"); - - if (cur_pos < (U32)mLastSamplePos) - { - mLoopedThisFrame = true; - } - mLastSamplePos = cur_pos; -} - - -void LLAudioChannelFMODEX::cleanup() -{ - LLAudioChannel::cleanup(); - - if (!mChannelp) - { - llassert(mCurrentBufferp == NULL); - //LL_INFOS("AudioImpl") << "Aborting cleanup with no channel handle." << LL_ENDL; - return; - } - - if(sVerboseDebugging) - LL_DEBUGS("AudioImpl") << "Stopping channel " << mChannelp << LL_ENDL; - - gSoundCheck.removeChannel(mChannelp); - mChannelp->setCallback(NULL); - Check_FMOD_Error(mChannelp->stop(),"FMOD::Channel::stop"); - - mChannelp = NULL; - mLastSamplePos = 0; -} - - -void LLAudioChannelFMODEX::play() -{ - if (!mChannelp) - { - LL_WARNS("AudioImpl") << "Playing without a channel handle, aborting" << LL_ENDL; - return; - } - - gSoundCheck.assertActiveState(this,true); - - bool paused=true; - Check_FMOD_Error(mChannelp->getPaused(&paused), "FMOD::Channel::getPaused"); - if(!paused) - { - Check_FMOD_Error(mChannelp->setPaused(true), "FMOD::Channel::setPaused"); - Check_FMOD_Error(mChannelp->setPosition(0,FMOD_TIMEUNIT_PCMBYTES), "FMOD::Channel::setPosition"); - } - Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::setPaused"); - - if(sVerboseDebugging) - LL_DEBUGS("AudioImpl") << "Playing channel " << mChannelp << LL_ENDL; - - getSource()->setPlayedOnce(true); - - if(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]) - Check_FMOD_Error(mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]),"FMOD::Channel::setChannelGroup"); -} - - -void LLAudioChannelFMODEX::playSynced(LLAudioChannel *channelp) -{ - LLAudioChannelFMODEX *fmod_channelp = (LLAudioChannelFMODEX*)channelp; - if (!(fmod_channelp->mChannelp && mChannelp)) - { - // Don't have channels allocated to both the master and the slave - return; - } - - gSoundCheck.assertActiveState(this,true); - - U32 cur_pos; - if(Check_FMOD_Error(fmod_channelp->mChannelp->getPosition(&cur_pos,FMOD_TIMEUNIT_PCMBYTES), "Unable to retrieve current position")) - return; - - cur_pos %= mCurrentBufferp->getLength(); - - // Try to match the position of our sync master - Check_FMOD_Error(mChannelp->setPosition(cur_pos,FMOD_TIMEUNIT_PCMBYTES),"Unable to set current position"); - - // Start us playing - play(); -} - - -bool LLAudioChannelFMODEX::isPlaying() -{ - if (!mChannelp) - { - return false; - } - - gSoundCheck.assertActiveState(this); - - bool paused, playing; - Check_FMOD_Error(mChannelp->getPaused(&paused),"FMOD::Channel::getPaused"); - Check_FMOD_Error(mChannelp->isPlaying(&playing),"FMOD::Channel::isPlaying"); - return !paused && playing; -} - - -// -// LLAudioChannelFMODEX implementation -// - - -LLAudioBufferFMODEX::LLAudioBufferFMODEX(FMOD::System *system) : LLAudioBuffer(), mSystemp(system), mSoundp(NULL) -{ -} - - -LLAudioBufferFMODEX::~LLAudioBufferFMODEX() -{ - if(mSoundp) - { - if(sVerboseDebugging) - LL_DEBUGS("AudioImpl") << "Release sound " << mSoundp << LL_ENDL; - - gSoundCheck.removeSound(mSoundp); - Check_FMOD_Error(mSoundp->release(),"FMOD::Sound::Release"); - mSoundp = NULL; - } -} - - -bool LLAudioBufferFMODEX::loadWAV(const std::string& filename) -{ - // Try to open a wav file from disk. This will eventually go away, as we don't - // really want to block doing this. - if (filename.empty()) - { - // invalid filename, abort. - return false; - } - - if (!LLAPRFile::isExist(filename, LL_APR_RPB)) - { - // File not found, abort. - return false; - } - - if (mSoundp) - { - gSoundCheck.removeSound(mSoundp); - // If there's already something loaded in this buffer, clean it up. - Check_FMOD_Error(mSoundp->release(),"FMOD::Sound::release"); - mSoundp = NULL; - } - - FMOD_MODE base_mode = FMOD_LOOP_NORMAL | FMOD_SOFTWARE; - FMOD_CREATESOUNDEXINFO exinfo; - memset(&exinfo,0,sizeof(exinfo)); - exinfo.cbsize = sizeof(exinfo); - exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_WAV; //Hint to speed up loading. - // Load up the wav file into an fmod sample -#if LL_WINDOWS - FMOD_RESULT result = getSystem()->createSound((const char*)utf8str_to_utf16str(filename).c_str(), base_mode | FMOD_UNICODE, &exinfo, &mSoundp); -#else - FMOD_RESULT result = getSystem()->createSound(filename.c_str(), base_mode, &exinfo, &mSoundp); -#endif - - if (result != FMOD_OK) - { - // We failed to load the file for some reason. - LL_WARNS("AudioImpl") << "Could not load data '" << filename << "': " << FMOD_ErrorString(result) << LL_ENDL; - - // - // If we EVER want to load wav files provided by end users, we need - // to rethink this! - // - // file is probably corrupt - remove it. - LLFile::remove(filename); - return false; - } - - gSoundCheck.addNewSound(mSoundp); - - // Everything went well, return true - return true; -} - - -U32 LLAudioBufferFMODEX::getLength() -{ - if (!mSoundp) - { - return 0; - } - - gSoundCheck.assertActiveState(this); - U32 length; - Check_FMOD_Error(mSoundp->getLength(&length, FMOD_TIMEUNIT_PCMBYTES),"FMOD::Sound::getLength"); - return length; -} - - -void LLAudioChannelFMODEX::set3DMode(bool use3d) -{ - gSoundCheck.assertActiveState(this); - - FMOD_MODE current_mode; - if(Check_FMOD_Error(mChannelp->getMode(¤t_mode),"FMOD::Channel::getMode")) - return; - FMOD_MODE new_mode = current_mode; - new_mode &= ~(use3d ? FMOD_2D : FMOD_3D); - new_mode |= use3d ? FMOD_3D : FMOD_2D; - - if(current_mode != new_mode) - { - Check_FMOD_Error(mChannelp->setMode(new_mode),"FMOD::Channel::setMode"); - } -} - - -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *originalbuffer, float *newbuffer, unsigned int length, int inchannels, int outchannels) -{ - // originalbuffer = fmod's original mixbuffer. - // newbuffer = the buffer passed from the previous DSP unit. - // length = length in samples at this mix time. - // userdata = user parameter passed through in FSOUND_DSP_Create. - - LLWindGen *windgen; - FMOD::DSP *thisdsp = (FMOD::DSP *)dsp_state->instance; - - thisdsp->getUserData((void **)&windgen); - - if (windgen) - windgen->windGenerate((LLAudioEngine_FMODEX::MIXBUFFERFORMAT *)newbuffer, length); - - return FMOD_OK; -} diff --git a/indra/llaudio/llaudioengine_fmodex.h b/indra/llaudio/llaudioengine_fmodex.h deleted file mode 100644 index fe93d8c48..000000000 --- a/indra/llaudio/llaudioengine_fmodex.h +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @file audioengine_FMODEX.h - * @brief Definition of LLAudioEngine class abstracting the audio - * support as a FMOD 3D implementation - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_AUDIOENGINE_FMODEX_H -#define LL_AUDIOENGINE_FMODEX_H - -#include "llaudioengine.h" -#include "lllistener_fmodex.h" -#include "llwindgen.h" - -//Stubs -class LLAudioStreamManagerFMODEX; -namespace FMOD -{ - class System; - class Channel; - class ChannelGroup; - class Sound; - class DSP; -} - -//Interfaces -class LLAudioEngine_FMODEX : public LLAudioEngine -{ -public: - LLAudioEngine_FMODEX(bool enable_profiler, bool verbose_debugging); - virtual ~LLAudioEngine_FMODEX(); - - // initialization/startup/shutdown - virtual bool init(const S32 num_channels, void *user_data); - virtual std::string getDriverName(bool verbose); - virtual void allocateListener(); - - virtual void shutdown(); - - /*virtual*/ bool initWind(); - /*virtual*/ void cleanupWind(); - - /*virtual*/void updateWind(LLVector3 direction, F32 camera_height_above_water); - - typedef F32 MIXBUFFERFORMAT; - - FMOD::System *getSystem() const {return mSystem;} -protected: - /*virtual*/ LLAudioBuffer *createBuffer(); // Get a free buffer, or flush an existing one if you have to. - /*virtual*/ LLAudioChannel *createChannel(); // Create a new audio channel. - - /*virtual*/ void setInternalGain(F32 gain); - - bool mInited; - - LLWindGen *mWindGen; - - FMOD::DSP *mWindDSP; - FMOD::System *mSystem; - bool mEnableProfiler; - -public: - static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT]; -}; - - -class LLAudioChannelFMODEX : public LLAudioChannel -{ -public: - LLAudioChannelFMODEX(FMOD::System *audioengine); - virtual ~LLAudioChannelFMODEX(); - void onRelease(); -protected: - /*virtual*/ void play(); - /*virtual*/ void playSynced(LLAudioChannel *channelp); - /*virtual*/ void cleanup(); - /*virtual*/ bool isPlaying(); - - /*virtual*/ bool updateBuffer(); - /*virtual*/ void update3DPosition(); - /*virtual*/ void updateLoop(); - - void set3DMode(bool use3d); -protected: - FMOD::System *getSystem() const {return mSystemp;} - FMOD::System *mSystemp; - FMOD::Channel *mChannelp; - S32 mLastSamplePos; - - friend class CFMODSoundChecks; -}; - - -class LLAudioBufferFMODEX : public LLAudioBuffer -{ -public: - LLAudioBufferFMODEX(FMOD::System *audioengine); - virtual ~LLAudioBufferFMODEX(); - - /*virtual*/ bool loadWAV(const std::string& filename); - /*virtual*/ U32 getLength(); - friend class LLAudioChannelFMODEX; -protected: - FMOD::System *getSystem() const {return mSystemp;} - FMOD::System *mSystemp; - FMOD::Sound *getSound() const{ return mSoundp; } - FMOD::Sound *mSoundp; - - friend class CFMODSoundChecks; -}; - - -#endif // LL_AUDIOENGINE_FMODEX_H diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index 93541d3de..dc192a899 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -1,5 +1,5 @@ /** - * @file audioengine_FMODSTUDIO.cpp + * @file audioengine_fmodstudio.cpp * @brief Implementation of LLAudioEngine class abstracting the audio support as a FMOD 3D implementation * * $LicenseInfo:firstyear=2002&license=viewergpl$ @@ -79,7 +79,7 @@ bool attemptDelayLoad() static bool sVerboseDebugging = false; -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); +FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); FMOD::ChannelGroup *LLAudioEngine_FMODSTUDIO::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; @@ -248,7 +248,6 @@ LLAudioEngine_FMODSTUDIO::~LLAudioEngine_FMODSTUDIO() { } - inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) { if(result == FMOD_OK) @@ -257,45 +256,20 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) return true; } -void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - if(type & FMOD_MEMORY_STREAM_DECODE) - { - LL_INFOS("AudioImpl") << "Decode buffer size: " << size << LL_ENDL; - } - else if(type & FMOD_MEMORY_STREAM_FILE) - { - LL_INFOS("AudioImpl") << "Stream buffer size: " << size << LL_ENDL; - } - return new char[size]; -} -void* F_STDCALL decode_realloc(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - memset(ptr,0,size); - return ptr; -} -void F_STDCALL decode_dealloc(void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - delete[] (char*)ptr; -} - bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata) { - -#if LL_WINDOWS + LL_WARNS("AudioImpl") << "BARKBARKBARK" << LL_ENDL; +#if 0 //LL_WINDOWS if(!attemptDelayLoad()) return false; #endif U32 version = 0; + FMOD_RESULT result; LL_DEBUGS("AppInit") << "LLAudioEngine_FMODSTUDIO::init() initializing FMOD" << LL_ENDL; - //result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE); - //if(Check_FMOD_Error(result, "FMOD::Memory_Initialize")) - // return false; - result = FMOD::System_Create(&mSystem); if(Check_FMOD_Error(result, "FMOD::System_Create")) return false; @@ -477,7 +451,7 @@ std::string LLAudioEngine_FMODSTUDIO::getDriverName(bool verbose) return llformat("FMOD Studio %1x.%02x.%02x", version >> 16, version >> 8 & 0x000000FF, version & 0x000000FF); } } - return "FMODEx"; + return "FMOD Studio"; } @@ -533,15 +507,16 @@ bool LLAudioEngine_FMODSTUDIO::initWind() dspdesc.pluginsdkversion = FMOD_PLUGIN_SDK_VERSION; strncpy(dspdesc.name,"Wind Unit", sizeof(dspdesc.name)); //Set name to "Wind Unit" dspdesc.numoutputbuffers = 1; - dspdesc.read = &windCallback; //Assign callback. + dspdesc.read = &windDSPCallback; //Assign callback. if (Check_FMOD_Error(mSystem->createDSP(&dspdesc, &mWindDSP), "FMOD::createDSP") || !mWindDSP) return false; int frequency = 44100; - if (!Check_FMOD_Error(mSystem->getSoftwareFormat(&frequency, NULL, NULL), "FMOD::System::getSoftwareFormat")) + FMOD_SPEAKERMODE mode; + if (!Check_FMOD_Error(mSystem->getSoftwareFormat(&frequency, &mode, NULL), "FMOD::System::getSoftwareFormat")) { mWindGen = new LLWindGen((U32)frequency); - FMOD_SPEAKERMODE mode; + if (!Check_FMOD_Error(mWindDSP->setUserData((void*)mWindGen), "FMOD::DSP::setUserData") && !Check_FMOD_Error(mSystem->playDSP(mWindDSP, NULL, false, 0), "FMOD::System::playDSP") && !Check_FMOD_Error(mSystem->getSoftwareFormat(NULL, &mode, NULL), "FMOD::System::getSoftwareFormat") && @@ -686,6 +661,7 @@ bool LLAudioChannelFMODSTUDIO::updateBuffer() return false; } + // Actually play the sound. Start it off paused so we can do all the necessary // setup. if(!mChannelp) @@ -924,8 +900,7 @@ bool LLAudioBufferFMODSTUDIO::loadWAV(const std::string& filename) } FMOD_MODE base_mode = FMOD_LOOP_NORMAL; - FMOD_CREATESOUNDEXINFO exinfo; - memset(&exinfo,0,sizeof(exinfo)); + FMOD_CREATESOUNDEXINFO exinfo = {0}; exinfo.cbsize = sizeof(exinfo); exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_WAV; //Hint to speed up loading. // Load up the wav file into an fmod sample @@ -983,7 +958,7 @@ void LLAudioChannelFMODSTUDIO::set3DMode(bool use3d) } -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels) +FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels) { // inbuffer = incomming data. // newbuffer = outgoing data. AKA this DSP's output. diff --git a/indra/llaudio/lllistener_fmodex.cpp b/indra/llaudio/lllistener_fmodex.cpp deleted file mode 100644 index e70dc7c60..000000000 --- a/indra/llaudio/lllistener_fmodex.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @file listener_fmod.cpp - * @brief implementation of LISTENER class abstracting the audio - * support as a FMOD 3D implementation (windows only) - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "llaudioengine.h" -#include "lllistener_fmodex.h" -#include "fmod.hpp" - -//----------------------------------------------------------------------- -// constructor -//----------------------------------------------------------------------- -LLListener_FMODEX::LLListener_FMODEX(FMOD::System *system) -{ - mSystem = system; - init(); -} - -//----------------------------------------------------------------------- -LLListener_FMODEX::~LLListener_FMODEX() -{ -} - -//----------------------------------------------------------------------- -void LLListener_FMODEX::init(void) -{ - // do inherited - LLListener::init(); - mDopplerFactor = 1.0f; - mRolloffFactor = 1.0f; -} - -//----------------------------------------------------------------------- -void LLListener_FMODEX::translate(LLVector3 offset) -{ - LLListener::translate(offset); - - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mPosition.mV, NULL, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODEX::setPosition(LLVector3 pos) -{ - LLListener::setPosition(pos); - - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mPosition.mV, NULL, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODEX::setVelocity(LLVector3 vel) -{ - LLListener::setVelocity(vel); - - mSystem->set3DListenerAttributes(0, NULL, (FMOD_VECTOR*)mVelocity.mV, (FMOD_VECTOR*)mListenAt.mV, (FMOD_VECTOR*)mListenUp.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODEX::orient(LLVector3 up, LLVector3 at) -{ - LLListener::orient(up, at); - - // Welcome to the transition between right and left - // (coordinate systems, that is) - // Leaving the at vector alone results in a L/R reversal - // since DX is left-handed and we (LL, OpenGL, OpenAL) are right-handed - at = -at; - - mSystem->set3DListenerAttributes(0, NULL, NULL, (FMOD_VECTOR*)at.mV, (FMOD_VECTOR*)up.mV); -} - -//----------------------------------------------------------------------- -void LLListener_FMODEX::commitDeferredChanges() -{ - mSystem->update(); -} - - -void LLListener_FMODEX::setRolloffFactor(F32 factor) -{ - //An internal FMODEx optimization skips 3D updates if there have not been changes to the 3D sound environment. - //Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well. - //In short: Changing the position ticks a dirtyflag inside fmodex, which makes it not skip 3D processing next update call. - if(mRolloffFactor != factor) - { - LLVector3 pos = mVelocity - LLVector3(0.f,0.f,.1f); - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL); - mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mVelocity.mV, NULL, NULL, NULL); - } - mRolloffFactor = factor; - mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor); -} - - -F32 LLListener_FMODEX::getRolloffFactor() -{ - return mRolloffFactor; -} - - -void LLListener_FMODEX::setDopplerFactor(F32 factor) -{ - mDopplerFactor = factor; - mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor); -} - - -F32 LLListener_FMODEX::getDopplerFactor() -{ - return mDopplerFactor; -} - - diff --git a/indra/llaudio/lllistener_fmodex.h b/indra/llaudio/lllistener_fmodex.h deleted file mode 100644 index 8a91b3a2e..000000000 --- a/indra/llaudio/lllistener_fmodex.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @file listener_fmod.h - * @brief Description of LISTENER class abstracting the audio support - * as an FMOD 3D implementation (windows and Linux) - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LISTENER_FMODEX_H -#define LL_LISTENER_FMODEX_H - -#include "lllistener.h" - -//Stubs -namespace FMOD -{ - class System; -} - -//Interfaces -class LLListener_FMODEX : public LLListener -{ - public: - LLListener_FMODEX(FMOD::System *system); - virtual ~LLListener_FMODEX(); - virtual void init(); - - virtual void translate(LLVector3 offset); - virtual void setPosition(LLVector3 pos); - virtual void setVelocity(LLVector3 vel); - virtual void orient(LLVector3 up, LLVector3 at); - virtual void commitDeferredChanges(); - - virtual void setDopplerFactor(F32 factor); - virtual F32 getDopplerFactor(); - virtual void setRolloffFactor(F32 factor); - virtual F32 getRolloffFactor(); - protected: - FMOD::System *mSystem; - F32 mDopplerFactor; - F32 mRolloffFactor; -}; - -#endif - - diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp deleted file mode 100644 index 39436977a..000000000 --- a/indra/llaudio/llstreamingaudio_fmodex.cpp +++ /dev/null @@ -1,596 +0,0 @@ -/** - * @file streamingaudio_fmod.cpp - * @brief LLStreamingAudio_FMODEX implementation - * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llmath.h" - -#include "fmod.hpp" -#include "fmod_errors.h" - -#include "llstreamingaudio_fmodex.h" - -inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) -{ - if (result == FMOD_OK) - return false; - LL_WARNS("AudioImpl") << string << " Error: " << FMOD_ErrorString(result) << LL_ENDL; - return true; -} - -class LLAudioStreamManagerFMODEX -{ -public: - LLAudioStreamManagerFMODEX(FMOD::System *system, const std::string& url); - FMOD::Channel* startStream(); - bool stopStream(); // Returns true if the stream was successfully stopped. - bool ready(); - - const std::string& getURL() { return mInternetStreamURL; } - - FMOD_RESULT getOpenState(FMOD_OPENSTATE& openstate, unsigned int* percentbuffered=NULL, bool* starving=NULL, bool* diskbusy=NULL); -protected: - FMOD::System* mSystem; - FMOD::Channel* mStreamChannel; - FMOD::Sound* mInternetStream; - bool mReady; - - std::string mInternetStreamURL; -}; - - - -//--------------------------------------------------------------------------- -// Internet Streaming -//--------------------------------------------------------------------------- -LLStreamingAudio_FMODEX::LLStreamingAudio_FMODEX(FMOD::System *system) : - mSystem(system), - mCurrentInternetStreamp(NULL), - mFMODInternetStreamChannelp(NULL), - mGain(1.0f), - mMetaData(NULL) -{ - FMOD_RESULT result; - - // Number of milliseconds of audio to buffer for the audio card. - // Must be larger than the usual Second Life frame stutter time. - const U32 buffer_seconds = 10; //sec - const U32 estimated_bitrate = 128; //kbit/sec - result = mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES); - Check_FMOD_Error(result, "FMOD::System::setStreamBufferSize"); - - // Here's where we set the size of the network buffer and some buffering - // parameters. In this case we want a network buffer of 16k, we want it - // to prebuffer 40% of that when we first connect, and we want it - // to rebuffer 80% of that whenever we encounter a buffer underrun. - - // Leave the net buffer properties at the default. - //FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80); -} - - -LLStreamingAudio_FMODEX::~LLStreamingAudio_FMODEX() -{ - stop(); - for (U32 i = 0; i < 100; ++i) - { - if (releaseDeadStreams()) - break; - ms_sleep(10); - } -} - - -void LLStreamingAudio_FMODEX::start(const std::string& url) -{ - //if (!mInited) - //{ - // LL_WARNS() << "startInternetStream before audio initialized" << LL_ENDL; - // return; - //} - - // "stop" stream but don't clear url, etc. in case url == mInternetStreamURL - stop(); - - if (!url.empty()) - { - if(mDeadStreams.empty()) - { - LL_INFOS() << "Starting internet stream: " << url << LL_ENDL; - mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,url); - mURL = url; - mMetaData = new LLSD; - } - else - { - LL_INFOS() << "Deferring stream load until buffer release: " << url << LL_ENDL; - mPendingURL = url; - } - } - else - { - LL_INFOS() << "Set internet stream to null" << LL_ENDL; - mURL.clear(); - } -} - -enum utf_endian_type_t -{ - UTF16LE, - UTF16BE, - UTF16 -}; - -std::string utf16input_to_utf8(unsigned char* input, U32 len, utf_endian_type_t type) -{ - if (type == UTF16) - { - type = UTF16BE; //Default - if (len > 2) - { - //Parse and strip BOM. - if ((input[0] == 0xFE && input[1] == 0xFF) || - (input[0] == 0xFF && input[1] == 0xFE)) - { - input += 2; - len -= 2; - type = input[0] == 0xFE ? UTF16BE : UTF16LE; - } - } - } - llutf16string out_16((U16*)input, len / 2); - if (len % 2) - { - out_16.push_back((input)[len - 1] << 8); - } - if (type == UTF16BE) - { - for (llutf16string::iterator i = out_16.begin(); i < out_16.end(); ++i) - { - llutf16string::value_type v = *i; - *i = ((v & 0x00FF) << 8) | ((v & 0xFF00) >> 8); - } - } - return utf16str_to_utf8str(out_16); -} - -void LLStreamingAudio_FMODEX::update() -{ - if (!releaseDeadStreams()) - { - llassert_always(mCurrentInternetStreamp == NULL); - return; - } - - if(!mPendingURL.empty()) - { - llassert_always(mCurrentInternetStreamp == NULL); - LL_INFOS() << "Starting internet stream: " << mPendingURL << LL_ENDL; - mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,mPendingURL); - mURL = mPendingURL; - mMetaData = new LLSD; - mPendingURL.clear(); - } - - // Don't do anything if there are no streams playing - if (!mCurrentInternetStreamp) - { - return; - } - - unsigned int progress; - bool starving; - bool diskbusy; - FMOD_OPENSTATE open_state; - FMOD_RESULT res = mCurrentInternetStreamp->getOpenState(open_state, &progress, &starving, &diskbusy); - - if (res != FMOD_OK || open_state == FMOD_OPENSTATE_ERROR) - { - stop(); - return; - } - else if (open_state == FMOD_OPENSTATE_READY) - { - // Stream is live - - // start the stream if it's ready - if (!mFMODInternetStreamChannelp && - (mFMODInternetStreamChannelp = mCurrentInternetStreamp->startStream())) - { - // Reset volume to previously set volume - setGain(getGain()); - Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(false), "FMOD::Channel::setPaused"); - } - } - - if(mFMODInternetStreamChannelp) - { - if(!mMetaData) - mMetaData = new LLSD; - - FMOD::Sound *sound = NULL; - - if(mFMODInternetStreamChannelp->getCurrentSound(&sound) == FMOD_OK && sound) - { - FMOD_TAG tag; - S32 tagcount, dirtytagcount; - if(sound->getNumTags(&tagcount, &dirtytagcount) == FMOD_OK && dirtytagcount) - { - mMetaData->clear(); - - for(S32 i = 0; i < tagcount; ++i) - { - if(sound->getTag(NULL, i, &tag)!=FMOD_OK) - continue; - std::string name = tag.name; - switch(tag.type) //Crappy tag translate table. - { - case(FMOD_TAGTYPE_ID3V2): - if (!LLStringUtil::compareInsensitive(name, "TIT2")) name = "TITLE"; - else if(name == "TPE1") name = "ARTIST"; - break; - case(FMOD_TAGTYPE_ASF): - if (!LLStringUtil::compareInsensitive(name, "Title")) name = "TITLE"; - else if (!LLStringUtil::compareInsensitive(name, "WM/AlbumArtist")) name = "ARTIST"; - break; - case(FMOD_TAGTYPE_FMOD): - if (!LLStringUtil::compareInsensitive(name, "Sample Rate Change")) - { - LL_INFOS() << "Stream forced changing sample rate to " << *((float *)tag.data) << LL_ENDL; - Check_FMOD_Error(mFMODInternetStreamChannelp->setFrequency(*((float *)tag.data)), "FMOD::Channel::setFrequency"); - } - continue; - default: - if (!LLStringUtil::compareInsensitive(name, "TITLE") || - !LLStringUtil::compareInsensitive(name, "ARTIST")) - LLStringUtil::toUpper(name); - break; - } - - switch(tag.datatype) - { - case(FMOD_TAGDATATYPE_INT): - (*mMetaData)[name]=*(LLSD::Integer*)(tag.data); - LL_INFOS() << tag.name << ": " << *(int*)(tag.data) << LL_ENDL; - break; - case(FMOD_TAGDATATYPE_FLOAT): - (*mMetaData)[name]=*(LLSD::Float*)(tag.data); - LL_INFOS() << tag.name << ": " << *(float*)(tag.data) << LL_ENDL; - break; - case(FMOD_TAGDATATYPE_STRING): - { - std::string out = rawstr_to_utf8(std::string((char*)tag.data,tag.datalen)); - if (out.length() && out[out.size() - 1] == 0) - out.erase(out.size() - 1); - (*mMetaData)[name]=out; - LL_INFOS() << tag.name << "(RAW): " << out << LL_ENDL; - } - break; - case(FMOD_TAGDATATYPE_STRING_UTF8) : - { - U8 offs = 0; - if (tag.datalen > 3 && ((unsigned char*)tag.data)[0] == 0xEF && ((char*)tag.data)[1] == 0xBB && ((char*)tag.data)[2] == 0xBF) - offs = 3; - std::string out((char*)tag.data + offs, tag.datalen - offs); - if (out.length() && out[out.size() - 1] == 0) - out.erase(out.size() - 1); - (*mMetaData)[name] = out; - LL_INFOS() << tag.name << "(UTF8): " << out << LL_ENDL; - } - break; - case(FMOD_TAGDATATYPE_STRING_UTF16): - { - std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16); - if (out.length() && out[out.size() - 1] == 0) - out.erase(out.size() - 1); - (*mMetaData)[name] = out; - LL_INFOS() << tag.name << "(UTF16): " << out << LL_ENDL; - } - break; - case(FMOD_TAGDATATYPE_STRING_UTF16BE): - { - std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16BE); - if (out.length() && out[out.size() - 1] == 0) - out.erase(out.size() - 1); - (*mMetaData)[name] = out; - LL_INFOS() << tag.name << "(UTF16BE): " << out << LL_ENDL; - } - default: - break; - } - } - } - if(starving) - { - bool paused = false; - if (mFMODInternetStreamChannelp->getPaused(&paused) == FMOD_OK && !paused) - { - LL_INFOS() << "Stream starvation detected! Pausing stream until buffer nearly full." << LL_ENDL; - LL_INFOS() << " (diskbusy="<setPaused(true), "FMOD::Channel::setPaused"); - } - } - else if(progress > 80) - { - Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(false), "FMOD::Channel::setPaused"); - } - } - } -} - -void LLStreamingAudio_FMODEX::stop() -{ - mPendingURL.clear(); - - if(mMetaData) - { - delete mMetaData; - mMetaData = NULL; - } - if (mFMODInternetStreamChannelp) - { - Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(true), "FMOD::Channel::setPaused"); - Check_FMOD_Error(mFMODInternetStreamChannelp->setPriority(0), "FMOD::Channel::setPriority"); - mFMODInternetStreamChannelp = NULL; - } - - if (mCurrentInternetStreamp) - { - LL_INFOS() << "Stopping internet stream: " << mCurrentInternetStreamp->getURL() << LL_ENDL; - if (mCurrentInternetStreamp->stopStream()) - { - delete mCurrentInternetStreamp; - } - else - { - LL_WARNS() << "Pushing stream to dead list: " << mCurrentInternetStreamp->getURL() << LL_ENDL; - mDeadStreams.push_back(mCurrentInternetStreamp); - } - mCurrentInternetStreamp = NULL; - //mURL.clear(); - } -} - -void LLStreamingAudio_FMODEX::pause(int pauseopt) -{ - if (pauseopt < 0) - { - pauseopt = mCurrentInternetStreamp ? 1 : 0; - } - - if (pauseopt) - { - if (mCurrentInternetStreamp) - { - stop(); - } - } - else - { - start(getURL()); - } -} - - -// A stream is "playing" if it has been requested to start. That -// doesn't necessarily mean audio is coming out of the speakers. -int LLStreamingAudio_FMODEX::isPlaying() -{ - if (mCurrentInternetStreamp) - { - return 1; // Active and playing - } - else if (!mURL.empty() || !mPendingURL.empty()) - { - return 2; // "Paused" - } - else - { - return 0; - } -} - - -F32 LLStreamingAudio_FMODEX::getGain() -{ - return mGain; -} - - -std::string LLStreamingAudio_FMODEX::getURL() -{ - return mURL; -} - - -void LLStreamingAudio_FMODEX::setGain(F32 vol) -{ - mGain = vol; - - if (mFMODInternetStreamChannelp) - { - vol = llclamp(vol * vol, 0.f, 1.f); //should vol be squared here? - - Check_FMOD_Error(mFMODInternetStreamChannelp->setVolume(vol), "FMOD::Channel::setVolume"); - } -} - -/*virtual*/ bool LLStreamingAudio_FMODEX::getWaveData(float* arr, S32 count, S32 stride/*=1*/) -{ - if(!mFMODInternetStreamChannelp || !mCurrentInternetStreamp) - return false; - - bool muted=false; - FMOD_RESULT res = mFMODInternetStreamChannelp->getMute(&muted); - if(res != FMOD_OK || muted) - return false; - - static std::vector local_array(count); //Have to have an extra buffer to mix channels. Bleh. - if(count > (S32)local_array.size()) //Expand the array if needed. Try to minimize allocation calls, so don't ever shrink. - local_array.resize(count); - - if( mFMODInternetStreamChannelp->getWaveData(&local_array[0],count,0) == FMOD_OK && - mFMODInternetStreamChannelp->getWaveData(&arr[0],count,1) == FMOD_OK ) - { - for(S32 i = count-1;i>=0;i-=stride) - { - arr[i] += local_array[i]; - arr[i] *= .5f; - } - return true; - } - return false; -} - -/////////////////////////////////////////////////////// -// manager of possibly-multiple internet audio streams - -LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, const std::string& url) : - mSystem(system), - mStreamChannel(NULL), - mInternetStream(NULL), - mReady(false) -{ - mInternetStreamURL = url; - - /*FMOD_CREATESOUNDEXINFO exinfo; - memset(&exinfo,0,sizeof(exinfo)); - exinfo.cbsize = sizeof(exinfo); - exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_OGGVORBIS; //Hint to speed up loading.*/ - - FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, 0, &mInternetStream); - - if (result!= FMOD_OK) - { - LL_WARNS() << "Couldn't open fmod stream, error " - << FMOD_ErrorString(result) - << LL_ENDL; - mReady = false; - return; - } - - mReady = true; -} - -FMOD::Channel *LLAudioStreamManagerFMODEX::startStream() -{ - // We need a live and opened stream before we try and play it. - FMOD_OPENSTATE open_state; - if (getOpenState(open_state) != FMOD_OK || open_state != FMOD_OPENSTATE_READY) - { - LL_WARNS() << "No internet stream to start playing!" << LL_ENDL; - return NULL; - } - - if(mStreamChannel) - return mStreamChannel; //Already have a channel for this stream. - - Check_FMOD_Error(mSystem->playSound(FMOD_CHANNEL_FREE, mInternetStream, true, &mStreamChannel), "FMOD::System::playSound"); - return mStreamChannel; -} - -bool LLAudioStreamManagerFMODEX::stopStream() -{ - if (mInternetStream) - { - bool close = true; - FMOD_OPENSTATE open_state; - if (getOpenState(open_state) == FMOD_OK) - { - switch (open_state) - { - case FMOD_OPENSTATE_CONNECTING: - close = false; - break; - default: - close = true; - } - } - - if (close && mInternetStream->release() == FMOD_OK) - { - mStreamChannel = NULL; - mInternetStream = NULL; - return true; - } - else - { - return false; - } - } - else - { - return true; - } -} - -FMOD_RESULT LLAudioStreamManagerFMODEX::getOpenState(FMOD_OPENSTATE& state, unsigned int* percentbuffered, bool* starving, bool* diskbusy) -{ - if (!mInternetStream) - return FMOD_ERR_INVALID_HANDLE; - FMOD_RESULT result = mInternetStream->getOpenState(&state, percentbuffered, starving, diskbusy); - Check_FMOD_Error(result, "FMOD::Sound::getOpenState"); - return result; -} - -void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuffertime) -{ - Check_FMOD_Error(mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES), "FMOD::System::setStreamBufferSize"); - FMOD_ADVANCEDSETTINGS settings; - memset(&settings,0,sizeof(settings)); - settings.cbsize=sizeof(settings); - settings.defaultDecodeBufferSize = decodebuffertime;//ms - Check_FMOD_Error(mSystem->setAdvancedSettings(&settings), "FMOD::System::setAdvancedSettings"); -} - -bool LLStreamingAudio_FMODEX::releaseDeadStreams() -{ - // Kill dead internet streams, if possible - std::list::iterator iter; - for (iter = mDeadStreams.begin(); iter != mDeadStreams.end();) - { - LLAudioStreamManagerFMODEX *streamp = *iter; - if (streamp->stopStream()) - { - LL_INFOS() << "Closed dead stream" << LL_ENDL; - delete streamp; - mDeadStreams.erase(iter++); - } - else - { - iter++; - } - } - - return mDeadStreams.empty(); -} \ No newline at end of file diff --git a/indra/llaudio/llstreamingaudio_fmodex.h b/indra/llaudio/llstreamingaudio_fmodex.h deleted file mode 100644 index 15a4af931..000000000 --- a/indra/llaudio/llstreamingaudio_fmodex.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @file streamingaudio_fmod.h - * @author Tofu Linden - * @brief Definition of LLStreamingAudio_FMOD implementation - * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_STREAMINGAUDIO_FMOD_H -#define LL_STREAMINGAUDIO_FMOD_H - -#include "stdtypes.h" // from llcommon - -#include "llstreamingaudio.h" -#include "lltimer.h" - -//Stubs -class LLAudioStreamManagerFMODEX; -namespace FMOD -{ - class System; - class Channel; -} - -//Interfaces -class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface -{ - public: - LLStreamingAudio_FMODEX(FMOD::System *system); - /*virtual*/ ~LLStreamingAudio_FMODEX(); - - /*virtual*/ void start(const std::string& url); - /*virtual*/ void stop(); - /*virtual*/ void pause(int pause); - /*virtual*/ void update(); - /*virtual*/ int isPlaying(); - /*virtual*/ void setGain(F32 vol); - /*virtual*/ F32 getGain(); - /*virtual*/ std::string getURL(); - - /*virtual*/ bool supportsMetaData(){return true;} - /*virtual*/ const LLSD *getMetaData(){return mMetaData;} //return NULL if not playing. - /*virtual*/ bool supportsWaveData(){return true;} - /*virtual*/ bool getWaveData(float* arr, S32 count, S32 stride = 1); - /*virtual*/ bool supportsAdjustableBufferSizes(){return true;} - /*virtual*/ void setBufferSizes(U32 streambuffertime, U32 decodebuffertime); -private: - bool releaseDeadStreams(); - - FMOD::System *mSystem; - - LLAudioStreamManagerFMODEX *mCurrentInternetStreamp; - FMOD::Channel *mFMODInternetStreamChannelp; - std::list mDeadStreams; - - std::string mURL; - std::string mPendingURL; - F32 mGain; - - LLSD *mMetaData; -}; - - -#endif // LL_STREAMINGAUDIO_FMOD_H diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp index 5ef93fd00..470eb8828 100644 --- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp +++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp @@ -31,6 +31,7 @@ */ #include "linden_common.h" +#include "llstreamingaudio_fmodstudio.h" #include "llmath.h" #include "llthread.h" @@ -38,8 +39,6 @@ #include "fmod.hpp" #include "fmod_errors.h" -#include "llstreamingaudio_fmodstudio.h" - inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) { if (result == FMOD_OK) @@ -61,9 +60,9 @@ public: FMOD_RESULT getOpenState(FMOD_OPENSTATE& openstate, unsigned int* percentbuffered = NULL, bool* starving = NULL, bool* diskbusy = NULL); protected: FMOD::System* mSystem; + FMOD::ChannelGroup* mChannelGroup; FMOD::Channel* mStreamChannel; FMOD::Sound* mInternetStream; - FMOD::ChannelGroup* mChannelGroup; bool mReady; std::string mInternetStreamURL; @@ -119,11 +118,11 @@ FMOD_RESULT F_CALLBACK waveDataCallback(FMOD_DSP_STATE *dsp_state, float *inbuff LLStreamingAudio_FMODSTUDIO::LLStreamingAudio_FMODSTUDIO(FMOD::System *system) : mSystem(system), mCurrentInternetStreamp(NULL), + mStreamDSP(NULL), + mStreamGroup(NULL), mFMODInternetStreamChannelp(NULL), mGain(1.0f), - mMetaData(NULL), - mStreamGroup(NULL), - mStreamDSP(NULL) + mMetaData(NULL) { FMOD_RESULT result; @@ -142,10 +141,9 @@ LLStreamingAudio_FMODSTUDIO::LLStreamingAudio_FMODSTUDIO(FMOD::System *system) : // Leave the net buffer properties at the default. //FSOUND_Stream_Net_SetBufferProperties(20000, 40, 80); - Check_FMOD_Error(mSystem->createChannelGroup("stream", &mStreamGroup), "FMOD::System::createChannelGroup"); + Check_FMOD_Error(system->createChannelGroup("stream", &mStreamGroup), "FMOD::System::createChannelGroup"); - FMOD_DSP_DESCRIPTION dspdesc; - memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION)); //Zero out everything + FMOD_DSP_DESCRIPTION dspdesc = {0}; dspdesc.pluginsdkversion = FMOD_PLUGIN_SDK_VERSION; strncpy(dspdesc.name, "Waveform", sizeof(dspdesc.name)); dspdesc.numoutputbuffers = 1; @@ -154,7 +152,6 @@ LLStreamingAudio_FMODSTUDIO::LLStreamingAudio_FMODSTUDIO(FMOD::System *system) : Check_FMOD_Error(system->createDSP(&dspdesc, &mStreamDSP), "FMOD::System::createDSP"); } - LLStreamingAudio_FMODSTUDIO::~LLStreamingAudio_FMODSTUDIO() { stop(); @@ -168,7 +165,6 @@ LLStreamingAudio_FMODSTUDIO::~LLStreamingAudio_FMODSTUDIO() cleanupWaveData(); } - void LLStreamingAudio_FMODSTUDIO::start(const std::string& url) { //if (!mInited) @@ -209,7 +205,7 @@ enum utf_endian_type_t UTF16 }; -std::string utf16input_to_utf8(char* input, U32 len, utf_endian_type_t type) +std::string utf16input_to_utf8(unsigned char* input, U32 len, utf_endian_type_t type) { if (type == UTF16) { @@ -226,7 +222,7 @@ std::string utf16input_to_utf8(char* input, U32 len, utf_endian_type_t type) } } } - llutf16string out_16((U16*)input, len / 2); + llutf16string out_16((llutf16string::value_type*)input, len / 2); if (len % 2) { out_16.push_back((input)[len - 1] << 8); @@ -254,7 +250,7 @@ void LLStreamingAudio_FMODSTUDIO::update() { llassert_always(mCurrentInternetStreamp == NULL); LL_INFOS() << "Starting internet stream: " << mPendingURL << LL_ENDL; - mCurrentInternetStreamp = new LLAudioStreamManagerFMODSTUDIO(mSystem,mStreamGroup, mPendingURL); + mCurrentInternetStreamp = new LLAudioStreamManagerFMODSTUDIO(mSystem, mStreamGroup, mPendingURL); mURL = mPendingURL; mMetaData = new LLSD; mPendingURL.clear(); @@ -315,6 +311,7 @@ void LLStreamingAudio_FMODSTUDIO::update() { if(sound->getTag(NULL, i, &tag)!=FMOD_OK) continue; + std::string name = tag.name; switch(tag.type) //Crappy tag translate table. { @@ -373,7 +370,7 @@ void LLStreamingAudio_FMODSTUDIO::update() break; case(FMOD_TAGDATATYPE_STRING_UTF16): { - std::string out = utf16input_to_utf8((char*)tag.data, tag.datalen, UTF16); + std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16); if (out.length() && out[out.size() - 1] == 0) out.erase(out.size() - 1); (*mMetaData)[name] = out; @@ -382,7 +379,7 @@ void LLStreamingAudio_FMODSTUDIO::update() break; case(FMOD_TAGDATATYPE_STRING_UTF16BE): { - std::string out = utf16input_to_utf8((char*)tag.data, tag.datalen, UTF16BE); + std::string out = utf16input_to_utf8((unsigned char*)tag.data, tag.datalen, UTF16BE); if (out.length() && out[out.size() - 1] == 0) out.erase(out.size() - 1); (*mMetaData)[name] = out; @@ -393,6 +390,7 @@ void LLStreamingAudio_FMODSTUDIO::update() } } } + static bool was_starved = false; if(starving) { bool paused = false; @@ -403,9 +401,11 @@ void LLStreamingAudio_FMODSTUDIO::update() LL_INFOS() << " (progress="<setPaused(true), "FMOD::Channel::setPaused"); } + was_starved = true; } - else if(progress > 80) + else if(progress > 80 && was_starved) { + was_starved = false; Check_FMOD_Error(mFMODInternetStreamChannelp->setPaused(false), "FMOD::Channel::setPaused"); } } @@ -446,7 +446,6 @@ void LLStreamingAudio_FMODSTUDIO::stop() mDeadStreams.push_back(mCurrentInternetStreamp); } mCurrentInternetStreamp = NULL; - //mURL.clear(); } } @@ -514,7 +513,8 @@ void LLStreamingAudio_FMODSTUDIO::setGain(F32 vol) } } -/*virtual*/ bool LLStreamingAudio_FMODSTUDIO::getWaveData(float* arr, S32 count, S32 stride/*=1*/) +/* virtual */ +bool LLStreamingAudio_FMODSTUDIO::getWaveData(float* arr, S32 count, S32 stride/*=1*/) { if (count > (WAVE_BUFFER_SIZE / 2)) LL_ERRS("AudioImpl") << "Count=" << count << " exceeds WAVE_BUFFER_SIZE/2=" << WAVE_BUFFER_SIZE << LL_ENDL; @@ -547,9 +547,9 @@ void LLStreamingAudio_FMODSTUDIO::setGain(F32 vol) LLAudioStreamManagerFMODSTUDIO::LLAudioStreamManagerFMODSTUDIO(FMOD::System *system, FMOD::ChannelGroup *group, const std::string& url) : mSystem(system), + mChannelGroup(group), mStreamChannel(NULL), mInternetStream(NULL), - mChannelGroup(group), mReady(false) { mInternetStreamURL = url; @@ -632,8 +632,7 @@ FMOD_RESULT LLAudioStreamManagerFMODSTUDIO::getOpenState(FMOD_OPENSTATE& state, void LLStreamingAudio_FMODSTUDIO::setBufferSizes(U32 streambuffertime, U32 decodebuffertime) { Check_FMOD_Error(mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES), "FMOD::System::setStreamBufferSize"); - FMOD_ADVANCEDSETTINGS settings; - memset(&settings,0,sizeof(settings)); + FMOD_ADVANCEDSETTINGS settings = {0}; settings.cbSize=sizeof(settings); settings.defaultDecodeBufferSize = decodebuffertime;//ms Check_FMOD_Error(mSystem->setAdvancedSettings(&settings), "FMOD::System::setAdvancedSettings"); @@ -672,4 +671,4 @@ void LLStreamingAudio_FMODSTUDIO::cleanupWaveData() if(mStreamDSP) Check_FMOD_Error(mStreamDSP->release(), "FMOD::DSP::release"); mStreamDSP = NULL; -} \ No newline at end of file +} diff --git a/indra/llcharacter/CMakeLists.txt b/indra/llcharacter/CMakeLists.txt index 8dda476d9..1c4ab0b2d 100644 --- a/indra/llcharacter/CMakeLists.txt +++ b/indra/llcharacter/CMakeLists.txt @@ -73,4 +73,3 @@ set_source_files_properties(${llcharacter_HEADER_FILES} list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES}) add_library (llcharacter ${llcharacter_SOURCE_FILES}) -add_dependencies(llcharacter prepare) diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index f1cea2f6d..35b9ab8a1 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1382,7 +1382,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) } if (mJointMotionList->mDuration > MAX_ANIM_DURATION || - !llfinite(mJointMotionList->mDuration)) + !std::isfinite(mJointMotionList->mDuration)) { LL_WARNS() << "invalid animation duration" << LL_ENDL; return FALSE; @@ -1407,14 +1407,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) // get loop //------------------------------------------------------------------------- if (!dp.unpackF32(mJointMotionList->mLoopInPoint, "loop_in_point") || - !llfinite(mJointMotionList->mLoopInPoint)) + !std::isfinite(mJointMotionList->mLoopInPoint)) { LL_WARNS() << "can't read loop point" << LL_ENDL; return FALSE; } if (!dp.unpackF32(mJointMotionList->mLoopOutPoint, "loop_out_point") || - !llfinite(mJointMotionList->mLoopOutPoint)) + !std::isfinite(mJointMotionList->mLoopOutPoint)) { LL_WARNS() << "can't read loop point" << LL_ENDL; return FALSE; @@ -1430,14 +1430,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) // get easeIn and easeOut //------------------------------------------------------------------------- if (!dp.unpackF32(mJointMotionList->mEaseInDuration, "ease_in_duration") || - !llfinite(mJointMotionList->mEaseInDuration)) + !std::isfinite(mJointMotionList->mEaseInDuration)) { LL_WARNS() << "can't read easeIn" << LL_ENDL; return FALSE; } if (!dp.unpackF32(mJointMotionList->mEaseOutDuration, "ease_out_duration") || - !llfinite(mJointMotionList->mEaseOutDuration)) + !std::isfinite(mJointMotionList->mEaseOutDuration)) { LL_WARNS() << "can't read easeOut" << LL_ENDL; return FALSE; @@ -1608,7 +1608,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (old_version) { if (!dp.unpackF32(time, "time") || - !llfinite(time)) + !std::isfinite(time)) { LL_WARNS() << "can't read rotation key (" << k << ")" << LL_ENDL; return FALSE; @@ -1702,7 +1702,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (old_version) { if (!dp.unpackF32(pos_key.mTime, "time") || - !llfinite(pos_key.mTime)) + !std::isfinite(pos_key.mTime)) { LL_WARNS() << "can't read position key (" << k << ")" << LL_ENDL; return FALSE; @@ -1907,28 +1907,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) // constraintp->mTargetConstraintDir *= constraintp->mSourceConstraintOffset.magVec(); } - if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !llfinite(constraintp->mEaseInStartTime)) + if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !std::isfinite(constraintp->mEaseInStartTime)) { LL_WARNS() << "can't read constraint ease in start time" << LL_ENDL; delete constraintp; return FALSE; } - if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !llfinite(constraintp->mEaseInStopTime)) + if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !std::isfinite(constraintp->mEaseInStopTime)) { LL_WARNS() << "can't read constraint ease in stop time" << LL_ENDL; delete constraintp; return FALSE; } - if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !llfinite(constraintp->mEaseOutStartTime)) + if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !std::isfinite(constraintp->mEaseOutStartTime)) { LL_WARNS() << "can't read constraint ease out start time" << LL_ENDL; delete constraintp; return FALSE; } - if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !llfinite(constraintp->mEaseOutStopTime)) + if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !std::isfinite(constraintp->mEaseOutStopTime)) { LL_WARNS() << "can't read constraint ease out stop time" << LL_ENDL; delete constraintp; diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 123f6a82b..ba6a3d667 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -30,7 +30,10 @@ #include "v3math.h" #include "llstring.h" #include "llxmltree.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif class LLPolyMesh; class LLXmlTreeNode; diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 72e03e709..00c4b4109 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -7,7 +7,11 @@ include(00-Common) include(LLCommon) include(APR) include(Linking) +include(Boost) +include(LLSharedLibs) include(GoogleBreakpad) +include(Copy3rdPartyLibs) +include(ZLIB) include_directories( ${EXPAT_INCLUDE_DIRS} @@ -229,7 +233,6 @@ set(llcommon_HEADER_FILES lltypeinfolookup.h lluri.h lluuid.h - llversionviewer.h.in llworkerthread.h metaclass.h metaclasst.h @@ -249,13 +252,26 @@ set_source_files_properties(${llcommon_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) list(APPEND llcommon_SOURCE_FILES ${cwdebug_SOURCE_FILES}) + list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) -add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) -if(WINDOWS) -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") -endif(WINDOWS) -add_dependencies(llcommon prepare) +if(NOT WORD_SIZE EQUAL 32) + if(NOT WINDOWS) + add_definitions(-fPIC) + endif(NOT WINDOWS) +endif(NOT WORD_SIZE EQUAL 32) + +if(LLCOMMON_LINK_SHARED) + add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) + if(WINDOWS) + # always generate llcommon.pdb, even for "Release" builds + set_target_properties(llcommon PROPERTIES LINK_FLAGS "/DEBUG") + endif(WINDOWS) + ll_stage_sharedlib(llcommon) +else(LLCOMMON_LINK_SHARED) + add_library (llcommon ${llcommon_SOURCE_FILES}) +endif(LLCOMMON_LINK_SHARED) + target_link_libraries( llcommon ${BREAKPAD_EXCEPTION_HANDLER_LIBRARIES} @@ -280,3 +296,5 @@ if (DARWIN) INSTALL_NAME_DIR "@executable_path/../Resources" ) endif (DARWIN) + +add_dependencies(llcommon stage_third_party_libs) diff --git a/indra/llcommon/aithreadsafe.h b/indra/llcommon/aithreadsafe.h index 93b38246f..ac1531596 100644 --- a/indra/llcommon/aithreadsafe.h +++ b/indra/llcommon/aithreadsafe.h @@ -96,16 +96,6 @@ #include "llthread.h" #include "llerror.h" -// g++ 4.2.x (and before?) have the bug that when you try to pass a temporary -// to a function taking a const reference, it still calls the copy constructor. -// Define this to hack around that. -// Note that the chosen solution ONLY works for copying an AI*Access object that -// is passed to a function: the lifetime of the copied object must not be longer -// than the original (or at least, it shouldn't be used anymore after the -// original is destructed). This will be guaranteed if the code also compiles -// on a compiler that doesn't need this hack. -#define AI_NEED_ACCESS_CC (defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) || (__GNUC__ < 4))) - template struct AIReadAccessConst; template struct AIReadAccess; template struct AIWriteAccess; @@ -339,9 +329,6 @@ struct AIReadAccessConst AIReadAccessConst(AIThreadSafe const& wrapper, bool high_priority = false) : mWrapper(const_cast&>(wrapper)), mState(readlocked) -#if AI_NEED_ACCESS_CC - , mIsCopyConstructed(false) -#endif { mWrapper.mRWLock.rdlock(high_priority); } @@ -350,9 +337,6 @@ struct AIReadAccessConst // These should never be dynamically allocated, so there is no need to make this virtual. ~AIReadAccessConst() { -#if AI_NEED_ACCESS_CC - if (mIsCopyConstructed) return; -#endif if (mState == readlocked) mWrapper.mRWLock.rdunlock(); else if (mState == writelocked) @@ -371,23 +355,14 @@ protected: //! Constructor used by AIReadAccess. AIReadAccessConst(AIThreadSafe& wrapper, state_type state) : mWrapper(wrapper), mState(state) -#if AI_NEED_ACCESS_CC - , mIsCopyConstructed(false) -#endif { } AIThreadSafe& mWrapper; //!< Reference to the object that we provide access to. state_type const mState; //!< The lock state that mWrapper is in. -#if AI_NEED_ACCESS_CC - bool mIsCopyConstructed; -public: - AIReadAccessConst(AIReadAccessConst const& orig) : mWrapper(orig.mWrapper), mState(orig.mState), mIsCopyConstructed(true) { } -#else private: // Disallow copy constructing directly. AIReadAccessConst(AIReadAccessConst const&); -#endif }; /** @@ -596,9 +571,6 @@ struct AIAccessConst { //! Construct a AIAccessConst from a constant AIThreadSafeSimple. AIAccessConst(AIThreadSafeSimple const& wrapper) : mWrapper(const_cast&>(wrapper)) -#if AI_NEED_ACCESS_CC - , mIsCopyConstructed(false) -#endif { this->mWrapper.mMutex.lock(); } @@ -611,9 +583,6 @@ struct AIAccessConst ~AIAccessConst() { -#if AI_NEED_ACCESS_CC - if (mIsCopyConstructed) return; -#endif this->mWrapper.mMutex.unlock(); } @@ -625,15 +594,9 @@ struct AIAccessConst protected: AIThreadSafeSimple& mWrapper; //!< Reference to the object that we provide access to. -#if AI_NEED_ACCESS_CC - bool mIsCopyConstructed; -public: - AIAccessConst(AIAccessConst const& orig) : mWrapper(orig.mWrapper), mIsCopyConstructed(true) { } -#else private: // Disallow copy constructing directly. AIAccessConst(AIAccessConst const&); -#endif }; /** @@ -817,14 +780,9 @@ struct AISTAccessConst protected: AIThreadSafeSingleThread& mWrapper; //!< Reference to the object that we provide access to. -#if AI_NEED_ACCESS_CC -public: - AISTAccessConst(AISTAccessConst const& orig) : mWrapper(orig.mWrapper) { } -#else private: // Disallow copy constructing directly. AISTAccessConst(AISTAccessConst const&); -#endif }; /** diff --git a/indra/llcommon/llatomic.h b/indra/llcommon/llatomic.h index 3ffd7e125..e9a88a7b6 100644 --- a/indra/llcommon/llatomic.h +++ b/indra/llcommon/llatomic.h @@ -50,7 +50,7 @@ #include "boost/atomic.hpp" template struct impl_atomic_type { typedef boost::atomic type; }; -#elif defined(USE_STD_ATOMIC) && defined(LL_CPP11) +#elif defined(USE_STD_ATOMIC) #include template struct impl_atomic_type { typedef std::atomic type; }; diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h index 867d6bdbf..6e7a49245 100644 --- a/indra/llcommon/llavatarconstants.h +++ b/indra/llcommon/llavatarconstants.h @@ -44,14 +44,6 @@ const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisa // Maximum number of avatar picks const S32 MAX_AVATAR_PICKS = 10; -// For Flags in AvatarPropertiesReply -const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not -const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature" -const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info -const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info -const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known. -const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified - char const* const VISIBILITY_DEFAULT = "default"; char const* const VISIBILITY_HIDDEN = "hidden"; char const* const VISIBILITY_VISIBLE = "visible"; diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index b24e70fad..065a72215 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -4,69 +4,60 @@ * @date 2006-02-05 * @brief Implementation of the date class * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "linden_common.h" #include "lldate.h" -#include "apr_time.h" - #include #include #include #include +#include #include -#include "llfasttimer.h" #include "lltimer.h" #include "llstring.h" +#include "llfasttimer.h" +#if defined(LL_WINDOWS) && !defined(timegm) +# define timegm _mkgmtime +#endif + +#define EPOCH_STR "1970-01-01T00:00:00Z" static const F64 DATE_EPOCH = 0.0; - -static const F64 LL_APR_USEC_PER_SEC = 1000000.0; - // should be APR_USEC_PER_SEC, but that relies on INT64_C which - // isn't defined in glib under our build set up for some reason - +static std::string sPrevLocale = ""; LLDate::LLDate() : mSecondsSinceEpoch(DATE_EPOCH) -{ -} +{} LLDate::LLDate(const LLDate& date) : mSecondsSinceEpoch(date.mSecondsSinceEpoch) -{ -} +{} LLDate::LLDate(F64 seconds_since_epoch) : mSecondsSinceEpoch(seconds_since_epoch) -{ -} +{} LLDate::LLDate(const std::string& iso8601_date) { @@ -92,37 +83,43 @@ std::string LLDate::asString() const // is one of the standards used and the prefered format std::string LLDate::asRFC1123() const { - return toHTTPDateString (std::string ("%A, %d %b %Y %H:%M:%S GMT")); + return toHTTPDateString(LLStringExplicit("%A, %d %b %Y %H:%M:%S GMT")); } LLFastTimer::DeclareTimer FT_DATE_FORMAT("Date Format"); -std::string LLDate::toHTTPDateString (std::string fmt) const +std::string LLDate::toHTTPDateString(std::string fmt) const { LLFastTimer ft1(FT_DATE_FORMAT); - time_t locSeconds = (time_t) mSecondsSinceEpoch; - struct tm * gmt = gmtime (&locSeconds); + std::time_t locSeconds = (std::time_t) mSecondsSinceEpoch; + std::tm * gmt = gmtime (&locSeconds); + if (!gmt) + { + LL_WARNS() << "The impossible has happened!" << LL_ENDL; + return LLStringExplicit(EPOCH_STR); + } return toHTTPDateString(gmt, fmt); } -std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt) +std::string LLDate::toHTTPDateString(tm * gmt, std::string fmt) { LLFastTimer ft1(FT_DATE_FORMAT); // avoid calling setlocale() unnecessarily - it's expensive. - static std::string prev_locale = ""; std::string this_locale = LLStringUtil::getLocale(); - if (this_locale != prev_locale) + if (this_locale != sPrevLocale) { setlocale(LC_TIME, this_locale.c_str()); - prev_locale = this_locale; + sPrevLocale = this_locale; } // use strftime() as it appears to be faster than std::time_put char buffer[128]; - strftime(buffer, 128, fmt.c_str(), gmt); + if (std::strftime(buffer, 128, fmt.c_str(), gmt) == 0) + return LLStringExplicit(EPOCH_STR); std::string res(buffer); + #if LL_WINDOWS // Convert from locale-dependant charset to UTF-8 (EXT-8524). res = ll_convert_string_to_utf8_string(res); @@ -132,12 +129,18 @@ std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt) void LLDate::toStream(std::ostream& s) const { - apr_time_t time = (apr_time_t)(mSecondsSinceEpoch * LL_APR_USEC_PER_SEC); + std::ios::fmtflags f( s.flags() ); - apr_time_exp_t exp_time; - if (apr_time_exp_gmt(&exp_time, time) != APR_SUCCESS) + std::tm exp_time = {0}; + std::time_t time = static_cast(mSecondsSinceEpoch); + +#if LL_WINDOWS + if (gmtime_s(&exp_time, &time) != 0) +#else + if (!gmtime_r(&time, &exp_time)) +#endif { - s << "1970-01-01T00:00:00Z"; + s << EPOCH_STR; return; } @@ -153,22 +156,29 @@ void LLDate::toStream(std::ostream& s) const << 'T' << std::setw(2) << (exp_time.tm_hour) << ':' << std::setw(2) << (exp_time.tm_min) << ':' << std::setw(2) << (exp_time.tm_sec); - if (exp_time.tm_usec > 0) - { - s << '.' << std::setw(2) - << (int)(exp_time.tm_usec / (LL_APR_USEC_PER_SEC / 100)); - } s << 'Z' << std::setfill(' '); + + s.flags( f ); } bool LLDate::split(S32 *year, S32 *month, S32 *day, S32 *hour, S32 *min, S32 *sec) const { - apr_time_t time = (apr_time_t)(mSecondsSinceEpoch * LL_APR_USEC_PER_SEC); + std::tm exp_time = {0}; + std::time_t time = static_cast(mSecondsSinceEpoch); - apr_time_exp_t exp_time; - if (apr_time_exp_gmt(&exp_time, time) != APR_SUCCESS) +#if LL_WINDOWS + if (gmtime_s(&exp_time, &time) != 0) +#else + if (!gmtime_r(&time, &exp_time)) +#endif { + *year = 1970; + *month = 01; + *day = 01; + *hour = 00; + *min = 00; + *sec = 00; return false; } @@ -201,60 +211,63 @@ bool LLDate::fromString(const std::string& iso8601_date) bool LLDate::fromStream(std::istream& s) { - struct apr_time_exp_t exp_time; - apr_int32_t tm_part; + std::tm time = {0}; int c; - +#if LL_WINDOWS || LL_LINUX // GCC 4.8 lacks this Windows has broken std::get_time() Time for things to get ugly! + int32_t tm_part; s >> tm_part; - exp_time.tm_year = tm_part - 1900; + time.tm_year = tm_part - 1900; c = s.get(); // skip the hypen if (c != '-') { return false; } s >> tm_part; - exp_time.tm_mon = tm_part - 1; + time.tm_mon = tm_part - 1; c = s.get(); // skip the hypen if (c != '-') { return false; } s >> tm_part; - exp_time.tm_mday = tm_part; + time.tm_mday = tm_part; c = s.get(); // skip the T if (c != 'T') { return false; } s >> tm_part; - exp_time.tm_hour = tm_part; + time.tm_hour = tm_part; c = s.get(); // skip the : if (c != ':') { return false; } s >> tm_part; - exp_time.tm_min = tm_part; + time.tm_min = tm_part; c = s.get(); // skip the : if (c != ':') { return false; } s >> tm_part; - exp_time.tm_sec = tm_part; + time.tm_sec = tm_part; - // zero out the unused fields - exp_time.tm_usec = 0; - exp_time.tm_wday = 0; - exp_time.tm_yday = 0; - exp_time.tm_isdst = 0; - exp_time.tm_gmtoff = 0; - - // generate a time_t from that - apr_time_t time; - if (apr_time_exp_gmt_get(&time, &exp_time) != APR_SUCCESS) - { - return false; - } - - F64 seconds_since_epoch = time / LL_APR_USEC_PER_SEC; - - // check for fractional c = s.peek(); if(c == '.') { F64 fractional = 0.0; s >> fractional; - seconds_since_epoch += fractional; } +#else + std::string this_locale = LLStringUtil::getLocale(); + if (this_locale != sPrevLocale) + { + setlocale(LC_TIME, this_locale.c_str()); + sPrevLocale = this_locale; + } + + // Isn't stdlib nice? + s.imbue(std::locale(sPrevLocale.c_str())); + s >> std::get_time(&time, "%Y-%m-%dT%H:%M:%S"); + if (s.fail()) + { + return false; + } +#endif + std::time_t tm = timegm(&time); + if (tm == -1) + return false; + + F64 seconds_since_epoch = static_cast(tm); c = s.peek(); // check for offset if (c == '+' || c == '-') { @@ -270,7 +283,6 @@ bool LLDate::fromStream(std::istream& s) { s >> offset_minutes; } - offset_in_seconds = (offset_hours * 60 + offset_sign * offset_minutes) * 60; seconds_since_epoch -= offset_in_seconds; } @@ -282,7 +294,7 @@ bool LLDate::fromStream(std::istream& s) bool LLDate::fromYMDHMS(S32 year, S32 month, S32 day, S32 hour, S32 min, S32 sec) { - struct apr_time_exp_t exp_time; + std::tm exp_time = {0}; exp_time.tm_year = year - 1900; exp_time.tm_mon = month - 1; @@ -291,21 +303,11 @@ bool LLDate::fromYMDHMS(S32 year, S32 month, S32 day, S32 hour, S32 min, S32 sec exp_time.tm_min = min; exp_time.tm_sec = sec; - // zero out the unused fields - exp_time.tm_usec = 0; - exp_time.tm_wday = 0; - exp_time.tm_yday = 0; - exp_time.tm_isdst = 0; - exp_time.tm_gmtoff = 0; - - // generate a time_t from that - apr_time_t time; - if (apr_time_exp_gmt_get(&time, &exp_time) != APR_SUCCESS) - { + std::time_t tm = timegm(&exp_time); + if (tm == -1) return false; - } - mSecondsSinceEpoch = time / LL_APR_USEC_PER_SEC; + mSecondsSinceEpoch = static_cast(tm); return true; } diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h index e0294e271..d48d29875 100644 --- a/indra/llcommon/lldependencies.h +++ b/indra/llcommon/lldependencies.h @@ -39,7 +39,10 @@ #include #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include /***************************************************************************** diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 7acc61de4..dc582f2d2 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -58,7 +58,10 @@ static const int& nil(nil_); #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include #include diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h index e822a664f..4fff7644a 100644 --- a/indra/llcommon/lleventfilter.h +++ b/indra/llcommon/lleventfilter.h @@ -32,7 +32,10 @@ #include "llevents.h" #include "stdtypes.h" #include "lltimer.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif /** * Generic base class diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index cefc7a883..170930c8c 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -56,7 +56,10 @@ #include #include // reference_wrapper #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include "llsd.h" #include "llsingleton.h" diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index e776c559b..5cb7b2c25 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -157,6 +157,7 @@ #if LL_WINDOWS #include "lltimer.h" +#include #elif LL_LINUX || LL_SOLARIS #include #include @@ -184,7 +185,7 @@ LLMutex* LLFastTimer::sLogLock = NULL; std::queue LLFastTimer::sLogQueue; const int LLFastTimer::NamedTimer::HISTORY_NUM = 300; -#if defined(LL_WINDOWS) && !defined(_WIN64) +#if defined(LL_WINDOWS) #define USE_RDTSC 1 #endif @@ -952,34 +953,15 @@ LLFastTimer::LLFastTimer(LLFastTimer::FrameState* state) #if USE_RDTSC U32 LLFastTimer::getCPUClockCount32() { - U32 ret_val; - __asm - { - _emit 0x0f - _emit 0x31 - shr eax,8 - shl edx,24 - or eax, edx - mov dword ptr [ret_val], eax - } - return ret_val; + return (U32)(__rdtsc()>>8); } // return full timer value, *not* shifted by 8 bits U64 LLFastTimer::getCPUClockCount64() { - U64 ret_val; - __asm - { - _emit 0x0f - _emit 0x31 - mov eax,eax - mov edx,edx - mov dword ptr [ret_val+4], edx - mov dword ptr [ret_val], eax - } - return ret_val; + return (U64)__rdtsc(); } + #else //LL_COMMON_API U64 get_clock_count(); // in lltimer.cpp // These use QueryPerformanceCounter, which is arguably fine and also works on AMD architectures. diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 686a516b9..7660baa90 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -416,679 +416,76 @@ LLFILE * LLFile::_Fiopen(const std::string& filename, #endif /* LL_WINDOWS */ -/************** llstdio file buffer ********************************/ - - -//llstdio_filebuf* llstdio_filebuf::open(const char *_Filename, -// ios_base::openmode _Mode) -//{ -//#if LL_WINDOWS -// _Filet *_File; -// if (is_open() || (_File = LLFILE::_Fiopen(_Filename, _Mode)) == 0) -// return (0); // open failed -// -// _Init(_File, _Openfl); -// _Initcvt(&_USE(_Mysb::getloc(), _Cvt)); -// return (this); // open succeeded -//#else -// std::filebuf* _file = std::filebuf::open(_Filename, _Mode); -// if (NULL == _file) return NULL; -// return this; -//#endif -//} - - -// *TODO: Seek the underlying c stream for better cross-platform compatibility? -#if !LL_WINDOWS -llstdio_filebuf::int_type llstdio_filebuf::overflow(llstdio_filebuf::int_type __c) -{ - int_type __ret = traits_type::eof(); - const bool __testeof = traits_type::eq_int_type(__c, __ret); - const bool __testout = _M_mode & ios_base::out; - if (__testout && !_M_reading) - { - if (this->pbase() < this->pptr()) - { - // If appropriate, append the overflow char. - if (!__testeof) - { - *this->pptr() = traits_type::to_char_type(__c); - this->pbump(1); - } - - // Convert pending sequence to external representation, - // and output. - if (_convert_to_external(this->pbase(), - this->pptr() - this->pbase())) - { - _M_set_buffer(0); - __ret = traits_type::not_eof(__c); - } - } - else if (_M_buf_size > 1) - { - // Overflow in 'uncommitted' mode: set _M_writing, set - // the buffer to the initial 'write' mode, and put __c - // into the buffer. - _M_set_buffer(0); - _M_writing = true; - if (!__testeof) - { - *this->pptr() = traits_type::to_char_type(__c); - this->pbump(1); - } - __ret = traits_type::not_eof(__c); - } - else - { - // Unbuffered. - char_type __conv = traits_type::to_char_type(__c); - if (__testeof || _convert_to_external(&__conv, 1)) - { - _M_writing = true; - __ret = traits_type::not_eof(__c); - } - } - } - return __ret; -} - -bool llstdio_filebuf::_convert_to_external(char_type* __ibuf, - std::streamsize __ilen) -{ - // Sizes of external and pending output. - streamsize __elen; - streamsize __plen; - if (__check_facet(_M_codecvt).always_noconv()) - { - //__elen = _M_file.xsputn(reinterpret_cast(__ibuf), __ilen); - __elen = fwrite(reinterpret_cast(__ibuf), 1, - __ilen, _M_file.file()); - __plen = __ilen; - } - else - { - // Worst-case number of external bytes needed. - // XXX Not done encoding() == -1. - streamsize __blen = __ilen * _M_codecvt->max_length(); - char* __buf = static_cast(__builtin_alloca(__blen)); - - char* __bend; - const char_type* __iend; - codecvt_base::result __r; - __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen, - __iend, __buf, __buf + __blen, __bend); - - if (__r == codecvt_base::ok || __r == codecvt_base::partial) - __blen = __bend - __buf; - else if (__r == codecvt_base::noconv) - { - // Same as the always_noconv case above. - __buf = reinterpret_cast(__ibuf); - __blen = __ilen; - } - else - __throw_ios_failure(__N("llstdio_filebuf::_convert_to_external " - "conversion error")); - - //__elen = _M_file.xsputn(__buf, __blen); - __elen = fwrite(__buf, 1, __blen, _M_file.file()); - __plen = __blen; - - // Try once more for partial conversions. - if (__r == codecvt_base::partial && __elen == __plen) - { - const char_type* __iresume = __iend; - streamsize __rlen = this->pptr() - __iend; - __r = _M_codecvt->out(_M_state_cur, __iresume, - __iresume + __rlen, __iend, __buf, - __buf + __blen, __bend); - if (__r != codecvt_base::error) - { - __rlen = __bend - __buf; - //__elen = _M_file.xsputn(__buf, __rlen); - __elen = fwrite(__buf, 1, __rlen, _M_file.file()); - __plen = __rlen; - } - else - { - __throw_ios_failure(__N("llstdio_filebuf::_convert_to_external " - "conversion error")); - } - } - } - return __elen == __plen; -} - -llstdio_filebuf::int_type llstdio_filebuf::underflow() -{ - int_type __ret = traits_type::eof(); - const bool __testin = _M_mode & ios_base::in; - if (__testin) - { - if (_M_writing) - { - if (overflow() == traits_type::eof()) - return __ret; - //_M_set_buffer(-1); - //_M_writing = false; - } - // Check for pback madness, and if so switch back to the - // normal buffers and jet outta here before expensive - // fileops happen... - _M_destroy_pback(); - - if (this->gptr() < this->egptr()) - return traits_type::to_int_type(*this->gptr()); - - // Get and convert input sequence. - const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; - - // Will be set to true if ::fread() returns 0 indicating EOF. - bool __got_eof = false; - // Number of internal characters produced. - streamsize __ilen = 0; - codecvt_base::result __r = codecvt_base::ok; - if (__check_facet(_M_codecvt).always_noconv()) - { - //__ilen = _M_file.xsgetn(reinterpret_cast(this->eback()), - // __buflen); - __ilen = fread(reinterpret_cast(this->eback()), 1, - __buflen, _M_file.file()); - if (__ilen == 0) - __got_eof = true; - } - else - { - // Worst-case number of external bytes. - // XXX Not done encoding() == -1. - const int __enc = _M_codecvt->encoding(); - streamsize __blen; // Minimum buffer size. - streamsize __rlen; // Number of chars to read. - if (__enc > 0) - __blen = __rlen = __buflen * __enc; - else - { - __blen = __buflen + _M_codecvt->max_length() - 1; - __rlen = __buflen; - } - const streamsize __remainder = _M_ext_end - _M_ext_next; - __rlen = __rlen > __remainder ? __rlen - __remainder : 0; - - // An imbue in 'read' mode implies first converting the external - // chars already present. - if (_M_reading && this->egptr() == this->eback() && __remainder) - __rlen = 0; - - // Allocate buffer if necessary and move unconverted - // bytes to front. - if (_M_ext_buf_size < __blen) - { - char* __buf = new char[__blen]; - if (__remainder) - __builtin_memcpy(__buf, _M_ext_next, __remainder); - - delete [] _M_ext_buf; - _M_ext_buf = __buf; - _M_ext_buf_size = __blen; - } - else if (__remainder) - __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder); - - _M_ext_next = _M_ext_buf; - _M_ext_end = _M_ext_buf + __remainder; - _M_state_last = _M_state_cur; - - do - { - if (__rlen > 0) - { - // Sanity check! - // This may fail if the return value of - // codecvt::max_length() is bogus. - if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size) - { - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "codecvt::max_length() " - "is not valid")); - } - //streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen); - streamsize __elen = fread(_M_ext_end, 1, - __rlen, _M_file.file()); - if (__elen == 0) - __got_eof = true; - else if (__elen == -1) - break; - //_M_ext_end += __elen; - } - - char_type* __iend = this->eback(); - if (_M_ext_next < _M_ext_end) - { - __r = _M_codecvt->in(_M_state_cur, _M_ext_next, - _M_ext_end, _M_ext_next, - this->eback(), - this->eback() + __buflen, __iend); - } - if (__r == codecvt_base::noconv) - { - size_t __avail = _M_ext_end - _M_ext_buf; - __ilen = std::min(__avail, __buflen); - traits_type::copy(this->eback(), - reinterpret_cast - (_M_ext_buf), __ilen); - _M_ext_next = _M_ext_buf + __ilen; - } - else - __ilen = __iend - this->eback(); - - // _M_codecvt->in may return error while __ilen > 0: this is - // ok, and actually occurs in case of mixed encodings (e.g., - // XML files). - if (__r == codecvt_base::error) - break; - - __rlen = 1; - } while (__ilen == 0 && !__got_eof); - } - - if (__ilen > 0) - { - _M_set_buffer(__ilen); - _M_reading = true; - __ret = traits_type::to_int_type(*this->gptr()); - } - else if (__got_eof) - { - // If the actual end of file is reached, set 'uncommitted' - // mode, thus allowing an immediate write without an - // intervening seek. - _M_set_buffer(-1); - _M_reading = false; - // However, reaching it while looping on partial means that - // the file has got an incomplete character. - if (__r == codecvt_base::partial) - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "incomplete character in file")); - } - else if (__r == codecvt_base::error) - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "invalid byte sequence in file")); - else - __throw_ios_failure(__N("llstdio_filebuf::underflow " - "error reading the file")); - } - return __ret; -} - -std::streamsize llstdio_filebuf::xsgetn(char_type* __s, std::streamsize __n) -{ - // Clear out pback buffer before going on to the real deal... - streamsize __ret = 0; - if (_M_pback_init) - { - if (__n > 0 && this->gptr() == this->eback()) - { - *__s++ = *this->gptr(); - this->gbump(1); - __ret = 1; - --__n; - } - _M_destroy_pback(); - } - - // Optimization in the always_noconv() case, to be generalized in the - // future: when __n > __buflen we read directly instead of using the - // buffer repeatedly. - const bool __testin = _M_mode & ios_base::in; - const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; - - if (__n > __buflen && __check_facet(_M_codecvt).always_noconv() - && __testin && !_M_writing) - { - // First, copy the chars already present in the buffer. - const streamsize __avail = this->egptr() - this->gptr(); - if (__avail != 0) - { - if (__avail == 1) - *__s = *this->gptr(); - else - traits_type::copy(__s, this->gptr(), __avail); - __s += __avail; - this->gbump(__avail); - __ret += __avail; - __n -= __avail; - } - - // Need to loop in case of short reads (relatively common - // with pipes). - streamsize __len; - for (;;) - { - //__len = _M_file.xsgetn(reinterpret_cast(__s), __n); - __len = fread(reinterpret_cast(__s), 1, - __n, _M_file.file()); - if (__len == -1) - __throw_ios_failure(__N("llstdio_filebuf::xsgetn " - "error reading the file")); - if (__len == 0) - break; - - __n -= __len; - __ret += __len; - if (__n == 0) - break; - - __s += __len; - } - - if (__n == 0) - { - _M_set_buffer(0); - _M_reading = true; - } - else if (__len == 0) - { - // If end of file is reached, set 'uncommitted' - // mode, thus allowing an immediate write without - // an intervening seek. - _M_set_buffer(-1); - _M_reading = false; - } - } - else - __ret += __streambuf_type::xsgetn(__s, __n); - - return __ret; -} - -std::streamsize llstdio_filebuf::xsputn(char_type const* __s, std::streamsize __n) -{ - // Optimization in the always_noconv() case, to be generalized in the - // future: when __n is sufficiently large we write directly instead of - // using the buffer. - streamsize __ret = 0; - const bool __testout = _M_mode & ios_base::out; - if (__check_facet(_M_codecvt).always_noconv() - && __testout && !_M_reading) - { - // Measurement would reveal the best choice. - const streamsize __chunk = 1ul << 10; - streamsize __bufavail = this->epptr() - this->pptr(); - - // Don't mistake 'uncommitted' mode buffered with unbuffered. - if (!_M_writing && _M_buf_size > 1) - __bufavail = _M_buf_size - 1; - - const streamsize __limit = std::min(__chunk, __bufavail); - if (__n >= __limit) - { - const streamsize __buffill = this->pptr() - this->pbase(); - const char* __buf = reinterpret_cast(this->pbase()); - //__ret = _M_file.xsputn_2(__buf, __buffill, - // reinterpret_cast(__s), __n); - if (__buffill) - { - __ret = fwrite(__buf, 1, __buffill, _M_file.file()); - } - if (__ret == __buffill) - { - __ret += fwrite(reinterpret_cast(__s), 1, - __n, _M_file.file()); - } - if (__ret == __buffill + __n) - { - _M_set_buffer(0); - _M_writing = true; - } - if (__ret > __buffill) - __ret -= __buffill; - else - __ret = 0; - } - else - __ret = __streambuf_type::xsputn(__s, __n); - } - else - __ret = __streambuf_type::xsputn(__s, __n); - return __ret; -} - -int llstdio_filebuf::sync() -{ - return (_M_file.sync() == 0 ? 0 : -1); -} -#endif +#if LL_WINDOWS /************** input file stream ********************************/ - -llifstream::llifstream() : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) {} -#else - std::istream() +llifstream::llifstream() : std::ifstream() { - this->init(&_M_filebuf); } -#endif // explicit -llifstream::llifstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) +llifstream::llifstream(const std::string& _Filename, ios_base::openmode _Mode) : + std::ifstream(utf8str_to_utf16str(_Filename), + _Mode | ios_base::in) { - if (_M_filebuf.open(_Filename.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } } -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::in); -} -#endif // explicit -llifstream::llifstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) -{ - if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::in); -} -#endif +llifstream::llifstream(const char* _Filename, ios_base::openmode _Mode) : + std::ifstream(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::in) - -// explicit -llifstream::llifstream(_Filet *_File, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(_File, _Mode, _Size), -#if LL_WINDOWS - std::istream(&_M_filebuf) {} -#else - std::istream() { - this->init(&_M_filebuf); } -#endif -#if !LL_WINDOWS -// explicit -llifstream::llifstream(int __fd, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(__fd, _Mode, _Size), - std::istream() +void llifstream::open(const std::string& _Filename, ios_base::openmode _Mode) { - this->init(&_M_filebuf); -} -#endif - -bool llifstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); + std::ifstream::open(utf8str_to_utf16str(_Filename), + _Mode | ios_base::in); } void llifstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode - if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) -#if LL_WINDOWS - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif -} - -void llifstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } +{ + std::ifstream::open(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::in); } /************** output file stream ********************************/ -llofstream::llofstream() : _M_filebuf(), -#if LL_WINDOWS - std::ostream(&_M_filebuf) {} -#else - std::ostream() +llofstream::llofstream() : std::ofstream() { - this->init(&_M_filebuf); } -#endif // explicit -llofstream::llofstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ostream(&_M_filebuf) +llofstream::llofstream(const std::string& _Filename, ios_base::openmode _Mode) : + std::ofstream(utf8str_to_utf16str(_Filename), + _Mode | ios_base::out) { - if (_M_filebuf.open(_Filename.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } } -#else - std::ostream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::out); -} -#endif // explicit -llofstream::llofstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ostream(&_M_filebuf) +llofstream::llofstream(const char* _Filename, ios_base::openmode _Mode) : + std::ofstream(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::out) { - if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } } -#else - std::ostream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::out); -} -#endif -// explicit -llofstream::llofstream(_Filet *_File, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(_File, _Mode, _Size), -#if LL_WINDOWS - std::ostream(&_M_filebuf) {} -#else - std::ostream() +void llofstream::open(const std::string& _Filename, ios_base::openmode _Mode) { - this->init(&_M_filebuf); -} -#endif - -#if !LL_WINDOWS -// explicit -llofstream::llofstream(int __fd, - ios_base::openmode _Mode, size_t _Size) : - _M_filebuf(__fd, _Mode, _Size), - std::ostream() -{ - this->init(&_M_filebuf); -} -#endif - -bool llofstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); + std::ofstream::open(utf8str_to_utf16str(_Filename), + _Mode | ios_base::out); } void llofstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode - if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) -#if LL_WINDOWS - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif +{ + std::ofstream::open(utf8str_to_utf16str(_Filename).c_str(), + _Mode | ios_base::out); } -void llofstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } -} +#endif // LL_WINDOWS /************** helper functions ********************************/ diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index cc990f6ab..eacbacca1 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -38,15 +38,13 @@ * Attempts to mostly mirror the POSIX style IO functions. */ -typedef FILE LLFILE; +typedef FILE LLFILE; #if LL_WINDOWS // windows version of stat function and stat data structure are called _stat typedef struct _stat llstat; #else typedef struct stat llstat; -#include -#include #endif #ifndef S_ISREG @@ -93,135 +91,20 @@ public: static std::string strerr(); }; -/** - * @brief Provides a layer of compatibility for C/POSIX. - * - * This is taken from both the GNU __gnu_cxx::stdio_filebuf extension and - * VC's basic_filebuf implementation. - * This file buffer provides extensions for working with standard C FILE*'s - * and POSIX file descriptors for platforms that support this. -*/ -namespace -{ -#if LL_WINDOWS -//typedef std::filebuf _Myfb; -//Singu note: Wrap around std::filebuf to override the open procedure. -// The client encodes filepaths in UTF-8, however Windows uses UTF-16 encoding natively. -// Need to convert paths to UTF-16 before calling std::filebuf::open. -struct _Myfb : public std::filebuf -{ - _Myfb() : std::filebuf() {} - _Myfb(_Filet* file) : std::filebuf(file) {} - _Myt *open(const char *filename, std::ios_base::openmode mode, int prot = (int)std::ios_base::_Openprot) - { - return std::filebuf::open(utf8str_to_utf16str(filename).c_str(),mode,prot); - } -}; +#if !defined(LL_WINDOWS) +typedef std::ifstream llifstream; +typedef std::ofstream llofstream; #else -typedef __gnu_cxx::stdio_filebuf< char > _Myfb; -typedef std::__c_file _Filet; -#endif /* LL_WINDOWS */ -} - -class LL_COMMON_API llstdio_filebuf : public _Myfb -{ -public: - /** - * deferred initialization / destruction - */ - llstdio_filebuf() : _Myfb() {} - virtual ~llstdio_filebuf() {} - - /** - * @param f An open @c FILE*. - * @param mode Same meaning as in a standard filebuf. - * @param size Optimal or preferred size of internal buffer, in chars. - * Defaults to system's @c BUFSIZ. - * - * This constructor associates a file stream buffer with an open - * C @c FILE*. The @c FILE* will not be automatically closed when the - * stdio_filebuf is closed/destroyed. - */ - llstdio_filebuf(_Filet* __f, std::ios_base::openmode __mode, - //size_t __size = static_cast(BUFSIZ)) : - size_t __size = static_cast(1)) : -#if LL_WINDOWS - _Myfb(__f) {} -#else - _Myfb(__f, __mode, __size) {} -#endif - - /** - * @brief Opens an external file. - * @param s The name of the file. - * @param mode The open mode flags. - * @return @c this on success, NULL on failure - * - * If a file is already open, this function immediately fails. - * Otherwise it tries to open the file named @a s using the flags - * given in @a mode. - */ - //llstdio_filebuf* open(const char *_Filename, - // std::ios_base::openmode _Mode); - - /** - * @param fd An open file descriptor. - * @param mode Same meaning as in a standard filebuf. - * @param size Optimal or preferred size of internal buffer, in chars. - * - * This constructor associates a file stream buffer with an open - * POSIX file descriptor. The file descriptor will be automatically - * closed when the stdio_filebuf is closed/destroyed. - */ -#if !LL_WINDOWS - llstdio_filebuf(int __fd, std::ios_base::openmode __mode, - //size_t __size = static_cast(BUFSIZ)) : - size_t __size = static_cast(1)) : - _Myfb(__fd, __mode, __size) {} -#endif - -// *TODO: Seek the underlying c stream for better cross-platform compatibility? -#if !LL_WINDOWS -protected: - /** underflow() and uflow() functions are called to get the next - * character from the real input source when the buffer is empty. - * Buffered input uses underflow() - */ - /*virtual*/ int_type underflow(); - - /* Convert internal byte sequence to external, char-based - * sequence via codecvt. - */ - bool _convert_to_external(char_type*, std::streamsize); - - /** The overflow() function is called to transfer characters to the - * real output destination when the buffer is full. A call to - * overflow(c) outputs the contents of the buffer plus the - * character c. - * Consume some sequence of the characters in the pending sequence. - */ - /*virtual*/ int_type overflow(int_type __c = traits_type::eof()); - - /** sync() flushes the underlying @c FILE* stream. - */ - /*virtual*/ int sync(); - - std::streamsize xsgetn(char_type*, std::streamsize); - std::streamsize xsputn(char_type const*, std::streamsize); -#endif -}; - /** * @brief Controlling input for files. * * This class supports reading from named files, using the inherited - * functions from std::basic_istream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * which allows construction using a pre-exisintg file stream buffer. - * We refer to this std::basic_filebuf (or derivative) as @c sb. -*/ -class LL_COMMON_API llifstream : public std::istream + * functions from std::ifstream. The only added value is that our constructor + * Does The Right Thing when passed a non-ASCII pathname. Sadly, that isn't + * true of Microsoft's std::ifstream. + */ +class LL_COMMON_API llifstream : public std::ifstream { // input stream associated with a C stream public: @@ -247,56 +130,6 @@ public: explicit llifstream(const char* _Filename, ios_base::openmode _Mode = ios_base::in); - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llifstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llifstream(int __fd, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); -#endif - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llifstream() {} - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - llstdio_filebuf* rdbuf() const - { return const_cast(&_M_filebuf); } - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool is_open() const; - /** * @brief Opens an external file. * @param Filename The name of the file. @@ -306,34 +139,21 @@ public: * fails, @c failbit is set in the stream's error state. */ void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in) - { open(_Filename.c_str(), _Mode); } + ios_base::openmode _Mode = ios_base::in); void open(const char* _Filename, ios_base::openmode _Mode = ios_base::in); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; }; /** * @brief Controlling output for files. * - * This class supports writing to named files, using the inherited - * functions from std::basic_ostream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * which allows construction using a pre-exisintg file stream buffer. - * We refer to this std::basic_filebuf (or derivative) as @c sb. -*/ -class LL_COMMON_API llofstream : public std::ostream + * This class supports writing to named files, using the inherited functions + * from std::ofstream. The only added value is that our constructor Does The + * Right Thing when passed a non-ASCII pathname. Sadly, that isn't true of + * Microsoft's std::ofstream. + */ +class LL_COMMON_API llofstream : public std::ofstream { public: // Constructors: @@ -351,64 +171,13 @@ public: * @param Filename String specifying the filename. * @param Mode Open file in specified mode (see std::ios_base). * - * @c ios_base::out|ios_base::trunc is automatically included in - * @a mode. + * @c ios_base::out is automatically included in @a mode. */ explicit llofstream(const std::string& _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); explicit llofstream(const char* _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llofstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llofstream(int __fd, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast(BUFSIZ)); - size_t _Size = static_cast(1)); -#endif - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llofstream() {} - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - llstdio_filebuf* rdbuf() const - { return const_cast(&_M_filebuf); } - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool is_open() const; - /** * @brief Opens an external file. * @param Filename The name of the file. @@ -418,23 +187,11 @@ public: * fails, @c failbit is set in the stream's error state. */ void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc) - { open(_Filename.c_str(), _Mode); } + ios_base::openmode _Mode = ios_base::out | ios_base::trunc); void open(const char* _Filename, ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; }; - +#endif /** * @breif filesize helpers. diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 24f59c44a..b781baa58 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -30,7 +30,10 @@ #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include #include diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 485c65e68..52db12314 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -34,7 +34,10 @@ #include "llstringtable.h" #include "llerror.h" // llassert_always #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include #include diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 84087cee3..b299fd829 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -109,9 +109,9 @@ #endif -// Check for C++11 support -#if __cplusplus >= 201100L || _MSC_VER >= 1800 -# define LL_CPP11 +// Require C++11 support +#if __cplusplus < 201100L && _MSC_VER < 1800 +#error C++11 support is required to build this project. #endif #if LL_WINDOWS @@ -211,11 +211,7 @@ #endif #endif -#if defined(LL_WINDOWS) || __cplusplus >= 201103L -# define LL_TYPEOF(exp) decltype(exp) -#else -# define LL_TYPEOF(exp) typeof(exp) -#endif +#define LL_TYPEOF(exp) decltype(exp) #define LL_TO_STRING_HELPER(x) #x #define LL_TO_STRING(x) LL_TO_STRING_HELPER(x) @@ -226,8 +222,8 @@ #if LL_WINDOWS #define LL_COMPILE_TIME_MESSAGE(msg) __pragma(message(LL_FILE_LINENO_MSG(msg))) #else -// no way to get gcc 4.2 to print a user-defined diagnostic message only when a macro is used -#define LL_COMPILE_TIME_MESSAGE(msg) +#define PRAGMA_MSG(x) _Pragma(#x) +#define LL_COMPILE_TIME_MESSAGE(msg) PRAGMA_MSG(message msg) #endif #endif // not LL_LINDEN_PREPROCESSOR_H diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index 130e38d71..133cab5ee 100644 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h @@ -29,7 +29,9 @@ #include -#include +//#include +#include +#include #include "llsingleton.h" #include "llstl.h" diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index d8bbb3a74..ec061c9d0 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -31,7 +31,6 @@ #include "llsd.h" #include "llerror.h" -#include "../llmath/llmath.h" #include "llformat.h" #include "llsdserialize.h" #include "stringize.h" @@ -249,10 +248,10 @@ namespace }; LLSD::Boolean ImplReal::asBoolean() const - { return !llisnan(mValue) && mValue != 0.0; } + { return !std::isnan(mValue) && mValue != 0.0; } LLSD::Integer ImplReal::asInteger() const - { return !llisnan(mValue) ? (LLSD::Integer)mValue : 0; } + { return !std::isnan(mValue) ? (LLSD::Integer)mValue : 0; } LLSD::String ImplReal::asString() const { return llformat("%lg", mValue); } diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index a61c4ba97..bb4dea06d 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -1330,13 +1330,7 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 break; case LLSD::TypeBoolean: - if(mBoolAlpha || -#if( LL_WINDOWS || __GNUC__ > 2) - (ostr.flags() & std::ios::boolalpha) -#else - (ostr.flags() & 0x0100) -#endif - ) + if(mBoolAlpha || (ostr.flags() & std::ios::boolalpha)) { ostr << (data.asBoolean() ? NOTATION_TRUE_SERIAL : NOTATION_FALSE_SERIAL); diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 941958d15..9c66bc886 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -35,11 +35,8 @@ #include #include -#include +#include #include -#include -#include -#include #include // Use to compare the first element only of a pair @@ -224,14 +221,7 @@ template //Singu note: This has been generalized to support a broader range of map-esque containers inline bool is_in_map(const T& inmap, typename T::key_type const& key) { - if(inmap.find(key) == inmap.end()) - { - return false; - } - else - { - return true; - } + return inmap.find(key) != inmap.end(); } // Similar to get_ptr_in_map, but for any type with a valid T(0) constructor. @@ -331,19 +321,6 @@ inline T* vector_append(std::vector& invec, S32 N) return &(invec[sz]); } -template -inline void vector_shrink_to_fit(std::vector& invec) -{ - //For Windows: We always assume vs2010 or later, which support this c++11 feature with no configuration needed. - //For GCC: __cplusplus >= 201103L indicates C++11 support. __GXX_EXPERIMENTAL_CXX0X being set indicates experimental c++0x support. C++11 support replaces C++0x support. - // std::vector::shrink_to_fit was added to GCCs C++0x implementation in version 4.5.0. -#if defined(LL_WINDOWS) || __cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X) && __GNUC_MINOR__ >= 5) - invec.shrink_to_fit(); -#else - std::vector(invec).swap(invec); -#endif -} - // call function f to n members starting at first. similar to std::for_each template Function ll_for_n(InputIter first, Size n, Function f) @@ -410,7 +387,7 @@ OutputIter ll_transform_n( template struct _LLSelect1st : public std::unary_function<_Pair, typename _Pair::first_type> { const typename _Pair::first_type& operator()(const _Pair& __x) const { - return __x.first; + return __x.first; } }; @@ -418,7 +395,7 @@ template struct _LLSelect2nd : public std::unary_function<_Pair, typename _Pair::second_type> { const typename _Pair::second_type& operator()(const _Pair& __x) const { - return __x.second; + return __x.second; } }; @@ -438,10 +415,10 @@ protected: _Operation2 __op2; public: ll_unary_compose(const _Operation1& __x, const _Operation2& __y) - : __op1(__x), __op2(__y) {} + : __op1(__x), __op2(__y) {} typename _Operation1::result_type operator()(const typename _Operation2::argument_type& __x) const { - return __op1(__op2(__x)); + return __op1(__op2(__x)); } }; @@ -463,20 +440,20 @@ protected: public: ll_binary_compose(const _Operation1& __x, const _Operation2& __y, const _Operation3& __z) - : _M_op1(__x), _M_op2(__y), _M_op3(__z) { } + : _M_op1(__x), _M_op2(__y), _M_op3(__z) { } typename _Operation1::result_type operator()(const typename _Operation2::argument_type& __x) const { - return _M_op1(_M_op2(__x), _M_op3(__x)); + return _M_op1(_M_op2(__x), _M_op3(__x)); } }; template inline ll_binary_compose<_Operation1, _Operation2, _Operation3> llcompose2(const _Operation1& __op1, const _Operation2& __op2, - const _Operation3& __op3) + const _Operation3& __op3) { return ll_binary_compose<_Operation1,_Operation2,_Operation3> - (__op1, __op2, __op3); + (__op1, __op2, __op3); } // helpers to deal with the fact that MSDev does not package @@ -491,7 +468,7 @@ protected: public: llbinder1st(const _Operation& __x, const typename _Operation::first_argument_type& __y) - : op(__x), value(__y) {} + : op(__x), value(__y) {} typename _Operation::result_type operator()(const typename _Operation::second_argument_type& __x) const { return op(value, __x); @@ -531,27 +508,6 @@ llbind2nd(const _Operation& __oper, const _Tp& __x) return llbinder2nd<_Operation>(__oper, _Arg2_type(__x)); } -/** - * Compare std::type_info* pointers a la std::less. We break this out as a - * separate function for use in two different std::less specializations. - */ -inline -bool before(const std::type_info* lhs, const std::type_info* rhs) -{ -#if LL_LINUX && defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)) - // If we're building on Linux with gcc, and it's either gcc 3.x or - // 4.{0,1,2,3}, then we have to use a workaround. Note that we use gcc on - // Mac too, and some people build with gcc on Windows (cygwin or mingw). - // On Linux, different load modules may produce different type_info* - // pointers for the same type. Have to compare name strings to get good - // results. - return strcmp(lhs->name(), rhs->name()) < 0; -#else // not Linux, or gcc 4.4+ - // Just use before(), as we normally would - return lhs->before(*rhs); -#endif -} - /** * Specialize std::less to use std::type_info::before(). * See MAINT-1175. It is NEVER a good idea to directly compare std::type_info* @@ -566,7 +522,7 @@ namespace std { bool operator()(const std::type_info* lhs, const std::type_info* rhs) const { - return before(lhs, rhs); + return lhs->before(*rhs); } }; @@ -576,7 +532,7 @@ namespace std { bool operator()(std::type_info* lhs, std::type_info* rhs) const { - return before(lhs, rhs); + return lhs->before(*rhs); } }; } // std @@ -592,10 +548,10 @@ namespace std template struct ll_template_cast_impl { - T operator()(U) - { - return 0; - } + T operator()(U) + { + return 0; + } }; /** @@ -637,7 +593,7 @@ struct ll_template_cast_impl template T ll_template_cast(U value) { - return ll_template_cast_impl()(value); + return ll_template_cast_impl()(value); } /** @@ -648,10 +604,10 @@ T ll_template_cast(U value) template struct ll_template_cast_impl { - T operator()(T value) - { - return value; - } + T operator()(T value) + { + return value; + } }; /** @@ -721,10 +677,10 @@ struct ll_template_cast_impl template <> \ struct ll_template_cast_impl \ { \ - DEST operator()(SOURCE wrapper) \ - { \ - return wrapper; \ - } \ + DEST operator()(SOURCE wrapper) \ + { \ + return wrapper; \ + } \ } diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 44c6d1435..f898efe04 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -174,10 +174,10 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars) return outchars - base; } -S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar) +S32 utf16chars_to_wchar(const utf16strtype* inchars, llwchar* outchar) { - const U16* base = inchars; - U16 cur_char = *inchars++; + const utf16strtype* base = inchars; + utf16strtype cur_char = *inchars++; llwchar char32 = cur_char; if ((cur_char >= 0xD800) && (cur_char <= 0xDFFF)) { @@ -236,7 +236,7 @@ LLWString utf16str_to_wstring(const llutf16string &utf16str, S32 len) S32 i = 0; // craziness to make gcc happy (llutf16string.c_str() is tweaked on linux): - const U16* chars16 = &(*(utf16str.begin())); + const utf16strtype* chars16 = &(*(utf16str.begin())); while (i < len) { llwchar cur_char; @@ -257,18 +257,18 @@ S32 utf16str_wstring_length(const llutf16string &utf16str, const S32 utf16_len) { S32 surrogate_pairs = 0; // ... craziness to make gcc happy (llutf16string.c_str() is tweaked on linux): - const U16 *const utf16_chars = &(*(utf16str.begin())); + const utf16strtype *const utf16_chars = &(*(utf16str.begin())); S32 i = 0; while (i < utf16_len) { - const U16 c = utf16_chars[i++]; + const utf16strtype c = utf16_chars[i++]; if (c >= 0xD800 && c <= 0xDBFF) // See http://en.wikipedia.org/wiki/UTF-16 { // Have first byte of a surrogate pair if (i >= utf16_len) { break; } - const U16 d = utf16_chars[i]; + const utf16strtype d = utf16_chars[i]; if (d >= 0xDC00 && d <= 0xDFFF) { // Have valid second byte of a surrogate pair surrogate_pairs++; @@ -621,22 +621,6 @@ bool LLStringOps::isHexString(const std::string& str) } #if LL_WINDOWS -// documentation moved to header. Phoenix 2007-11-27 -namespace snprintf_hack -{ - int snprintf(char *str, size_t size, const char *format, ...) - { - va_list args; - va_start(args, format); - - int num_written = _vsnprintf(str, size, format, args); /* Flawfinder: ignore */ - va_end(args); - - str[size-1] = '\0'; // always null terminate - return num_written; - } -} - std::string ll_convert_wide_to_string(const wchar_t* in, unsigned int code_page) { std::string out; diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 112a25e66..be8af44dd 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -501,7 +501,14 @@ LL_COMMON_API std::string rawstr_to_utf8(const std::string& raw); // // We should never use UTF16 except when communicating with Win32! // -typedef std::basic_string llutf16string; + +#if _WIN32 && _NATIVE_WCHAR_T_DEFINED +typedef wchar_t utf16strtype; +#else +typedef U16 utf16strtype; +#endif + +typedef std::basic_string llutf16string; LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str, S32 len); LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str); @@ -586,32 +593,6 @@ LL_COMMON_API std::string utf8str_removeCRLF(const std::string& utf8str); */ //@{ -/** - * @brief Implementation the expected snprintf interface. - * - * If the size of the passed in buffer is not large enough to hold the string, - * two bad things happen: - * 1. resulting formatted string is NOT null terminated - * 2. Depending on the platform, the return value could be a) the required - * size of the buffer to copy the entire formatted string or b) -1. - * On Windows with VS.Net 2003, it returns -1 e.g. - * - * safe_snprintf always adds a NULL terminator so that the caller does not - * need to check for return value or need to add the NULL terminator. - * It does not, however change the return value - to let the caller know - * that the passed in buffer size was not large enough to hold the - * formatted string. - * - */ - -// Deal with the differeneces on Windows -namespace snprintf_hack -{ - LL_COMMON_API int snprintf(char *str, size_t size, const char *format, ...); -} - -using snprintf_hack::snprintf; - /** * @brief Convert a wide string to std::string * diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index ba81301e3..fd724365e 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -46,15 +46,9 @@ #include "lltimer.h" #include "llsdserialize.h" #include "llsdutil.h" -#include #include #include -#include #include -#include -#include -#include -#include using namespace llsd; @@ -63,6 +57,7 @@ using namespace llsd; # include # include # include // GetPerformanceInfo() et al. +# include #elif LL_DARWIN # include # include @@ -95,8 +90,6 @@ const char MEMINFO_FILE[] = "/proc/meminfo"; extern int errno; #endif - -static const S32 CPUINFO_BUFFER_SIZE = 16383; LLCPUInfo gSysCPU; // Don't log memory info any more often than this. It also serves as our @@ -108,78 +101,6 @@ static const F32 MEM_INFO_THROTTLE = 20; // dropped below the login framerate, we'd have very little additional data. static const F32 MEM_INFO_WINDOW = 10*60; -#if LL_WINDOWS -// We cannot trust GetVersionEx function on Win8.1 , we should check this value when creating OS string -static const U32 WINNT_WINBLUE = 0x0603; - -#ifndef DLLVERSIONINFO -typedef struct _DllVersionInfo -{ - DWORD cbSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformID; -}DLLVERSIONINFO; -#endif - -#ifndef DLLGETVERSIONPROC -typedef int (FAR WINAPI *DLLGETVERSIONPROC) (DLLVERSIONINFO *); -#endif - -bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number) -{ - bool result = false; - const U32 BUFF_SIZE = 32767; - WCHAR tempBuf[BUFF_SIZE]; - if(GetSystemDirectory((LPWSTR)&tempBuf, BUFF_SIZE)) - { - - std::basic_string shell32_path(tempBuf); - - // Shell32.dll contains the DLLGetVersion function. - // according to msdn its not part of the API - // so you have to go in and get it. - // http://msdn.microsoft.com/en-us/library/bb776404(VS.85).aspx - shell32_path += TEXT("\\shell32.dll"); - - HMODULE hDllInst = LoadLibrary(shell32_path.c_str()); //load the DLL - if(hDllInst) - { // Could successfully load the DLL - DLLGETVERSIONPROC pDllGetVersion; - /* - You must get this function explicitly because earlier versions of the DLL - don't implement this function. That makes the lack of implementation of the - function a version marker in itself. - */ - pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hDllInst, - "DllGetVersion"); - - if(pDllGetVersion) - { - // DLL supports version retrieval function - DLLVERSIONINFO dvi; - - ZeroMemory(&dvi, sizeof(dvi)); - dvi.cbSize = sizeof(dvi); - HRESULT hr = (*pDllGetVersion)(&dvi); - - if(SUCCEEDED(hr)) - { // Finally, the version is at our hands - major = dvi.dwMajorVersion; - minor = dvi.dwMinorVersion; - build_number = dvi.dwBuildNumber; - result = true; - } - } - - FreeLibrary(hDllInst); // Release DLL - } - } - return result; -} -#endif // LL_WINDOWS - // Wrap boost::regex_match() with a function that doesn't throw. template static bool regex_match_no_exc(const S& string, M& match, const R& regex) @@ -212,221 +133,141 @@ static bool regex_search_no_exc(const S& string, M& match, const R& regex) } } -#if LL_WINDOWS -// GetVersionEx should not works correct with Windows 8.1 and the later version. We need to check this case -static bool check_for_version(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) -{ - OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 }; - DWORDLONG const dwlConditionMask = VerSetConditionMask( - VerSetConditionMask( - VerSetConditionMask( - 0, VER_MAJORVERSION, VER_GREATER_EQUAL), - VER_MINORVERSION, VER_GREATER_EQUAL), - VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); - - osvi.dwMajorVersion = wMajorVersion; - osvi.dwMinorVersion = wMinorVersion; - osvi.wServicePackMajor = wServicePackMajor; - - return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; -} -#endif - - LLOSInfo::LLOSInfo() : mMajorVer(0), mMinorVer(0), mBuild(0), mOSVersionString("") { #if LL_WINDOWS + bool is_server = IsWindowsServer(); + std::string service_pack; + if (IsWindows10OrGreater()) + { + if (is_server) + { + mOSStringSimple = "Microsoft Windows Server 2016 "; + } + else + { + mOSStringSimple = "Microsoft Windows 10 "; + } + } + else if (IsWindows8Point1OrGreater()) + { + if (is_server) + { + mOSStringSimple = "Microsoft Windows Server 2012 R2 "; + } + else + { + mOSStringSimple = "Microsoft Windows 8.1 "; + } + } + else if (IsWindows8OrGreater()) + { + if (is_server) + { + mOSStringSimple = "Microsoft Windows Server 2012 "; + } + else + { + mOSStringSimple = "Microsoft Windows 8 "; + } + } + else if (IsWindows7OrGreater()) + { + if (is_server) + { + mOSStringSimple = "Microsoft Windows Server 2008 R2 "; + } + else + { + mOSStringSimple = "Microsoft Windows 7 "; + } + if (IsWindows7SP1OrGreater()) + { + service_pack = "Service Pack 1 "; + } + } + else if (IsWindowsVistaOrGreater()) + { + if (is_server) + { + mOSStringSimple = "Microsoft Windows Server 2008 "; + } + else + { + mOSStringSimple = "Microsoft Windows Vista "; + } + if (IsWindowsVistaSP2OrGreater()) + { + service_pack = "Service Pack 2 "; + } + else if (IsWindowsVistaSP1OrGreater()) + { + service_pack = "Service Pack 1 "; + } + } + else + { + mOSStringSimple = "Microsoft Windows (unrecognized) "; + } + + ///get native system info if available.. + typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); ///function pointer for loading GetNativeSystemInfo + SYSTEM_INFO si; //System Info object file contains architecture info + PGNSI pGNSI; //pointer object + ZeroMemory(&si, sizeof(SYSTEM_INFO)); //zero out the memory in information + pGNSI = (PGNSI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); //load kernel32 get function + if (NULL != pGNSI) //check if it has failed + pGNSI(&si); //success + else + GetSystemInfo(&si); //if it fails get regular system info + //(Warning: If GetSystemInfo it may result in incorrect information in a WOW64 machine, if the kernel fails to load) + + //msdn microsoft finds 32 bit and 64 bit flavors this way.. + //http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx (example code that contains quite a few more flavors + //of windows than this code does (in case it is needed for the future) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) //check for 64 bit + { + mOSStringSimple += "64-bit "; + } + else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + { + mOSStringSimple += "32-bit "; + } + OSVERSIONINFOEX osvi; BOOL bOsVersionInfoEx; - BOOL bShouldUseShellVersion = false; - // Try calling GetVersionEx using the OSVERSIONINFOEX structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - if(!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) + if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) { // If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO. - osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if(!GetVersionEx( (OSVERSIONINFO *) &osvi)) - return; + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi); } - mMajorVer = osvi.dwMajorVersion; - mMinorVer = osvi.dwMinorVersion; - mBuild = osvi.dwBuildNumber; - DWORD shell32_major, shell32_minor, shell32_build; - bool got_shell32_version = get_shell32_dll_version(shell32_major, - shell32_minor, - shell32_build); - - switch(osvi.dwPlatformId) + + std::string tmpstr; + if (bOsVersionInfoEx) { - case VER_PLATFORM_WIN32_NT: - { - // Test for the product. - if(osvi.dwMajorVersion <= 4) - { - mOSStringSimple = "Microsoft Windows NT "; - } - else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) - { - mOSStringSimple = "Microsoft Windows 2000 "; - } - else if(osvi.dwMajorVersion ==5 && osvi.dwMinorVersion == 1) - { - mOSStringSimple = "Microsoft Windows XP "; - } - else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) - { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows XP x64 Edition "; - else - mOSStringSimple = "Microsoft Windows Server 2003 "; - } - else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion <= 2) - { - if(osvi.dwMinorVersion == 0) - { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows Vista "; - else - mOSStringSimple = "Windows Server 2008 "; - } - else if(osvi.dwMinorVersion == 1) - { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows 7 "; - else - mOSStringSimple = "Windows Server 2008 R2 "; - } - else if(osvi.dwMinorVersion == 2) - { - if (check_for_version(HIBYTE(WINNT_WINBLUE), LOBYTE(WINNT_WINBLUE), 0)) - { - mOSStringSimple = "Microsoft Windows 8.1 "; - bShouldUseShellVersion = true; // GetVersionEx failed, going to use shell version - } - else - { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows 8 "; - else - mOSStringSimple = "Windows Server 2012 "; - } - } - - ///get native system info if available.. - typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); ///function pointer for loading GetNativeSystemInfo - SYSTEM_INFO si; //System Info object file contains architecture info - PGNSI pGNSI; //pointer object - ZeroMemory(&si, sizeof(SYSTEM_INFO)); //zero out the memory in information - pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); //load kernel32 get function - if(NULL != pGNSI) //check if it has failed - pGNSI(&si); //success - else - GetSystemInfo(&si); //if it fails get regular system info - //(Warning: If GetSystemInfo it may result in incorrect information in a WOW64 machine, if the kernel fails to load) - - //msdn microsoft finds 32 bit and 64 bit flavors this way.. - //http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx (example code that contains quite a few more flavors - //of windows than this code does (in case it is needed for the future) - if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) //check for 64 bit - { - mOSStringSimple += "64-bit "; - } - else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL ) - { - mOSStringSimple += "32-bit "; - } - } - else // Use the registry on early versions of Windows NT. - { - mOSStringSimple = "Microsoft Windows (unrecognized) "; - - HKEY hKey; - WCHAR szProductType[80]; - DWORD dwBufLen; - RegOpenKeyEx( HKEY_LOCAL_MACHINE, - L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions", - 0, KEY_QUERY_VALUE, &hKey ); - RegQueryValueEx( hKey, L"ProductType", NULL, NULL, - (LPBYTE) szProductType, &dwBufLen); - RegCloseKey( hKey ); - if ( lstrcmpi( L"WINNT", szProductType) == 0 ) - { - mOSStringSimple += "Professional "; - } - else if ( lstrcmpi( L"LANMANNT", szProductType) == 0 ) - { - mOSStringSimple += "Server "; - } - else if ( lstrcmpi( L"SERVERNT", szProductType) == 0 ) - { - mOSStringSimple += "Advanced Server "; - } - } - - std::string csdversion = utf16str_to_utf8str(osvi.szCSDVersion); - // Display version, service pack (if any), and build number. - std::string tmpstr; - if(osvi.dwMajorVersion <= 4) - { - tmpstr = llformat("version %d.%d %s (Build %d)", - osvi.dwMajorVersion, - osvi.dwMinorVersion, - csdversion.c_str(), - (osvi.dwBuildNumber & 0xffff)); - } - else - { - tmpstr = !bShouldUseShellVersion ? llformat("%s (Build %d)", csdversion.c_str(), (osvi.dwBuildNumber & 0xffff)): - llformat("%s (Build %d)", csdversion.c_str(), shell32_build); - } - - mOSString = mOSStringSimple + tmpstr; - } - break; - - case VER_PLATFORM_WIN32_WINDOWS: - // Test for the Windows 95 product family. - if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) - { - mOSStringSimple = "Microsoft Windows 95 "; - if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' ) - { - mOSStringSimple += "OSR2 "; - } - } - if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) - { - mOSStringSimple = "Microsoft Windows 98 "; - if ( osvi.szCSDVersion[1] == 'A' ) - { - mOSStringSimple += "SE "; - } - } - if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) - { - mOSStringSimple = "Microsoft Windows Millennium Edition "; - } - mOSString = mOSStringSimple; - break; + mMajorVer = osvi.dwMajorVersion; + mMinorVer = osvi.dwMinorVersion; + mBuild = osvi.dwBuildNumber; + tmpstr = llformat("%s(Build %d)", service_pack.c_str(), mBuild); } - - std::string compatibility_mode; - if(got_shell32_version) + else { - if((osvi.dwMajorVersion != shell32_major || osvi.dwMinorVersion != shell32_minor) && !bShouldUseShellVersion) - { - compatibility_mode = llformat(" compatibility mode. real ver: %d.%d (Build %d)", - shell32_major, - shell32_minor, - shell32_build); - } + mMajorVer = 0; + mMinorVer = 0; + mBuild = 0; + tmpstr = llformat("%s(Build %d)", service_pack.c_str(), 0); } - mOSString += compatibility_mode; + + // Display version, service pack (if any), and build number. + mOSString = mOSStringSimple + tmpstr; + LLStringUtil::trim(mOSStringSimple); #elif LL_DARWIN @@ -668,8 +509,6 @@ const std::string& LLOSInfo::getOSVersionString() const return mOSVersionString; } -const S32 STATUS_SIZE = 8192; - //static U32 LLOSInfo::getProcessVirtualSizeKB() { @@ -677,6 +516,7 @@ U32 LLOSInfo::getProcessVirtualSizeKB() #if LL_WINDOWS #endif #if LL_LINUX +# define STATUS_SIZE 2048 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); if (status_filep) { @@ -834,7 +674,7 @@ public: // Store every integer type as LLSD::Integer. template void add(const LLSD::String& name, const T& value, - typename boost::enable_if >::type* = 0) + typename std::enable_if::value>::type* = nullptr) { mStats[name] = LLSD::Integer(value); } @@ -842,7 +682,7 @@ public: // Store every floating-point type as LLSD::Real. template void add(const LLSD::String& name, const T& value, - typename boost::enable_if >::type* = 0) + typename std::enable_if::value>::type* = nullptr) { mStats[name] = LLSD::Real(value); } @@ -1029,7 +869,7 @@ void LLMemoryInfo::stream(std::ostream& s) const // Max key length size_t key_width(0); - BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) + for (const MapEntry& pair : inMap(mStatsMap)) { size_t len(pair.first.length()); if (len > key_width) @@ -1039,7 +879,7 @@ void LLMemoryInfo::stream(std::ostream& s) const } // Now stream stats - BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) + for (const MapEntry& pair : inMap(mStatsMap)) { s << pfx << std::setw(key_width+1) << (pair.first + ':') << ' '; LLSD value(pair.second); @@ -1327,7 +1167,8 @@ public: // Hooking onto the "mainloop" event pump gets us one call per frame. mConnection(LLEventPumps::instance() .obtain("mainloop") - .listen("FrameWatcher", boost::bind(&FrameWatcher::tick, this, _1))), + .listen("FrameWatcher", std::bind(&FrameWatcher::tick, this, std::placeholders::_1))), + // Initializing mSampleStart to an invalid timestamp alerts us to skip // trying to compute framerate on the first call. mSampleStart(-1), diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 33b6e9809..9ac6496c4 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -201,7 +201,7 @@ protected: #include typedef boost::recursive_mutex LLMutexImpl; typedef boost::condition_variable_any LLConditionVariableImpl; -#elif defined(USE_STD_MUTEX) && LL_CPP11 +#elif defined(USE_STD_MUTEX) #include typedef std::recursive_mutex LLMutexImpl; typedef std::condition_variable_any LLConditionVariableImpl; diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index ff9f63b1a..1ef4aa414 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -81,10 +81,10 @@ void ms_sleep(U32 ms) U32 micro_sleep(U64 us, U32 max_yields) { - // max_yields is unused; just fiddle with it to avoid warnings. - max_yields = 0; - ms_sleep(us / 1000); - return 0; + // max_yields is unused; just fiddle with it to avoid warnings. + max_yields = 0; + ms_sleep(us / 1000); + return 0; } #elif LL_LINUX || LL_SOLARIS || LL_DARWIN static void _sleep_loop(struct timespec& thiswait) @@ -103,8 +103,8 @@ static void _sleep_loop(struct timespec& thiswait) if (sleep_more) { if ( nextwait.tv_sec > thiswait.tv_sec || - (nextwait.tv_sec == thiswait.tv_sec && - nextwait.tv_nsec >= thiswait.tv_nsec) ) + (nextwait.tv_sec == thiswait.tv_sec && + nextwait.tv_nsec >= thiswait.tv_nsec) ) { // if the remaining time isn't actually going // down then we're being shafted by low clock @@ -130,31 +130,31 @@ static void _sleep_loop(struct timespec& thiswait) U32 micro_sleep(U64 us, U32 max_yields) { - U64 start = get_clock_count(); - // This is kernel dependent. Currently, our kernel generates software clock - // interrupts at 250 Hz (every 4,000 microseconds). - const U64 KERNEL_SLEEP_INTERVAL_US = 4000; + U64 start = get_clock_count(); + // This is kernel dependent. Currently, our kernel generates software clock + // interrupts at 250 Hz (every 4,000 microseconds). + const U64 KERNEL_SLEEP_INTERVAL_US = 4000; - S32 num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; - if (num_sleep_intervals > 0) - { - U64 sleep_time = (num_sleep_intervals * KERNEL_SLEEP_INTERVAL_US) - (KERNEL_SLEEP_INTERVAL_US >> 1); - struct timespec thiswait; - thiswait.tv_sec = sleep_time / 1000000; - thiswait.tv_nsec = (sleep_time % 1000000) * 1000l; - _sleep_loop(thiswait); - } + S32 num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; + if (num_sleep_intervals > 0) + { + U64 sleep_time = (num_sleep_intervals * KERNEL_SLEEP_INTERVAL_US) - (KERNEL_SLEEP_INTERVAL_US >> 1); + struct timespec thiswait; + thiswait.tv_sec = sleep_time / 1000000; + thiswait.tv_nsec = (sleep_time % 1000000) * 1000l; + _sleep_loop(thiswait); + } - U64 current_clock = get_clock_count(); - U32 yields = 0; - while ( (yields < max_yields) - && (current_clock - start < us) ) - { - sched_yield(); - ++yields; - current_clock = get_clock_count(); - } - return yields; + U64 current_clock = get_clock_count(); + U32 yields = 0; + while ( (yields < max_yields) + && (current_clock - start < us) ) + { + sched_yield(); + ++yields; + current_clock = get_clock_count(); + } + return yields; } void ms_sleep(U32 ms) @@ -163,7 +163,7 @@ void ms_sleep(U32 ms) struct timespec thiswait; thiswait.tv_sec = ms / 1000; thiswait.tv_nsec = (mslong % 1000) * 1000000l; - _sleep_loop(thiswait); + _sleep_loop(thiswait); } #else # error "architecture not supported" @@ -411,15 +411,15 @@ BOOL LLTimer::knownBadTimer() #if LL_WINDOWS WCHAR bad_pci_list[][10] = {L"1039:0530", - L"1039:0620", - L"10B9:0533", - L"10B9:1533", - L"1106:0596", - L"1106:0686", - L"1166:004F", - L"1166:0050", - L"8086:7110", - L"\0" + L"1039:0620", + L"10B9:0533", + L"10B9:1533", + L"1106:0596", + L"1106:0686", + L"1166:004F", + L"1166:0050", + L"8086:7110", + L"\0" }; HKEY hKey = NULL; diff --git a/indra/llcommon/lltreeiterators.h b/indra/llcommon/lltreeiterators.h index ba861ae70..6aea5f7cc 100644 --- a/indra/llcommon/lltreeiterators.h +++ b/indra/llcommon/lltreeiterators.h @@ -63,7 +63,10 @@ #include #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include namespace LLTreeIter diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 85abc411c..31bbd9036 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -73,7 +73,7 @@ public: BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings void setNull(); // Faster than setting to LLUUID::null. - S32 cmpTime(uuid_time_t *t1, uuid_time_t *t2); + S32 cmpTime(uuid_time_t *t1, uuid_time_t *t2); static void getSystemTime(uuid_time_t *timestamp); void getCurrentTime(uuid_time_t *timestamp); @@ -307,8 +307,6 @@ struct lluuid_less typedef std::set uuid_list_t; - -#ifdef LL_CPP11 namespace std { template <> struct hash { @@ -319,7 +317,6 @@ namespace std { } }; } -#endif namespace boost { template<> class hash diff --git a/indra/llcommon/llversionviewer.h.in b/indra/llcommon/llversionviewer.h.in deleted file mode 100644 index 76d53b926..000000000 --- a/indra/llcommon/llversionviewer.h.in +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file llversionviewer.h - * @brief - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLVERSIONVIEWER_H -#define LL_LLVERSIONVIEWER_H - -const S32 LL_VERSION_MAJOR = 1; -const S32 LL_VERSION_MINOR = 8; -const S32 LL_VERSION_PATCH = 6; -const S32 LL_VERSION_BUILD = ${vBUILD}; - -const char * const LL_CHANNEL = "${VIEWER_CHANNEL}"; - -#if LL_DARWIN -const char * const LL_VERSION_BUNDLE_ID = "org.singularityviewer.singularity"; -#endif - -#endif - diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index af0b4dd4e..b5079f849 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -108,8 +108,4 @@ typedef U8 LLPCode; #define LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) ) -#if LL_LINUX && __GNUC__ <= 2 -typedef int intptr_t; -#endif - #endif diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt index 431744c42..e05eebc32 100644 --- a/indra/llimage/CMakeLists.txt +++ b/indra/llimage/CMakeLists.txt @@ -54,7 +54,7 @@ set_source_files_properties(${llimage_HEADER_FILES} list(APPEND llimage_SOURCE_FILES ${llimage_HEADER_FILES}) add_library (llimage ${llimage_SOURCE_FILES}) -add_dependencies(llimage prepare) + target_link_libraries( llimage ${JPEG_LIBRARIES} diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index f034909da..a8de77067 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -1155,7 +1155,7 @@ bool LLImageTGA::loadFile( const std::string& path ) return false; } - S32 file_size = 0; + size_t file_size = 0; if (!fseek(file, 0, SEEK_END)) { file_size = ftell(file); diff --git a/indra/llimagej2coj/CMakeLists.txt b/indra/llimagej2coj/CMakeLists.txt index e8b87e587..af7d35601 100644 --- a/indra/llimagej2coj/CMakeLists.txt +++ b/indra/llimagej2coj/CMakeLists.txt @@ -41,7 +41,7 @@ IF(WIN32) ENDIF(WIN32) add_library (llimagej2coj ${llimagej2coj_SOURCE_FILES}) -add_dependencies(llimagej2coj prepare) + target_link_libraries( llimagej2coj ${OPENJPEG_LIBRARIES} diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index f288fa496..028117151 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -58,4 +58,3 @@ set_source_files_properties(${llinventory_HEADER_FILES} list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES}) add_library (llinventory ${llinventory_SOURCE_FILES}) -add_dependencies(llinventory prepare) diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index 392dfd345..dbb692bde 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -102,6 +102,8 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", TRUE)); addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", TRUE)); addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); + + addEntry(LLFolderType::FT_SUITCASE, new FolderEntry("suitcase", FALSE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; diff --git a/indra/llinventory/llfoldertype.h b/indra/llinventory/llfoldertype.h index 421c44fea..bb9a3f213 100644 --- a/indra/llinventory/llfoldertype.h +++ b/indra/llinventory/llfoldertype.h @@ -94,6 +94,8 @@ public: FT_BASIC_ROOT = 52, + FT_SUITCASE = 100, + FT_COUNT, FT_NONE = -1 diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 01c9d1783..6bce8f62e 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -34,7 +34,6 @@ #include "llsd.h" #include "message.h" #include -#include "../newview/hippogridmanager.h" #include "llsdutil.h" @@ -545,10 +544,6 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 S8 type; msg->getS8Fast(block, _PREHASH_Type, type, block_num); mType = static_cast(type); - if (mType == LLAssetType::AT_LINK || mType == LLAssetType::AT_LINK_FOLDER) - { - gHippoGridManager->getConnectedGrid()->setSupportsInvLinks(true); - } msg->getS8(block, "InvType", type, block_num); mInventoryType = static_cast(type); mPermissions.initMasks(mInventoryType); @@ -836,7 +831,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("permissions", keyword)) { - success = mPermissions.importStream(input_stream); + success = mPermissions.importLegacyStream(input_stream); } else if(0 == strcmp("sale_info", keyword)) { @@ -846,7 +841,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) // should pick up the vast majority of the tasks. BOOL has_perm_mask = FALSE; U32 perm_mask = 0; - success = mSaleInfo.importStream(input_stream, has_perm_mask, perm_mask); + success = mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask); if(has_perm_mask) { if(perm_mask == PERM_NONE) @@ -962,7 +957,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu output_stream << "\t\titem_id\t" << uuid_str << "\n"; mParentUUID.toString(uuid_str); output_stream << "\t\tparent_id\t" << uuid_str << "\n"; - mPermissions.exportStream(output_stream); + mPermissions.exportLegacyStream(output_stream); // Check for permissions to see the asset id, and if so write it // out as an asset id. Otherwise, apply our cheesy encryption. @@ -996,7 +991,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu std::string buffer; buffer = llformat( "\t\tflags\t%08x\n", mFlags); output_stream << buffer; - mSaleInfo.exportStream(output_stream); + mSaleInfo.exportLegacyStream(output_stream); output_stream << "\t\tname\t" << mName.c_str() << "|\n"; output_stream << "\t\tdesc\t" << mDescription.c_str() << "|\n"; output_stream << "\t\tcreation_date\t" << mCreationDate << "\n"; @@ -1132,11 +1127,6 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) S8 type = (U8)sd[w].asInteger(); mType = static_cast(type); } - - if (mType == LLAssetType::AT_LINK || mType == LLAssetType::AT_LINK_FOLDER) - { - gHippoGridManager->getConnectedGrid()->setSupportsInvLinks(true); - } } w = INV_INVENTORY_TYPE_LABEL; if (sd.has(w)) diff --git a/indra/llinventory/lllandmark.h b/indra/llinventory/lllandmark.h index feaf1a0e9..6d6f63b75 100644 --- a/indra/llinventory/lllandmark.h +++ b/indra/llinventory/lllandmark.h @@ -35,7 +35,10 @@ #define LL_LLLANDMARK_H #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include "llframetimer.h" #include "lluuid.h" #include "v3dmath.h" diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index b0deafdfe..2316c635d 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -31,7 +31,6 @@ // library includes #include "message.h" -#include "metapropertyt.h" #include "llsd.h" ///---------------------------------------------------------------------------- @@ -572,17 +571,143 @@ void LLPermissions::unpackMessage(LLMessageSystem* msg, const char* block, S32 b BOOL LLPermissions::importFile(LLFILE* fp) { - llifstream ifs(fp); - return importStream(ifs); + init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); + const S32 BUFSIZE = 16384; + + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. + char buffer[BUFSIZE]; /* Flawfinder: ignore */ + char keyword[256]; /* Flawfinder: ignore */ + char valuestr[256]; /* Flawfinder: ignore */ + char uuid_str[256]; /* Flawfinder: ignore */ + U32 mask; + + keyword[0] = '\0'; + valuestr[0] = '\0'; + + while (!feof(fp)) + { + if (fgets(buffer, BUFSIZE, fp) == NULL) + { + buffer[0] = '\0'; + } + + sscanf( /* Flawfinder: ignore */ + buffer, + " %255s %255s", + keyword, valuestr); + if (!strcmp("{", keyword)) + { + continue; + } + if (!strcmp("}",keyword)) + { + break; + } + else if (!strcmp("creator_mask", keyword)) + { + // legacy support for "creator" masks + sscanf(valuestr, "%x", &mask); + mMaskBase = mask; + fixFairUse(); + } + else if (!strcmp("base_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskBase = mask; + //fixFairUse(); + } + else if (!strcmp("owner_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskOwner = mask; + } + else if (!strcmp("group_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskGroup = mask; + } + else if (!strcmp("everyone_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskEveryone = mask; + } + else if (!strcmp("next_owner_mask", keyword)) + { + sscanf(valuestr, "%x", &mask); + mMaskNextOwner = mask; + } + else if (!strcmp("creator_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mCreator.set(uuid_str); + } + else if (!strcmp("owner_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mOwner.set(uuid_str); + } + else if (!strcmp("last_owner_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mLastOwner.set(uuid_str); + } + else if (!strcmp("group_id", keyword)) + { + sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */ + mGroup.set(uuid_str); + } + else if (!strcmp("group_owned", keyword)) + { + sscanf(valuestr, "%d", &mask); + if(mask) mIsGroupOwned = true; + else mIsGroupOwned = false; + } + else + { + LL_INFOS() << "unknown keyword " << keyword << " in permissions import" << LL_ENDL; + } + } + fix(); + return TRUE; } + BOOL LLPermissions::exportFile(LLFILE* fp) const { - llofstream ofs(fp); - return exportStream(ofs); + std::string uuid_str; + + fprintf(fp, "\tpermissions 0\n"); + fprintf(fp, "\t{\n"); + + fprintf(fp, "\t\tbase_mask\t%08x\n", mMaskBase); + fprintf(fp, "\t\towner_mask\t%08x\n", mMaskOwner); + fprintf(fp, "\t\tgroup_mask\t%08x\n", mMaskGroup); + fprintf(fp, "\t\teveryone_mask\t%08x\n", mMaskEveryone); + fprintf(fp, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); + + mCreator.toString(uuid_str); + fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str.c_str()); + + mOwner.toString(uuid_str); + fprintf(fp, "\t\towner_id\t%s\n", uuid_str.c_str()); + + mLastOwner.toString(uuid_str); + fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str.c_str()); + + mGroup.toString(uuid_str); + fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str.c_str()); + + if(mIsGroupOwned) + { + fprintf(fp, "\t\tgroup_owned\t1\n"); + } + fprintf(fp,"\t}\n"); + return TRUE; } -BOOL LLPermissions::importStream(std::istream& input_stream) + +BOOL LLPermissions::importLegacyStream(std::istream& input_stream) { init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); const S32 BUFSIZE = 16384; @@ -601,18 +726,6 @@ BOOL LLPermissions::importStream(std::istream& input_stream) while (input_stream.good()) { input_stream.getline(buffer, BUFSIZE); - if (input_stream.eof()) - { - LL_WARNS() << "Bad permissions: early end of input stream" - << LL_ENDL; - return FALSE; - } - if (input_stream.fail()) - { - LL_WARNS() << "Bad permissions: failed to read from input stream" - << LL_ENDL; - return FALSE; - } sscanf( /* Flawfinder: ignore */ buffer, " %255s %255s", @@ -695,26 +808,36 @@ BOOL LLPermissions::importStream(std::istream& input_stream) } -BOOL LLPermissions::exportStream(std::ostream& output_stream) const +BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const { - if (!output_stream.good()) return FALSE; + std::string uuid_str; + output_stream << "\tpermissions 0\n"; output_stream << "\t{\n"; - char prev_fill = output_stream.fill('0'); - output_stream << std::hex; - output_stream << "\t\tbase_mask\t" << std::setw(8) << mMaskBase << "\n"; - output_stream << "\t\towner_mask\t" << std::setw(8) << mMaskOwner << "\n"; - output_stream << "\t\tgroup_mask\t" << std::setw(8) << mMaskGroup << "\n"; - output_stream << "\t\teveryone_mask\t" << std::setw(8) << mMaskEveryone << "\n"; - output_stream << "\t\tnext_owner_mask\t" << std::setw(8) << mMaskNextOwner << "\n"; - output_stream << std::dec; - output_stream.fill(prev_fill); + std::string buffer; + buffer = llformat( "\t\tbase_mask\t%08x\n", mMaskBase); + output_stream << buffer; + buffer = llformat( "\t\towner_mask\t%08x\n", mMaskOwner); + output_stream << buffer; + buffer = llformat( "\t\tgroup_mask\t%08x\n", mMaskGroup); + output_stream << buffer; + buffer = llformat( "\t\teveryone_mask\t%08x\n", mMaskEveryone); + output_stream << buffer; + buffer = llformat( "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner); + output_stream << buffer; - output_stream << "\t\tcreator_id\t" << mCreator << "\n"; - output_stream << "\t\towner_id\t" << mOwner << "\n"; - output_stream << "\t\tlast_owner_id\t" << mLastOwner << "\n"; - output_stream << "\t\tgroup_id\t" << mGroup << "\n"; + mCreator.toString(uuid_str); + output_stream << "\t\tcreator_id\t" << uuid_str << "\n"; + + mOwner.toString(uuid_str); + output_stream << "\t\towner_id\t" << uuid_str << "\n"; + + mLastOwner.toString(uuid_str); + output_stream << "\t\tlast_owner_id\t" << uuid_str << "\n"; + + mGroup.toString(uuid_str); + output_stream << "\t\tgroup_id\t" << uuid_str << "\n"; if(mIsGroupOwned) { @@ -772,21 +895,6 @@ std::ostream& operator<<(std::ostream &s, const LLPermissions &perm) return s; } -template <> -void LLMetaClassT::reflectProperties(LLMetaClass& meta_class) -{ - reflectProperty(meta_class, "mCreator", &LLPermissions::mCreator); - reflectProperty(meta_class, "mOwner", &LLPermissions::mOwner); - reflectProperty(meta_class, "mGroup", &LLPermissions::mGroup); - reflectProperty(meta_class, "mIsGroupOwned", &LLPermissions::mIsGroupOwned); -} - -// virtual -const LLMetaClass& LLPermissions::getMetaClass() const -{ - return LLMetaClassT::instance(); -} - ///---------------------------------------------------------------------------- /// Class LLAggregatePermissions ///---------------------------------------------------------------------------- @@ -1021,7 +1129,7 @@ void mask_to_string(U32 mask, char* str) else { *str = ' '; - } + } str++; if (mask & PERM_EXPORT) diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index d3a65a5a6..a69f6033d 100644 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -31,7 +31,6 @@ #include "llsd.h" #include "lluuid.h" #include "llxmlnode.h" -#include "reflective.h" #include "llinventorytype.h" // prototypes @@ -89,7 +88,7 @@ enum ExportPolicy { // logical consistency. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLPermissions : public LLReflective +class LLPermissions { private: LLUUID mCreator; // null if object created by system @@ -329,17 +328,14 @@ public: BOOL importFile(LLFILE* fp); BOOL exportFile(LLFILE* fp) const; - BOOL importStream(std::istream& input_stream); - BOOL exportStream(std::ostream& output_stream) const; + BOOL importLegacyStream(std::istream& input_stream); + BOOL exportLegacyStream(std::ostream& output_stream) const; bool operator==(const LLPermissions &rhs) const; bool operator!=(const LLPermissions &rhs) const; friend std::ostream& operator<<(std::ostream &s, const LLPermissions &perm); - // Reflection. - friend class LLMetaClassT; - virtual const LLMetaClass& getMetaClass() const; }; // Inlines diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index 2c5d163e3..021c1d9d3 100644 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -87,13 +87,15 @@ U32 LLSaleInfo::getCRC32() const BOOL LLSaleInfo::exportFile(LLFILE* fp) const { - llofstream ofs(fp); - return exportStream(ofs); + fprintf(fp, "\tsale_info\t0\n\t{\n"); + fprintf(fp, "\t\tsale_type\t%s\n", lookup(mSaleType)); + fprintf(fp, "\t\tsale_price\t%d\n", mSalePrice); + fprintf(fp,"\t}\n"); + return TRUE; } -BOOL LLSaleInfo::exportStream(std::ostream& output_stream) const +BOOL LLSaleInfo::exportLegacyStream(std::ostream& output_stream) const { - if (!output_stream.good()) return FALSE; output_stream << "\tsale_info\t0\n\t{\n"; output_stream << "\t\tsale_type\t" << lookup(mSaleType) << "\n"; output_stream << "\t\tsale_price\t" << mSalePrice << "\n"; @@ -137,40 +139,25 @@ bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask) // because I can't find any non-test code references to it. 2009-05-04 JC BOOL LLSaleInfo::importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask) -{ - llifstream ifs(fp); - return importStream(ifs, has_perm_mask, perm_mask); -} - -BOOL LLSaleInfo::importStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask) { has_perm_mask = FALSE; - const S32 BUFSIZE = 16384; - // *NOTE: Changing the buffer size will require changing the scanf // calls below. - char buffer[BUFSIZE]; /* Flawfinder: ignore */ - char keyword[255]; /* Flawfinder: ignore */ - char valuestr[255]; /* Flawfinder: ignore */ + char buffer[MAX_STRING]; /* Flawfinder: ignore */ + char keyword[MAX_STRING]; /* Flawfinder: ignore */ + char valuestr[MAX_STRING]; /* Flawfinder: ignore */ + BOOL success = TRUE; keyword[0] = '\0'; valuestr[0] = '\0'; - while(input_stream.good()) + while(success && (!feof(fp))) { - input_stream.getline(buffer, MAX_STRING); - if (input_stream.eof()) + if (fgets(buffer, MAX_STRING, fp) == NULL) { - LL_WARNS() << "Bad sale info: early end of input stream" - << LL_ENDL; - return FALSE; - } - if (input_stream.fail()) - { - LL_WARNS() << "Bad sale info: failed to read from input stream" - << LL_ENDL; - return FALSE; + buffer[0] = '\0'; } + sscanf( /* Flawfinder: ignore */ buffer, " %254s %254s", @@ -208,7 +195,63 @@ BOOL LLSaleInfo::importStream(std::istream& input_stream, BOOL& has_perm_mask, U << "' in sale info import" << LL_ENDL; } } - return TRUE; + return success; +} + +BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask) +{ + has_perm_mask = FALSE; + + // *NOTE: Changing the buffer size will require changing the scanf + // calls below. + char buffer[MAX_STRING]; /* Flawfinder: ignore */ + char keyword[MAX_STRING]; /* Flawfinder: ignore */ + char valuestr[MAX_STRING]; /* Flawfinder: ignore */ + BOOL success = TRUE; + + keyword[0] = '\0'; + valuestr[0] = '\0'; + while(success && input_stream.good()) + { + input_stream.getline(buffer, MAX_STRING); + sscanf( /* Flawfinder: ignore */ + buffer, + " %254s %254s", + keyword, valuestr); + if(!keyword[0]) + { + continue; + } + if(0 == strcmp("{",keyword)) + { + continue; + } + if(0 == strcmp("}", keyword)) + { + break; + } + else if(0 == strcmp("sale_type", keyword)) + { + mSaleType = lookup(valuestr); + } + else if(0 == strcmp("sale_price", keyword)) + { + sscanf(valuestr, "%d", &mSalePrice); + mSalePrice = llclamp(mSalePrice, 0, S32_MAX); + } + else if (!strcmp("perm_mask", keyword)) + { + //LL_INFOS() << "found deprecated keyword perm_mask" << LL_ENDL; + has_perm_mask = TRUE; + sscanf(valuestr, "%x", &perm_mask); + } + else + { + LL_WARNS() << "unknown keyword '" << keyword + << "' in sale info import" << LL_ENDL; + } + } + return success; } void LLSaleInfo::setSalePrice(S32 price) diff --git a/indra/llinventory/llsaleinfo.h b/indra/llinventory/llsaleinfo.h index 8a01653a6..262aeb3dd 100644 --- a/indra/llinventory/llsaleinfo.h +++ b/indra/llinventory/llsaleinfo.h @@ -95,11 +95,11 @@ public: BOOL exportFile(LLFILE* fp) const; BOOL importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask); - BOOL exportStream(std::ostream& output_stream) const; + BOOL exportLegacyStream(std::ostream& output_stream) const; LLSD asLLSD() const; operator LLSD() const { return asLLSD(); } bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask); - BOOL importStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask); + BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask); LLSD packMessage() const; void unpackMessage(const LLSD& sales); diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index 1c43bb218..ff174112a 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -13,6 +13,7 @@ set(llmath_SOURCE_FILES llbbox.cpp llbboxlocal.cpp llcalc.cpp + llcalcparser.cpp llcamera.cpp llcoordframe.cpp llline.cpp @@ -97,4 +98,3 @@ set_source_files_properties(${llmath_HEADER_FILES} list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES}) add_library (llmath ${llmath_SOURCE_FILES}) -add_dependencies(llmath prepare) diff --git a/indra/llmath/llcalc.cpp b/indra/llmath/llcalc.cpp index 46330a767..edc6986cc 100644 --- a/indra/llmath/llcalc.cpp +++ b/indra/llmath/llcalc.cpp @@ -28,61 +28,59 @@ #include "llcalc.h" +#include "llcalcparser.h" #include "llmath.h" -#include "llcalcparser.h" // Variable names for use in the build floater -// must be lower case for parser definition -// case-insensitive for actual parsing -const char* LLCalc::X_POS = "px"; -const char* LLCalc::Y_POS = "py"; -const char* LLCalc::Z_POS = "pz"; -const char* LLCalc::X_SCALE = "sx"; -const char* LLCalc::Y_SCALE = "sy"; -const char* LLCalc::Z_SCALE = "sz"; -const char* LLCalc::X_ROT = "rx"; -const char* LLCalc::Y_ROT = "ry"; -const char* LLCalc::Z_ROT = "rz"; -const char* LLCalc::HOLLOW = "hlw"; -const char* LLCalc::CUT_BEGIN = "cb"; -const char* LLCalc::CUT_END = "ce"; -const char* LLCalc::PATH_BEGIN = "pb"; -const char* LLCalc::PATH_END = "pe"; -const char* LLCalc::TWIST_BEGIN = "tb"; -const char* LLCalc::TWIST_END = "te"; -const char* LLCalc::X_SHEAR = "shx"; -const char* LLCalc::Y_SHEAR = "shy"; -const char* LLCalc::X_TAPER = "tpx"; -const char* LLCalc::Y_TAPER = "tpy"; -const char* LLCalc::RADIUS_OFFSET = "rof"; -const char* LLCalc::REVOLUTIONS = "rev"; -const char* LLCalc::SKEW = "skw"; -const char* LLCalc::X_HOLE = "hlx"; -const char* LLCalc::Y_HOLE = "hly"; -const char* LLCalc::TEX_U_SCALE = "tsu"; -const char* LLCalc::TEX_V_SCALE = "tsv"; -const char* LLCalc::TEX_U_OFFSET = "tou"; -const char* LLCalc::TEX_V_OFFSET = "tov"; -const char* LLCalc::TEX_ROTATION = "trot"; -const char* LLCalc::TEX_TRANSPARENCY = "trns"; -const char* LLCalc::TEX_GLOW = "glow"; +const char* LLCalc::X_POS = "PX"; +const char* LLCalc::Y_POS = "PY"; +const char* LLCalc::Z_POS = "PZ"; +const char* LLCalc::X_SCALE = "SX"; +const char* LLCalc::Y_SCALE = "SY"; +const char* LLCalc::Z_SCALE = "SZ"; +const char* LLCalc::X_ROT = "RX"; +const char* LLCalc::Y_ROT = "RY"; +const char* LLCalc::Z_ROT = "RZ"; +const char* LLCalc::HOLLOW = "HLW"; +const char* LLCalc::CUT_BEGIN = "CB"; +const char* LLCalc::CUT_END = "CE"; +const char* LLCalc::PATH_BEGIN = "PB"; +const char* LLCalc::PATH_END = "PE"; +const char* LLCalc::TWIST_BEGIN = "TB"; +const char* LLCalc::TWIST_END = "TE"; +const char* LLCalc::X_SHEAR = "SHX"; +const char* LLCalc::Y_SHEAR = "SHY"; +const char* LLCalc::X_TAPER = "TPX"; +const char* LLCalc::Y_TAPER = "TPY"; +const char* LLCalc::RADIUS_OFFSET = "ROF"; +const char* LLCalc::REVOLUTIONS = "REV"; +const char* LLCalc::SKEW = "SKW"; +const char* LLCalc::X_HOLE = "HLX"; +const char* LLCalc::Y_HOLE = "HLY"; +const char* LLCalc::TEX_U_SCALE = "TSU"; +const char* LLCalc::TEX_V_SCALE = "TSV"; +const char* LLCalc::TEX_U_OFFSET = "TOU"; +const char* LLCalc::TEX_V_OFFSET = "TOV"; +const char* LLCalc::TEX_ROTATION = "TROT"; +const char* LLCalc::TEX_TRANSPARENCY = "TRNS"; +const char* LLCalc::TEX_GLOW = "GLOW"; + LLCalc* LLCalc::sInstance = NULL; -//TODO: Make this a static global class LLCalc::LLCalc() : mLastErrorPos(0) { // Init table of constants - /*setVar("PI", F_PI); - setVar("TWO_PI", F_TWO_PI); - setVar("PI_BY_TWO", F_PI_BY_TWO); - setVar("SQRT_TWO_PI", F_SQRT_TWO_PI); - setVar("SQRT2", F_SQRT2); - setVar("SQRT3", F_SQRT3); - setVar("DEG_TO_RAD", DEG_TO_RAD); - setVar("RAD_TO_DEG", RAD_TO_DEG); - setVar("GRAVITY", GRAVITY);*/ + mConstants["PI"] = F_PI; + mConstants["TWO_PI"] = F_TWO_PI; + mConstants["PI_BY_TWO"] = F_PI_BY_TWO; + mConstants["SQRT_TWO_PI"] = F_SQRT_TWO_PI; + mConstants["SQRT2"] = F_SQRT2; + mConstants["SQRT3"] = F_SQRT3; + mConstants["DEG_TO_RAD"] = DEG_TO_RAD; + mConstants["RAD_TO_DEG"] = RAD_TO_DEG; + mConstants["GRAVITY"] = GRAVITY; } LLCalc::~LLCalc() @@ -99,7 +97,7 @@ void LLCalc::cleanUp() //static LLCalc* LLCalc::getInstance() { - if (!sInstance) sInstance = new LLCalc(); + if (!sInstance) sInstance = new LLCalc(); return sInstance; } @@ -118,35 +116,47 @@ void LLCalc::clearAllVariables() mVariables.clear(); } +/* +void LLCalc::updateVariables(LLSD& vars) +{ + LLSD::map_iterator cIt = vars.beginMap(); + for(; cIt != vars.endMap(); cIt++) + { + setVar(cIt->first, (F32)(LLSD::Real)cIt->second); + } +} +*/ + bool LLCalc::evalString(const std::string& expression, F32& result) { - mLastErrorPos = 0; - std::string::const_iterator itr = expression.begin(); - expression::grammar calc; - calc.constant.add - ("pi", F_PI) - ("two_pi", F_TWO_PI) - ("pi_by_two", F_PI_BY_TWO) - ("sqrt_two_pi", F_SQRT_TWO_PI) - ("sqrt2", F_SQRT2) - ("sqrt3", F_SQRT3) - ("deg_to_rad", DEG_TO_RAD) - ("rad_to_deg", RAD_TO_DEG) - ("gravity", GRAVITY) - ; - for(calc_map_t::const_iterator iter = mVariables.begin(); - iter != mVariables.end(); - ++iter) - { - calc.constant.add(iter->first, iter->second); - } + std::string expr_upper = expression; + LLStringUtil::toUpper(expr_upper); + + LLCalcParser calc(result, &mConstants, &mVariables); - if (!expression::parse(itr, expression.end(), calc, result) || itr != expression.end()) + mLastErrorPos = 0; + std::string::iterator start = expr_upper.begin(); + parse_info info; + + try { - mLastErrorPos = itr - expression.begin(); + info = parse(start, expr_upper.end(), calc, space_p); + LL_DEBUGS() << "Math expression: " << expression << " = " << result << LL_ENDL; + } + catch(parser_error &e) + { + mLastErrorPos = e.where - expr_upper.begin(); + + LL_INFOS() << "Calc parser exception: " << e.descriptor << " at " << mLastErrorPos << " in expression: " << expression << LL_ENDL; + return false; + } + + if (!info.full) + { + mLastErrorPos = info.stop - expr_upper.begin(); LL_INFOS() << "Unhandled syntax error at " << mLastErrorPos << " in expression: " << expression << LL_ENDL; return false; } - LL_DEBUGS() << "Math expression: " << expression << " = " << result << LL_ENDL; + return true; } diff --git a/indra/llmath/llcalc.h b/indra/llmath/llcalc.h index 8c71569f4..7f4c6e317 100644 --- a/indra/llmath/llcalc.h +++ b/indra/llmath/llcalc.h @@ -86,6 +86,7 @@ public: private: std::string::size_type mLastErrorPos; + calc_map_t mConstants; calc_map_t mVariables; // "There shall be only one" diff --git a/indra/llmath/llcalcparser.cpp b/indra/llmath/llcalcparser.cpp new file mode 100644 index 000000000..b4ca32065 --- /dev/null +++ b/indra/llmath/llcalcparser.cpp @@ -0,0 +1,63 @@ +/* + * LLCalcParser.cpp + * Copyright 2008 Aimee Walton. + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2008, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + * + */ + +#include "linden_common.h" + +#include "llcalcparser.h" +using namespace boost::spirit::classic; + +F32 LLCalcParser::lookup(const std::string::iterator& start, const std::string::iterator& end) const +{ + LLCalc::calc_map_t::iterator iter; + + std::string name(start, end); + + if (mConstants) + { + iter = mConstants->find(name); + if (iter != mConstants->end()) + { + return (*iter).second; + } + } + else + { + // This should never happen! + throw_(end, std::string("Missing constants table")); + } + + if (mVariables) + { + iter = mVariables->find(name); + if (iter != mVariables->end()) + { + return (*iter).second; + } + } + + throw_(end, std::string("Unknown symbol " + name)); + return 0.f; +} diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h index 8df507bc8..05e7491fc 100644 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -27,200 +27,162 @@ #ifndef LL_CALCPARSER_H #define LL_CALCPARSER_H -#include -#if !defined(SPIRIT_VERSION) || SPIRIT_VERSION < 0x2010 -#error "At least Spirit version 2.1 required" -#endif +#include +#include +#include +#include +#include +#include +using namespace boost::spirit::classic; -// Add this in if we want boost math constants. -//#include -#include -#include +#include "llcalc.h" +#include "llmath.h" -namespace expression { - - -//TODO: If we can find a better way to do this with boost::pheonix::bind lets do it -//namespace { // anonymous - -template -T min_glue(T a, T b) +struct LLCalcParser : grammar { - return std::min(a, b); -} - -template -T max_glue(T a, T b) -{ - return std::max(a, b); -} - -template -struct lazy_ufunc_ -{ - typedef RT result_type; - - template - struct result { typedef RT type; }; - - template - RT operator()(F f, A1 a1) const + LLCalcParser(F32& result, LLCalc::calc_map_t* constants, LLCalc::calc_map_t* vars) : + mResult(result), mConstants(constants), mVariables(vars) {}; + + struct value_closure : closure { - return f(a1); - } -}; - -template -struct lazy_bfunc_ -{ - typedef RT result_type; - - template - struct result { typedef RT type; }; - - template - RT operator()(F f, A1 a1, A2 a2) const + member1 value; + }; + + template + struct definition { - return f(a1, a2); - } -}; + // Rule declarations + rule statement, identifier; + rule expression, term, + power, + unary_expr, + factor, + unary_func, + binary_func, + group; -//} // end namespace anonymous - -template -struct grammar - : boost::spirit::qi::grammar< - Iterator, FPT(), boost::spirit::ascii::space_type - > -{ - - // symbol table for constants - // to be added by the actual calculator - struct constant_ - : boost::spirit::qi::symbols< - typename std::iterator_traits::value_type, - FPT - > - { - constant_() + // start() should return the starting symbol + rule const& start() const { return statement; } + + definition(LLCalcParser const& self) { - } - } constant; - - // symbol table for unary functions like "abs" - struct ufunc_ - : boost::spirit::qi::symbols< - typename std::iterator_traits::value_type, - FPT (*)(FPT) - > - { - ufunc_() - { - this->add - ("abs" , (FPT (*)(FPT)) std::abs ) - ("acos" , (FPT (*)(FPT)) std::acos ) - ("asin" , (FPT (*)(FPT)) std::asin ) - ("atan" , (FPT (*)(FPT)) std::atan ) - ("ceil" , (FPT (*)(FPT)) std::ceil ) - ("cos" , (FPT (*)(FPT)) std::cos ) - ("cosh" , (FPT (*)(FPT)) std::cosh ) - ("exp" , (FPT (*)(FPT)) std::exp ) - ("floor" , (FPT (*)(FPT)) std::floor) - ("log" , (FPT (*)(FPT)) std::log ) - ("log10" , (FPT (*)(FPT)) std::log10) - ("sin" , (FPT (*)(FPT)) std::sin ) - ("sinh" , (FPT (*)(FPT)) std::sinh ) - ("sqrt" , (FPT (*)(FPT)) std::sqrt ) - ("tan" , (FPT (*)(FPT)) std::tan ) - ("tanh" , (FPT (*)(FPT)) std::tanh ) + using namespace phoenix; + + assertion assert_domain("Domain error"); +// assertion assert_symbol("Unknown symbol"); + assertion assert_syntax("Syntax error"); + + identifier = + lexeme_d[(alpha_p | '_') >> *(alnum_p | '_')] ; - } - } ufunc; - - // symbol table for binary functions like "pow" - struct bfunc_ - : boost::spirit::qi::symbols< - typename std::iterator_traits::value_type, - FPT (*)(FPT, FPT) - > - { - bfunc_() - { - using boost::bind; - this->add - ("pow" , (FPT (*)(FPT, FPT)) std::pow ) - ("atan2", (FPT (*)(FPT, FPT)) std::atan2) - ("min" , (FPT (*)(FPT, FPT)) min_glue) - ("max" , (FPT (*)(FPT, FPT)) max_glue) + + group = + '(' >> expression[group.value = arg1] >> assert_syntax(ch_p(')')) ; - } - } bfunc; - - boost::spirit::qi::rule< - Iterator, FPT(), boost::spirit::ascii::space_type - > expression, term, factor, primary; - - grammar() : grammar::base_type(expression) - { - using boost::spirit::qi::real_parser; - using boost::spirit::qi::real_policies; - real_parser > real; - - using boost::spirit::qi::_1; - using boost::spirit::qi::_2; - using boost::spirit::qi::_3; - using boost::spirit::qi::no_case; - using boost::spirit::qi::_val; - - boost::phoenix::function< lazy_ufunc_ > lazy_ufunc; - boost::phoenix::function< lazy_bfunc_ > lazy_bfunc; - expression = - term [_val = _1] - >> *( ('+' >> term [_val += _1]) - | ('-' >> term [_val -= _1]) + unary_func = + ((str_p("SIN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_sin)(self,arg1)]) | + (str_p("COS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_cos)(self,arg1)]) | + (str_p("TAN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_tan)(self,arg1)]) | + (str_p("ASIN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_asin)(self,arg1)]) | + (str_p("ACOS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_acos)(self,arg1)]) | + (str_p("ATAN") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_atan)(self,arg1)]) | + (str_p("SQRT") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_sqrt)(self,arg1)]) | + (str_p("LOG") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_log)(self,arg1)]) | + (str_p("EXP") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_exp)(self,arg1)]) | + (str_p("ABS") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_fabs)(self,arg1)]) | + (str_p("FLR") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_floor)(self,arg1)]) | + (str_p("CEIL") >> '(' >> expression[unary_func.value = bind(&LLCalcParser::_ceil)(self,arg1)]) + ) >> assert_syntax(ch_p(')')) + ; + + binary_func = + ((str_p("ATAN2") >> '(' >> expression[binary_func.value = arg1] >> ',' >> + expression[binary_func.value = bind(&LLCalcParser::_atan2)(self, binary_func.value, arg1)]) | + (str_p("MIN") >> '(' >> expression[binary_func.value = arg1] >> ',' >> + expression[binary_func.value = bind(&LLCalcParser::_min)(self, binary_func.value, arg1)]) | + (str_p("MAX") >> '(' >> expression[binary_func.value = arg1] >> ',' >> + expression[binary_func.value = bind(&LLCalcParser::_max)(self, binary_func.value, arg1)]) + ) >> assert_syntax(ch_p(')')) + ; + + // *TODO: Localisation of the decimal point? + // Problem, LLLineEditor::postvalidateFloat accepts a comma when appropriate + // for the current locale. However to do that here could clash with using + // the comma as a separator when passing arguments to functions. + factor = + (ureal_p[factor.value = arg1] | + group[factor.value = arg1] | + unary_func[factor.value = arg1] | + binary_func[factor.value = arg1] | + // Lookup throws an Unknown Symbol error if it is unknown, while this works fine, + // would be "neater" to handle symbol lookup from here with an assertive parser. +// constants_p[factor.value = arg1]| + identifier[factor.value = bind(&LLCalcParser::lookup)(self, arg1, arg2)] + ) >> + // Detect and throw math errors. + assert_domain(eps_p(bind(&LLCalcParser::checkNaN)(self, factor.value))) + ; + + unary_expr = + !ch_p('+') >> factor[unary_expr.value = arg1] | + '-' >> factor[unary_expr.value = -arg1] + ; + + power = + unary_expr[power.value = arg1] >> + *('^' >> assert_syntax(unary_expr[power.value = bind(&powf)(power.value, arg1)])) + ; + + term = + power[term.value = arg1] >> + *(('*' >> assert_syntax(power[term.value *= arg1])) | + ('/' >> assert_syntax(power[term.value /= arg1])) | + ('%' >> assert_syntax(power[term.value = bind(&fmodf)(term.value, arg1)])) ) ; - - term = - factor [_val = _1] - >> *( ('*' >> factor [_val *= _1]) - | ('/' >> factor [_val /= _1]) + + expression = + assert_syntax(term[expression.value = arg1]) >> + *(('+' >> assert_syntax(term[expression.value += arg1])) | + ('-' >> assert_syntax(term[expression.value -= arg1])) ) ; - - factor = - primary [_val = _1] - >> *( ("**" >> factor [_val = boost::phoenix::bind(static_cast(&std::pow),_val,_1)]) - ) + + statement = + !ch_p('=') >> ( expression )[var(self.mResult) = arg1] >> (end_p) ; - - primary = - real [_val = _1] - | '(' >> expression [_val = _1] >> ')' - | ('-' >> primary [_val = -_1]) - | ('+' >> primary [_val = _1]) - | (no_case[ufunc] >> '(' >> expression >> ')') - [_val = lazy_ufunc(_1, _2)] - | (no_case[bfunc] >> '(' >> expression >> ',' - >> expression >> ')') - [_val = lazy_bfunc(_1, _2, _3)] - | no_case[constant] [_val = _1] - ; - - } + } + }; + +private: + // Member functions for semantic actions + F32 lookup(const std::string::iterator&, const std::string::iterator&) const; + F32 _min(const F32& a, const F32& b) const { return llmin(a, b); } + F32 _max(const F32& a, const F32& b) const { return llmax(a, b); } + + bool checkNaN(const F32& a) const { return !std::isnan(a); } + + //FIX* non ambiguous function fix making SIN() work for calc -Cryogenic Blitz + F32 _sin(const F32& a) const { return sin(DEG_TO_RAD * a); } + F32 _cos(const F32& a) const { return cos(DEG_TO_RAD * a); } + F32 _tan(const F32& a) const { return tan(DEG_TO_RAD * a); } + F32 _asin(const F32& a) const { return asin(a * RAD_TO_DEG); } + F32 _acos(const F32& a) const { return acos(a * RAD_TO_DEG); } + F32 _atan(const F32& a) const { return atan(a * RAD_TO_DEG); } + F32 _sqrt(const F32& a) const { return sqrt(a); } + F32 _log(const F32& a) const { return log(a); } + F32 _exp(const F32& a) const { return exp(a); } + F32 _fabs(const F32& a) const { return fabs(a); } + F32 _floor(const F32& a) const { return (F32)llfloor(a); } + F32 _ceil(const F32& a) const { return llceil(a); } + F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } + + LLCalc::calc_map_t* mConstants; + LLCalc::calc_map_t* mVariables; +// LLCalc::calc_map_t* mUserVariables; + + F32& mResult; }; - -template -bool parse(Iterator &iter, - Iterator end, - const grammar &g, - FPT &result) -{ - return boost::spirit::qi::phrase_parse( - iter, end, g, boost::spirit::ascii::space, result); -} - -} // end namespace expression #endif // LL_CALCPARSER_H diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 7b3586cf3..c829e1f8d 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -41,23 +41,6 @@ // llcommon depend on llmath. #include "is_approx_equal_fraction.h" - -// work around for Windows & older gcc non-standard function names. -#if LL_WINDOWS -#include -#define llisnan(val) _isnan(val) -#define llfinite(val) _finite(val) -#elif (LL_LINUX && __GNUC__ <= 2) -#define llisnan(val) isnan(val) -#define llfinite(val) isfinite(val) -#elif LL_SOLARIS -#define llisnan(val) isnan(val) -#define llfinite(val) (val <= std::numeric_limits::max()) -#else -#define llisnan(val) std::isnan(val) -#define llfinite(val) std::isfinite(val) -#endif - // Single Precision Floating Point Routines // (There used to be more defined here, but they appeared to be redundant and // were breaking some other includes. Removed by Falcon, reviewed by Andrew, 11/25/09) @@ -65,34 +48,34 @@ #define tanf(x) ((F32)tan((F64)(x))) #endif*/ -const F32 GRAVITY = -9.8f; +constexpr F32 GRAVITY = -9.8f; // mathematical constants -const F32 F_PI = 3.1415926535897932384626433832795f; -const F32 F_TWO_PI = 6.283185307179586476925286766559f; -const F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f; -const F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f; -const F32 F_E = 2.71828182845904523536f; -const F32 F_SQRT2 = 1.4142135623730950488016887242097f; -const F32 F_SQRT3 = 1.73205080756888288657986402541f; -const F32 OO_SQRT2 = 0.7071067811865475244008443621049f; -const F32 OO_SQRT3 = 0.577350269189625764509f; -const F32 DEG_TO_RAD = 0.017453292519943295769236907684886f; -const F32 RAD_TO_DEG = 57.295779513082320876798154814105f; -const F32 F_APPROXIMATELY_ZERO = 0.00001f; -const F32 F_LN10 = 2.3025850929940456840179914546844f; -const F32 OO_LN10 = 0.43429448190325182765112891891661f; -const F32 F_LN2 = 0.69314718056f; -const F32 OO_LN2 = 1.4426950408889634073599246810019f; +constexpr F32 F_PI = 3.1415926535897932384626433832795f; +constexpr F32 F_TWO_PI = 6.283185307179586476925286766559f; +constexpr F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f; +constexpr F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f; +constexpr F32 F_E = 2.71828182845904523536f; +constexpr F32 F_SQRT2 = 1.4142135623730950488016887242097f; +constexpr F32 F_SQRT3 = 1.73205080756888288657986402541f; +constexpr F32 OO_SQRT2 = 0.7071067811865475244008443621049f; +constexpr F32 OO_SQRT3 = 0.577350269189625764509f; +constexpr F32 DEG_TO_RAD = 0.017453292519943295769236907684886f; +constexpr F32 RAD_TO_DEG = 57.295779513082320876798154814105f; +constexpr F32 F_APPROXIMATELY_ZERO = 0.00001f; +constexpr F32 F_LN10 = 2.3025850929940456840179914546844f; +constexpr F32 OO_LN10 = 0.43429448190325182765112891891661f; +constexpr F32 F_LN2 = 0.69314718056f; +constexpr F32 OO_LN2 = 1.4426950408889634073599246810019f; -const F32 F_ALMOST_ZERO = 0.0001f; -const F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO; +constexpr F32 F_ALMOST_ZERO = 0.0001f; +constexpr F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO; -const F32 GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees +constexpr F32 GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees // formula: GIMBAL_THRESHOLD = sin(DEG_TO_RAD * gimbal_threshold_angle); // BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above? -const F32 FP_MAG_THRESHOLD = 0.0000001f; +constexpr F32 FP_MAG_THRESHOLD = 0.0000001f; // TODO: Replace with logic like is_approx_equal inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); } @@ -129,13 +112,13 @@ inline bool is_zero(F32 x) inline bool is_approx_equal(F32 x, F32 y) { - const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; + constexpr S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; return (std::abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } inline bool is_approx_equal(F64 x, F64 y) { - const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; + constexpr S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } @@ -156,36 +139,12 @@ inline F64 llabs(const F64 a) inline S32 lltrunc( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined(_WIN64) && !(_MSC_VER >= 1800) - // Avoids changing the floating point control word. - // Add or subtract 0.5 - epsilon and then round - const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF }; - S32 result; - __asm { - fld f - mov eax, f - shr eax, 29 - and eax, 4 - fadd dword ptr [zpfp + eax] - fistp result - } - return result; -#else -#ifdef LL_CPP11 - return (S32)trunc(f); -#else - return (S32)f; -#endif -#endif + return (S32)trunc(f); } inline S32 lltrunc( F64 f ) { -#ifdef LL_CPP11 return (S32)trunc(f); -#else - return (S32)f; -#endif } inline S32 llfloor( F32 f ) @@ -217,29 +176,17 @@ inline S32 llceil( F32 f ) // Use this round. Does an arithmetic round (0.5 always rounds up) inline S32 ll_round(const F32 val) { -#ifdef LL_CPP11 return (S32)round(val); -#else - return llfloor(val + 0.5f); -#endif } inline F32 ll_round(F32 val, F32 nearest) { -#ifdef LL_CPP11 return F32(round(val * (1.0f / nearest))) * nearest; -#else - return F32(floor(val * (1.0f / nearest) + 0.5f)) * nearest; -#endif } inline F64 ll_round(F64 val, F64 nearest) { -#ifdef LL_CPP11 return F64(round(val * (1.0 / nearest))) * nearest; -#else - return F64(floor(val * (1.0 / nearest) + 0.5)) * nearest; -#endif } // these provide minimum peak error @@ -248,8 +195,8 @@ inline F64 ll_round(F64 val, F64 nearest) // peak error = -31.4 dB // RMS error = -28.1 dB -const F32 FAST_MAG_ALPHA = 0.960433870103f; -const F32 FAST_MAG_BETA = 0.397824734759f; +constexpr F32 FAST_MAG_ALPHA = 0.960433870103f; +constexpr F32 FAST_MAG_BETA = 0.397824734759f; // these provide minimum RMS error // @@ -257,8 +204,8 @@ const F32 FAST_MAG_BETA = 0.397824734759f; // peak error = -32.6 dB // RMS error = -25.7 dB // -//const F32 FAST_MAG_ALPHA = 0.948059448969f; -//const F32 FAST_MAG_BETA = 0.392699081699f; +//constexpr F32 FAST_MAG_ALPHA = 0.948059448969f; +//constexpr F32 FAST_MAG_BETA = 0.392699081699f; inline F32 fastMagnitude(F32 a, F32 b) { @@ -275,8 +222,8 @@ inline F32 fastMagnitude(F32 a, F32 b) // // Culled from www.stereopsis.com/FPU.html -const F64 LL_DOUBLE_TO_FIX_MAGIC = 68719476736.0*1.5; //2^36 * 1.5, (52-_shiftamt=36) uses limited precisicion to floor -const S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point representation, +constexpr F64 LL_DOUBLE_TO_FIX_MAGIC = 68719476736.0*1.5; //2^36 * 1.5, (52-_shiftamt=36) uses limited precisicion to floor +constexpr S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point representation, // Endian dependent code #ifdef LL_LITTLE_ENDIAN diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 3d6310310..de831a4e6 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -696,7 +696,7 @@ public: (mData.size() > gOctreeReserveCapacity && mData.capacity() > gOctreeReserveCapacity + mData.size() - 1 - (mData.size() - gOctreeReserveCapacity - 1) % 4)) { //Shrink to lowest possible (reserve)+4*i size.. Say reserve is 5, here are [size,capacity] pairs. [10,13],[9,9],[8,9],[7,9],[6,9],[5,5],[4,5],[3,5],[2,5],[1,5],[0,5] - vector_shrink_to_fit(mData); + mData.shrink_to_fit(); } #ifdef LL_OCTREE_STATS if(old_cap != mData.capacity()) diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index 349af0552..236ce442b 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -166,7 +166,7 @@ public: // checker inline BOOL LLQuaternion::isFinite() const { - return (llfinite(mQ[VX]) && llfinite(mQ[VY]) && llfinite(mQ[VZ]) && llfinite(mQ[VS])); + return (std::isfinite(mQ[VX]) && std::isfinite(mQ[VY]) && std::isfinite(mQ[VZ]) && std::isfinite(mQ[VS])); } inline BOOL LLQuaternion::isIdentity() const diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index c38075610..3de6dab3c 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -167,8 +167,8 @@ void calc_tangent_from_triangle( float r = ((rd*rd) > FLT_EPSILON) ? (1.0f / rd) : ((rd > 0.0f) ? 1024.f : -1024.f); //some made up large ratio for division by zero - llassert(llfinite(r)); - llassert(!llisnan(r)); + llassert(std::isfinite(r)); + llassert(!std::isnan(r)); LLVector4a sdir( (t2 * x1 - t1 * x2) * r, @@ -5989,13 +5989,13 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) normal.set(0,0,1); } - llassert(llfinite(normal.getF32ptr()[0])); - llassert(llfinite(normal.getF32ptr()[1])); - llassert(llfinite(normal.getF32ptr()[2])); + llassert(std::isfinite(normal.getF32ptr()[0])); + llassert(std::isfinite(normal.getF32ptr()[1])); + llassert(std::isfinite(normal.getF32ptr()[2])); - llassert(!llisnan(normal.getF32ptr()[0])); - llassert(!llisnan(normal.getF32ptr()[1])); - llassert(!llisnan(normal.getF32ptr()[2])); + llassert(!std::isnan(normal.getF32ptr()[0])); + llassert(!std::isnan(normal.getF32ptr()[1])); + llassert(!std::isnan(normal.getF32ptr()[2])); for (S32 i = 0; i < num_vertices; i++) { @@ -6810,8 +6810,8 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe float r = ((rd*rd) > FLT_EPSILON) ? (1.0f / rd) : ((rd > 0.0f) ? 1024.f : -1024.f); //some made up large ratio for division by zero - llassert(llfinite(r)); - llassert(!llisnan(r)); + llassert(std::isfinite(r)); + llassert(!std::isnan(r)); LLVector4a sdir((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r); diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index 194bcfcfb..c1ec3f516 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -250,7 +250,7 @@ inline F32 LLVector2::normalize(void) // checker inline bool LLVector2::isFinite() const { - return (llfinite(mV[VX]) && llfinite(mV[VY])); + return (std::isfinite(mV[VX]) && std::isfinite(mV[VY])); } // deprecated diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index f92c3984e..dae0b3077 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -191,7 +191,7 @@ inline LLVector3d::LLVector3d(const LLVector3d ©) // checker inline BOOL LLVector3d::isFinite() const { - return (llfinite(mdV[VX]) && llfinite(mdV[VY]) && llfinite(mdV[VZ])); + return (std::isfinite(mdV[VX]) && std::isfinite(mdV[VY]) && std::isfinite(mdV[VZ])); } diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp index 898296707..43c94a5e5 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -76,7 +76,7 @@ BOOL LLVector3::clampLength( F32 length_limit ) BOOL changed = FALSE; F32 len = length(); - if (llfinite(len)) + if (std::isfinite(len)) { if ( len > length_limit) { @@ -97,7 +97,7 @@ BOOL LLVector3::clampLength( F32 length_limit ) for (S32 i = 0; i < 3; ++i) { F32 abs_component = fabs(mV[i]); - if (llfinite(abs_component)) + if (std::isfinite(abs_component)) { if (abs_component > max_abs_component) { diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 193533678..9403135a5 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -199,7 +199,7 @@ inline LLVector3::LLVector3(const LLVector3 ©) // checker inline BOOL LLVector3::isFinite() const { - return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ])); + return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]) && std::isfinite(mV[VZ])); } diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index 4288916e4..b4a59f01c 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -194,7 +194,7 @@ inline LLVector4::LLVector4(const LLVector3 &vec, F32 w) inline BOOL LLVector4::isFinite() const { - return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]) && llfinite(mV[VW])); + return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]) && std::isfinite(mV[VZ]) && std::isfinite(mV[VW])); } // Clear and Assignment Functions diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index 06c408fa5..b07988e1b 100644 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -200,7 +200,7 @@ void LLXform::setPosition(const LLVector3& pos) void LLXform::setPosition(const F32 x, const F32 y, const F32 z) { setChanged(TRANSLATED); - if (llfinite(x) && llfinite(y) && llfinite(z)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z)) mPosition.setVec(x,y,z); else { @@ -212,7 +212,7 @@ void LLXform::setPosition(const F32 x, const F32 y, const F32 z) void LLXform::setPositionX(const F32 x) { setChanged(TRANSLATED); - if (llfinite(x)) + if (std::isfinite(x)) mPosition.mV[VX] = x; else { @@ -224,7 +224,7 @@ void LLXform::setPositionX(const F32 x) void LLXform::setPositionY(const F32 y) { setChanged(TRANSLATED); - if (llfinite(y)) + if (std::isfinite(y)) mPosition.mV[VY] = y; else { @@ -236,7 +236,7 @@ void LLXform::setPositionY(const F32 y) void LLXform::setPositionZ(const F32 z) { setChanged(TRANSLATED); - if (llfinite(z)) + if (std::isfinite(z)) mPosition.mV[VZ] = z; else { @@ -268,7 +268,7 @@ void LLXform::setScale(const LLVector3& scale) void LLXform::setScale(const F32 x, const F32 y, const F32 z) { setChanged(SCALED); - if (llfinite(x) && llfinite(y) && llfinite(z)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z)) mScale.setVec(x,y,z); else { @@ -290,7 +290,7 @@ void LLXform::setRotation(const LLQuaternion& rot) void LLXform::setRotation(const F32 x, const F32 y, const F32 z) { setChanged(ROTATED); - if (llfinite(x) && llfinite(y) && llfinite(z)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z)) { mRotation.setQuat(x,y,z); } @@ -303,7 +303,7 @@ void LLXform::setRotation(const F32 x, const F32 y, const F32 z) void LLXform::setRotation(const F32 x, const F32 y, const F32 z, const F32 s) { setChanged(ROTATED); - if (llfinite(x) && llfinite(y) && llfinite(z) && llfinite(s)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z) && std::isfinite(s)) { mRotation.mQ[VX] = x; mRotation.mQ[VY] = y; mRotation.mQ[VZ] = z; mRotation.mQ[VS] = s; } diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index 6523a2c9a..5ce76470b 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -220,7 +220,7 @@ set_source_files_properties(${llmessage_HEADER_FILES} list(APPEND llmessage_SOURCE_FILES ${llmessage_HEADER_FILES}) add_library (llmessage ${llmessage_SOURCE_FILES}) -add_dependencies(llmessage prepare) + target_link_libraries( llmessage ${CURL_LIBRARIES} diff --git a/indra/llmessage/aicurl.cpp b/indra/llmessage/aicurl.cpp index 843b06a28..70bd956c8 100644 --- a/indra/llmessage/aicurl.cpp +++ b/indra/llmessage/aicurl.cpp @@ -195,10 +195,10 @@ ssl_dyn_create_function_type old_ssl_dyn_create_function; ssl_dyn_destroy_function_type old_ssl_dyn_destroy_function; ssl_dyn_lock_function_type old_ssl_dyn_lock_function; -#if LL_WINDOWS +#if LL_WINDOWS && !HAVE_CRYPTO_THREADID static unsigned long __cdecl apr_os_thread_current_wrapper() { - return (unsigned long)apr_os_thread_current(); + return (unsigned long)(HANDLE)apr_os_thread_current(); } #endif diff --git a/indra/llmessage/aicurlthread.h b/indra/llmessage/aicurlthread.h index 908456b13..7046af12b 100644 --- a/indra/llmessage/aicurlthread.h +++ b/indra/llmessage/aicurlthread.h @@ -45,7 +45,7 @@ class PollSet; // For ordering a std::set with AICurlEasyRequest objects. struct AICurlEasyRequestCompare { - bool operator()(AICurlEasyRequest const& h1, AICurlEasyRequest const& h2) { return h1.get() < h2.get(); } + bool operator()(AICurlEasyRequest const& h1, AICurlEasyRequest const& h2) const { return h1.get() < h2.get(); } }; //----------------------------------------------------------------------------- diff --git a/indra/llmessage/aihttptimeoutpolicy.cpp b/indra/llmessage/aihttptimeoutpolicy.cpp index 9c63a5046..ba8de6bad 100644 --- a/indra/llmessage/aihttptimeoutpolicy.cpp +++ b/indra/llmessage/aihttptimeoutpolicy.cpp @@ -30,7 +30,6 @@ #include "sys.h" #include "aihttptimeoutpolicy.h" -#define NOMINMAX #include "llerror.h" #include "lldefs.h" #include "v3math.h" @@ -943,8 +942,6 @@ P2(meshHeaderResponder, connect_30s); P2(meshLODResponder, connect_30s); P2(meshPhysicsShapeResponder, connect_30s); P2(meshSkinInfoResponder, connect_30s); -P(mimeDiscoveryResponder); -P(moderationResponder); P(objectCostResponder); P(physicsFlagsResponder); P(productInfoRequestResponder); @@ -960,8 +957,6 @@ P(translationReceiver); P(uploadModelPremissionsResponder); P(verifiedDestinationResponder); P(viewerChatterBoxInvitationAcceptResponder); -P(viewerMediaOpenIDResponder); -P(viewerMediaWebProfileResponder); P(viewerStatsResponder); P(voiceCallCapResponder); P(webProfileResponders); diff --git a/indra/llmessage/llbufferstream.cpp b/indra/llmessage/llbufferstream.cpp index ff1c9993c..15e90872a 100644 --- a/indra/llmessage/llbufferstream.cpp +++ b/indra/llmessage/llbufferstream.cpp @@ -233,17 +233,10 @@ int LLBufferStreamBuf::sync() } // virtual -#if( LL_WINDOWS || __GNUC__ > 2) LLBufferStreamBuf::pos_type LLBufferStreamBuf::seekoff( LLBufferStreamBuf::off_type off, std::ios::seekdir way, std::ios::openmode which) -#else -streampos LLBufferStreamBuf::seekoff( - streamoff off, - std::ios::seekdir way, - std::ios::openmode which) -#endif { if(!mBuffer || ((way == std::ios::beg) && (off < 0)) @@ -318,12 +311,8 @@ streampos LLBufferStreamBuf::seekoff( } } -#if( LL_WINDOWS || __GNUC__ > 2 ) S32 rv = (S32)(intptr_t)address; return (pos_type)rv; -#else - return (streampos)address; -#endif } diff --git a/indra/llmessage/llbufferstream.h b/indra/llmessage/llbufferstream.h index 723269307..33ce6a68d 100644 --- a/indra/llmessage/llbufferstream.h +++ b/indra/llmessage/llbufferstream.h @@ -48,10 +48,8 @@ public: virtual ~LLBufferStreamBuf(); protected: -#if( LL_WINDOWS || __GNUC__ > 2 ) typedef std::streambuf::pos_type pos_type; typedef std::streambuf::off_type off_type; -#endif /* @name streambuf vrtual implementations */ @@ -87,17 +85,10 @@ protected: * or both masked together. * @return Returns the new position or an invalid position on failure. */ -#if( LL_WINDOWS || __GNUC__ > 2) virtual pos_type seekoff( off_type off, std::ios::seekdir way, std::ios::openmode which); -#else - virtual streampos seekoff( - streamoff off, - std::ios::seekdir way, - std::ios::openmode which); -#endif /* * @brief Get s sequence of characters from the input diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index c51883ee3..8eb844fb7 100644 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -168,7 +168,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con } // finite checks - if (!llfinite(t1) || !llfinite(t2) || !llfinite(t3)) + if (!std::isfinite(t1) || !std::isfinite(t2) || !std::isfinite(t3)) { t1 = 0.f; t2 = 0.f; diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index 448b6606b..a18c40d57 100644 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -115,9 +115,9 @@ S32 LLProxy::proxyHandshake(LLHost proxy) U32 request_size = socks_username.size() + socks_password.size() + 3; char * password_auth = new char[request_size]; password_auth[0] = 0x01; - password_auth[1] = socks_username.size(); + password_auth[1] = (char)socks_username.size(); memcpy(&password_auth[2], socks_username.c_str(), socks_username.size()); - password_auth[socks_username.size() + 2] = socks_password.size(); + password_auth[socks_username.size() + 2] = (char)socks_password.size(); memcpy(&password_auth[socks_username.size() + 3], socks_password.c_str(), socks_password.size()); authmethod_password_reply_t password_reply; diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 6f728ff35..b0044de0b 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -326,7 +326,7 @@ void LLTemplateMessageReader::getF32(const char *block, const char *var, { getData(block, var, &d, sizeof(F32), blocknum); - if( !llfinite( d ) ) + if( !std::isfinite( d ) ) { LL_WARNS() << "non-finite in getF32Fast " << block << " " << var << LL_ENDL; @@ -339,7 +339,7 @@ void LLTemplateMessageReader::getF64(const char *block, const char *var, { getData(block, var, &d, sizeof(F64), blocknum); - if( !llfinite( d ) ) + if( !std::isfinite( d ) ) { LL_WARNS() << "non-finite in getF64Fast " << block << " " << var << LL_ENDL; diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt index 5aa33696e..3c76f7a50 100644 --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -13,7 +13,6 @@ include_directories( ${LLMATH_INCLUDE_DIRS} ${LLMESSAGE_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS} - ${LLQTWEBKIT_INCLUDE_DIR} ) set(llplugin_SOURCE_FILES @@ -62,8 +61,6 @@ if(LINUX AND STANDALONE) target_link_libraries (llplugin rt dl) endif(LINUX AND STANDALONE) -add_dependencies(llplugin prepare) - add_subdirectory(slplugin) # # Add tests diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index c5ff97ef7..75de5393f 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llpluginclassmedia.cpp * @brief LLPluginClassMedia handles a plugin which knows about the "media" message class. * @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2008&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ * @endcond @@ -41,7 +41,7 @@ static int nextPowerOf2( int value ) { next_power_of_2 <<= 1; } - + return next_power_of_2; } @@ -104,7 +104,7 @@ void LLPluginClassMedia::reset_impl(void) mMediaName.clear(); mMediaDescription.clear(); mBackgroundColor = LLColor4(1.0f, 1.0f, 1.0f, 1.0f); - + // media_browser class mNavigateURI.clear(); mNavigateResultCode = -1; @@ -112,13 +112,13 @@ void LLPluginClassMedia::reset_impl(void) mHistoryBackAvailable = false; mHistoryForwardAvailable = false; mStatusText.clear(); - mProgressPercent = 0; + mProgressPercent = 0; mClickURL.clear(); mClickNavType.clear(); mClickTarget.clear(); mClickUUID.clear(); mStatusCode = 0; - + // media_time class mCurrentTime = 0.0f; mDuration = 0.0f; @@ -144,7 +144,7 @@ void LLPluginClassMedia::idle_impl(void) else { mRequestedTextureWidth = mRequestedMediaWidth; - + if(mPadding > 1) { // Pad up to a multiple of the specified number of bytes per row @@ -154,7 +154,7 @@ void LLPluginClassMedia::idle_impl(void) { rowbytes += mPadding - pad; } - + if(rowbytes % mRequestedTextureDepth == 0) { mRequestedTextureWidth = rowbytes / mRequestedTextureDepth; @@ -166,7 +166,7 @@ void LLPluginClassMedia::idle_impl(void) } } - + // Size change has been requested but not initiated yet. size_t newsize = mRequestedTextureWidth * mRequestedTextureHeight * mRequestedTextureDepth; @@ -181,22 +181,22 @@ void LLPluginClassMedia::idle_impl(void) mPlugin->removeSharedMemory(mTextureSharedMemoryName); mTextureSharedMemoryName.clear(); } - + mTextureSharedMemorySize = newsize; mTextureSharedMemoryName = mPlugin->addSharedMemory(mTextureSharedMemorySize); if(!mTextureSharedMemoryName.empty()) { void *addr = mPlugin->getSharedMemoryAddress(mTextureSharedMemoryName); - + // clear texture memory to avoid random screen visual fuzz from uninitialized texture data memset( addr, 0x00, newsize ); - + // We could do this to force an update, but textureValid() will still be returning false until the first roundtrip to the plugin, // so it may not be worthwhile. // mDirtyRect.setOriginAndSize(0, 0, mRequestedMediaWidth, mRequestedMediaHeight); } } - + // This is our local indicator that a change is in progress. mTextureWidth = -1; mTextureHeight = -1; @@ -205,7 +205,7 @@ void LLPluginClassMedia::idle_impl(void) // This invalidates any existing dirty rect. resetDirty(); - + // Send a size change message to the plugin { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change"); @@ -219,7 +219,7 @@ void LLPluginClassMedia::idle_impl(void) message.setValueReal("background_b", mBackgroundColor.mV[VZ]); message.setValueReal("background_a", mBackgroundColor.mV[VW]); mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue. - + LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL; } } @@ -278,11 +278,11 @@ void LLPluginClassMedia::setSizeInternal(void) mRequestedMediaWidth = mDefaultMediaWidth; mRequestedMediaHeight = mDefaultMediaHeight; } - + // Save these for size/interest calculations mFullMediaWidth = mRequestedMediaWidth; mFullMediaHeight = mRequestedMediaHeight; - + if(mAllowDownsample) { switch(mPriority) @@ -296,19 +296,19 @@ void LLPluginClassMedia::setSizeInternal(void) mRequestedMediaHeight /= 2; } break; - + default: // Don't adjust texture size break; } } - + if(mAutoScaleMedia) { mRequestedMediaWidth = nextPowerOf2(mRequestedMediaWidth); mRequestedMediaHeight = nextPowerOf2(mRequestedMediaHeight); } - + if(mRequestedMediaWidth > 2048) mRequestedMediaWidth = 2048; @@ -336,9 +336,9 @@ bool LLPluginClassMedia::textureValid(void) mRequestedMediaWidth != mMediaWidth || mRequestedMediaHeight != mMediaHeight || getBitsData() == NULL - ) + ) return false; - + return true; } @@ -362,8 +362,8 @@ void LLPluginClassMedia::resetDirty(void) std::string LLPluginClassMedia::translateModifiers(MASK modifiers) { std::string result; - - + + if(modifiers & MASK_CONTROL) { result += "control|"; @@ -386,7 +386,7 @@ std::string LLPluginClassMedia::translateModifiers(MASK modifiers) { result += "meta|"; } -*/ +*/ return result; } @@ -494,11 +494,11 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int // Don't spam unnecessary mouse move events. return; } - + mLastMouseX = x; mLastMouseY = y; } - + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "mouse_event"); std::string temp; switch(type) @@ -513,7 +513,7 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int message.setValueS32("button", button); message.setValueS32("x", x); - + // Incoming coordinates are OpenGL-style ((0,0) = lower left), so flip them here if the plugin has requested it. if(!mRequestedTextureCoordsOpenGL) { @@ -523,42 +523,42 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int message.setValueS32("y", y); message.setValue("modifiers", translateModifiers(modifiers)); - + sendMessage(message); } bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifiers, LLSD native_key_data) { bool result = true; - + // FIXME: // HACK: we don't have an easy way to tell if the plugin is going to handle a particular keycode. // For now, return false for the ones the webkit plugin won't handle properly. - + switch(key_code) { - case KEY_BACKSPACE: - case KEY_TAB: - case KEY_RETURN: - case KEY_PAD_RETURN: - case KEY_SHIFT: - case KEY_CONTROL: - case KEY_ALT: - case KEY_CAPSLOCK: - case KEY_ESCAPE: - case KEY_PAGE_UP: - case KEY_PAGE_DOWN: - case KEY_END: - case KEY_HOME: - case KEY_LEFT: - case KEY_UP: - case KEY_RIGHT: - case KEY_DOWN: - case KEY_INSERT: + case KEY_BACKSPACE: + case KEY_TAB: + case KEY_RETURN: + case KEY_PAD_RETURN: + case KEY_SHIFT: + case KEY_CONTROL: + case KEY_ALT: + case KEY_CAPSLOCK: + case KEY_ESCAPE: + case KEY_PAGE_UP: + case KEY_PAGE_DOWN: + case KEY_END: + case KEY_HOME: + case KEY_LEFT: + case KEY_UP: + case KEY_RIGHT: + case KEY_DOWN: + case KEY_INSERT: case KEY_DELETE: - // These will be handled + // These will be handled break; - + default: // regular ASCII characters will also be handled if(key_code >= KEY_SPECIAL) @@ -569,7 +569,7 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie break; } -#if LL_DARWIN +#if LL_DARWIN if(modifiers & MASK_ALT) { // Option-key modified characters should be handled by the unicode input path instead of this one. @@ -588,15 +588,15 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie case KEY_EVENT_REPEAT: temp = "repeat"; break; } message.setValue("event", temp); - + message.setValueS32("key", key_code); message.setValue("modifiers", translateModifiers(modifiers)); message.setValueLLSD("native_key_data", native_key_data); - + sendMessage(message); } - + return result; } @@ -607,10 +607,10 @@ void LLPluginClassMedia::scrollEvent(int x, int y, MASK modifiers) message.setValueS32("x", x); message.setValueS32("y", y); message.setValue("modifiers", translateModifiers(modifiers)); - + sendMessage(message); } - + bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD native_key_data) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "text_event"); @@ -618,18 +618,33 @@ bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD message.setValue("text", text); message.setValue("modifiers", translateModifiers(modifiers)); message.setValueLLSD("native_key_data", native_key_data); - + sendMessage(message); - + return true; } +void LLPluginClassMedia::setCookie(std::string uri, std::string name, std::string value, std::string domain, std::string path, bool httponly, bool secure) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_cookie"); + + message.setValue("uri", uri); + message.setValue("name", name); + message.setValue("value", value); + message.setValue("domain", domain); + message.setValue("path", path); + message.setValueBoolean("httponly", httponly); + message.setValueBoolean("secure", secure); + + sendMessage(message); +} + void LLPluginClassMedia::loadURI(const std::string &uri) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "load_uri"); message.setValue("uri", uri); - + sendMessage(message); } @@ -645,6 +660,7 @@ void LLPluginClassMedia::setLowPrioritySizeLimit(int size) if(mLowPrioritySizeLimit != power) { mLowPrioritySizeLimit = power; + // This may affect the calculated size, so recalculate it here. setSizeInternal(); } @@ -653,12 +669,12 @@ void LLPluginClassMedia::setLowPrioritySizeLimit(int size) F64 LLPluginClassMedia::getCPUUsage() { F64 result = 0.0f; - + if(mPlugin) { result = mPlugin->getCPUUsage(); } - + return result; } @@ -706,10 +722,12 @@ void LLPluginClassMedia::paste() sendMessage(message); } -void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path) +void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path_cache, const std::string &user_data_path_cookies, const std::string &user_data_path_logs) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_user_data_path"); - message.setValue("path", user_data_path); + message.setValue("cache_path", user_data_path_cache); + message.setValue("cookies_path", user_data_path_cookies); + message.setValue("logs_path", user_data_path_logs); sendMessage(message); } @@ -722,14 +740,14 @@ void LLPluginClassMedia::setLanguageCode(const std::string &language_code) void LLPluginClassMedia::setPluginsEnabled(const bool enabled) { - LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "plugins_enabled"); + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "plugins_enabled"); message.setValueBoolean("enable", enabled); sendMessage(message); } void LLPluginClassMedia::setJavascriptEnabled(const bool enabled) { - LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "javascript_enabled"); + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "javascript_enabled"); message.setValueBoolean("enable", enabled); sendMessage(message); } @@ -746,7 +764,8 @@ void LLPluginClassMedia::setTarget(const std::string &target) { mTarget = target; } -/* virtual */ + +/* virtual */ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) { std::string message_class = message.getClass(); @@ -765,21 +784,21 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mRequestedTextureFormat = message.getValueU32("format"); mRequestedTextureType = message.getValueU32("type"); mRequestedTextureSwapBytes = message.getValueBoolean("swap_bytes"); - mRequestedTextureCoordsOpenGL = message.getValueBoolean("coords_opengl"); - + mRequestedTextureCoordsOpenGL = message.getValueBoolean("coords_opengl"); + // These two are optional, and will default to 0 if they're not specified. mDefaultMediaWidth = message.getValueS32("default_width"); mDefaultMediaHeight = message.getValueS32("default_height"); - + mAllowDownsample = message.getValueBoolean("allow_downsample"); mPadding = message.getValueS32("padding"); setSizeInternal(); - + mTextureParamsReceived = true; } else if(message_name == "updated") - { + { if(message.hasValue("left")) { LLRect newDirtyRect; @@ -787,7 +806,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) newDirtyRect.mTop = message.getValueS32("top"); newDirtyRect.mRight = message.getValueS32("right"); newDirtyRect.mBottom = message.getValueS32("bottom"); - + // The plugin is likely to have top and bottom switched, due to vertical flip and OpenGL coordinate confusion. // If they're backwards, swap them. if(newDirtyRect.mTop < newDirtyRect.mBottom) @@ -796,7 +815,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) newDirtyRect.mTop = newDirtyRect.mBottom; newDirtyRect.mBottom = temp; } - + if(mDirtyRect.isEmpty()) { mDirtyRect = newDirtyRect; @@ -816,10 +835,10 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) << mDirtyRect.mRight << ", " << mDirtyRect.mBottom << ")" << LL_ENDL; - + mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CONTENT_UPDATED); - } - + } + bool time_duration_updated = false; int previous_percent = mProgressPercent; @@ -839,7 +858,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) { mCurrentRate = message.getValueReal("current_rate"); } - + if(message.hasValue("loaded_duration")) { mLoadedDuration = message.getValueReal("loaded_duration"); @@ -850,7 +869,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) // If the message doesn't contain a loaded_duration param, assume it's equal to duration mLoadedDuration = mDuration; } - + // Calculate a percentage based on the loaded duration and total duration. if(mDuration != 0.0f) // Don't divide by zero. { @@ -861,7 +880,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) { mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_TIME_DURATION_UPDATED); } - + if(previous_percent != mProgressPercent) { mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PROGRESS_UPDATED); @@ -870,9 +889,9 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) else if(message_name == "media_status") { std::string status = message.getValue("status"); - + LL_DEBUGS("Plugin") << "Status changed to: " << status << LL_ENDL; - + if(status == "loading") { mStatus = LLPluginClassMediaOwner::MEDIA_LOADING; @@ -912,24 +931,24 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) // TODO: check that name matches? mNaturalMediaWidth = width; mNaturalMediaHeight = height; - + setSizeInternal(); } else if(message_name == "size_change_response") { std::string name = message.getValue("name"); - + // TODO: check that name matches? - + mTextureWidth = message.getValueS32("texture_width"); mTextureHeight = message.getValueS32("texture_height"); mMediaWidth = message.getValueS32("width"); mMediaHeight = message.getValueS32("height"); - + // This invalidates any existing dirty rect. resetDirty(); - - // TODO: should we verify that the plugin sent back the right values? + + // TODO: should we verify that the plugin sent back the right values? // Two size changes in a row may cause them to not match, due to queueing, etc. mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_SIZE_CHANGED); @@ -969,7 +988,12 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mAuthURL = message.getValue("url"); mAuthRealm = message.getValue("realm"); mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_AUTH_REQUEST); - } + } + else if (message_name == "file_download") + { + mFileDownloadFilename = message.getValue("filename"); + mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_FILE_DOWNLOAD); + } else if(message_name == "debug_message") { mDebugMessageText = message.getValue("message_text"); @@ -996,7 +1020,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mNavigateResultString = message.getValue("result_string"); mHistoryBackAvailable = message.getValueBoolean("history_back_available"); mHistoryForwardAvailable = message.getValueBoolean("history_forward_available"); - + mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE); } else if(message_name == "progress") @@ -1051,7 +1075,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mGeometryY = message.getValueS32("y"); mGeometryWidth = message.getValueS32("width"); mGeometryHeight = message.getValueS32("height"); - + mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_GEOMETRY_CHANGE); } else if(message_name == "link_hovered") @@ -1060,7 +1084,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mHoverLink = message.getValue("link"); mHoverText = message.getValue("title"); // message.getValue("text"); - + mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_LINK_HOVERED); } else @@ -1076,20 +1100,21 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) // if(message_name == "message_name") // { // } -// else +// else { LL_WARNS("Plugin") << "Unknown " << message_class << " class message: " << message_name << LL_ENDL; } } + } -/* virtual */ +/* virtual */ void LLPluginClassMedia::pluginLaunchFailed() { mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PLUGIN_FAILED_LAUNCH); } -/* virtual */ +/* virtual */ void LLPluginClassMedia::pluginDied() { mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PLUGIN_FAILED); @@ -1116,7 +1141,7 @@ void LLPluginClassMedia::focus(bool focused) LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "focus"); message.setValueBoolean("focused", focused); - + sendMessage(message); } @@ -1143,7 +1168,7 @@ void LLPluginClassMedia::clear_cookies() void LLPluginClassMedia::set_cookies(const std::string &cookies) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_cookies"); - message.setValue("cookies", cookies); + message.setValue("cookies", cookies); sendMessage(message); } @@ -1176,7 +1201,7 @@ void LLPluginClassMedia::browse_reload(bool ignore_cache) LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "browse_reload"); message.setValueBoolean("ignore_cache", ignore_cache); - + sendMessage(message); } @@ -1300,7 +1325,7 @@ void LLPluginClassMedia::seek(float time) LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME, "seek"); message.setValueReal("time", time); - + sendMessage(message); } @@ -1318,11 +1343,11 @@ void LLPluginClassMedia::setVolume(float volume) if(volume != mRequestedVolume) { mRequestedVolume = volume; - + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME, "set_volume"); message.setValueReal("volume", volume); - + sendMessage(message); } } @@ -1341,4 +1366,3 @@ void LLPluginClassMedia::initializeUrlHistory(const LLSD& url_history) LL_DEBUGS("Plugin") << "Sending history" << LL_ENDL; } - diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 8e7a40a67..c2b993488 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -122,6 +122,8 @@ public: // Text may be unicode (utf8 encoded) bool textInput(const std::string &text, MASK modifiers, LLSD native_key_data); + void setCookie(std::string uri, std::string name, std::string value, std::string domain, std::string path, bool httponly, bool secure); + void loadURI(const std::string &uri); // Inherited from LLPluginProcessParentOwner @@ -154,7 +156,7 @@ public: bool canPaste() const { return mCanPaste; }; // These can be called before init(), and they will be queued and sent before the media init message. - void setUserDataPath(const std::string &user_data_path); + void setUserDataPath(const std::string &user_data_path_cache, const std::string &user_data_path_cookies, const std::string &user_data_path_logs); void setLanguageCode(const std::string &language_code); void setPluginsEnabled(const bool enabled); void setJavascriptEnabled(const bool enabled); @@ -234,6 +236,10 @@ public: std::string getHoverText() const { return mHoverText; }; std::string getHoverLink() const { return mHoverLink; }; + // these are valid during MEDIA_EVENT_LINK_HOVERED + std::string getFileDownloadFilename() const { return mFileDownloadFilename; } + + const std::string& getMediaName() const { return mMediaName; }; std::string getMediaDescription() const { return mMediaDescription; }; @@ -373,6 +379,7 @@ protected: std::string mAuthRealm; std::string mHoverText; std::string mHoverLink; + std::string mFileDownloadFilename; ///////////////////////////////////////// // media_time class diff --git a/indra/llplugin/llpluginclassmediaowner.h b/indra/llplugin/llpluginclassmediaowner.h index 4a739cf86..391c23d88 100644 --- a/indra/llplugin/llpluginclassmediaowner.h +++ b/indra/llplugin/llpluginclassmediaowner.h @@ -3,33 +3,26 @@ * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class. * * @cond - * $LicenseInfo:firstyear=2008&license=viewergpl$ - * - * Copyright (c) 2008-2010, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ - * * @endcond */ @@ -71,6 +64,8 @@ public: MEDIA_EVENT_AUTH_REQUEST, // The plugin wants to display an auth dialog + MEDIA_EVENT_FILE_DOWNLOAD, // the plugin wants to download a file + MEDIA_EVENT_DEBUG_MESSAGE, // plugin sending back debug information for host to process MEDIA_EVENT_LINK_HOVERED // Got a "link hovered" event from the plugin diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt index 381782ed6..f2596a1a6 100644 --- a/indra/llplugin/slplugin/CMakeLists.txt +++ b/indra/llplugin/slplugin/CMakeLists.txt @@ -6,6 +6,7 @@ include(LLPlugin) include(Linking) include(PluginAPI) include(LLMessage) +include(WinManifest) include_directories( ${LLPLUGIN_INCLUDE_DIRS} @@ -56,8 +57,9 @@ set_target_properties(SLPlugin if (WINDOWS) set_target_properties(SLPlugin PROPERTIES - LINK_FLAGS "/OPT:NOREF" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMTD\"" ) + EMBED_MANIFEST(SLPlugin 1) endif() target_link_libraries(SLPlugin diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index e9478bb06..e2c4d5295 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -62,4 +62,3 @@ set_source_files_properties(${llprimitive_HEADER_FILES} list(APPEND llprimitive_SOURCE_FILES ${llprimitive_HEADER_FILES}) add_library (llprimitive ${llprimitive_SOURCE_FILES}) -add_dependencies(llprimitive prepare) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 27bb606ff..cf3c685b1 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -53,8 +53,6 @@ # include "zlib/zlib.h" #endif - - std::string model_names[] = { "lowest_lod", @@ -68,7 +66,7 @@ const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string); LLModel::LLModel(LLVolumeParams& params, F32 detail) : LLVolume(params, detail), mNormalizedScale(1,1,1), mNormalizedTranslation(0,0,0) - , mPelvisOffset( 0.0f ), mStatus(NO_ERRORS) + , mPelvisOffset( 0.0f ), mStatus(NO_ERRORS), mSubmodelID(0) { mDecompID = -1; mLocalID = -1; @@ -1909,7 +1907,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) weight_map::iterator best = iter_up; - F32 min_dist = (iter->first - pos).magVec(); + F32 min_dist = (iter_up->first - pos).magVec(); bool done = false; while (!done) @@ -2015,21 +2013,20 @@ bool LLModel::loadModel(std::istream& is) } } - std::string nm[] = - { + mSubmodelID = header.has("submodel_id") ? header["submodel_id"].asInteger() : false; + + static const std::array lod_name = {{ "lowest_lod", "low_lod", "medium_lod", "high_lod", "physics_mesh", - }; + }}; - const S32 MODEL_LODS = 5; + S32 lod = llclamp((S32) mDetail, 0, (S32)lod_name.size() - 1); - S32 lod = llclamp((S32) mDetail, 0, MODEL_LODS); - - if (header[nm[lod]]["offset"].asInteger() == -1 || - header[nm[lod]]["size"].asInteger() == 0 ) + if (header[lod_name[lod]]["offset"].asInteger() == -1 || + header[lod_name[lod]]["size"].asInteger() == 0 ) { //cannot load requested LOD LL_WARNS() << "LoD data is invalid!" << LL_ENDL; return false; @@ -2038,23 +2035,23 @@ bool LLModel::loadModel(std::istream& is) bool has_skin = header["skin"]["offset"].asInteger() >=0 && header["skin"]["size"].asInteger() > 0; - if (lod == LLModel::LOD_HIGH) + if ((lod == LLModel::LOD_HIGH) && !mSubmodelID) { //try to load skin info and decomp info std::ios::pos_type cur_pos = is.tellg(); loadSkinInfo(header, is); is.seekg(cur_pos); } - if (lod == LLModel::LOD_HIGH || lod == LLModel::LOD_PHYSICS) + if ((lod == LLModel::LOD_HIGH || lod == LLModel::LOD_PHYSICS) && !mSubmodelID) { std::ios::pos_type cur_pos = is.tellg(); loadDecomposition(header, is); is.seekg(cur_pos); } - is.seekg(header[nm[lod]]["offset"].asInteger(), std::ios_base::cur); + is.seekg(header[lod_name[lod]]["offset"].asInteger(), std::ios_base::cur); - if (unpackVolumeFaces(is, header[nm[lod]]["size"].asInteger())) + if (unpackVolumeFaces(is, header[lod_name[lod]]["size"].asInteger())) { if (has_skin) { @@ -2112,7 +2109,7 @@ bool LLModel::isMaterialListSubset( LLModel* ref ) for (S32 dst = 0; dst < refCnt; ++dst) { - //LL_INFOS() <mMaterialList[dst]<mMaterialList[dst]<mMaterialList[dst]; if ( foundRef ) @@ -2120,8 +2117,10 @@ bool LLModel::isMaterialListSubset( LLModel* ref ) break; } } + if (!foundRef) { + LL_INFOS() << "Could not find material " << mMaterialList[src] << " in reference model " << ref->mLabel << LL_ENDL; return false; } } @@ -2157,7 +2156,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn bool isASubset = isMaterialListSubset( ref ); if ( !isASubset ) { - LL_INFOS() <<"Material of model is not a subset of reference."<mMaterialList[i]] = i; - if (!reorder) - { //if any material name does not match reference, we need to reorder - reorder = ref->mMaterialList[i] != mMaterialList[i]; - } + //if any material name does not match reference, we need to reorder + reorder |= ref->mMaterialList[i] != mMaterialList[i]; base_mat.insert(ref->mMaterialList[i]); cur_mat.insert(mMaterialList[i]); } - if (reorder && - base_mat == cur_mat) //don't reorder if material name sets don't match + if (reorder && (base_mat == cur_mat)) //don't reorder if material name sets don't match { std::vector new_face_list; - new_face_list.resize(mVolumeFaces.size()); + new_face_list.resize(mMaterialList.size()); std::vector new_material_list; - new_material_list.resize(mVolumeFaces.size()); + new_material_list.resize(mMaterialList.size()); //rebuild face list so materials have the same order //as the reference model for (U32 i = 0; i < mMaterialList.size(); ++i) { U32 ref_idx = index_map[mMaterialList[i]]; - new_face_list[ref_idx] = mVolumeFaces[i]; + if (i < mVolumeFaces.size()) + { + new_face_list[ref_idx] = mVolumeFaces[i]; + } new_material_list[ref_idx] = mMaterialList[i]; } llassert(new_material_list == ref->mMaterialList); mVolumeFaces = new_face_list; - } - //override material list with reference model ordering - mMaterialList = ref->mMaterialList; + //override material list with reference model ordering + mMaterialList = ref->mMaterialList; + } + return true; } @@ -2237,7 +2237,7 @@ bool LLModel::loadDecomposition(LLSD& header, std::istream& is) S32 offset = header["physics_convex"]["offset"].asInteger(); S32 size = header["physics_convex"]["size"].asInteger(); - if (offset >= 0 && size > 0) + if (offset >= 0 && size > 0 && !mSubmodelID) { is.seekg(offset, std::ios_base::cur); @@ -2452,7 +2452,7 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) range = max-min; - U16 count = position.size()/6; + size_t count = position.size()/6; for (U32 j = 0; j < count; ++j) { diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index f6063165d..33086bab9 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -181,7 +181,11 @@ public: bool isMaterialListSubset( LLModel* ref ); bool needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt ); - std::vector mMaterialList; + typedef std::vector material_list; + + material_list mMaterialList; + + material_list& getMaterialList() { return mMaterialList; } //data used for skin weights class JointWeight @@ -274,6 +278,8 @@ public: Decomposition mPhysics; EModelStatus mStatus ; + + int mSubmodelID; protected: void addVolumeFacesFromDomMesh(domMesh* mesh); virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh); diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 82481feaa..36680ba9b 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -528,7 +528,7 @@ inline BOOL LLPrimitive::isApp(const LLPCode pcode) // Special case for setPosition. If not check-for-finite, fall through to LLXform method. void LLPrimitive::setPosition(const F32 x, const F32 y, const F32 z) { - if (llfinite(x) && llfinite(y) && llfinite(z)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z)) { LLXform::setPosition(x, y, z); } @@ -565,7 +565,7 @@ void LLPrimitive::setAngularVelocity(const LLVector3& avel) void LLPrimitive::setAngularVelocity(const F32 x, const F32 y, const F32 z) { - if (llfinite(x) && llfinite(y) && llfinite(z)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z)) { mAngularVelocity.setVec(x,y,z); } @@ -589,7 +589,7 @@ void LLPrimitive::setVelocity(const LLVector3& vel) void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z) { - if (llfinite(x) && llfinite(y) && llfinite(z)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z)) { mVelocity.setVec(x,y,z); } @@ -601,7 +601,7 @@ void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z) void LLPrimitive::setVelocityX(const F32 x) { - if (llfinite(x)) + if (std::isfinite(x)) { mVelocity.mV[VX] = x; } @@ -613,7 +613,7 @@ void LLPrimitive::setVelocityX(const F32 x) void LLPrimitive::setVelocityY(const F32 y) { - if (llfinite(y)) + if (std::isfinite(y)) { mVelocity.mV[VY] = y; } @@ -625,7 +625,7 @@ void LLPrimitive::setVelocityY(const F32 y) void LLPrimitive::setVelocityZ(const F32 z) { - if (llfinite(z)) + if (std::isfinite(z)) { mVelocity.mV[VZ] = z; } @@ -661,7 +661,7 @@ void LLPrimitive::setAcceleration(const LLVector3& accel) void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z) { - if (llfinite(x) && llfinite(y) && llfinite(z)) + if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z)) { mAcceleration.setVec(x,y,z); } diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index 284dfc15f..91d5c7ca7 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -417,7 +417,7 @@ S32 LLTextureEntry::setOffsetT(F32 t) S32 LLTextureEntry::setRotation(F32 theta) { - if (mRotation != theta && llfinite(theta)) + if (mRotation != theta && std::isfinite(theta)) { mRotation = theta; return TEM_CHANGE_TEXTURE; diff --git a/indra/llqtwebkit/CMakeLists.txt b/indra/llqtwebkit/CMakeLists.txt deleted file mode 100644 index 6fbf5e960..000000000 --- a/indra/llqtwebkit/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -# -*- cmake -*- - -project(llqtwebkit) - -include(00-Common) -include(Qt4) - -if(NOT WORD_SIZE EQUAL 32) - if(WINDOWS) - add_definitions(/FIXED:NO) - else(WINDOWS) - add_definitions(-fPIC) - endif(WINDOWS) -endif(NOT WORD_SIZE EQUAL 32) - -include_directories(${QT_INCLUDES}) - -add_subdirectory(qtwebkit_cookiejar) -include_directories(qtwebkit_cookiejar/src/) - -set(llqtwebkit_SOURCE_FILES - llembeddedbrowser.cpp - llembeddedbrowserwindow.cpp - lljsobject.cpp - llnetworkaccessmanager.cpp - llqtwebkit.cpp - llstyle.cpp - llwebpage.cpp - llwebpageopenshim.cpp - ) - -set(llqtwebkit_HEADER_FILES - llembeddedbrowser.h - llembeddedbrowser_p.h - llembeddedbrowserwindow.h - llembeddedbrowserwindow_p.h - lljsobject.h - llnetworkaccessmanager.h - llqtwebkit.h - llstyle.h - llwebpage.h - llwebpageopenshim.h - pstdint.h - ) - -set(llqtwebkit_UI_FILES - passworddialog.ui - ) - -set(llqtwebkit_LINK_LIBRARIES - networkcookiejar -) - -QT4_WRAP_UI(llqtwebkit_UI_MOC ${llqtwebkit_UI_FILES}) -QT4_WRAP_CPP(llqtwebkit_HEADERS_MOC ${llqtwebkit_HEADER_FILES}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -add_library(llqtwebkit - ${llqtwebkit_SOURCE_FILES} - ${llqtwebkit_HEADERS_MOC} - ${llqtwebkit_UI_MOC} -) - -add_dependencies(llqtwebkit prepare) - -target_link_libraries(llqtwebkit ${llqtwebkit_LINK_LIBRARIES}) - -add_dependencies(llqtwebkit - networkcookiejar -) diff --git a/indra/llqtwebkit/autotests/llembeddedbrowser/llembeddedbrowser.pro b/indra/llqtwebkit/autotests/llembeddedbrowser/llembeddedbrowser.pro deleted file mode 100644 index 02ecce5a2..000000000 --- a/indra/llqtwebkit/autotests/llembeddedbrowser/llembeddedbrowser.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += qtestlib -QT += webkit opengl network - -include(../../llmozlib2.pri) -DEFINES += AUTOTEST - -# Input -SOURCES += tst_llembeddedbrowser.cpp - diff --git a/indra/llqtwebkit/autotests/llembeddedbrowser/tst_llembeddedbrowser.cpp b/indra/llqtwebkit/autotests/llembeddedbrowser/tst_llembeddedbrowser.cpp deleted file mode 100644 index a59cc9e19..000000000 --- a/indra/llqtwebkit/autotests/llembeddedbrowser/tst_llembeddedbrowser.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include -#include - -class tst_LLEmbeddedBrowser : public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void llembeddedbrowser_data(); - void llembeddedbrowser(); - - void clearAllCookies(); - void clearCache_data(); - void clearCache(); - void clearLastError_data(); - void clearLastError(); - void createBrowserWindow_data(); - void createBrowserWindow(); - void destroyBrowserWindow(); - void enableCookies_data(); - void enableCookies(); - void enablePlugins_data(); - void enablePlugins(); - void enableProxy_data(); - void enableProxy(); - void getGREVersion_data(); - void getGREVersion(); - void getInstance(); - void getLastError_data(); - void getLastError(); - void initBrowser_data(); - void initBrowser(); //change function init as initbrowser - void reset(); - void setBrowserAgentId_data(); - void setBrowserAgentId(); - void setLastError_data(); - void setLastError(); -}; - -// Subclass that exposes the protected functions. -class SubLLEmbeddedBrowser : public LLEmbeddedBrowser -{ -public: - -}; - -// This will be called before the first test function is executed. -// It is only called once. -void tst_LLEmbeddedBrowser::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_LLEmbeddedBrowser::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_LLEmbeddedBrowser::init() -{ -} - -// This will be called after every test function. -void tst_LLEmbeddedBrowser::cleanup() -{ -} - -void tst_LLEmbeddedBrowser::llembeddedbrowser_data() -{ -} - -void tst_LLEmbeddedBrowser::llembeddedbrowser() -{ - SubLLEmbeddedBrowser browser; - QCOMPARE(browser.clearAllCookies(), false); - QCOMPARE(browser.clearCache(), false); - browser.clearLastError(); - QCOMPARE(browser.enableCookies(false), false); - QCOMPARE(browser.enablePlugins(false), true); - QCOMPARE(browser.enableProxy(false, std::string(""), -1), true); - QCOMPARE(browser.getGREVersion(), std::string(QT_VERSION_STR)); - QVERIFY(browser.getInstance() != NULL); - QCOMPARE(browser.getLastError(), 0); - browser.setBrowserAgentId("uBrowser"); - browser.setLastError(-1); - QCOMPARE(browser.reset(), true); - browser.destroyBrowserWindow(0); - browser.destroyBrowserWindow((LLEmbeddedBrowserWindow*)6); - QCOMPARE(browser.getWindowCount(), 0); - QCOMPARE(browser.init(std::string(""),std::string(""),std::string(""),0), true); -} - -// public bool clearAllCookies() -void tst_LLEmbeddedBrowser::clearAllCookies() -{ - SubLLEmbeddedBrowser browser; - - QCOMPARE(browser.clearAllCookies(), false); - browser.reset(); - QCOMPARE(browser.clearAllCookies(), true); -} - -void tst_LLEmbeddedBrowser::clearCache_data() -{ - QTest::addColumn("clearCache"); -#if QT_VERSION < 0x040500 - QTest::newRow("QTVersion < 4.5") << false; -#else - QTest::newRow("QTVersion > 4.5") << true; -#endif -} - -// public bool clearCache() -void tst_LLEmbeddedBrowser::clearCache() -{ - QFETCH(bool, clearCache); - - SubLLEmbeddedBrowser browser; - browser.reset(); - QCOMPARE(browser.clearCache(), clearCache); -} - -void tst_LLEmbeddedBrowser::clearLastError_data() -{ - QTest::addColumn("lastError"); - QTest::newRow("1") << 1; -} - -// public void clearLastError() -void tst_LLEmbeddedBrowser::clearLastError() -{ - SubLLEmbeddedBrowser browser; - QFETCH(int, lastError); - - browser.setLastError(lastError); - browser.clearLastError(); - QCOMPARE(browser.getLastError(), 0); -} - -void tst_LLEmbeddedBrowser::createBrowserWindow_data() -{ - QTest::addColumn("width"); - QTest::addColumn("height"); - QTest::newRow("0,0") << 0 << 0; - QTest::newRow("800,600") << 800 << 600; -} - -// public LLEmbeddedBrowserWindow* createBrowserWindow(int width, int height) -void tst_LLEmbeddedBrowser::createBrowserWindow() -{ - QFETCH(int, width); - QFETCH(int, height); - SubLLEmbeddedBrowser browser; - - LLEmbeddedBrowserWindow *window = browser.createBrowserWindow(width, height); - QVERIFY(window); - QCOMPARE(browser.getLastError(), 0); - QCOMPARE(browser.getWindowCount(), 1); - QCOMPARE(window->getBrowserWidth(), (int16_t)width); - QCOMPARE(window->getBrowserHeight(), (int16_t)height); -} - -// public bool destroyBrowserWindow(LLEmbeddedBrowserWindow* browser_window) -void tst_LLEmbeddedBrowser::destroyBrowserWindow() -{ - SubLLEmbeddedBrowser browser; - browser.reset(); - LLEmbeddedBrowserWindow* browser_window = browser.createBrowserWindow(200, 100); - if (browser_window) - { - QCOMPARE(browser.getWindowCount(), 1); - browser.destroyBrowserWindow(browser_window); - QCOMPARE(browser.getLastError(), 0); - QCOMPARE(browser.getWindowCount(), 0); - } - - browser_window = browser.createBrowserWindow(800, 600); - if (browser_window) - { - QCOMPARE(browser.getWindowCount(), 1); - browser.destroyBrowserWindow(browser_window); - QCOMPARE(browser.getLastError(), 0); - QCOMPARE(browser.getWindowCount(), 0); - } -} - -void tst_LLEmbeddedBrowser::enableCookies_data() -{ - QTest::addColumn("enabled"); - QTest::addColumn("enableCookies"); - QTest::newRow("disable") << false << false; - QTest::newRow("enable") << true << false; -} - -// public bool enableCookies(bool enabled) -void tst_LLEmbeddedBrowser::enableCookies() -{ - QFETCH(bool, enabled); - QFETCH(bool, enableCookies); - - SubLLEmbeddedBrowser browser; - browser.reset(); - QCOMPARE(browser.enableCookies(enabled), enableCookies); - // TODO check that cookies are not saved -} - -void tst_LLEmbeddedBrowser::enablePlugins_data() -{ - QTest::addColumn("enabled"); - QTest::addColumn("enablePlugins"); - QTest::newRow("disable") << false << true; - QTest::newRow("enable") << true << true; -} - -// public bool enablePlugins(bool enabled) -void tst_LLEmbeddedBrowser::enablePlugins() -{ - QFETCH(bool, enabled); - QFETCH(bool, enablePlugins); - - SubLLEmbeddedBrowser browser; - browser.reset(); - QCOMPARE(browser.enablePlugins(enabled), enablePlugins); - // TODO check that plugins work/do not work -} - -Q_DECLARE_METATYPE(std::string) -void tst_LLEmbeddedBrowser::enableProxy_data() -{ - QTest::addColumn("enabled"); - QTest::addColumn("host_name"); - QTest::addColumn("port"); - QTest::addColumn("enableProxy"); - QTest::newRow("null") << false << std::string() << 0 << true; - QTest::newRow("valid") << true << std::string("wtfsurf.com") << 80 << true; -} - -// public bool enableProxy(bool enabled, std::string host_name, int port) -void tst_LLEmbeddedBrowser::enableProxy() -{ - QFETCH(bool, enabled); - QFETCH(std::string, host_name); - QFETCH(int, port); - QFETCH(bool, enableProxy); - - SubLLEmbeddedBrowser browser; - browser.reset(); - QCOMPARE(browser.enableProxy(enabled, host_name, port), enableProxy); - // TODO need some proxy servers to test this -} - -void tst_LLEmbeddedBrowser::getGREVersion_data() -{ - QTest::addColumn("getGREVersion"); - QTest::newRow("valid") << std::string(QT_VERSION_STR); -} - -// public std::string getGREVersion() -void tst_LLEmbeddedBrowser::getGREVersion() -{ - QFETCH(std::string, getGREVersion); - - SubLLEmbeddedBrowser browser; - browser.reset(); - QCOMPARE(browser.getGREVersion(), getGREVersion); -} - -// public static LLEmbeddedBrowser* getInstance() -void tst_LLEmbeddedBrowser::getInstance() -{ - SubLLEmbeddedBrowser browser; - QVERIFY(browser.getInstance() != NULL); -} - -void tst_LLEmbeddedBrowser::getLastError_data() -{ - QTest::addColumn("error"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; - QTest::newRow("100") << 100; -} - -// public int getLastError() -void tst_LLEmbeddedBrowser::getLastError() -{ - QFETCH(int, error); - SubLLEmbeddedBrowser browser; - browser.setLastError(error); - QCOMPARE(browser.getLastError(), error); -} - -void tst_LLEmbeddedBrowser::initBrowser_data() -{ - QTest::addColumn("application_directory"); - QTest::addColumn("component_directory"); - QTest::addColumn("profile_directory"); - QTest::addColumn("native_window_handleCount"); - QTest::addColumn("init"); - QTest::newRow("null") << std::string() << std::string() << std::string() << (void *)0 << true; - QTest::newRow("valid") << std::string("/home/crystal/Settings/") << std::string() << std::string() << (void *)0 << true; -} -void tst_LLEmbeddedBrowser::initBrowser() -{ - QFETCH(std::string, application_directory); - QFETCH(std::string, component_directory); - QFETCH(std::string, profile_directory); - QFETCH(void *, native_window_handleCount); - SubLLEmbeddedBrowser browser; - browser.init(application_directory,component_directory,profile_directory,native_window_handleCount); - QCOMPARE(browser.getLastError(), 0); -} - -// public bool reset() -void tst_LLEmbeddedBrowser::reset() -{ - SubLLEmbeddedBrowser browser; - - browser.setLastError(100); - QCOMPARE(browser.getLastError(), 100); - QVERIFY(browser.reset()); - QCOMPARE(browser.getLastError(), 0); - // TODO what should reset really do? -} - -void tst_LLEmbeddedBrowser::setBrowserAgentId_data() -{ - QTest::addColumn("id"); - QTest::newRow("null") << std::string(); - QTest::newRow("valid") << std::string("uBrowser"); - -} - -// public void setBrowserAgentId(std::string id) -void tst_LLEmbeddedBrowser::setBrowserAgentId() -{ - QFETCH(std::string, id); - - SubLLEmbeddedBrowser browser; - browser.reset(); - browser.setBrowserAgentId(id); - LLEmbeddedBrowserWindow *window = browser.createBrowserWindow(0, 0); - Q_UNUSED(window); - // TODO confirm that the page is actually sending the agent ID -} - -void tst_LLEmbeddedBrowser::setLastError_data() -{ - QTest::addColumn("error_number"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; - QTest::newRow("100") << 100; -} - -// public void setLastError(int error_number) -void tst_LLEmbeddedBrowser::setLastError() -{ - QFETCH(int, error_number); - - SubLLEmbeddedBrowser browser; - - browser.setLastError(error_number); - QCOMPARE(browser.getLastError(), error_number); -} - -QTEST_MAIN(tst_LLEmbeddedBrowser) -#include "tst_llembeddedbrowser.moc" - diff --git a/indra/llqtwebkit/autotests/llembeddedbrowserwindow/llembeddedbrowserwindow.pro b/indra/llqtwebkit/autotests/llembeddedbrowserwindow/llembeddedbrowserwindow.pro deleted file mode 100644 index a89f50065..000000000 --- a/indra/llqtwebkit/autotests/llembeddedbrowserwindow/llembeddedbrowserwindow.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += qtestlib -QT += webkit opengl network - -include(../../llmozlib2.pri) -DEFINES += AUTOTEST - -# Input -SOURCES += tst_llembeddedbrowserwindow.cpp - diff --git a/indra/llqtwebkit/autotests/llembeddedbrowserwindow/tst_llembeddedbrowserwindow.cpp b/indra/llqtwebkit/autotests/llembeddedbrowserwindow/tst_llembeddedbrowserwindow.cpp deleted file mode 100644 index 4c365d371..000000000 --- a/indra/llqtwebkit/autotests/llembeddedbrowserwindow/tst_llembeddedbrowserwindow.cpp +++ /dev/null @@ -1,1027 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include - -#include "llembeddedbrowserwindow.h" -#include "llembeddedbrowser.h" - -#ifndef QTRY_COMPARE - -#define __TRY_TIMEOUT__ 10000 -#define __TRY_STEP__ 50 - -#define __QTRY(__expression__, __functionToCall__) \ - do { \ - int __i = 0; \ - while (!(__expression__) && __i < __TRY_TIMEOUT__) { \ - QTest::qWait(__TRY_STEP__); \ - __i += __TRY_STEP__; \ - } \ - __functionToCall__; \ - } while(0) - -#define QTRY_COMPARE(__expression__, __expected__) \ - __QTRY((__expression__ == __expected__), QCOMPARE(__expression__, __expected__)); - -#define QTRY_VERIFY(__expression__) \ - __QTRY(__expression__, QVERIFY(__expression__)); - -#endif // QTRY_COMPARE - -class tst_LLEmbeddedBrowserWindow : public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void llembeddedbrowserwindow_data(); - void llembeddedbrowserwindow(); - - void addObserver_data(); - void addObserver(); - void canNavigateBack_data(); - void canNavigateBack(); - void canNavigateForward_data(); - void canNavigateForward(); - void evaluateJavascript_data(); - void evaluateJavascript(); - void flipWindow_data(); - void flipWindow(); - void focusBrowser_data(); - void focusBrowser(); - void getBrowserDepth_data(); - void getBrowserDepth(); - void getBrowserHeight_data(); - void getBrowserHeight(); - void getBrowserRowSpan_data(); - void getBrowserRowSpan(); - void getBrowserWidth_data(); - void getBrowserWidth(); - void getClickLinkHref_data(); - void getClickLinkHref(); - void getClickLinkTarget_data(); - void getClickLinkTarget(); - void getCurrentUri_data(); - void getCurrentUri(); - void getNoFollowScheme_data(); - void getNoFollowScheme(); - void getPageBuffer_data(); - void getPageBuffer(); - void getPercentComplete_data(); - void getPercentComplete(); - void getStatusMsg_data(); - void getStatusMsg(); - void getWindowId_data(); - void getWindowId(); - void grabWindow_data(); - void grabWindow(); - void keyPress_data(); - void keyPress(); - void mouseDown_data(); - void mouseDown(); - void mouseLeftDoubleClick_data(); - void mouseLeftDoubleClick(); - void mouseMove_data(); - void mouseMove(); - void mouseUp_data(); - void mouseUp(); - void navigateBack_data(); - void navigateBack(); - void navigateForward_data(); - void navigateForward(); - void navigateReload_data(); - void navigateReload(); - void navigateStop_data(); - void navigateStop(); - void navigateTo_data(); - void navigateTo(); - void remObserver_data(); - void remObserver(); - void scrollByLines_data(); - void scrollByLines(); - void setBackgroundColor_data(); - void setBackgroundColor(); - void setCaretColor_data(); - void setCaretColor(); - void setEnabled_data(); - void setEnabled(); - void setNoFollowScheme_data(); - void setNoFollowScheme(); - void setParent_data(); - void setParent(); - void setSize_data(); - void setSize(); - void setWindowId_data(); - void setWindowId(); - void unicodeInput_data(); - void unicodeInput(); -}; - -// Subclass that exposes the protected functions. -class SubLLEmbeddedBrowserWindow : public LLEmbeddedBrowserWindow -{ -public: - -}; - -// This will be called before the first test function is executed. -// It is only called once. -void tst_LLEmbeddedBrowserWindow::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_LLEmbeddedBrowserWindow::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_LLEmbeddedBrowserWindow::init() -{ -} - -// This will be called after every test function. -void tst_LLEmbeddedBrowserWindow::cleanup() -{ -} - -void tst_LLEmbeddedBrowserWindow::llembeddedbrowserwindow_data() -{ -} - -void tst_LLEmbeddedBrowserWindow::llembeddedbrowserwindow() -{ - SubLLEmbeddedBrowserWindow window; - QCOMPARE(window.addObserver((LLEmbeddedBrowserWindowObserver*)0), false); - QCOMPARE(window.canNavigateBack(), false); - QCOMPARE(window.canNavigateForward(), false); - QCOMPARE(window.evaluateJavascript(std::string()), std::string()); - QCOMPARE(window.flipWindow(false), true); - window.focusBrowser(false); - QCOMPARE(window.getBrowserDepth(), (int16_t)4); - QCOMPARE(window.getBrowserHeight(), (int16_t)0); - QCOMPARE(window.getBrowserRowSpan(), (int32_t)0); - QCOMPARE(window.getBrowserWidth(), (int16_t)0); - QCOMPARE(window.getClickLinkHref(), std::string()); - QCOMPARE(window.getClickLinkTarget(), std::string()); - QCOMPARE(window.getCurrentUri(), std::string()); - QCOMPARE(window.getNoFollowScheme(), std::string("secondlife")); - QCOMPARE(window.getPageBuffer(), (unsigned char*)0); - QCOMPARE(window.getPercentComplete(), (int16_t)0); - QCOMPARE(window.getStatusMsg(), std::string()); - QCOMPARE(window.getWindowId(), -1); - QCOMPARE(window.grabWindow(-1, -1, -1, -1), (unsigned char*)0); - window.keyPress(0); - window.mouseDown(0, 0); - window.mouseLeftDoubleClick(0, 0); - window.mouseMove(0, 0); - window.mouseUp(0, 0); - window.navigateBack(); - window.navigateForward(); - window.navigateReload(); - window.navigateStop(); - QCOMPARE(window.navigateTo(std::string()), true); - QCOMPARE(window.remObserver((LLEmbeddedBrowserWindowObserver*)0), false); - window.scrollByLines(0); - window.setBackgroundColor(0, 0, 0); - window.setCaretColor(0, 0, 0); - window.setEnabled(false); - window.setNoFollowScheme(std::string()); - window.setParent((LLEmbeddedBrowser*)0); - QCOMPARE(window.setSize(0, 0), true); - window.setWindowId(-1); - window.unicodeInput((uint32_t)0); -} - -void tst_LLEmbeddedBrowserWindow::addObserver_data() -{ -#if 0 - QTest::addColumn("observerCount"); - QTest::addColumn("addObserver"); - QTest::newRow("null") << 0 << false; -#endif -} - -// public bool addObserver(LLEmbeddedBrowserWindowObserver* observer) -void tst_LLEmbeddedBrowserWindow::addObserver() -{ -#if 0 - QFETCH(int, observerCount); - QFETCH(bool, addObserver); - - SubLLEmbeddedBrowserWindow window; - - QCOMPARE(window.addObserver(observer), addObserver); -#endif - QSKIP("Test is same with remObserver.", SkipAll); -} - -void tst_LLEmbeddedBrowserWindow::canNavigateBack_data() -{ -#if 0 - QTest::addColumn("canNavigateBack"); - QTest::newRow("true") << true; - QTest::newRow("false") << false; -#endif -} - -// public bool canNavigateBack() -void tst_LLEmbeddedBrowserWindow::canNavigateBack() -{ - //QFETCH(bool, canNavigateForward); - - SubLLEmbeddedBrowserWindow window; - window.setSize(800,600); - window.setParent(new LLEmbeddedBrowser()); - QCOMPARE(window.canNavigateForward(), false); - window.navigateTo(std::string("http://www.google.com")); - QTest::qWait(__TRY_TIMEOUT__); - QCOMPARE(window.canNavigateBack(), false); - window.navigateTo(std::string("http://www.cnn.com")); - QTest::qWait(__TRY_TIMEOUT__); - QCOMPARE(window.canNavigateBack(), true); - window.navigateBack(); - QTRY_COMPARE(window.canNavigateForward(), true); - window.navigateForward(); - QTRY_COMPARE(window.canNavigateBack(), true); -} - -void tst_LLEmbeddedBrowserWindow::canNavigateForward_data() -{ -#if 0 - QTest::addColumn("canNavigateForward"); - QTest::newRow("true") << true; - QTest::newRow("false") << false; -#endif -} - -// public bool canNavigateForward() -void tst_LLEmbeddedBrowserWindow::canNavigateForward() -{ - QSKIP("Test is same with canNavigateBack().", SkipAll); -} - -Q_DECLARE_METATYPE(std::string) -void tst_LLEmbeddedBrowserWindow::evaluateJavascript_data() -{ - QTest::addColumn("script"); - QTest::addColumn("evaluateJavascript"); - QTest::newRow("null") << std::string() << std::string(); - //QTest::newRow("valid") << std::string("alert(\"hey!\")") << std::string("alert(\"hey!\")"); -} - -// public std::string evaluateJavascript(std::string script) -void tst_LLEmbeddedBrowserWindow::evaluateJavascript() -{ - QFETCH(std::string, script); - QFETCH(std::string, evaluateJavascript); - - SubLLEmbeddedBrowserWindow window; - - window.evaluateJavascript(script); -} - -void tst_LLEmbeddedBrowserWindow::flipWindow_data() -{ - QTest::addColumn("flip"); - QTest::addColumn("flipWindow"); - QTest::newRow("false") << false << true; - QTest::newRow("true") << true << true; -} - -// public bool flipWindow(bool flip) -void tst_LLEmbeddedBrowserWindow::flipWindow() -{ - QFETCH(bool, flip); - QFETCH(bool, flipWindow); - - SubLLEmbeddedBrowserWindow window; - - QCOMPARE(window.flipWindow(flip), flipWindow); -} - -void tst_LLEmbeddedBrowserWindow::focusBrowser_data() -{ - QTest::addColumn("focus_browser"); - QTest::newRow("true") << true; - QTest::newRow("false") << false; -} - -// public void focusBrowser(bool focus_browser) -void tst_LLEmbeddedBrowserWindow::focusBrowser() -{ - QFETCH(bool, focus_browser); - - SubLLEmbeddedBrowserWindow window; - window.focusBrowser(focus_browser); -} - -Q_DECLARE_METATYPE(int16_t) -void tst_LLEmbeddedBrowserWindow::getBrowserDepth_data() -{ -#if 0 - QTest::addColumn("getBrowserDepth"); - QTest::newRow("null") << int16_t(); -#endif -} - -// public int16_t getBrowserDepth() -void tst_LLEmbeddedBrowserWindow::getBrowserDepth() -{ - //QFETCH(int16_t, getBrowserDepth); - - SubLLEmbeddedBrowserWindow window; - - QCOMPARE(window.getBrowserDepth(), int16_t(4)); -} - -void tst_LLEmbeddedBrowserWindow::getBrowserHeight_data() -{ -#if 0 - QTest::addColumn("getBrowserHeight"); - QTest::newRow("null") << int16_t(); -#endif -} - -// public int16_t getBrowserHeight() -void tst_LLEmbeddedBrowserWindow::getBrowserHeight() -{ -#if 0 - QFETCH(int16_t, getBrowserHeight); - - SubLLEmbeddedBrowserWindow window; - - QCOMPARE(window.getBrowserHeight(), getBrowserHeight); -#endif - QSKIP("Test is same with setSize().", SkipAll); -} - -Q_DECLARE_METATYPE(int32_t) -void tst_LLEmbeddedBrowserWindow::getBrowserRowSpan_data() -{ -#if 0 - QTest::addColumn("getBrowserRowSpan"); - QTest::newRow("null") << int32_t(); -#endif -} - -// public int32_t getBrowserRowSpan() -void tst_LLEmbeddedBrowserWindow::getBrowserRowSpan() -{ -#if 0 - SubLLEmbeddedBrowserWindow window; - window.setSize(0, 0); - - QCOMPARE(window.getBrowserWidth(), int16_t(0)); - QCOMPARE(window.getBrowserRowSpan(), int32_t(0)); - window.setSize(100, 100); - - QCOMPARE(window.getBrowserWidth(), int16_t(100)); - QCOMPARE(window.getBrowserRowSpan(), int32_t(400)); -#endif - QSKIP("Test is same with setSize().", SkipAll); -} - -void tst_LLEmbeddedBrowserWindow::getBrowserWidth_data() -{ -#if 0 - QTest::addColumn("getBrowserWidth"); - QTest::newRow("null") << int16_t(); -#endif -} - -// public int16_t getBrowserWidth() -void tst_LLEmbeddedBrowserWindow::getBrowserWidth() -{ -#if 0 - //QFETCH(int16_t, getBrowserWidth); - - SubLLEmbeddedBrowserWindow window; - window.setSize(0, 0); - - QCOMPARE(window.getBrowserWidth(), int16_t(0)); - QCOMPARE(window.getBrowserHeight(), int16_t(0)); - window.setSize(100, 100); - - QCOMPARE(window.getBrowserWidth(), int16_t(100)); - QCOMPARE(window.getBrowserHeight(), int16_t(100)); -#endif - QSKIP("Test is same with setSize().", SkipAll); -} - -//Q_DECLARE_METATYPE(std::string const) -void tst_LLEmbeddedBrowserWindow::getClickLinkHref_data() -{ -#if 0 - QTest::addColumn("getClickLinkHref"); - QTest::newRow("null") << std::string const(); -#endif -} - -// public std::string const getClickLinkHref() -void tst_LLEmbeddedBrowserWindow::getClickLinkHref() -{ - //QFETCH(std::string const, getClickLinkHref); - - SubLLEmbeddedBrowserWindow window; - - window.getClickLinkHref(); -} - -void tst_LLEmbeddedBrowserWindow::getClickLinkTarget_data() -{ -#if 0 - QTest::addColumn("getClickLinkTarget"); - QTest::newRow("null") << std::string const(); -#endif -} - -// public std::string const getClickLinkTarget() -void tst_LLEmbeddedBrowserWindow::getClickLinkTarget() -{ - //QFETCH(std::string const, getClickLinkTarget); - - SubLLEmbeddedBrowserWindow window; - - window.getClickLinkTarget(); -} - -void tst_LLEmbeddedBrowserWindow::getCurrentUri_data() -{ -#if 0 - QTest::addColumn("getCurrentUri"); - QTest::newRow("null") << std::string const(); -#endif -} - -// public std::string const getCurrentUri() -void tst_LLEmbeddedBrowserWindow::getCurrentUri() -{ - //QFETCH(std::string const, getCurrentUri); - - SubLLEmbeddedBrowserWindow window; - window.navigateTo(std::string("http://www.google.ca/")); - QTRY_COMPARE(QString::fromStdString(window.getCurrentUri()), QString::fromStdString(std::string("http://www.google.ca/"))); -} - -void tst_LLEmbeddedBrowserWindow::getNoFollowScheme_data() -{ -#if 0 - QTest::addColumn("getNoFollowScheme"); - QTest::newRow("FTP") << std::string("FTP"); -#endif -} - -// public std::string getNoFollowScheme() -void tst_LLEmbeddedBrowserWindow::getNoFollowScheme() -{ - //QFETCH(std::string, getNoFollowScheme); - - SubLLEmbeddedBrowserWindow window; - window.setNoFollowScheme("FTP://www.google.com"); - - QCOMPARE(window.getNoFollowScheme(), std::string("FTP")); -} - -//Q_DECLARE_METATYPE(unsigned char*) -void tst_LLEmbeddedBrowserWindow::getPageBuffer_data() -{ -#if 0 - QTest::addColumn("getPageBuffer"); - QTest::newRow("null") << unsigned char*(); -#endif -} - -// public unsigned char* getPageBuffer() -void tst_LLEmbeddedBrowserWindow::getPageBuffer() -{ - //QFETCH(unsigned char*, getPageBuffer); - - SubLLEmbeddedBrowserWindow window; - window.setSize(100,100); - window.grabWindow(0, 0, 100, 100); - - QVERIFY(window.getPageBuffer() != NULL); -} - -//Q_DECLARE_METATYPE(int16_t const) -void tst_LLEmbeddedBrowserWindow::getPercentComplete_data() -{ -#if 0 - QTest::addColumn("getPercentComplete"); - QTest::newRow("null") << int16_t const(); -#endif -} - -// public int16_t const getPercentComplete() -void tst_LLEmbeddedBrowserWindow::getPercentComplete() -{ - //QFETCH(int16_t const, getPercentComplete); - SubLLEmbeddedBrowserWindow window; - window.navigateTo(std::string("http://www.google.com")); - QTest::qWait(1000); - QVERIFY(window.getPercentComplete() > 0); -} - -void tst_LLEmbeddedBrowserWindow::getStatusMsg_data() -{ -#if 0 - QTest::addColumn("getStatusMsg"); - QTest::newRow("null") << std::string const(); -#endif -} - -// public std::string const getStatusMsg() -void tst_LLEmbeddedBrowserWindow::getStatusMsg() -{ - //QFETCH(std::string const, getStatusMsg); - - SubLLEmbeddedBrowserWindow window; - window.navigateTo(std::string("http://www.google.com")); - QTest::qWait(1000); - window.navigateStop(); - window.navigateTo(std::string("http://www.yahoo.com")); - // Seems status msg will always be null during navigating. - //QTRY_VERIFY(QString::fromStdString(window.getStatusMsg())!= NULL); - QSKIP("Status msg will always be null during navigating", SkipAll); -} - -void tst_LLEmbeddedBrowserWindow::getWindowId_data() -{ -#if 0 - QTest::addColumn("getWindowId"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; -#endif -} - -// public int getWindowId() -void tst_LLEmbeddedBrowserWindow::getWindowId() -{ - //QFETCH(int, getWindowId); - - SubLLEmbeddedBrowserWindow window; - window.setWindowId(0); - QCOMPARE(window.getWindowId(), 0); - window.setWindowId(100); - QCOMPARE(window.getWindowId(), 100); -} - -void tst_LLEmbeddedBrowserWindow::grabWindow_data() -{ -#if 0 - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::addColumn("width"); - QTest::addColumn("height"); - QTest::addColumn("grabWindow"); - QTest::newRow("null") << 0 << 0 << 0 << 0 << 0; -#endif -} - -// public unsigned char* grabWindow(int x, int y, int width, int height) -void tst_LLEmbeddedBrowserWindow::grabWindow() -{ - QSKIP("Test is same with getPageBuffer().", SkipAll); -} - -void tst_LLEmbeddedBrowserWindow::keyPress_data() -{ - QTest::addColumn("key_code"); - QTest::newRow("null") << int16_t(0); - QTest::newRow("valid") << int16_t(0x0E); -} - -// public void keyPress(int16_t key_code) -void tst_LLEmbeddedBrowserWindow::keyPress() -{ - QFETCH(int16_t, key_code); - - SubLLEmbeddedBrowserWindow window; - window.keyPress(key_code); -} - -void tst_LLEmbeddedBrowserWindow::mouseDown_data() -{ - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::newRow("0") << int16_t(0) << int16_t(0); - QTest::newRow("bignumber") << int16_t(100000) << int16_t(100000); - QTest::newRow("valid") << int16_t(100) << int16_t(100); -} - -// public void mouseDown(int16_t x, int16_t y) -void tst_LLEmbeddedBrowserWindow::mouseDown() -{ - QFETCH(int16_t, x); - QFETCH(int16_t, y); - - SubLLEmbeddedBrowserWindow window; - window.mouseDown(x, y); -} - -void tst_LLEmbeddedBrowserWindow::mouseLeftDoubleClick_data() -{ - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::newRow("0") << int16_t(0) << int16_t(0); - QTest::newRow("bignumber") << int16_t(100000) << int16_t(100000); - QTest::newRow("valid") << int16_t(100) << int16_t(100); -} - -// public void mouseLeftDoubleClick(int16_t x, int16_t y) -void tst_LLEmbeddedBrowserWindow::mouseLeftDoubleClick() -{ - QFETCH(int16_t, x); - QFETCH(int16_t, y); - - SubLLEmbeddedBrowserWindow window; - window.mouseLeftDoubleClick(x, y); -} - -void tst_LLEmbeddedBrowserWindow::mouseMove_data() -{ - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::newRow("0") << int16_t(0) << int16_t(0); - QTest::newRow("bignumber") << int16_t(100000) << int16_t(100000); - QTest::newRow("valid") << int16_t(100) << int16_t(100); -} - -// public void mouseMove(int16_t x, int16_t y) -void tst_LLEmbeddedBrowserWindow::mouseMove() -{ - QFETCH(int16_t, x); - QFETCH(int16_t, y); - - SubLLEmbeddedBrowserWindow window; - window.mouseMove(x, y); -} - -void tst_LLEmbeddedBrowserWindow::mouseUp_data() -{ - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::newRow("0") << int16_t(0) << int16_t(0); - QTest::newRow("bignumber") << int16_t(100000) << int16_t(100000); - QTest::newRow("valid") << int16_t(100) << int16_t(100); -} - -// public void mouseUp(int16_t x, int16_t y) -void tst_LLEmbeddedBrowserWindow::mouseUp() -{ - QFETCH(int16_t, x); - QFETCH(int16_t, y); - - SubLLEmbeddedBrowserWindow window; - window.mouseUp(x, y); -} - -void tst_LLEmbeddedBrowserWindow::navigateBack_data() -{ -#if 0 - QTest::addColumn("foo"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; -#endif -} - -// public void navigateBack() -void tst_LLEmbeddedBrowserWindow::navigateBack() -{ - //QFETCH(int, foo); - - SubLLEmbeddedBrowserWindow window; - window.navigateTo(std::string("http://www.google.ca/")); - QTest::qWait(__TRY_TIMEOUT__); - QCOMPARE(window.canNavigateForward(), false); - window.navigateTo(std::string("http://www.yahoo.com/")); - QTest::qWait(__TRY_TIMEOUT__); - QCOMPARE(window.canNavigateBack(), true); - window.navigateBack(); - QTRY_COMPARE(QString::fromStdString((window.getCurrentUri())), QString("http://www.google.ca/")); - window.navigateBack(); - QTRY_COMPARE(QString::fromStdString((window.getCurrentUri())), QString("http://www.google.ca/")); -} - -void tst_LLEmbeddedBrowserWindow::navigateForward_data() -{ -#if 0 - QTest::addColumn("foo"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; -#endif -} - -// public void navigateForward() -void tst_LLEmbeddedBrowserWindow::navigateForward() -{ - // QFETCH(int, foo); - SubLLEmbeddedBrowserWindow window; - window.navigateTo(std::string("http://www.google.ca/")); - QTest::qWait(__TRY_TIMEOUT__); - QCOMPARE(window.canNavigateForward(), false); - window.navigateTo(std::string("http://www.yahoo.ca/")); - QTest::qWait(__TRY_TIMEOUT__); - QCOMPARE(window.canNavigateBack(), true); - window.navigateBack(); - QTRY_COMPARE(QString::fromStdString((window.getCurrentUri())), QString("http://www.google.ca/")); - window.navigateForward(); - QTRY_COMPARE(QString::fromStdString((window.getCurrentUri())), QString("http://ca.yahoo.com/")); - window.navigateForward(); - QTRY_COMPARE(QString::fromStdString((window.getCurrentUri())), QString("http://ca.yahoo.com/")); -} - -void tst_LLEmbeddedBrowserWindow::navigateReload_data() -{ -#if 0 - QTest::addColumn("foo"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; -#endif -} - -// public void navigateReload() -void tst_LLEmbeddedBrowserWindow::navigateReload() -{ - SubLLEmbeddedBrowserWindow window; - - window.navigateTo(std::string("http://www.google.ca/")); - QTest::qWait(__TRY_TIMEOUT__); - window.navigateReload(); - QTRY_COMPARE(QString::fromStdString((window.getCurrentUri())), QString("http://www.google.ca/")); -} - -void tst_LLEmbeddedBrowserWindow::navigateStop_data() -{ -#if 0 - QTest::addColumn("foo"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; -#endif -} - -// public void navigateStop() -void tst_LLEmbeddedBrowserWindow::navigateStop() -{ - SubLLEmbeddedBrowserWindow window; - window.navigateTo("www.google.com"); - window.navigateStop(); -} - -void tst_LLEmbeddedBrowserWindow::navigateTo_data() -{ - QTest::addColumn("uri"); - QTest::addColumn("navigateTo"); - QTest::newRow("null") << std::string() << std::string(); - QTest::newRow("valid") << std::string("http://www.google.ca/") << std::string("http://www.google.ca/"); -} - -// public bool navigateTo(std::string const uri) -void tst_LLEmbeddedBrowserWindow::navigateTo() -{ - QSKIP("Test is same with navigateBack(), navigateForward().", SkipAll); -} - -void tst_LLEmbeddedBrowserWindow::remObserver_data() -{ -#if 0 - QTest::addColumn("observerCount"); - QTest::addColumn("remObserver"); - QTest::newRow("null") << 0 << false; -#endif -} - -// public bool remObserver(LLEmbeddedBrowserWindowObserver* observer) -void tst_LLEmbeddedBrowserWindow::remObserver() -{ -// QFETCH(int, observerCount); -// QFETCH(bool, remObserver); - - SubLLEmbeddedBrowserWindow window; - LLEmbeddedBrowserWindowObserver* observer = new LLEmbeddedBrowserWindowObserver(); - window.addObserver(observer); - QCOMPARE(window.getObserverNumber(), 1); - window.remObserver(observer); - QCOMPARE(window.getObserverNumber(), 0); -} - -void tst_LLEmbeddedBrowserWindow::scrollByLines_data() -{ - QTest::addColumn("lines"); - QTest::newRow("null") << int16_t(0); - QTest::addColumn("lines"); - QTest::newRow("100") << int16_t(100); -} - -// public void scrollByLines(int16_t lines) -void tst_LLEmbeddedBrowserWindow::scrollByLines() -{ - QFETCH(int16_t, lines); - - SubLLEmbeddedBrowserWindow window; - - window.scrollByLines(lines); -} - -Q_DECLARE_METATYPE(uint8_t) -void tst_LLEmbeddedBrowserWindow::setBackgroundColor_data() -{ - QTest::addColumn("red"); - QTest::addColumn("green"); - QTest::addColumn("blue"); - QTest::newRow("black") << uint8_t(0) << uint8_t(0) << uint8_t(0); - QTest::newRow("red") << uint8_t(255) << uint8_t(0) << uint8_t(0); - QTest::newRow("green") << uint8_t(0) << uint8_t(255) << uint8_t(0); - QTest::newRow("blue") << uint8_t(0) << uint8_t(0) << uint8_t(255); -} - -// public void setBackgroundColor(uint8_t const red, uint8_t const green, uint8_t const blue) -void tst_LLEmbeddedBrowserWindow::setBackgroundColor() -{ - QFETCH(uint8_t, red); - QFETCH(uint8_t, green); - QFETCH(uint8_t, blue); - - SubLLEmbeddedBrowserWindow window; - - window.setBackgroundColor(red, green, blue); -} - -void tst_LLEmbeddedBrowserWindow::setCaretColor_data() -{ - QTest::addColumn("red"); - QTest::addColumn("green"); - QTest::addColumn("blue"); - QTest::newRow("black") << uint8_t(0) << uint8_t(0) << uint8_t(0); - QTest::newRow("red") << uint8_t(255) << uint8_t(0) << uint8_t(0); - QTest::newRow("green") << uint8_t(0) << uint8_t(255) << uint8_t(0); - QTest::newRow("blue") << uint8_t(0) << uint8_t(0) << uint8_t(255); -} - -// public void setCaretColor(uint8_t const red, uint8_t const green, uint8_t const blue) -void tst_LLEmbeddedBrowserWindow::setCaretColor() -{ - QFETCH(uint8_t, red); - QFETCH(uint8_t, green); - QFETCH(uint8_t, blue); - - SubLLEmbeddedBrowserWindow window; - - window.setCaretColor(red, green, blue); -} - -void tst_LLEmbeddedBrowserWindow::setEnabled_data() -{ - QTest::addColumn("enabledIn"); - QTest::newRow("true") << true; - QTest::newRow("false") << false; -} - -// public void setEnabled(bool enabledIn) -void tst_LLEmbeddedBrowserWindow::setEnabled() -{ - QFETCH(bool, enabledIn); - - SubLLEmbeddedBrowserWindow window; - - window.setEnabled(enabledIn); -} - -void tst_LLEmbeddedBrowserWindow::setNoFollowScheme_data() -{ - QTest::addColumn("scheme"); - QTest::addColumn("result"); - QTest::newRow("null") << std::string() << std::string(); - QTest::newRow("valid") << std::string("ftp://www.google.com") << std::string("ftp");; -} - -// public void setNoFollowScheme(std::string scheme) -void tst_LLEmbeddedBrowserWindow::setNoFollowScheme() -{ - QFETCH(std::string, scheme); - QFETCH(std::string, result); - - SubLLEmbeddedBrowserWindow window; - - window.setNoFollowScheme(scheme); - QCOMPARE(window.getNoFollowScheme(), result); -} - -void tst_LLEmbeddedBrowserWindow::setParent_data() -{ -#if 0 - QTest::addColumn("parentCount"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; -#endif -} - -// public void setParent(LLEmbeddedBrowser* parent) -void tst_LLEmbeddedBrowserWindow::setParent() -{ -#if 0 - QFETCH(int, parentCount); - - SubLLEmbeddedBrowserWindow window; - LLEmbeddedBrowser* parent = new LLEmbeddedBrowser(); - - window.setParent(parent); -#endif - QSKIP("Has been tested before.", SkipAll); -} - -void tst_LLEmbeddedBrowserWindow::setSize_data() -{ - QTest::addColumn("width"); - QTest::addColumn("height"); - QTest::addColumn("setSize"); - QTest::newRow("null") << int16_t(0) << int16_t(0) << true; - QTest::newRow("valid") << int16_t(100) << int16_t(200) << true; -} - -// public bool setSize(int16_t width, int16_t height) -void tst_LLEmbeddedBrowserWindow::setSize() -{ - QFETCH(int16_t, width); - QFETCH(int16_t, height); - QFETCH(bool, setSize); - - SubLLEmbeddedBrowserWindow window; - QCOMPARE(window.setSize(width, height), setSize); - window.grabWindow(0, 0, 800, 600); - - QCOMPARE(window.getBrowserWidth(), width); - QCOMPARE(window.getBrowserHeight(), height); - QCOMPARE(window.getBrowserRowSpan(), (int32_t)width * 4); -} - -void tst_LLEmbeddedBrowserWindow::setWindowId_data() -{ - QTest::addColumn("window_id"); - QTest::newRow("0") << 0; - QTest::newRow("-1") << -1; - QTest::newRow("100") << 100; -} - -// public void setWindowId(int window_id) -void tst_LLEmbeddedBrowserWindow::setWindowId() -{ - QFETCH(int, window_id); - - SubLLEmbeddedBrowserWindow window; - - window.setWindowId(window_id); - QCOMPARE(window.getWindowId(), window_id); -} - -Q_DECLARE_METATYPE(uint32_t) -void tst_LLEmbeddedBrowserWindow::unicodeInput_data() -{ - QTest::addColumn("unicode_char"); - QTest::newRow("null") << uint32_t(); - QTest::newRow("valid") << uint32_t(54); -} - -// public void unicodeInput(uint32_t unicode_char) -void tst_LLEmbeddedBrowserWindow::unicodeInput() -{ - QFETCH(uint32_t, unicode_char); - - SubLLEmbeddedBrowserWindow window; - - window.unicodeInput(unicode_char); -} - -QTEST_MAIN(tst_LLEmbeddedBrowserWindow) -#include "tst_llembeddedbrowserwindow.moc" - diff --git a/indra/llqtwebkit/llembeddedbrowser.cpp b/indra/llqtwebkit/llembeddedbrowser.cpp deleted file mode 100644 index f38019b9b..000000000 --- a/indra/llqtwebkit/llembeddedbrowser.cpp +++ /dev/null @@ -1,759 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include "llembeddedbrowser.h" - -#include "llembeddedbrowser_p.h" -#include "llembeddedbrowserwindow.h" -#include "llnetworkaccessmanager.h" -#include "llstyle.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// singleton pattern - initialization -LLEmbeddedBrowser* LLEmbeddedBrowser::sInstance = 0; - -LLEmbeddedBrowserPrivate::LLEmbeddedBrowserPrivate() - : mErrorNum(0) - , mNativeWindowHandle(0) - , mNetworkAccessManager(0) - , mApplication(0) -#if QT_VERSION >= 0x040500 - , mDiskCache(0) -#endif - , mNetworkCookieJar(0) - , mHostLanguage( "en" ) - , mIgnoreSSLCertErrors(false) -{ - if (!qApp) - { - static int argc = 0; - static const char* argv[] = {""}; - QApplication::setAttribute(Qt::AA_MacPluginApplication); - QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); - - mApplication = new QApplication(argc, (char **)argv); - mApplication->addLibraryPath(qApp->applicationDirPath()); - } - qApp->setStyle(new LLStyle()); - mNetworkAccessManager = new LLNetworkAccessManager(this); -#if LL_DARWIN - // HACK: Qt installs CarbonEvent handlers that steal events from our main event loop. - // This uninstalls them. - // It's not clear whether calling this internal function is really a good idea. It's probably not. - // It does, however, seem to fix at least one problem ( https://jira.secondlife.com/browse/MOZ-12 ). - extern void qt_release_app_proc_handler(); - qt_release_app_proc_handler(); - - // This is defined and exported from qwidget_mac.mm. - // Calling it with false should prevent qwidget from bringing its process to the foreground, such as when bringing up a popup menu. - extern void qt_mac_set_raise_process(bool b); - qt_mac_set_raise_process(false); -#endif -} - -LLEmbeddedBrowserPrivate::~LLEmbeddedBrowserPrivate() -{ - delete mApplication; - delete mNetworkAccessManager; - delete mNetworkCookieJar; -} - - - -LLEmbeddedBrowser::LLEmbeddedBrowser() - : d(new LLEmbeddedBrowserPrivate) - , mPluginsEnabled( false ) - , mJavaScriptEnabled( false ) - , mCookiesEnabled( false ) -{ -} - -LLEmbeddedBrowser::~LLEmbeddedBrowser() -{ - if(d->mNetworkCookieJar) - { - d->mNetworkCookieJar->mBrowser = NULL; - } - - delete d; -} - -LLEmbeddedBrowser* LLEmbeddedBrowser::getInstance() -{ - if (!sInstance) - sInstance = new LLEmbeddedBrowser; - return sInstance; -} - -void LLEmbeddedBrowser::setLastError(int error_number) -{ - d->mErrorNum = error_number; -} - -void LLEmbeddedBrowser::clearLastError() -{ - d->mErrorNum = 0x0000; -} - -int LLEmbeddedBrowser::getLastError() -{ - return d->mErrorNum; -} - -std::string LLEmbeddedBrowser::getGREVersion() -{ - // take the string directly from Qt - return std::string(QT_VERSION_STR); -} - -bool LLEmbeddedBrowser::init(std::string application_directory, - std::string component_directory, - std::string profile_directory, - void* native_window_handle) -{ - Q_UNUSED(application_directory); - Q_UNUSED(component_directory); - Q_UNUSED(native_window_handle); - d->mStorageDirectory = QString::fromStdString(profile_directory); - QWebSettings::setIconDatabasePath(d->mStorageDirectory); - // The gif and jpeg libraries should be installed in component_directory/imageformats/ - QCoreApplication::addLibraryPath(QString::fromStdString(component_directory)); - - // turn on plugins by default - enablePlugins( true ); - - // Until QtWebkit defaults to 16 - QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFontSize, 16); - QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFixedFontSize, 16); - - - QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); - QWebSettings::globalSettings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); - - // use default text encoding - not sure how this helps right now so commenting out until we - // understand how to use it a little better. - //QWebSettings::globalSettings()->setDefaultTextEncoding ( "" ); - - return reset(); -} - -bool LLEmbeddedBrowser::reset() -{ - foreach(LLEmbeddedBrowserWindow *window, d->windows) - delete window; - d->windows.clear(); - delete d->mNetworkAccessManager; - d->mNetworkAccessManager = new LLNetworkAccessManager(d); -#if QT_VERSION >= 0x040500 - d->mDiskCache = new QNetworkDiskCache(d->mNetworkAccessManager); - d->mDiskCache->setCacheDirectory(d->mStorageDirectory + "/cache"); - if (QLatin1String(qVersion()) != QLatin1String("4.5.1")) - d->mNetworkAccessManager->setCache(d->mDiskCache); -#endif - d->mNetworkCookieJar = new LLNetworkCookieJar(d->mNetworkAccessManager, this); - d->mNetworkAccessManager->setCookieJar(d->mNetworkCookieJar); - clearLastError(); - return true; -} - -bool LLEmbeddedBrowser::clearCache() -{ -#if QT_VERSION >= 0x040500 - if (d->mDiskCache) - { - d->mDiskCache->clear(); - return true; - } -#endif - return false; -} - -bool LLEmbeddedBrowser::enableProxy(bool enabled, std::string host_name, int port) -{ - QNetworkProxy proxy; - if (enabled) - { - proxy.setType(QNetworkProxy::HttpProxy); - QString q_host_name = QString::fromStdString(host_name); - proxy.setHostName(q_host_name); - proxy.setPort(port); - } - d->mNetworkAccessManager->setProxy(proxy); - return true; -} - -bool LLEmbeddedBrowser::clearAllCookies() -{ - if (!d->mNetworkCookieJar) - return false; - d->mNetworkCookieJar->clear(); - return true; -} - -void LLEmbeddedBrowser::setCookies(const std::string &cookies) -{ - if (d->mNetworkCookieJar) - { - d->mNetworkCookieJar->setCookiesFromRawForm(cookies); - } -} - -std::string LLEmbeddedBrowser::getAllCookies() -{ - std::string result; - - if (d->mNetworkCookieJar) - { - result = d->mNetworkCookieJar->getAllCookiesInRawForm(); - } - - return result; -} - -void LLEmbeddedBrowser::enableCookies( bool enabled ) -{ - mCookiesEnabled = enabled; - enableCookiesTransient( mCookiesEnabled ); -} - -void LLEmbeddedBrowser::enableCookiesTransient( bool enabled ) -{ - if ( d->mNetworkCookieJar ) - { - d->mNetworkCookieJar->mAllowCookies = enabled; - } -} - -bool LLEmbeddedBrowser::areCookiesEnabled() -{ - return mCookiesEnabled; -} - -void LLEmbeddedBrowser::enablePlugins( bool enabled ) -{ - mPluginsEnabled = enabled; // record state - enablePluginsTransient( mPluginsEnabled ); -} - -void LLEmbeddedBrowser::enablePluginsTransient( bool enabled ) -{ - QWebSettings* default_settings = QWebSettings::globalSettings(); - default_settings->setAttribute( QWebSettings::PluginsEnabled, enabled ); -} - -bool LLEmbeddedBrowser::arePluginsEnabled() -{ - return mPluginsEnabled; -} - -void LLEmbeddedBrowser::enableJavaScript( bool enabled ) -{ - mJavaScriptEnabled = enabled; // record state - enableJavaScriptTransient( mJavaScriptEnabled ); -} - -void LLEmbeddedBrowser::enableJavaScriptTransient( bool enabled ) -{ - QWebSettings* default_settings = QWebSettings::globalSettings(); - default_settings->setAttribute( QWebSettings::JavascriptEnabled, enabled ); - default_settings->setAttribute( QWebSettings::JavascriptCanOpenWindows, enabled ); -} - -bool LLEmbeddedBrowser::isJavaScriptEnabled() -{ - return mJavaScriptEnabled; -} - -bool LLEmbeddedBrowser::showWebInspector(bool show) -{ - QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, show); - foreach (LLEmbeddedBrowserWindow* window, d->windows) - { - window->showWebInspector(show); - } - return true; -} - -/* - Sets a string that should be addded to the user agent to identify the application -*/ -void LLEmbeddedBrowser::setBrowserAgentId(std::string id) -{ - QCoreApplication::setApplicationName(QString::fromStdString(id)); -} - -// updates value of 'hostLanguage' in JavaScript 'Navigator' obect that -// embedded pages can query to see what language the host app is set to -// IMPORTANT: call this before any windows are created - only gets passed -// to LLWebPage when new window is created -void LLEmbeddedBrowser::setHostLanguage( const std::string& host_language ) -{ - d->mHostLanguage = host_language; -} - -LLEmbeddedBrowserWindow* LLEmbeddedBrowser::createBrowserWindow(int width, int height, const std::string target) -{ - LLEmbeddedBrowserWindow *newWin = new LLEmbeddedBrowserWindow(); - if (newWin) - { - newWin->setSize(width, height); - newWin->setParent(this); - newWin->setHostLanguage(d->mHostLanguage); - clearLastError(); - d->windows.append(newWin); - - if(!target.empty() && (target != "_blank")) - { - newWin->setTarget(target); - } - - return newWin; - } - return 0; -} - -bool LLEmbeddedBrowser::destroyBrowserWindow(LLEmbeddedBrowserWindow* browser_window) -{ - // check if exists in windows list - if (d->windows.removeOne(browser_window)) - { - delete browser_window; - clearLastError(); - return true; - } - return false; -} - -int LLEmbeddedBrowser::getWindowCount() const -{ - return d->windows.size(); -} - -void LLEmbeddedBrowser::pump(int max_milliseconds) -{ -#if 0 - // This USED to be necessary on the mac, but with Qt 4.6 it seems to cause trouble loading some pages, - // and using processEvents() seems to work properly now. - // Leaving this here in case these issues ever come back. - - // On the Mac, calling processEvents hangs the viewer. - // I'm not entirely sure this does everything we need, but it seems to work better, and allows things like animated gifs to work. - qApp->sendPostedEvents(); - qApp->sendPostedEvents(0, QEvent::DeferredDelete); -#else - qApp->processEvents(QEventLoop::AllEvents, max_milliseconds); -#endif -} - -void LLEmbeddedBrowser::cookieChanged(const std::string &cookie, const std::string &url, bool dead) -{ - foreach (LLEmbeddedBrowserWindow* window, d->windows) - { - window->cookieChanged(cookie, url, dead); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLEmbeddedBrowser::setCAFile(const std::string &ca_file) -{ - bool result = false; - //qDebug() << "LLEmbeddedBrowser::" << __FUNCTION__ << "attempting to read certs from file: " << QString::fromStdString(ca_file); - - // Extract the list of certificates from the specified file - QList certs = QSslCertificate::fromPath(QString::fromStdString(ca_file)); - - if(!certs.isEmpty()) - { - //qDebug() << "LLEmbeddedBrowser::" << __FUNCTION__ << "certs read: " << certs; - - // Set the default CA cert for Qt's SSL implementation. - QSslConfiguration config = QSslConfiguration::defaultConfiguration(); - config.setCaCertificates(certs); - QSslConfiguration::setDefaultConfiguration(config); - result = true; - } - - return result; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLEmbeddedBrowser::addCAFile(const std::string &ca_file) -{ - // Enabling this can help diagnose certificate verification issues. - const bool cert_debugging_on = false; - - if ( cert_debugging_on ) - { - //qDebug() << "\n\nLLEmbeddedBrowser::" << __FUNCTION__ << " ------------------- (Before add)"; - QSslCertificate cert; - foreach(cert, QSslSocket::defaultCaCertificates()) - { - //qDebug() << cert.issuerInfo(QSslCertificate::CommonName) << " --- " << cert.subjectInfo(QSslCertificate::CommonName); - } - } - - bool result = false; - //qDebug() << "LLEmbeddedBrowser::" << __FUNCTION__ << "attempting to read certs from file: " << QString::fromStdString(ca_file); - - if ( cert_debugging_on ) - { - //qDebug() << "\n\nLLEmbeddedBrowser::" << __FUNCTION__ << " ------------------- (From CA.pem)"; - QList certs = QSslCertificate::fromPath(QString::fromStdString(ca_file)); - QSslCertificate cert; - foreach(cert, certs) - { - //qDebug() << cert.issuerInfo(QSslCertificate::CommonName) << " --- " << cert.subjectInfo(QSslCertificate::CommonName); - } - } - - result = QSslSocket::addDefaultCaCertificates(QString::fromStdString(ca_file)); - - if ( cert_debugging_on ) - { - //qDebug() << "\n\nLLEmbeddedBrowser::" << __FUNCTION__ << " ------------------- (After add)"; - QSslCertificate cert; - foreach(cert, QSslSocket::defaultCaCertificates()) - { - //qDebug() << cert.issuerInfo(QSslCertificate::CommonName) << " --- " << cert.subjectInfo(QSslCertificate::CommonName); - } - } - - return result; -} - -void LLEmbeddedBrowser::setIgnoreSSLCertErrors(bool ignore) -{ - d->mIgnoreSSLCertErrors = ignore; -} - -bool LLEmbeddedBrowser::getIgnoreSSLCertErrors() -{ - return d->mIgnoreSSLCertErrors; -} - -const std::vector< std::string > LLEmbeddedBrowser::getInstalledCertsList() -{ - std::vector< std::string > cert_list; - - QSslCertificate cert; - foreach(cert, QSslSocket::defaultCaCertificates()) - { - QString cert_info=""; - - QString issuer_info=""; - issuer_info+="C="; - issuer_info+=cert.issuerInfo(QSslCertificate::CountryName); - issuer_info+=", ST="; - issuer_info+=cert.issuerInfo(QSslCertificate::StateOrProvinceName); - issuer_info+=", L="; - issuer_info+=cert.issuerInfo(QSslCertificate::LocalityName); - issuer_info+=", O="; - issuer_info+=cert.issuerInfo(QSslCertificate::Organization); - issuer_info+=", OU="; - issuer_info+=cert.issuerInfo(QSslCertificate::OrganizationalUnitName); - issuer_info+=", CN="; - issuer_info+=cert.issuerInfo(QSslCertificate::CommonName); - cert_info+=issuer_info; - cert_info+="\n"; - - QString subject_info=""; - subject_info+="C="; - subject_info+=cert.subjectInfo(QSslCertificate::CountryName); - subject_info+=", ST="; - subject_info+=cert.subjectInfo(QSslCertificate::StateOrProvinceName); - subject_info+=", L="; - subject_info+=cert.subjectInfo(QSslCertificate::LocalityName); - subject_info+=", O="; - subject_info+=cert.subjectInfo(QSslCertificate::Organization); - subject_info+=", OU="; - subject_info+=cert.subjectInfo(QSslCertificate::OrganizationalUnitName); - subject_info+=", CN="; - subject_info+=cert.subjectInfo(QSslCertificate::CommonName); - cert_info+=subject_info; - cert_info+="\n"; - - cert_info+="Not valid before: "; - cert_info+=cert.effectiveDate().toString(); - cert_info+="\n"; - cert_info+="Not valid after: "; - cert_info+=cert.expiryDate().toString(); - cert_info+="\n"; - - cert_list.push_back( llToStdString(cert_info) ); - } - return cert_list; -} - -// Second Life viewer specific functions -void LLEmbeddedBrowser::setSLObjectEnabled( bool enabled ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setSLObjectEnabled( enabled ); - } -} - -void LLEmbeddedBrowser::setAgentLanguage( const std::string& agent_language ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setAgentLanguage( agent_language ); - } -} - -void LLEmbeddedBrowser::setAgentRegion( const std::string& agent_region ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setAgentRegion( agent_region ); - } -} - -void LLEmbeddedBrowser::setAgentLocation( double x, double y, double z ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setAgentLocation( x, y, z ); - } -} - -void LLEmbeddedBrowser::setAgentGlobalLocation( double x, double y, double z ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setAgentGlobalLocation( x, y, z ); - } -} - -void LLEmbeddedBrowser::setAgentOrientation( double angle ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setAgentOrientation( angle ); - } -} - -void LLEmbeddedBrowser::setAgentMaturity( const std::string& agent_maturity ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setAgentMaturity( agent_maturity ); - } -} - -void LLEmbeddedBrowser::emitLocation() -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->emitLocation(); - } -} - -void LLEmbeddedBrowser::emitMaturity() -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->emitMaturity(); - } -} - -void LLEmbeddedBrowser::emitLanguage() -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->emitLanguage(); - } -} - -void LLEmbeddedBrowser::setPageZoomFactor( double factor ) -{ - foreach ( LLEmbeddedBrowserWindow* window, d->windows ) - { - window->setPageZoomFactor( factor ); - } -} - -void LLEmbeddedBrowser::qtMessageHandler(QtMsgType type, const char *msg) -{ - std::string msg_type(""); - switch (type) - { - case QtDebugMsg: - msg_type="Debug"; - break; - case QtWarningMsg: - msg_type="Warning"; - break; - case QtCriticalMsg: - msg_type="Critical"; - break; - case QtFatalMsg: - msg_type="Fatal"; - break; - }; - - foreach ( LLEmbeddedBrowserWindow* window, sInstance->d->windows ) - { - - window->onQtDebugMessage( std::string( msg ), msg_type); - } -} - -void LLEmbeddedBrowser::enableQtMessageHandler( bool enable ) -{ - if ( enable ) - { - qInstallMsgHandler( qtMessageHandler ); - } - else - { - // remove handler - qInstallMsgHandler(0); - }; -} - -LLNetworkCookieJar::LLNetworkCookieJar(QObject* parent, LLEmbeddedBrowser *browser) - : NetworkCookieJar(parent) - , mAllowCookies(true) - , mBrowser(browser) -{ -} - -LLNetworkCookieJar::~LLNetworkCookieJar() -{ -} - -QList LLNetworkCookieJar::cookiesForUrl(const QUrl& url) const -{ - if (!mAllowCookies) - return QList(); - return NetworkCookieJar::cookiesForUrl(url); -} - -bool LLNetworkCookieJar::setCookiesFromUrl(const QList &cookie_list, const QUrl& url) -{ - if (!mAllowCookies) - return false; - return NetworkCookieJar::setCookiesFromUrl(cookie_list, url); -} - -void LLNetworkCookieJar::onCookieSetFromURL(const QNetworkCookie &cookie, const QUrl &url, bool already_dead) -{ -// qDebug() << "LLNetworkCookieJar::" << __FUNCTION__ << (already_dead?"set dead cookie":"set cookie ") << cookie; - - if(mBrowser) - { - QByteArray cookie_bytes = cookie.toRawForm(QNetworkCookie::Full); - std::string cookie_string(cookie_bytes.data(), cookie_bytes.size()); - std::string url_string = llToStdString(url); - mBrowser->cookieChanged(cookie_string, url_string, already_dead); - } -} - -void LLNetworkCookieJar::clear() -{ - clearCookies(); -} - -void LLNetworkCookieJar::setCookiesFromRawForm(const std::string &cookie_string) -{ - QByteArray cookie_bytearray(cookie_string.data(), cookie_string.size()); - QList cookie_list = QNetworkCookie::parseCookies(cookie_bytearray); - setCookies(cookie_list); -} - -std::string LLNetworkCookieJar::getAllCookiesInRawForm() -{ - std::string result; - - QList cookie_list = allCookies(); - - foreach (const QNetworkCookie &cookie, cookie_list) - { - QByteArray raw_form = cookie.toRawForm(QNetworkCookie::Full); - result.append(raw_form.data(), raw_form.size()); - result.append("\n"); - } - - return result; -} - -#include "llembeddedbrowserwindow_p.h" -#include - -QGraphicsWebView *LLEmbeddedBrowserPrivate::findView(QNetworkReply *reply) -{ - for (int i = 0; i < windows.count(); ++i) - if (windows[i]->d->mView->url() == reply->url()) - return windows[i]->d->mView; - return windows[0]->d->mView; -} - -bool LLEmbeddedBrowserPrivate::authRequest(const std::string &in_url, const std::string &in_realm, std::string &out_username, std::string &out_password) -{ - bool result = false; - -// qDebug() << "LLEmbeddedBrowser::" << __FUNCTION__ << "requesting auth for url " << QString::fromStdString(in_url) << ", realm " << QString::fromStdString(in_realm); -// -// qDebug() << "LLEmbeddedBrowser::" << __FUNCTION__ << "window count is " << windows.count(); - - if(windows.count() > 1) - { - qDebug() << "LLEmbeddedBrowser::" << __FUNCTION__ << "WARNING: authRequest called with more than one window, using the first one"; - } - - LLEmbeddedBrowserWindow* window = windows.first(); - - if(window) - { - result = window->authRequest(in_url, in_realm, out_username, out_password); - } - - return result; -} - -bool LLEmbeddedBrowserPrivate::certError(const std::string &in_url, const std::string &in_msg) -{ - bool result = false; - - LLEmbeddedBrowserWindow* window = windows.first(); - if(window) - { - result = window->certError(in_url, in_msg); - } - - return result; -} diff --git a/indra/llqtwebkit/llembeddedbrowser.h b/indra/llqtwebkit/llembeddedbrowser.h deleted file mode 100644 index c21a6b063..000000000 --- a/indra/llqtwebkit/llembeddedbrowser.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLEMBEDDEDBROWSER_H -#define LLEMBEDDEDBROWSER_H - -#include -#include -#include -#include - -class LLEmbeddedBrowserWindow; -class LLEmbeddedBrowserWindowObserver; - -class LLEmbeddedBrowserPrivate; -class LLEmbeddedBrowser -{ - public: - LLEmbeddedBrowser(); - virtual ~LLEmbeddedBrowser(); - - static LLEmbeddedBrowser* getInstance(); - - bool init(std::string application_directory, - std::string component_directory, - std::string profile_directory, - void* native_window_handle); - bool reset(); - bool clearCache(); - bool enableProxy(bool enabled, std::string host_name, int port); - bool clearAllCookies(); - void setCookies(const std::string &cookies); - std::string getAllCookies(); - - void enableCookies( bool enabled ); - void enableCookiesTransient( bool enabled ); - bool areCookiesEnabled(); - void enablePlugins( bool enabled ); - void enablePluginsTransient( bool enabled ); - bool arePluginsEnabled(); - void enableJavaScript( bool enabled ); - void enableJavaScriptTransient( bool enabled ); - bool isJavaScriptEnabled(); - - bool showWebInspector(bool show); - std::string getGREVersion(); - void setBrowserAgentId(std::string id); - void setHostLanguage( const std::string& host_language ); - LLEmbeddedBrowserWindow* createBrowserWindow(int width, int height, const std::string target); - bool destroyBrowserWindow(LLEmbeddedBrowserWindow* browser_window); - void setLastError(int error_number); - void clearLastError(); - int getLastError(); - int getWindowCount() const; - void pump(int max_milliseconds); - void cookieChanged(const std::string &cookie, const std::string &url, bool dead); - bool setCAFile(const std::string &ca_file); - bool addCAFile(const std::string &ca_file); - void setIgnoreSSLCertErrors(bool ignore); - bool getIgnoreSSLCertErrors(); - const std::vector< std::string > getInstalledCertsList(); - - void enableQtMessageHandler( bool enable ); - - void setPageZoomFactor( double factor ); - - // Second Life specific functions - void setSLObjectEnabled( bool enabled ); - void setAgentLanguage( const std::string& agent_language ); - void setAgentRegion( const std::string& agent_region ); - void setAgentLocation( double x, double y, double z ); - void setAgentGlobalLocation( double x, double y, double z ); - void setAgentOrientation( double angle ); - void setAgentMaturity( const std::string& agent_maturity ); - void emitLocation(); - void emitMaturity(); - void emitLanguage(); - - private: - friend class LLEmbeddedBrowserWindow; - friend class LLEmbeddedBrowserWindowPrivate; - LLEmbeddedBrowserPrivate *d; - bool mPluginsEnabled; - bool mJavaScriptEnabled; - bool mCookiesEnabled; - - static void qtMessageHandler(QtMsgType type, const char *msg); - - static LLEmbeddedBrowser* sInstance; -}; - -#endif // LLEMBEDDEDBROWSER_H - diff --git a/indra/llqtwebkit/llembeddedbrowser_p.h b/indra/llqtwebkit/llembeddedbrowser_p.h deleted file mode 100644 index 9f9f9cd02..000000000 --- a/indra/llqtwebkit/llembeddedbrowser_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLEMBEDDEDBROWSER_P_H -#define LLEMBEDDEDBROWSER_P_H - -#include -#include -#if QT_VERSION >= 0x040500 -#include -#endif - -#include "networkcookiejar.h" -#include "llembeddedbrowser.h" - -#include - -class LLEmbeddedBrowser; -class LLNetworkCookieJar : public NetworkCookieJar -{ -public: - LLNetworkCookieJar(QObject *parent, LLEmbeddedBrowser *browser); - ~LLNetworkCookieJar(); - - QList cookiesForUrl(const QUrl& url) const; - bool setCookiesFromUrl(const QList &cookie_list, const QUrl& url); - - /*virtual*/ void onCookieSetFromURL(const QNetworkCookie &cookie, const QUrl &url, bool already_dead); - - void clear(); - - void setCookiesFromRawForm(const std::string &cookie_string); - std::string getAllCookiesInRawForm(); - - bool mAllowCookies; - LLEmbeddedBrowser *mBrowser; -}; - -class LLNetworkAccessManager; -class LLEmbeddedBrowserPrivate -{ -public: - LLEmbeddedBrowserPrivate(); - ~LLEmbeddedBrowserPrivate(); - - bool authRequest(const std::string &in_url, const std::string &in_realm, std::string &out_username, std::string &out_password); - bool certError(const std::string &in_url, const std::string &in_msg); - - int mErrorNum; - void* mNativeWindowHandle; - LLNetworkAccessManager *mNetworkAccessManager; - QApplication *mApplication; -#if QT_VERSION >= 0x040500 - QNetworkDiskCache *mDiskCache; -#endif - LLNetworkCookieJar *mNetworkCookieJar; - - QGraphicsWebView *findView(QNetworkReply *); - - QString mStorageDirectory; - QList windows; - - std::string mHostLanguage; - bool mIgnoreSSLCertErrors; -}; - -#endif - diff --git a/indra/llqtwebkit/llembeddedbrowserwindow.cpp b/indra/llqtwebkit/llembeddedbrowserwindow.cpp deleted file mode 100644 index c990d5567..000000000 --- a/indra/llqtwebkit/llembeddedbrowserwindow.cpp +++ /dev/null @@ -1,1136 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "llembeddedbrowserwindow.h" -#include "llembeddedbrowserwindow_p.h" - -#include "llembeddedbrowser.h" -#include "llembeddedbrowser_p.h" -#include "llnetworkaccessmanager.h" - -#ifdef STATIC_QT - #include - // Enable gif and jpeg plugins, since web pages look pretty bleak without gifs or jpegs. - // Qt 4.7 uses the system gif and jpeg libraries by default, so this is no longer necessary. -// Q_IMPORT_PLUGIN(qgif) -// Q_IMPORT_PLUGIN(qjpeg) -#ifndef LL_LINUX - // Qt also has its own translators for CJK text encodings we need to pull in. - Q_IMPORT_PLUGIN(qcncodecs) - Q_IMPORT_PLUGIN(qjpcodecs) - Q_IMPORT_PLUGIN(qkrcodecs) - Q_IMPORT_PLUGIN(qtwcodecs) -#endif -#endif - -//#define LLEMBEDDEDBROWSER_DEBUG 1 - -#ifdef LLEMBEDDEDBROWSER_DEBUG -#include -#endif - -#if LL_DARWIN || defined(STATIC_QT) - // Don't define qt_sendSpontaneousEvent on the mac -- it causes a multiply-defined symbol. - extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); -#else - #include - bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event) - { - return QCoreApplication::sendSpontaneousEvent(receiver, event); - } -#endif - -LLEmbeddedBrowserWindow::LLEmbeddedBrowserWindow() -{ - d = new LLEmbeddedBrowserWindowPrivate(); - - d->mPage = new LLWebPage; - d->mInspector = new QWebInspector; - d->mInspector->setPage(d->mPage); - d->mPage->window = this; - d->mView = new LLWebView; - d->mPage->webView = d->mView; - d->mView->window = this; - d->mView->setPage(d->mPage); - d->mGraphicsScene = new LLGraphicsScene; - d->mGraphicsScene->window = this; - d->mGraphicsView = new QGraphicsView; - d->mGraphicsScene->addItem(d->mView); - d->mGraphicsView->setScene(d->mGraphicsScene); - d->mGraphicsScene->setStickyFocus(true); - d->mGraphicsView->viewport()->setParent(0); - - mEnableLoadingOverlay = false; -} - -LLEmbeddedBrowserWindow::~LLEmbeddedBrowserWindow() -{ - delete d; -} - -void LLEmbeddedBrowserWindow::setParent(LLEmbeddedBrowser* parent) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << parent; -#endif - d->mParent = parent; - if (parent) - { - d->mPage->setNetworkAccessManager(parent->d->mNetworkAccessManager); - } else - { - d->mPage->setNetworkAccessManager(0); - } -} - -void LLEmbeddedBrowserWindow::showWebInspector(bool show) -{ - if ( d ) - { - if ( d->mInspector ) - { - d->mInspector->setVisible( show ); - } - } -} - -void LLEmbeddedBrowserWindow::enableLoadingOverlay(bool enable) -{ - mEnableLoadingOverlay = enable; -} - -// change the background color that gets used between pages (usually white) -void LLEmbeddedBrowserWindow::setBackgroundColor(const uint8_t red, const uint8_t green, const uint8_t blue) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << red << green << blue; -#endif - d->backgroundColor = QColor(red, green, blue); -} - -// -void LLEmbeddedBrowserWindow::setEnabled(bool enabled) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << enabled; -#endif - d->mEnabled = enabled; -} - -// allow consumers of this class to observe events - add themselves as an observer -bool LLEmbeddedBrowserWindow::addObserver(LLEmbeddedBrowserWindowObserver* observer) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << observer; -#endif - return d->mEventEmitter.addObserver(observer); -} - -// allow consumers of this class to observe events - remove themselves as an observer -bool LLEmbeddedBrowserWindow::remObserver(LLEmbeddedBrowserWindowObserver* observer) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << observer; -#endif - return d->mEventEmitter.remObserver(observer); -} - -int LLEmbeddedBrowserWindow::getObserverNumber() -{ - return d->mEventEmitter.getObserverNumber(); -} - -// used by observers of this class to get the current URI -std::string& LLEmbeddedBrowserWindow::getCurrentUri() -{ - d->mCurrentUri = llToStdString(d->mPage->mainFrame()->url()); - return d->mCurrentUri; -} - -// utility method that is used by observers to retrieve data after an event -int16_t LLEmbeddedBrowserWindow::getPercentComplete() -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return d->mPercentComplete; -} - -// utility method that is used by observers to retrieve data after an event -std::string& LLEmbeddedBrowserWindow::getStatusMsg() -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return d->mStatusText; -} - -// render a page into memory and grab the window -unsigned char* LLEmbeddedBrowserWindow::grabWindow(int x, int y, int width, int height) -{ -#if LLEMBEDDEDBROWSER_DEBUG > 10 - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << x << y << width << height; -#endif - // only grab the window if it's enabled - if (!d->mEnabled) - return 0; - - if (!d->mDirty) - return d->mPageBuffer; - - Q_ASSERT(d->mImage.size() == d->mView->size()); - if (!d->mPage->mainFrame()->url().isValid()) - { - d->mImage.fill(d->backgroundColor.value()); - } else - { - QPainter painter(&d->mImage); - - QRectF r(x, y, width, height); - QRect g(0, 0, d->mView->width(), d->mView->height()); - d->mGraphicsView->render(&painter, r, g); - - d->mDirty = false; - - const bool spinner_enabled = false; - if ( spinner_enabled ) - { - const time_t seconds_before_show_overlay = 1; - - if ( mEnableLoadingOverlay && - d->mShowLoadingOverlay && - time(NULL) - d->mTimeLoadStarted >= seconds_before_show_overlay ) - { - painter.setRenderHint(QPainter::Antialiasing);; - - QBrush brush; - QPen pen; - - int size = width; - if ( height < width ) - size = height; - - const int symbol_translucency = 64; // 0=fully trans, 255=opaque - const int symbol_proportion_of_sceen = 8; // (1/8) - const int symbol_diameter = size/(symbol_proportion_of_sceen); - const int symbol_start_line = symbol_diameter*2/3; - const int symbol_end_line = symbol_diameter; - const int symbol_num_segments = 20; - const int symbol_line_width = size/60; - if ( size < 4 ) size = 4; - - QColor background_color(QColor(128,128,128,symbol_translucency)); - brush.setColor(background_color); - brush.setStyle(Qt::SolidPattern); - pen.setColor(background_color); - painter.setPen(pen); - painter.setBrush(brush); - painter.drawRect(0,0,width, height); - - painter.translate(QPoint(width/2, height/2)); - - static int offset=0; - painter.rotate(((qreal)(offset++%(symbol_num_segments))/(qreal)symbol_num_segments)*360.0f); - - for ( int count=0; countmDirty = true; // force dirty so updates happen frequently during load - } - } - - painter.end(); - if (d->mFlipBitmap) - { - d->mImage = d->mImage.mirrored(); - } - d->mImage = d->mImage.rgbSwapped(); - } - - d->mPageBuffer = d->mImage.bits(); - - return d->mPageBuffer; -} - -// return the buffer that contains the rendered page -unsigned char* LLEmbeddedBrowserWindow::getPageBuffer() -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return d->mPageBuffer; -} - -int16_t LLEmbeddedBrowserWindow::getBrowserWidth() -{ -#if LLEMBEDDEDBROWSER_DEBUG > 10 - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return d->mImage.width(); -} - -int16_t LLEmbeddedBrowserWindow::getBrowserHeight() -{ -#if LLEMBEDDEDBROWSER_DEBUG > 10 - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return d->mImage.height(); -} - -int16_t LLEmbeddedBrowserWindow::getBrowserDepth() -{ -#if LLEMBEDDEDBROWSER_DEBUG > 10 - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return 4; -} - -int32_t LLEmbeddedBrowserWindow::getBrowserRowSpan() -{ -#if LLEMBEDDEDBROWSER_DEBUG > 10 - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return 4 * getBrowserWidth(); -} - -bool LLEmbeddedBrowserWindow::navigateTo(const std::string uri) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << QString::fromStdString(uri); -#endif - QUrl url = QUrl::fromUserInput(QString::fromStdString(uri)); - - d->mPage->triggerAction(QWebPage::Stop); - d->mPage->mainFrame()->setUrl(url); - d->mPage->mainFrame()->load(url); - return true; -} - -bool LLEmbeddedBrowserWindow::userAction(LLQtWebKit::EUserAction action) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << action; -#endif - bool result = true; - - switch(action) - { - case LLQtWebKit::UA_EDIT_CUT: - d->mPage->triggerAction(QWebPage::Cut); - break; - case LLQtWebKit::UA_EDIT_COPY: - d->mPage->triggerAction(QWebPage::Copy); - break; - case LLQtWebKit::UA_EDIT_PASTE: - d->mPage->triggerAction(QWebPage::Paste); - break; - case LLQtWebKit::UA_NAVIGATE_STOP: - d->mPage->triggerAction(QWebPage::Stop); - break; - case LLQtWebKit::UA_NAVIGATE_BACK: - d->mPage->triggerAction(QWebPage::Back); - break; - case LLQtWebKit::UA_NAVIGATE_FORWARD: - d->mPage->triggerAction(QWebPage::Forward); - break; - case LLQtWebKit::UA_NAVIGATE_RELOAD: - d->mPage->triggerAction(QWebPage::ReloadAndBypassCache); - break; - default: - result = false; - break; - } - - return result; -} - -bool LLEmbeddedBrowserWindow::userActionIsEnabled(LLQtWebKit::EUserAction action) -{ -#if LLEMBEDDEDBROWSER_DEBUG > 10 - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << action; -#endif - - bool result; - - switch(action) - { - case LLQtWebKit::UA_EDIT_CUT: - result = d->mPage->action(QWebPage::Cut)->isEnabled(); - break; - case LLQtWebKit::UA_EDIT_COPY: - result = d->mPage->action(QWebPage::Copy)->isEnabled(); - break; - case LLQtWebKit::UA_EDIT_PASTE: - result = d->mPage->action(QWebPage::Paste)->isEnabled(); - break; - case LLQtWebKit::UA_NAVIGATE_STOP: - result = true; - break; - case LLQtWebKit::UA_NAVIGATE_BACK: - result = d->mPage->history()->canGoBack(); - break; - case LLQtWebKit::UA_NAVIGATE_FORWARD: - result = d->mPage->history()->canGoForward(); - break; - case LLQtWebKit::UA_NAVIGATE_RELOAD: - result = true; - break; - default: - result = false; - break; - } - return result; -} - -// set the size of the browser window -bool LLEmbeddedBrowserWindow::setSize(int16_t width, int16_t height) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << width << height; -#endif - d->mPageBuffer = NULL; - d->mImage = QImage(QSize(width, height), QImage::Format_RGB32); - d->mGraphicsView->resize(width, height); - d->mView->resize(width, height); - d->mImage.fill(d->backgroundColor.rgb()); - return true; -} - -bool LLEmbeddedBrowserWindow::flipWindow(bool flip) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << flip; -#endif - d->mFlipBitmap = flip; - return true; -} - -static Qt::KeyboardModifiers convert_modifiers(LLQtWebKit::EKeyboardModifier modifiers) -{ - Qt::KeyboardModifiers result = Qt::NoModifier; - - if(modifiers & LLQtWebKit::KM_MODIFIER_SHIFT) - result |= Qt::ShiftModifier; - - if(modifiers & LLQtWebKit::KM_MODIFIER_CONTROL) - result |= Qt::ControlModifier; - - if(modifiers & LLQtWebKit::KM_MODIFIER_ALT) - result |= Qt::AltModifier; - - if(modifiers & LLQtWebKit::KM_MODIFIER_META) - result |= Qt::MetaModifier; - - return result; -} - -static Qt::MouseButton qt_button_from_button_number(int button) -{ - Qt::MouseButton result; - - switch(button) - { - default: result = Qt::NoButton; break; - case 0: result = Qt::LeftButton; break; - case 1: result = Qt::RightButton; break; - case 2: result = Qt::MidButton; break; - case 3: result = Qt::XButton1; break; - case 4: result = Qt::XButton2; break; - } - - return result; -} - -static QEvent::Type event_from_mouse_event(LLQtWebKit::EMouseEvent mouse_event) -{ - QEvent::Type result; - - switch(mouse_event) - { - default: - result = QEvent::None; - break; - - case LLQtWebKit::ME_MOUSE_MOVE: - result = QEvent::MouseMove; - break; - - case LLQtWebKit::ME_MOUSE_DOWN: - result = QEvent::MouseButtonPress; - break; - - case LLQtWebKit::ME_MOUSE_UP: - result = QEvent::MouseButtonRelease; - break; - - case LLQtWebKit::ME_MOUSE_DOUBLE_CLICK: - result = QEvent::MouseButtonDblClick; - break; - } - - return result; -} - -static QEvent::Type event_from_keyboard_event(LLQtWebKit::EKeyEvent keyboard_event) -{ - QEvent::Type result; - - switch(keyboard_event) - { - default: - result = QEvent::None; - break; - - case LLQtWebKit::KE_KEY_DOWN: - case LLQtWebKit::KE_KEY_REPEAT: - result = QEvent::KeyPress; - break; - - case LLQtWebKit::KE_KEY_UP: - result = QEvent::KeyRelease; - break; - } - - return result; -} - -void LLEmbeddedBrowserWindow::mouseEvent(LLQtWebKit::EMouseEvent mouse_event, int16_t button, int16_t x, int16_t y, LLQtWebKit::EKeyboardModifier modifiers) -{ -#if LLEMBEDDEDBROWSER_DEBUG > 10 - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << x << y; -#endif - - QEvent::Type type = event_from_mouse_event(mouse_event); - Qt::MouseButton qt_button = qt_button_from_button_number(button); - Qt::KeyboardModifiers qt_modifiers = convert_modifiers(modifiers); - - if(type == QEvent::MouseMove) - { - // Mouse move events should always use "no button". - qt_button = Qt::NoButton; - } - - // FIXME: should the current button state be updated before or after constructing the event? - switch(type) - { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonDblClick: - d->mCurrentMouseButtonState |= qt_button; - break; - - case QEvent::MouseButtonRelease: - d->mCurrentMouseButtonState &= ~qt_button; - break; - - default: - break; - } - - QMouseEvent event(type, QPoint(x, y), qt_button, d->mCurrentMouseButtonState, qt_modifiers); - - qt_sendSpontaneousEvent(d->mGraphicsView->viewport(), &event); -} - -void LLEmbeddedBrowserWindow::scrollWheelEvent(int16_t x, int16_t y, int16_t scroll_x, int16_t scroll_y, LLQtWebKit::EKeyboardModifier modifiers) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << x << y; -#endif - - Qt::KeyboardModifiers qt_modifiers = convert_modifiers(modifiers); - - if(scroll_y != 0) - { - QWheelEvent event(QPoint(x, y), scroll_y, d->mCurrentMouseButtonState, qt_modifiers, Qt::Vertical); - qApp->sendEvent(d->mGraphicsView->viewport(), &event); - } - - if(scroll_x != 0) - { - QWheelEvent event(QPoint(x, y), scroll_x, d->mCurrentMouseButtonState, qt_modifiers, Qt::Horizontal); - qApp->sendEvent(d->mGraphicsView->viewport(), &event); - } -} - - -// utility methods to set an error message so something else can look at it -void LLEmbeddedBrowserWindow::scrollByLines(int16_t lines) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << lines; -#endif - int currentScrollValue = d->mPage->mainFrame()->scrollBarValue(Qt::Vertical); - d->mPage->mainFrame()->setScrollBarValue(Qt::Vertical, currentScrollValue + lines); -} - -// Send a keyboard event with native event data. -void LLEmbeddedBrowserWindow::keyboardEvent( - LLQtWebKit::EKeyEvent key_event, - uint32_t key_code, - const char *utf8_text, - LLQtWebKit::EKeyboardModifier modifiers, - uint32_t native_scan_code, - uint32_t native_virtual_key, - uint32_t native_modifiers) -{ - QEvent::Type type = event_from_keyboard_event(key_event); - Qt::KeyboardModifiers qt_modifiers = convert_modifiers(modifiers); - bool auto_repeat = (key_event == LLQtWebKit::KE_KEY_REPEAT); - QString text = QString::fromUtf8(utf8_text); - - Qt::Key key = Qt::Key_unknown; - - switch (key_code) - { - case LLQtWebKit::KEY_RETURN: key = Qt::Key_Return; break; - case LLQtWebKit::KEY_LEFT: key = Qt::Key_Left; break; - case LLQtWebKit::KEY_RIGHT: key = Qt::Key_Right; break; - case LLQtWebKit::KEY_UP: key = Qt::Key_Up; break; - case LLQtWebKit::KEY_DOWN: key = Qt::Key_Down; break; - case LLQtWebKit::KEY_ESCAPE: key = Qt::Key_Escape; break; - case LLQtWebKit::KEY_BACKSPACE: key = Qt::Key_Backspace; break; - case LLQtWebKit::KEY_DELETE: key = Qt::Key_Delete; break; - case LLQtWebKit::KEY_SHIFT: key = Qt::Key_Shift; break; - case LLQtWebKit::KEY_CONTROL: key = Qt::Key_Control; break; - case LLQtWebKit::KEY_ALT: key = Qt::Key_Alt; break; - case LLQtWebKit::KEY_HOME: key = Qt::Key_Home; break; - case LLQtWebKit::KEY_END: key = Qt::Key_End; break; - case LLQtWebKit::KEY_PAGE_UP: key = Qt::Key_PageUp; break; - case LLQtWebKit::KEY_PAGE_DOWN: key = Qt::Key_PageDown; break; - case LLQtWebKit::KEY_HYPHEN: key = Qt::Key_hyphen; break; - case LLQtWebKit::KEY_EQUALS: key = Qt::Key_Equal; break; - case LLQtWebKit::KEY_INSERT: key = Qt::Key_Insert; break; - case LLQtWebKit::KEY_CAPSLOCK: key = Qt::Key_CapsLock; break; - case LLQtWebKit::KEY_TAB: key = Qt::Key_Tab; break; - case LLQtWebKit::KEY_ADD: key = Qt::Key_Plus; break; - case LLQtWebKit::KEY_SUBTRACT: key = Qt::Key_Minus; break; - case LLQtWebKit::KEY_MULTIPLY: key = Qt::Key_Asterisk; break; - case LLQtWebKit::KEY_DIVIDE: key = Qt::Key_Slash; break; - case LLQtWebKit::KEY_F1: key = Qt::Key_F1; break; - case LLQtWebKit::KEY_F2: key = Qt::Key_F2; break; - case LLQtWebKit::KEY_F3: key = Qt::Key_F3; break; - case LLQtWebKit::KEY_F4: key = Qt::Key_F4; break; - case LLQtWebKit::KEY_F5: key = Qt::Key_F5; break; - case LLQtWebKit::KEY_F6: key = Qt::Key_F6; break; - case LLQtWebKit::KEY_F7: key = Qt::Key_F7; break; - case LLQtWebKit::KEY_F8: key = Qt::Key_F8; break; - case LLQtWebKit::KEY_F9: key = Qt::Key_F9; break; - case LLQtWebKit::KEY_F10: key = Qt::Key_F10; break; - case LLQtWebKit::KEY_F11: key = Qt::Key_F11; break; - case LLQtWebKit::KEY_F12: key = Qt::Key_F12; break; - - case LLQtWebKit::KEY_PAD_UP: key = Qt::Key_Up; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_DOWN: key = Qt::Key_Down; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_LEFT: key = Qt::Key_Left; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_RIGHT: key = Qt::Key_Right; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_HOME: key = Qt::Key_Home; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_END: key = Qt::Key_End; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_PGUP: key = Qt::Key_PageUp; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_PGDN: key = Qt::Key_PageDown; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_CENTER: key = Qt::Key_5; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_INS: key = Qt::Key_Insert; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_DEL: key = Qt::Key_Delete; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_RETURN: key = Qt::Key_Enter; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_ADD: key = Qt::Key_Plus; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_SUBTRACT: key = Qt::Key_Minus; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_MULTIPLY: key = Qt::Key_Asterisk; qt_modifiers |= Qt::KeypadModifier; break; - case LLQtWebKit::KEY_PAD_DIVIDE: key = Qt::Key_Slash; qt_modifiers |= Qt::KeypadModifier; break; - - case LLQtWebKit::KEY_NONE: key = Qt::Key_unknown; break; - - default: - key = (Qt::Key)toupper(key_code); - break; - } - - - QKeyEvent *event = - QKeyEvent::createExtendedKeyEvent( - type, - key, - qt_modifiers, - native_scan_code, - native_virtual_key, - native_modifiers, - text, - auto_repeat, - text.count()); - - qApp->sendEvent(d->mGraphicsScene, event); - - delete event; -} - - -// give focus to the browser so that input keyboard events work -void LLEmbeddedBrowserWindow::focusBrowser(bool focus_browser) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << focus_browser; -#endif - QEvent ev(QEvent::WindowActivate); - qApp->sendEvent(d->mGraphicsScene, &ev); - - QEvent ev2(QEvent::ActivationChange); - qApp->sendEvent(d->mGraphicsScene, &ev2); - - QFocusEvent event(focus_browser ? QEvent::FocusIn : QEvent::FocusOut, Qt::ActiveWindowFocusReason); - qApp->sendEvent(d->mPage, &event); -} - -void LLEmbeddedBrowserWindow::setWindowId(int window_id) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << window_id; -#endif - d->mWindowId = window_id; -} - -int LLEmbeddedBrowserWindow::getWindowId() -{ - return d->mWindowId; -} - -void LLEmbeddedBrowserWindow::proxyWindowOpened(const std::string target, const std::string uuid) -{ - LLWebPageOpenShim *shim = findShim(uuid); - if(!shim) - { - // We don't already have a shim with this uuid -- create one. - shim = new LLWebPageOpenShim(this, d->mPage); - d->mProxyPages.push_back(shim); - -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow::proxyWindowOpened: page list size is " << d->mProxyPages.size(); -#endif - } - - shim->setProxy(target, uuid); -} - -void LLEmbeddedBrowserWindow::proxyWindowClosed(const std::string uuid) -{ - LLWebPageOpenShim *shim = findShim(uuid); - if(shim) - { - deleteShim(shim); - } -} - -std::string LLEmbeddedBrowserWindow::evaluateJavaScript(std::string script) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << QString::fromStdString(script); -#endif - QString q_script = QString::fromStdString(script); - QString result = d->mPage->mainFrame()->evaluateJavaScript(q_script).toString(); - return llToStdString(result); -} - -void LLEmbeddedBrowserWindow::setHostLanguage(const std::string host_language) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << QString::fromStdString(host_language); -#endif - if ( d ) - if ( d->mPage ) - d->mPage->setHostLanguage( host_language ); -} - -void LLEmbeddedBrowserWindow::navigateErrorPage( int http_status_code ) -{ - LLEmbeddedBrowserWindowEvent event(getWindowId()); - event.setIntValue( http_status_code ); - - d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onNavigateErrorPage, event); -} - -void LLEmbeddedBrowserWindow::setNoFollowScheme(std::string scheme) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__ << QString::fromStdString(scheme); -#endif - d->mNoFollowScheme = QString::fromStdString(scheme); - // The scheme part of the url is what is before '://' - d->mNoFollowScheme = d->mNoFollowScheme.mid(0, d->mNoFollowScheme.indexOf("://")); -} - -std::string LLEmbeddedBrowserWindow::getNoFollowScheme() -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow" << __FUNCTION__; -#endif - return llToStdString(d->mNoFollowScheme); -} - -void LLEmbeddedBrowserWindow::prependHistoryUrl(std::string url) -{ -#ifdef WEBHISTORYPATCH - // *HACK: we only have a URL here, we set a "" title and "current time" as - // last visited time. - d->mPage->history()->prependItem(QString::fromStdString(url), - QString::fromAscii(""), - QDateTime::currentDateTime()); -#else - Q_UNUSED(url); -#endif -} - -void LLEmbeddedBrowserWindow::clearHistory() -{ - d->mPage->history()->clear(); -} - -std::string LLEmbeddedBrowserWindow::dumpHistory() -{ - std::ostringstream oss; - const QList &items = d->mPage->history()->backItems(9999); - oss << "cur: " << d->mPage->history()->currentItemIndex() << ":" - << d->mPage->history()->currentItem().url().toString().toAscii().data() << "\n"; - for (int i=0; i< items.count(); i++) { - oss << items[i].url().toString().toAscii().data() << "\n"; - } - return oss.str(); -} - -void LLEmbeddedBrowserWindow::cookieChanged(const std::string &cookie, const std::string &url, bool dead) -{ - LLEmbeddedBrowserWindowEvent event(getWindowId()); - event.setEventUri(url); - event.setStringValue(cookie); - event.setIntValue((int)dead); - - d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onCookieChanged, event); -} - -QWebPage *LLEmbeddedBrowserWindow::createWindow() -{ - QWebPage *result = NULL; - if(d->mOpeningSelf) - { - // Special case: opening self to set target, etc. -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow::createWindow: opening self to set target name. "; -#endif - result = d->mPage; - d->mOpeningSelf = false; - } - else - { - LLWebPageOpenShim *shim = new LLWebPageOpenShim(this, d->mPage); - d->mProxyPages.push_back(shim); - result = shim; - -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow::createWindow: page list size is " << d->mProxyPages.size(); -#endif - } - - return result; -} - -LLWebPageOpenShim *LLEmbeddedBrowserWindow::findShim(const std::string &uuid) -{ - LLEmbeddedBrowserWindowPrivate::ProxyList::iterator iter; - for(iter = d->mProxyPages.begin(); iter != d->mProxyPages.end(); iter++) - { - if((*iter)->matchesUUID(uuid)) - return *iter; - } - - return NULL; -} - -void LLEmbeddedBrowserWindow::deleteShim(LLWebPageOpenShim *shim) -{ - shim->window = 0; - shim->deleteLater(); - d->mProxyPages.remove(shim); - -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow::deleteShim: page list size is " << d->mProxyPages.size(); -#endif -} - -void LLEmbeddedBrowserWindow::setTarget(const std::string &target) -{ -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow::setTarget: setting target to " << QString::fromStdString(target); -#endif - - d->mOpeningSelf = true; - - std::stringstream s; - s << "window.open(\"\",\"" << target << "\");"; - - evaluateJavaScript(s.str()); -} - -std::string LLEmbeddedBrowserWindow::requestFilePicker() -{ - std::string filename_chosen; - - LLEmbeddedBrowserWindowEvent event(getWindowId()); - event.setEventUri(getCurrentUri()); - event.setStringValue("*.png;*.jpg"); - - // If there's at least one observer registered, call it with the event. - LLEmbeddedBrowserWindowPrivate::Emitter::iterator i = d->mEventEmitter.begin(); - if(i != d->mEventEmitter.end()) - { - filename_chosen = (*i)->onRequestFilePicker(event); - } - - return filename_chosen; -} - -bool LLEmbeddedBrowserWindow::authRequest(const std::string &in_url, const std::string &in_realm, std::string &out_username, std::string &out_password) -{ - bool result = false; - -#ifdef LLEMBEDDEDBROWSER_DEBUG - qDebug() << "LLEmbeddedBrowserWindow::authRequest: requesting auth for url " << QString::fromStdString(in_url) << ", realm " << QString::fromStdString(in_realm); -#endif - - // If there's at least one observer registered, send it the auth request. - LLEmbeddedBrowserWindowPrivate::Emitter::iterator i = d->mEventEmitter.begin(); - if(i != d->mEventEmitter.end()) - { - result = (*i)->onAuthRequest(in_url, in_realm, out_username, out_password); - } - - return result; -} - -bool LLEmbeddedBrowserWindow::certError(const std::string &in_url, const std::string &in_msg) -{ - bool result = false; - - // If there's at least one observer registered, send it the auth request. - LLEmbeddedBrowserWindowPrivate::Emitter::iterator i = d->mEventEmitter.begin(); - if(i != d->mEventEmitter.end()) - { - result = (*i)->onCertError(in_url, in_msg); - } - - return result; -} - -void LLEmbeddedBrowserWindow::onQtDebugMessage( const std::string& msg, const std::string& msg_type) -{ - // If there's at least one observer registered, send it the auth request. - LLEmbeddedBrowserWindowPrivate::Emitter::iterator i = d->mEventEmitter.begin(); - if(i != d->mEventEmitter.end()) - { - (*i)->onQtDebugMessage(msg, msg_type); - } -} - -void LLEmbeddedBrowserWindow::setWhiteListRegex( const std::string& regex ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setWhiteListRegex( regex ); -} - -// Second Life viewer specific functions -void LLEmbeddedBrowserWindow::setSLObjectEnabled( bool enabled ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setSLObjectEnabled( enabled ); -} - -void LLEmbeddedBrowserWindow::setAgentLanguage( const std::string& agent_language ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setAgentLanguage( agent_language ); -} - -void LLEmbeddedBrowserWindow::setAgentRegion( const std::string& agent_region ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setAgentRegion( agent_region ); -} - -void LLEmbeddedBrowserWindow::setAgentLocation( double x, double y, double z ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setAgentLocation( x, y, z ); -} - -void LLEmbeddedBrowserWindow::setAgentGlobalLocation( double x, double y, double z ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setAgentGlobalLocation( x, y, z ); -} - -void LLEmbeddedBrowserWindow::setAgentOrientation( double angle ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setAgentOrientation( angle ); -} - -void LLEmbeddedBrowserWindow::setAgentMaturity( const std::string& agent_maturity ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setAgentMaturity( agent_maturity ); -} - -void LLEmbeddedBrowserWindow::emitLocation() -{ - if ( d ) - if ( d->mPage ) - d->mPage->emitLocation(); -} - -void LLEmbeddedBrowserWindow::emitMaturity() -{ - if ( d ) - if ( d->mPage ) - d->mPage->emitMaturity(); -} - -void LLEmbeddedBrowserWindow::emitLanguage() -{ - if ( d ) - if ( d->mPage ) - d->mPage->emitLanguage(); -} - -void LLEmbeddedBrowserWindow::setPageZoomFactor( double factor ) -{ - if ( d ) - if ( d->mPage ) - d->mPage->setPageZoomFactor( factor ); -} - -LLGraphicsScene::LLGraphicsScene() - : QGraphicsScene() - , window(0) -{ - connect(this, SIGNAL(changed(const QList &)), - this, SLOT(repaintRequestedSlot(const QList &))); -} - -void LLGraphicsScene::repaintRequestedSlot(const QList ®ions) -{ - if (!window) - return; - window->d->mDirty = true; - for (int i = 0; i < regions.count(); ++i) - { - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - event.setRectValue(regions[i].x(), regions[i].y(), regions[i].width(), regions[i].height()); - - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onPageChanged, event); - } -} - -#include -#include -LLWebView::LLWebView(QGraphicsItem *parent) - : QGraphicsWebView(parent) - , window(0) -{ -} - -bool LLWebView::event(QEvent* event) -{ - if (window && event->type() == QEvent::CursorChange) { - QCursor cursor = this->cursor(); - if (currentShape != cursor.shape()) { - currentShape = cursor.shape(); - LLQtWebKit::ECursor llcursor; - switch(currentShape) - { - case Qt::ArrowCursor: - llcursor = LLQtWebKit::C_ARROW; - break; - case Qt::PointingHandCursor: - llcursor = LLQtWebKit::C_POINTINGHAND; - break; - case Qt::IBeamCursor: - llcursor = LLQtWebKit::C_IBEAM; - break; - case Qt::SplitVCursor: - llcursor = LLQtWebKit::C_SPLITV; - break; - case Qt::SplitHCursor: - llcursor = LLQtWebKit::C_SPLITH; - break; - default: - qWarning() << "Unhandled cursor shape:" << currentShape; - llcursor = LLQtWebKit::C_ARROW; - } - - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - event.setIntValue((int)llcursor); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onCursorChanged, event); - } - - return true; - } - return QGraphicsWebView::event(event); -} - - -std::string llToStdString(const QString &s) -{ - return llToStdString(s.toUtf8()); -} - -std::string llToStdString(const QByteArray &bytes) -{ - return std::string(bytes.constData(), bytes.size()); -} - -std::string llToStdString(const QUrl &url) -{ - return llToStdString(url.toEncoded()); -} diff --git a/indra/llqtwebkit/llembeddedbrowserwindow.h b/indra/llqtwebkit/llembeddedbrowserwindow.h deleted file mode 100644 index 0c8080c15..000000000 --- a/indra/llqtwebkit/llembeddedbrowserwindow.h +++ /dev/null @@ -1,185 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLEMBEDDEDBROWSERWINDOW_H -#define LLEMBEDDEDBROWSERWINDOW_H - -#include -#include -#include -#if defined _MSC_VER && _MSC_VER < 1600 -#include "pstdint.h" -#else -#include // Use the C99 official header -#endif - -#include "llqtwebkit.h" - -class LLEmbeddedBrowser; -class LLWebPageOpenShim; -class QWebPage; - -//////////////////////////////////////////////////////////////////////////////// -// class for a "window" that holds a browser - there can be lots of these -class LLEmbeddedBrowserWindowPrivate; -class LLEmbeddedBrowserWindow -{ -public: - LLEmbeddedBrowserWindow(); - virtual ~LLEmbeddedBrowserWindow(); - - // housekeeping - void setParent(LLEmbeddedBrowser* parent); - bool setSize(int16_t width, int16_t height); - void focusBrowser(bool focus_browser); - void scrollByLines(int16_t lines); - void setWindowId(int window_id); - int getWindowId(); - void proxyWindowOpened(const std::string target, const std::string uuid); - void proxyWindowClosed(const std::string uuid); - - // random accessors - int16_t getPercentComplete(); - std::string& getStatusMsg(); - std::string& getCurrentUri(); - - // memory buffer management - unsigned char* grabWindow(int x, int y, int width, int height); - bool flipWindow(bool flip); - unsigned char* getPageBuffer(); - int16_t getBrowserWidth(); - int16_t getBrowserHeight(); - int16_t getBrowserDepth(); - int32_t getBrowserRowSpan(); - - // set background color that you see in between pages - default is white but sometimes useful to change - void setBackgroundColor(const uint8_t red, const uint8_t green, const uint8_t blue); - - // can turn off updates to a page - e.g. when it's hidden by your windowing system - void setEnabled(bool enabledIn); - - // navigation - bool userAction(LLQtWebKit::EUserAction action); - bool userActionIsEnabled(LLQtWebKit::EUserAction action); - bool navigateTo(const std::string uri); - - // javascript access/control - std::string evaluateJavaScript(std::string script); - - // redirection when you hit an error page - void navigateErrorPage( int http_status_code ); - - // host language setting - void setHostLanguage(const std::string host_language); - - // mouse & keyboard events - void mouseEvent(LLQtWebKit::EMouseEvent mouse_event, int16_t button, int16_t x, int16_t y, LLQtWebKit::EKeyboardModifier modifiers); - void scrollWheelEvent(int16_t x, int16_t y, int16_t scroll_x, int16_t scroll_y, LLQtWebKit::EKeyboardModifier modifiers); - void keyboardEvent( - LLQtWebKit::EKeyEvent key_event, - uint32_t key_code, - const char *utf8_text, - LLQtWebKit::EKeyboardModifier modifiers, - uint32_t native_scan_code, - uint32_t native_virtual_key, - uint32_t native_modifiers); - - // allow consumers of this class and to observe browser events - bool addObserver(LLEmbeddedBrowserWindowObserver* observer); - bool remObserver(LLEmbeddedBrowserWindowObserver* observer); - int getObserverNumber(); - - // accessor/mutator for scheme that browser doesn't follow - e.g. secondlife.com:// - void setNoFollowScheme(std::string scheme); - std::string getNoFollowScheme(); - - // prepend the current history with the given url - void prependHistoryUrl(std::string url); - // clear the URL history - void clearHistory(); - std::string dumpHistory(); - - void cookieChanged(const std::string &cookie, const std::string &url, bool dead); - - QWebPage *createWindow(); - - LLWebPageOpenShim *findShim(const std::string &uuid); - void deleteShim(LLWebPageOpenShim *shim); - void setTarget(const std::string &target); - - std::string requestFilePicker(); - - void showWebInspector(bool enabled); - - bool authRequest(const std::string &in_url, const std::string &in_realm, std::string &out_username, std::string &out_password); - bool certError(const std::string &in_url, const std::string &in_msg); - - void onQtDebugMessage( const std::string& msg, const std::string& msg_type); - - void enableLoadingOverlay(bool enable); - - void setWhiteListRegex( const std::string& regex ); - - void setPageZoomFactor( double factor ); - - // Second Life specific functions - void setSLObjectEnabled( bool enabled ); - void setAgentLanguage( const std::string& agent_language ); - void setAgentRegion( const std::string& agent_region ); - void setAgentLocation( double x, double y, double z ); - void setAgentGlobalLocation( double x, double y, double z ); - void setAgentOrientation( double angle ); - void setAgentMaturity( const std::string& agent_maturity ); - void emitLocation(); - void emitMaturity(); - void emitLanguage(); - -private: - friend class LLWebPage; - friend class LLWebPageOpenShim; - friend class LLGraphicsScene; - friend class LLWebView; - friend class LLEmbeddedBrowserPrivate; - LLEmbeddedBrowserWindowPrivate *d; - bool mEnableLoadingOverlay; - -}; - - -// QString::toStdString converts to ascii, not utf8. Define our own versions that do utf8. - -#ifdef QSTRING_H -std::string llToStdString(const QString &s); -#endif - -#ifdef QBYTEARRAY_H -std::string llToStdString(const QByteArray &bytes); -#endif - -#ifdef QURL_H -std::string llToStdString(const QUrl &url); -#endif - -#endif // LLEMBEDEDDBROWSERWINDOW_H diff --git a/indra/llqtwebkit/llembeddedbrowserwindow_p.h b/indra/llqtwebkit/llembeddedbrowserwindow_p.h deleted file mode 100644 index 27b36d947..000000000 --- a/indra/llqtwebkit/llembeddedbrowserwindow_p.h +++ /dev/null @@ -1,251 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLEMBEDDEDBROWSERWINDOW_P_H -#define LLEMBEDDEDBROWSERWINDOW_P_H - -#include "llwebpage.h" -#include "llwebpageopenshim.h" - -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////////// -// manages the process of storing and emitting events that the consumer -// of the embedding class can observe -template< class T > -class LLEmbeddedBrowserWindowEmitter -{ - public: - LLEmbeddedBrowserWindowEmitter() { }; - ~LLEmbeddedBrowserWindowEmitter() { }; - - typedef typename T::EventType EventType; - typedef std::list< T* > ObserverContainer; - typedef typename ObserverContainer::iterator iterator; - typedef void(T::*observerMethod)(const EventType&); - - /////////////////////////////////////////////////////////////////////////////// - // - bool addObserver(T* observer) - { - if (! observer) - return false; - - if (std::find(observers.begin(), observers.end(), observer) != observers.end()) - return false; - - observers.push_back(observer); - - return true; - } - - /////////////////////////////////////////////////////////////////////////////// - // - bool remObserver(T* observer) - { - if (! observer) - return false; - - observers.remove(observer); - - return true; - } - - /////////////////////////////////////////////////////////////////////////////// - // - void update(observerMethod method, const EventType& msg) - { - typename std::list< T* >::iterator iter = observers.begin(); - - while(iter != observers.end()) - { - ((*iter)->*method)(msg); - ++iter; - } - } - - int getObserverNumber() - { - return observers.size(); - } - - iterator begin() - { - return observers.begin(); - } - - iterator end() - { - return observers.end(); - } - - protected: - ObserverContainer observers; -}; - -#include "llqtwebkit.h" -#include "llembeddedbrowserwindow.h" -#include -#include - -class LLGraphicsScene : public QGraphicsScene -{ - Q_OBJECT - -public: - LLGraphicsScene(); - LLEmbeddedBrowserWindow *window; - - void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) { - QGraphicsScene::mouseMoveEvent(mouseEvent); - mouseEvent->setAccepted(true); - mouseEvent->setButtons(Qt::LeftButton); - } - -private slots: - void repaintRequestedSlot(const QList &); - friend class LLEmbeddedBrowserWindow; -}; - - -class LLWebView : public QGraphicsWebView -{ - Q_OBJECT - -public: - LLWebView(QGraphicsItem *parent = 0); - LLEmbeddedBrowserWindow *window; - - static QUrl guessUrlFromString(const QString &string); - - int width() const { return boundingRect().width(); } - int height() const { return boundingRect().height(); } - -protected: - bool event(QEvent *event); - - Qt::CursorShape currentShape; -}; - -class LLEmbeddedBrowserWindowPrivate -{ - public: - LLEmbeddedBrowserWindowPrivate() - : mParent(0) - , mPage(0) - , mView(0) - , mGraphicsScene(0) - , mGraphicsView(0) - , mInspector(0) - , mCurrentMouseButtonState(Qt::NoButton) - , mPercentComplete(0) - , mShowLoadingOverlay(false) - , mTimeLoadStarted(0) - , mStatusText("") - , mTitle("") - , mCurrentUri("") - , mNoFollowScheme("secondlife") - , mWindowId(-1) - , mEnabled(true) - , mFlipBitmap(false) - , mPageBuffer(NULL) - , mDirty(false) - , mOpeningSelf(false) - { - } - - ~LLEmbeddedBrowserWindowPrivate() - { - while(!mProxyPages.empty()) - { - ProxyList::iterator iter = mProxyPages.begin(); - (*iter)->window = 0; - (*iter)->deleteLater(); - } - - if(mGraphicsScene) - { - mGraphicsScene->window = 0; - } - if(mPage) - { - mPage->window = 0; - } - if(mView) - { - mView->deleteLater(); - } - if(mGraphicsScene) - { - mGraphicsScene->deleteLater(); - } - if(mGraphicsView) - { - mGraphicsView->viewport()->setParent(mGraphicsView); - mGraphicsView->deleteLater(); - } - if(mInspector) - { - mInspector->deleteLater(); - } - } - - typedef LLEmbeddedBrowserWindowEmitter< LLEmbeddedBrowserWindowObserver> Emitter; - Emitter mEventEmitter; - QImage mImage; - LLEmbeddedBrowser *mParent; - LLWebPage *mPage; - typedef std::list ProxyList; - ProxyList mProxyPages; - - LLWebView *mView; - QWebInspector* mInspector; - LLGraphicsScene *mGraphicsScene; - QGraphicsView *mGraphicsView; - Qt::MouseButtons mCurrentMouseButtonState; - - int16_t mPercentComplete; - bool mShowLoadingOverlay; - time_t mTimeLoadStarted; - std::string mStatusText; - std::string mTitle; - std::string mCurrentUri; - QString mNoFollowScheme; - int mWindowId; - bool mEnabled; - bool mFlipBitmap; - unsigned char* mPageBuffer; - QColor backgroundColor; - bool mDirty; - bool mOpeningSelf; -}; - - -#endif - diff --git a/indra/llqtwebkit/lljsobject.cpp b/indra/llqtwebkit/lljsobject.cpp deleted file mode 100644 index f5abfa702..000000000 --- a/indra/llqtwebkit/lljsobject.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include "lljsobject.h" - -LLJsObject::LLJsObject( QObject* parent ) : - QObject( parent ) -{ - mEnabled = false; - - mAgentLanguage = QString(); - mAgentMaturity = QString(); - mAgentRegion = QString(); - - mAgentLocation[ "x" ] = 0.0; - mAgentLocation[ "y" ] = 0.0; - mAgentLocation[ "z" ] = 0.0; - - mAgentGlobalLocation[ "x" ] = 0.0; - mAgentGlobalLocation[ "y" ] = 0.0; - mAgentGlobalLocation[ "z" ] = 0.0; -} - -void LLJsObject::setSLObjectEnabled( bool enabled ) -{ - mEnabled = enabled; -} - -bool LLJsObject::getSLObjectEnabled() -{ - return mEnabled; -} - -void LLJsObject::setAgentLanguage( const QString& agent_language ) -{ - if ( mEnabled ) - { - mAgentLanguage = agent_language; - } - else - { - mAgentLanguage = QString(); - } -} - -void LLJsObject::setAgentRegion( const QString& agent_region ) -{ - if ( mEnabled ) - { - mAgentRegion = agent_region; - } - else - { - mAgentRegion = QString(); - } -} - -void LLJsObject::setAgentMaturity( const QString& agent_maturity ) -{ - if ( mEnabled ) - { - mAgentMaturity = agent_maturity; - } - else - { - mAgentMaturity = QString(); - } -} - -void LLJsObject::setAgentLocation( const QVariantMap agent_location ) -{ - if ( mEnabled ) - { - mAgentLocation = agent_location; - } - else - { - mAgentLocation[ "x" ] = 0.0; - mAgentLocation[ "y" ] = 0.0; - mAgentLocation[ "z" ] = 0.0; - } -} - -void LLJsObject::setAgentGlobalLocation( const QVariantMap agent_global_location ) -{ - if ( mEnabled ) - { - mAgentGlobalLocation = agent_global_location; - } - else - { - mAgentGlobalLocation[ "x" ] = 0.0; - mAgentGlobalLocation[ "y" ] = 0.0; - mAgentGlobalLocation[ "z" ] = 0.0; - } -} - -void LLJsObject::setAgentOrientation( const double angle ) -{ - if ( mEnabled ) - { - mAgentOrientation = angle; - } - else - { - mAgentOrientation = 0.0; - } -} - -void LLJsObject::emitLocation() -{ - QVariantMap agent_location; - - agent_location[ "region" ] = mAgentRegion; - agent_location[ "location" ] = mAgentLocation; - agent_location[ "orientation" ] = mAgentOrientation; - agent_location[ "globalLocation" ] = mAgentGlobalLocation; - - emit getLocation( agent_location ); -} - -void LLJsObject::emitMaturity() -{ - emit getMaturity( mAgentMaturity ); -} - -void LLJsObject::emitLanguage() -{ - emit getLanguage( mAgentLanguage ); -} diff --git a/indra/llqtwebkit/lljsobject.h b/indra/llqtwebkit/lljsobject.h deleted file mode 100644 index 806a8a8a1..000000000 --- a/indra/llqtwebkit/lljsobject.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLJSOBJECT_H -#define LLJSOBJECT_H - -#include -#include -#include - -class LLJsObject : - public QObject -{ - Q_OBJECT - - public: - LLJsObject( QObject* parent = 0 ); - - void setSLObjectEnabled( bool enabled ); - bool getSLObjectEnabled(); - - void setAgentLanguage( const QString& agent_language ); - void setAgentRegion( const QString& agent_region ); - void setAgentMaturity( const QString& agent_maturity ); - void setAgentLocation( const QVariantMap agent_location ); - void setAgentGlobalLocation( const QVariantMap agent_global_location ); - void setAgentOrientation( const double angle ); - - void emitLocation(); - void emitMaturity(); - void emitLanguage(); - - signals: - void getLocation( const QVariantMap agent_location ); - void getMaturity( const QString agent_maturity ); - void getLanguage( const QString agent_language ); - - private: - bool mEnabled; - - QString mAgentLanguage; - QString mAgentMaturity; - QString mAgentRegion; - QVariantMap mAgentLocation; - QVariantMap mAgentGlobalLocation; - double mAgentOrientation; -}; - -#endif // LLJSOBJECT_H diff --git a/indra/llqtwebkit/llnetworkaccessmanager.cpp b/indra/llqtwebkit/llnetworkaccessmanager.cpp deleted file mode 100644 index 2a51f1340..000000000 --- a/indra/llqtwebkit/llnetworkaccessmanager.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include "llnetworkaccessmanager.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "llembeddedbrowserwindow.h" -#include "llembeddedbrowser_p.h" - -#include "ui_passworddialog.h" - - -LLNetworkAccessManager::LLNetworkAccessManager(LLEmbeddedBrowserPrivate* browser,QObject* parent) - : QNetworkAccessManager(parent) - , mBrowser(browser) -{ - connect(this, SIGNAL(finished(QNetworkReply*)), - this, SLOT(finishLoading(QNetworkReply*))); - connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), - this, SLOT(authenticationRequiredSlot(QNetworkReply*, QAuthenticator*))); - connect(this, SIGNAL(sslErrors( QNetworkReply *, const QList &)), - this, SLOT(sslErrorsSlot( QNetworkReply *, const QList & ))); -} - -QNetworkReply *LLNetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, - QIODevice *outgoingData) -{ - - // Create a local copy of the request we can modify. - QNetworkRequest mutable_request(request); - - // Set an Accept-Language header in the request, based on what the host has set through setHostLanguage. - mutable_request.setRawHeader(QByteArray("Accept-Language"), QByteArray(mBrowser->mHostLanguage.c_str())); - - // this is undefine'd in 4.7.1 and leads to caching issues - setting it here explicitly - mutable_request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork); - - if(op == GetOperation) - { - // GET requests should not have a Content-Type header, but it seems somebody somewhere is adding one. - // This removes it. - mutable_request.setRawHeader("Content-Type", QByteArray()); - } - -// qDebug() << "headers for request:" << mutable_request.rawHeaderList(); - - // and pass this through to the parent implementation - return QNetworkAccessManager::createRequest(op, mutable_request, outgoingData); -} - -void LLNetworkAccessManager::sslErrorsSlot(QNetworkReply* reply, const QList& errors) -{ - // Enabling this can help diagnose certificate verification issues. - const bool ssl_debugging_on = false; - - // flag that indicates if the error that brought us here is one we care about or not - bool valid_ssl_error = false; - - foreach( const QSslError &error, errors ) - { - if ( ssl_debugging_on ) - { - qDebug() << "SSL error details are (" << (int)(error.error()) << ") - " << error.error(); - } - - // SSL "error" codes we don't care about - if we get one of these, we want to continue - if ( error.error() != QSslError::NoError - // many more in src/network/ssl/qsslerror.h - ) - { - if ( ssl_debugging_on ) - { - qDebug() << "Found valid SSL error - will not ignore"; - } - - valid_ssl_error = true; - } - else - { - if ( ssl_debugging_on ) - { - qDebug() << "Found invalid SSL error - will ignore and continue"; - } - } - } - - if ( ssl_debugging_on ) - { - qDebug() << "LLNetworkAccessManager" << __FUNCTION__ << "errors: " << errors - << ", peer certificate chain: "; - - QSslCertificate cert; - foreach(cert, reply->sslConfiguration().peerCertificateChain()) - { - qDebug() << " cert: " << cert - << ", issuer = " << cert.issuerInfo(QSslCertificate::CommonName) - << ", subject = " << cert.subjectInfo(QSslCertificate::CommonName); - } - } - - if ( valid_ssl_error ) - { - std::string url = llToStdString(reply->url()); - QString err_msg=""; - foreach( const QSslError &error, errors ) - { - err_msg+=error.errorString(); - err_msg+="\n"; - - QSslCertificate cert = error.certificate(); - - QString issuer_info=""; - issuer_info+="C="; - issuer_info+=cert.issuerInfo(QSslCertificate::CountryName); - issuer_info+=", ST="; - issuer_info+=cert.issuerInfo(QSslCertificate::StateOrProvinceName); - issuer_info+=", L="; - issuer_info+=cert.issuerInfo(QSslCertificate::LocalityName); - issuer_info+=", O="; - issuer_info+=cert.issuerInfo(QSslCertificate::Organization); - issuer_info+=", OU="; - issuer_info+=cert.issuerInfo(QSslCertificate::OrganizationalUnitName); - issuer_info+=", CN="; - issuer_info+=cert.issuerInfo(QSslCertificate::CommonName); - err_msg+=issuer_info; - err_msg+="\n"; - - QString subject_info=""; - subject_info+="C="; - subject_info+=cert.subjectInfo(QSslCertificate::CountryName); - subject_info+=", ST="; - subject_info+=cert.subjectInfo(QSslCertificate::StateOrProvinceName); - subject_info+=", L="; - subject_info+=cert.subjectInfo(QSslCertificate::LocalityName); - subject_info+=", O="; - subject_info+=cert.subjectInfo(QSslCertificate::Organization); - subject_info+=", OU="; - subject_info+=cert.subjectInfo(QSslCertificate::OrganizationalUnitName); - subject_info+=", CN="; - subject_info+=cert.subjectInfo(QSslCertificate::CommonName); - err_msg+=subject_info; - err_msg+="\n"; - - err_msg+="Not valid before: "; - err_msg+=cert.effectiveDate().toString(); - err_msg+="\n"; - err_msg+="Not valid after: "; - err_msg+=cert.expiryDate().toString(); - err_msg+="\n"; - err_msg+="----------\n"; - } - - if(mBrowser->certError(url, llToStdString(err_msg))) - { - // signal we should ignore and continue processing - reply->ignoreSslErrors(); - } - else - { - // The user canceled, don't return yet so we can test ignore variable - } - } - - // we the SSL error is invalid (in our opinion) or we explicitly ignore all SSL errors - if ( valid_ssl_error == false || ( mBrowser && mBrowser->mIgnoreSSLCertErrors ) ) - { - // signal we should ignore and continue processing - reply->ignoreSslErrors(); - }; -} - -void LLNetworkAccessManager::finishLoading(QNetworkReply* reply) -{ - QVariant val = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ); - int http_status_code = val.toInt(); - if ( http_status_code >=400 && http_status_code <=499 ) - { - if (mBrowser) - { - std::string current_url = llToStdString(reply->url()); - foreach (LLEmbeddedBrowserWindow *window, mBrowser->windows) - { - if (window->getCurrentUri() == current_url) - { - window->navigateErrorPage( http_status_code ); - } - } - } - } - - // tests if navigation request resulted in a cache hit - useful for testing so leaving here for the moment. - //QVariant from_cache = reply->attribute( QNetworkRequest::SourceIsFromCacheAttribute ); - //QString url = QString(reply->url().toEncoded()); - //qDebug() << url << " --- from cache?" << fromCache.toBool() << "\n"; -} - -void LLNetworkAccessManager:: authenticationRequiredSlot(QNetworkReply *reply, QAuthenticator *authenticator) -{ - std::string username; - std::string password; - std::string url = llToStdString(reply->url()); - std::string realm = llToStdString(authenticator->realm()); - - if(mBrowser->authRequest(url, realm, username, password)) - { - // Got credentials to try, attempt auth with them. - authenticator->setUser(QString::fromStdString(username)); - authenticator->setPassword(QString::fromStdString(password)); - } - else - { - // The user cancelled, don't attempt auth. - } -} - diff --git a/indra/llqtwebkit/llnetworkaccessmanager.h b/indra/llqtwebkit/llnetworkaccessmanager.h deleted file mode 100644 index 478b679aa..000000000 --- a/indra/llqtwebkit/llnetworkaccessmanager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLNETWORKACCESSMANAGER_H -#define LLNETWORKACCESSMANAGER_H - -#include -#include - -#include "ui_passworddialog.h" - -class QGraphicsProxyWidget; - -class LLEmbeddedBrowserPrivate; -class LLNetworkAccessManager: public QNetworkAccessManager -{ - Q_OBJECT -public: - LLNetworkAccessManager(LLEmbeddedBrowserPrivate* browser, QObject* parent = 0); - -protected: - virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, - QIODevice *outgoingData = 0); -private slots: - void finishLoading(QNetworkReply* reply); - void authenticationRequiredSlot(QNetworkReply *reply, QAuthenticator *authenticator); - void sslErrorsSlot(QNetworkReply* reply, const QList& errors); - -private: - LLEmbeddedBrowserPrivate* mBrowser; - -}; - -#endif // LLNETWORKACCESSMANAGER_H - diff --git a/indra/llqtwebkit/llqtwebkit.cpp b/indra/llqtwebkit/llqtwebkit.cpp deleted file mode 100644 index 2be066d11..000000000 --- a/indra/llqtwebkit/llqtwebkit.cpp +++ /dev/null @@ -1,820 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include -#include -#include - -#include "llqtwebkit.h" - -#include "llembeddedbrowser.h" -#include "llembeddedbrowserwindow.h" - -LLQtWebKit* LLQtWebKit::sInstance = 0; - -//////////////////////////////////////////////////////////////////////////////// -// -LLQtWebKit::LLQtWebKit() : - mMaxBrowserWindows(16) -{ -} - -//////////////////////////////////////////////////////////////////////////////// -// -LLQtWebKit* LLQtWebKit::getInstance() -{ - if (! sInstance) - { - sInstance = new LLQtWebKit; - } - - return sInstance; -} - -//////////////////////////////////////////////////////////////////////////////// -// -LLQtWebKit::~LLQtWebKit() -{ -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::init(std::string application_directory, - std::string component_directory, - std::string profile_directory, - void* native_window_handle) -{ - return LLEmbeddedBrowser::getInstance()->init(application_directory, - component_directory, - profile_directory, - native_window_handle); -} - -//////////////////////////////////////////////////////////////////////////////// -// -int LLQtWebKit::getLastError() -{ - return LLEmbeddedBrowser::getInstance()->getLastError(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::reset() -{ - mBrowserWindowMap.clear(); - return LLEmbeddedBrowser::getInstance()->reset(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::clearCache() -{ - return LLEmbeddedBrowser::getInstance()->clearCache(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -std::string LLQtWebKit::getVersion() -{ - const int majorVersion = 2; - const int minorVersion = 2; - - // number of hours since "time began" for this library - used to identify builds of same version - const int magicNumber = static_cast< int >((time(NULL) / 3600L) - (321190L)); - - // return as a string for now - don't think we need to expose actual version numbers - std::ostringstream codec; - codec << std::setw(1) << std::setfill('0'); - codec << majorVersion << "."; - codec << std::setw(2) << std::setfill('0'); - codec << minorVersion << "."; - codec << std::setw(5) << std::setfill('0'); - codec << magicNumber; - codec << " (QtWebKit version "; - codec << LLEmbeddedBrowser::getInstance()->getGREVersion(); - codec << ")"; - - return codec.str(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::setBrowserAgentId(std::string id) -{ - LLEmbeddedBrowser::getInstance()->setBrowserAgentId(id); -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::enableProxy(bool enabled, std::string host_name, int port) -{ - return LLEmbeddedBrowser::getInstance()->enableProxy(enabled, host_name, port); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::setHostLanguage(const std::string& host_language ) -{ - LLEmbeddedBrowser::getInstance()->setHostLanguage(host_language); -} - -//////////////////////////////////////////////////////////////////////////////// -// -int LLQtWebKit::createBrowserWindow(int width, int height, const std::string target) -{ - LLEmbeddedBrowserWindow* browser_window = LLEmbeddedBrowser::getInstance()->createBrowserWindow(width, height, target); - - if (browser_window) - { - // arbitrary limit so we don't exhaust system resources - int id(0); - while (++id < mMaxBrowserWindows) - { - std::pair< BrowserWindowMapIter, bool > result = mBrowserWindowMap.insert(std::make_pair(id, browser_window)); - - // find first place the insert succeeds and use that index as the id - if (result.second) - { - browser_window->setWindowId(id); - return id; - } - } - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::proxyWindowOpened(int browser_window_id, const std::string target, const std::string uuid) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->proxyWindowOpened(target, uuid); - } -} -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::proxyWindowClosed(int browser_window_id, const std::string uuid) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->proxyWindowClosed(uuid); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::destroyBrowserWindow(int browser_window_id) -{ - // don't use the utility method here since we need the iteratorator to remove the entry from the map - BrowserWindowMapIter iterator = mBrowserWindowMap.find(browser_window_id); - LLEmbeddedBrowserWindow* browser_window = (*iterator).second; - - if (browser_window) - { - LLEmbeddedBrowser::getInstance()->destroyBrowserWindow(browser_window); - } - - mBrowserWindowMap.erase(iterator); - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::setBackgroundColor(int browser_window_id, const int red, const int green, const int blue) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->setBackgroundColor(red, green, blue); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::setEnabled(int browser_window_id, bool enabled) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->setEnabled(enabled); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::setSize(int browser_window_id, int width, int height) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->setSize(width, height); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::scrollByLines(int browser_window_id, int lines) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->scrollByLines(lines); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::addObserver(int browser_window_id, LLEmbeddedBrowserWindowObserver* subject) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->addObserver(subject); - } - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::remObserver(int browser_window_id, LLEmbeddedBrowserWindowObserver* subject) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->remObserver(subject); - } - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::navigateTo(int browser_window_id, const std::string uri) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->navigateTo(uri) ? true : false; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::userAction(int browser_window_id, EUserAction action) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->userAction(action); - } - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::userActionIsEnabled(int browser_window_id, EUserAction action) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->userActionIsEnabled(action); - } - return false; -} - -/////////////////////////////////////////////////////////////////////////////// -// -const unsigned char* LLQtWebKit::grabBrowserWindow(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->grabWindow(0, 0, browser_window->getBrowserWidth(), browser_window->getBrowserHeight()); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// -const unsigned char* LLQtWebKit::getBrowserWindowPixels(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->getPageBuffer(); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::flipWindow(int browser_window_id, bool flip) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->flipWindow(flip); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -int LLQtWebKit::getBrowserWidth(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->getBrowserWidth(); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// -int LLQtWebKit::getBrowserHeight(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->getBrowserHeight(); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// -int LLQtWebKit::getBrowserDepth(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->getBrowserDepth(); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// -int LLQtWebKit::getBrowserRowSpan(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->getBrowserRowSpan(); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::mouseEvent(int browser_window_id, EMouseEvent mouse_event, int button, int x, int y, EKeyboardModifier modifiers) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->mouseEvent(mouse_event, button, x, y, modifiers); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::scrollWheelEvent(int browser_window_id, int x, int y, int scroll_x, int scroll_y, EKeyboardModifier modifiers) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->scrollWheelEvent(x, y, scroll_x, scroll_y, modifiers); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::keyboardEvent( - int browser_window_id, - EKeyEvent key_event, - uint32_t key_code, - const char *utf8_text, - EKeyboardModifier modifiers, - uint32_t native_scan_code, - uint32_t native_virtual_key, - uint32_t native_modifiers) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->keyboardEvent(key_event, key_code, utf8_text, modifiers, native_scan_code, native_virtual_key, native_modifiers); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::focusBrowser(int browser_window_id, bool focus_browser) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->focusBrowser(focus_browser); - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::setNoFollowScheme(int browser_window_id, std::string scheme) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->setNoFollowScheme(scheme); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -std::string LLQtWebKit::getNoFollowScheme(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->getNoFollowScheme(); - } - - return (""); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::pump(int max_milliseconds) -{ - LLEmbeddedBrowser::getInstance()->pump(max_milliseconds); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::enableCookies(bool enabled) -{ - LLEmbeddedBrowser::getInstance()->enableCookies( enabled ); -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::clearAllCookies() -{ - return LLEmbeddedBrowser::getInstance()->clearAllCookies(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::setCookies(const std::string &cookies) -{ - return LLEmbeddedBrowser::getInstance()->setCookies(cookies); -} - -//////////////////////////////////////////////////////////////////////////////// -// -std::string LLQtWebKit::getAllCookies() -{ - return LLEmbeddedBrowser::getInstance()->getAllCookies(); -} - - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::enablePlugins(bool enabled) -{ - LLEmbeddedBrowser::getInstance()->enablePlugins(enabled); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::enableJavaScript(bool enabled) -{ - LLEmbeddedBrowser::getInstance()->enableJavaScript(enabled); -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::showWebInspector(bool show) -{ - return LLEmbeddedBrowser::getInstance()->showWebInspector(show); -} - -//////////////////////////////////////////////////////////////////////////////// -// -std::string LLQtWebKit::evaluateJavaScript(int browser_window_id, const std::string script) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->evaluateJavaScript(script); - } - - return ""; -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::prependHistoryUrl(int browser_window_id, std::string url) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->prependHistoryUrl(url); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::clearHistory(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->clearHistory(); - } -} - -std::string LLQtWebKit::dumpHistory(int browser_window_id) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - return browser_window->dumpHistory(); - } - - return NULL; -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::setCAFile(const std::string &ca_file) -{ - return LLEmbeddedBrowser::getInstance()->setCAFile(ca_file); -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::addCAFile(const std::string &ca_file) -{ - return LLEmbeddedBrowser::getInstance()->addCAFile(ca_file); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLQtWebKit::setIgnoreSSLCertErrors(bool ignore) -{ - LLEmbeddedBrowser::getInstance()->setIgnoreSSLCertErrors(ignore); -} - -//////////////////////////////////////////////////////////////////////////////// -// -bool LLQtWebKit::getIgnoreSSLCertErrors() -{ - return LLEmbeddedBrowser::getInstance()-> getIgnoreSSLCertErrors(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -const std::vector< std::string > LLQtWebKit::getInstalledCertsList() -{ - return LLEmbeddedBrowser::getInstance()->getInstalledCertsList(); -} - -//////////////////////////////////////////////////////////////////////////////// -// utility method to get an LLEmbeddedBrowserWindow* from a window id (int) -LLEmbeddedBrowserWindow* LLQtWebKit::getBrowserWindowFromWindowId(int browser_window_id) -{ - BrowserWindowMapIter iterator = mBrowserWindowMap.find(browser_window_id); - - if (iterator != mBrowserWindowMap.end()) - return (*iterator).second; - else - return 0; -} - -LLEmbeddedBrowserWindowObserver::~LLEmbeddedBrowserWindowObserver() -{ -} - -void LLEmbeddedBrowserWindowObserver::onCursorChanged(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onPageChanged(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onNavigateBegin(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onNavigateComplete(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onUpdateProgress(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onStatusTextChange(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onTitleChange(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onLocationChange(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onNavigateErrorPage(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onClickLinkHref(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onClickLinkNoFollow(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onCookieChanged(const EventType&) -{ -} - -std::string LLEmbeddedBrowserWindowObserver::onRequestFilePicker(const EventType&) -{ - return std::string(); -} - -void LLEmbeddedBrowserWindowObserver::onWindowCloseRequested(const EventType&) -{ -} - -void LLEmbeddedBrowserWindowObserver::onWindowGeometryChangeRequested(const EventType&) -{ -} - -bool LLEmbeddedBrowserWindowObserver::onAuthRequest(const std::string &, const std::string &, std::string &, std::string &) -{ - return false; -} - -bool LLEmbeddedBrowserWindowObserver::onCertError(const std::string &, const std::string &) -{ - return false; // cancel and abort after cert error -} - -void LLEmbeddedBrowserWindowObserver::onQtDebugMessage( const std::string &, const std::string &) -{ -} - -void LLEmbeddedBrowserWindowObserver::onLinkHovered(const EventType&) -{ -} - -// set the regex used to determine if a page is trusted or not -void LLQtWebKit::setWhiteListRegex( int browser_window_id, const std::string& regex ) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->setWhiteListRegex(regex); - } -} - -// Second Life viewer specific functions -void LLQtWebKit::setSLObjectEnabled( bool enabled ) -{ - LLEmbeddedBrowser::getInstance()->setSLObjectEnabled( enabled ); -} - -void LLQtWebKit::setAgentLanguage( const std::string& agent_language ) -{ - LLEmbeddedBrowser::getInstance()->setAgentLanguage( agent_language ); -} - -void LLQtWebKit::setAgentRegion( const std::string& agent_region ) -{ - LLEmbeddedBrowser::getInstance()->setAgentRegion( agent_region ); -} - -void LLQtWebKit::setAgentLocation( double x, double y, double z ) -{ - LLEmbeddedBrowser::getInstance()->setAgentLocation( x, y, z ); -} - -void LLQtWebKit::setAgentGlobalLocation( double x, double y, double z ) -{ - LLEmbeddedBrowser::getInstance()->setAgentGlobalLocation( x, y, z ); -} - -void LLQtWebKit::setAgentOrientation( double angle ) -{ - LLEmbeddedBrowser::getInstance()->setAgentOrientation( angle ); -} - - -void LLQtWebKit::setAgentMaturity( const std::string& agent_maturity ) -{ - LLEmbeddedBrowser::getInstance()->setAgentMaturity( agent_maturity ); -} - -void LLQtWebKit::emitLocation() -{ - LLEmbeddedBrowser::getInstance()->emitLocation(); -} - -void LLQtWebKit::emitMaturity() -{ - LLEmbeddedBrowser::getInstance()->emitMaturity(); -} - -void LLQtWebKit::emitLanguage() -{ - LLEmbeddedBrowser::getInstance()->emitLanguage(); -} - -void LLQtWebKit::enableQtMessageHandler( bool enable ) -{ - LLEmbeddedBrowser::getInstance()->enableQtMessageHandler( enable ); -} - -void LLQtWebKit::enableLoadingOverlay( int browser_window_id, bool enable) -{ - LLEmbeddedBrowserWindow* browser_window = getBrowserWindowFromWindowId(browser_window_id); - if (browser_window) - { - browser_window->enableLoadingOverlay( enable ); - } -} - -void LLQtWebKit::setPageZoomFactor( double factor ) -{ - LLEmbeddedBrowser::getInstance()->setPageZoomFactor( factor ); -} diff --git a/indra/llqtwebkit/llqtwebkit.h b/indra/llqtwebkit/llqtwebkit.h deleted file mode 100644 index 8e7ebd390..000000000 --- a/indra/llqtwebkit/llqtwebkit.h +++ /dev/null @@ -1,470 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLQTWEBKIT_H -#define LLQTWEBKIT_H - -#if defined _MSC_VER && _MSC_VER < 1600 -// no pstdint.h in the client where this header is used -typedef unsigned long uint32_t; -#else -#include // Use the C99 official header -#endif - -#include -#include -#include - -class LLEmbeddedBrowser; -class LLEmbeddedBrowserWindow; - -// Use this to conditionalize code that depends on particular changes to the llqtwebkit API. -// This can be useful for times when we're waiting for a rebuild on one platform or another. -// When you bump this number, please note what the changes were in a comment below the #define, -// and keep the existing comments as history. -#define LLQTWEBKIT_API_VERSION 16 -// version 16: - // Added LLQtWebKit::enableLoadingOverlay() -// version 15: - // Added LLQtWebKit::setPageZoomFactor() -// version 14: - // Added LLEmbeddedBrowserWindowObserver::onQtDebugMessage -// version 13: - // Added LLEmbeddedBrowserWindowObserver::onCertError -// version 12: - // Pass over value to indicate if host for current URL is trusted as per whitelist regex or not -// version 11: - // Added initial support for url/host whitelist via a regex -// version 10: - // Added initial support for creating and displaying the Qt Web Inspector -// version 9: - // Added initial support for exposing certain Second Life viewer/agent variables to JavaScript -// version 8: - // Removed calls to set/clear 404 redirects and made the API now emit an event that the - // consumer can catch and decide what to do when an HTTP status code after navigate is 400-499 -// version 7: - // Added LLEmbeddedBrowserWindowEvent::setNavigationType() && LLEmbeddedBrowserWindowEvent::getNavigationType() - // Used to pass (and retrieve) the type of navigation event that caused a link to be activated. -// version 6: - // Added LLQtWebKit::addCAFile() -// version 5: - // Added LLEmbeddedBrowserWindowObserver::onLinkHovered -// version 4: - // Added LLEmbeddedBrowserWindowObserver::onAuthRequest -// version 3: - // Added setIgnoreSSLCertErrors and getIgnoreSSLCertErrors -// version 2: - // Changed the usage of the event parameters in onClickLinkHref and onClickLinkNoFollow events slightly. - // The clicked URI for both should now be retrieved with getEventUri() instead of getStringValue(). - // The "target" string in onClickLinkHref is now retrieved with getStringValue() instead of getStringValue2(). - // The contents of getStringValue2() in the onClickLinkHref event is now a unique ID for the window proxy the click targets. - // Removed the "link target type" concept, since it doesn't really belong here. - // Removed most of the construtor variants in LLEmbeddedBrowserWindowEvent and added setters in their place. - // Removed setCaretColor, since it's done nothing for some time now. - // Added LLEmbeddedBrowserWindowObserver::onWindowGeometryChangeRequested - // Added -// version 1: - // Added the LLQTWEBKIT_API_VERSION define. - // Added LLEmbeddedBrowserWindowObserver::onWindowCloseRequested - -//////////////////////////////////////////////////////////////////////////////// -// data class that is passed with an event -class LLEmbeddedBrowserWindowEvent -{ - public: - LLEmbeddedBrowserWindowEvent(int window_id) : - mEventWindowId(window_id) - { - }; - - virtual ~LLEmbeddedBrowserWindowEvent() {} - - void setEventUri(const std::string &uri) { mEventUri = uri; } - void setNavigationType(const std::string &type) { mNavigationType = type; } - void setTrustedHost(const bool trusted) { mTrustedHost = trusted; } - void setIntValue(int val) { mIntVal = val; } - void setStringValue(const std::string &val) { mStringVal = val; } - void setStringValue2(const std::string &val) { mStringVal2 = val; } - void setRectValue(int x, int y, int width, int height) - { - mXVal = x; - mYVal = y; - mWidthVal = width; - mHeightVal = height; - } - - int getEventWindowId() const { return mEventWindowId; } - std::string getEventUri() const { return mEventUri; } - std::string getNavigationType() const { return mNavigationType; } - bool getTrustedHost() const { return mTrustedHost; } - int getIntValue() const { return mIntVal; }; - std::string getStringValue() const { return mStringVal; } - std::string getStringValue2() const { return mStringVal2; } - void getRectValue(int& x, int& y, int& width, int& height) const - { - x = mXVal; - y = mYVal; - width = mWidthVal; - height = mHeightVal; - }; - - private: - int mEventWindowId; - std::string mEventUri; - std::string mNavigationType; - bool mTrustedHost; - int mIntVal; - std::string mStringVal; - std::string mStringVal2; - int mXVal; - int mYVal; - int mWidthVal; - int mHeightVal; -}; - -//////////////////////////////////////////////////////////////////////////////// -// derrive from this class and override these methods to observe these events -#ifdef __GNUC__ -#pragma GCC visibility push(default) -#endif -class LLEmbeddedBrowserWindowObserver -{ - public: - virtual ~LLEmbeddedBrowserWindowObserver(); - typedef LLEmbeddedBrowserWindowEvent EventType; - - virtual void onCursorChanged(const EventType& event); - virtual void onPageChanged(const EventType& event); - virtual void onNavigateBegin(const EventType& event); - virtual void onNavigateComplete(const EventType& event); - virtual void onNavigateErrorPage(const EventType& event); - virtual void onUpdateProgress(const EventType& event); - virtual void onStatusTextChange(const EventType& event); - virtual void onTitleChange(const EventType& event); - virtual void onLocationChange(const EventType& event); - virtual void onClickLinkHref(const EventType& event); - virtual void onClickLinkNoFollow(const EventType& event); - virtual void onCookieChanged(const EventType& event); - // mStringVal will be the cookie in RFC 2109 string format - // mEventUri will be the url that caused the cookie change - // mIntVal will be true if the cookie is dead (i.e. being deleted), false otherwise - virtual std::string onRequestFilePicker(const EventType& event); - virtual void onWindowCloseRequested(const EventType& event); - virtual void onWindowGeometryChangeRequested(const EventType& event); - - // This should return true to attempt auth, or false to cancel. - virtual bool onAuthRequest(const std::string &in_url, const std::string &in_realm, std::string &out_username, std::string &out_password); - - // This should return true to continue after cert error, or false to cancel and abort. - virtual bool onCertError(const std::string &in_url, const std::string &in_msg); - - virtual void onLinkHovered(const EventType& event); - // mEventURI will be the link - // mStringVal will be the title - // mStringVal2 will be the text - - // catch qDebug() messages from Qt and pipe them back to host application - virtual void onQtDebugMessage( const std::string& msg, const std::string& msg_type); -}; -#ifdef __GNUC__ -#pragma GCC visibility pop -#endif - -//////////////////////////////////////////////////////////////////////////////// -// main library class - -#ifdef __GNUC__ -#pragma GCC visibility push(default) -#endif -class LLQtWebKit -{ - public: - typedef enum e_cursor - { - C_ARROW, - C_IBEAM, - C_SPLITV, - C_SPLITH, - C_POINTINGHAND - } ECursor; - - typedef enum e_user_action - { - UA_EDIT_CUT, - UA_EDIT_COPY, - UA_EDIT_PASTE, - UA_NAVIGATE_STOP, - UA_NAVIGATE_BACK, - UA_NAVIGATE_FORWARD, - UA_NAVIGATE_RELOAD - } EUserAction; - - typedef enum e_key_event - { - KE_KEY_DOWN, - KE_KEY_REPEAT, - KE_KEY_UP - }EKeyEvent; - - typedef enum e_mouse_event - { - ME_MOUSE_MOVE, - ME_MOUSE_DOWN, - ME_MOUSE_UP, - ME_MOUSE_DOUBLE_CLICK - }EMouseEvent; - - typedef enum e_mouse_button - { - MB_MOUSE_BUTTON_LEFT, - MB_MOUSE_BUTTON_RIGHT, - MB_MOUSE_BUTTON_MIDDLE, - MB_MOUSE_BUTTON_EXTRA_1, - MB_MOUSE_BUTTON_EXTRA_2, - }EMouseButton; - - typedef enum e_keyboard_modifier - { - KM_MODIFIER_NONE = 0x00, - KM_MODIFIER_SHIFT = 0x01, - KM_MODIFIER_CONTROL = 0x02, - KM_MODIFIER_ALT = 0x04, - KM_MODIFIER_META = 0x08 - }EKeyboardModifier; - - virtual ~LLQtWebKit(); - - // singleton access - static LLQtWebKit* getInstance(); - - // housekeeping - bool init(std::string application_directory, - std::string component_directory, - std::string profile_directory, - void* native_window_handle); - bool reset(); - bool clearCache(); - int getLastError(); - std::string getVersion(); - void setBrowserAgentId(std::string id); - bool enableProxy(bool enabled, std::string host_name, int port); - - void enableCookies(bool enabled); - bool clearAllCookies(); - - // The following two functions accept and return cookies in the same format that's used for the Set-Cookie: HTTP header - // as defined in RFC 2109 ( http://www.ietf.org/rfc/rfc2109.txt ). The string should not contain the literal "Set-Cookie:", - // just the cookie itself. - // Multiple cookies within the string are separated by a newline character ('\n') - void setCookies(const std::string &cookies); - std::string getAllCookies(); - - void enablePlugins(bool enabled); - void enableJavaScript(bool enabled); - - // Web inspector - Firebug-esque debugger - bool showWebInspector(bool show); - - // updates value of 'hostLanguage' in JavaScript 'Navigator' obect that - // embedded pages can query to see what language the host app is set to - void setHostLanguage(const std::string& host_language); - - // browser window - creation/deletion, mutation etc. - int createBrowserWindow(int width, int height, const std::string target = std::string("")); - void proxyWindowOpened(int browser_window_id, const std::string target, const std::string uuid); - void proxyWindowClosed(int browser_window_id, const std::string uuid); - bool destroyBrowserWindow(int browser_window_id); - bool setSize(int browser_window_id, int width, int height); - bool scrollByLines(int browser_window_id, int lines); - bool setBackgroundColor(int browser_window_id, const int red, const int green, const int blue); - bool setEnabled(int browser_window_id, bool enabled); - - // add/remove yourself as an observer on browser events - see LLEmbeddedBrowserWindowObserver declaration - bool addObserver(int browser_window_id, LLEmbeddedBrowserWindowObserver* subject); - bool remObserver(int browser_window_id, LLEmbeddedBrowserWindowObserver* subject); - - // navigation - self explanatory - bool navigateTo(int browser_window_id, const std::string uri); - bool userAction(int browser_window_id, EUserAction action); - bool userActionIsEnabled(int browser_window_id, EUserAction action); - - // javascript access/control - std::string evaluateJavaScript(int browser_window_id, const std::string script); - - // set/clear URL to redirect to when a 404 page is reached - bool set404RedirectUrl(int browser_window_in, std::string redirect_url); - bool clr404RedirectUrl(int browser_window_in); - - // access to rendered bitmap data - const unsigned char* grabBrowserWindow(int browser_window_id); // renders page to memory and returns pixels - const unsigned char* getBrowserWindowPixels(int browser_window_id); // just returns pixels - no render - bool flipWindow(int browser_window_id, bool flip); // optionally flip window (pixels) you get back - int getBrowserWidth(int browser_window_id); // current browser width (can vary slightly after page is rendered) - int getBrowserHeight(int browser_window_id); // current height - int getBrowserDepth(int browser_window_id); // depth in bytes - int getBrowserRowSpan(int browser_window_id); // width in pixels * depth in bytes - - // mouse/keyboard interaction - bool mouseEvent(int browser_window_id, EMouseEvent mouse_event, int button, int x, int y, EKeyboardModifier modifiers); // send a mouse event to a browser window at given XY in browser space - bool scrollWheelEvent(int browser_window_id, int x, int y, int scroll_x, int scroll_y, EKeyboardModifier modifiers); - bool keyboardEvent( - int browser_window_id, - EKeyEvent key_event, - uint32_t key_code, - const char *utf8_text, - EKeyboardModifier modifiers, - uint32_t native_scan_code = 0, - uint32_t native_virtual_key = 0, - uint32_t native_modifiers = 0); - - bool focusBrowser(int browser_window_id, bool focus_browser); // set/remove focus to given browser window - - // accessor/mutator for scheme that browser doesn't follow - e.g. secondlife.com:// - void setNoFollowScheme(int browser_window_id, std::string scheme); - std::string getNoFollowScheme(int browser_window_id); - - void pump(int max_milliseconds); - - void prependHistoryUrl(int browser_window_id, std::string url); - void clearHistory(int browser_window_id); - std::string dumpHistory(int browser_window_id); - - // Specify a path to a .pem file containing a list of CA certificates the browser should trust. - // NOTE that this will replace the default list of root certs (not add to it). - // If the file isn't found or doesn't contain any certs in the correct format, this call will have no effect and will return false. - // NOTE: Using this function causes strange cert verification issues on the Mac. - // Using addCAFile() instead seems to work better. - bool setCAFile(const std::string &ca_file); - - // This behaves similarly, but instead of replacing the entire list it appends additional trusted root certs to the current list. - bool addCAFile(const std::string &ca_file); - - // Set a flag causing all SSL cert errors to be ignored. - // NOTE: this should only be used for testing, as it negates the security model of https. - void setIgnoreSSLCertErrors(bool ignore); - bool getIgnoreSSLCertErrors(); - - const std::vector< std::string > getInstalledCertsList(); - - void enableQtMessageHandler( bool enable ); - - void enableLoadingOverlay( int browser_window_id, bool enable); - - // Copied from indra_constants.h. - // The key_code argument to keyboardEvent should either be one of these or a 7-bit ascii character. - enum keyCodes - { - // Leading zeroes ensure that these won't sign-extend when assigned to a larger type. - KEY_RETURN = 0x0081, - KEY_LEFT = 0x0082, - KEY_RIGHT = 0x0083, - KEY_UP = 0x0084, - KEY_DOWN = 0x0085, - KEY_ESCAPE = 0x0086, - KEY_BACKSPACE = 0x0087, - KEY_DELETE = 0x0088, - KEY_SHIFT = 0x0089, - KEY_CONTROL = 0x008A, - KEY_ALT = 0x008B, - KEY_HOME = 0x008C, - KEY_END = 0x008D, - KEY_PAGE_UP = 0x008E, - KEY_PAGE_DOWN = 0x008F, - KEY_HYPHEN = 0x0090, - KEY_EQUALS = 0x0091, - KEY_INSERT = 0x0092, - KEY_CAPSLOCK = 0x0093, - KEY_TAB = 0x0094, - KEY_ADD = 0x0095, - KEY_SUBTRACT = 0x0096, - KEY_MULTIPLY = 0x0097, - KEY_DIVIDE = 0x0098, - KEY_F1 = 0x00A1, - KEY_F2 = 0x00A2, - KEY_F3 = 0x00A3, - KEY_F4 = 0x00A4, - KEY_F5 = 0x00A5, - KEY_F6 = 0x00A6, - KEY_F7 = 0x00A7, - KEY_F8 = 0x00A8, - KEY_F9 = 0x00A9, - KEY_F10 = 0x00AA, - KEY_F11 = 0x00AB, - KEY_F12 = 0x00AC, - - KEY_PAD_UP = 0x00C0, - KEY_PAD_DOWN = 0x00C1, - KEY_PAD_LEFT = 0x00C2, - KEY_PAD_RIGHT = 0x00C3, - KEY_PAD_HOME = 0x00C4, - KEY_PAD_END = 0x00C5, - KEY_PAD_PGUP = 0x00C6, - KEY_PAD_PGDN = 0x00C7, - KEY_PAD_CENTER = 0x00C8, // the 5 in the middle - KEY_PAD_INS = 0x00C9, - KEY_PAD_DEL = 0x00CA, - KEY_PAD_RETURN = 0x00CB, - KEY_PAD_ADD = 0x00CC, - KEY_PAD_SUBTRACT = 0x00CD, - KEY_PAD_MULTIPLY = 0x00CE, - KEY_PAD_DIVIDE = 0x00CF, - - KEY_NONE = 0x00FF // not sent from keyboard. For internal use only. - }; - - // set the regex used to determine if a page is trusted or not - void setWhiteListRegex( int browser_window_id, const std::string& regex ); - - // Second Life specific functions - // (Note, this is a departure from the generic nature of this library) - void setSLObjectEnabled( bool enabled ); // enable or disaable feature - void setAgentLanguage( const std::string& agent_language ); // viewer language selected by agent - void setAgentRegion( const std::string& agent_region ); // name of region where agent is located - void setAgentLocation( double x, double y, double z ); // agent's x,y,z location within a region - void setAgentGlobalLocation( double x, double y, double z ); // agent's x,y,z location within the current grid - void setAgentOrientation( double angle ); // direction (0..359) agent is facing - void setAgentMaturity( const std::string& agent_maturity ); // selected maturity level of agent - void emitLocation(); - void emitMaturity(); - void emitLanguage(); - - // set the zoom factor for web pages ( can be less than 0.0) - void setPageZoomFactor( double factor ); - - private: - LLQtWebKit(); - LLEmbeddedBrowserWindow* getBrowserWindowFromWindowId(int browser_window_id); - static LLQtWebKit* sInstance; - const int mMaxBrowserWindows; - typedef std::map< int, LLEmbeddedBrowserWindow* > BrowserWindowMap; - typedef std::map< int, LLEmbeddedBrowserWindow* >::iterator BrowserWindowMapIter; - BrowserWindowMap mBrowserWindowMap; -}; - -#ifdef __GNUC__ -#pragma GCC visibility pop -#endif - -#endif // LLQTWEBKIT_H diff --git a/indra/llqtwebkit/llqtwebkit.pri b/indra/llqtwebkit/llqtwebkit.pri deleted file mode 100644 index 4f85aa423..000000000 --- a/indra/llqtwebkit/llqtwebkit.pri +++ /dev/null @@ -1,47 +0,0 @@ -DEPENDPATH += $$PWD -INCLUDEPATH += $$PWD - -!mac { -unix { - DEFINES += LL_LINUX -} -} - -mac { - DEFINES += LL_OSX -} - -win32{ - DEFINES += _WINDOWS -} - -# Input -HEADERS += llembeddedbrowser.h \ - llembeddedbrowser_p.h \ - llembeddedbrowserwindow.h \ - llembeddedbrowserwindow_p.h \ - llnetworkaccessmanager.h \ - llqtwebkit.h \ - llwebpage.h \ - llwebpageopenshim.h \ - llstyle.h \ - lljsobject.h - -SOURCES += llembeddedbrowser.cpp \ - llembeddedbrowserwindow.cpp \ - llnetworkaccessmanager.cpp \ - llqtwebkit.cpp \ - llwebpage.cpp \ - llwebpageopenshim.cpp \ - llstyle.cpp \ - lljsobject.cpp - -FORMS += passworddialog.ui - -RCC_DIR = .rcc -UI_DIR = .ui -MOC_DIR = .moc -OBJECTS_DIR = .obj - -include(static.pri) -include(qtwebkit_cookiejar/src/src.pri) diff --git a/indra/llqtwebkit/llqtwebkit.pro b/indra/llqtwebkit/llqtwebkit.pro deleted file mode 100644 index b6ff077bd..000000000 --- a/indra/llqtwebkit/llqtwebkit.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = lib -CONFIG += static staticlib # we always build as static lib whether Qt is static or not -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -include(llqtwebkit.pri) - -QT += webkit opengl network gui - -win32:CONFIG(debug,debug|release) { - TARGET = llqtwebkitd -} - -RCC_DIR = $$PWD/.rcc -UI_DIR = $$PWD/.ui -MOC_DIR = $$PWD/.moc -OBJECTS_DIR = $$PWD/.obj diff --git a/indra/llqtwebkit/llstyle.cpp b/indra/llqtwebkit/llstyle.cpp deleted file mode 100644 index 8822d481a..000000000 --- a/indra/llqtwebkit/llstyle.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include "llstyle.h" - -#include "llembeddedbrowserwindow_p.h" -#include -#include -#include - -LLStyle::LLStyle() - : QPlastiqueStyle() -{ -} - -void LLStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const -{ -#ifdef Q_WS_MAC - if (control == QStyle::CC_ScrollBar) { - QStyleOptionSlider* opt = (QStyleOptionSlider*)option; - const QPoint topLeft = opt->rect.topLeft(); - painter->translate(topLeft); - opt->rect.moveTo(QPoint(0, 0)); - painter->fillRect(opt->rect, opt->palette.background()); - } -#endif - QPlastiqueStyle::drawComplexControl(control, option, painter, widget); -} - -void LLStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const -{ - switch(element) - { - case CE_ScrollBarAddLine: - case CE_ScrollBarSubLine: - // This fixes the "scrollbar arrows pointing the wrong way" bug. - if (const QStyleOptionSlider *scrollBar = qstyleoption_cast(option)) - { - // Make the State_Horizontal bit in the option's state field match its orientation field. - QStyleOptionSlider localOption(*scrollBar); - if(localOption.orientation == Qt::Horizontal) - { - localOption.state |= State_Horizontal; - } - else - { - localOption.state &= ~State_Horizontal; - } - QPlastiqueStyle::drawControl(element, &localOption, painter, widget); - return; - } - default: - break; - } - - QPlastiqueStyle::drawControl(element, option, painter, widget); -} diff --git a/indra/llqtwebkit/llstyle.h b/indra/llqtwebkit/llstyle.h deleted file mode 100644 index 77c09b3bb..000000000 --- a/indra/llqtwebkit/llstyle.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLSTYLE_H -#define LLSTYLE_H - -#include - -class LLStyle : public QPlastiqueStyle -{ - -public: - explicit LLStyle(); - void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; - void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const; - -}; - -#endif - diff --git a/indra/llqtwebkit/llwebpage.cpp b/indra/llqtwebkit/llwebpage.cpp deleted file mode 100644 index 113c0c186..000000000 --- a/indra/llqtwebkit/llwebpage.cpp +++ /dev/null @@ -1,536 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include "llwebpage.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "llqtwebkit.h" -#include "llembeddedbrowser.h" -#include "llembeddedbrowserwindow.h" -#include "llembeddedbrowserwindow_p.h" -#include "lljsobject.h" - -LLWebPage::LLWebPage(QObject *parent) - : QWebPage(parent) - , window(0) - , mHostLanguage( "en" ) - , mWhiteListRegex( "" ) -{ - mJsObject = new LLJsObject( parent ); - - connect(this, SIGNAL(loadProgress(int)), - this, SLOT(loadProgressSlot(int))); - connect(this, SIGNAL(linkHovered(const QString &, const QString &, const QString &)), - this, SLOT(linkHoveredSlot(const QString &, const QString &, const QString &))); - connect(this, SIGNAL(statusBarMessage(const QString &)), - this, SLOT(statusBarMessageSlot(const QString &))); - connect(mainFrame(), SIGNAL(urlChanged(const QUrl&)), - this, SLOT(urlChangedSlot(const QUrl&))); - connect(this, SIGNAL(loadStarted()), - this, SLOT(loadStarted())); - connect(this, SIGNAL(loadFinished(bool)), - this, SLOT(loadFinished(bool))); - connect(this, SIGNAL(windowCloseRequested()), - this, SLOT(windowCloseRequested())); - connect(this, SIGNAL(geometryChangeRequested(const QRect&)), - this, SLOT(geometryChangeRequested(const QRect&))); - connect(mainFrame(), SIGNAL(titleChanged(const QString&)), - this, SLOT(titleChangedSlot(const QString&))); - connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), - this, SLOT(extendNavigatorObject())); -} - -LLWebPage::~LLWebPage() -{ - delete mJsObject; -} - -void LLWebPage::loadProgressSlot(int progress) -{ - if (!window) - return; - window->d->mPercentComplete = progress; - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - event.setIntValue(progress); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onUpdateProgress, event); - - if ( progress >= 100 ) - window->d->mShowLoadingOverlay = false; - - window->d->mDirty = true; - window->grabWindow(0,0,webView->boundingRect().width(),webView->boundingRect().height()); - - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onPageChanged, event); -} - -void LLWebPage::linkHoveredSlot(const QString &link, const QString &title, const QString &textContent) -{ - if (!window) - return; - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(llToStdString(link)); - event.setStringValue(llToStdString(title)); - event.setStringValue2(llToStdString(textContent)); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onLinkHovered, event); -} - -void LLWebPage::statusBarMessageSlot(const QString& text) -{ - if (!window) - return; - window->d->mStatusText = llToStdString(text); - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - event.setStringValue(window->d->mStatusText); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onStatusTextChange, event); -} - -void LLWebPage::titleChangedSlot(const QString& text) -{ - if (!window) - return; - window->d->mTitle = llToStdString(text); - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - event.setStringValue(window->d->mTitle); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onTitleChange, event); -} - -// set the regex used to determine if a page is trusted or not -void LLWebPage::setWhiteListRegex( const std::string& regex ) -{ - mWhiteListRegex = regex; -} - -void LLWebPage::configureTrustedPage( bool is_trusted ) -{ - // action happens in browser window parent - LLEmbeddedBrowser* parent_browser = 0; - if ( window && window->d && window->d->mParent ) - { - parent_browser = window->d->mParent; - if ( parent_browser ) - { - if ( is_trusted ) - { - //qDebug() << "Whitelist passed - turning on"; - - // trusted so turn everything on - parent_browser->enableJavaScriptTransient( true ); - parent_browser->enableCookiesTransient( true ); - parent_browser->enablePluginsTransient( true ); - } - else - { - //qDebug() << "Whitelist failed - reverting to default state"; - - // restore default state set by client - parent_browser->enableJavaScript( parent_browser->isJavaScriptEnabled() ); - parent_browser->enableCookies( parent_browser->areCookiesEnabled() ); - parent_browser->enablePlugins( parent_browser->arePluginsEnabled() ); - } - } - } -} - -bool LLWebPage::checkRegex( const QUrl& url ) -{ - QRegExp reg_exp( QString::fromStdString( mWhiteListRegex ) ); - reg_exp.setCaseSensitivity( Qt::CaseInsensitive ); - reg_exp.setMinimal( true ); - - if ( reg_exp.exactMatch( url.host() ) ) - { - return true; - } - else - { - return false; - } -} - -void LLWebPage::checkWhiteList( const QUrl& url ) -{ - if ( mWhiteListRegex.length() ) - { - if ( checkRegex( url ) ) - { - configureTrustedPage( true ); // page is "trusted" - go ahead and configure it as such - } - else - { - configureTrustedPage( false ); // page is "NOT trusted" - go ahead and configure it as such - } - } - else - // no regex specified, don't do anything (i.e. don't change trust state) - { - } -} - -void LLWebPage::urlChangedSlot(const QUrl& url) -{ - if (!window) - return; - - checkWhiteList( url ); - - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onLocationChange, event); -} - -bool LLWebPage::event(QEvent *event) -{ - bool result = QWebPage::event(event); - - if (event->type() == QEvent::GraphicsSceneMousePress) - currentPoint = ((QGraphicsSceneMouseEvent*)event)->pos().toPoint(); - else if(event->type() == QEvent::GraphicsSceneMouseRelease) - currentPoint = QPoint(); - - return result; -} - -bool LLWebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type) -{ - Q_UNUSED( frame ); - - if (!window) - return false; - - if (request.url().scheme() == window->d->mNoFollowScheme) - { - QString encodedUrl = request.url().toEncoded(); - // QUrl is turning foo:///home/bar into foo:/home/bar for some reason while Firefox does not - // http://bugs.webkit.org/show_bug.cgi?id=24695 - if (!encodedUrl.startsWith(window->d->mNoFollowScheme + "://")) { - encodedUrl = encodedUrl.mid(window->d->mNoFollowScheme.length() + 1); - encodedUrl = window->d->mNoFollowScheme + "://" + encodedUrl; - } - std::string rawUri = llToStdString(encodedUrl); - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(rawUri); - - // pass over the navigation type as per this page: http://apidocs.meego.com/1.1/core/html/qt4/qwebpage.html#NavigationType-enum - // pass as strings because telling everyone who needs to know about enums is too invasive. - std::string nav_type("unknown"); - if (type == QWebPage::NavigationTypeLinkClicked) nav_type="clicked"; - else - if (type == QWebPage::NavigationTypeFormSubmitted) nav_type="form_submited"; - else - if (type == QWebPage::NavigationTypeBackOrForward) nav_type="back_forward"; - else - if (type == QWebPage::NavigationTypeReload) nav_type="reloaded"; - else - if (type == QWebPage::NavigationTypeFormResubmitted) nav_type="form_resubmited"; - event.setNavigationType(nav_type); - - if ( mWhiteListRegex.length() ) - { - if ( frame ) - { - if ( checkRegex( frame->url() ) ) - { - event.setTrustedHost( true ); - } - else - { - event.setTrustedHost( false ); - } - } - else - // no frame - no trust (TODO: when can this happen?) - { - event.setTrustedHost( false ); - } - } - else - // no regex is like switching it off and indicating everything is trusted - { - event.setTrustedHost( true ); - } - - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onClickLinkNoFollow, event); - - //qDebug() << "LLWebPage::acceptNavigationRequest: sending onClickLinkNoFollow, NavigationType is " << type << ", url is " << QString::fromStdString(rawUri) ; - return false; - } - - - return true; -} - - -void LLWebPage::loadStarted() -{ - if (!window) - return; - - QUrl url( QString::fromStdString( window->getCurrentUri() ) ); - checkWhiteList( url ); - - window->d->mShowLoadingOverlay = true; - - window->d->mTimeLoadStarted=time(NULL); - - window->d->mDirty = true; - window->grabWindow(0,0,webView->boundingRect().width(),webView->boundingRect().height()); - - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onNavigateBegin, event); -} - -void LLWebPage::loadFinished(bool) -{ - if (!window) - return; - - window->d->mShowLoadingOverlay = false; - - window->d->mDirty = true; - window->grabWindow(0,0,webView->boundingRect().width(),webView->boundingRect().height()); - - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setEventUri(window->getCurrentUri()); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onPageChanged, event); - - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onNavigateComplete, event); -} - -void LLWebPage::windowCloseRequested() -{ - if (!window) - return; - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onWindowCloseRequested, event); -} - -void LLWebPage::geometryChangeRequested(const QRect& geom) -{ - if (!window) - return; - - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - // empty UUID indicates this is targeting the main window -// event.setStringValue(window->getUUID()); - event.setRectValue(geom.x(), geom.y(), geom.width(), geom.height()); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onWindowGeometryChangeRequested, event); -} - -QString LLWebPage::chooseFile(QWebFrame* parentFrame, const QString& suggestedFile) -{ - Q_UNUSED(parentFrame); - Q_UNUSED(suggestedFile); - - return QString::fromStdString( window->requestFilePicker() ); -} - -void LLWebPage::javaScriptAlert(QWebFrame* frame, const QString& msg) -{ - Q_UNUSED(frame); - QMessageBox *msgBox = new QMessageBox; - msgBox->setWindowTitle(tr("JavaScript Alert - %1").arg(mainFrame()->url().host())); - msgBox->setText(msg); - msgBox->addButton(QMessageBox::Ok); - - QGraphicsProxyWidget *proxy = webView->scene()->addWidget(msgBox); - proxy->setWindowFlags(Qt::Window); // this makes the item a panel (and will make it get a window 'frame') - proxy->setPanelModality(QGraphicsItem::SceneModal); - proxy->setPos((webView->boundingRect().width() - msgBox->sizeHint().width())/2, - (webView->boundingRect().height() - msgBox->sizeHint().height())/2); - proxy->setActive(true); // make it the active item - - connect(msgBox, SIGNAL(finished(int)), proxy, SLOT(deleteLater())); - msgBox->show(); - - webView->scene()->setFocusItem(proxy); -} - -bool LLWebPage::javaScriptConfirm(QWebFrame* frame, const QString& msg) -{ - Q_UNUSED(frame); - Q_UNUSED(msg); - qWarning() << "LLWebPage::" << __FUNCTION__ << "not implemented" << msg << "returning true"; - return true; -} - -bool LLWebPage::javaScriptPrompt(QWebFrame* frame, const QString& msg, const QString& defaultValue, QString* result) -{ - Q_UNUSED(frame); - Q_UNUSED(msg); - Q_UNUSED(defaultValue); - Q_UNUSED(result); - qWarning() << "LLWebPage::" << __FUNCTION__ << "not implemented" << msg << defaultValue << "returning false"; - return false; -} - -void LLWebPage::extendNavigatorObject() -{ - // legacy - will go away in the future - QString q_host_language = QString::fromStdString( mHostLanguage ); - mainFrame()->evaluateJavaScript(QString("navigator.hostLanguage=\"%1\"").arg( q_host_language )); - - // the new way - if ( mJsObject ) - { - bool enabled = mJsObject->getSLObjectEnabled(); - if ( enabled ) - { - mainFrame()->addToJavaScriptWindowObject("slviewer", mJsObject ); - }; - }; -} - -QWebPage *LLWebPage::createWindow(WebWindowType type) -{ - Q_UNUSED(type); - QWebPage *result = NULL; - - if(window) - { - result = window->createWindow(); - } - - return result; -} - -void LLWebPage::setHostLanguage(const std::string& host_language) -{ - mHostLanguage = host_language; -} - -bool LLWebPage::supportsExtension(QWebPage::Extension extension) const -{ - if (extension == QWebPage::ErrorPageExtension) - return true; - return false; -} - -bool LLWebPage::extension(Extension, const ExtensionOption* option, ExtensionReturn* output) -{ - const QWebPage::ErrorPageExtensionOption* info = static_cast(option); - QWebPage::ErrorPageExtensionReturn* errorPage = static_cast(output); - - errorPage->content = QString("Failed loading page

%1

") - .arg(info->errorString).toUtf8(); - - return true; -} - -// Second Life viewer specific functions -void LLWebPage::setSLObjectEnabled( bool enabled ) -{ - if ( mJsObject ) - mJsObject->setSLObjectEnabled( enabled ); -} - -void LLWebPage::setAgentLanguage( const std::string& agent_language ) -{ - if ( mJsObject ) - mJsObject->setAgentLanguage( QString::fromStdString( agent_language ) ); -} - -void LLWebPage::setAgentRegion( const std::string& agent_region ) -{ - if ( mJsObject ) - mJsObject->setAgentRegion( QString::fromStdString( agent_region ) ); -} - -void LLWebPage::setAgentLocation( double x, double y, double z ) -{ - if ( mJsObject ) - { - QVariantMap location; - location["x"] = x; - location["y"] = y; - location["z"] = z; - mJsObject->setAgentLocation( location ); - } -} - -void LLWebPage::setAgentGlobalLocation( double x, double y, double z ) -{ - if ( mJsObject ) - { - QVariantMap global_location; - global_location["x"] = x; - global_location["y"] = y; - global_location["z"] = z; - mJsObject->setAgentGlobalLocation( global_location ); - } -} - -void LLWebPage::setAgentOrientation( double angle ) -{ - if ( mJsObject ) - { - mJsObject->setAgentOrientation( angle ); - } -} - -void LLWebPage::setAgentMaturity( const std::string& agent_maturity ) -{ - if ( mJsObject ) - mJsObject->setAgentMaturity( QString::fromStdString( agent_maturity ) ); -} - -void LLWebPage::emitLocation() -{ - if ( mJsObject ) - mJsObject->emitLocation(); -} - -void LLWebPage::emitMaturity() -{ - if ( mJsObject ) - mJsObject->emitMaturity(); -} - -void LLWebPage::emitLanguage() -{ - if ( mJsObject ) - mJsObject->emitLanguage(); -} - -void LLWebPage::setPageZoomFactor( double factor ) -{ - if ( webView ) - { - webView->setZoomFactor( factor ); - } -} \ No newline at end of file diff --git a/indra/llqtwebkit/llwebpage.h b/indra/llqtwebkit/llwebpage.h deleted file mode 100644 index 1a882254f..000000000 --- a/indra/llqtwebkit/llwebpage.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLWEBPAGE_H -#define LLWEBPAGE_H - -class QGraphicsWebView; -#include -#include "llqtwebkit.h" - -class LLEmbeddedBrowserWindow; -class LLJsObject; - -class LLWebPage : public QWebPage -{ - Q_OBJECT - - public: - LLWebPage(QObject *parent = 0); - ~LLWebPage(); - - LLEmbeddedBrowserWindow *window; - bool event(QEvent *event); - - QGraphicsWebView *webView; - - void setHostLanguage(const std::string& host_language); - virtual bool supportsExtension(QWebPage::Extension extension) const; - virtual bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output); - - // set the regex used to determine if a page is trusted or not - void setWhiteListRegex( const std::string& regex ); - - // check the whitelist and update browser config as appropriate - void checkWhiteList( const QUrl& url ); - - // code to change settings if page is known to be trusted goes here - void configureTrustedPage( bool is_trusted ); - - // Second Life specific functions - void setAgentRegion( const std::string& agent_region ); - void setAgentLocation( double x, double y, double z ); - void setAgentGlobalLocation( double x, double y, double z ); - void setAgentOrientation( double angle ); - void setSLObjectEnabled( bool enabled ); - void setAgentLanguage( const std::string& agent_language ); - void setAgentMaturity( const std::string& agent_maturity ); - void emitLocation(); - void emitMaturity(); - void emitLanguage(); - - void setPageZoomFactor( double factor ); - - protected: - bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type); - - public slots: - void loadProgressSlot(int progress); - void linkHoveredSlot(const QString &link, const QString &title, const QString &textContent); - void statusBarMessageSlot(const QString &); - void titleChangedSlot(const QString &); - void urlChangedSlot(const QUrl& url); - void loadStarted(); - void loadFinished(bool ok); - void windowCloseRequested(); - void geometryChangeRequested(const QRect& geom); - - private slots: - void extendNavigatorObject(); - - protected: - QString chooseFile(QWebFrame* parentFrame, const QString& suggestedFile); - void javaScriptAlert(QWebFrame* frame, const QString& msg); - bool javaScriptConfirm(QWebFrame* frame, const QString& msg); - bool javaScriptPrompt(QWebFrame* frame, const QString& msg, const QString& defaultValue, QString* result); - QWebPage *createWindow(WebWindowType type); - - private: - bool checkRegex( const QUrl& url ); - QPoint currentPoint; - std::string mHostLanguage; - std::string mWhiteListRegex; - LLJsObject* mJsObject; -}; - -#endif diff --git a/indra/llqtwebkit/llwebpageopenshim.cpp b/indra/llqtwebkit/llwebpageopenshim.cpp deleted file mode 100644 index af9627907..000000000 --- a/indra/llqtwebkit/llwebpageopenshim.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include "llwebpageopenshim.h" - -#include -#include -#include -#include - -#include "llqtwebkit.h" -#include "llembeddedbrowserwindow.h" -#include "llembeddedbrowserwindow_p.h" - -LLWebPageOpenShim::LLWebPageOpenShim(LLEmbeddedBrowserWindow *in_window, QObject *parent) - : QWebPage(parent) - , window(in_window) - , mOpeningSelf(false) - , mGeometryChangeRequested(false) - , mHasSentUUID(false) -{ -// qDebug() << "LLWebPageOpenShim created"; - - connect(this, SIGNAL(windowCloseRequested()), - this, SLOT(windowCloseRequested())); - connect(this, SIGNAL(geometryChangeRequested(const QRect&)), - this, SLOT(geometryChangeRequested(const QRect&))); - - // Create a unique UUID for this proxy - mUUID = llToStdString(QUuid::createUuid().toString()); - - // mTarget starts out as the empty string, which is what we want. -} - -LLWebPageOpenShim::~LLWebPageOpenShim() -{ -// qDebug() << "LLWebPageOpenShim destroyed"; -} - -void LLWebPageOpenShim::windowCloseRequested() -{ -// qDebug() << "LLWebPageOpenShim::windowCloseRequested"; - if(window) - { - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setStringValue(mUUID); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onWindowCloseRequested, event); - } -} - -void LLWebPageOpenShim::geometryChangeRequested(const QRect& geom) -{ -// qDebug() << "LLWebPageOpenShim::geometryChangeRequested: " << geom ; - - // This seems to happen before acceptNavigationRequest is called. If this is the case, delay sending the message until afterwards. - - if(window && mHasSentUUID) - { - LLEmbeddedBrowserWindowEvent event(window->getWindowId()); - event.setStringValue(mUUID); - event.setRectValue(geom.x(), geom.y(), geom.width(), geom.height()); - window->d->mEventEmitter.update(&LLEmbeddedBrowserWindowObserver::onWindowGeometryChangeRequested, event); - } - else - { - mGeometry = geom; - mGeometryChangeRequested = true; - } - -} - -bool LLWebPageOpenShim::matchesTarget(const std::string target) -{ - return (target == mTarget); -} - -bool LLWebPageOpenShim::matchesUUID(const std::string uuid) -{ - return (uuid == mUUID); -} - -void LLWebPageOpenShim::setProxy(const std::string &target, const std::string &uuid) -{ - mTarget = target; - mUUID = uuid; - - mHasSentUUID = false; - - mOpeningSelf = true; - - mainFrame()->evaluateJavaScript(QString("window.open("", \"%1\");").arg( QString::fromStdString(target) )); -} - -bool LLWebPageOpenShim::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type) -{ - Q_UNUSED(type); - if (!window) - { - return false; - } - - if(mOpeningSelf) - { - qDebug() << "LLWebPageOpenShim::acceptNavigationRequest: reopening self to set target name."; - return true; - } - -#if 0 - qDebug() << "LLWebPageOpenShim::acceptNavigationRequest called, NavigationType is " << type - << ", web frame is " << frame - << ", frame->page is " << frame->page() - << ", url is " << request.url() - << ", frame name is " << frame->frameName() - ; -#endif - - if (request.url().scheme() == QString("file")) - { - // For some reason, I'm seeing a spurious call to this function with a file:/// URL that points to the current working directory. - // Ignoring file:/// URLs here isn't a perfect solution (since it could potentially break content in local HTML files), - // but it's the best I could come up with for now. - - return false; - } - - // The name of the incoming frame has been set to the link target that was used when opening this window. - std::string click_href = llToStdString(request.url()); - mTarget = llToStdString(frame->frameName()); - - // build event based on the data we have and emit it - LLEmbeddedBrowserWindowEvent event( window->getWindowId()); - event.setEventUri(click_href); - event.setStringValue(mTarget); - event.setStringValue2(mUUID); - - window->d->mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onClickLinkHref, event ); - - mHasSentUUID = true; - - if(mGeometryChangeRequested) - { - geometryChangeRequested(mGeometry); - mGeometryChangeRequested = false; - } - - return false; -} - -QWebPage *LLWebPageOpenShim::createWindow(WebWindowType type) -{ - Q_UNUSED(type); - - return this; -} diff --git a/indra/llqtwebkit/llwebpageopenshim.h b/indra/llqtwebkit/llwebpageopenshim.h deleted file mode 100644 index 322f832ce..000000000 --- a/indra/llqtwebkit/llwebpageopenshim.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef LLWEBPAGEOPENSHIM_H -#define LLWEBPAGEOPENSHIM_H - -#include - -class LLEmbeddedBrowserWindow; -class LLWebPageOpenShim : public QWebPage -{ - Q_OBJECT - - public: - LLWebPageOpenShim(LLEmbeddedBrowserWindow *in_window, QObject *parent = 0); - ~LLWebPageOpenShim(); - LLEmbeddedBrowserWindow *window; - bool matchesTarget(const std::string target); - bool matchesUUID(const std::string uuid); - void setProxy(const std::string &target, const std::string &uuid); - - public slots: - void windowCloseRequested(); - void geometryChangeRequested(const QRect& geom); - - protected: - bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type); - QWebPage *createWindow(WebWindowType type); - - private: - std::string mUUID; - std::string mTarget; - bool mOpeningSelf; - bool mGeometryChangeRequested; - bool mHasSentUUID; - QRect mGeometry; - -}; - -#endif - diff --git a/indra/llqtwebkit/passworddialog.ui b/indra/llqtwebkit/passworddialog.ui deleted file mode 100644 index 033514eff..000000000 --- a/indra/llqtwebkit/passworddialog.ui +++ /dev/null @@ -1,137 +0,0 @@ - - - PasswordDialog - - - - 0 - 0 - 394 - 183 - - - - Dialog - - - - - - Qt::Vertical - - - - 20 - 12 - - - - - - - - - - - true - - - - - - - - 32 - 32 - - - - icon - - - - - - - Qt::Vertical - - - - 20 - 13 - - - - - - - - User name: - - - - - - - - - - Password: - - - - - - - QLineEdit::Password - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - PasswordDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - PasswordDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/indra/llqtwebkit/pstdint.h b/indra/llqtwebkit/pstdint.h deleted file mode 100644 index b36f63db3..000000000 --- a/indra/llqtwebkit/pstdint.h +++ /dev/null @@ -1,728 +0,0 @@ -/* A portable stdint.h - **************************************************************************** - * BSD License: - **************************************************************************** - * - * Copyright (c) 2005-2007 Paul Hsieh - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - **************************************************************************** - * - * Version 0.1.10 - * - * The ANSI C standard committee, for the C99 standard, specified the - * inclusion of a new standard include file called stdint.h. This is - * a very useful and long desired include file which contains several - * very precise definitions for integer scalar types that is - * critically important for making portable several classes of - * applications including cryptography, hashing, variable length - * integer libraries and so on. But for most developers its likely - * useful just for programming sanity. - * - * The problem is that most compiler vendors have decided not to - * implement the C99 standard, and the next C++ language standard - * (which has a lot more mindshare these days) will be a long time in - * coming and its unknown whether or not it will include stdint.h or - * how much adoption it will have. Either way, it will be a long time - * before all compilers come with a stdint.h and it also does nothing - * for the extremely large number of compilers available today which - * do not include this file, or anything comparable to it. - * - * So that's what this file is all about. Its an attempt to build a - * single universal include file that works on as many platforms as - * possible to deliver what stdint.h is supposed to. A few things - * that should be noted about this file: - * - * 1) It is not guaranteed to be portable and/or present an identical - * interface on all platforms. The extreme variability of the - * ANSI C standard makes this an impossibility right from the - * very get go. Its really only meant to be useful for the vast - * majority of platforms that possess the capability of - * implementing usefully and precisely defined, standard sized - * integer scalars. Systems which are not intrinsically 2s - * complement may produce invalid constants. - * - * 2) There is an unavoidable use of non-reserved symbols. - * - * 3) Other standard include files are invoked. - * - * 4) This file may come in conflict with future platforms that do - * include stdint.h. The hope is that one or the other can be - * used with no real difference. - * - * 5) In the current verison, if your platform can't represent - * int32_t, int16_t and int8_t, it just dumps out with a compiler - * error. - * - * 6) 64 bit integers may or may not be defined. Test for their - * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. - * Note that this is different from the C99 specification which - * requires the existence of 64 bit support in the compiler. If - * this is not defined for your platform, yet it is capable of - * dealing with 64 bits then it is because this file has not yet - * been extended to cover all of your system's capabilities. - * - * 7) (u)intptr_t may or may not be defined. Test for its presence - * with the test: #ifdef PTRDIFF_MAX. If this is not defined - * for your platform, then it is because this file has not yet - * been extended to cover all of your system's capabilities, not - * because its optional. - * - * 8) The following might not been defined even if your platform is - * capable of defining it: - * - * WCHAR_MIN - * WCHAR_MAX - * (u)int64_t - * PTRDIFF_MIN - * PTRDIFF_MAX - * (u)intptr_t - * - * 9) The following have not been defined: - * - * WINT_MIN - * WINT_MAX - * - * 10) The criteria for defining (u)int_least(*)_t isn't clear, - * except for systems which don't have a type that precisely - * defined 8, 16, or 32 bit types (which this include file does - * not support anyways). Default definitions have been given. - * - * 11) The criteria for defining (u)int_fast(*)_t isn't something I - * would trust to any particular compiler vendor or the ANSI C - * committee. It is well known that "compatible systems" are - * commonly created that have very different performance - * characteristics from the systems they are compatible with, - * especially those whose vendors make both the compiler and the - * system. Default definitions have been given, but its strongly - * recommended that users never use these definitions for any - * reason (they do *NOT* deliver any serious guarantee of - * improved performance -- not in this file, nor any vendor's - * stdint.h). - * - * 12) The following macros: - * - * PRINTF_INTMAX_MODIFIER - * PRINTF_INT64_MODIFIER - * PRINTF_INT32_MODIFIER - * PRINTF_INT16_MODIFIER - * PRINTF_LEAST64_MODIFIER - * PRINTF_LEAST32_MODIFIER - * PRINTF_LEAST16_MODIFIER - * PRINTF_INTPTR_MODIFIER - * - * are strings which have been defined as the modifiers required - * for the "d", "u" and "x" printf formats to correctly output - * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, - * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. - * PRINTF_INTPTR_MODIFIER is not defined for some systems which - * provide their own stdint.h. PRINTF_INT64_MODIFIER is not - * defined if INT64_MAX is not defined. These are an extension - * beyond what C99 specifies must be in stdint.h. - * - * In addition, the following macros are defined: - * - * PRINTF_INTMAX_HEX_WIDTH - * PRINTF_INT64_HEX_WIDTH - * PRINTF_INT32_HEX_WIDTH - * PRINTF_INT16_HEX_WIDTH - * PRINTF_INT8_HEX_WIDTH - * PRINTF_INTMAX_DEC_WIDTH - * PRINTF_INT64_DEC_WIDTH - * PRINTF_INT32_DEC_WIDTH - * PRINTF_INT16_DEC_WIDTH - * PRINTF_INT8_DEC_WIDTH - * - * Which specifies the maximum number of characters required to - * print the number of that type in either hexadecimal or decimal. - * These are an extension beyond what C99 specifies must be in - * stdint.h. - * - * Compilers tested (all with 0 warnings at their highest respective - * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 - * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio - * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 - * - * This file should be considered a work in progress. Suggestions for - * improvements, especially those which increase coverage are strongly - * encouraged. - * - * Acknowledgements - * - * The following people have made significant contributions to the - * development and testing of this file: - * - * Chris Howie - * John Steele Scott - * Dave Thorup - * - */ - -#include -#include -#include - -/* - * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and - * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. - */ - -#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) )) && !defined (_PSTDINT_H_INCLUDED) -#include -#define _PSTDINT_H_INCLUDED -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -# endif -# ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -# endif -# ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -# endif -# ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -# endif -# ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "20" -# endif -# ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -# endif -# ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -# endif -# ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH -# endif - -/* - * Something really weird is going on with Open Watcom. Just pull some of - * these duplicated definitions from Open Watcom's stdint.h file for now. - */ - -# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 -# if !defined (INT64_C) -# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) -# endif -# if !defined (UINT64_C) -# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) -# endif -# if !defined (INT32_C) -# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) -# endif -# if !defined (UINT32_C) -# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) -# endif -# if !defined (INT16_C) -# define INT16_C(x) (x) -# endif -# if !defined (UINT16_C) -# define UINT16_C(x) (x) -# endif -# if !defined (INT8_C) -# define INT8_C(x) (x) -# endif -# if !defined (UINT8_C) -# define UINT8_C(x) (x) -# endif -# if !defined (UINT64_MAX) -# define UINT64_MAX 18446744073709551615ULL -# endif -# if !defined (INT64_MAX) -# define INT64_MAX 9223372036854775807LL -# endif -# if !defined (UINT32_MAX) -# define UINT32_MAX 4294967295UL -# endif -# if !defined (INT32_MAX) -# define INT32_MAX 2147483647L -# endif -# if !defined (INTMAX_MAX) -# define INTMAX_MAX INT64_MAX -# endif -# if !defined (INTMAX_MIN) -# define INTMAX_MIN INT64_MIN -# endif -# endif -#endif - -#ifndef _PSTDINT_H_INCLUDED -#define _PSTDINT_H_INCLUDED - -#ifndef SIZE_MAX -# define SIZE_MAX (~(size_t)0) -#endif - -/* - * Deduce the type assignments from limits.h under the assumption that - * integer sizes in bits are powers of 2, and follow the ANSI - * definitions. - */ - -#ifndef UINT8_MAX -# define UINT8_MAX 0xff -#endif -#ifndef uint8_t -# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) - typedef unsigned char uint8_t; -# define UINT8_C(v) ((uint8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef INT8_MAX -# define INT8_MAX 0x7f -#endif -#ifndef INT8_MIN -# define INT8_MIN INT8_C(0x80) -#endif -#ifndef int8_t -# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) - typedef signed char int8_t; -# define INT8_C(v) ((int8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef UINT16_MAX -# define UINT16_MAX 0xffff -#endif -#ifndef uint16_t -#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) - typedef unsigned int uint16_t; -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -# define UINT16_C(v) ((uint16_t) (v)) -#elif (USHRT_MAX == UINT16_MAX) - typedef unsigned short uint16_t; -# define UINT16_C(v) ((uint16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT16_MAX -# define INT16_MAX 0x7fff -#endif -#ifndef INT16_MIN -# define INT16_MIN INT16_C(0x8000) -#endif -#ifndef int16_t -#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) - typedef signed int int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -#elif (SHRT_MAX == INT16_MAX) - typedef signed short int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef UINT32_MAX -# define UINT32_MAX (0xffffffffUL) -#endif -#ifndef uint32_t -#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) - typedef unsigned long uint32_t; -# define UINT32_C(v) v ## UL -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (UINT_MAX == UINT32_MAX) - typedef unsigned int uint32_t; -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -# define UINT32_C(v) v ## U -#elif (USHRT_MAX == UINT32_MAX) - typedef unsigned short uint32_t; -# define UINT32_C(v) ((unsigned short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT32_MAX -# define INT32_MAX (0x7fffffffL) -#endif -#ifndef INT32_MIN -# define INT32_MIN INT32_C(0x80000000) -#endif -#ifndef int32_t -#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) - typedef signed long int32_t; -# define INT32_C(v) v ## L -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (INT_MAX == INT32_MAX) - typedef signed int int32_t; -# define INT32_C(v) v -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#elif (SHRT_MAX == INT32_MAX) - typedef signed short int32_t; -# define INT32_C(v) ((short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -/* - * The macro stdint_int64_defined is temporarily used to record - * whether or not 64 integer support is available. It must be - * defined for any 64 integer extensions for new platforms that are - * added. - */ - -#undef stdint_int64_defined -#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) -# if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# endif -#endif - -#if !defined (stdint_int64_defined) -# if defined(__GNUC__) -# define stdint_int64_defined - __extension__ typedef long long int64_t; - __extension__ typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) -# define stdint_int64_defined - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; -# define UINT64_C(v) v ## UI64 -# define INT64_C(v) v ## I64 -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "I64" -# endif -# endif -#endif - -#if !defined (LONG_LONG_MAX) && defined (INT64_C) -# define LONG_LONG_MAX INT64_C (9223372036854775807) -#endif -#ifndef ULONG_LONG_MAX -# define ULONG_LONG_MAX UINT64_C (18446744073709551615) -#endif - -#if !defined (INT64_MAX) && defined (INT64_C) -# define INT64_MAX INT64_C (9223372036854775807) -#endif -#if !defined (INT64_MIN) && defined (INT64_C) -# define INT64_MIN INT64_C (-9223372036854775808) -#endif -#if !defined (UINT64_MAX) && defined (INT64_C) -# define UINT64_MAX UINT64_C (18446744073709551615) -#endif - -/* - * Width of hexadecimal for number field. - */ - -#ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -#endif -#ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -#endif -#ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -#endif -#ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -#endif - -#ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "20" -#endif -#ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -#endif -#ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -#endif -#ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -#endif - -/* - * Ok, lets not worry about 128 bit integers for now. Moore's law says - * we don't need to worry about that until about 2040 at which point - * we'll have bigger things to worry about. - */ - -#ifdef stdint_int64_defined - typedef int64_t intmax_t; - typedef uint64_t uintmax_t; -# define INTMAX_MAX INT64_MAX -# define INTMAX_MIN INT64_MIN -# define UINTMAX_MAX UINT64_MAX -# define UINTMAX_C(v) UINT64_C(v) -# define INTMAX_C(v) INT64_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH -# endif -#else - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; -# define INTMAX_MAX INT32_MAX -# define UINTMAX_MAX UINT32_MAX -# define UINTMAX_C(v) UINT32_C(v) -# define INTMAX_C(v) INT32_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH -# endif -#endif - -/* - * Because this file currently only supports platforms which have - * precise powers of 2 as bit sizes for the default integers, the - * least definitions are all trivial. Its possible that a future - * version of this file could have different definitions. - */ - -#ifndef stdint_least_defined - typedef int8_t int_least8_t; - typedef uint8_t uint_least8_t; - typedef int16_t int_least16_t; - typedef uint16_t uint_least16_t; - typedef int32_t int_least32_t; - typedef uint32_t uint_least32_t; -# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER -# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER -# define UINT_LEAST8_MAX UINT8_MAX -# define INT_LEAST8_MAX INT8_MAX -# define UINT_LEAST16_MAX UINT16_MAX -# define INT_LEAST16_MAX INT16_MAX -# define UINT_LEAST32_MAX UINT32_MAX -# define INT_LEAST32_MAX INT32_MAX -# define INT_LEAST8_MIN INT8_MIN -# define INT_LEAST16_MIN INT16_MIN -# define INT_LEAST32_MIN INT32_MIN -# ifdef stdint_int64_defined - typedef int64_t int_least64_t; - typedef uint64_t uint_least64_t; -# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER -# define UINT_LEAST64_MAX UINT64_MAX -# define INT_LEAST64_MAX INT64_MAX -# define INT_LEAST64_MIN INT64_MIN -# endif -#endif -#undef stdint_least_defined - -/* - * The ANSI C committee pretending to know or specify anything about - * performance is the epitome of misguided arrogance. The mandate of - * this file is to *ONLY* ever support that absolute minimum - * definition of the fast integer types, for compatibility purposes. - * No extensions, and no attempt to suggest what may or may not be a - * faster integer type will ever be made in this file. Developers are - * warned to stay away from these types when using this or any other - * stdint.h. - */ - -typedef int_least8_t int_fast8_t; -typedef uint_least8_t uint_fast8_t; -typedef int_least16_t int_fast16_t; -typedef uint_least16_t uint_fast16_t; -typedef int_least32_t int_fast32_t; -typedef uint_least32_t uint_fast32_t; -#define UINT_FAST8_MAX UINT_LEAST8_MAX -#define INT_FAST8_MAX INT_LEAST8_MAX -#define UINT_FAST16_MAX UINT_LEAST16_MAX -#define INT_FAST16_MAX INT_LEAST16_MAX -#define UINT_FAST32_MAX UINT_LEAST32_MAX -#define INT_FAST32_MAX INT_LEAST32_MAX -#define INT_FAST8_MIN INT_LEAST8_MIN -#define INT_FAST16_MIN INT_LEAST16_MIN -#define INT_FAST32_MIN INT_LEAST32_MIN -#ifdef stdint_int64_defined - typedef int_least64_t int_fast64_t; - typedef uint_least64_t uint_fast64_t; -# define UINT_FAST64_MAX UINT_LEAST64_MAX -# define INT_FAST64_MAX INT_LEAST64_MAX -# define INT_FAST64_MIN INT_LEAST64_MIN -#endif - -#undef stdint_int64_defined - -/* - * Whatever piecemeal, per compiler thing we can do about the wchar_t - * type limits. - */ - -#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) -# include -# ifndef WCHAR_MIN -# define WCHAR_MIN 0 -# endif -# ifndef WCHAR_MAX -# define WCHAR_MAX ((wchar_t)-1) -# endif -#endif - -/* - * Whatever piecemeal, per compiler/platform thing we can do about the - * (u)intptr_t types and limits. - */ - -#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED) -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -#ifndef STDINT_H_UINTPTR_T_DEFINED -# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) -# define stdint_intptr_bits 64 -# elif defined (__WATCOMC__) || defined (__TURBOC__) -# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) -# define stdint_intptr_bits 16 -# else -# define stdint_intptr_bits 32 -# endif -# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) -# define stdint_intptr_bits 32 -# elif defined (__INTEL_COMPILER) -/* TODO -- what will Intel do about x86-64? */ -# endif - -# ifdef stdint_intptr_bits -# define stdint_intptr_glue3_i(a,b,c) a##b##c -# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) -# ifndef PRINTF_INTPTR_MODIFIER -# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) -# endif -# ifndef PTRDIFF_MAX -# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef PTRDIFF_MIN -# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef UINTPTR_MAX -# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MAX -# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MIN -# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef INTPTR_C -# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) -# endif -# ifndef UINTPTR_C -# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) -# endif - typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; - typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; -# else -/* TODO -- This following is likely wrong for some platforms, and does - nothing for the definition of uintptr_t. */ - typedef ptrdiff_t intptr_t; -# endif -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -/* - * Assumes sig_atomic_t is signed and we have a 2s complement machine. - */ - -#ifndef SIG_ATOMIC_MAX -# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) -#endif - -#endif diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/CMakeLists.txt b/indra/llqtwebkit/qtwebkit_cookiejar/CMakeLists.txt deleted file mode 100644 index 635765c83..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -# -*- cmake -*- - -add_subdirectory(src) diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/autotest/trie/trie.pro b/indra/llqtwebkit/qtwebkit_cookiejar/autotest/trie/trie.pro deleted file mode 100644 index c031e1971..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/autotest/trie/trie.pro +++ /dev/null @@ -1,15 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -win32: CONFIG += console -mac:CONFIG -= app_bundle - -CONFIG += qtestlib - -include(../../src/src.pri) - -# Input -SOURCES += tst_trie.cpp -HEADERS += diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/autotest/trie/tst_trie.cpp b/indra/llqtwebkit/qtwebkit_cookiejar/autotest/trie/tst_trie.cpp deleted file mode 100644 index e4bdc6d4e..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/autotest/trie/tst_trie.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include - -class tst_Trie : public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void trie_data(); - void trie(); - - void insert_data(); - void insert(); - void clear(); - void find_data(); - void find(); - void remove_data(); - void remove(); - void all(); -}; - -// Subclass that exposes the protected functions. -class SubTrie : public Trie -{ -public: - -}; - -// This will be called before the first test function is executed. -// It is only called once. -void tst_Trie::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_Trie::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_Trie::init() -{ -} - -// This will be called after every test function. -void tst_Trie::cleanup() -{ -} - -void tst_Trie::trie_data() -{ -} - -void tst_Trie::trie() -{ - SubTrie t; - t.clear(); - QCOMPARE(t.find(QStringList()), QList()); - QCOMPARE(t.remove(QStringList(), -1), false); - QCOMPARE(t.all(), QList()); - t.insert(QStringList(), -1); -} - -void tst_Trie::insert_data() -{ -#if 0 - QTest::addColumn("key"); - QTest::addColumn("value"); - QTest::newRow("null") << QStringList() << T(); -#endif -} - -// public void insert(QStringList const& key, T value) -void tst_Trie::insert() -{ -#if 0 - QFETCH(QStringList, key); - QFETCH(T, value); - - SubTrie t>; - - t>.insert(key, value); -#endif - QSKIP("Test is not implemented.", SkipAll); -} - -// public void clear() -void tst_Trie::clear() -{ - SubTrie t; - t.insert(QStringList(), 0); - t.clear(); - QCOMPARE(t.find(QStringList()), QList()); - QCOMPARE(t.all(), QList()); -} - -Q_DECLARE_METATYPE(QStringList) -typedef QList IntList; -Q_DECLARE_METATYPE(IntList) -void tst_Trie::find_data() -{ - QTest::addColumn("keys"); - QTest::addColumn("values"); - QTest::addColumn("find"); - QTest::addColumn("found"); - - QTest::newRow("null") << QStringList() << IntList() << QStringList() << IntList(); - - QStringList wiki = (QStringList() << "t,e,a" << "i" << "t,e,n" << "i,n" << "i,n,n" << "t,o"); - IntList wikiNum = (IntList() << 3 << 11 << 12 << 5 << 9 << 7); - - QTest::newRow("wikipedia-0") - << wiki - << wikiNum - << (QStringList() << "t") - << (IntList()); - - QTest::newRow("wikipedia-1") - << wiki - << wikiNum - << (QStringList() << "t" << "o") - << (IntList() << 7); - - QTest::newRow("wikipedia-2") - << (wiki << "t,o") - << (wikiNum << 4) - << (QStringList() << "t" << "o") - << (IntList() << 7 << 4); - - QTest::newRow("wikipedia-3") - << wiki - << wikiNum - << (QStringList() << "i" << "n" << "n") - << (IntList() << 9); - -} - -// public QList const find(QStringList const& key) -void tst_Trie::find() -{ - QFETCH(QStringList, keys); - QFETCH(IntList, values); - QFETCH(QStringList, find); - QFETCH(IntList, found); - - SubTrie t; - for (int i = 0; i < keys.count(); ++i) - t.insert(keys[i].split(","), values[i]); - QCOMPARE(t.all(), values); - QCOMPARE(t.find(find), found); -} - -void tst_Trie::remove_data() -{ - QTest::addColumn("keys"); - QTest::addColumn("values"); - QTest::addColumn("removeKey"); - QTest::addColumn("removeValue"); - QTest::addColumn("removed"); - - QTest::newRow("null") << QStringList() << IntList() << QStringList() << -1 << false; - - QStringList wiki = (QStringList() << "t,e,a" << "i" << "t,e,n" << "i,n" << "i,n,n" << "t,o"); - IntList wikiNum = (IntList() << 3 << 11 << 12 << 5 << 9 << 7); - - QTest::newRow("valid key-0") - << wiki - << wikiNum - << (QStringList() << "t") - << -1 - << false; - - QTest::newRow("valid key-1") - << wiki - << wikiNum - << (QStringList() << "t" << "o") - << -1 - << false; - - QTest::newRow("valid key-2") - << wiki - << wikiNum - << (QStringList() << "t" << "o" << "w") - << 2 - << false; - - QTest::newRow("valid key-3") - << wiki - << wikiNum - << (QStringList() << "t" << "o") - << 7 - << true; - - QTest::newRow("valid key-4") - << wiki - << wikiNum - << (QStringList() << "i" << "n") - << 3 - << false; - - QTest::newRow("valid key-5") - << wiki - << wikiNum - << (QStringList() << "i" << "n") - << 5 - << true; - -} - -// public bool remove(QStringList const& key, T value) -void tst_Trie::remove() -{ - QFETCH(QStringList, keys); - QFETCH(IntList, values); - QFETCH(QStringList, removeKey); - QFETCH(int, removeValue); - QFETCH(bool, removed); - - SubTrie t; - for (int i = 0; i < keys.count(); ++i) - t.insert(keys[i].split(","), values[i]); - QCOMPARE(t.all(), values); - QCOMPARE(t.remove(removeKey, removeValue), removed); - if (removed) - values.removeOne(removeValue); - QCOMPARE(t.all(), values); -} - -void tst_Trie::all() -{ - SubTrie t; - // hmm everyone else tests this it seems - QSKIP("Test is not implemented.", SkipAll); -} - -QTEST_MAIN(tst_Trie) -#include "tst_trie.moc" - diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/benchmark/networkcookiejar/cookiejar.pro b/indra/llqtwebkit/qtwebkit_cookiejar/benchmark/networkcookiejar/cookiejar.pro deleted file mode 100644 index 350fbc0f6..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/benchmark/networkcookiejar/cookiejar.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -win32: CONFIG += console -mac:CONFIG -= app_bundle - -CONFIG += qtestlib - -include(../../src/src.pri) -#include(../../../dev/code/webweaver/src/iris.pri) -#include(../../../dev/arora/src/src.pri) - -# Input -SOURCES += main.cpp -HEADERS += diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/benchmark/networkcookiejar/main.cpp b/indra/llqtwebkit/qtwebkit_cookiejar/benchmark/networkcookiejar/main.cpp deleted file mode 100644 index 863d6b0be..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/benchmark/networkcookiejar/main.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include -#include - -class CookieJarBenchmark: public QObject { - Q_OBJECT - -private slots: - void setCookiesFromUrl(); - void cookiesForUrl(); - void player(); - -private: - QNetworkCookieJar *getJar(bool populate = true); - QList generateCookies(int size); -}; - -QNetworkCookieJar *CookieJarBenchmark::getJar(bool populate) -{ - QNetworkCookieJar *jar; - if (qgetenv("JAR") == "CookieJar") { - jar = new NetworkCookieJar(this); - } else { - jar = new QNetworkCookieJar(this); - } - if (!populate) - return jar; - - // pre populate - for (int i = 0; i < 500; ++i) { - QList cookies = generateCookies(1); - QUrl url = QUrl(QString("http://%1").arg(cookies[0].domain())); - jar->setCookiesFromUrl(cookies, url); - } - - return jar; -} - -QList CookieJarBenchmark::generateCookies(int size) -{ - QList cookies; - for (int i = 0; i < size; ++i) { - QNetworkCookie cookie; - - QString tld; - int c = qrand() % 3; - if (c == 0) tld = "com"; - if (c == 1) tld = "net"; - if (c == 2) tld = "org"; - - QString mid; - int size = qrand() % 6 + 3; - while (mid.count() < size) - mid += QString(QChar::fromAscii(qrand() % 26 + 65)); - - QString sub; - c = qrand() % 3; - if (c == 0) sub = "."; - if (c == 1) sub = ".www."; - if (c == 2) sub = ".foo"; - - cookie.setDomain(QString("%1%2.%3").arg(sub).arg(mid).arg(tld)); - cookie.setName("a"); - cookie.setValue("b"); - cookie.setPath("/"); - cookies.append(cookie); - } - return cookies; -} - -void CookieJarBenchmark::setCookiesFromUrl() -{ - QNetworkCookieJar *jar = getJar(); - QList cookies = generateCookies(1); - QUrl url = QUrl(QString("http://%1").arg(cookies[0].domain())); - QBENCHMARK { - jar->setCookiesFromUrl(cookies, url); - } - delete jar; -} - -void CookieJarBenchmark::cookiesForUrl() -{ - QNetworkCookieJar *jar = getJar(); - QList cookies = generateCookies(1); - cookies[0].setDomain("www.foo.tld"); - QUrl url = QUrl("http://www.foo.tld"); - //QUrl url = QUrl(QString("http://foo%1/").arg(cookies[0].domain())); - jar->setCookiesFromUrl(cookies, url); - //qDebug() << cookies << url; - int c = 0; - QBENCHMARK { - c += jar->cookiesForUrl(url).count(); - } - delete jar; -} - -// Grab the cookie.log file from the manualtest/browser directory -void CookieJarBenchmark::player() -{ - QBENCHMARK { - QFile file("cookie.log"); - file.open(QFile::ReadOnly); - QDataStream stream(&file); - QNetworkCookieJar *jar = getJar(false); - while (!stream.atEnd()) { - QString command; - QUrl url; - stream >> command; - stream >> url; - //qDebug() << command << url; - if (command == "cookiesForUrl") { - jar->cookiesForUrl(url); - } - if (command == "setCookiesFromUrl") { - QByteArray data; - stream >> data; - QDataStream dstream(&data, QIODevice::ReadWrite); - qint32 c; - dstream >> c; - QList cookies; - for (int i = 0; i < c; ++i) { - QByteArray text; - dstream >> text; - cookies += QNetworkCookie::parseCookies(text); - } - jar->setCookiesFromUrl(cookies, url); - } - } - } -} - -QTEST_MAIN(CookieJarBenchmark) -#include "main.moc" diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/browser/browser.pro b/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/browser/browser.pro deleted file mode 100644 index a363bbefc..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/browser/browser.pro +++ /dev/null @@ -1,11 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Jan 7 13:19:00 2009 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . -include(../../src/src.pri) -# Input -SOURCES += main.cpp diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/browser/main.cpp b/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/browser/main.cpp deleted file mode 100644 index 6d21759fc..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/browser/main.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include -#include -#include - -QFile file; -QDataStream stream; - -class CookieLog : public NetworkCookieJar { - - Q_OBJECT - -public: - CookieLog(QObject *parent = 0) : NetworkCookieJar(parent) - { - file.setFileName("cookie.log"); - file.open(QFile::WriteOnly); - stream.setDevice(&file); - }; - - virtual QList cookiesForUrl(const QUrl & url) const - { - stream << QString("cookiesForUrl") << url; - QList cookies = NetworkCookieJar::cookiesForUrl(url); - //stream << "#" << cookies; - file.flush(); - return cookies; - } - - virtual bool setCookiesFromUrl(const QList &cookieList, const QUrl &url) - { - QByteArray data; - QDataStream dstream(&data, QIODevice::ReadWrite); - qint32 c = cookieList.count(); - dstream << c; - qDebug() << cookieList.count(); - for (int i = 0; i < c; ++i) - dstream << cookieList[i].toRawForm(); - dstream.device()->close(); - stream << QString("setCookiesFromUrl") << url << data;// << cookieList; - bool set = NetworkCookieJar::setCookiesFromUrl(cookieList, url); - file.flush(); - return set; - } - -}; - -int main(int argc, char**argv) { - QApplication application(argc, argv); - QWebView view; - QString url = "http://www.google.com"; - if (argc > 1) - url = argv[1]; - view.load(QUrl(url)); - view.page()->networkAccessManager()->setCookieJar(new CookieLog()); - view.show(); - return application.exec(); -} - -#include "main.moc" diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/fuzz/fuzz.pro b/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/fuzz/fuzz.pro deleted file mode 100644 index 0ad65f1bf..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/fuzz/fuzz.pro +++ /dev/null @@ -1,12 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Jan 7 13:19:00 2009 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . -include(../../src/src.pri) -DEFINES += QT_NO_CAST_FROM_ASCII QT_STRICT_ITERATOR -# Input -SOURCES += main.cpp diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/fuzz/main.cpp b/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/fuzz/main.cpp deleted file mode 100644 index 28c79a1c2..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/manualtest/fuzz/main.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include - -QStringList generateKey() { - QStringList key; - int size = qrand() % 20 + 3; - while (key.count() < size) - key += QString(QChar::fromAscii(qrand() % 26 + 64)); - return key; -} - -void basicCheck() { - QStringList list; - list << QLatin1String("to") << QLatin1String("tea") << QLatin1String("ten") << QLatin1String("i") << QLatin1String("in") << QLatin1String("inn"); - Trie trie; - for (int i = 0; i < list.count(); ++i) { - QString key = list[i]; - QStringList keyList; - for (int j = 0; j < key.count(); ++j) - keyList.append(QString(key[j])); - trie.insert(keyList, i); - } - QByteArray data; - { - QDataStream stream(&data, QIODevice::ReadWrite); - stream << trie; - } - Trie trie2; - { - QDataStream stream(&data, QIODevice::ReadOnly); - stream >> trie2; - } - for (int i = 0; i < list.count(); ++i) { - QString key = list[i]; - QStringList keyList; - for (int j = 0; j < key.count(); ++j) - keyList.append(QString(key[j])); - QList x = trie2.find(keyList); - qDebug() << x.count() << i << x[0] << i; - qDebug() << trie2.remove(keyList, i); - qDebug() << trie2.find(keyList).count(); - } -} - -int main(int argc, char **argv) { - Q_UNUSED(argc); - Q_UNUSED(argv); - - basicCheck(); - - QHash hash; - Trie t; - while (hash.count() < 500) { - qDebug() << hash.count(); - QStringList key = generateKey(); - int value = qrand() % 50000; - hash[key.join(QLatin1String(","))] = value; - t.insert(key, value); - - QHashIterator i(hash); - while (i.hasNext()) { - i.next(); - if (t.find(i.key().split(QLatin1Char(','))).count() == 0) - qDebug() << i.key(); - Q_ASSERT(t.find(i.key().split(QLatin1Char(','))).count() > 0); - if (qrand() % 500 == 0) { - t.remove(i.key().split(QLatin1Char(',')), i.value()); - hash.remove(i.key()); - } - //cout << i.key() << ": " << i.value() << endl; - } - } - return 0; -} - diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/src/CMakeLists.txt b/indra/llqtwebkit/qtwebkit_cookiejar/src/CMakeLists.txt deleted file mode 100644 index 20bacf3eb..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/src/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# -*- cmake -*- - -project(networkcookiejar) - -set(networkcookiejar_SOURCE_FILES - networkcookiejar.cpp - ) - -set(networkcookiejar_HEADER_FILES - networkcookiejar.h - networkcookiejar_p.h - trie_p.h - twoleveldomains_p.h - - ) - -QT4_WRAP_CPP(networkcookiejar_HEADERS_MOC ${networkcookiejar_HEADER_FILES}) - -add_library(networkcookiejar - ${networkcookiejar_SOURCE_FILES} - ${networkcookiejar_HEADERS_MOC} - ${networkcookiejar_UI_MOC} -) - -add_dependencies(networkcookiejar prepare) - -target_link_libraries(networkcookiejar) \ No newline at end of file diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar.cpp b/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar.cpp deleted file mode 100644 index 274d9e1c1..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar.cpp +++ /dev/null @@ -1,444 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include "networkcookiejar.h" -#include "networkcookiejar_p.h" -#include "twoleveldomains_p.h" - -//#define NETWORKCOOKIEJAR_DEBUG - -#ifndef QT_NO_DEBUG -// ^ Prevent being left on in a released product by accident -// qDebug any cookies that are rejected for further inspection -#define NETWORKCOOKIEJAR_LOGREJECTEDCOOKIES -#include -#endif - -#include -#include - -#if defined(NETWORKCOOKIEJAR_DEBUG) -#include -#endif - - -NetworkCookieJar::NetworkCookieJar(QObject *parent) - : QNetworkCookieJar(parent) -{ - d = new NetworkCookieJarPrivate; -} - -NetworkCookieJar::~NetworkCookieJar() -{ - delete d; -} - -static QStringList splitHost(const QString &host) { - QStringList parts = host.split(QLatin1Char('.'), QString::KeepEmptyParts); - // Remove empty components that are on the start and end - while (!parts.isEmpty() && parts.last().isEmpty()) - parts.removeLast(); - while (!parts.isEmpty() && parts.first().isEmpty()) - parts.removeFirst(); - return parts; -} - -inline static bool shorterPaths(const QNetworkCookie &c1, const QNetworkCookie &c2) -{ - return c2.path().length() < c1.path().length(); -} - -QList NetworkCookieJar::cookiesForUrl(const QUrl &url) const -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << url; -#endif - // Generate split host - QString host = url.host(); - if (url.scheme().toLower() == QLatin1String("file")) - host = QLatin1String("localhost"); - QStringList urlHost = splitHost(host); - - // Get all the cookies for url - QList cookies = d->tree.find(urlHost); - if (urlHost.count() > 2) { - int top = 2; - if (d->matchesBlacklist(urlHost.last())) - top = 3; - - urlHost.removeFirst(); - while (urlHost.count() >= top) { - cookies += d->tree.find(urlHost); - urlHost.removeFirst(); - } - } - - // Prevent doing anything expensive in the common case where - // there are no cookies to check - if (cookies.isEmpty()) - return cookies; - - QDateTime now = QDateTime::currentDateTime().toTimeSpec(Qt::UTC); - const QString urlPath = d->urlPath(url); - const bool isSecure = url.scheme().toLower() == QLatin1String("https"); - QList::iterator i = cookies.begin(); - for (; i != cookies.end();) { - if (!d->matchingPath(*i, urlPath)) { -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << __FUNCTION__ << "Ignoring cookie, path does not match" << *i << urlPath; -#endif - i = cookies.erase(i); - continue; - } - if (!isSecure && i->isSecure()) { - i = cookies.erase(i); -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << __FUNCTION__ << "Ignoring cookie, security mismatch" - << *i << !isSecure; -#endif - continue; - } - if (!i->isSessionCookie() && now > i->expirationDate()) { - // remove now (expensive short term) because there will - // probably be many more cookiesForUrl calls for this host - d->tree.remove(splitHost(i->domain()), *i); -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << __FUNCTION__ << "Ignoring cookie, expiration issue" - << *i << now; -#endif - i = cookies.erase(i); - continue; - } - ++i; - } - - // shorter paths should go first - qSort(cookies.begin(), cookies.end(), shorterPaths); -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << "returning" << cookies.count(); - qDebug() << cookies; -#endif - return cookies; -} - -static const qint32 NetworkCookieJarMagic = 0xae; - -QByteArray NetworkCookieJar::saveState () const -{ - int version = 1; - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - - stream << qint32(NetworkCookieJarMagic); - stream << qint32(version); - stream << d->tree; - return data; -} - -bool NetworkCookieJar::restoreState(const QByteArray &state) -{ - int version = 1; - QByteArray sd = state; - QDataStream stream(&sd, QIODevice::ReadOnly); - if (stream.atEnd()) - return false; - qint32 marker; - qint32 v; - stream >> marker; - stream >> v; - if (marker != NetworkCookieJarMagic || v != version) - return false; - stream >> d->tree; - if (stream.status() != QDataStream::Ok) { - d->tree.clear(); - return false; - } - return true; -} - -/*! - Remove any session cookies or cookies that have expired. - */ -void NetworkCookieJar::endSession() -{ - const QList cookies = d->tree.all(); - QDateTime now = QDateTime::currentDateTime().toTimeSpec(Qt::UTC); - QList::const_iterator i = cookies.constBegin(); - for (; i != cookies.constEnd();) { - if (i->isSessionCookie() - || (!i->isSessionCookie() && now > i->expirationDate())) { - d->tree.remove(splitHost(i->domain()), *i); - } - ++i; - } -} - -static const int maxCookiePathLength = 1024; - -bool NetworkCookieJar::setCookiesFromUrl(const QList &cookieList, const QUrl &url) -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << url; - qDebug() << cookieList; -#endif - QDateTime now = QDateTime::currentDateTime().toTimeSpec(Qt::UTC); - bool changed = false; - QString fullUrlPath = url.path(); - QString defaultPath = fullUrlPath.mid(0, fullUrlPath.lastIndexOf(QLatin1Char('/')) + 1); - if (defaultPath.isEmpty()) - defaultPath = QLatin1Char('/'); - - QString urlPath = d->urlPath(url); - foreach (QNetworkCookie cookie, cookieList) { - if (cookie.path().length() > maxCookiePathLength) - continue; - - bool alreadyDead = !cookie.isSessionCookie() && cookie.expirationDate() < now; - - if (cookie.path().isEmpty()) { - cookie.setPath(defaultPath); - } - // Matching the behavior of Firefox, no path checking is done when setting cookies - // Safari does something even odder, when that paths don't match it keeps - // the cookie, but changes the paths to the default path -#if 0 - else if (!d->matchingPath(cookie, urlPath)) { -#ifdef NETWORKCOOKIEJAR_LOGREJECTEDCOOKIES - qDebug() << "NetworkCookieJar::" << __FUNCTION__ - << "Blocked cookie because: path doesn't match: " << cookie << url; -#endif - continue; - } -#endif - - if (cookie.domain().isEmpty()) { - QString host = url.host().toLower(); - if (host.isEmpty()) - continue; - cookie.setDomain(host); - } else if (!d->matchingDomain(cookie, url)) { -#ifdef NETWORKCOOKIEJAR_LOGREJECTEDCOOKIES - qDebug() << "NetworkCookieJar::" << __FUNCTION__ - << "Blocked cookie because: domain doesn't match: " << cookie << url; -#endif - continue; - } - - // replace/remove existing cookies - removeCookie(cookie); - - // Notify derived class - onCookieSetFromURL(cookie, url, alreadyDead); - - if (alreadyDead) - continue; - - changed = true; - d->tree.insert(splitHost(cookie.domain()), cookie); - } - - return changed; -} - -QList NetworkCookieJar::allCookies() const -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__; -#endif - return d->tree.all(); -} - -void NetworkCookieJar::clearCookies() -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__; -#endif - d->tree.clear(); -} - -void NetworkCookieJar::setCookies(const QList &cookieList) -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << cookieList.count(); -#endif - - QDateTime now = QDateTime::currentDateTime().toTimeSpec(Qt::UTC); - - foreach (const QNetworkCookie &cookie, cookieList) - { - // If a matching cookie is already in the list, remove it. - removeCookie(cookie); - - if(!cookie.isSessionCookie() && cookie.expirationDate() < now) - { -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << "removing cookie: " << cookie; -#endif - // This cookie has expired -- don't re-add it - } - else - { -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << "adding cookie: " << cookie; -#endif - // this cookie has not expired -- save it - d->tree.insert(splitHost(cookie.domain()), cookie); - } - - } -} - -void NetworkCookieJar::setAllCookies(const QList &cookieList) -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << cookieList.count(); -#endif - clearCookies(); - setCookies(cookieList); -} - -void NetworkCookieJar::removeCookie(const QNetworkCookie &cookie) -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << "removing cookie: " << cookie; -#endif - - // If a cookie with the matching domain, path, and name exists in the cookiejar, remove it. - QString domain = cookie.domain(); - Q_ASSERT(!domain.isEmpty()); - QStringList urlHost = splitHost(domain); - - QList cookies = d->tree.find(urlHost); - QList::const_iterator it = cookies.constBegin(); - for (; it != cookies.constEnd(); ++it) - { - if (cookie.name() == it->name() && - domain == it->domain() && - cookie.path() == it->path()) - { -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << "found matching cookie: " << *it; -#endif - d->tree.remove(urlHost, *it); - break; - } - } -} - -void NetworkCookieJar::dump() -{ -#if defined(NETWORKCOOKIEJAR_DEBUG) - qDebug() << "NetworkCookieJar::" << __FUNCTION__ << "dumping all cookies: "; - QList cookies = allCookies(); - foreach (const QNetworkCookie &cookie, cookies) - { - qDebug() << " " << cookie; - } -#endif -} - -QString NetworkCookieJarPrivate::urlPath(const QUrl &url) const -{ - QString urlPath = url.path(); - if (!urlPath.endsWith(QLatin1Char('/'))) - urlPath += QLatin1Char('/'); - return urlPath; -} - -bool NetworkCookieJarPrivate::matchingPath(const QNetworkCookie &cookie, const QString &urlPath) const -{ - QString cookiePath = cookie.path(); - if (!cookiePath.endsWith(QLatin1Char('/'))) - cookiePath += QLatin1Char('/'); - - return urlPath.startsWith(cookiePath); -} - -bool NetworkCookieJarPrivate::matchesBlacklist(const QString &string) const -{ - if (!setSecondLevelDomain) { - // Alternatively to save a little bit of ram we could just - // use bsearch on twoLevelDomains in place - for (int j = 0; twoLevelDomains[j]; ++j) - secondLevelDomains += QLatin1String(twoLevelDomains[j]); - setSecondLevelDomain = true; - } - QStringList::const_iterator i = - qBinaryFind(secondLevelDomains.constBegin(), secondLevelDomains.constEnd(), string); - return (i != secondLevelDomains.constEnd()); -} - -bool NetworkCookieJarPrivate::matchingDomain(const QNetworkCookie &cookie, const QUrl &url) const -{ - QString domain = cookie.domain().simplified().toLower(); - domain.remove(QLatin1Char(' ')); - QStringList parts = splitHost(domain); - if (parts.isEmpty()) - return false; - - // When there is only one part only file://localhost/ is accepted - if (parts.count() == 1) { - QString s = parts.first(); - if (parts.first() != QLatin1String("localhost")) - return false; - if (url.scheme().toLower() == QLatin1String("file")) - return true; - } - - // Check for blacklist - if (parts.count() == 2 && matchesBlacklist(parts.last())) - return false; - - QStringList urlParts = url.host().toLower().split(QLatin1Char('.'), QString::SkipEmptyParts); - if (urlParts.isEmpty()) - return false; - while (urlParts.count() > parts.count()) - urlParts.removeFirst(); - - for (int j = 0; j < urlParts.count(); ++j) { - if (urlParts.at(j) != parts.at(j)) { - return false; - } - } - - return true; -} - -void NetworkCookieJar::setSecondLevelDomains(const QStringList &secondLevelDomains) -{ - d->setSecondLevelDomain = true; - d->secondLevelDomains = secondLevelDomains; - qSort(d->secondLevelDomains); -} - - -void NetworkCookieJar::onCookieSetFromURL(const QNetworkCookie &cookie, const QUrl &url, bool already_dead) -{ - Q_UNUSED(cookie); - Q_UNUSED(url); - Q_UNUSED(already_dead); - - // Derived classes can use this to track cookie changes. -} diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar.h b/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar.h deleted file mode 100644 index 86b14fa16..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef NETWORKCOOKIEJAR_H -#define NETWORKCOOKIEJAR_H - -#include - -class NetworkCookieJarPrivate; -class NetworkCookieJar : public QNetworkCookieJar { - Q_OBJECT -public: - NetworkCookieJar(QObject *parent = 0); - ~NetworkCookieJar(); - - virtual QList cookiesForUrl(const QUrl & url) const; - virtual bool setCookiesFromUrl(const QList &cookieList, const QUrl &url); - -protected: - QByteArray saveState() const; - bool restoreState(const QByteArray &state); - void endSession(); - - QList allCookies() const; - void clearCookies(); - void setCookies(const QList &cookieList); - void setAllCookies(const QList &cookieList); - void removeCookie(const QNetworkCookie &cookie); - void dump(); - void setSecondLevelDomains(const QStringList &secondLevelDomains); - - virtual void onCookieSetFromURL(const QNetworkCookie &cookie, const QUrl &url, bool already_dead); - -private: - NetworkCookieJarPrivate *d; -}; - -#endif - diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar_p.h b/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar_p.h deleted file mode 100644 index d8f22cfce..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/src/networkcookiejar_p.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef NETWORKCOOKIEJARPRIVATE_H -#define NETWORKCOOKIEJARPRIVATE_H - -#include "trie_p.h" - -QT_BEGIN_NAMESPACE -QDataStream &operator<<(QDataStream &stream, const QNetworkCookie &cookie) -{ - stream << cookie.toRawForm(); - return stream; -} - -QDataStream &operator>>(QDataStream &stream, QNetworkCookie &cookie) -{ - QByteArray value; - stream >> value; - QList newCookies = QNetworkCookie::parseCookies(value); - if (!newCookies.isEmpty()) - cookie = newCookies.first(); - return stream; -} -QT_END_NAMESPACE - -class NetworkCookieJarPrivate { -public: - NetworkCookieJarPrivate() - : setSecondLevelDomain(false) - {} - - Trie tree; - mutable bool setSecondLevelDomain; - mutable QStringList secondLevelDomains; - - bool matchesBlacklist(const QString &string) const; - bool matchingDomain(const QNetworkCookie &cookie, const QUrl &url) const; - QString urlPath(const QUrl &url) const; - bool matchingPath(const QNetworkCookie &cookie, const QString &urlPath) const; -}; - -#endif - diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/src/src.pri b/indra/llqtwebkit/qtwebkit_cookiejar/src/src.pri deleted file mode 100644 index 78ac273a1..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/src/src.pri +++ /dev/null @@ -1,5 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -HEADERS += trie_p.h networkcookiejar.h twoleveldomains_p.h networkcookiejar_p.h -SOURCES += networkcookiejar.cpp diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/src/trie_p.h b/indra/llqtwebkit/qtwebkit_cookiejar/src/trie_p.h deleted file mode 100644 index a4959a198..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/src/trie_p.h +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef TRIE_H -#define TRIE_H - -//#define TRIE_DEBUG - -#include - -#if defined(TRIE_DEBUG) -#include -#endif - -/* - A Trie tree (prefix tree) where the lookup takes m in the worst case. - - The key is stored in *reverse* order - - Example: - Keys: x,a y,a - - Trie: - a - | \ - x y -*/ - -template -class Trie { -public: - Trie(); - ~Trie(); - - void clear(); - void insert(const QStringList &key, const T &value); - bool remove(const QStringList &key, const T &value); - QList find(const QStringList &key) const; - QList all() const; - - inline bool contains(const QStringList &key) const; - inline bool isEmpty() const { return children.isEmpty() && values.isEmpty(); } - -private: - const Trie* walkTo(const QStringList &key) const; - Trie* walkTo(const QStringList &key, bool create = false); - - template friend QDataStream &operator<<(QDataStream &, const Trie&); - template friend QDataStream &operator>>(QDataStream &, Trie&); - - QList values; - QStringList childrenKeys; - QList > children; -}; - -template -Trie::Trie() { -} - -template -Trie::~Trie() { -} - -template -void Trie::clear() { -#if defined(TRIE_DEBUG) - qDebug() << "Trie::" << __FUNCTION__; -#endif - values.clear(); - childrenKeys.clear(); - children.clear(); -} - -template -bool Trie::contains(const QStringList &key) const { - return walkTo(key); -} - -template -void Trie::insert(const QStringList &key, const T &value) { -#if defined(TRIE_DEBUG) - qDebug() << "Trie::" << __FUNCTION__ << key << value; -#endif - Trie *node = walkTo(key, true); - if (node) - node->values.append(value); -} - -template -bool Trie::remove(const QStringList &key, const T &value) { -#if defined(TRIE_DEBUG) - qDebug() << "Trie::" << __FUNCTION__ << key << value; -#endif - Trie *node = walkTo(key, true); - if (node) { - bool removed = node->values.removeOne(value); - if (!removed) - return false; - - // A faster implementation of removing nodes up the tree - // can be created if profile shows this to be slow - QStringList subKey = key; - while (node->values.isEmpty() - && node->children.isEmpty() - && !subKey.isEmpty()) { - QString currentLevelKey = subKey.first(); - QStringList parentKey = subKey.mid(1); - Trie *parent = walkTo(parentKey, false); - Q_ASSERT(parent); - QStringList::iterator iterator; - iterator = qBinaryFind(parent->childrenKeys.begin(), - parent->childrenKeys.end(), - currentLevelKey); - Q_ASSERT(iterator != parent->childrenKeys.end()); - int index = iterator - parent->childrenKeys.begin(); - parent->children.removeAt(index); - parent->childrenKeys.removeAt(index); - - node = parent; - subKey = parentKey; - } - return removed; - } - return false; -} - -template -QList Trie::find(const QStringList &key) const { -#if defined(TRIE_DEBUG) - qDebug() << "Trie::" << __FUNCTION__ << key; -#endif - const Trie *node = walkTo(key); - if (node) - return node->values; - return QList(); -} - -template -QList Trie::all() const { -#if defined(TRIE_DEBUG) - qDebug() << "Trie::" << __FUNCTION__; -#endif - QList all = values; - for (int i = 0; i < children.count(); ++i) - all += children[i].all(); - return all; -} - -template -QDataStream &operator<<(QDataStream &out, const Trie&trie) { - out << trie.values; - out << trie.childrenKeys; - out << trie.children; - Q_ASSERT(trie.childrenKeys.count() == trie.children.count()); - return out; -} - -template -QDataStream &operator>>(QDataStream &in, Trie &trie) { - trie.clear(); - if (in.status() != QDataStream::Ok) - return in; - in >> trie.values; - in >> trie.childrenKeys; - in >> trie.children; - //Q_ASSERT(trie.childrenKeys.count() == trie.children.count()); - if (trie.childrenKeys.count() != trie.children.count()) - in.setStatus(QDataStream::ReadCorruptData); - return in; -} - -// Very fast const walk -template -const Trie* Trie::walkTo(const QStringList &key) const { - const Trie *node = this; - QStringList::const_iterator childIterator; - QStringList::const_iterator begin, end; - - int depth = key.count() - 1; - while (depth >= 0) { - const QString currentLevelKey = key.at(depth--); - begin = node->childrenKeys.constBegin(); - end = node->childrenKeys.constEnd(); - childIterator = qBinaryFind(begin, end, currentLevelKey); - if (childIterator == end) - return 0; - node = &node->children.at(childIterator - begin); - } - return node; -} - -template -Trie* Trie::walkTo(const QStringList &key, bool create) { - QStringList::iterator iterator; - Trie *node = this; - QStringList::iterator begin, end; - int depth = key.count() - 1; - while (depth >= 0) { - const QString currentLevelKey = key.at(depth--); - begin = node->childrenKeys.begin(); - end = node->childrenKeys.end(); - iterator = qBinaryFind(begin, end, currentLevelKey); -#if defined(TRIE_DEBUG) - qDebug() << "\t" << node << key << currentLevelKey << node->childrenKeys; -#endif - int index = -1; - if (iterator == end) { - if (!create) - return 0; - iterator = qLowerBound(begin, - end, - currentLevelKey); - index = iterator - begin; - node->childrenKeys.insert(iterator, currentLevelKey); - node->children.insert(index, Trie()); - } else { - index = iterator - begin; - } - Q_ASSERT(index >= 0 && index < node->children.count()); - node = &node->children[index]; - } - return node; -} - -#endif diff --git a/indra/llqtwebkit/qtwebkit_cookiejar/src/twoleveldomains_p.h b/indra/llqtwebkit/qtwebkit_cookiejar/src/twoleveldomains_p.h deleted file mode 100644 index e4c046cb6..000000000 --- a/indra/llqtwebkit/qtwebkit_cookiejar/src/twoleveldomains_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -// Updated from https://wiki.mozilla.org/TLD_List#External_Links -// To set a custom list use NetworkCookieJar::setSecondLevelDomains() -static const char *const twoLevelDomains[] = { - "ao", - "ar", - "arpa", - "bd", - "bn", - "br", - "co", - "cr", - "cy", - "do", - "eg", - "et", - "fj", - "fk", - "gh", - "gn", - "gu", - "id", - "il", - "jm", - "ke", - "kh", - "ki", - "kw", - "kz", - "lb", - "lc", - "lr", - "ls", - "ml", - "mm", - "mv", - "mw", - "mx", - "my", - "ng", - "ni", - "np", - "nz", - "om", - "pa", - "pe", - "pg", - "pw", - "py", - "qa", - "sa", - "sb", - "sv", - "sy", - "th", - "tn", - "tz", - "uk", - "uy", - "va", - "ve", - "ye", - "yu", - "za", - "zm", - "zw", - 0 -}; diff --git a/indra/llqtwebkit/static.pri b/indra/llqtwebkit/static.pri deleted file mode 100644 index 8c282347d..000000000 --- a/indra/llqtwebkit/static.pri +++ /dev/null @@ -1,18 +0,0 @@ -# Detect if Qt is static or shared -CONFIG(debug, debug|release) { - win32:PRL = $$[QT_INSTALL_LIBS] QtGui.prl -} else { - win32:PRL = $$[QT_INSTALL_LIBS] QtGuid.prl -} - -unix:!mac: PRL = $$[QT_INSTALL_LIBS] libQtGui.prl -mac: PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl -include($$join(PRL, "/")) - -contains(QMAKE_PRL_CONFIG, static) { - DEFINES += STATIC_QT - QTPLUGIN += qgif -} else { - DEFINES += SHARED_QT -} - diff --git a/indra/llqtwebkit/tests/3dgl/3dgl.cpp b/indra/llqtwebkit/tests/3dgl/3dgl.cpp deleted file mode 100644 index c07c5d89c..000000000 --- a/indra/llqtwebkit/tests/3dgl/3dgl.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ -#define FREEGLUT_STATIC - -#include "zpr.h" -#include "llqtwebkit.h" - -#include -#include -#include -#include - -bool gDebugMode = false; -int gBrowserWindowId=-1; -GLuint gBrowserTexture=-1; -GLuint gCheckerTexture=-1; - -// manually make part of the browser texture transparent - for testing - LLQtWebKit will handle this eventually -void alphaize_browser_texture(unsigned char* texture_pixels) -{ - const int texture_depth=4; - - int texture_width = LLQtWebKit::getInstance()->getBrowserWidth(gBrowserWindowId); - int texture_height = LLQtWebKit::getInstance()->getBrowserHeight(gBrowserWindowId); - - const int num_squares=16; - int sqr1_alpha=0xff; - int sqr2_alpha=0x00; - - for(int y1=0;y1pump(200); - LLQtWebKit::getInstance()->grabBrowserWindow( gBrowserWindowId ); - glutPostRedisplay(); - }; -} - -void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - - glBindTexture(GL_TEXTURE_2D, gCheckerTexture); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glBegin(GL_QUADS); - glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.8f, -0.8f, -0.8f); - glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.8f, 0.8f, -0.8f); - glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.8f, 0.8f, -0.8f); - glTexCoord2f(0.0f, 0.0f); glVertex3f( 0.8f, -0.8f, -0.8f); - glEnd(); - - glBindTexture(GL_TEXTURE_2D, gBrowserTexture); - if(!gDebugMode) - { - const unsigned char* browser_pixels=LLQtWebKit::getInstance()->getBrowserWindowPixels(gBrowserWindowId); - if(browser_pixels) - { - int texture_width = LLQtWebKit::getInstance()->getBrowserWidth(gBrowserWindowId); - int texture_height = LLQtWebKit::getInstance()->getBrowserHeight(gBrowserWindowId); - int texture_depth = 4; - - unsigned char* texture_pixels = new unsigned char[texture_width*texture_height*texture_depth]; - memcpy(texture_pixels, browser_pixels, texture_width*texture_height*texture_depth); - alphaize_browser_texture(texture_pixels); - - glTexSubImage2D(GL_TEXTURE_2D, 0, - 0, 0, - texture_width, texture_height, - GL_RGBA, - GL_UNSIGNED_BYTE, - texture_pixels); - - delete [] texture_pixels; - }; - }; - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.8f, -0.8f, 0.8f); - glTexCoord2f(1.0f, 0.0f); glVertex3f( 0.8f, -0.8f, 0.8f); - glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.8f, 0.8f, 0.8f); - glTexCoord2f(0.0f, 1.0f); glVertex3f(-0.8f, 0.8f, 0.8f); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - -GLuint make_rgba_texture(int texture_width, int texture_height) -{ - const int texture_depth=4; - - unsigned char* texture_pixels = new unsigned char[texture_width*texture_height*texture_depth]; - - const int num_squares=rand()%10+10; - int sqr1_r=rand()%0xa0+0x20; - int sqr1_g=rand()%0xa0+0x20; - int sqr1_b=rand()%0xa0+0x20; - int sqr1_alpha=0xff; - - int sqr2_r=rand()%0xa0+0x20; - int sqr2_g=rand()%0xa0+0x20; - int sqr2_b=rand()%0xa0+0x20; - int sqr2_alpha=0x00; - - for(int y1=0;y1init(std::string(), app_dir, profile_dir, GetDesktopWindow()); - - LLQtWebKit::getInstance()->enableJavaScript(true); - LLQtWebKit::getInstance()->enableCookies(true); - LLQtWebKit::getInstance()->enablePlugins(true); - - const std::string start_url("http://news.google.com"); - //const std::string start_url("http://www.youtube.com/watch?v=4Z3r9X8OahA&feature=rbl_entertainment"); - gBrowserWindowId=LLQtWebKit::getInstance()->createBrowserWindow(browser_width, browser_height); - LLQtWebKit::getInstance()->setSize(gBrowserWindowId, browser_width, browser_height); - LLQtWebKit::getInstance()->flipWindow(gBrowserWindowId, true); - LLQtWebKit::getInstance()->navigateTo(gBrowserWindowId, start_url); - } - - gCheckerTexture = make_rgba_texture( browser_width, browser_height); - - glutMainLoop(); - - return 0; -} diff --git a/indra/llqtwebkit/tests/3dgl/3dgl.pro b/indra/llqtwebkit/tests/3dgl/3dgl.pro deleted file mode 100644 index 6285128ef..000000000 --- a/indra/llqtwebkit/tests/3dgl/3dgl.pro +++ /dev/null @@ -1,38 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../../ -CONFIG -= app_bundle - -QT += webkit opengl network - -!mac { -unix { - DEFINES += LL_LINUX - LIBS += -lglui -lglut - LIBS += $$PWD/../../libllqtwebkit.a -} -} - -mac { - DEFINES += LL_OSX - LIBS += -framework GLUT -framework OpenGL - LIBS += $$PWD/libllqtwebkit.dylib -} - -win32 { - DEFINES += _WINDOWS - INCLUDEPATH += ../ - INCLUDEPATH += $$PWD/../../stage/packages/include - DESTDIR=../build - release { - LIBS += $$PWD/../../Release/llqtwebkit.lib - LIBS += $$PWD/../build/freeglut_static.lib - LIBS += comdlg32.lib - } -} - -include(../../static.pri) - -SOURCES += 3dgl.cpp zpr.c diff --git a/indra/llqtwebkit/tests/3dgl/zpr.c b/indra/llqtwebkit/tests/3dgl/zpr.c deleted file mode 100644 index 65373efc5..000000000 --- a/indra/llqtwebkit/tests/3dgl/zpr.c +++ /dev/null @@ -1,429 +0,0 @@ -#include -#include -#include -#include - -#include "zpr.h" - -/* This code was originally C++ :-) */ - -#define bool int -#define true 1 -#define false 0 - -static double _left = 0.0; -static double _right = 0.0; -static double _bottom = 0.0; -static double _top = 0.0; -static double _zNear = -10.0; -static double _zFar = 10.0; - -static int _mouseX = 0; -static int _mouseY = 0; -static bool _mouseLeft = false; -static bool _mouseMiddle = false; -static bool _mouseRight = false; - -static double _dragPosX = 0.0; -static double _dragPosY = 0.0; -static double _dragPosZ = 0.0; - -static double _matrix[16]; -static double _matrixInverse[16]; - -static double vlen(double x,double y,double z); -static void pos(double *px,double *py,double *pz,const int x,const int y,const int *viewport); -static void getMatrix(); -static void invertMatrix(const GLdouble *m, GLdouble *out ); - -static void zprReshape(int w,int h); -static void zprMouse(int button, int state, int x, int y); -static void zprMotion(int x, int y); - -static void zprPick(GLdouble x, GLdouble y,GLdouble delX, GLdouble delY); - -/* Configurable center point for zooming and rotation */ - -GLfloat zprReferencePoint[4] = { 0,0,0,0 }; - -void -zprInit() -{ - getMatrix(); - - glutReshapeFunc(zprReshape); - glutMouseFunc(zprMouse); - glutMotionFunc(zprMotion); -} - -static void -zprReshape(int w,int h) -{ - glViewport(0,0,w,h); - - _top = 1.0; - _bottom = -1.0; - _left = -(double)w/(double)h; - _right = -_left; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(_left,_right,_bottom,_top,_zNear,_zFar); - - glMatrixMode(GL_MODELVIEW); -} - -static void -zprMouse(int button, int state, int x, int y) -{ - GLint viewport[4]; - - /* Do picking */ - if (state==GLUT_DOWN) - zprPick(x,glutGet(GLUT_WINDOW_HEIGHT)-1-y,3,3); - - _mouseX = x; - _mouseY = y; - - if (state==GLUT_UP) - switch (button) - { - case GLUT_LEFT_BUTTON: _mouseLeft = false; break; - case GLUT_MIDDLE_BUTTON: _mouseMiddle = false; break; - case GLUT_RIGHT_BUTTON: _mouseRight = false; break; - } - else - switch (button) - { - case GLUT_LEFT_BUTTON: _mouseLeft = true; break; - case GLUT_MIDDLE_BUTTON: _mouseMiddle = true; break; - case GLUT_RIGHT_BUTTON: _mouseRight = true; break; - } - - glGetIntegerv(GL_VIEWPORT,viewport); - pos(&_dragPosX,&_dragPosY,&_dragPosZ,x,y,viewport); - glutPostRedisplay(); -} - -static void -zprMotion(int x, int y) -{ - bool changed = false; - - const int dx = x - _mouseX; - const int dy = y - _mouseY; - - GLint viewport[4]; - glGetIntegerv(GL_VIEWPORT,viewport); - - if (dx==0 && dy==0) - return; - - if (_mouseMiddle || (_mouseLeft && _mouseRight)) - { - double s = exp((double)dy*0.01); - - glTranslatef( zprReferencePoint[0], zprReferencePoint[1], zprReferencePoint[2]); - glScalef(s,s,s); - glTranslatef(-zprReferencePoint[0],-zprReferencePoint[1],-zprReferencePoint[2]); - - changed = true; - } - else - if (_mouseLeft) - { - double ax,ay,az; - double bx,by,bz; - double angle; - - ax = dy; - ay = dx; - az = 0.0; - angle = vlen(ax,ay,az)/(double)(viewport[2]+1)*180.0; - - /* Use inverse matrix to determine local axis of rotation */ - - bx = _matrixInverse[0]*ax + _matrixInverse[4]*ay + _matrixInverse[8] *az; - by = _matrixInverse[1]*ax + _matrixInverse[5]*ay + _matrixInverse[9] *az; - bz = _matrixInverse[2]*ax + _matrixInverse[6]*ay + _matrixInverse[10]*az; - - glTranslatef( zprReferencePoint[0], zprReferencePoint[1], zprReferencePoint[2]); - glRotatef(angle,bx,by,bz); - glTranslatef(-zprReferencePoint[0],-zprReferencePoint[1],-zprReferencePoint[2]); - - changed = true; - } - else - if (_mouseRight) - { - double px,py,pz; - - pos(&px,&py,&pz,x,y,viewport); - - glLoadIdentity(); - glTranslatef(px-_dragPosX,py-_dragPosY,pz-_dragPosZ); - glMultMatrixd(_matrix); - - _dragPosX = px; - _dragPosY = py; - _dragPosZ = pz; - - changed = true; - } - - _mouseX = x; - _mouseY = y; - - if (changed) - { - getMatrix(); - glutPostRedisplay(); - } -} - -/***************************************************************** - * Utility functions - *****************************************************************/ - -static double -vlen(double x,double y,double z) -{ - return sqrt(x*x+y*y+z*z); -} - -static void -pos(double *px,double *py,double *pz,const int x,const int y,const int *viewport) -{ - /* - Use the ortho projection and viewport information - to map from mouse co-ordinates back into world - co-ordinates - */ - - *px = (double)(x-viewport[0])/(double)(viewport[2]); - *py = (double)(y-viewport[1])/(double)(viewport[3]); - - *px = _left + (*px)*(_right-_left); - *py = _top + (*py)*(_bottom-_top); - *pz = _zNear; -} - -static void -getMatrix() -{ - glGetDoublev(GL_MODELVIEW_MATRIX,_matrix); - invertMatrix(_matrix,_matrixInverse); -} - -/* - * From Mesa-2.2\src\glu\project.c - * - * Compute the inverse of a 4x4 matrix. Contributed by scotter@lafn.org - */ - -static void -invertMatrix(const GLdouble *m, GLdouble *out ) -{ - -/* NB. OpenGL Matrices are COLUMN major. */ -#define MAT(m,r,c) (m)[(c)*4+(r)] - -/* Here's some shorthand converting standard (row,column) to index. */ -#define m11 MAT(m,0,0) -#define m12 MAT(m,0,1) -#define m13 MAT(m,0,2) -#define m14 MAT(m,0,3) -#define m21 MAT(m,1,0) -#define m22 MAT(m,1,1) -#define m23 MAT(m,1,2) -#define m24 MAT(m,1,3) -#define m31 MAT(m,2,0) -#define m32 MAT(m,2,1) -#define m33 MAT(m,2,2) -#define m34 MAT(m,2,3) -#define m41 MAT(m,3,0) -#define m42 MAT(m,3,1) -#define m43 MAT(m,3,2) -#define m44 MAT(m,3,3) - - GLdouble det; - GLdouble d12, d13, d23, d24, d34, d41; - GLdouble tmp[16]; /* Allow out == in. */ - - /* Inverse = adjoint / det. (See linear algebra texts.)*/ - - /* pre-compute 2x2 dets for last two rows when computing */ - /* cofactors of first two rows. */ - d12 = (m31*m42-m41*m32); - d13 = (m31*m43-m41*m33); - d23 = (m32*m43-m42*m33); - d24 = (m32*m44-m42*m34); - d34 = (m33*m44-m43*m34); - d41 = (m34*m41-m44*m31); - - tmp[0] = (m22 * d34 - m23 * d24 + m24 * d23); - tmp[1] = -(m21 * d34 + m23 * d41 + m24 * d13); - tmp[2] = (m21 * d24 + m22 * d41 + m24 * d12); - tmp[3] = -(m21 * d23 - m22 * d13 + m23 * d12); - - /* Compute determinant as early as possible using these cofactors. */ - det = m11 * tmp[0] + m12 * tmp[1] + m13 * tmp[2] + m14 * tmp[3]; - - /* Run singularity test. */ - if (det == 0.0) { - /* printf("invert_matrix: Warning: Singular matrix.\n"); */ -/* memcpy(out,_identity,16*sizeof(double)); */ - } - else { - GLdouble invDet = 1.0 / det; - /* Compute rest of inverse. */ - tmp[0] *= invDet; - tmp[1] *= invDet; - tmp[2] *= invDet; - tmp[3] *= invDet; - - tmp[4] = -(m12 * d34 - m13 * d24 + m14 * d23) * invDet; - tmp[5] = (m11 * d34 + m13 * d41 + m14 * d13) * invDet; - tmp[6] = -(m11 * d24 + m12 * d41 + m14 * d12) * invDet; - tmp[7] = (m11 * d23 - m12 * d13 + m13 * d12) * invDet; - - /* Pre-compute 2x2 dets for first two rows when computing */ - /* cofactors of last two rows. */ - d12 = m11*m22-m21*m12; - d13 = m11*m23-m21*m13; - d23 = m12*m23-m22*m13; - d24 = m12*m24-m22*m14; - d34 = m13*m24-m23*m14; - d41 = m14*m21-m24*m11; - - tmp[8] = (m42 * d34 - m43 * d24 + m44 * d23) * invDet; - tmp[9] = -(m41 * d34 + m43 * d41 + m44 * d13) * invDet; - tmp[10] = (m41 * d24 + m42 * d41 + m44 * d12) * invDet; - tmp[11] = -(m41 * d23 - m42 * d13 + m43 * d12) * invDet; - tmp[12] = -(m32 * d34 - m33 * d24 + m34 * d23) * invDet; - tmp[13] = (m31 * d34 + m33 * d41 + m34 * d13) * invDet; - tmp[14] = -(m31 * d24 + m32 * d41 + m34 * d12) * invDet; - tmp[15] = (m31 * d23 - m32 * d13 + m33 * d12) * invDet; - - memcpy(out, tmp, 16*sizeof(GLdouble)); - } - -#undef m11 -#undef m12 -#undef m13 -#undef m14 -#undef m21 -#undef m22 -#undef m23 -#undef m24 -#undef m31 -#undef m32 -#undef m33 -#undef m34 -#undef m41 -#undef m42 -#undef m43 -#undef m44 -#undef MAT -} - -/***************************************** Picking ****************************************************/ - -static void (*selection)(void) = NULL; -static void (*pick)(GLint name) = NULL; - -void zprSelectionFunc(void (*f)(void)) -{ - selection = f; -} - -void zprPickFunc(void (*f)(GLint name)) -{ - pick = f; -} - -/* Draw in selection mode */ - -static void -zprPick(GLdouble x, GLdouble y,GLdouble delX, GLdouble delY) -{ - GLuint buffer[1024]; - const int bufferSize = sizeof(buffer)/sizeof(GLuint); - - GLint viewport[4]; - GLdouble projection[16]; - - GLint hits; - GLint i,j,k; - - GLint min = -1; - GLuint minZ = -1; - - glSelectBuffer(bufferSize,buffer); /* Selection buffer for hit records */ - glRenderMode(GL_SELECT); /* OpenGL selection mode */ - glInitNames(); /* Clear OpenGL name stack */ - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); /* Push current projection matrix */ - glGetIntegerv(GL_VIEWPORT,viewport); /* Get the current viewport size */ - glGetDoublev(GL_PROJECTION_MATRIX,projection); /* Get the projection matrix */ - glLoadIdentity(); /* Reset the projection matrix */ - gluPickMatrix(x,y,delX,delY,viewport); /* Set the picking matrix */ - glMultMatrixd(projection); /* Apply projection matrix */ - - glMatrixMode(GL_MODELVIEW); - - if (selection) - selection(); /* Draw the scene in selection mode */ - - hits = glRenderMode(GL_RENDER); /* Return to normal rendering mode */ - - /* Diagnostic output to stdout */ - - #ifndef NDEBUG - if (hits!=0) - { - printf("hits = %d\n",hits); - - for (i=0,j=0; i rotate - * Middle button -> zoom - * Right button -> pan - * - * Picking is also provided via two configurable callbacks: - * - * void zprSelectionFunc(void (*f)(void)) - * - * The draw function to be called in OpenGL selection - * mode in response to a mouse-down button event. - * - * void zprPickFunc(void (*f)(GLint name)) - * - * The callback function which will receive the - * top-most item of the name stack of the closest selection - * hit. If there is no selection hit, -1 - * - * Limitations - * ----------- - * - * Works best with zprReferencePoint appropriately configured. - * Works best with ortho projection. - * You may need to use glEnable(GL_NORMALIZATION) for correct lighting. - * Near and far clip planes are hard-coded. - * Zooming and rotation is centered on the origin. - * Only one window can use the callbacks at one time. - * - */ - -#ifdef WIN32 -#include -#endif - -#define FREEGLUT_STATIC - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* - * - */ - -/* Mouse Manipulation API */ - -void zprInit(); - -extern GLfloat zprReferencePoint[4]; - -/* Picking API (Optional) */ - -extern void zprSelectionFunc(void (*f)(void)); /* Selection-mode draw function */ -extern void zprPickFunc(void (*f)(GLint name)); /* Pick event handling function */ - -/* - * - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/indra/llqtwebkit/tests/qttestapp/main.cpp b/indra/llqtwebkit/tests/qttestapp/main.cpp deleted file mode 100644 index 3ab3a9c17..000000000 --- a/indra/llqtwebkit/tests/qttestapp/main.cpp +++ /dev/null @@ -1,341 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#include -#include - -class WebPage : public QWidget, LLEmbeddedBrowserWindowObserver -{ - Q_OBJECT - -signals: - void locationChanged(const QString &); - void canGoBack(bool); - void canGoForward(bool); - -public: - WebPage(QWidget *parent = 0); - ~WebPage(); - - void onCursorChanged(const EventType& event); - void onPageChanged(const EventType& event); - void onNavigateBegin(const EventType& event); - void onNavigateComplete(const EventType& event); - void onUpdateProgress(const EventType& event); - void onStatusTextChange(const EventType& event); - void onLocationChange(const EventType& event); - void onClickLinkHref(const EventType& event); - void onClickLinkNoFollow(const EventType& event); - -public slots: - void goBack(); - void goForward(); - void reload(); - void loadUrl(const QString &); - -protected: - void resizeEvent(QResizeEvent *event); - void paintEvent(QPaintEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *event); -private: - void updateSLvariables(); - int mBrowserWindowId; -}; - -WebPage::WebPage(QWidget *parent) - : QWidget(parent) -{ - setMouseTracking(true); - std::string applicationDir = std::string(); - std::string componentDir = applicationDir; - std::string profileDir = applicationDir + "\\" + "testGL_profile"; - LLQtWebKit::getInstance()->init(applicationDir, componentDir, profileDir, 0); - - mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow(width(), height()); - - // observer events that LLQtWebKit emits - LLQtWebKit::getInstance()->addObserver( mBrowserWindowId, this ); - - // append details to agent string - LLQtWebKit::getInstance()->setBrowserAgentId("testqtapp"); - - // don't flip bitmap - LLQtWebKit::getInstance()->flipWindow(mBrowserWindowId, false); - - // test Second Life viewer specific functions - LLQtWebKit::getInstance()->setSLObjectEnabled( true ); // true means feature is turned on - LLQtWebKit::getInstance()->setAgentLanguage( "tst-en" ); // viewer language selected by agent - LLQtWebKit::getInstance()->setAgentRegion( "QtTestAppRegion" ); // name of region where agent is located - LLQtWebKit::getInstance()->setAgentLocation( 9.8, 7.6, 5.4 ); // agent's x,y,z location within a region - LLQtWebKit::getInstance()->setAgentGlobalLocation( 119.8, 227.6, 335.4 ); // agent's x,y,z location within the grid - LLQtWebKit::getInstance()->setAgentMaturity( "Very immature" ); // selected maturity level of agent - LLQtWebKit::getInstance()->setAgentOrientation( (rand()%36000)/100.0f ); // direction avatar is facing - LLQtWebKit::getInstance()->emitLocation(); - LLQtWebKit::getInstance()->emitLanguage(); - LLQtWebKit::getInstance()->emitMaturity(); - - // go to the "home page" - LLQtWebKit::getInstance()->navigateTo(mBrowserWindowId, "http://callum-linden.s3.amazonaws.com/browsertest.html"); -} - -WebPage::~WebPage() -{ - // unhook observer - LLQtWebKit::getInstance()->remObserver( mBrowserWindowId, this ); - - // clean up - LLQtWebKit::getInstance()->reset(); -} - -void WebPage::updateSLvariables() -{ - // randomly update SL values to test - LLQtWebKit::getInstance()->setAgentOrientation( (rand()%36000)/100.0f ); - LLQtWebKit::getInstance()->setAgentLocation( (rand()%25600)/100.0f, (rand()%25600)/100.0f, (rand()%25600)/100.0f ); - LLQtWebKit::getInstance()->setAgentGlobalLocation( (rand()%25600)/100.0f, (rand()%25600)/100.0f, (rand()%25600)/100.0f ); - - if ( rand() % 2 ) - LLQtWebKit::getInstance()->setAgentLanguage( "One language" ); - else - LLQtWebKit::getInstance()->setAgentLanguage( "Another language" ); - - if ( rand() % 2 ) - LLQtWebKit::getInstance()->setAgentRegion( "Region Wibble" ); - else - LLQtWebKit::getInstance()->setAgentRegion( "Region Flasm" ); - - if ( rand() % 2 ) - LLQtWebKit::getInstance()->setAgentMaturity( "Adults only" ); - else - LLQtWebKit::getInstance()->setAgentMaturity( "Children only" ); - - LLQtWebKit::getInstance()->emitLocation(); - LLQtWebKit::getInstance()->emitLanguage(); - LLQtWebKit::getInstance()->emitMaturity(); -} - -void WebPage::onCursorChanged(const EventType& event) -{ - //qDebug() << __FUNCTION__ << QString::fromStdString(event.getEventUri()); - switch (event.getIntValue()) { - case LLQtWebKit::C_ARROW: setCursor(QCursor(Qt::ArrowCursor)); break; - case LLQtWebKit::C_IBEAM: setCursor(QCursor(Qt::IBeamCursor)); break; - case LLQtWebKit::C_SPLITV: setCursor(QCursor(Qt::SplitHCursor)); break; - case LLQtWebKit::C_SPLITH: setCursor(QCursor(Qt::SplitVCursor)); break; - case LLQtWebKit::C_POINTINGHAND: setCursor(QCursor(Qt::PointingHandCursor)); break; - default: break; - } -} - -void WebPage::onPageChanged(const EventType& event) -{ - Q_UNUSED(event); - LLQtWebKit::getInstance()->grabBrowserWindow( mBrowserWindowId ); - //qDebug() << __FUNCTION__ << QString::fromStdString(event.getEventUri()); - update(); -} - -void WebPage::onNavigateBegin(const EventType& event) -{ - Q_UNUSED(event); - //qDebug() << __FUNCTION__ << QString::fromStdString(event.getEventUri()); -} - -void WebPage::onNavigateComplete(const EventType& event) -{ - Q_UNUSED(event); - //qDebug() << __FUNCTION__ << QString::fromStdString(event.getEventUri()); -} - -void WebPage::onUpdateProgress(const EventType& event) -{ - Q_UNUSED(event); -} - -void WebPage::onStatusTextChange(const EventType& event) -{ - Q_UNUSED(event); -} - -void WebPage::onLocationChange(const EventType& event) -{ - //qDebug() << __FUNCTION__; - emit locationChanged(QString::fromStdString(event.getEventUri())); - //void canGoBack(bool); - //void canGoForward(bool); -} - -void WebPage::onClickLinkHref(const EventType& event) -{ - Q_UNUSED(event); -} - -void WebPage::onClickLinkNoFollow(const EventType& event) -{ - Q_UNUSED(event); -} - -void WebPage::resizeEvent(QResizeEvent *event) -{ - LLQtWebKit::getInstance()->setSize(mBrowserWindowId, event->size().width(), event->size().height()); - QWidget::resizeEvent(event); -} - -void WebPage::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - - int width = LLQtWebKit::getInstance()->getBrowserWidth(mBrowserWindowId); - int height = LLQtWebKit::getInstance()->getBrowserHeight(mBrowserWindowId); - const unsigned char* pixels = LLQtWebKit::getInstance()->getBrowserWindowPixels(mBrowserWindowId); - QImage image(pixels, width, height, QImage::Format_RGB32); - image = image.rgbSwapped(); - QPainter painter(this); - painter.drawImage(QPoint(0, 0), image); -} - -void WebPage::mouseDoubleClickEvent(QMouseEvent *event) -{ - LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, - LLQtWebKit::ME_MOUSE_DOUBLE_CLICK, - LLQtWebKit::MB_MOUSE_BUTTON_LEFT, - event->x(), event->y(), - LLQtWebKit::KM_MODIFIER_NONE ); -} - -void WebPage::mouseMoveEvent(QMouseEvent *event) -{ - updateSLvariables(); - - LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, - LLQtWebKit::ME_MOUSE_MOVE, - LLQtWebKit::MB_MOUSE_BUTTON_LEFT, - event->x(), event->y(), - LLQtWebKit::KM_MODIFIER_NONE ); -} - -void WebPage::mousePressEvent(QMouseEvent *event) -{ - LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, - LLQtWebKit::ME_MOUSE_DOWN, - LLQtWebKit::MB_MOUSE_BUTTON_LEFT, - event->x(), event->y(), - LLQtWebKit::KM_MODIFIER_NONE ); -} - -void WebPage::mouseReleaseEvent(QMouseEvent *event) -{ - LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, - LLQtWebKit::ME_MOUSE_UP, - LLQtWebKit::MB_MOUSE_BUTTON_LEFT, - event->x(), event->y(), - LLQtWebKit::KM_MODIFIER_NONE ); - - LLQtWebKit::getInstance()->focusBrowser(mBrowserWindowId, true); -} - -void WebPage::keyPressEvent(QKeyEvent *event) -{ - Q_UNUSED(event); -} - -void WebPage::keyReleaseEvent(QKeyEvent *event) -{ - Q_UNUSED(event); - //LLQtWebKit::getInstance()->unicodeInput(mBrowserWindowId, event->text().at(0).unicode(),LLQtWebKit::KM_MODIFIER_NONE); -} - -void WebPage::goBack() -{ - LLQtWebKit::getInstance()->userAction(mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_BACK); -} - -void WebPage::goForward() -{ - LLQtWebKit::getInstance()->userAction(mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_FORWARD); -} - -void WebPage::reload() -{ - LLQtWebKit::getInstance()->userAction(mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_RELOAD); -} - -void WebPage::loadUrl(const QString &url) -{ - LLQtWebKit::getInstance()->navigateTo(mBrowserWindowId, url.toStdString()); -} - -#include "ui_window.h" - -class Window : public QDialog, public Ui_Dialog -{ - Q_OBJECT -public: - Window(QWidget *parent = 0); - -public slots: - void loadUrl(); -}; - -Window::Window(QWidget *parent) - : QDialog(parent) -{ - setupUi(this); - connect(webpage, SIGNAL(locationChanged(const QString &)), - location, SLOT(setText(const QString &))); - connect(webpage, SIGNAL(canGoBack(bool)), - backButton, SLOT(setEnabled(bool))); - connect(webpage, SIGNAL(canGoForward(bool)), - forwardButton, SLOT(setEnabled(bool))); - connect(backButton, SIGNAL(clicked()), - webpage, SLOT(goBack())); - connect(forwardButton, SIGNAL(clicked()), - webpage, SLOT(goForward())); - connect(reloadButton, SIGNAL(clicked()), - webpage, SLOT(reload())); - connect(location, SIGNAL(returnPressed()), - this, SLOT(loadUrl())); -} - -void Window::loadUrl() -{ - webpage->loadUrl(location->text()); -} - - -int main(int argc, char **argv) -{ - QApplication application(argc, argv); - Window window; - window.show(); - return application.exec(); -} - -#include "main.moc" diff --git a/indra/llqtwebkit/tests/qttestapp/qttestapp.pro b/indra/llqtwebkit/tests/qttestapp/qttestapp.pro deleted file mode 100644 index 5a0ca33cf..000000000 --- a/indra/llqtwebkit/tests/qttestapp/qttestapp.pro +++ /dev/null @@ -1,38 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../../ -CONFIG -= app_bundle - -include(../../static.pri) - -QT += webkit opengl network - -unix { - LIBS += $$PWD/../../libllqtwebkit.a -} - -!mac { -unix { - DEFINES += LL_LINUX -} -} - -mac { - DEFINES += LL_OSX -} - - -win32{ - DEFINES += _WINDOWS - INCLUDEPATH += ../ - DESTDIR=../build - release { - LIBS += $$PWD/../../Release/llqtwebkit.lib - } -} - -# Input -SOURCES += main.cpp -FORMS += window.ui diff --git a/indra/llqtwebkit/tests/qttestapp/webpage.h b/indra/llqtwebkit/tests/qttestapp/webpage.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/indra/llqtwebkit/tests/qttestapp/window.ui b/indra/llqtwebkit/tests/qttestapp/window.ui deleted file mode 100644 index 6125821cc..000000000 --- a/indra/llqtwebkit/tests/qttestapp/window.ui +++ /dev/null @@ -1,79 +0,0 @@ - - - Dialog - - - - 0 - 0 - 766 - 613 - - - - Dialog - - - - 0 - - - - - 6 - - - 6 - - - 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - WebPage - QWidget -
webpage.h
- 1 -
-
- - -
diff --git a/indra/llqtwebkit/tests/ssltest/ssltest.cpp b/indra/llqtwebkit/tests/ssltest/ssltest.cpp deleted file mode 100644 index fcbf80314..000000000 --- a/indra/llqtwebkit/tests/ssltest/ssltest.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef _WINDOWS -extern "C" { -#include -} -#endif - -#ifdef _WINDOWS -#include -#include -#endif - -#include -#include -#include - -#ifdef LL_OSX -// I'm not sure why STATIC_QT is getting defined, but the Q_IMPORT_PLUGIN thing doesn't seem to be necessary on the mac. -#undef STATIC_QT -#endif - -#ifdef STATIC_QT -#include -Q_IMPORT_PLUGIN(qgif) -#endif - -#include "llqtwebkit.h" - -class sslTest : - public LLEmbeddedBrowserWindowObserver -{ - public: - sslTest( std::string url, bool ignore_ca_file, bool ignore_ssl_errors ) : - mBrowserWindowWidth( 512 ), - mBrowserWindowHeight( 512 ), - mBrowserWindowHandle( 0 ), - mNavigateInProgress( true ) - { -#ifdef _WINDOWS - std::string cwd = std::string( _getcwd( NULL, 1024) ); - std::string profile_dir = cwd + "\\" + "ssltest_profile"; - void* native_window_handle = (void*)GetDesktopWindow(); - std::string ca_file_loc = cwd + "\\" + "CA.pem"; -#else - std::string cwd = std::string( getcwd( NULL, 1024) ); - std::string profile_dir = cwd + "/" + "ssltest_profile"; - void* native_window_handle = 0; - std::string ca_file_loc = cwd + "/" + "CA.pem"; -#endif - std::cout << "ssltest> === begin ===" << std::endl; - std::cout << "ssltest> current working dir is " << cwd << std::endl; - std::cout << "ssltest> profiles dir location is " << profile_dir << std::endl; - - LLQtWebKit::getInstance()->init( cwd, cwd, profile_dir, native_window_handle ); - - LLQtWebKit::getInstance()->enableJavaScript( true ); - LLQtWebKit::getInstance()->enablePlugins( true ); - - mBrowserWindowHandle = LLQtWebKit::getInstance()->createBrowserWindow( mBrowserWindowWidth, mBrowserWindowHeight ); - LLQtWebKit::getInstance()->setSize( mBrowserWindowHandle, mBrowserWindowWidth, mBrowserWindowHeight ); - - LLQtWebKit::getInstance()->addObserver( mBrowserWindowHandle, this ); - - if ( ! ignore_ca_file ) - { - std::cout << "ssltest> Expected certificate authority file location is " << ca_file_loc << std::endl; - LLQtWebKit::getInstance()->setCAFile( ca_file_loc.c_str() ); - } - else - { - std::cout << "ssltest> Not loading certificate authority file" << std::endl; - }; - - if ( ignore_ssl_errors ) - { - LLQtWebKit::getInstance()->setIgnoreSSLCertErrors( true ); - std::cout << "ssltest> Ignoring SSL errors " << std::endl; - } - else - { - std::cout << "ssltest> Not ignoring SSL errors " << std::endl; - }; - - LLQtWebKit::getInstance()->navigateTo( mBrowserWindowHandle, url ); - - std::cout << "ssltest> navigating to " << url << std::endl; - }; - - bool idle( void ) - { - LLQtWebKit::getInstance()->pump( 100 ); - -#if _WINDOWS - MSG msg; - while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) - { - GetMessage( &msg, NULL, 0, 0 ); - TranslateMessage( &msg ); - DispatchMessage( &msg ); - }; -#endif - return mNavigateInProgress; - }; - - ~sslTest() - { - LLQtWebKit::getInstance()->remObserver( mBrowserWindowHandle, this ); - LLQtWebKit::getInstance()->reset(); - std::cout << "ssltest> === end ===" << std::endl; - }; - - void onNavigateBegin( const EventType& eventIn ) - { - mNavigateInProgress = true; - std::cout << "ssltest> Event: begin navigation to " << eventIn.getEventUri() << std::endl; - }; - - void onNavigateComplete( const EventType& eventIn ) - { - std::cout << "ssltest> Event: end navigation to " << eventIn.getEventUri() << std::endl; - mNavigateInProgress = false; - }; - - void onUpdateProgress( const EventType& eventIn ) - { - std::cout << "ssltest> Event: progress value updated to " << eventIn.getIntValue() << std::endl; - }; - - void onStatusTextChange( const EventType& eventIn ) - { - std::cout << "ssltest> Event: status updated to " << eventIn.getStringValue() << std::endl; - }; - - void onTitleChange( const EventType& eventIn ) - { - std::cout << "ssltest> Event: title changed to " << eventIn.getStringValue() << std::endl; - }; - - void onLocationChange( const EventType& eventIn ) - { - std::cout << "ssltest> Event: location changed to " << eventIn.getStringValue() << std::endl; - }; - - bool onCertError(const std::string &in_url, const std::string &in_msg) - { - std::cout << "ssltest> Cert error triggered\n" << in_url << "\n" << in_msg << std::endl; - return true; - } - - private: - int mBrowserWindowWidth; - int mBrowserWindowHeight; - int mBrowserWindowHandle; - bool mNavigateInProgress; -}; - -int main( int argc, char* argv[] ) -{ - bool ingore_ssl_errors = false; - bool ignore_ca_file = false; - - for( int i = 1; i < argc; ++i ) - { - if ( std::string( argv[ i ] ) == "--help" ) - { - std::cout << std::endl << "ssltest [--ignoresslerrors] [--ignorecafile]" << std::endl; - std::cout << "Looks for cert file CA.pem in the current working directory"; - - exit( 0 ); - }; - - if ( std::string( argv[ i ] ) == "--ignoresslerrors" ) - ingore_ssl_errors = true; - - if ( std::string( argv[ i ] ) == "--ignorecafile" ) - ignore_ca_file = true; - }; - - std::string url ( "https://my.secondlife.com/callum.linden" ); - for( int i = 1; i < argc; ++i ) - { - if ( std::string( argv[ i ] ).substr( 0, 2 ) != "--" ) - { - url = std::string( argv[ i ] ); - break; - }; - }; - - std::cout << std::endl << " --------- sslTest application starting --------- " << std::endl; - std::cout << "ssltest> URL specified is " << url << std::endl; - - sslTest* app = new sslTest( url, ignore_ca_file, ingore_ssl_errors ); - - bool result = app->idle(); - while( result ) - { - result = app->idle(); - }; - - delete app; - - std::cout << " --------- sslTest application ending --------- " << std::endl; - - return 0; -} diff --git a/indra/llqtwebkit/tests/ssltest/ssltest.pro b/indra/llqtwebkit/tests/ssltest/ssltest.pro deleted file mode 100644 index 981e35211..000000000 --- a/indra/llqtwebkit/tests/ssltest/ssltest.pro +++ /dev/null @@ -1,28 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../../ -CONFIG -= app_bundle -CONFIG += console - -QT += webkit network - -mac { - DEFINES += LL_OSX - LIBS += $$PWD/libllqtwebkit.dylib -} - -win32 { - DEFINES += _WINDOWS - INCLUDEPATH += ../ - DESTDIR=../build - LIBS += user32.lib - release { - LIBS += $$PWD/../../Release/llqtwebkit.lib - } -} - -include(../../static.pri) - -SOURCES += ssltest.cpp diff --git a/indra/llqtwebkit/tests/testgl/testgl.cpp b/indra/llqtwebkit/tests/testgl/testgl.cpp deleted file mode 100644 index 6dfb11a72..000000000 --- a/indra/llqtwebkit/tests/testgl/testgl.cpp +++ /dev/null @@ -1,1002 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef _WINDOWS -extern "C" { -#include -} -#endif - -#ifdef _WINDOWS -#include -#include // file choser dialog -#include // for local file access -#endif - -#include -#include -#include -#include -#include - -#ifdef LL_OSX -// I'm not sure why STATIC_QT is getting defined, but the Q_IMPORT_PLUGIN thing doesn't seem to be necessary on the mac. -#undef STATIC_QT -#endif - -#ifdef STATIC_QT -#include -Q_IMPORT_PLUGIN(qgif) -#endif - -#ifdef LL_OSX -#include -#include -#else -#define FREEGLUT_STATIC -#include "GL/glut.h" -#endif -#include "llqtwebkit.h" - -#ifdef _WINDOWS - #define PATH_SEPARATOR "\\" -#else - #define PATH_SEPARATOR "/" -#endif - - -//////////////////////////////////////////////////////////////////////////////// -// -std::string chooseFileName() -{ -#ifdef _WINDOWS - OPENFILENAMEA ofn ; - static char szFile[_MAX_PATH] ; - - ZeroMemory( &ofn , sizeof( ofn) ); - ofn.lStructSize = sizeof ( ofn ); - ofn.hwndOwner = NULL ; - ofn.lpstrFile = szFile ; - ofn.lpstrFile[0] = '\0'; - ofn.nMaxFile = sizeof( szFile ); - ofn.lpstrFilter = "All\0*.*\0Images\0*.jpg;*.png\0"; - ofn.nFilterIndex =1; - ofn.lpstrFileTitle = NULL ; - ofn.nMaxFileTitle = 0 ; - ofn.lpstrInitialDir=NULL ; - ofn.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST ; - - GetOpenFileNameA( &ofn ); - - return ofn.lpstrFile; -#else - return ""; -#endif -} - -//////////////////////////////////////////////////////////////////////////////// -// Implementation of the test app - implemented as a class and derrives from -// the observer so we can catch events emitted by LLQtWebKit -// -class testGL : - public LLEmbeddedBrowserWindowObserver -{ - public: - testGL() : - mAppWindowWidth( 800 ), // dimensions of the app window - can be anything - mAppWindowHeight( 900 ), - mBrowserWindowWidth( mAppWindowWidth ), // dimensions of the embedded browser - can be anything - mBrowserWindowHeight( mAppWindowHeight ), // but looks best when it's the same as the app window - mAppTextureWidth( -1 ), // dimensions of the texture that the browser is rendered into - mAppTextureHeight( -1 ), // calculated at initialization - mAppTexture( 0 ), - mBrowserWindowId( 0 ), - mAppWindowName( "testGL" ), - mCwd(), - mHomeUrl(), - mNeedsUpdate( true ) // flag to indicate if browser texture needs an update - { -#ifdef _WINDOWS // to remove warning on Windows - mCwd = _getcwd(NULL, 1024); -#else - mCwd = getcwd(NULL, 1024); -#endif - mHomeUrl = "http://callum-linden.s3.amazonaws.com/browsertest.html"; - std::cout << "LLQtWebKit version: " << LLQtWebKit::getInstance()->getVersion() << std::endl; - - std::cout << "Current working directory is " << mCwd << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void init( const std::string argv0, const std::string argv1 ) - { - // OpenGL initialization - glClearColor( 0.0f, 0.0f, 0.0f, 0.5f); - glEnable( GL_COLOR_MATERIAL ); - glColorMaterial( GL_FRONT, GL_AMBIENT_AND_DIFFUSE ); - glEnable( GL_TEXTURE_2D ); - glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); - glEnable( GL_CULL_FACE ); - - // calculate texture size required (next power of two above browser window size - for ( mAppTextureWidth = 1; mAppTextureWidth < mBrowserWindowWidth; mAppTextureWidth <<= 1 ) - { - }; - - for ( mAppTextureHeight = 1; mAppTextureHeight < mBrowserWindowHeight; mAppTextureHeight <<= 1 ) - { - }; - - // create the texture used to display the browser data - glGenTextures( 1, &mAppTexture ); - glBindTexture( GL_TEXTURE_2D, mAppTexture ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, - GL_RGB, - mAppTextureWidth, mAppTextureHeight, - 0, GL_RGB, GL_UNSIGNED_BYTE, 0 ); - - // create a single browser window and set things up. - mProfileDir = mCwd + PATH_SEPARATOR + "testGL_profile"; - std::cout << "Profiles dir location is " << mProfileDir << std::endl; - - mCookiePath = mProfileDir + PATH_SEPARATOR + "cookies.txt"; - std::cout << "Cookies.txt file location is " << mCookiePath << std::endl; - - LLQtWebKit::getInstance()->init( mApplicationDir, mApplicationDir, mProfileDir, getNativeWindowHandle() ); - - LLQtWebKit::getInstance()->enableQtMessageHandler( false ); - - // set host language test (in reality, string will be language code passed into client) - // IMPORTANT: must be called before createBrowserWindow(...) - LLQtWebKit::getInstance()->setHostLanguage( "EN-AB-CD-EF" ); - - // set up features - LLQtWebKit::getInstance()->enableJavaScript( true ); - LLQtWebKit::getInstance()->enableCookies( true ); - LLQtWebKit::getInstance()->enablePlugins( true ); - - // make a browser window - mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mBrowserWindowWidth, mBrowserWindowHeight ); - - // tell LLQtWebKit about the size of the browser window - LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mBrowserWindowWidth, mBrowserWindowHeight ); - - // observer events that LLQtWebKit emits - LLQtWebKit::getInstance()->addObserver( mBrowserWindowId, this ); - - // append details to agent string - LLQtWebKit::getInstance()->setBrowserAgentId( mAppWindowName ); - - // don't flip bitmap - LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, false ); - - // only "trust" pages whose host match this regex - LLQtWebKit::getInstance()->setWhiteListRegex( mBrowserWindowId, "^([^.]+\\.)*amazonaws\\.com$" ); - - LLQtWebKit::getInstance()->enableLoadingOverlay( mBrowserWindowId, true ); - - // Attempt to read cookies from the cookie file and send them to llqtwebkit. - { - std::ifstream cookie_file(mCookiePath.c_str(), std::ios_base::in); - std::string cookies; - - while(cookie_file.good() && !cookie_file.eof()) - { - std::string tmp; - std::getline(cookie_file, tmp); - cookies += tmp; - cookies += "\n"; - } - - if(!cookies.empty()) - { - LLQtWebKit::getInstance()->setCookies(cookies); - } - } - - #if 0 - const std::vector before=LLQtWebKit::getInstance()->getInstalledCertsList(); - std::cout << "Certs before CA.pem load: " << before.size() << " items" << std::endl; - for(int i=0;isetCAFile( ca_pem_file_loc.c_str() ); - std::cout << "Expected CA.pem file location is " << ca_pem_file_loc << std::endl; - - #if 0 - const std::vector after=LLQtWebKit::getInstance()->getInstalledCertsList(); - std::cout << "Certs after CA.pem load: " << after.size() << " items" << std::endl; - for(int i=0;isetSLObjectEnabled( true ); // true means the feature is turned on - LLQtWebKit::getInstance()->setAgentLanguage( "tst-en" ); // viewer language selected by agent - LLQtWebKit::getInstance()->setAgentRegion( "TestGL region" ); // name of region where agent is located - LLQtWebKit::getInstance()->setAgentLocation( 9.8, 7.6, 5.4 ); // agent's x,y,z location within a region - LLQtWebKit::getInstance()->setAgentGlobalLocation( 1234.5, 6789.0, 3456.7 ); // agent's x,y,z location within a region - LLQtWebKit::getInstance()->setAgentOrientation( 175.69 ); // direction (0..359) agent is facing - LLQtWebKit::getInstance()->setAgentMaturity( "Very immature" ); // selected maturity level of agent - - // go to the "home page" or URL passed in via command line - if ( ! argv1.empty() ) - LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, argv1 ); - else - LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, mHomeUrl ); - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void reset( void ) - { - // Get cookies from this instance - std::string cookies = LLQtWebKit::getInstance()->getAllCookies(); - - // Dump cookies to stdout -// std::cout << "Cookies:" << std::endl; -// std::cout << cookies; - - // and save them to cookies.txt in the profile directory - { - std::ofstream cookie_file(mCookiePath.c_str(), std::ios_base::out|std::ios_base::trunc); - - if(cookie_file.good()) - { - cookie_file << cookies; - } - - cookie_file.close(); - } - - // unhook observer - LLQtWebKit::getInstance()->remObserver( mBrowserWindowId, this ); - - // clean up - LLQtWebKit::getInstance()->reset(); - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void reshape( int widthIn, int heightIn ) - { - if ( heightIn == 0 ) - heightIn = 1; - - LLQtWebKit::getInstance()->setSize(mBrowserWindowId, widthIn, heightIn ); - mNeedsUpdate = true; - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - - glViewport( 0, 0, widthIn, heightIn ); - glOrtho( 0.0f, widthIn, heightIn, 0.0f, -1.0f, 1.0f ); - - // we use these elsewhere so save - mAppWindowWidth = widthIn; - mAppWindowHeight = heightIn; - mBrowserWindowWidth = widthIn; - mBrowserWindowHeight = heightIn; - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - - mNeedsUpdate = true; - idle(); - - glutPostRedisplay(); - }; - - void updateSLvariables() - { - if ( rand() % 2 ) - LLQtWebKit::getInstance()->setAgentRegion( "Region Wibble" ); - else - LLQtWebKit::getInstance()->setAgentRegion( "Region Flasm" ); - LLQtWebKit::getInstance()->setAgentLocation( (rand()%25600)/100.0f, (rand()%25600)/100.0f, (rand()%25600)/100.0f ); - LLQtWebKit::getInstance()->setAgentGlobalLocation( (rand()%25600)/10.0f, (rand()%25600)/10.0f, (rand()%25600)/10.0f ); - LLQtWebKit::getInstance()->setAgentOrientation( (rand()%3600)/10.0f ); - LLQtWebKit::getInstance()->emitLocation(); - - if ( rand() % 2 ) - LLQtWebKit::getInstance()->setAgentLanguage( "One language" ); - else - LLQtWebKit::getInstance()->setAgentLanguage( "Another language" ); - LLQtWebKit::getInstance()->emitLanguage(); - - if ( rand() % 2 ) - LLQtWebKit::getInstance()->setAgentMaturity( "Adults only" ); - else - LLQtWebKit::getInstance()->setAgentMaturity( "Children only" ); - LLQtWebKit::getInstance()->emitMaturity(); - } - - //////////////////////////////////////////////////////////////////////////////// - // - void idle() - { - static time_t starttime = time( NULL ); - if ( time( NULL ) - starttime ) - { - updateSLvariables(); - time( &starttime ); - }; - - LLQtWebKit::getInstance()->pump(100); - - // onPageChanged event sets this - if ( mNeedsUpdate ) - // grab a page but don't reset 'needs update' flag until we've written it to the texture in display() - LLQtWebKit::getInstance()->grabBrowserWindow( mBrowserWindowId ); - - // lots of updates for smooth motion - glutPostRedisplay(); - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void display() - { - // clear screen - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glLoadIdentity(); - - // use the browser texture - glBindTexture( GL_TEXTURE_2D, mAppTexture ); - - // valid window ? - if ( mBrowserWindowId ) - { - // needs to be updated? - if ( mNeedsUpdate ) - { - // grab the page - const unsigned char* pixels = LLQtWebKit::getInstance()->getBrowserWindowPixels( mBrowserWindowId ); - if ( pixels ) - { - // write them into the texture - glTexSubImage2D( GL_TEXTURE_2D, 0, - 0, 0, - // because sometimes the rowspan != width * bytes per pixel (mBrowserWindowWidth) - LLQtWebKit::getInstance()->getBrowserRowSpan( mBrowserWindowId ) / LLQtWebKit::getInstance()->getBrowserDepth( mBrowserWindowId ), - mBrowserWindowHeight, -#ifdef _WINDOWS - LLQtWebKit::getInstance()->getBrowserDepth(mBrowserWindowId ) == 3 ? GL_RGBA : GL_RGBA, -#elif defined(__APPLE__) - GL_RGBA, -#elif defined(LL_LINUX) - GL_RGBA, -#endif - GL_UNSIGNED_BYTE, - pixels ); - }; - - // flag as already updated - mNeedsUpdate = false; - }; - }; - - // scale the texture so that it fits the screen - GLfloat textureScaleX = ( GLfloat )mBrowserWindowWidth / ( GLfloat )mAppTextureWidth; - GLfloat textureScaleY = ( GLfloat )mBrowserWindowHeight / ( GLfloat )mAppTextureHeight; - - // draw the single quad full screen (orthographic) - glMatrixMode( GL_TEXTURE ); - glPushMatrix(); - glScalef( textureScaleX, textureScaleY, 1.0f ); - - glEnable( GL_TEXTURE_2D ); - glColor3f( 1.0f, 1.0f, 1.0f ); - glBegin( GL_QUADS ); - glTexCoord2f( 1.0f, 0.0f ); - glVertex2d( mAppWindowWidth, 0 ); - - glTexCoord2f( 0.0f, 0.0f ); - glVertex2d( 0, 0 ); - - glTexCoord2f( 0.0f, 1.0f ); - glVertex2d( 0, mAppWindowHeight ); - - glTexCoord2f( 1.0f, 1.0f ); - glVertex2d( mAppWindowWidth, mAppWindowHeight ); - glEnd(); - - glMatrixMode( GL_TEXTURE ); - glPopMatrix(); - - glutSwapBuffers(); - }; - - //////////////////////////////////////////////////////////////////////////////// - // convert a GLUT keyboard modifier to an LLQtWebKit one - // (only valid in mouse and keyboard callbacks - LLQtWebKit::EKeyboardModifier getLLQtWebKitKeyboardModifierCode() - { - int result = LLQtWebKit::KM_MODIFIER_NONE; - - int modifiers = glutGetModifiers(); - - if ( GLUT_ACTIVE_SHIFT & modifiers ) - { - result |= LLQtWebKit::KM_MODIFIER_SHIFT; - } - - if ( GLUT_ACTIVE_CTRL & modifiers ) - result |= LLQtWebKit::KM_MODIFIER_CONTROL; - - if ( GLUT_ACTIVE_ALT & modifiers ) - result |= LLQtWebKit::KM_MODIFIER_ALT; - - return (LLQtWebKit::EKeyboardModifier)result; - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void mouseButton( int button, int state, int xIn, int yIn ) - { - // texture is scaled to fit the screen so we scale mouse coords in the same way - xIn = ( xIn * mBrowserWindowWidth ) / mAppWindowWidth; - yIn = ( yIn * mBrowserWindowHeight ) / mAppWindowHeight; - - if ( button == GLUT_LEFT_BUTTON ) - { - if ( state == GLUT_DOWN ) - { - // send event to LLQtWebKit - LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, - LLQtWebKit::ME_MOUSE_DOWN, - LLQtWebKit::MB_MOUSE_BUTTON_LEFT, - xIn, yIn, - getLLQtWebKitKeyboardModifierCode() ); - } - else - if ( state == GLUT_UP ) - { - // send event to LLQtWebKit - LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, - LLQtWebKit::ME_MOUSE_UP, - LLQtWebKit::MB_MOUSE_BUTTON_LEFT, - xIn, yIn, - getLLQtWebKitKeyboardModifierCode() ); - - - // this seems better than sending focus on mouse down (still need to improve this) - LLQtWebKit::getInstance()->focusBrowser( mBrowserWindowId, true ); - }; - }; - - // force a GLUT update - glutPostRedisplay(); - } - - //////////////////////////////////////////////////////////////////////////////// - // - void mouseMove( int xIn , int yIn ) - { - // texture is scaled to fit the screen so we scale mouse coords in the same way - xIn = ( xIn * mBrowserWindowWidth ) / mAppWindowWidth; - yIn = ( yIn * mBrowserWindowHeight ) / mAppWindowHeight; - - // send event to LLQtWebKit - LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, - LLQtWebKit::ME_MOUSE_MOVE, - LLQtWebKit::MB_MOUSE_BUTTON_LEFT, - xIn, yIn, - LLQtWebKit::KM_MODIFIER_NONE ); - - - // force a GLUT update - glutPostRedisplay(); - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void keyboard( unsigned char keyIn, bool isDown) - { - // ESC key exits - if ( keyIn == 27 ) - { - reset(); - - exit( 0 ); - }; - - // Translate some keys - switch(keyIn) - { - case 127: - // Turn delete char into backspace - keyIn = LLQtWebKit::KEY_BACKSPACE; - break; - case '\r': - case '\n': - // Turn CR and NL into enter key - keyIn = LLQtWebKit::KEY_RETURN; - break; - - case '\t': - keyIn = LLQtWebKit::KEY_TAB; - break; - - default: - break; - } - - // control-H goes home - if ( keyIn == 8 ) - { - LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, mHomeUrl ); - } - // control-B navigates back - else if ( keyIn == 2 ) - { - LLQtWebKit::getInstance()->userAction(mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_BACK); - } - // control-F navigates forward - else if ( keyIn == 6 ) - { - LLQtWebKit::getInstance()->userAction(mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_FORWARD); - } - // control-R reloads - else if ( keyIn == 18 ) - { - LLQtWebKit::getInstance()->userAction(mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_RELOAD ); - } - // control-I toggles inspector - else if ( keyIn == 23 ) - { - LLQtWebKit::getInstance()->showWebInspector( true ); - } - else if ( keyIn == '1' ) - { - if ( getLLQtWebKitKeyboardModifierCode() == LLQtWebKit::KM_MODIFIER_CONTROL ) - { - LLQtWebKit::getInstance()->setPageZoomFactor( 1.0 ); - } - } - else if ( keyIn == '2' ) - { - if ( getLLQtWebKitKeyboardModifierCode() == LLQtWebKit::KM_MODIFIER_CONTROL ) - { - LLQtWebKit::getInstance()->setPageZoomFactor( 2.0 ); - } - } - - char text[2]; - if(keyIn < 0x80) - { - text[0] = (char)keyIn; - } - else - { - text[0] = 0; - } - - text[1] = 0; - - std::cerr << "key " << (isDown?"down ":"up ") << (int)keyIn << ", modifiers = " << (int)getLLQtWebKitKeyboardModifierCode() << std::endl; - - // send event to LLQtWebKit - LLQtWebKit::getInstance()->keyboardEvent(mBrowserWindowId, isDown?LLQtWebKit::KE_KEY_DOWN:LLQtWebKit::KE_KEY_UP, keyIn, text, getLLQtWebKitKeyboardModifierCode() ); - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void keyboardSpecial( int specialIn, bool isDown) - { - uint32_t key = LLQtWebKit::KEY_NONE; - - switch(specialIn) - { - case GLUT_KEY_F1: key = LLQtWebKit::KEY_F1; break; - case GLUT_KEY_F2: key = LLQtWebKit::KEY_F2; break; - case GLUT_KEY_F3: key = LLQtWebKit::KEY_F3; break; - case GLUT_KEY_F4: key = LLQtWebKit::KEY_F4; break; - case GLUT_KEY_F5: key = LLQtWebKit::KEY_F5; break; - case GLUT_KEY_F6: key = LLQtWebKit::KEY_F6; break; - case GLUT_KEY_F7: key = LLQtWebKit::KEY_F7; break; - case GLUT_KEY_F8: key = LLQtWebKit::KEY_F8; break; - case GLUT_KEY_F9: key = LLQtWebKit::KEY_F9; break; - case GLUT_KEY_F10: key = LLQtWebKit::KEY_F10; break; - case GLUT_KEY_F11: key = LLQtWebKit::KEY_F11; break; - case GLUT_KEY_F12: key = LLQtWebKit::KEY_F12; break; - case GLUT_KEY_LEFT: key = LLQtWebKit::KEY_LEFT; break; - case GLUT_KEY_UP: key = LLQtWebKit::KEY_UP; break; - case GLUT_KEY_RIGHT: key = LLQtWebKit::KEY_RIGHT; break; - case GLUT_KEY_DOWN: key = LLQtWebKit::KEY_DOWN; break; - case GLUT_KEY_PAGE_UP: key = LLQtWebKit::KEY_PAGE_UP; break; - case GLUT_KEY_PAGE_DOWN: key = LLQtWebKit::KEY_PAGE_DOWN;break; - case GLUT_KEY_HOME: key = LLQtWebKit::KEY_HOME; break; - case GLUT_KEY_END: key = LLQtWebKit::KEY_END; break; - case GLUT_KEY_INSERT: key = LLQtWebKit::KEY_INSERT; break; - - default: - break; - } - - if(key != LLQtWebKit::KEY_NONE) - { - keyboard(key, isDown); - } - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onPageChanged( const EventType& /*eventIn*/ ) - { - // flag that an update is required - page grab happens in idle() so we don't stall - mNeedsUpdate = true; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onNavigateBegin( const EventType& eventIn ) - { - std::cout << "Event: begin navigation to " << eventIn.getEventUri() << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onNavigateComplete( const EventType& eventIn ) - { - std::cout << "Event: end navigation to " << eventIn.getEventUri() << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onUpdateProgress( const EventType& eventIn ) - { - std::cout << "Event: progress value updated to " << eventIn.getIntValue() << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onStatusTextChange( const EventType& eventIn ) - { - std::cout << "Event: status updated to " << eventIn.getStringValue() << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onTitleChange( const EventType& eventIn ) - { - std::cout << "Event: title changed to " << eventIn.getStringValue() << std::endl; - glutSetWindowTitle( eventIn.getStringValue().c_str() ); - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onLocationChange( const EventType& eventIn ) - { - std::cout << "Event: location changed to " << eventIn.getStringValue() << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onClickLinkHref( const EventType& eventIn ) - { - std::string uuid = eventIn.getStringValue2(); - - std::cout << "Event: clicked on link:" << std::endl; - std::cout << " URL:" << eventIn.getEventUri() << std::endl; - std::cout << " target:" << eventIn.getStringValue() << std::endl; - std::cout << " UUID:" << uuid << std::endl; - std::cout << std::endl; - - // Since we never actually open the window, send a "proxy window closed" back to webkit to keep it from leaking. - LLQtWebKit::getInstance()->proxyWindowClosed(mBrowserWindowId, uuid); - }; - - // virtual - void onClickLinkNoFollow(const EventType& eventIn) - { - std::cout << "Clink link no-follow --" << std::endl; - std::cout << " URL:" << eventIn.getEventUri() << std::endl; - std::cout << " type:" << eventIn.getNavigationType() << std::endl; - std::cout << " trusted:" << eventIn.getTrustedHost() << std::endl; - } - - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onCookieChanged( const EventType& eventIn ) - { - int dead = eventIn.getIntValue(); - std::cout << (dead?"deleting cookie: ":"setting cookie: ") << eventIn.getStringValue() << std::endl; - } - - //////////////////////////////////////////////////////////////////////////////// - // virtual - std::string onRequestFilePicker( const EventType& ) - { - std::string fn = chooseFileName(); - return fn; - } - - //////////////////////////////////////////////////////////////////////////////// - // virtual - bool onAuthRequest(const std::string &in_url, const std::string &in_realm, std::string &out_username, std::string &out_password) - { - std::cout << "Auth request, url = " << in_url << ", realm = " << in_realm << std::endl; - out_username = ""; // replace these temporarily with site username/password as required. - out_password = ""; - return false; - } - - //////////////////////////////////////////////////////////////////////////////// - // virtual - bool onCertError(const std::string &in_url, const std::string &in_msg) - { - std::cout << "Cert error, url = " << in_url << ", message = " << in_msg << std::endl; - return false; // cancel (return true to ignore errors and continue) - } - - virtual void onQtDebugMessage( const std::string& msg, const std::string& msg_type) - { - std::cout << "QtDebugMsg [" << msg_type << "]> " << msg << std::endl; - } - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onLinkHovered( const EventType& eventIn ) - { - std::cout - << "Link hovered, link = " << eventIn.getEventUri() - << ", title = " << eventIn.getStringValue() - << ", text = " << eventIn.getStringValue2() - << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onWindowCloseRequested( const EventType& ) - { - std::cout << "Event: window close requested" << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onNavigateErrorPage( const EventType& event ) - { - std::cout << "Error page hit with code of " << event.getIntValue() << " - navigating to another URL" << std::endl; - LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "http://bestbuy.com" ); - }; - - //////////////////////////////////////////////////////////////////////////////// - // virtual - void onWindowGeometryChangeRequested( const EventType& eventIn) - { - int x, y, width, height; - eventIn.getRectValue(x, y, width, height); - - std::cout << "Event: window geometry change requested" << std::endl; - std::cout << " uuid: " << eventIn.getStringValue() << std::endl; - std::cout << " location: (" << x << ", " << y << ")" << std::endl; - std::cout << " size: (" << width << ", " << height << ")" << std::endl; - }; - - //////////////////////////////////////////////////////////////////////////////// - // - int getAppWindowWidth() - { - return mAppWindowWidth; - }; - - //////////////////////////////////////////////////////////////////////////////// - // - int getAppWindowHeight() - { - return mAppWindowHeight; - }; - - //////////////////////////////////////////////////////////////////////////////// - // - std::string getAppWindowName() - { - return mAppWindowName; - }; - - //////////////////////////////////////////////////////////////////////////////// - // - void* getNativeWindowHandle() - { - // My implementation of the embedded browser needs a native window handle - // Can't get this via GLUT so had to use this hack - #ifdef _WINDOWS - return FindWindow( NULL, (LPCWSTR)mAppWindowName.c_str() ); - #else - #ifdef LL_OSX - // not needed on osx - return 0; - #else - //#error "You will need an implementation of this method" - return 0; - #endif - #endif - }; - - private: - int mAppWindowWidth; - int mAppWindowHeight; - int mBrowserWindowWidth; - int mBrowserWindowHeight; - int mAppTextureWidth; - int mAppTextureHeight; - GLuint mAppTexture; - int mBrowserWindowId; - std::string mAppWindowName; - std::string mHomeUrl; - std::string mCwd; - bool mNeedsUpdate; - std::string mApplicationDir; - std::string mProfileDir; - std::string mCookiePath; -}; - -testGL* theApp; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutReshape( int widthIn, int heightIn ) -{ - if ( theApp ) - theApp->reshape( widthIn, heightIn ); -}; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutDisplay() -{ - if ( theApp ) - theApp->display(); -}; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutIdle() -{ - if ( theApp ) - theApp->idle(); -}; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutKeyboard( unsigned char keyIn, int /*xIn*/, int /*yIn*/ ) -{ - if ( theApp ) - { - theApp->keyboard( keyIn, true ); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutKeyboardUp( unsigned char keyIn, int /*xIn*/, int /*yIn*/ ) -{ - if ( theApp ) - { - theApp->keyboard( keyIn, false ); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutSpecial( int specialIn, int /*xIn*/, int /*yIn*/ ) -{ - if ( theApp ) - { - theApp->keyboardSpecial( specialIn, true ); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutSpecialUp( int specialIn, int /*xIn*/, int /*yIn*/ ) -{ - if ( theApp ) - { - theApp->keyboardSpecial( specialIn, false ); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -// -void glutMouseMove( int xIn , int yIn ) -{ - if ( theApp ) - theApp->mouseMove( xIn, yIn ); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void glutMouseButton( int buttonIn, int stateIn, int xIn, int yIn ) -{ - if ( theApp ) - theApp->mouseButton( buttonIn, stateIn, xIn, yIn ); -} - -//////////////////////////////////////////////////////////////////////////////// -// -int main( int argc, char* argv[] ) -{ - glutInit( &argc, argv ); - glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB ); - - // implementation in a class so we can observer events - // means we need this painful GLUT <--> class shim... - theApp = new testGL; - - if ( theApp ) - { - glutInitWindowPosition( 80, 0 ); - glutInitWindowSize( theApp->getAppWindowWidth(), theApp->getAppWindowHeight() ); - - glutCreateWindow( theApp->getAppWindowName().c_str() ); - - std::string url = ""; - if ( 2 == argc ) - url = std::string( argv[ 1 ] ); - - theApp->init( std::string( argv[ 0 ] ), url ); - - glutKeyboardFunc( glutKeyboard ); - glutKeyboardUpFunc( glutKeyboardUp ); - glutSpecialFunc( glutSpecial ); - glutSpecialUpFunc( glutSpecialUp ); - - glutMouseFunc( glutMouseButton ); - glutPassiveMotionFunc( glutMouseMove ); - glutMotionFunc( glutMouseMove ); - - glutDisplayFunc( glutDisplay ); - glutReshapeFunc( glutReshape ); - - glutIdleFunc( glutIdle ); - - glutMainLoop(); - - std::cout << "glutMainLoop returned" << std::endl; - - delete theApp; - }; - - return 0; -} diff --git a/indra/llqtwebkit/tests/testgl/testgl.pro b/indra/llqtwebkit/tests/testgl/testgl.pro deleted file mode 100644 index 42692d68d..000000000 --- a/indra/llqtwebkit/tests/testgl/testgl.pro +++ /dev/null @@ -1,38 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../../ -CONFIG -= app_bundle - -QT += webkit opengl network - -!mac { -unix { - DEFINES += LL_LINUX - LIBS += -lglui -lglut - LIBS += $$PWD/../../libllqtwebkit.a -} -} - -mac { - DEFINES += LL_OSX - LIBS += -framework GLUT -framework OpenGL - LIBS += $$PWD/libllqtwebkit.dylib -} - -win32 { - DEFINES += _WINDOWS - INCLUDEPATH += ../ - INCLUDEPATH += $$PWD/../../stage/packages/include - DESTDIR=../build - release { - LIBS += $$PWD/../../Release/llqtwebkit.lib - LIBS += $$PWD/../build/freeglut_static.lib - LIBS += comdlg32.lib - } -} - -include(../../static.pri) - -SOURCES += testgl.cpp diff --git a/indra/llqtwebkit/tests/textmode/textmode.cpp b/indra/llqtwebkit/tests/textmode/textmode.cpp deleted file mode 100644 index 019fba902..000000000 --- a/indra/llqtwebkit/tests/textmode/textmode.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* Copyright (c) 2006-2010, Linden Research, Inc. - * - * LLQtWebKit Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in GPL-license.txt in this distribution, or online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/technology-programs/license-virtual-world/viewerlicensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - */ - -#ifndef _WINDOWS -extern "C" { -#include -} -#endif - -#ifdef _WINDOWS -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -#ifdef LL_OSX -// I'm not sure why STATIC_QT is getting defined, but the Q_IMPORT_PLUGIN thing doesn't seem to be necessary on the mac. -#undef STATIC_QT -#endif - -#ifdef STATIC_QT -#include -Q_IMPORT_PLUGIN(qgif) -#endif - -#include "llqtwebkit.h" - -class textMode : - public LLEmbeddedBrowserWindowObserver -{ - public: - textMode( std::string url, bool ignore_ca_file, bool ignore_ssl_errors ) : - mBrowserWindowWidth( 512 ), - mBrowserWindowHeight( 512 ), - mBrowserWindowHandle( 0 ), - mNavigateInProgress( true ), - mLogLine( "" ) - { - -#ifdef _WINDOWS - std::string cwd = std::string( _getcwd( NULL, 1024) ); - std::string profile_dir = cwd + "\\" + "textmode_profile"; - void* native_window_handle = (void*)GetDesktopWindow(); - std::string ca_file_loc = cwd + "\\" + "CA.pem"; -#else - std::string cwd = std::string( getcwd( NULL, 1024) ); - std::string profile_dir = cwd + "/" + "textmode_profile"; - void* native_window_handle = 0; - std::string ca_file_loc = cwd + "/" + "CA.pem"; -#endif - mLogLine << "Current working dir is " << cwd << std::endl; - mLogLine << "Profiles dir is " << profile_dir; - writeLine( mLogLine.str() ); - - LLQtWebKit::getInstance()->init( cwd, cwd, profile_dir, native_window_handle ); - - LLQtWebKit::getInstance()->enableQtMessageHandler( true ); - - LLQtWebKit::getInstance()->enableJavaScript( true ); - LLQtWebKit::getInstance()->enablePlugins( true ); - - mBrowserWindowHandle = LLQtWebKit::getInstance()->createBrowserWindow( mBrowserWindowWidth, mBrowserWindowHeight ); - LLQtWebKit::getInstance()->setSize( mBrowserWindowHandle, mBrowserWindowWidth, mBrowserWindowHeight ); - - LLQtWebKit::getInstance()->addObserver( mBrowserWindowHandle, this ); - - if ( ! ignore_ca_file ) - { - mLogLine.str(""); - mLogLine << "Expected certificate authority file location is " << ca_file_loc; - writeLine( mLogLine.str() ); - LLQtWebKit::getInstance()->setCAFile( ca_file_loc.c_str() ); - } - else - { - mLogLine.str(""); - mLogLine << "Not loading certificate authority file"; - writeLine( mLogLine.str() ); - }; - - if ( ignore_ssl_errors ) - { - LLQtWebKit::getInstance()->setIgnoreSSLCertErrors( true ); - mLogLine.str(""); - mLogLine << "Ignoring SSL errors"; - writeLine( mLogLine.str() ); - } - else - { - mLogLine.str(""); - mLogLine << "Not ignoring SSL errors"; - writeLine( mLogLine.str() ); - }; - - mLogLine.str(""); - mLogLine << "Navigating to " << url; - writeLine( mLogLine.str() ); - - LLQtWebKit::getInstance()->navigateTo( mBrowserWindowHandle, url ); - }; - - bool idle( void ) - { - LLQtWebKit::getInstance()->pump( 100 ); - -#if _WINDOWS - MSG msg; - while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) - { - GetMessage( &msg, NULL, 0, 0 ); - TranslateMessage( &msg ); - DispatchMessage( &msg ); - }; -#endif - return mNavigateInProgress; - }; - - ~textMode() - { - LLQtWebKit::getInstance()->remObserver( mBrowserWindowHandle, this ); - LLQtWebKit::getInstance()->reset(); - }; - - void onNavigateBegin( const EventType& eventIn ) - { - mNavigateInProgress = true; - mLogLine.str(""); - mLogLine << "Event: Begin navigation to " << eventIn.getEventUri(); - writeLine( mLogLine.str() ); - }; - - void onNavigateComplete( const EventType& eventIn ) - { - mLogLine.str(""); - mLogLine << "Event: End navigation to " << eventIn.getEventUri(); - writeLine( mLogLine.str() ); - mNavigateInProgress = false; - }; - - void onUpdateProgress( const EventType& eventIn ) - { - mLogLine.str(""); - mLogLine << "Event: progress value updated to " << eventIn.getIntValue(); - writeLine( mLogLine.str() ); - }; - - void onStatusTextChange( const EventType& eventIn ) - { - mLogLine.str(""); - mLogLine << "Event: status updated to " << eventIn.getStringValue(); - writeLine( mLogLine.str() ); - }; - - void onTitleChange( const EventType& eventIn ) - { - mLogLine.str(""); - mLogLine << "Event: title change to " << eventIn.getStringValue(); - writeLine( mLogLine.str() ); - }; - - void onLocationChange( const EventType& eventIn ) - { - mLogLine.str(""); - mLogLine << "Event: location changed to " << eventIn.getStringValue(); - writeLine( mLogLine.str() ); - }; - - bool onCertError(const std::string &in_url, const std::string &in_msg) - { - mLogLine.str(""); - mLogLine << "Cert error triggered: " << std::endl << in_url << "\n" << in_msg; - writeLine( mLogLine.str() ); - return true; - } - - void onCookieChanged(const EventType& event) - { - std::string url = event.getEventUri(); - std::string cookie = event.getStringValue(); - int dead = event.getIntValue(); - mLogLine.str(""); - if ( ! dead ) - mLogLine << "Cookie added:" << cookie; - else - mLogLine << "Cookie deleted:" << cookie; - writeLine( mLogLine.str() ); - } - - virtual void onQtDebugMessage( const std::string& msg, const std::string& msg_type) - { - mLogLine.str(""); - mLogLine << "QtDebugMsg (" << msg_type << "): " << msg.substr(msg.length() - 1); - writeLine( mLogLine.str() ); - } - - void writeLine( std::string line ) - { - double elapsed_seconds = (double)clock() / (double)CLOCKS_PER_SEC; - - std::cout << "[" << std::setprecision(7) << std::setw(3) << std::setfill('0') << elapsed_seconds << "] "; - const int max_len = 140; - if ( line.length() > max_len ) - { - std::cout << line.substr(0, max_len); - std::cout << "...."; - } - else - { - std::cout << line; - } - std::cout << std::endl; - //std::cout << std::endl; - } - - private: - int mBrowserWindowWidth; - int mBrowserWindowHeight; - int mBrowserWindowHandle; - bool mNavigateInProgress; - std::ostringstream mLogLine; -}; - -int main( int argc, char* argv[] ) -{ - bool ingore_ssl_errors = false; - bool ignore_ca_file = false; - - for( int i = 1; i < argc; ++i ) - { - if ( std::string( argv[ i ] ) == "--help" ) - { - std::cout << std::endl << "textmode " << std::endl; - exit( 0 ); - }; - - if ( std::string( argv[ i ] ) == "--ignoresslerrors" ) - ingore_ssl_errors = true; - - if ( std::string( argv[ i ] ) == "--ignorecafile" ) - ignore_ca_file = true; - }; - - std::string url ( "https://my.secondlife.com/callum.linden" ); - for( int i = 1; i < argc; ++i ) - { - if ( std::string( argv[ i ] ).substr( 0, 2 ) != "--" ) - { - url = std::string( argv[ i ] ); - break; - }; - }; - - textMode* app = new textMode( url, ignore_ca_file, ingore_ssl_errors ); - - bool result = app->idle(); - while( result ) - { - result = app->idle(); - }; - - delete app; - - return 0; -} diff --git a/indra/llqtwebkit/tests/textmode/textmode.pro b/indra/llqtwebkit/tests/textmode/textmode.pro deleted file mode 100644 index d41e1ea68..000000000 --- a/indra/llqtwebkit/tests/textmode/textmode.pro +++ /dev/null @@ -1,28 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../../ -CONFIG -= app_bundle -CONFIG += console - -QT += webkit network - -mac { - DEFINES += LL_OSX - LIBS += $$PWD/libllqtwebkit.dylib -} - -win32 { - DEFINES += _WINDOWS - INCLUDEPATH += ../ - DESTDIR=../build - LIBS += user32.lib - release { - LIBS += $$PWD/../../Release/llqtwebkit.lib - } -} - -include(../../static.pri) - -SOURCES += textmode.cpp diff --git a/indra/llqtwebkit/win32/3p-qt-vars.bat b/indra/llqtwebkit/win32/3p-qt-vars.bat deleted file mode 100644 index 5ea118848..000000000 --- a/indra/llqtwebkit/win32/3p-qt-vars.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -echo Setting up a Qt environment using 3p-qt HG repository -set QTDIR=C:\Work\3p-llqtwebkit\stage -set PATH=C:\Work\3p-llqtwebkit\stage\bin;%PATH% -set QMAKESPEC=win32-msvc2010 -call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" diff --git a/indra/llqtwebkit/win32/Qt Command Prompt (3p-qt).lnk b/indra/llqtwebkit/win32/Qt Command Prompt (3p-qt).lnk deleted file mode 100644 index 460a9e9cf..000000000 Binary files a/indra/llqtwebkit/win32/Qt Command Prompt (3p-qt).lnk and /dev/null differ diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index b03111f7e..57283e9fe 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -8,6 +8,7 @@ include(LLCommon) include(LLImage) include(LLMath) include(LLRender) +include(LLVFS) include(LLWindow) include(LLXML) include(LLVFS) @@ -18,6 +19,7 @@ include_directories( ${LLIMAGE_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} @@ -82,4 +84,3 @@ endif (DARWIN) list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) add_library (llrender ${llrender_SOURCE_FILES}) -add_dependencies(llrender prepare) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 3ed54f0ca..24f7d94ce 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -604,6 +604,9 @@ bool LLGLManager::initGL() LLImageGL::sCompressTextures = false; } +#if LL_WINDOWS + bool mIsHD3K(false); +#endif // Trailing space necessary to keep "nVidia Corpor_ati_on" cards // from being recognized as ATI. if (mGLVendor.substr(0,4) == "ATI ") @@ -675,6 +678,14 @@ bool LLGLManager::initGL() { mGLVendorShort = "INTEL"; mIsIntel = TRUE; +#if LL_WINDOWS + if (mGLRenderer.find("HD") != std::string::npos + && ((mGLRenderer.find("2000") != std::string::npos || mGLRenderer.find("3000") != std::string::npos) + || (mGLVersion == 3.1f && mGLRenderer.find("INTEL(R) HD GRAPHICS") != std::string::npos))) + { + mIsHD3K = TRUE; + } +#endif } else { @@ -721,6 +732,11 @@ bool LLGLManager::initGL() if (mHasVertexShader) { //According to the spec, the resulting value should never be less than 512. We need at least 1024 to use skinned shaders. +#if LL_WINDOWS + if (mIsHD3K) + mGLMaxVertexUniformComponents = 4096; + else +#endif glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &mGLMaxVertexUniformComponents); } diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 416c3f9a7..68ff5d6a0 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1089,31 +1089,31 @@ void LLImageGL::deleteTextures(S32 numTextures, U32 *textures) //#include "crnlib.h" struct DDS_PIXELFORMAT { - DWORD dwSize; - DWORD dwFlags; - DWORD dwFourCC; - DWORD dwRGBBitCount; - DWORD dwRBitMask; - DWORD dwGBitMask; - DWORD dwBBitMask; - DWORD dwABitMask; + U32 dwSize; + U32 dwFlags; + U32 dwFourCC; + U32 dwRGBBitCount; + U32 dwRBitMask; + U32 dwGBitMask; + U32 dwBBitMask; + U32 dwABitMask; }; typedef struct { - DWORD dwSize; - DWORD dwFlags; - DWORD dwHeight; - DWORD dwWidth; - DWORD dwPitchOrLinearSize; - DWORD dwDepth; - DWORD dwMipMapCount; - DWORD dwReserved1[11]; + U32 dwSize; + U32 dwFlags; + U32 dwHeight; + U32 dwWidth; + U32 dwPitchOrLinearSize; + U32 dwDepth; + U32 dwMipMapCount; + U32 dwReserved1[11]; DDS_PIXELFORMAT ddspf; - DWORD dwCaps; - DWORD dwCaps2; - DWORD dwCaps3; - DWORD dwCaps4; - DWORD dwReserved2; + U32 dwCaps; + U32 dwCaps2; + U32 dwCaps3; + U32 dwCaps4; + U32 dwReserved2; } DDS_HEADER; typedef enum DXGI_FORMAT { @@ -1291,9 +1291,9 @@ typedef enum D3D10_RESOURCE_DIMENSION { typedef struct { DXGI_FORMAT dxgiFormat; D3D10_RESOURCE_DIMENSION resourceDimension; - UINT miscFlag; - UINT arraySize; - UINT miscFlags2; + U32 miscFlag; + U32 arraySize; + U32 miscFlags2; } DDS_HEADER_DXT10; // static @@ -1440,7 +1440,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt { glTexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE); - U32 pos = sizeof(DWORD); + U32 pos = sizeof(U32); const DDS_HEADER& header = *(DDS_HEADER*)(((U8*)compressed_data) + pos); pos += sizeof(DDS_HEADER); if (header.ddspf.dwFlags & 0x4 && header.ddspf.dwFourCC == '01XD') diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index f7496140c..946361e62 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -865,7 +865,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade dumpObjectLog(ret); error_str = get_object_log(ret); -#if LL_WINDOWS std::stringstream ostr; //dump shader source for debugging for (GLuint i = 0; i < count; i++) @@ -876,25 +875,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade { //dump every 128 lines LL_WARNS("ShaderLoading") << "\n" << ostr.str() << LL_ENDL; - ostr = std::stringstream(); + ostr.clear(); + ostr.str(LLStringUtil::null); } } LL_WARNS("ShaderLoading") << "\n" << ostr.str() << LL_ENDL; -#else - std::string str; - - for (GLuint i = 0; i < count; i++) { - str.append(text[i]); - - if (i % 128 == 0) - { - LL_WARNS("ShaderLoading") << str << LL_ENDL; - str = ""; - } - } -#endif glDeleteObjectARB(ret); //no longer need handle ret = 0; } diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index 2be700aad..00edc7610 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -152,3 +152,48 @@ void LLUIImage::onImageLoaded() } } + +namespace LLInitParam +{ + void ParamValue::updateValueFromBlock() + { + // The keyword "none" is specifically requesting a null image + // do not default to current value. Used to overwrite template images. + if (name() == "none") + { + updateValue(NULL); + return; + } + + LLUIImage* imagep = LLRender2D::getUIImage(name()); + if (imagep) + { + updateValue(imagep); + } + } + + void ParamValue::updateBlockFromValue(bool make_block_authoritative) + { + if (getValue() == NULL) + { + name.set("none", make_block_authoritative); + } + else + { + name.set(getValue()->getName(), make_block_authoritative); + } + } + + + bool ParamCompare::equals( + LLUIImage* const &a, + LLUIImage* const &b) + { + // force all LLUIImages for XML UI export to be "non-default" + if (!a && !b) + return false; + else + return (a == b); + } +} + diff --git a/indra/llrender/lluiimage.h b/indra/llrender/lluiimage.h index 45af03272..dede4acb1 100644 --- a/indra/llrender/lluiimage.h +++ b/indra/llrender/lluiimage.h @@ -32,8 +32,12 @@ #include "llrefcount.h" #include "llrefcount.h" #include "llrect.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include +#include "llinitparam.h" #include "lltexture.h" extern const LLColor4 UI_VERTEX_COLOR; @@ -88,6 +92,36 @@ protected: BOOL mNoClip; }; +namespace LLInitParam +{ + template<> + class ParamValue + : public CustomParamValue + { + typedef boost::add_reference::type>::type T_const_ref; + typedef CustomParamValue super_t; + public: + Optional name; + + ParamValue(LLUIImage* const& image = NULL) + : super_t(image) + { + updateBlockFromValue(false); + addSynonym(name, "name"); + } + + void updateValueFromBlock(); + void updateBlockFromValue(bool make_block_authoritative); + }; + + // Need custom comparison function for our test app, which only loads + // LLUIImage* as NULL. + template<> + struct ParamCompare + { + static bool equals(LLUIImage* const &a, LLUIImage* const &b); + }; +} typedef LLPointer LLUIImagePtr; #endif diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 1d02fa44a..62db38a5c 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1399,13 +1399,13 @@ void LLVertexBuffer::setupVertexArray() //glVertexattribIPointer requires GLSL 1.30 or later if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30) { - glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], reinterpret_cast(mOffsets[i])); + glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], reinterpret_cast(static_cast(mOffsets[i]))); } #endif } else { - glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], reinterpret_cast(mOffsets[i])); + glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], reinterpret_cast(static_cast(mOffsets[i]))); } } else diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index cb9a4e4a3..1ee716cb8 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -24,6 +24,8 @@ include_directories( ) set(llui_SOURCE_FILES + llaccordionctrl.cpp + llaccordionctrltab.cpp llalertdialog.cpp llbutton.cpp llcheckboxctrl.cpp @@ -98,6 +100,8 @@ set(llui_HEADER_FILES CMakeLists.txt ailist.h + llaccordionctrl.h + llaccordionctrltab.h llalertdialog.h llbutton.h llcallbackmap.h diff --git a/indra/llui/ailist.h b/indra/llui/ailist.h index 14ef05f0c..c528227ba 100644 --- a/indra/llui/ailist.h +++ b/indra/llui/ailist.h @@ -257,7 +257,7 @@ class AIConstListIterator { typedef AIListIterator iterator; _Container const* mContainer; - _Iterator mConstIterator; // This has to be an _Iterator instead of _ConstIterator, because the compiler doesn't accept a const_iterator for erase yet (C++11 does). + _ConstIterator mConstIterator; void ref(void) { @@ -289,7 +289,7 @@ class AIConstListIterator { typedef T const& reference; AIConstListIterator(void) : mContainer(NULL) { } - AIConstListIterator(_Container const* __c, _Iterator const& __i) : mContainer(__c), mConstIterator(__i) + AIConstListIterator(_Container const* __c, _ConstIterator const& __i) : mContainer(__c), mConstIterator(__i) { llassert(mContainer); ref(); @@ -343,7 +343,7 @@ class AIConstListIterator { _Self& operator++() { - _Iterator cur = mConstIterator; + _ConstIterator cur = mConstIterator; ++cur; unref(); while(cur != mContainer->end() && cur->dead) @@ -364,7 +364,7 @@ class AIConstListIterator { _Self& operator--() { - _Iterator cur = mConstIterator; + _ConstIterator cur = mConstIterator; --cur; unref(); while(cur->dead) diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp new file mode 100644 index 000000000..0aa99221c --- /dev/null +++ b/indra/llui/llaccordionctrl.cpp @@ -0,0 +1,925 @@ +/** + * @file llaccordionctrl.cpp + * @brief Accordion panel implementation + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "llaccordionctrl.h" +#include "llaccordionctrltab.h" + +#include "lluictrlfactory.h" // builds floaters from XML + +#include "llwindow.h" +#include "llfocusmgr.h" +#include "lllocalcliprect.h" + +#include "boost/bind.hpp" + +static const S32 BORDER_MARGIN = 2; +static const S32 PARENT_BORDER_MARGIN = 5; +static const S32 VERTICAL_MULTIPLE = 16; +static const F32 MIN_AUTO_SCROLL_RATE = 120.f; +static const F32 MAX_AUTO_SCROLL_RATE = 500.f; +static const F32 AUTO_SCROLL_RATE_ACCEL = 120.f; + +// LLAccordionCtrl =================================================================| + +//static LLDefaultChildRegistry::Register t2("accordion"); +static LLRegisterWidget t2("accordion"); + +/*LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) + , mFitParent(params.fit_parent) + , mAutoScrolling( false ) + , mAutoScrollRate( 0.f ) + , mSelectedTab( NULL ) + , mTabComparator( NULL ) + , mNoVisibleTabsHelpText(NULL) + , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString()) +{ + initNoTabsWidget(params.no_matched_tabs_text); + + mSingleExpansion = params.single_expansion; + if(mFitParent && !mSingleExpansion) + { + LL_INFOS() << "fit_parent works best when combined with single_expansion" << LL_ENDL; + } +}*/ + +LLAccordionCtrl::LLAccordionCtrl() : LLPanel() + , mAutoScrolling( false ) + , mAutoScrollRate( 0.f ) + , mSelectedTab( NULL ) + , mNoVisibleTabsHelpText(NULL) +{ + initNoTabsWidget(""/*LLTextBox::Params()*/); + + mSingleExpansion = false; + mFitParent = false; + LLUICtrlFactory::getInstance()->buildPanel(this, "accordion_parent.xml"); +} + +//--------------------------------------------------------------------------------- +void LLAccordionCtrl::draw() +{ + if (mAutoScrolling) + { + // add acceleration to autoscroll + mAutoScrollRate = llmin(mAutoScrollRate + (LLFrameTimer::getFrameDeltaTimeF32() * AUTO_SCROLL_RATE_ACCEL), MAX_AUTO_SCROLL_RATE); + } + else + { + // reset to minimum for next time + mAutoScrollRate = MIN_AUTO_SCROLL_RATE; + } + // clear this flag to be set on next call to autoScroll + mAutoScrolling = false; + + LLRect local_rect(0, getRect().getHeight(), getRect().getWidth(), 0); + + LLLocalClipRect clip(local_rect); + + LLPanel::draw(); +} + + +//--------------------------------------------------------------------------------- +BOOL LLAccordionCtrl::postBuild() +{ + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + + LLRect scroll_rect; + scroll_rect.setOriginAndSize( + getRect().getWidth() - scrollbar_size, + 1, + scrollbar_size, + getRect().getHeight() - 1); + + mScrollbar = new LLScrollbar("scrollable vertical", scroll_rect, LLScrollbar::VERTICAL, mInnerRect.getHeight(), 0, mInnerRect.getHeight(), boost::bind(&LLAccordionCtrl::onScrollPosChangeCallback, this, _1, _2), VERTICAL_MULTIPLE); + mScrollbar->setFollows(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM); + LLView::addChild( mScrollbar ); + mScrollbar->setVisible( false ); + mScrollbar->setFollows(FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM); + + //if it was created from xml... + std::vector accordion_tabs; + for(child_list_const_iter_t it = getChildList()->begin(); + getChildList()->end() != it; ++it) + { + LLAccordionCtrlTab* accordion_tab = dynamic_cast(*it); + if(accordion_tab == NULL) + continue; + if(std::find(mAccordionTabs.begin(),mAccordionTabs.end(),accordion_tab) == mAccordionTabs.end()) + { + accordion_tabs.push_back(accordion_tab); + } + } + + for(std::vector::reverse_iterator it = accordion_tabs.rbegin();it!=accordion_tabs.rend();++it) + addCollapsibleCtrl(*it); + + arrange (); + + if(mSingleExpansion) + { + if(!mAccordionTabs[0]->getDisplayChildren()) + mAccordionTabs[0]->setDisplayChildren(true); + for(size_t i=1;igetDisplayChildren()) + mAccordionTabs[i]->setDisplayChildren(false); + } + } + + updateNoTabsHelpTextVisibility(); + + return TRUE; +} + + +//--------------------------------------------------------------------------------- +LLAccordionCtrl::~LLAccordionCtrl() +{ + mAccordionTabs.clear(); +} + +//--------------------------------------------------------------------------------- + +void LLAccordionCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + // adjust our rectangle + LLRect rcLocal = getRect(); + rcLocal.mRight = rcLocal.mLeft + width; + rcLocal.mTop = rcLocal.mBottom + height; + + // get textbox a chance to reshape its content + mNoVisibleTabsHelpText->reshape(width, height, called_from_parent); + + setRect(rcLocal); + + // assume that help text is always fit accordion. + // necessary text paddings can be set via h_pad and v_pad + mNoVisibleTabsHelpText->setRect(getLocalRect()); + + arrange(); +} + +//--------------------------------------------------------------------------------- +BOOL LLAccordionCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + return LLPanel::handleRightMouseDown(x, y, mask); +} + +//--------------------------------------------------------------------------------- +void LLAccordionCtrl::shiftAccordionTabs(S16 panel_num, S32 delta) +{ + for(size_t i = panel_num; i < mAccordionTabs.size(); i++ ) + { + ctrlShiftVertical(mAccordionTabs[i],delta); + } +} + + +//--------------------------------------------------------------------------------- +void LLAccordionCtrl::onCollapseCtrlCloseOpen(S16 panel_num) +{ + if(mSingleExpansion) + { + for(size_t i=0;igetDisplayChildren()) + mAccordionTabs[i]->setDisplayChildren(false); + } + + } + arrange(); +} + +void LLAccordionCtrl::show_hide_scrollbar(S32 width, S32 height) +{ + calcRecuiredHeight(); + if(getRecuiredHeight() > height ) + showScrollbar(width,height); + else + hideScrollbar(width,height); +} + +void LLAccordionCtrl::showScrollbar(S32 width, S32 height) +{ + bool was_visible = mScrollbar->getVisible(); + + mScrollbar->setVisible(true); + + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + + ctrlSetLeftTopAndSize(mScrollbar + ,width-scrollbar_size - PARENT_BORDER_MARGIN/2 + ,height-PARENT_BORDER_MARGIN + ,scrollbar_size + ,height-2*PARENT_BORDER_MARGIN); + + mScrollbar->setPageSize(height); + mScrollbar->setDocParams(mInnerRect.getHeight(),mScrollbar->getDocPos()); + + if(was_visible) + { + S32 scroll_pos = llmin(mScrollbar->getDocPos(), getRecuiredHeight() - height - 1); + mScrollbar->setDocPos(scroll_pos); + } +} + +void LLAccordionCtrl::hideScrollbar( S32 width, S32 height ) +{ + if(mScrollbar->getVisible() == false) + return; + mScrollbar->setVisible(false); + + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + + S32 panel_width = width - 2*BORDER_MARGIN; + + //reshape all accordeons and shift all draggers + for(size_t i=0;igetRect(); + ctrlSetLeftTopAndSize(mAccordionTabs[i],panel_rect.mLeft,panel_rect.mTop,panel_width,panel_rect.getHeight()); + } + + mScrollbar->setDocPos(0); + + if(mAccordionTabs.size()>0) + { + S32 panel_top = height - BORDER_MARGIN; // Top coordinate of the first panel + S32 diff = panel_top - mAccordionTabs[0]->getRect().mTop; + shiftAccordionTabs(0,diff); + } +} + + +//--------------------------------------------------------------------------------- +S32 LLAccordionCtrl::calcRecuiredHeight() +{ + S32 rec_height = 0; + + std::vector::iterator panel; + for(panel=mAccordionTabs.begin(); panel!=mAccordionTabs.end(); ++panel) + { + LLAccordionCtrlTab* accordion_tab = dynamic_cast(*panel); + if(accordion_tab && accordion_tab->getVisible()) + { + rec_height += accordion_tab->getRect().getHeight(); + } + } + + mInnerRect.setLeftTopAndSize(0,rec_height + BORDER_MARGIN*2,getRect().getWidth(),rec_height + BORDER_MARGIN); + + return mInnerRect.getHeight(); +} + +//--------------------------------------------------------------------------------- +void LLAccordionCtrl::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height) +{ + if(!panel) + return; + LLRect panel_rect = panel->getRect(); + panel_rect.setLeftTopAndSize( left, top, width, height); + panel->reshape( width, height, 1); + panel->setRect(panel_rect); +} + +void LLAccordionCtrl::ctrlShiftVertical(LLView* panel,S32 delta) +{ + if(!panel) + return; + panel->translate(0,delta); +} + +//--------------------------------------------------------------------------------- + +void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) +{ + LLAccordionCtrlTab* accordion_tab = dynamic_cast(view); + if(!accordion_tab) + return; + if(std::find(beginChild(), endChild(), accordion_tab) == endChild()) + addChild(accordion_tab); + mAccordionTabs.push_back(accordion_tab); + + accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLAccordionCtrl::onCollapseCtrlCloseOpen, this, S16(mAccordionTabs.size() - 1)) ); + arrange(); +} + +void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view) +{ + LLAccordionCtrlTab* accordion_tab = dynamic_cast(view); + if(!accordion_tab) + return; + + if(std::find(beginChild(), endChild(), accordion_tab) != endChild()) + removeChild(accordion_tab); + + for (std::vector::iterator iter = mAccordionTabs.begin(); + iter != mAccordionTabs.end(); ++iter) + { + if (accordion_tab == (*iter)) + { + mAccordionTabs.erase(iter); + break; + } + } + + // if removed is selected - reset selection + if (mSelectedTab == view) + { + mSelectedTab = NULL; + } +} + +void LLAccordionCtrl::initNoTabsWidget(const std::string/*LLTextBox::Params*/& tb_params) +{ + //LLTextBox::Params tp = tb_params; + //tp.rect(getLocalRect()); + mNoMatchedTabsOrigString = tb_params; //tp.initial_value().asString(); + mNoVisibleTabsHelpText = new LLTextBox(tb_params, getLocalRect()); //LLUICtrlFactory::create(tp, this); +} + +void LLAccordionCtrl::updateNoTabsHelpTextVisibility() +{ + bool visible_exists = false; + std::vector::const_iterator it = mAccordionTabs.begin(); + const std::vector::const_iterator it_end = mAccordionTabs.end(); + for (; it != it_end; ++it) + { + if ((*it)->getVisible()) + { + visible_exists = true; + break; + } + } + + mNoVisibleTabsHelpText->setVisible(!visible_exists); +} + +void LLAccordionCtrl::arrangeSinge() +{ + S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + S32 panel_height; + + S32 collapsed_height = 0; + + for(size_t i=0;i(mAccordionTabs[i]); + + if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + continue; + if(!accordion_tab->isExpanded() ) + { + collapsed_height+=mAccordionTabs[i]->getRect().getHeight(); + } + } + + S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height; + + for(size_t i=0;i(mAccordionTabs[i]); + + if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + continue; + if(!accordion_tab->isExpanded() ) + { + panel_height = accordion_tab->getRect().getHeight(); + } + else + { + if(mFitParent) + { + panel_height = expanded_height; + } + else + { + if(accordion_tab->getAccordionView()) + { + panel_height = accordion_tab->getAccordionView()->getRect().getHeight() + + accordion_tab->getHeaderHeight() + 2*BORDER_MARGIN; + } + else + { + panel_height = accordion_tab->getRect().getHeight(); + } + } + } + + // make sure at least header is shown + panel_height = llmax(panel_height, accordion_tab->getHeaderHeight()); + + ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); + panel_top-=mAccordionTabs[i]->getRect().getHeight(); + } + + show_hide_scrollbar(getRect().getWidth(), getRect().getHeight()); + updateLayout(getRect().getWidth(), getRect().getHeight()); +} + +void LLAccordionCtrl::arrangeMultiple() +{ + S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + + //Calculate params + for(size_t i = 0; i < mAccordionTabs.size(); i++ ) + { + LLAccordionCtrlTab* accordion_tab = dynamic_cast(mAccordionTabs[i]); + + if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + continue; + + if(!accordion_tab->isExpanded() ) + { + ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight()); + panel_top-=mAccordionTabs[i]->getRect().getHeight(); + } + else + { + S32 panel_height = accordion_tab->getRect().getHeight(); + + if(mFitParent) + { + // all expanded tabs will have equal height + panel_height = calcExpandedTabHeight(i, panel_top); + ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); + + // try to make accordion tab fit accordion view height. + // Accordion View should implement getRequiredRect() and provide valid height + S32 optimal_height = accordion_tab->getAccordionView()->getRequiredRect().getHeight(); + optimal_height += accordion_tab->getHeaderHeight() + 2 * BORDER_MARGIN; + if(optimal_height < panel_height) + { + panel_height = optimal_height; + } + + // minimum tab height is equal to header height + if(mAccordionTabs[i]->getHeaderHeight() > panel_height) + { + panel_height = mAccordionTabs[i]->getHeaderHeight(); + } + } + + ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); + panel_top-=panel_height; + + } + } + + show_hide_scrollbar(getRect().getWidth(),getRect().getHeight()); + + updateLayout(getRect().getWidth(),getRect().getHeight()); +} + + +void LLAccordionCtrl::arrange() +{ + updateNoTabsHelpTextVisibility(); + + if( mAccordionTabs.size() == 0) + { + //We do not arrange if we do not have what should be arranged + return; + } + + + if(mAccordionTabs.size() == 1) + { + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + + LLAccordionCtrlTab* accordion_tab = dynamic_cast(mAccordionTabs[0]); + + LLRect panel_rect = accordion_tab->getRect(); + + S32 panel_height = getRect().getHeight() - 2*BORDER_MARGIN; + + if (accordion_tab->getFitParent()) + panel_height = accordion_tab->getRect().getHeight(); + ctrlSetLeftTopAndSize(accordion_tab,panel_rect.mLeft,panel_top,panel_width,panel_height); + + show_hide_scrollbar(getRect().getWidth(),getRect().getHeight()); + return; + + } + + if(mSingleExpansion) + arrangeSinge (); + else + arrangeMultiple (); +} + +//--------------------------------------------------------------------------------- + +BOOL LLAccordionCtrl::handleScrollWheel ( S32 x, S32 y, S32 clicks ) +{ + if(LLPanel::handleScrollWheel(x,y,clicks)) + return TRUE; + if( mScrollbar->getVisible() && mScrollbar->handleScrollWheel( 0, 0, clicks ) ) + return TRUE; + return false; + +} + +BOOL LLAccordionCtrl::handleKeyHere (KEY key, MASK mask) +{ + if( mScrollbar->getVisible() && mScrollbar->handleKeyHere( key,mask ) ) + return TRUE; + return LLPanel::handleKeyHere(key,mask); +} + +BOOL LLAccordionCtrl::handleDragAndDrop (S32 x, S32 y, MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + // Scroll folder view if needed. Never accepts a drag or drop. + *accept = ACCEPT_NO; + BOOL handled = autoScroll(x, y); + + if( !handled ) + { + handled = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, + cargo_data, accept, tooltip_msg) != NULL; + } + return TRUE; +} + +BOOL LLAccordionCtrl::autoScroll (S32 x, S32 y) +{ + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + + bool scrolling = false; + if( mScrollbar->getVisible() ) + { + LLRect rect_local( 0, getRect().getHeight(), getRect().getWidth() - scrollbar_size, 0 ); + LLRect screen_local_extents; + + // clip rect against root view + screenRectToLocal(getRootView()->getLocalRect(), &screen_local_extents); + rect_local.intersectWith(screen_local_extents); + + // autoscroll region should take up no more than one third of visible scroller area + S32 auto_scroll_region_height = llmin(rect_local.getHeight() / 3, 10); + S32 auto_scroll_speed = ll_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32()); + + LLRect bottom_scroll_rect = screen_local_extents; + bottom_scroll_rect.mTop = rect_local.mBottom + auto_scroll_region_height; + if( bottom_scroll_rect.pointInRect( x, y ) && (mScrollbar->getDocPos() < mScrollbar->getDocPosMax()) ) + { + mScrollbar->setDocPos( mScrollbar->getDocPos() + auto_scroll_speed ); + mAutoScrolling = true; + scrolling = true; + } + + LLRect top_scroll_rect = screen_local_extents; + top_scroll_rect.mBottom = rect_local.mTop - auto_scroll_region_height; + if( top_scroll_rect.pointInRect( x, y ) && (mScrollbar->getDocPos() > 0) ) + { + mScrollbar->setDocPos( mScrollbar->getDocPos() - auto_scroll_speed ); + mAutoScrolling = true; + scrolling = true; + } + } + return scrolling; +} + +void LLAccordionCtrl::updateLayout (S32 width, S32 height) +{ + S32 panel_top = height - BORDER_MARGIN ; + if(mScrollbar->getVisible()) + panel_top+=mScrollbar->getDocPos(); + + S32 panel_width = width - 2*BORDER_MARGIN; + + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + if(mScrollbar->getVisible()) + panel_width-=scrollbar_size; + + //set sizes for first panels and dragbars + for(size_t i=0;igetVisible()) + continue; + LLRect panel_rect = mAccordionTabs[i]->getRect(); + ctrlSetLeftTopAndSize(mAccordionTabs[i],panel_rect.mLeft,panel_top,panel_width,panel_rect.getHeight()); + panel_top-=panel_rect.getHeight(); + } +} + +void LLAccordionCtrl::onScrollPosChangeCallback(S32, LLScrollbar*) +{ + updateLayout(getRect().getWidth(),getRect().getHeight()); +} +/*void LLAccordionCtrl::onOpen (const LLSD& key) +{ + for(size_t i=0;i(mAccordionTabs[i]); + LLPanel* panel = dynamic_cast(accordion_tab->getAccordionView()); + if(panel!=NULL) + { + panel->onOpen(key); + } + } +}*/ +S32 LLAccordionCtrl::notifyParent(const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "size_changes") + { + // + arrange(); + return 1; + } + else if(str_action == "select_next") + { + for(size_t i=0;i(mAccordionTabs[i]); + if(accordion_tab->hasFocus()) + { + while(++igetVisible()) + break; + } + if(i(mAccordionTabs[i]); + accordion_tab->notify(LLSD().with("action","select_first")); + return 1; + } + break; + } + } + return 0; + } + else if(str_action == "select_prev") + { + for(size_t i=0;i(mAccordionTabs[i]); + if(accordion_tab->hasFocus() && i>0) + { + bool prev_visible_tab_found = false; + while(i>0) + { + if(mAccordionTabs[--i]->getVisible()) + { + prev_visible_tab_found = true; + break; + } + } + + if (prev_visible_tab_found) + { + accordion_tab = dynamic_cast(mAccordionTabs[i]); + accordion_tab->notify(LLSD().with("action","select_last")); + return 1; + } + break; + } + } + return 0; + } + else if(str_action == "select_current") + { + for(size_t i=0;ihasFocus()) + { + if (mAccordionTabs[i] != mSelectedTab) + { + if (mSelectedTab) + { + mSelectedTab->setSelected(false); + } + mSelectedTab = mAccordionTabs[i]; + mSelectedTab->setSelected(true); + } + + return 1; + } + } + return 0; + } + else if(str_action == "deselect_current") + { + // Reset selection to the currently selected tab. + if (mSelectedTab) + { + mSelectedTab->setSelected(false); + mSelectedTab = NULL; + return 1; + } + return 0; + } + } + else if (info.has("scrollToShowRect")) + { + LLRect screen_rc, local_rc; + screen_rc.setValue(info["scrollToShowRect"]); + screenRectToLocal(screen_rc, &local_rc); + + // Translate to parent coordinatess to check if we are in visible rectangle + local_rc.translate( getRect().mLeft, getRect().mBottom ); + + if ( !getRect().contains (local_rc) ) + { + // Back to local coords and calculate position for scroller + S32 bottom = mScrollbar->getDocPos() - local_rc.mBottom + getRect().mBottom; + S32 top = mScrollbar->getDocPos() - local_rc.mTop + getRect().mTop; + + S32 scroll_pos = llclamp(mScrollbar->getDocPos(), + bottom, // min vertical scroll + top); // max vertical scroll + + mScrollbar->setDocPos( scroll_pos ); + } + return 1; + } + else if (info.has("child_visibility_change")) + { + BOOL new_visibility = info["child_visibility_change"]; + if (new_visibility) + { + // there is at least one visible tab + mNoVisibleTabsHelpText->setVisible(FALSE); + } + else + { + // it could be the latest visible tab, check all of them + updateNoTabsHelpTextVisibility(); + } + } + return LLPanel::notifyParent(info); +} +void LLAccordionCtrl::reset () +{ + if(mScrollbar) + mScrollbar->setDocPos(0); +} + +void LLAccordionCtrl::expandDefaultTab() +{ + if (mAccordionTabs.size() > 0) + { + LLAccordionCtrlTab* tab = mAccordionTabs.front(); + + if (!tab->getDisplayChildren()) + { + tab->setDisplayChildren(true); + } + + for (size_t i = 1; i < mAccordionTabs.size(); ++i) + { + tab = mAccordionTabs[i]; + + if (tab->getDisplayChildren()) + { + tab->setDisplayChildren(false); + } + } + + arrange(); + } +} + +void LLAccordionCtrl::sort() +{ + if (!mTabComparator) + { + LL_WARNS() << "No comparator specified for sorting accordion tabs." << LL_ENDL; + return; + } + + std::sort(mAccordionTabs.begin(), mAccordionTabs.end(), LLComparatorAdaptor(*mTabComparator)); + arrange(); +} + +void LLAccordionCtrl::setFilterSubString(const std::string& filter_string) +{ + LLStringUtil::format_map_t args; + args["[SEARCH_TERM]"] = LLURI::escape(filter_string); + std::string text = filter_string.empty() ? mNoVisibleTabsOrigString : mNoMatchedTabsOrigString; + LLStringUtil::format(text, args); + + mNoVisibleTabsHelpText->setValue(text); +} + +const LLAccordionCtrlTab* LLAccordionCtrl::getExpandedTab() const +{ + typedef std::vector::const_iterator tabs_const_iterator; + + const LLAccordionCtrlTab* result = 0; + + for (tabs_const_iterator i = mAccordionTabs.begin(); i != mAccordionTabs.end(); ++i) + { + if ((*i)->isExpanded()) + { + result = *i; + break; + } + } + + return result; +} + +S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 available_height /* = 0 */) +{ + if(tab_index < 0) + { + return available_height; + } + + S32 collapsed_tabs_height = 0; + S32 num_expanded = 0; + + for(size_t n = tab_index; n < mAccordionTabs.size(); ++n) + { + if(!mAccordionTabs[n]->isExpanded()) + { + collapsed_tabs_height += mAccordionTabs[n]->getHeaderHeight(); + } + else + { + ++num_expanded; + } + } + + if(0 == num_expanded) + { + return available_height; + } + + S32 expanded_tab_height = available_height - collapsed_tabs_height - BORDER_MARGIN; // top BORDER_MARGIN is added in arrange(), here we add bottom BORDER_MARGIN + expanded_tab_height /= num_expanded; + return expanded_tab_height; +} + + +//static +LLView* LLAccordionCtrl::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory) +{ + LLAccordionCtrl* ctrl = new LLAccordionCtrl(); + ctrl->mCommitCallbackRegistrar.pushScope(); + ctrl->mEnableCallbackRegistrar.pushScope(); + ctrl->initPanelXML(node, parent, factory); + ctrl->mCommitCallbackRegistrar.popScope(); + ctrl->mEnableCallbackRegistrar.popScope(); + return ctrl; +} + +void LLAccordionCtrl::initFromXML(LLXMLNodePtr node, LLView* parent) +{ + if (node->hasAttribute("single_expansion")) + node->getAttribute_bool("single_expansion", mSingleExpansion); + if (node->hasAttribute("fit_parent")) + node->getAttribute_bool("fit_parent", mFitParent); + if (node->hasAttribute("no_matched_tabs_text")) + { + node->getAttributeString("no_matched_tabs_text", mNoMatchedTabsOrigString); + mNoVisibleTabsHelpText->setValue(mNoMatchedTabsOrigString); + } + if (node->hasAttribute("no_visible_tabs_text")) + node->getAttributeString("no_visible_tabs_text", mNoVisibleTabsOrigString); + + LLPanel::initFromXML(node, parent); +} diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h new file mode 100644 index 000000000..95e321df3 --- /dev/null +++ b/indra/llui/llaccordionctrl.h @@ -0,0 +1,197 @@ +/** + * @file LLAccordionCtrl.h + * @brief Accordion Panel implementation + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_ACCORDIONCTRL_H +#define LL_ACCORDIONCTRL_H + +#include "llpanel.h" +#include "lltextbox.h" +#include "llscrollbar.h" + +#include +#include +#include + +class LLAccordionCtrlTab; + +class LLAccordionCtrl: public LLPanel +{ +private: + + std::vector mAccordionTabs; + + void ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height); + void ctrlShiftVertical(LLView* panel,S32 delta); + + void onCollapseCtrlCloseOpen(S16 panel_num); + void shiftAccordionTabs(S16 panel_num, S32 delta); + + +public: + /** + * Abstract comparator for accordion tabs. + */ + class LLTabComparator + { + public: + LLTabComparator() {}; + virtual ~LLTabComparator() {}; + + /** Returns true if tab1 < tab2, false otherwise */ + virtual bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const = 0; + }; + + #if 0 // Singu TODO: LLPanel::Params, LLTextBox::Params + struct Params + : public LLInitParam::Block + { + Optional single_expansion, + fit_parent; /* Accordion will fit its parent size, controls that are placed into + accordion tabs are responsible for scrolling their content. + *NOTE fit_parent works best when combined with single_expansion. + Accordion view should implement getRequiredRect() and provide valid height*/ + Optional no_matched_tabs_text; + Optional no_visible_tabs_text; + + Params() + : single_expansion("single_expansion",false) + , fit_parent("fit_parent", false) + , no_matched_tabs_text("no_matched_tabs_text") + , no_visible_tabs_text("no_visible_tabs_text") + {}; + }; + + LLAccordionCtrl(const Params& params); + #endif + + LLAccordionCtrl(); + virtual ~LLAccordionCtrl(); + + virtual BOOL postBuild(); + static LLView* fromXML(LLXMLNodePtr node, LLView* parent, class LLUICtrlFactory* factory); + virtual void initFromXML(LLXMLNodePtr node, LLView* parent); + + virtual BOOL handleRightMouseDown ( S32 x, S32 y, MASK mask); + virtual BOOL handleScrollWheel ( S32 x, S32 y, S32 clicks ); + virtual BOOL handleKeyHere (KEY key, MASK mask); + virtual BOOL handleDragAndDrop (S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + // + + // Call reshape after changing splitter's size + virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + + void addCollapsibleCtrl(LLView* view); + void removeCollapsibleCtrl(LLView* view); + void arrange(); + + + void draw(); + + void onScrollPosChangeCallback(S32, LLScrollbar*); + + //void onOpen (const LLSD& key); + S32 notifyParent(const LLSD& info); + + void reset (); + void expandDefaultTab(); + + void setComparator(const LLTabComparator* comp) { mTabComparator = comp; } + void sort(); + + /** + * Sets filter substring as a search_term for help text when there are no any visible tabs. + */ + void setFilterSubString(const std::string& filter_string); + + /** + * This method returns the first expanded accordion tab. + * It is expected to be called for accordion which doesn't allow multiple + * tabs to be expanded. Use with care. + */ + const LLAccordionCtrlTab* getExpandedTab() const; + + LLAccordionCtrlTab* getSelectedTab() const { return mSelectedTab; } + + bool getFitParent() const {return mFitParent;} + +private: + void initNoTabsWidget(const std::string/*LLTextBox::Params*/& tb_params); + void updateNoTabsHelpTextVisibility(); + + void arrangeSinge(); + void arrangeMultiple(); + + // Calc Splitter's height that is necessary to display all child content + S32 calcRecuiredHeight(); + S32 getRecuiredHeight() const { return mInnerRect.getHeight(); } + S32 calcExpandedTabHeight(S32 tab_index = 0, S32 available_height = 0); + + void updateLayout (S32 width, S32 height); + + void show_hide_scrollbar (S32 width, S32 height); + + void showScrollbar (S32 width, S32 height); + void hideScrollbar (S32 width, S32 height); + + BOOL autoScroll (S32 x, S32 y); + + /** + * An adaptor for LLTabComparator + */ + struct LLComparatorAdaptor + { + LLComparatorAdaptor(const LLTabComparator& comparator) : mComparator(comparator) {}; + + bool operator()(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) + { + return mComparator.compare(tab1, tab2); + } + + const LLTabComparator& mComparator; + }; + +private: + LLRect mInnerRect; + LLScrollbar* mScrollbar; + bool mSingleExpansion; + bool mFitParent; + bool mAutoScrolling; + F32 mAutoScrollRate; + LLTextBox* mNoVisibleTabsHelpText; + + std::string mNoMatchedTabsOrigString; + std::string mNoVisibleTabsOrigString; + + LLAccordionCtrlTab* mSelectedTab; + const LLTabComparator* mTabComparator; +}; + + +#endif // LL_LLSPLITTER_H diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp new file mode 100644 index 000000000..79ebd9705 --- /dev/null +++ b/indra/llui/llaccordionctrltab.cpp @@ -0,0 +1,1278 @@ +/** + * @file LLAccordionCtrlTab.cpp + * @brief Collapsible control implementation + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llaccordionctrltab.h" +#include "llaccordionctrl.h" + +#include "lllocalcliprect.h" +#include "llscrollbar.h" +#include "lltextbox.h" +//#include "lltextutil.h" +#include "lluictrl.h" +#include "lluictrlfactory.h" + +static const std::string DD_BUTTON_NAME = "dd_button"; +static const std::string DD_TEXTBOX_NAME = "dd_textbox"; +static const std::string DD_HEADER_NAME = "dd_header"; + +static const S32 HEADER_HEIGHT = 23; +static const S32 HEADER_IMAGE_LEFT_OFFSET = 5; +static const S32 HEADER_TEXT_LEFT_OFFSET = 30; +static const F32 AUTO_OPEN_TIME = 1.f; +static const S32 VERTICAL_MULTIPLE = 16; +static const S32 PARENT_BORDER_MARGIN = 5; + +//static LLDefaultChildRegistry::Register t1("accordion_tab"); +static LLRegisterWidget t1("accordion_tab"); + +class LLAccordionCtrlTab::LLAccordionCtrlTabHeader : public LLUICtrl +{ +public: + friend class LLUICtrlFactory; + + struct Params : public LLAccordionCtrlTab::Params //LLInitParam::Block + { + Params(); + Params(const LLAccordionCtrlTab::Params& p) : LLAccordionCtrlTab::Params(p) {} + }; + + LLAccordionCtrlTabHeader(const LLAccordionCtrlTabHeader::Params& p); + + virtual ~LLAccordionCtrlTabHeader(); + + virtual void draw(); + + virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + + virtual BOOL postBuild(); + + std::string getTitle(); + void setTitle(const std::string& title, const std::string& hl); + + void setTitleFontStyle(std::string style); + + void setTitleColor(LLUIColor); + + void setSelected(bool is_selected) { mIsSelected = is_selected; } + + virtual void onMouseEnter(S32 x, S32 y, MASK mask); + virtual void onMouseLeave(S32 x, S32 y, MASK mask); + virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); +private: + + LLTextBox* mHeaderTextbox; + + // Overlay images (arrows) + LLPointer mImageCollapsed; + LLPointer mImageExpanded; + LLPointer mImageCollapsedPressed; + LLPointer mImageExpandedPressed; + + // Background images + LLPointer mImageHeader; + LLPointer mImageHeaderOver; + LLPointer mImageHeaderPressed; + LLPointer mImageHeaderFocused; + + // style saved when applying it in setTitleFontStyle + //U8/*LLStyle::Params*/ mStyleParams; + + LLUIColor mHeaderBGColor; + + bool mNeedsHighlight; + bool mIsSelected; + + LLFrameTimer mAutoOpenTimer; +}; + +LLAccordionCtrlTab::LLAccordionCtrlTabHeader::Params::Params() +{ +} + +LLAccordionCtrlTab::LLAccordionCtrlTabHeader::LLAccordionCtrlTabHeader( + const LLAccordionCtrlTabHeader::Params& p) +: LLUICtrl(p) +, mHeaderBGColor(p.header_bg_color()) +, mNeedsHighlight(false) +, mIsSelected(false), + mImageCollapsed(p.header_collapse_img), + mImageCollapsedPressed(p.header_collapse_img_pressed), + mImageExpanded(p.header_expand_img), + mImageExpandedPressed(p.header_expand_img_pressed), + mImageHeader(p.header_image), + mImageHeaderOver(p.header_image_over), + mImageHeaderPressed(p.header_image_pressed), + mImageHeaderFocused(p.header_image_focused) +{ + mHeaderTextbox = new LLTextBox(DD_TEXTBOX_NAME, p.title(), 200, p.font(), false); + mHeaderTextbox->setColor(p.header_text_color()); + mHeaderTextbox->setFollows(FOLLOWS_NONE); + mHeaderTextbox->setFontShadow(LLFontGL::NO_SHADOW); + mHeaderTextbox->setUseEllipses(true); + mHeaderTextbox->setBackgroundVisible(false); + addChild(mHeaderTextbox); +} + +LLAccordionCtrlTab::LLAccordionCtrlTabHeader::~LLAccordionCtrlTabHeader() +{ +} + +BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild() +{ + return TRUE; +} + +std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle() +{ + if(mHeaderTextbox) + { + return mHeaderTextbox->getText(); + } + else + { + return LLStringUtil::null; + } +} + +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title, const std::string& hl) +{ + if(mHeaderTextbox) + { + mHeaderTextbox->setText(title); + /*LLTextUtil::textboxSetHighlightedVal( + mHeaderTextbox, + mStyleParams, + title, + hl);*/ + } +} + +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleFontStyle(std::string style) +{ + if (mHeaderTextbox) + { + mHeaderTextbox->setFontStyle(/*mStyleParams =*/ LLFontGL::getStyleFromString(style)); + } +} + +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleColor(LLUIColor color) +{ + if(mHeaderTextbox) + { + mHeaderTextbox->setColor(color); + } +} + +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() +{ + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); + + //F32 alpha = getCurrentTransparency(); // Singu TODO + gl_rect_2d(0,0,width - 1 ,height - 1,mHeaderBGColor.get() /*% alpha*/,true); + + LLAccordionCtrlTab* parent = dynamic_cast(getParent()); + bool collapsible = (parent && parent->getCollapsible()); + bool expanded = (parent && parent->getDisplayChildren()); + + // Handle overlay images, if needed + // Only show green "focus" background image if the accordion is open, + // because the user's mental model of focus is that it goes away after + // the accordion is closed. + if (getParent()->hasFocus() || mIsSelected + /*&& !(collapsible && !expanded)*/ // WHY?? + ) + { + mImageHeaderFocused->draw(0,0,width,height); + } + else + { + mImageHeader->draw(0,0,width,height); + } + + if(mNeedsHighlight) + { + mImageHeaderOver->draw(0,0,width,height); + } + + + if(collapsible) + { + LLPointer overlay_image; + if(expanded) + { + overlay_image = mImageExpanded; + } + else + { + overlay_image = mImageCollapsed; + } + overlay_image->draw(HEADER_IMAGE_LEFT_OFFSET, + (height - overlay_image->getHeight()) / 2); + } + + LLUICtrl::draw(); +} + +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +{ + S32 header_height = mHeaderTextbox->getTextPixelHeight(); + + LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET,(height+header_height)/2 ,width,(height-header_height)/2); + mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight()); + mHeaderTextbox->setRect(textboxRect); + + if (mHeaderTextbox->getTextPixelWidth() > mHeaderTextbox->getRect().getWidth()) + { + setToolTip(mHeaderTextbox->getText()); + } + else + { + setToolTip(LLStringUtil::null); + } +} + +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseEnter(S32 x, S32 y, MASK mask) +{ + LLUICtrl::onMouseEnter(x, y, mask); + mNeedsHighlight = true; +} +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseLeave(S32 x, S32 y, MASK mask) +{ + LLUICtrl::onMouseLeave(x, y, mask); + mNeedsHighlight = false; + mAutoOpenTimer.stop(); +} +BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, BOOL called_from_parent) +{ + if ( ( key == KEY_LEFT || key == KEY_RIGHT) && mask == MASK_NONE) + { + return getParent()->handleKey(key, mask, called_from_parent); + } + return LLUICtrl::handleKey(key, mask, called_from_parent); +} +BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + LLAccordionCtrlTab* parent = dynamic_cast(getParent()); + + if ( parent && !parent->getDisplayChildren() && parent->getCollapsible() && parent->canOpenClose() ) + { + if (mAutoOpenTimer.getStarted()) + { + if (mAutoOpenTimer.getElapsedTimeF32() > AUTO_OPEN_TIME) + { + parent->changeOpenClose(false); + mAutoOpenTimer.stop(); + return TRUE; + } + } + else + mAutoOpenTimer.start(); + } + + return LLUICtrl::handleDragAndDrop(x, y, mask, drop, cargo_type, + cargo_data, accept, tooltip_msg); +} +LLAccordionCtrlTab::Params::Params() + : title("title") + ,display_children("expanded", true) + ,header_height("header_height", HEADER_HEIGHT), + min_width("min_width", 0), + min_height("min_height", 0) + ,collapsible("collapsible", true) + ,header_bg_color("header_bg_color") + ,dropdown_bg_color("dropdown_bg_color") + ,header_visible("header_visible",true) + ,padding_left("padding_left",2) + ,padding_right("padding_right",2) + ,padding_top("padding_top",2) + ,padding_bottom("padding_bottom",2) + ,header_expand_img("header_expand_img") + ,header_expand_img_pressed("header_expand_img_pressed") + ,header_collapse_img("header_collapse_img") + ,header_collapse_img_pressed("header_collapse_img_pressed") + ,header_image("header_image") + ,header_image_over("header_image_over") + ,header_image_pressed("header_image_pressed") + ,header_image_focused("header_image_focused") + ,header_text_color("header_text_color") + ,fit_panel("fit_panel",true) + ,selection_enabled("selection_enabled", false) +{ + changeDefault(mouse_opaque, false); +} + +LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) + : LLUICtrl(p) + ,mDisplayChildren(p.display_children) + ,mCollapsible(p.collapsible) + ,mExpandedHeight(0) + ,mDropdownBGColor(p.dropdown_bg_color()) + ,mHeaderVisible(p.header_visible) + ,mPaddingLeft(p.padding_left) + ,mPaddingRight(p.padding_right) + ,mPaddingTop(p.padding_top) + ,mPaddingBottom(p.padding_bottom) + ,mCanOpenClose(true) + ,mFitPanel(p.fit_panel) + ,mSelectionEnabled(p.selection_enabled) + ,mContainerPanel(NULL) + ,mScrollbar(NULL) +{ + mStoredOpenCloseState = false; + mWasStateStored = false; + + mDropdownBGColor = LLColor4::white; + LLAccordionCtrlTabHeader::Params headerParams(p); + headerParams.name(DD_HEADER_NAME); + headerParams.title(p.title); + mHeader = LLUICtrlFactory::create(headerParams); + addChild(mHeader, 1); + + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLAccordionCtrlTab::selectOnFocusReceived, this)); + + if (!p.selection_enabled) + { + LLFocusableElement::setFocusLostCallback(boost::bind(&LLAccordionCtrlTab::deselectOnFocusLost, this)); + } + + reshape(100, 200,FALSE); +} + +LLAccordionCtrlTab::~LLAccordionCtrlTab() +{ +} + + +void LLAccordionCtrlTab::setDisplayChildren(bool display) +{ + mDisplayChildren = display; + LLRect rect = getRect(); + + rect.mBottom = rect.mTop - (getDisplayChildren() ? + mExpandedHeight : HEADER_HEIGHT); + setRect(rect); + + if(mContainerPanel) + mContainerPanel->setVisible(getDisplayChildren()); + + if(mDisplayChildren) + { + adjustContainerPanel(); + } + else + { + if(mScrollbar) + mScrollbar->setVisible(false); + } + +} + +void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +{ + LLRect headerRect; + + headerRect.setLeftTopAndSize( + 0,height,width,HEADER_HEIGHT); + mHeader->setRect(headerRect); + mHeader->reshape(headerRect.getWidth(), headerRect.getHeight()); + + if(!mDisplayChildren) + return; + + LLRect childRect; + + childRect.setLeftTopAndSize( + getPaddingLeft(), + height - getHeaderHeight() - getPaddingTop(), + width - getPaddingLeft() - getPaddingRight(), + height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + + adjustContainerPanel(childRect); +} + +void LLAccordionCtrlTab::changeOpenClose(bool is_open) +{ + if(is_open) + mExpandedHeight = getRect().getHeight(); + + setDisplayChildren(!is_open); + reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + if (mCommitSignal) + { + (*mCommitSignal)(this, getDisplayChildren()); + } +} + +/*void LLAccordionCtrlTab::onVisibilityChange(BOOL new_visibility) +{ + LLUICtrl::onVisibilityChange(new_visibility); + + notifyParent(LLSD().with("child_visibility_change", new_visibility)); +}*/ + +BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if(mCollapsible && mHeaderVisible && mCanOpenClose) + { + if(y >= (getRect().getHeight() - HEADER_HEIGHT) ) + { + mHeader->setFocus(true); + changeOpenClose(getDisplayChildren()); + + //reset stored state + mWasStateStored = false; + return TRUE; + } + } + return LLUICtrl::handleMouseDown(x,y,mask); +} + +BOOL LLAccordionCtrlTab::handleMouseUp(S32 x, S32 y, MASK mask) +{ + return LLUICtrl::handleMouseUp(x,y,mask); +} + +boost::signals2::connection LLAccordionCtrlTab::setDropDownStateChangedCallback(commit_callback_t cb) +{ + return setCommitCallback(cb); +} + +bool LLAccordionCtrlTab::addChild(LLView* child, S32 tab_group) +{ + if(DD_HEADER_NAME != child->getName()) + { + reshape(child->getRect().getWidth() , child->getRect().getHeight() + HEADER_HEIGHT ); + mExpandedHeight = getRect().getHeight(); + } + + bool res = LLUICtrl::addChild(child, tab_group); + + if(DD_HEADER_NAME != child->getName()) + { + if(!mCollapsible) + setDisplayChildren(true); + else + setDisplayChildren(getDisplayChildren()); + } + + if (!mContainerPanel) + mContainerPanel = findContainerView(); + + return res; +} + +void LLAccordionCtrlTab::setAccordionView(LLView* panel) +{ + addChild(panel,0); +} + +std::string LLAccordionCtrlTab::getTitle() const +{ + if (mHeader) + { + return mHeader->getTitle(); + } + else + { + return LLStringUtil::null; + } +} + +void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& hl) +{ + if (mHeader) + { + mHeader->setTitle(title, hl); + } +} + +void LLAccordionCtrlTab::setTitleFontStyle(std::string style) +{ + if (mHeader) + { + mHeader->setTitleFontStyle(style); + } +} + +void LLAccordionCtrlTab::setTitleColor(LLUIColor color) +{ + if (mHeader) + { + mHeader->setTitleColor(color); + } +} + +boost::signals2::connection LLAccordionCtrlTab::setFocusReceivedCallback(const focus_signal_t::slot_type& cb) +{ + if (mHeader) + { + return mHeader->setFocusReceivedCallback(cb); + } + return boost::signals2::connection(); +} + +boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus_signal_t::slot_type& cb) +{ + if (mHeader) + { + return mHeader->setFocusLostCallback(cb); + } + return boost::signals2::connection(); +} + +void LLAccordionCtrlTab::setSelected(bool is_selected) +{ + if (mHeader) + { + mHeader->setSelected(is_selected); + } +} + +LLView* LLAccordionCtrlTab::findContainerView() +{ + for(child_list_const_iter_t it = getChildList()->begin(); + getChildList()->end() != it; ++it) + { + LLView* child = *it; + if(DD_HEADER_NAME == child->getName()) + continue; + if(!child->getVisible()) + continue; + return child; + } + return NULL; +} + +void LLAccordionCtrlTab::selectOnFocusReceived() +{ + if (getParent()) // A parent may not be set if tabs are added dynamically. + getParent()->notifyParent(LLSD().with("action", "select_current")); +} + +void LLAccordionCtrlTab::deselectOnFocusLost() +{ + if(getParent()) // A parent may not be set if tabs are added dynamically. + { + getParent()->notifyParent(LLSD().with("action", "deselect_current")); + } + +} + +S32 LLAccordionCtrlTab::getHeaderHeight() +{ + return mHeaderVisible?HEADER_HEIGHT:0; +} + +void LLAccordionCtrlTab::setHeaderVisible(bool value) +{ + if(mHeaderVisible == value) + return; + mHeaderVisible = value; + if(mHeader) + mHeader->setVisible(value); + reshape(getRect().getWidth(), getRect().getHeight(), FALSE); +}; + +//virtual +BOOL LLAccordionCtrlTab::postBuild() +{ + if(mHeader) + mHeader->setVisible(mHeaderVisible); + + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + + LLRect scroll_rect; + scroll_rect.setOriginAndSize( + getRect().getWidth() - scrollbar_size, + 1, + scrollbar_size, + getRect().getHeight() - 1); + + mContainerPanel = findContainerView(); + + if(!mFitPanel) + { + mScrollbar = new LLScrollbar("scrollable vertical", scroll_rect, LLScrollbar::VERTICAL, getRect().getHeight(), 0, getRect().getHeight(), boost::bind(&LLAccordionCtrlTab::onScrollPosChangeCallback, this, _1, _2), VERTICAL_MULTIPLE); + mScrollbar->setFollows(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM); + LLView::addChild( mScrollbar ); + mScrollbar->setFollows(FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM); + + mScrollbar->setVisible(false); + } + + if(mContainerPanel) + mContainerPanel->setVisible(mDisplayChildren); + + return LLUICtrl::postBuild(); +} +bool LLAccordionCtrlTab::notifyChildren (const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "store_state") + { + storeOpenCloseState(); + return true; + } + if(str_action == "restore_state") + { + restoreOpenCloseState(); + return true; + } + } + return LLUICtrl::notifyChildren(info); +} + +S32 LLAccordionCtrlTab::notifyParent(const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "size_changes") + { + // + S32 height = info["height"]; + height = llmax(height,10) + HEADER_HEIGHT + getPaddingTop() + getPaddingBottom(); + + mExpandedHeight = height; + + if(isExpanded()) + { + LLRect panel_rect = getRect(); + panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), height); + reshape(getRect().getWidth(),height); + setRect(panel_rect); + } + + //LLAccordionCtrl should rearrange accordion tab if one of accordion change its size + if (getParent()) // A parent may not be set if tabs are added dynamically. + getParent()->notifyParent(info); + return 1; + } + else if(str_action == "select_prev") + { + showAndFocusHeader(); + return 1; + } + } + else if (info.has("scrollToShowRect")) + { + LLAccordionCtrl* parent = dynamic_cast(getParent()); + if (parent && parent->getFitParent()) + { + // EXT-8285 ('No attachments worn' text appears at the bottom of blank 'Attachments' accordion) + // The problem was in passing message "scrollToShowRect" IN LLAccordionCtrlTab::notifyParent + // FROM child LLScrollContainer TO parent LLAccordionCtrl with "it_parent" set to true. + + // It is wrong notification for parent accordion which leads to recursive call of adjustContainerPanel + // As the result of recursive call of adjustContainerPanel we got LLAccordionCtrlTab + // that reshaped and re-sized with different rectangles. + + // LLAccordionCtrl has own scrollContainer and LLAccordionCtrlTab has own scrollContainer + // both should handle own scroll container's event. + // So, if parent accordion "fit_parent" accordion tab should handle its scroll container events itself. + + return 1; + } + + if (!getDisplayChildren()) + { + // Don't pass scrolling event further if our contents are invisible (STORM-298). + return 1; + } + } + + return LLUICtrl::notifyParent(info); +} + +S32 LLAccordionCtrlTab::notify(const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "select_first") + { + showAndFocusHeader(); + return 1; + } + else if( str_action == "select_last" ) + { + if(getDisplayChildren() == false) + { + showAndFocusHeader(); + } + else + { + LLView* view = getAccordionView(); + if(view) + view->notify(LLSD().with("action","select_last")); + } + } + } + return 0; +} + +BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) +{ + if( !mHeader->hasFocus() ) + return LLUICtrl::handleKey(key, mask, called_from_parent); + + if ( (key == KEY_RETURN )&& mask == MASK_NONE) + { + changeOpenClose(getDisplayChildren()); + return TRUE; + } + + if ( (key == KEY_ADD || key == KEY_RIGHT)&& mask == MASK_NONE) + { + if(getDisplayChildren() == false) + { + changeOpenClose(getDisplayChildren()); + return TRUE; + } + } + if ( (key == KEY_SUBTRACT || key == KEY_LEFT)&& mask == MASK_NONE) + { + if(getDisplayChildren() == true) + { + changeOpenClose(getDisplayChildren()); + return TRUE; + } + } + + if ( key == KEY_DOWN && mask == MASK_NONE) + { + //if collapsed go to the next accordion + if(getDisplayChildren() == false) + //we processing notifyParent so let call parent directly + getParent()->notifyParent(LLSD().with("action","select_next")); + else + { + getAccordionView()->notify(LLSD().with("action","select_first")); + } + return TRUE; + } + + if ( key == KEY_UP && mask == MASK_NONE) + { + //go to the previous accordion + + //we processing notifyParent so let call parent directly + getParent()->notifyParent(LLSD().with("action","select_prev")); + return TRUE; + } + + return LLUICtrl::handleKey(key, mask, called_from_parent); +} + +void LLAccordionCtrlTab::showAndFocusHeader() +{ + mHeader->setFocus(true); + mHeader->setSelected(mSelectionEnabled); + + LLRect screen_rc; + LLRect selected_rc = mHeader->getRect(); + localRectToScreen(selected_rc, &screen_rc); + + // This call to notifyParent() is intended to deliver "scrollToShowRect" command + // to the parent LLAccordionCtrl so by calling it from the direct parent of this + // accordion tab (assuming that the parent is an LLAccordionCtrl) the calls chain + // is shortened and messages from inside the collapsed tabs are avoided. + // See STORM-536. + getParent()->notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue())); +} +void LLAccordionCtrlTab::storeOpenCloseState() +{ + if(mWasStateStored) + return; + mStoredOpenCloseState = getDisplayChildren(); + mWasStateStored = true; +} + +void LLAccordionCtrlTab::restoreOpenCloseState() +{ + if(!mWasStateStored) + return; + if(getDisplayChildren() != mStoredOpenCloseState) + { + changeOpenClose(getDisplayChildren()); + } + mWasStateStored = false; +} + +void LLAccordionCtrlTab::adjustContainerPanel () +{ + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); + + LLRect child_rect; + child_rect.setLeftTopAndSize( + getPaddingLeft(), + height - getHeaderHeight() - getPaddingTop(), + width - getPaddingLeft() - getPaddingRight(), + height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + + adjustContainerPanel(child_rect); +} + +void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect) +{ + if(!mContainerPanel) + return; + + if(!mFitPanel) + { + show_hide_scrollbar(child_rect); + updateLayout(child_rect); + } + else + { + mContainerPanel->reshape(child_rect.getWidth(),child_rect.getHeight()); + mContainerPanel->setRect(child_rect); + } +} + +S32 LLAccordionCtrlTab::getChildViewHeight() +{ + if(!mContainerPanel) + return 0; + return mContainerPanel->getRect().getHeight(); +} + +void LLAccordionCtrlTab::show_hide_scrollbar(const LLRect& child_rect) +{ + if(getChildViewHeight() > child_rect.getHeight() ) + showScrollbar(child_rect); + else + hideScrollbar(child_rect); +} +void LLAccordionCtrlTab::showScrollbar(const LLRect& child_rect) +{ + if(!mContainerPanel || !mScrollbar) + return; + bool was_visible = mScrollbar->getVisible(); + mScrollbar->setVisible(true); + + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + + { + ctrlSetLeftTopAndSize(mScrollbar,child_rect.getWidth()-scrollbar_size, + child_rect.getHeight()-PARENT_BORDER_MARGIN, + scrollbar_size, + child_rect.getHeight()-2*PARENT_BORDER_MARGIN); + } + + LLRect orig_rect = mContainerPanel->getRect(); + + mScrollbar->setPageSize(child_rect.getHeight()); + mScrollbar->setDocParams(orig_rect.getHeight(),mScrollbar->getDocPos()); + + if(was_visible) + { + S32 scroll_pos = llmin(mScrollbar->getDocPos(), orig_rect.getHeight() - child_rect.getHeight() - 1); + mScrollbar->setDocPos(scroll_pos); + } + else//shrink child panel + { + updateLayout(child_rect); + } + +} + +void LLAccordionCtrlTab::hideScrollbar( const LLRect& child_rect ) +{ + if(!mContainerPanel || !mScrollbar) + return; + + if(mScrollbar->getVisible() == false) + return; + mScrollbar->setVisible(false); + mScrollbar->setDocPos(0); + + //shrink child panel + updateLayout(child_rect); +} + +void LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*) +{ + LLRect child_rect; + + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); + + child_rect.setLeftTopAndSize( + getPaddingLeft(), + height - getHeaderHeight() - getPaddingTop(), + width - getPaddingLeft() - getPaddingRight(), + height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + + updateLayout(child_rect); +} + +void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) +{ + if (child && child->getVisible() && child->getRect().isValid()) + { + LLRect screen_rect; + localRectToScreen(child->getRect(),&screen_rect); + + if ( root_rect.overlaps(screen_rect) /*&& LLUI::sDirtyRect.overlaps(screen_rect)*/)// Singu TODO: LLUI::sDirtyRect + { + gGL.matrixMode(LLRender::MM_MODELVIEW); + LLUI::pushMatrix(); + { + LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom); + child->draw(); + + } + LLUI::popMatrix(); + } + } +} + +void LLAccordionCtrlTab::draw() +{ + if(mFitPanel) + LLUICtrl::draw(); + else + { + LLRect root_rect = getRootView()->getRect(); + drawChild(root_rect,mHeader); + drawChild(root_rect,mScrollbar ); + { + LLRect child_rect; + + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); + + child_rect.setLeftTopAndSize( + getPaddingLeft(), + height - getHeaderHeight() - getPaddingTop(), + width - getPaddingLeft() - getPaddingRight(), + height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + + LLLocalClipRect clip(child_rect); + drawChild(root_rect,mContainerPanel); + } + } +} + +void LLAccordionCtrlTab::updateLayout ( const LLRect& child_rect ) +{ + LLView* child = getAccordionView(); + if(!mContainerPanel) + return; + + S32 panel_top = child_rect.getHeight(); + S32 panel_width = child_rect.getWidth(); + + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + if(mScrollbar && mScrollbar->getVisible() != false) + { + panel_top+=mScrollbar->getDocPos(); + panel_width-=scrollbar_size; + } + + //set sizes for first panels and dragbars + LLRect panel_rect = child->getRect(); + ctrlSetLeftTopAndSize(mContainerPanel,child_rect.mLeft,panel_top,panel_width,panel_rect.getHeight()); +} +void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height) +{ + if(!panel) + return; + LLRect panel_rect = panel->getRect(); + panel_rect.setLeftTopAndSize( left, top, width, height); + panel->reshape( width, height, 1); + panel->setRect(panel_rect); +} +BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect) +{ + //header may be not the first child but we need to process it first + if(y >= (getRect().getHeight() - HEADER_HEIGHT - HEADER_HEIGHT/2) ) + { + //inside tab header + //fix for EXT-6619 + mHeader->handleToolTip(x, y, msg, sticky_rect); + return TRUE; + } + return LLUICtrl::handleToolTip(x, y, msg, sticky_rect); +} +BOOL LLAccordionCtrlTab::handleScrollWheel ( S32 x, S32 y, S32 clicks ) +{ + if( LLUICtrl::handleScrollWheel(x,y,clicks)) + { + return TRUE; + } + if( mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel( 0, 0, clicks ) ) + { + return TRUE; + } + return FALSE; +} + +//static +LLView* LLAccordionCtrlTab::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory) +{ + Params p; + // Singu TODO: Widgets folder for defaults instead of shoving into params here where noted + if (node->hasAttribute("title")) + { + std::string title; + node->getAttributeString("title", title); + p.title(title); + } + + if (node->hasAttribute("expanded")) + { + bool display_children; + node->getAttribute_bool("expanded", display_children); + p.display_children(display_children); + } + + if (node->hasAttribute("header_height")) + { + S32 header_height; + node->getAttributeS32("header_height", header_height); + p.header_height(header_height); + } + + if (node->hasAttribute("min_width")) + { + S32 min_width; + node->getAttributeS32("min_width", min_width); + p.min_width(min_width); + } + + if (node->hasAttribute("min_width")) + { + S32 min_height; + node->getAttributeS32("min_height", min_height); + p.min_height(min_height); + } + + if (node->hasAttribute("collapsible")) + { + bool collapsible; + node->getAttribute_bool("collapsible", collapsible); + p.collapsible(collapsible); + } + + if (node->hasAttribute("header_bg_color")) + { + LLColor4 color; + node->getAttributeColor("header_bg_color", color); + p.header_bg_color(color); + } + else // widget + { + p.header_bg_color(LLUI::sColorsGroup->getColor("ButtonUnselectedBgColor")); // was DkGray2 + } + + if (node->hasAttribute("dropdown_bg_color")) + { + LLColor4 color; + node->getAttributeColor("dropdown_bg_color", color); + p.dropdown_bg_color(color); + } + + if (node->hasAttribute("header_visible")) + { + bool header_visible; + node->getAttribute_bool("header_visible", header_visible); + p.header_visible(header_visible); + } + + if (node->hasAttribute("padding_left")) + { + S32 padding_left; + node->getAttributeS32("padding_left", padding_left); + p.padding_left(padding_left); + } + + if (node->hasAttribute("padding_right")) + { + S32 padding_right; + node->getAttributeS32("padding_right", padding_right); + p.padding_right(padding_right); + } + + if (node->hasAttribute("padding_top")) + { + S32 padding_top; + node->getAttributeS32("padding_top", padding_top); + p.padding_top(padding_top); + } + + if (node->hasAttribute("padding_bottom")) + { + S32 padding_bottom; + node->getAttributeS32("padding_bottom", padding_bottom); + p.padding_bottom(padding_bottom); + } + + if (node->hasAttribute("header_expand_img")) + { + std::string image; + node->getAttributeString("header_expand_img", image); + p.header_expand_img.name(image); + } + else // widget + { + p.header_expand_img.name("Accordion_ArrowOpened_Off"); + } + + if (node->hasAttribute("header_expand_img_pressed")) + { + std::string image; + node->getAttributeString("header_expand_img_pressed", image); + p.header_expand_img_pressed.name(image); + } + else // widget + { + p.header_expand_img_pressed.name("Accordion_ArrowOpened_Press"); + } + + if (node->hasAttribute("header_collapse_img")) + { + std::string image; + node->getAttributeString("header_collapse_img", image); + p.header_collapse_img.name(image); + } + else // widget + { + p.header_collapse_img.name("Accordion_ArrowClosed_Off"); + } + + if (node->hasAttribute("header_collapse_img_pressed")) + { + std::string image; + node->getAttributeString("header_collapse_img_pressed", image); + p.header_collapse_img_pressed.name(image); + } + else // widget + { + p.header_collapse_img_pressed.name("Accordion_ArrowClosed_Press"); + } + + if (node->hasAttribute("header_image")) + { + std::string image; + node->getAttributeString("header_image", image); + p.header_image.name(image); + } + else // widget + { + p.header_image.name("Accordion_Off"); + } + + if (node->hasAttribute("header_image_over")) + { + std::string image; + node->getAttributeString("header_image_over", image); + p.header_image_over.name(image); + } + else // widget + { + p.header_image_over.name("Accordion_Over"); + } + + if (node->hasAttribute("header_image_pressed")) + { + std::string image; + node->getAttributeString("header_image_pressed", image); + p.header_image_pressed.name(image); + } + else // widget + { + p.header_image_pressed.name("Accordion_Press"); + } + + if (node->hasAttribute("header_image_focused")) + { + std::string image; + node->getAttributeString("header_image_focused", image); + p.header_image_focused.name(image); + } + else // widget + { + p.header_image_focused.name("Accordion_Selected"); + } + + if (node->hasAttribute("header_text_color")) + { + LLColor4 color; + node->getAttributeColor("header_text_color", color); + p.header_text_color(color); + } + else // widget + { + p.header_text_color(LLUI::sColorsGroup->getColor("ButtonLabelColor")); // AccordionHeaderTextColor + } + + if (node->hasAttribute("fit_panel")) + { + bool fit_panel; + node->getAttribute_bool("fit_panel", fit_panel); + p.fit_panel(fit_panel); + } + + if (node->hasAttribute("selection_enabled")) + { + bool selection_enabled; + node->getAttribute_bool("selection_enabled", selection_enabled); + p.selection_enabled(selection_enabled); + } + + if (node->hasAttribute("font")) + { + std::string font; + node->getAttributeString("font", font); + p.font.name(font); + } + else // widget + { + p.font.name("SansSerif"); + } + + LLAccordionCtrlTab* ctrl = new LLAccordionCtrlTab(p); + ctrl->initFromXML(node, parent); + return ctrl; +} diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h new file mode 100644 index 000000000..45321c85c --- /dev/null +++ b/indra/llui/llaccordionctrltab.h @@ -0,0 +1,248 @@ +/** + * @file LLAccordionCtrlTab.h + * @brief Collapsible box control implementation + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_ACCORDIONCTRLTAB_H_ +#define LL_ACCORDIONCTRLTAB_H_ + +#include +#include "llrect.h" +#include "lluictrl.h" +#include "lluicolor.h" +#include "llstyle.h" + +class LLUICtrlFactory; +class LLUIImage; +class LLButton; +class LLTextBox; +class LLScrollbar; + + + +// LLAccordionCtrlTab is a container for other controls. +// It has a Header, by clicking on which hosted controls are shown or hidden. +// When hosted controls are show - LLAccordionCtrlTab is expanded. +// When hosted controls are hidden - LLAccordionCtrlTab is collapsed. + +class LLAccordionCtrlTab : public LLUICtrl +{ +// Interface +public: + + struct Params + : public LLInitParam::Block + { + Optional display_children, //expanded or collapsed after initialization + collapsible; + + Optional title; + + Optional header_height, + min_width, + min_height; + + // Overlay images (arrows on the left) + Mandatory header_expand_img, + header_expand_img_pressed, + header_collapse_img, + header_collapse_img_pressed; + + // Background images for the accordion tabs + Mandatory header_image, + header_image_over, + header_image_pressed, + header_image_focused; + + Optional header_bg_color, + header_text_color, + dropdown_bg_color; + + Optional header_visible; + + Optional fit_panel; + + Optional selection_enabled; + + Optional padding_left, + padding_right, + padding_top, + padding_bottom; + + Params(); + }; + +// typedef LLDefaultChildRegistry child_registry_t; // Singu TODO: NOTE: This comes in with the VMM merge. + + virtual ~LLAccordionCtrlTab(); + + // Registers callback for expand/collapse events. + boost::signals2::connection setDropDownStateChangedCallback(commit_callback_t cb); + + // Changes expand/collapse state + virtual void setDisplayChildren(bool display); + + // Returns expand/collapse state + virtual bool getDisplayChildren() const {return mDisplayChildren;}; + + //set LLAccordionCtrlTab panel + void setAccordionView(LLView* panel); + LLView* getAccordionView() { return mContainerPanel; }; + + std::string getTitle() const; + + // Set text and highlight substring in LLAccordionCtrlTabHeader + void setTitle(const std::string& title, const std::string& hl = LLStringUtil::null); + + // Set text font style in LLAccordionCtrlTabHeader + void setTitleFontStyle(std::string style); + + // Set text color in LLAccordionCtrlTabHeader + void setTitleColor(LLUIColor color); + + boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb); + boost::signals2::connection setFocusLostCallback(const focus_signal_t::slot_type& cb); + + void setSelected(bool is_selected); + + bool getCollapsible() {return mCollapsible;}; + + void setCollapsible(bool collapsible) {mCollapsible = collapsible;}; + void changeOpenClose(bool is_open); + + void canOpenClose(bool can_open_close) { mCanOpenClose = can_open_close;}; + bool canOpenClose() const { return mCanOpenClose; }; + + virtual BOOL postBuild(); + static LLView* fromXML(LLXMLNodePtr node, LLView* parent, class LLUICtrlFactory* factory); + + S32 notifyParent(const LLSD& info); + S32 notify(const LLSD& info); + bool notifyChildren(const LLSD& info); + + void draw(); + + void storeOpenCloseState (); + void restoreOpenCloseState (); + +protected: + LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&); + friend class LLUICtrlFactory; + +// Overrides +public: + + // Call reshape after changing size + virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + + /** + * Raises notifyParent event with "child_visibility_change" = new_visibility + */ + //void onVisibilityChange(BOOL new_visibility); + + // Changes expand/collapse state and triggers expand/collapse callbacks + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); + virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + + + virtual bool addChild(LLView* child, S32 tab_group = 0 ); + + bool isExpanded() const { return mDisplayChildren; } + + S32 getHeaderHeight(); + + // Min size functions + + void setHeaderVisible(bool value); + + bool getHeaderVisible() { return mHeaderVisible;} + + S32 mExpandedHeight; // Height of expanded ctrl. + // Used to restore height after expand. + + S32 getPaddingLeft() const { return mPaddingLeft;} + S32 getPaddingRight() const { return mPaddingRight;} + S32 getPaddingTop() const { return mPaddingTop;} + S32 getPaddingBottom() const { return mPaddingBottom;} + + void showAndFocusHeader(); + + void setFitPanel( bool fit ) { mFitPanel = true; } + bool getFitParent() const { return mFitPanel; } + +protected: + void adjustContainerPanel (const LLRect& child_rect); + void adjustContainerPanel (); + S32 getChildViewHeight (); + + void onScrollPosChangeCallback(S32, LLScrollbar*); + + void show_hide_scrollbar (const LLRect& child_rect); + void showScrollbar (const LLRect& child_rect); + void hideScrollbar (const LLRect& child_rect); + + void updateLayout ( const LLRect& child_rect ); + void ctrlSetLeftTopAndSize (LLView* panel, S32 left, S32 top, S32 width, S32 height); + + void drawChild(const LLRect& root_rect,LLView* child); + + LLView* findContainerView (); + + void selectOnFocusReceived(); + void deselectOnFocusLost(); + +private: + + class LLAccordionCtrlTabHeader; + LLAccordionCtrlTabHeader* mHeader; //Header + + bool mDisplayChildren; //Expanded/collapsed + bool mCollapsible; + bool mHeaderVisible; + + bool mCanOpenClose; + bool mFitPanel; + + S32 mPaddingLeft; + S32 mPaddingRight; + S32 mPaddingTop; + S32 mPaddingBottom; + + bool mStoredOpenCloseState; + bool mWasStateStored; + + bool mSelectionEnabled; + + LLScrollbar* mScrollbar; + LLView* mContainerPanel; + + LLUIColor mDropdownBGColor; +}; + +#endif diff --git a/indra/llui/llcallbackmap.h b/indra/llui/llcallbackmap.h index 2ad6d54c5..b92febdb2 100644 --- a/indra/llui/llcallbackmap.h +++ b/indra/llui/llcallbackmap.h @@ -35,7 +35,10 @@ #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif class LLCallbackMap { diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index afcafdace..1be8be2b0 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -46,12 +46,30 @@ BOOL LLFocusableElement::handleKey(KEY key, MASK mask, BOOL called_from_parent) return FALSE; } +// virtual +BOOL LLFocusableElement::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +{ + return FALSE; +} + // virtual BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) { return FALSE; } +// virtual +bool LLFocusableElement::wantsKeyUpKeyDown() const +{ + return false; +} + +//virtual +bool LLFocusableElement::wantsReturnKey() const +{ + return false; +} + // virtual LLFocusableElement::~LLFocusableElement() { diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 483ef8137..04c32e11f 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -57,8 +57,17 @@ public: // These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus. virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); + /** + * If true this LLFocusableElement wants to receive KEYUP and KEYDOWN messages + * even for normal character strokes. + * Default implementation returns false. + */ + virtual bool wantsKeyUpKeyDown() const; + virtual bool wantsReturnKey() const; + virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere protected: virtual void onFocusReceived(); diff --git a/indra/llui/llfunctorregistry.h b/indra/llui/llfunctorregistry.h index 2cba7f2cd..43c8b47c8 100644 --- a/indra/llui/llfunctorregistry.h +++ b/indra/llui/llfunctorregistry.h @@ -37,8 +37,6 @@ #include #include -#include - #include "llsd.h" #include "llsingleton.h" @@ -140,5 +138,6 @@ public: } }; + #endif//LL_LLFUNCTORREGISTRY_H diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index e724dfb54..0b9b29085 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -34,7 +34,8 @@ #include "llpanel.h" #include "lluictrlfactory.h" #include "llcriticaldamp.h" -#include "boost/foreach.hpp" + +#include static const F32 MIN_FRACTIONAL_SIZE = 0.00001f; static const F32 MAX_FRACTIONAL_SIZE = 1.f; @@ -245,7 +246,7 @@ void LLLayoutStack::draw() // always clip to stack itself LLLocalClipRect clip(getLocalRect()); - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { // clip to layout rectangle, not bounding rectangle LLRect clip_rect = panelp->getRect(); @@ -367,8 +368,8 @@ void LLLayoutStack::updateLayout() : getRect().getHeight(); // first, assign minimum dimensions - LLLayoutPanel* panelp = NULL; - BOOST_FOREACH(panelp, mPanels) + LLLayoutPanel* panelp = mPanels.size() ? *mPanels.rbegin() : nullptr; + for (auto* panelp : mPanels) { if (panelp->mAutoResize) { @@ -387,7 +388,7 @@ void LLLayoutStack::updateLayout() F32 fraction_distributed = 0.f; if (space_to_distribute > 0 && total_visible_fraction > 0.f) { // give space proportionally to visible auto resize panels - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -401,7 +402,7 @@ void LLLayoutStack::updateLayout() } // distribute any left over pixels to non-collapsed, visible panels - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (remaining_space == 0) break; @@ -417,7 +418,7 @@ void LLLayoutStack::updateLayout() F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight(); - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim); F32 panel_visible_dim = panelp->getVisibleDim(); @@ -473,7 +474,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const if (!panelp) return NULL; e_panel_list_t::const_iterator panel_it; - BOOST_FOREACH(LLLayoutPanel* p, mPanels) + for (LLLayoutPanel* p : mPanels) { if (p == panelp) { @@ -487,7 +488,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c { LLLayoutPanel* result = NULL; - BOOST_FOREACH(LLLayoutPanel* p, mPanels) + for (LLLayoutPanel* p : mPanels) { if (p->getName() == name) { @@ -501,7 +502,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) { - BOOST_FOREACH(LLLayoutPanel* lp, mPanels) + for (LLLayoutPanel* lp : mPanels) { if (lp->mResizeBar == NULL) { @@ -545,7 +546,7 @@ void LLLayoutStack::updateFractionalSizes() { F32 total_resizable_dim = 0.f; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -553,7 +554,7 @@ void LLLayoutStack::updateFractionalSizes() } } - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -561,7 +562,7 @@ void LLLayoutStack::updateFractionalSizes() panelp->mFractionalSize = panel_resizable_dim > 0.f ? llclamp(panel_resizable_dim / total_resizable_dim, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE) : MIN_FRACTIONAL_SIZE; - llassert(!llisnan(panelp->mFractionalSize)); + llassert(!std::isnan(panelp->mFractionalSize)); } } @@ -574,7 +575,7 @@ void LLLayoutStack::normalizeFractionalSizes() S32 num_auto_resize_panels = 0; F32 total_fractional_size = 0.f; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -585,7 +586,7 @@ void LLLayoutStack::normalizeFractionalSizes() if (total_fractional_size == 0.f) { // equal distribution - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -595,7 +596,7 @@ void LLLayoutStack::normalizeFractionalSizes() } else { // renormalize - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -612,7 +613,7 @@ bool LLLayoutStack::animatePanels() // // animate visibility // - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->getVisible()) { @@ -710,7 +711,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& LLLayoutPanel* other_resize_panel = NULL; LLLayoutPanel* following_panel = NULL; - BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) + for(LLLayoutPanel* panelp : boost::adaptors::reverse(mPanels)) { if (panelp->mAutoResize) { @@ -759,7 +760,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& AFTER_RESIZED_PANEL } which_panel = BEFORE_RESIZED_PANEL; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (!panelp->getVisible() || panelp->mCollapsed) { @@ -789,7 +790,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& fraction_given_up -= new_fractional_size - panelp->mFractionalSize; fraction_remaining -= panelp->mFractionalSize; panelp->mFractionalSize = new_fractional_size; - llassert(!llisnan(panelp->mFractionalSize)); + llassert(!std::isnan(panelp->mFractionalSize)); } else { @@ -805,7 +806,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& fraction_given_up -= new_fractional_size - panelp->mFractionalSize; fraction_remaining -= panelp->mFractionalSize; panelp->mFractionalSize = new_fractional_size; - llassert(!llisnan(panelp->mFractionalSize)); + llassert(!std::isnan(panelp->mFractionalSize)); } else { // freeze new size as original size @@ -867,7 +868,7 @@ void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent) void LLLayoutStack::updateResizeBarLimits() { LLLayoutPanel* previous_visible_panelp = NULL; - BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels) + for(LLLayoutPanel* visible_panelp : boost::adaptors::reverse(mPanels)) { if (!visible_panelp->getVisible() || visible_panelp->mCollapsed) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index f6f267f57..81611090f 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -92,7 +92,6 @@ #include #include #include -#include #include // we want to minimize external dependencies, but this one is important @@ -307,7 +306,7 @@ public: // after someone responds to a notification (usually by clicking a button, // but sometimes by filling out a little form and THEN clicking a button), - // the result of the response (the name and value of the button clicked, + // the result of the response (the name and value of the button clicked, // plus any other data) should be packaged up as LLSD, then passed as a // parameter to the notification's respond() method here. This will look up // and call the appropriate responder. @@ -320,7 +319,7 @@ public: // ["payload"] = transaction specific data, such as ["source_id"] (originator of notification), // ["item_id"] (attached inventory item), etc. // ["substitutions"] = string substitutions used to generate notification message - // from the template + // from the template // ["time"] = time at which notification was generated; // ["expiry"] = time at which notification expires; // ["responseFunctor"] = name of registered functor that handles responses to notification; @@ -514,7 +513,7 @@ namespace LLNotificationComparators struct orderBy { typedef boost::function field_t; - orderBy(field_t field, EDirection direction = ORDER_INCREASING) : mField(field), mDirection(direction) {} + orderBy(field_t field, EDirection direction = ORDER_INCREASING) : mField(field), mDirection(direction) {} bool operator()(LLNotificationPtr lhs, LLNotificationPtr rhs) { if (mDirection == ORDER_DECREASING) @@ -632,18 +631,18 @@ class LLNotificationChannel : public: virtual ~LLNotificationChannel() {} typedef LLNotificationSet::iterator Iterator; - + std::string getName() const { return mName; } std::string getParentChannelName() { return mParent; } - - bool isEmpty() const; - - Iterator begin(); - Iterator end(); + + bool isEmpty() const; + + Iterator begin(); + Iterator end(); - // Channels have a comparator to control sort order; + // Channels have a comparator to control sort order; // the default sorts by arrival date - void setComparator(LLNotificationComparator comparator); + void setComparator(LLNotificationComparator comparator); std::string summarize(); @@ -654,7 +653,7 @@ public: LLNotificationComparator comparator=LLNotificationComparators::orderByUUID()); protected: - // Notification Channels have a filter, which determines which notifications + // Notification Channels have a filter, which determines which notifications // will be added to this channel. // Channel filters cannot change. // Channels have a protected constructor so you can't make smart pointers that don't diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h index 893d2269c..0715d1299 100644 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h @@ -32,7 +32,10 @@ #include "llnotificationptr.h" #include "aialert.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif class LLSD; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index fde1550ba..4d92cafd1 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1,11 +1,11 @@ -/** +/** * @file lltabcontainer.cpp * @brief LLTabContainer class * * $LicenseInfo:firstyear=2001&license=viewergpl$ - * + * * Copyright (c) 2001-2009, Linden Research, Inc. - * + * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 @@ -13,17 +13,17 @@ * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * + * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or * online at * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * + * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, * and agree to abide by those obligations. - * + * * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * COMPLETENESS OR PERFORMANCE. @@ -40,6 +40,7 @@ #include "llresmgr.h" #include "llresizehandle.h" #include "lltextbox.h" +#include "lltrans.h" #include "llcriticaldamp.h" #include "lluictrlfactory.h" #include "llrender.h" @@ -92,7 +93,7 @@ public: LLTabContainer::LLTabContainer(const std::string& name, const LLRect& rect, TabPosition pos, BOOL bordered, BOOL is_vertical ) - : + : LLPanel(name, rect, bordered), mCurrentTabIdx(-1), mTabsHidden(FALSE), @@ -114,7 +115,7 @@ LLTabContainer::LLTabContainer(const std::string& name, const LLRect& rect, TabP mJumpNextArrowBtn(NULL), mRightTabBtnOffset(0), mTotalTabWidth(0) -{ +{ //RN: HACK to support default min width for legacy vertical tab containers if (mIsVertical) { @@ -237,7 +238,7 @@ void LLTabContainer::draw() left = LLPANEL_BORDER_WIDTH + (has_scroll_arrows ? (TABCNTR_ARROW_BTN_SIZE * 2) : TABCNTR_TAB_H_PAD); left -= getScrollPosPixels(); } - + // Hide all the buttons if (getTabsHidden() || mIsVertical) { @@ -507,7 +508,7 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) BOOL LLTabContainer::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect ) { BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect ); - if (!handled && getTabCount() > 0 && !getTabsHidden()) + if (!handled && getTabCount() > 0 && !getTabsHidden()) { LLTabTuple* firsttuple = getTab(0); @@ -700,7 +701,7 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag mDragAndDropDelayTimer.stop(); } } - else + else { // Start a timer so we don't open tabs as soon as we hover on them mDragAndDropDelayTimer.start(); @@ -710,9 +711,9 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip); } -void LLTabContainer::addTabPanel(LLPanel* child, - const std::string& label, - BOOL select, +void LLTabContainer::addTabPanel(LLPanel* child, + const std::string& label, + BOOL select, S32 indent, BOOL placeholder, eInsertionPoint insertion_point) @@ -735,16 +736,16 @@ void LLTabContainer::addTabPanel(LLPanel* child, { button_width = llclamp(font->getWidth(trimmed_label) + TAB_PADDING, mMinTabWidth, mMaxTabWidth); } - + // Tab panel S32 tab_panel_top; S32 tab_panel_bottom; - if (!getTabsHidden()) + if (!getTabsHidden()) { if( getTabPosition() == LLTabContainer::TOP ) { S32 tab_height = mIsVertical ? BTN_HEIGHT : TABCNTR_TAB_HEIGHT; - tab_panel_top = getRect().getHeight() - getTopBorderHeight() - (tab_height - TABCNTR_BUTTON_PANEL_OVERLAP); + tab_panel_top = getRect().getHeight() - getTopBorderHeight() - (tab_height - TABCNTR_BUTTON_PANEL_OVERLAP); tab_panel_bottom = LLPANEL_BORDER_WIDTH; } else @@ -769,7 +770,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, } else { - tab_panel_rect = LLRect(LLPANEL_BORDER_WIDTH, + tab_panel_rect = LLRect(LLPANEL_BORDER_WIDTH, tab_panel_top, getRect().getWidth()-LLPANEL_BORDER_WIDTH, tab_panel_bottom ); @@ -811,12 +812,12 @@ void LLTabContainer::addTabPanel(LLPanel* child, LLTextBox* textbox = NULL; LLButton* btn = NULL; - + if (placeholder) { btn_rect.translate(0, -LLBUTTON_V_PAD-2); textbox = new LLTextBox(trimmed_label, btn_rect, trimmed_label, font); - + btn = new LLButton(LLStringUtil::null); } else @@ -826,8 +827,8 @@ void LLTabContainer::addTabPanel(LLPanel* child, btn = new LLButton(std::string("vert tab button"), btn_rect, LLStringUtil::null, - LLStringUtil::null, - LLStringUtil::null, + LLStringUtil::null, + LLStringUtil::null, NULL, font, trimmed_label, trimmed_label); @@ -843,18 +844,13 @@ void LLTabContainer::addTabPanel(LLPanel* child, } else { - std::string tooltip = trimmed_label; - tooltip += "\nAlt-Left arrow for previous tab"; - tooltip += "\nAlt-Right arrow for next tab"; - btn = new LLButton(std::string(child->getName()) + " tab", - btn_rect, + btn_rect, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, NULL, // set userdata below font, trimmed_label, trimmed_label ); btn->setVisible( FALSE ); - btn->setToolTip( tooltip ); btn->setScaleImage(TRUE); btn->setImages(tab_img, tab_selected_img); @@ -877,8 +873,20 @@ void LLTabContainer::addTabPanel(LLPanel* child, btn->setFollowsBottom(); } } + std::string tooltip = trimmed_label; + LLStringUtil::format_map_t args; + args["[ALT]"] = LLTrans::getString( +#ifdef LL_DARWIN + "accel-mac-option" +#else + "accel-win-alt" +#endif + ); + tooltip += '\n' + LLTrans::getString("tab_tooltip_prev", args); + tooltip += '\n' + LLTrans::getString("tab_tooltip_next", args); + btn->setToolTip( tooltip ); } - + LLTabTuple* tuple = new LLTabTuple( this, child, btn, textbox ); insertTuple( tuple, insertion_point ); @@ -906,7 +914,7 @@ void LLTabContainer::addTabPanel(LLPanel* child, sendChildToFront(mNextArrowBtn); sendChildToFront(mJumpPrevArrowBtn); sendChildToFront(mJumpNextArrowBtn); - + if( select ) { selectLastTab(); @@ -958,7 +966,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) } } } - + BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this); // If the tab being deleted is the selected one, select a different tab. @@ -972,7 +980,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) removeChild( tuple->mTabPanel ); // delete tuple->mTabPanel; - + mTabList.erase( iter ); delete tuple; @@ -1041,7 +1049,7 @@ void LLTabContainer::deleteAllTabs() // Actually delete the tuples themselves std::for_each(mTabList.begin(), mTabList.end(), DeletePointer()); mTabList.clear(); - + // And there isn't a current tab any more mCurrentTabIdx = -1; } @@ -1173,7 +1181,7 @@ void LLTabContainer::selectPrevTab() { mTabList[idx]->mButton->setFocus(TRUE); } -} +} BOOL LLTabContainer::selectTabPanel(LLPanel* child) { @@ -1205,7 +1213,7 @@ BOOL LLTabContainer::selectTab(S32 which) { return FALSE; } - + LLSD cbdata; if (selected_tuple->mTabPanel) cbdata = selected_tuple->mTabPanel->getName(); @@ -1219,7 +1227,7 @@ BOOL LLTabContainer::selectTab(S32 which) (*mCommitSignal)(this, cbdata); } } - + return res; } @@ -1247,7 +1255,7 @@ BOOL LLTabContainer::setTab(S32 which) tuple->mButton->setToggleState( is_selected ); // RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs tuple->mButton->setTabStop( is_selected ); - + if (is_selected) { // Make sure selected tab is within scroll region @@ -1391,7 +1399,7 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple) { const LLFontGL* fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); S32 image_overlay_width = 0; - image_overlay_width = tuple->mButton->getImageOverlay().notNull() ? + image_overlay_width = tuple->mButton->getImageOverlay().notNull() ? tuple->mButton->getImageOverlay()->getImage()->getWidth(0) : 0; // remove current width from total tab strip width mTotalTabWidth -= tuple->mButton->getRect().getWidth(); @@ -1401,7 +1409,7 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple) tuple->mPadding = image_overlay_width; tuple->mButton->setRightHPad(6); - tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), + tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tuple->mButton->getRect().getHeight()); // add back in button width to total tab strip width mTotalTabWidth += tuple->mButton->getRect().getWidth(); @@ -1412,7 +1420,7 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple) } void LLTabContainer::setTitle(const std::string& title) -{ +{ if (mTitleBox) { mTitleBox->setText( title ); @@ -1452,10 +1460,18 @@ void LLTabContainer::setPanelTitle(S32 index, const std::string& title) { LLTabTuple* tuple = getTab(index); LLButton* tab_button = tuple->mButton; - const LLFontGL* fontp = LLFontGL::getFontSansSerifSmall(); - mTotalTabWidth -= tab_button->getRect().getWidth(); - tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight()); - mTotalTabWidth += tab_button->getRect().getWidth(); + if (!mIsVertical) + { + const LLFontGL* fontp = LLFontGL::getFontSansSerifSmall(); + mTotalTabWidth -= tab_button->getRect().getWidth(); + tab_button->reshape(llclamp(fontp->getWidth(title) + + TAB_PADDING + + tuple->mPadding, + mMinTabWidth, + mMaxTabWidth), + tab_button->getRect().getHeight()); + mTotalTabWidth += tab_button->getRect().getWidth(); + } tab_button->setLabelSelected(title); tab_button->setLabelUnselected(title); } @@ -1556,7 +1572,7 @@ LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto node->getAttributeBOOL("border", border); LLTabContainer* tab_container = new LLTabContainer(name, LLRect::null, tab_position, border, is_vertical); - + S32 tab_min_width = tab_container->mMinTabWidth; if (node->hasAttribute("tab_width")) { @@ -1573,9 +1589,9 @@ LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto node->getAttributeS32("tab_max_width", tab_max_width); } - tab_container->setMinTabWidth(tab_min_width); - tab_container->setMaxTabWidth(tab_max_width); - + tab_container->setMinTabWidth(tab_min_width); + tab_container->setMaxTabWidth(tab_max_width); + BOOL hidden(tab_container->getTabsHidden()); node->getAttributeBOOL("hide_tabs", hidden); tab_container->setTabsHidden(hidden); @@ -1614,7 +1630,7 @@ LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto tab_container->postBuild(); tab_container->initButtons(); // now that we have the correct rect - + return tab_container; } @@ -1627,7 +1643,7 @@ void LLTabContainer::initButtons() { return; // Don't have a rect yet or already got called } - + std::string out_id; std::string in_id; @@ -1650,7 +1666,7 @@ void LLTabContainer::initButtons() mPrevArrowBtn->setFollowsTop(); mPrevArrowBtn->setFollowsLeft(); mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2)); - + out_id = "UIImgBtnScrollDownOutUUID"; in_id = "UIImgBtnScrollDownInUUID"; mNextArrowBtn = new LLButton(std::string("Down Arrow"), down_arrow_btn_rect, @@ -1661,7 +1677,7 @@ void LLTabContainer::initButtons() } else // Horizontal { - S32 arrow_fudge = 1; // match new art better + S32 arrow_fudge = 1; // match new art better // tabs on bottom reserve room for resize handle (just in case) if (getTabPosition() == BOTTOM) @@ -1705,7 +1721,7 @@ void LLTabContainer::initButtons() boost::bind(&LLTabContainer::onPrevBtn, this, _2), LLFontGL::getFontSansSerif() ); mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2)); mPrevArrowBtn->setFollowsLeft(); - + out_id = "UIImgBtnJumpRightOutUUID"; in_id = "UIImgBtnJumpRightInUUID"; mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect, @@ -1740,7 +1756,7 @@ void LLTabContainer::initButtons() mPrevArrowBtn->setSaveToXML(false); mPrevArrowBtn->setTabStop(FALSE); addChild(mPrevArrowBtn); - + mNextArrowBtn->setSaveToXML(false); mNextArrowBtn->setTabStop(FALSE); addChild(mNextArrowBtn); @@ -1758,7 +1774,7 @@ void LLTabContainer::initButtons() mJumpNextArrowBtn->setTabStop(FALSE); addChild(mJumpNextArrowBtn); } - + // set default tab group to be panel contents setDefaultTabGroup(1); } diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 7cf54e95d..2389ee34c 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -33,7 +33,6 @@ #include "llcoord.h" #include "v2math.h" #include "llinitparam.h" -#include "llregistry.h" #include "llrender2dutils.h" #include "llpointer.h" #include "lluicolor.h" @@ -206,7 +205,7 @@ public: { } - virtual ~LLUIFactory() + virtual ~LLUIFactory() { } diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 0dc2be1db..0ccf74868 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -406,7 +406,7 @@ BOOL LLUICtrl::isCtrl() const //virtual void LLUICtrl::setValue(const LLSD& value) { - mViewModel->setValue(value); + mViewModel->setValue(value); } //virtual @@ -419,10 +419,10 @@ LLSD LLUICtrl::getValue() const /// change), share their ViewModel. void LLUICtrl::shareViewModelFrom(const LLUICtrl& other) { - // Because mViewModel is an LLViewModelPtr, this assignment will quietly - // dispose of the previous LLViewModel -- unless it's already shared by - // somebody else. - mViewModel = other.mViewModel; + // Because mViewModel is an LLViewModelPtr, this assignment will quietly + // dispose of the previous LLViewModel -- unless it's already shared by + // somebody else. + mViewModel = other.mViewModel; } //virtual @@ -635,7 +635,7 @@ BOOL LLUICtrl::isDirty() const //virtual void LLUICtrl::resetDirty() { - mViewModel->resetDirty(); + mViewModel->resetDirty(); } // virtual diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 5ae818d87..ca0e11d16 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -36,7 +36,12 @@ #include "llrect.h" #include "llsd.h" +#include "llregistry.h" + +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include "llinitparam.h" @@ -128,7 +133,7 @@ public: void initFromParams(const Params& p); static const Params& getDefaultParams(); LLUICtrl(const Params& p = getDefaultParams(), - const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel)); + const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel)); // Singu Note: This constructor is deprecated: LLUICtrl( const std::string& name, const LLRect rect = LLRect(), BOOL mouse_opaque = TRUE, commit_callback_t commit_callback = NULL, @@ -139,8 +144,8 @@ public: // We need this virtual so we can override it with derived versions virtual LLViewModel* getViewModel() const; - // We shouldn't ever need to set this directly - //virtual void setViewModel(const LLViewModelPtr&); + // We shouldn't ever need to set this directly + //virtual void setViewModel(const LLViewModelPtr&); virtual BOOL postBuild(); @@ -179,9 +184,9 @@ public: virtual BOOL getTentative() const; virtual void setValue(const LLSD& value); virtual LLSD getValue() const; - /// When two widgets are displaying the same data (e.g. during a skin - /// change), share their ViewModel. - virtual void shareViewModelFrom(const LLUICtrl& other); + /// When two widgets are displaying the same data (e.g. during a skin + /// change), share their ViewModel. + virtual void shareViewModelFrom(const LLUICtrl& other); virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); virtual void setIsChrome(BOOL is_chrome); @@ -259,12 +264,12 @@ public: }; template class CallbackRegistry : public LLRegistrySingleton - {}; + {}; class CommitCallbackRegistry : public CallbackRegistry{}; // the enable callback registry is also used for visiblity callbacks class EnableCallbackRegistry : public CallbackRegistry{}; - + protected: static bool controlListener(const LLSD& newvalue, LLHandle handle, std::string type); @@ -282,7 +287,7 @@ protected: mouse_signal_t* mDoubleClickSignal; - LLViewModelPtr mViewModel; + LLViewModelPtr mViewModel; LLControlVariable* mEnabledControlVariable; boost::signals2::connection mEnabledControlConnection; diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index c34960b82..0747829b7 100644 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -29,7 +29,10 @@ #define LL_LLURLACTION_H #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif /// /// The LLUrlAction class provides a number of static functions that diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d7a11ad00..1254c8265 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -38,7 +38,6 @@ #include #include -#include #include "llrender.h" #include "llevent.h" @@ -372,7 +371,7 @@ void LLView::removeChild(LLView* child) // if we are removing an item we are currently iterating over, that would be bad llassert(child->mInDraw == false); mChildList.remove( child ); - for(boost::unordered_map::iterator it=mChildHashMap.begin(); it != mChildHashMap.end(); ++it) + for(boost::container::flat_map::iterator it=mChildHashMap.begin(); it != mChildHashMap.end(); ++it) { if(it->second == child) { @@ -400,7 +399,7 @@ void LLView::removeChild(LLView* child) LLView::ctrl_list_t LLView::getCtrlList() const { ctrl_list_t controls; - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if(viewp->isCtrl()) { @@ -613,12 +612,12 @@ void LLView::deleteAllChildren() LLView* viewp = mChildList.front(); delete viewp; // will remove the child from mChildList } - mChildHashMap.clear(); + mChildHashMap.clear(); // } void LLView::setAllChildrenEnabled(BOOL b) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { viewp->setEnabled(b); } @@ -644,7 +643,7 @@ void LLView::setVisible(BOOL visible) // virtual void LLView::handleVisibilityChange ( BOOL new_visibility ) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { // only views that are themselves visible will have their overall visibility affected by their ancestors if (viewp->getVisible()) @@ -722,7 +721,7 @@ BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_s std::string tool_tip; - BOOST_FOREACH(LLView* viewp, mChildList) + for(LLView* viewp : mChildList) { S32 local_x = x - viewp->mRect.mLeft; S32 local_y = y - viewp->mRect.mBottom; @@ -804,7 +803,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m { if ( getVisible() && getEnabled() ) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if ((viewp->*method)(c, mask, TRUE)) { @@ -823,7 +822,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m template LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -853,7 +852,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, // default to not accepting drag and drop, will be overridden by handler *accept = ACCEPT_NO; - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -879,7 +878,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -904,9 +903,9 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) LLView* LLView::childFromPoint(S32 x, S32 y, bool recur) { if (!getVisible()) - return NULL; + return NULL; // - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -930,7 +929,7 @@ LLView* LLView::childFromPoint(S32 x, S32 y, bool recur) return viewp; } - return 0; + return NULL; // } BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) @@ -947,8 +946,10 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) if (!handled) { + // For event logging we don't care which widget handles it + // So we capture the key at the end of this function once we know if it was handled handled = handleKeyHere( key, mask ); - if (handled && LLView::sDebugKeys) + if (handled && LLView::sDebugKeys) // - AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH { LL_INFOS() << "Key handled by " << getName() << LL_ENDL; } @@ -963,6 +964,38 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) return handled; } +BOOL LLView::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +{ + BOOL handled = FALSE; + + if (getVisible() && getEnabled()) + { + if (called_from_parent) + { + // Downward traversal + handled = childrenHandleKeyUp(key, mask) != NULL; + } + + if (!handled) + { + // For event logging we don't care which widget handles it + // So we capture the key at the end of this function once we know if it was handled + handled = handleKeyUpHere(key, mask); + if (handled) + { + LL_DEBUGS() << "Key handled by " << getName() << LL_ENDL; + } + } + } + + if (!handled && !called_from_parent && mParentView) + { + // Upward traversal + handled = mParentView->handleKeyUp(key, mask, FALSE); + } + return handled; +} + // Called from handleKey() // Handles key in this object. Checking parents and children happens in handleKey() BOOL LLView::handleKeyHere(KEY key, MASK mask) @@ -970,6 +1003,13 @@ BOOL LLView::handleKeyHere(KEY key, MASK mask) return FALSE; } +// Called from handleKey() +// Handles key in this object. Checking parents and children happens in handleKey() +BOOL LLView::handleKeyUpHere(KEY key, MASK mask) +{ + return FALSE; +} + BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) { BOOL handled = FALSE; @@ -1095,6 +1135,12 @@ LLView* LLView::childrenHandleKey(KEY key, MASK mask) return childrenHandleCharEvent("Key", &LLView::handleKey, key, mask); } +// Called during downward traversal +LLView* LLView::childrenHandleKeyUp(KEY key, MASK mask) +{ + return childrenHandleCharEvent("Key Up", &LLView::handleKeyUp, key, mask); +} + // Called during downward traversal LLView* LLView::childrenHandleUnicodeChar(llwchar uni_char) { @@ -1137,7 +1183,7 @@ LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) LLView* handled_view = NULL; if( getVisible() && getEnabled() ) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -1332,8 +1378,10 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) mRect.mTop = getRect().mBottom + height; // move child views according to reshape flags - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { + if (viewp != NULL) + { LLRect child_rect( viewp->mRect ); if (viewp->followsRight() && viewp->followsLeft()) @@ -1383,6 +1431,7 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) } } } + } if (!called_from_parent) { @@ -1399,7 +1448,7 @@ LLRect LLView::calcBoundingRect() { LLRect local_bounding_rect = LLRect::null; - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { // ignore invisible and "top" children when calculating bounding rect // such as combobox popups @@ -1561,7 +1610,7 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_ //if(name.empty()) // return NULL; // Look for direct children *first* - /*BOOST_FOREACH(LLView* childp, mChildList) + /*for (LLView* childp : mChildList) { llassert(childp); if (childp->getName() == name) @@ -1569,7 +1618,7 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_ return childp; } }*/ - boost::unordered_map::const_iterator it = mChildHashMap.find(name); + boost::container::flat_map::const_iterator it = mChildHashMap.find(name); if(it != mChildHashMap.end()) { return it->second; @@ -1577,7 +1626,7 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_ if (recurse) { // Look inside each child as well. - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { llassert(childp); LLView* viewp = childp->getChildView(name, recurse, FALSE); @@ -3013,7 +3062,7 @@ S32 LLView::notifyParent(const LLSD& info) bool LLView::notifyChildren(const LLSD& info) { bool ret = false; - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { ret = ret || childp->notifyChildren(info); } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 89d2fc33c..3fd5d44b3 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -57,7 +57,7 @@ #include "llinitparam.h" #include "lltreeiterators.h" #include "llfocusmgr.h" -#include +#include // #include "ailist.h" const U32 FOLLOWS_NONE = 0x00; @@ -452,6 +452,7 @@ public: // inherited from LLFocusableElement /* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + /* virtual */ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); /* virtual */ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, @@ -517,7 +518,7 @@ public: const child_list_t* getChildList() const { return &mChildList; } child_list_const_iter_t beginChild() const { return mChildList.begin(); } child_list_const_iter_t endChild() const { return mChildList.end(); } - boost::unordered_map mChildHashMap; + boost::container::flat_map mChildHashMap; // // LLMouseHandler functions // Default behavior is to pass events to children @@ -657,6 +658,7 @@ public: virtual void handleReshape(const LLRect& rect, bool by_user); virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual BOOL handleKeyUpHere(KEY key, MASK mask); virtual BOOL handleUnicodeCharHere(llwchar uni_char); @@ -681,6 +683,7 @@ protected: void logMouseEvent(); LLView* childrenHandleKey(KEY key, MASK mask); + LLView* childrenHandleKeyUp(KEY key, MASK mask); LLView* childrenHandleUnicodeChar(llwchar uni_char); LLView* childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 9cf5bb03e..5330d5f18 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -1353,9 +1353,9 @@ struct ScopedFile { if (!isOpen()) return 0; - S32 cur_pos = ftell(mFile); + size_t cur_pos = ftell(mFile); fseek(mFile, 0L, SEEK_END); - S32 file_size = ftell(mFile); + size_t file_size = ftell(mFile); fseek(mFile, cur_pos, SEEK_SET); return file_size - cur_pos; } diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h index ad2a39cab..6ada48d05 100644 --- a/indra/llui/llxuiparser.h +++ b/indra/llui/llxuiparser.h @@ -31,7 +31,10 @@ #include "llregistry.h" #include "llxmlnode.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include #include diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt index ca491529b..326f6671c 100644 --- a/indra/llvfs/CMakeLists.txt +++ b/indra/llvfs/CMakeLists.txt @@ -60,7 +60,6 @@ set_source_files_properties(${llvfs_HEADER_FILES} list(APPEND llvfs_SOURCE_FILES ${llvfs_HEADER_FILES}) add_library (llvfs ${llvfs_SOURCE_FILES}) -add_dependencies(llvfs prepare) target_link_libraries(llvfs ${Boost_FILESYSTEM_LIBRARY} diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index def50c85b..69a89abf8 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -878,7 +878,7 @@ LLDir::SepOff LLDir::needSep(const std::string& path, const std::string& name) c { // But if BOTH path and name bring a separator, we need not add one. // Moreover, we should actually skip the leading separator of 'name'. - return SepOff(false, seplen); + return SepOff(false, static_cast(seplen)); } // Here we know that either path_ends_sep or name_starts_sep is true -- // but not both. So don't add a separator, and don't skip any characters: diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 34c4a8d53..2a9396526 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -11,7 +11,6 @@ project(llwindow) include(00-Common) -include(DirectX) include(LLCommon) include(LLImage) include(LLMath) @@ -144,11 +143,9 @@ if (llwindow_HEADER_FILES) endif (llwindow_HEADER_FILES) list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES}) -add_library (llwindow + add_library (llwindow ${llwindow_SOURCE_FILES} ${viewer_SOURCE_FILES} ) -add_dependencies(llwindow prepare) + target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) - - diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index 40d0a2212..e0ec7c565 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -183,11 +183,11 @@ HRESULT GetVideoMemoryViaWMI( WCHAR* strInputDeviceID, DWORD* pdwAdapterRam ) SAFE_RELEASE( pVideoControllers[iController] ); } } - SAFE_RELEASE(pEnumVideoControllers); } if( pClassName ) SysFreeString( pClassName ); + SAFE_RELEASE( pEnumVideoControllers ); } if( pNamespace ) @@ -206,7 +206,7 @@ HRESULT GetVideoMemoryViaWMI( WCHAR* strInputDeviceID, DWORD* pdwAdapterRam ) return E_FAIL; } -void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPropValue, int outputSize) +void get_wstring(IDxDiagContainer* containerp, const WCHAR* wszPropName, WCHAR* wszPropValue, int outputSize) { HRESULT hr; VARIANT var; @@ -219,10 +219,10 @@ void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPro switch( var.vt ) { case VT_UI4: - swprintf( wszPropValue, L"%d", var.ulVal ); /* Flawfinder: ignore */ + swprintf(wszPropValue, outputSize, L"%d", var.ulVal); /* Flawfinder: ignore */ break; case VT_I4: - swprintf( wszPropValue, L"%d", var.lVal ); /* Flawfinder: ignore */ + swprintf(wszPropValue, outputSize, L"%d", var.lVal); /* Flawfinder: ignore */ break; case VT_BOOL: wcscpy( wszPropValue, (var.boolVal) ? L"true" : L"false" ); /* Flawfinder: ignore */ @@ -237,7 +237,7 @@ void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPro VariantClear( &var ); } -std::string get_string(IDxDiagContainer *containerp, WCHAR *wszPropName) +std::string get_string(IDxDiagContainer *containerp, const WCHAR *wszPropName) { WCHAR wszPropValue[256]; get_wstring(containerp, wszPropName, wszPropValue, 256); @@ -452,9 +452,9 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) hr = CoInitialize(NULL); if (FAILED(hr)) { - LL_WARNS("AppInit") << "COM library initialization failed!" << LL_ENDL; - gWriteDebug("COM library initialization failed!\n"); - return FALSE; + LL_WARNS() << "COM initialization failure!" << LL_ENDL; + gWriteDebug("COM initialization failure!\n"); + return ok; } IDxDiagProvider *dx_diag_providerp = NULL; @@ -507,8 +507,6 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) goto LCleanup; } - HRESULT hr; - // Get display driver information LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer" << LL_ENDL; hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp); @@ -718,8 +716,8 @@ LLSD LLDXHardware::getDisplayInfo() hr = CoInitialize(NULL); if (FAILED(hr)) { - LL_WARNS("AppInit") << "COM library initialization failed!" << LL_ENDL; - gWriteDebug("COM library initialization failed!\n"); + LL_WARNS() << "COM initialization failure!" << LL_ENDL; + gWriteDebug("COM initialization failure!\n"); return ret; } @@ -772,8 +770,6 @@ LLSD LLDXHardware::getDisplayInfo() goto LCleanup; } - HRESULT hr; - // Get display driver information LL_INFOS() << "dx_diag_rootp->GetChildContainer" << LL_ENDL; hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp); diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index ddb275761..a52e7b522 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -28,7 +28,10 @@ #define LL_LLKEYBOARD_H #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include "llstringtable.h" #include "lltimer.h" diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index 2740fce59..a06d5ec1d 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -261,7 +261,7 @@ void LLKeyboardWin32::scanKeyboard() // *TODO: I KNOW there must be a better way of // interrogating the key state than this, using async key // state can cause ALL kinds of bugs - Doug - if (key < KEY_BUTTON0) + if ((key < KEY_BUTTON0) && ((key < '0') || (key > '9'))) { // ...under windows make sure the key actually still is down. // ...translate back to windows key diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 36bcd266b..2ca113f55 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -45,7 +45,10 @@ #if LL_GTK extern "C" { -# include "gtk/gtk.h" +# include +#if GTK_CHECK_VERSION(2, 24, 0) +#include +#endif } #include #endif // LL_GTK @@ -86,23 +89,6 @@ static bool ATIbug = false; // be only one object of this class at any time. Currently this is true. static LLWindowSDL *gWindowImplementation = NULL; - -void maybe_lock_display(void) -{ - if (gWindowImplementation && gWindowImplementation->Lock_Display) { - gWindowImplementation->Lock_Display(); - } -} - - -void maybe_unlock_display(void) -{ - if (gWindowImplementation && gWindowImplementation->Unlock_Display) { - gWindowImplementation->Unlock_Display(); - } -} - - #if LL_GTK // Lazily initialize and check the runtime GTK version for goodness. // static @@ -116,9 +102,7 @@ bool LLWindowSDL::ll_try_gtk_init(void) if (!done_setlocale) { LL_INFOS() << "Starting GTK Initialization." << LL_ENDL; - maybe_lock_display(); gtk_disable_setlocale(); - maybe_unlock_display(); done_setlocale = TRUE; } @@ -128,9 +112,7 @@ bool LLWindowSDL::ll_try_gtk_init(void) #if !GLIB_CHECK_VERSION(2, 32, 0) if (!g_thread_supported ()) g_thread_init (NULL); #endif - maybe_lock_display(); gtk_is_good = gtk_init_check(NULL, NULL); - maybe_unlock_display(); if (!gtk_is_good) LL_WARNS() << "GTK Initialization failed." << LL_ENDL; } @@ -146,12 +128,10 @@ bool LLWindowSDL::ll_try_gtk_init(void) << gtk_major_version << "." << gtk_minor_version << "." << gtk_micro_version << LL_ENDL; - maybe_lock_display(); const gchar* gtk_warning = gtk_check_version( GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); - maybe_unlock_display(); if (gtk_warning) { LL_WARNS() << "- GTK COMPATIBILITY WARNING: " << @@ -197,14 +177,14 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, const S32 vsync_mode, BOOL ignore_pixel_depth, U32 fsaa_samples) : LLWindow(callbacks, fullscreen, flags), - Lock_Display(NULL), - Unlock_Display(NULL), mGamma(1.0f) + mGamma(1.0f) { // Initialize the keyboard gKeyboard = new LLKeyboardSDL(); gKeyboard->setCallbacks(callbacks); // Note that we can't set up key-repeat until after SDL has init'd video + // Ignore use_gl for now, only used for drones on PC mWindow = NULL; mNeedsResize = FALSE; mOverrideAspectRatio = 0.f; @@ -230,7 +210,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, mOriginalAspectRatio = 1024.0 / 768.0; if (title.empty()) - mWindowTitle = "SDL Window"; // *FIX: (???) + mWindowTitle = "SDL Window"; // *FIX: (?) else mWindowTitle = title; @@ -315,7 +295,7 @@ static int x11_detect_VRAM_kb() #if LL_SOLARIS && defined(__sparc) // NOTE: there's no Xorg server on SPARC so just return 0 // and allow SDL to attempt to get the amount of VRAM - return(0); + return 0; #else std::string x_log_location("/var/log/"); @@ -423,7 +403,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // Set the application icon. SDL_Surface *bmpsurface; - bmpsurface = Load_BMP_Resource("singularity_icon.BMP"); + bmpsurface = Load_BMP_Resource("viewer_icon.BMP"); if (bmpsurface) { // This attempts to give a black-keyed mask to the icon. @@ -594,7 +574,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B mWindow = SDL_SetVideoMode(width, height, bits, sdlflags); } - if (!mWindow) { LL_WARNS() << "createContext: window creation failure. SDL: " << SDL_GetError() << LL_ENDL; @@ -607,13 +586,14 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B } // Detect video memory size. -# if LL_X11 +#if LL_X11 gGLManager.mVRAM = x11_detect_VRAM_kb() / 1024; if (gGLManager.mVRAM != 0) { LL_INFOS() << "X11 log-parser detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL; - } else -# endif // LL_X11 + } + else +#endif // LL_X11 { // fallback to letting SDL detect VRAM. // note: I've not seen SDL's detection ever actually find @@ -677,23 +657,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B return FALSE; } -#if 0 // *FIX: we're going to brave it for now... - if (alphaBits < 8) - { - close(); - setupFailure( - "Second Life is unable to run because it can't get an 8 bit alpha\n" - "channel. Usually this is due to video card driver issues.\n" - "Please make sure you have the latest video card drivers installed.\n" - "Also be sure your monitor is set to True Color (32-bit) in\n" - "Control Panels -> Display -> Settings.\n" - "If you continue to receive this message, contact customer service.", - "Error", - OSMB_OK); - return FALSE; - } -#endif - #if LL_X11 /* Grab the window manager specific information */ SDL_SysWMinfo info; @@ -705,8 +668,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { mSDL_Display = info.info.x11.display; mSDL_XWindowID = info.info.x11.wmwindow; - Lock_Display = info.info.x11.lock_func; - Unlock_Display = info.info.x11.unlock_func; } else { @@ -804,8 +765,6 @@ void LLWindowSDL::destroyContext() #if LL_X11 mSDL_Display = NULL; mSDL_XWindowID = None; - Lock_Display = NULL; - Unlock_Display = NULL; #endif // LL_X11 // Clean up remaining GL state before blowing away window @@ -960,7 +919,7 @@ BOOL LLWindowSDL::setPosition(const LLCoordScreen position) { if(mWindow) { - // *FIX: (???) + // *FIX: (?) //MacMoveWindow(mWindow, position.mX, position.mY, false); } @@ -1206,9 +1165,7 @@ void LLWindowSDL::beforeDialog() { // Everything that we/SDL asked for should happen before we // potentially hand control over to GTK. - maybe_lock_display(); XSync(mSDL_Display, False); - maybe_unlock_display(); } #endif // LL_X11 @@ -1217,8 +1174,6 @@ void LLWindowSDL::beforeDialog() // diagnostics, if not already done. ll_try_gtk_init(); #endif // LL_GTK - - maybe_lock_display(); } void LLWindowSDL::afterDialog() @@ -1230,8 +1185,6 @@ void LLWindowSDL::afterDialog() LL_INFOS() << "LLWindowSDL::afterDialog()" << LL_ENDL; - maybe_unlock_display(); - if (mFullscreen) { // need to restore fullscreen mode after dialog - only works @@ -1254,7 +1207,6 @@ void LLWindowSDL::x11_set_urgent(BOOL urgent) LL_INFOS() << "X11 hint for urgency, " << urgent << LL_ENDL; - maybe_lock_display(); wm_hints = XGetWMHints(mSDL_Display, mSDL_XWindowID); if (!wm_hints) wm_hints = XAllocWMHints(); @@ -1267,7 +1219,6 @@ void LLWindowSDL::x11_set_urgent(BOOL urgent) XSetWMHints(mSDL_Display, mSDL_XWindowID, wm_hints); XFree(wm_hints); XSync(mSDL_Display, False); - maybe_unlock_display(); } } #endif // LL_X11 @@ -1567,12 +1518,10 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) { //LL_INFOS() << "X11 POINTER GRABBY" << LL_ENDL; //newmode = SDL_WM_GrabInput(wantmode); - maybe_lock_display(); result = XGrabPointer(mSDL_Display, mSDL_XWindowID, True, 0, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); - maybe_unlock_display(); if (GrabSuccess == result) newmode = SDL_GRAB_ON; else @@ -1583,11 +1532,9 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) newmode = SDL_GRAB_OFF; //newmode = SDL_WM_GrabInput(SDL_GRAB_OFF); - maybe_lock_display(); XUngrabPointer(mSDL_Display, CurrentTime); // Make sure the ungrab happens RIGHT NOW. XSync(mSDL_Display, False); - maybe_unlock_display(); } else { newmode = SDL_GRAB_QUERY; // neutral @@ -1784,6 +1731,7 @@ void LLWindowSDL::gatherInput() mKeyScanCode = event.key.keysym.scancode; mKeyVirtualKey = event.key.keysym.unicode; mKeyModifiers = event.key.keysym.mod; + mKeySym = event.key.keysym.sym; gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod); // part of the fix for SL-13243 @@ -1801,6 +1749,7 @@ void LLWindowSDL::gatherInput() mKeyScanCode = event.key.keysym.scancode; mKeyVirtualKey = event.key.keysym.unicode; mKeyModifiers = event.key.keysym.mod; + mKeySym = event.key.keysym.sym; if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0) SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243 @@ -2312,8 +2261,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ { gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin GdkWindow *gdkwin = gdk_window_foreign_new(gWindowImplementation->mSDL_XWindowID); - gdk_window_set_transient_for(GTK_WIDGET(win)->window, - gdkwin); + gdk_window_set_transient_for(GTK_WIDGET(win)->window, gdkwin); } # endif //LL_X11 @@ -2402,6 +2350,7 @@ LLSD LLWindowSDL::getNativeKeyData() result["scan_code"] = (S32)mKeyScanCode; result["virtual_key"] = (S32)mKeyVirtualKey; result["modifiers"] = (S32)modifiers; + result[ "sdl_sym" ] = (S32)mKeySym; return result; } @@ -2427,8 +2376,7 @@ BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) { gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin GdkWindow *gdkwin = gdk_window_foreign_new(mSDL_XWindowID); - gdk_window_set_transient_for(GTK_WIDGET(win)->window, - gdkwin); + gdk_window_set_transient_for(GTK_WIDGET(win)->window, gdkwin); } # endif //LL_X11 @@ -2551,10 +2499,8 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) # if LL_X11 if (mSDL_Display) { - maybe_lock_display(); // Just in case - before forking. XSync(mSDL_Display, False); - maybe_unlock_display(); } # endif // LL_X11 @@ -2571,19 +2517,12 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) LL_INFOS() << "spawn_web_browser returning." << LL_ENDL; } -void LLWindowSDL::setTitle(const std::string &title) -{ - mWindowTitle = title; - SDL_WM_SetCaption(mWindowTitle.c_str(),mWindowTitle.c_str()); -} void *LLWindowSDL::getPlatformWindow() { #if LL_GTK && LL_LLMOZLIB_ENABLED if (LLWindowSDL::ll_try_gtk_init()) { - maybe_lock_display(); - GtkWidget *owin = gtk_window_new(GTK_WINDOW_POPUP); // Why a layout widget? A MozContainer would be ideal, but // it involves exposing Mozilla headers to mozlib-using apps. @@ -2595,8 +2534,6 @@ void *LLWindowSDL::getPlatformWindow() gtk_widget_realize(rtnw); GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(rtnw), GTK_NO_WINDOW); - maybe_unlock_display(); - return rtnw; } #endif // LL_GTK && LL_LLMOZLIB_ENABLED @@ -2612,10 +2549,8 @@ void LLWindowSDL::bringToFront() #if LL_X11 if (mSDL_Display && !mFullscreen) { - maybe_lock_display(); XRaiseWindow(mSDL_Display, mSDL_XWindowID); XSync(mSDL_Display, False); - maybe_unlock_display(); } #endif // LL_X11 } @@ -2626,7 +2561,7 @@ std::vector LLWindowSDL::getDynamicFallbackFontList() // Use libfontconfig to find us a nice ordered list of fallback fonts // specific to this system. std::string final_fallback("/usr/share/fonts/truetype/kochi/kochi-gothic.ttf"); - const int max_font_count_cutoff = 100; // fonts are expensive in the current system, don't enumerate an arbitrary number of them + const int max_font_count_cutoff = 40; // fonts are expensive in the current system, don't enumerate an arbitrary number of them // Our 'ideal' font properties which define the sorting results. // slant=0 means Roman, index=0 means the first face in a font file // (the one we actually use), weight=80 means medium weight, @@ -2721,4 +2656,10 @@ std::vector LLWindowSDL::getDynamicFallbackFontList() return rtns; } +void LLWindowSDL::setTitle(const std::string& title) +{ + mWindowTitle = title; + SDL_WM_SetCaption(mWindowTitle.c_str(),mWindowTitle.c_str()); +} + #endif // LL_SDL diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 3334fcb98..a180be319 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -135,8 +135,6 @@ public: Window mSDL_XWindowID; Display *mSDL_Display; #endif - void (*Lock_Display)(void); - void (*Unlock_Display)(void); #if LL_GTK // Lazily initialize and check the runtime GTK version for goodness. @@ -216,6 +214,7 @@ private: U32 mKeyScanCode; U32 mKeyVirtualKey; SDLMod mKeyModifiers; + U32 mKeySym; }; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index fab15ea71..6c505028c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -42,6 +42,7 @@ #include "llgl.h" #include "llstring.h" #include "lldir.h" +#include "llsdutil.h" #include "llglslshader.h" // System includes @@ -2105,6 +2106,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mKeyCharCode = 0; // don't know until wm_char comes in next window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff; window_imp->mKeyVirtualKey = w_param; + window_imp->mRawMsg = u_msg; + window_imp->mRawWParam = w_param; + window_imp->mRawLParam = l_param; window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYDOWN"); { @@ -2127,6 +2131,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff; window_imp->mKeyVirtualKey = w_param; + window_imp->mRawMsg = u_msg; + window_imp->mRawWParam = w_param; + window_imp->mRawLParam = l_param; window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP"); LLFastTimer t2(FTM_KEYHANDLER); @@ -2214,6 +2221,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_CHAR: window_imp->mKeyCharCode = w_param; + window_imp->mRawMsg = u_msg; + window_imp->mRawWParam = w_param; + window_imp->mRawLParam = l_param; // Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need // to figure out how that works. - Doug @@ -3310,6 +3320,9 @@ LLSD LLWindowWin32::getNativeKeyData() result["scan_code"] = (S32)mKeyScanCode; result["virtual_key"] = (S32)mKeyVirtualKey; + result["msg"] = ll_sd_from_U32(mRawMsg); + result["w_param"] = ll_sd_from_U32(mRawWParam); + result["l_param"] = ll_sd_from_U32(mRawLParam); return result; } diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 9ef2b206e..3412dcd9a 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -132,7 +132,7 @@ protected: HCURSOR loadColorCursor(LPCTSTR name); BOOL isValid(); void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); - LLSD getNativeKeyData(); + virtual LLSD getNativeKeyData(); // Changes display resolution. Returns true if successful BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); @@ -215,6 +215,9 @@ protected: U32 mKeyCharCode; U32 mKeyScanCode; U32 mKeyVirtualKey; + U32 mRawMsg; + U32 mRawWParam; + U32 mRawLParam; friend class LLWindowManager; }; diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt index be0a510b4..d65bf3146 100644 --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories( ) set(llxml_SOURCE_FILES - aixml.cpp + #aixml.cpp llcontrol.cpp llxmlnode.cpp llxmlparser.cpp @@ -23,7 +23,7 @@ set(llxml_SOURCE_FILES set(llxml_HEADER_FILES CMakeLists.txt - aixml.h + #aixml.h llcontrol.h llcontrolgroupreader.h llxmlnode.h @@ -37,7 +37,7 @@ set_source_files_properties(${llxml_HEADER_FILES} list(APPEND llxml_SOURCE_FILES ${llxml_HEADER_FILES}) add_library (llxml ${llxml_SOURCE_FILES}) -add_dependencies(llxml prepare) + target_link_libraries( llxml ${EXPAT_LIBRARIES} diff --git a/indra/llxml/aixml.cpp b/indra/llxml/aixml.cpp index d7592c431..dffe3d73a 100644 --- a/indra/llxml/aixml.cpp +++ b/indra/llxml/aixml.cpp @@ -263,7 +263,7 @@ void AIXMLElement::close_child(void) mIndentation -= 2; } -AIXMLElement::~AIXMLElement() +AIXMLElement::~AIXMLElement() noexcept(false) { if (mHasChildren) { diff --git a/indra/llxml/aixml.h b/indra/llxml/aixml.h index 9bfb783f4..3ff971101 100644 --- a/indra/llxml/aixml.h +++ b/indra/llxml/aixml.h @@ -64,7 +64,7 @@ class AIXMLElement public: AIXMLElement(std::ostream& os, char const* name, int indentation); - ~AIXMLElement(); + ~AIXMLElement() noexcept(false); template void attribute(char const* name, T const& attribute); diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index bdfd161cd..1b8b5a42e 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -43,8 +43,6 @@ #include "lluuid.h" //#include "lldir.h" // Do not need. -const S32 MAX_COLUMN_WIDTH = 80; - // static BOOL LLXMLNode::sStripEscapedStrings = TRUE; BOOL LLXMLNode::sStripWhitespaceValues = FALSE; @@ -147,13 +145,15 @@ LLXMLNodePtr LLXMLNode::deepCopy() for (LLXMLChildList::iterator iter = mChildren->map.begin(); iter != mChildren->map.end(); ++iter) { - newnode->addChild(iter->second->deepCopy()); + LLXMLNodePtr temp_ptr_for_gcc(iter->second->deepCopy()); + newnode->addChild(temp_ptr_for_gcc); } } for (LLXMLAttribList::iterator iter = mAttributes.begin(); iter != mAttributes.end(); ++iter) { - newnode->addChild(iter->second->deepCopy()); + LLXMLNodePtr temp_ptr_for_gcc(iter->second->deepCopy()); + newnode->addChild(temp_ptr_for_gcc); } return newnode; @@ -756,7 +756,7 @@ bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXML return false; } fseek(fp, 0, SEEK_END); - U32 length = ftell(fp); + size_t length = ftell(fp); fseek(fp, 0, SEEK_SET); U8* buffer = new U8[length+1]; diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index 67993065e..cc5399efe 100644 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp @@ -89,7 +89,7 @@ BOOL LLXmlParser::parseFile(const std::string &path) S32 bytes_read = 0; fseek(file, 0L, SEEK_END); - S32 buffer_size = ftell(file); + size_t buffer_size = ftell(file); fseek(file, 0L, SEEK_SET); void* buffer = XML_GetBuffer(mParser, buffer_size); diff --git a/indra/lscript/lscript_byteconvert.h b/indra/lscript/lscript_byteconvert.h index aa8c7ffb4..4cc118fab 100644 --- a/indra/lscript/lscript_byteconvert.h +++ b/indra/lscript/lscript_byteconvert.h @@ -136,7 +136,7 @@ inline F32 bytestream2float(const U8 *stream, S32 &offset) { S32 value = bytestream2integer(stream, offset); F32 fpvalue = *(F32 *)&value; - if (!llfinite(fpvalue)) + if (!std::isfinite(fpvalue)) { fpvalue = 0; set_fault(stream, LSRF_MATH); @@ -155,7 +155,7 @@ inline void bytestream_int2float(U8 *stream, S32 &offset) S32 value = bytestream2integer(stream, offset); offset -= 4; F32 fpvalue = (F32)value; - if (!llfinite(fpvalue)) + if (!std::isfinite(fpvalue)) { fpvalue = 0; set_fault(stream, LSRF_MATH); @@ -230,21 +230,21 @@ inline void bytestream2vector(LLVector3 &vector, const U8 *stream, S32 &offset) { S32 value = bytestream2integer(stream, offset); vector.mV[VZ] = *(F32 *)&value; - if (!llfinite(vector.mV[VZ])) + if (!std::isfinite(vector.mV[VZ])) { vector.mV[VZ] = 0; set_fault(stream, LSRF_MATH); } value = bytestream2integer(stream, offset); vector.mV[VY] = *(F32 *)&value; - if (!llfinite(vector.mV[VY])) + if (!std::isfinite(vector.mV[VY])) { vector.mV[VY] = 0; set_fault(stream, LSRF_MATH); } value = bytestream2integer(stream, offset); vector.mV[VX] = *(F32 *)&value; - if (!llfinite(vector.mV[VX])) + if (!std::isfinite(vector.mV[VX])) { vector.mV[VX] = 0; set_fault(stream, LSRF_MATH); @@ -265,28 +265,28 @@ inline void bytestream2quaternion(LLQuaternion &quat, const U8 *stream, S32 &off { S32 value = bytestream2integer(stream, offset); quat.mQ[VS] = *(F32 *)&value; - if (!llfinite(quat.mQ[VS])) + if (!std::isfinite(quat.mQ[VS])) { quat.mQ[VS] = 0; set_fault(stream, LSRF_MATH); } value = bytestream2integer(stream, offset); quat.mQ[VZ] = *(F32 *)&value; - if (!llfinite(quat.mQ[VZ])) + if (!std::isfinite(quat.mQ[VZ])) { quat.mQ[VZ] = 0; set_fault(stream, LSRF_MATH); } value = bytestream2integer(stream, offset); quat.mQ[VY] = *(F32 *)&value; - if (!llfinite(quat.mQ[VY])) + if (!std::isfinite(quat.mQ[VY])) { quat.mQ[VY] = 0; set_fault(stream, LSRF_MATH); } value = bytestream2integer(stream, offset); quat.mQ[VX] = *(F32 *)&value; - if (!llfinite(quat.mQ[VX])) + if (!std::isfinite(quat.mQ[VX])) { quat.mQ[VX] = 0; set_fault(stream, LSRF_MATH); @@ -315,7 +315,7 @@ inline F32 get_register_fp(U8 *stream, LSCRIPTRegisters reg) { S32 offset = gLSCRIPTRegisterAddresses[reg]; F32 value = bytestream2float(stream, offset); - if (!llfinite(value)) + if (!std::isfinite(value)) { value = 0; set_fault(stream, LSRF_MATH); @@ -390,7 +390,7 @@ inline F32 add_register_fp(U8 *stream, LSCRIPTRegisters reg, F32 value) S32 offset = gLSCRIPTRegisterAddresses[reg]; F32 newvalue = bytestream2float(stream, offset); newvalue += value; - if (!llfinite(newvalue)) + if (!std::isfinite(newvalue)) { newvalue = 0; set_fault(stream, LSRF_MATH); @@ -587,7 +587,7 @@ inline F32 lscript_pop_float(U8 *stream) { S32 sp = get_register(stream, LREG_SP); F32 value = bytestream2float(stream, sp); - if (!llfinite(value)) + if (!std::isfinite(value)) { value = 0; set_fault(stream, LSRF_MATH); @@ -727,7 +727,7 @@ inline void lscript_local_get(U8 *stream, S32 address, F32 &value) { if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT])) value = bytestream2float(stream, address); - if (!llfinite(value)) + if (!std::isfinite(value)) { value = 0; set_fault(stream, LSRF_MATH); @@ -757,7 +757,7 @@ inline void lscript_global_get(U8 *stream, S32 address, F32 &value) { if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT])) value = bytestream2float(stream, address); - if (!llfinite(value)) + if (!std::isfinite(value)) { value = 0; set_fault(stream, LSRF_MATH); @@ -1058,7 +1058,7 @@ inline F32 safe_instruction_bytestream2float(U8 *stream, S32 &offset) if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_INTEGER])) { F32 value = bytestream2float(stream, offset); - if (!llfinite(value)) + if (!std::isfinite(value)) { value = 0; set_fault(stream, LSRF_MATH); diff --git a/indra/newview/Ascent.icns b/indra/newview/Ascent.icns deleted file mode 100644 index b2d2aa3b8..000000000 Binary files a/indra/newview/Ascent.icns and /dev/null differ diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 835672041..f8a4dc60a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -4,20 +4,17 @@ project(viewer) include(00-Common) include(Boost) +include(BuildPackagesInfo) +include(BuildVersion) +include(CMakeCopyIfDifferent) include(DBusGlib) -include(DirectX) -include(ELFIO) -if(FMODSTUDIO) - include(FMODSTUDIO) -endif(FMODSTUDIO) -if(FMODEX) - include(FMODEX) -endif(FMODEX) -include(OPENAL) +include(FMODSTUDIO) +include(GLOD) include(FindOpenGL) include(Hunspell) include(JsonCpp) include(LLAddBuildTest) +include(LLAppearance) include(LLAudio) include(LLCharacter) include(LLCommon) @@ -34,38 +31,35 @@ include(LLUI) include(LLVFS) include(LLWindow) include(LLXML) -#include(LScript) include(Linking) include(NDOF) include(NVAPI) +include(OPENAL) include(StateMachine) include(TemplateCheck) include(UI) include(ViewerMiscLibs) -include(GLOD) -include(LLAppearance) +include(WinManifest) +include(ZLIB) -if (WINDOWS) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) - include(InstallRequiredSystemLibraries) -endif (WINDOWS) +if (MSVC) + use_prebuilt_binary(vcredist) +endif (MSVC) include_directories( - ${CMAKE_SOURCE_DIR}/newview ${STATEMACHINE_INCLUDE_DIRS} ${DBUSGLIB_INCLUDE_DIRS} - ${HUNSPELL_INCLUDE_DIR} - ${ELFIO_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ${JSONCPP_INCLUDE_DIR} - ${GLOD_INCLUDE_DIRS} + ${GLOD_INCLUDE_DIR} ${LLAUDIO_INCLUDE_DIRS} ${LLCHARACTER_INCLUDE_DIRS} ${LLCOMMON_INCLUDE_DIRS} + ${LLPHYSICSEXTENSIONS_INCLUDE_DIRS} ${LLIMAGE_INCLUDE_DIRS} ${LLINVENTORY_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS} ${LLMESSAGE_INCLUDE_DIRS} - ${LLPHYSICSEXTENSIONS_INCLUDE_DIRS} ${LLPLUGIN_INCLUDE_DIRS} ${LLPRIMITIVE_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS} @@ -73,15 +67,15 @@ include_directories( ${LLVFS_INCLUDE_DIRS} ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} + ${HUNSPELL_INCLUDE_DIR} ${LLAPPEARANCE_INCLUDE_DIRS} -# ${LSCRIPT_INCLUDE_DIRS} -# ${LSCRIPT_INCLUDE_DIRS}/lscript_compile + ${CMAKE_CURRENT_SOURCE_DIR} ) set(viewer_SOURCE_FILES NACLantispam.cpp aihttpview.cpp - aixmllindengenepool.cpp + #aixmllindengenepool.cpp alfloaterregiontracker.cpp aoremotectrl.cpp ascentfloatercontactgroups.cpp @@ -229,7 +223,6 @@ set(viewer_SOURCE_FILES llfloaterimagepreview.cpp llfloaterinspect.cpp llfloaterjoystick.cpp - llfloaterlagmeter.cpp llfloaterland.cpp llfloaterlandholdings.cpp llfloaterlandmark.cpp @@ -493,6 +486,7 @@ set(viewer_SOURCE_FILES llurlwhitelist.cpp lluserauth.cpp llvectorperfoptions.cpp + llversioninfo.cpp llvelocitybar.cpp llviewchildren.cpp llviewerassetstats.cpp @@ -597,14 +591,12 @@ set(viewer_SOURCE_FILES rlvui.cpp scriptcounter.cpp sgmemstat.cpp - sgversion.cpp shcommandhandler.cpp shfloatermediaticker.cpp wlfPanel_AdvSettings.cpp ) -# This gets renamed in the packaging step -set(VIEWER_BINARY_NAME "secondlife-bin" CACHE STRING +set(VIEWER_BINARY_NAME "singularity-bin" CACHE STRING "The name of the viewer executable to create.") set(viewer_HEADER_FILES @@ -613,7 +605,7 @@ set(viewer_HEADER_FILES NACLantispam.h aihttpview.h - aixmllindengenepool.h + #aixmllindengenepool.h alfloaterregiontracker.h aoremotectrl.h ascentfloatercontactgroups.h @@ -762,7 +754,6 @@ set(viewer_HEADER_FILES llfloaterimagepreview.h llfloaterinspect.h llfloaterjoystick.h - llfloaterlagmeter.h llfloaterland.h llfloaterlandholdings.h llfloaterlandmark.h @@ -1032,6 +1023,7 @@ set(viewer_HEADER_FILES lluserauth.h llvectorperfoptions.h llvelocitybar.h + llversioninfo.h llviewchildren.h llviewerassetstats.h llviewerassetstorage.h @@ -1139,7 +1131,6 @@ set(viewer_HEADER_FILES roles_constants.h scriptcounter.h sgmemstat.h - sgversion.h shcommandhandler.h shfloatermediaticker.h wlfPanel_AdvSettings.h @@ -1147,6 +1138,22 @@ set(viewer_HEADER_FILES source_group("CMake Rules" FILES ViewerInstall.cmake) +# 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 +add_custom_target(generate_viewer_version ALL + COMMAND cmake -E echo ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION} > ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + COMMAND cmake -E echo {"Type":"viewer","Version":"${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}"} > ${CMAKE_BINARY_DIR}/summary.json + COMMENT "Generating viewer_version.txt for manifest processing" + ) + +set_source_files_properties( + llversioninfo.cpp + PROPERTIES + DEPENDS generate_viewer_version # dummy dependency to force recompile every time + COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" # see BuildVersion.cmake + ) + if (DARWIN) LIST(APPEND viewer_SOURCE_FILES llappviewermacosx.cpp) @@ -1163,7 +1170,6 @@ if (DARWIN) # Add resource files to the project. set(viewer_RESOURCE_FILES - ${VIEWER_BRANDING_ID}_icon.icns macview.r gpu_table.txt SecondLife.nib/ @@ -1210,19 +1216,35 @@ if (WINDOWS) # the .pch file. # All sources added to viewer_SOURCE_FILES # at this point use it. - set_source_files_properties(llviewerprecompiledheaders.cpp - PROPERTIES - COMPILE_FLAGS "/Ycllviewerprecompiledheaders.h" - ) - foreach( src_file ${viewer_SOURCE_FILES} ) - set_source_files_properties( - ${src_file} + if(USE_PRECOMPILED_HEADERS) + set_source_files_properties(llviewerprecompiledheaders.cpp PROPERTIES - COMPILE_FLAGS "/Yullviewerprecompiledheaders.h" - ) - endforeach( src_file ${viewer_SOURCE_FILES} ) - list(APPEND viewer_SOURCE_FILES llviewerprecompiledheaders.cpp) - + COMPILE_FLAGS "/Ycllviewerprecompiledheaders.h" + ) + list(APPEND viewer_SOURCE_FILES llviewerprecompiledheaders.cpp) + endif(USE_PRECOMPILED_HEADERS) + + # Replace the icons with the appropriate ones for the channel + # ('test' is the default) + set(ICON_PATH "default") + set(VIEWER_MACOSX_PHASE "d") + message("Copying icons for ${ICON_PATH}") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_SOURCE_DIR}/icons/${ICON_PATH}/viewer.ico" + "${CMAKE_CURRENT_SOURCE_DIR}/res/viewer_icon.ico" + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_SOURCE_DIR}/icons/${ICON_PATH}/viewer_256.BMP" + "${CMAKE_CURRENT_SOURCE_DIR}/res/viewer_icon.BMP" + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_SOURCE_DIR}/icons/${ICON_PATH}/viewer_256.BMP" + "${CMAKE_CURRENT_SOURCE_DIR}/res-sdl/viewer_icon.BMP" + ) + # Add resource files to the project. # viewerRes.rc is the only buildable file, but # the rest are all dependencies of it. @@ -1251,7 +1273,9 @@ if (WINDOWS) res/lltooltranslate.cur res/lltoolzoomin.cur res/lltoolzoomout.cur - res/${VIEWER_BRANDING_ID}_icon.ico + res-sdl/viewer_icon.BMP + res/viewer_icon.BMP + res/viewer_icon.ico res/resource.h res/toolpickobject.cur res/toolpickobject2.cur @@ -1266,30 +1290,29 @@ if (WINDOWS) set_source_files_properties(${viewer_RESOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/res/viewerRes.rc + ${CMAKE_CURRENT_BINARY_DIR}/viewerRes.rc + ) set(viewer_RESOURCE_FILES - res/resource.h - res/viewerRes.rc + ${CMAKE_CURRENT_BINARY_DIR}/viewerRes.rc ${viewer_RESOURCE_FILES} ) + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/viewerRes.rc + PROPERTIES COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/res" + ) + SOURCE_GROUP("Resource Files" FILES ${viewer_RESOURCE_FILES}) list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES}) - find_library(DINPUT_LIBRARY dinput8 ${DIRECTX_LIBRARY_DIR}) - find_library(DXGUID_LIBRARY dxguid ${DIRECTX_LIBRARY_DIR}) - mark_as_advanced( - DINPUT_LIBRARY - DXGUID_LIBRARY - ) - # see EXP-1765 - theory is opengl32.lib needs to be included before gdi32.lib (windows libs) set(viewer_LIBRARIES opengl32 advapi32 comdlg32 - ${DINPUT_LIBRARY} - ${DXGUID_LIBRARY} + dinput8 + dxguid gdi32 kernel32 odbc32 @@ -1302,27 +1325,6 @@ if (WINDOWS) Wbemuuid winspool ) - - find_library(DEBUG_INTEL_MEMOPS_LIBRARY ll_intel_memops - PATHS - ${LIBS_PREBUILT_DIR}/lib/debug - ${LIBS_PREBUILT_LEGACY_DIR}/lib/debug - "${QUICKTIME_SDK_DIR}\\libraries" - ) - - find_library(RELEASE_INTEL_MEMOPS_LIBRARY ll_intel_memops - PATHS - ${LIBS_PREBUILT_DIR}/lib/release - ${LIBS_PREBUILT_LEGACY_DIR}/lib/release - "${QUICKTIME_SDK_DIR}\\libraries" - ) - - if (DEBUG_INTEL_MEMOPS_LIBRARY AND RELEASE_INTEL_MEMOPS_LIBRARY) - list(APPEND viewer_LIBRARIES optimized ${RELEASE_INTEL_MEMOPS_LIBRARY}) - list(APPEND viewer_LIBRARIES debug ${DEBUG_INTEL_MEMOPS_LIBRARY}) - mark_as_advanced(RELEASE_INTEL_MEMOPS_LIBRARY) - mark_as_advanced(DEBUG_INTEL_MEMOPS_LIBRARY) - endif (DEBUG_INTEL_MEMOPS_LIBRARY AND RELEASE_INTEL_MEMOPS_LIBRARY) endif (WINDOWS) # Add the xui files. This is handy for searching for xui elements @@ -1352,7 +1354,8 @@ set(viewer_APPSETTINGS_FILES app_settings/cmd_line.xml app_settings/grass.xml app_settings/high_graphics.xml - app_settings/keys.ini + app_settings/keys.xml + app_settings/keysZQSD.xml app_settings/keywords.ini app_settings/logcontrol.xml app_settings/low_graphics.xml @@ -1371,6 +1374,7 @@ set(viewer_APPSETTINGS_FILES app_settings/viewerart.xml ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg + packages-info.txt ) source_group("App Settings" FILES ${viewer_APPSETTINGS_FILES}) @@ -1419,42 +1423,8 @@ add_executable(${VIEWER_BINARY_NAME} ${viewer_SOURCE_FILES} ) -if (!DISABLE_TEMPLATE_CHECK) - check_message_template(${VIEWER_BINARY_NAME}) -endif (!DISABLE_TEMPLATE_CHECK) - set(PACKAGE OFF CACHE BOOL - "Add a package_viewer target that builds an installer package.") - -if(FMOD_LIBRARY_RELEASE) - get_filename_component(fmod_lib_rel_name ${FMOD_LIBRARY_RELEASE} NAME) - get_filename_component(fmod_lib_deb_name ${FMOD_LIBRARY_DEBUG} NAME) - add_custom_command(OUTPUT fmod_lib.marker - COMMENT "Copying fmod library to executable directory" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<$>:${FMOD_LIBRARY_RELEASE}>$<$:${FMOD_LIBRARY_DEBUG}>" "${CMAKE_CFG_INTDIR}/$<$>:${fmod_lib_rel_name}>$<$:${fmod_lib_deb_name}>" - DEPENDS "${FMOD_LIBRARY_RELEASE}") - add_custom_target(fmod_lib_copy DEPENDS fmod_lib.marker prepare) - if(DARWIN AND FMOD_EXTERNAL_LIB) - add_custom_command(OUTPUT fmod_lib_install.marker - COMMAND install_name_tool -id "@executable_path/../Resources/$<$>:${fmod_lib_rel_name}>$<$:${FMOD_LIBRARY_DEBUG}>" "${CMAKE_CFG_INTDIR}/$<$>:${fmod_lib_rel_name}>$<$:${fmod_lib_deb_name}>" - DEPENDS fmod_lib.marker) - add_dependencies(fmod_lib_copy fmod_lib_install.marker) - endif(DARWIN AND FMOD_EXTERNAL_LIB) - add_dependencies(${VIEWER_BINARY_NAME} fmod_lib_copy) - - #viewer_manifest.py needs these libraries (for now its all dylib) - if(MANIFEST_LIBRARIES) - set(MANIFEST_LIBRARIES ${MANIFEST_LIBRARIES}|optimized ${fmod_lib_rel_name}|debug ${fmod_lib_deb_name}) - else(MANIFEST_LIBRARIES) - set(MANIFEST_LIBRARIES optimized ${fmod_lib_rel_name}|debug ${fmod_lib_deb_name}) - endif(MANIFEST_LIBRARIES) - - if(WINDOWS) #If windows, fmod_lib_ points to a dll. The correct .lib needs to be linked (but copying is not necessary) - set(EXTRA_LINKER_FLAGS_RELEASE "/DELAYLOAD:${fmod_lib_rel_name}") - set(EXTRA_LINKER_FLAGS_DEBUG "/DELAYLOAD:${fmod_lib_deb_name}") - endif(WINDOWS) - list(APPEND viewer_LIBRARIES optimized "${FMOD_LINK_LIBRARY_RELEASE}" debug "${FMOD_LINK_LIBRARY_DEBUG}" ) -endif(FMOD_LIBRARY_RELEASE) + "Add a package target that builds an installer package.") if (WINDOWS) set(release_flags "/MAP") @@ -1467,6 +1437,128 @@ if (WINDOWS) LINK_FLAGS_RELWITHDEBINFO "${release_flags} ${EXTRA_LINKER_FLAGS_RELEASE}" ) + add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version) + + if(USE_PRECOMPILED_HEADERS) + set_target_properties( + ${VIEWER_BINARY_NAME} + PROPERTIES + COMPILE_FLAGS "/Yullviewerprecompiledheaders.h" + ) + endif(USE_PRECOMPILED_HEADERS) + + # If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency + # here. + # *NOTE:Mani - This is a crappy hack to have important dependencies for the viewer_manifest copy action + # be met. I'm looking forward to a source-code split-up project next year that will address this kind of thing. + # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py + # and have the build deps get tracked *please* tell me about it. + + if(NOT DISABLE_TCMALLOC) + # Configure a var for tcmalloc location, if used. + # Note the need to specify multiple names explicitly. + set(GOOGLE_PERF_TOOLS_SOURCE + ${SHARED_LIB_STAGING_DIR}/Release/libtcmalloc_minimal.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll + ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll + ) + endif(NOT DISABLE_TCMALLOC) + + set(COPY_INPUT_DEPENDENCIES + # The following commented dependencies are determined at variably at build time. Can't do this here. + #${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll + ${CMAKE_SOURCE_DIR}/../etc/message.xml + ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/glod.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll + ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll + ${SHARED_LIB_STAGING_DIR}/Release/openjpeg.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjpeg.dll + ${SHARED_LIB_STAGING_DIR}/Debug/openjpegd.dll + ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/zlib1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxplatform.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt + ${GOOGLE_PERF_TOOLS_SOURCE} + ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt + ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt + ${CMAKE_CURRENT_SOURCE_DIR}/featuretable_xp.txt + ${ARCH_PREBUILT_DIRS_RELEASE}/libeay32.dll + ${ARCH_PREBUILT_DIRS_RELEASE}/ssleay32.dll + ${ARCH_PREBUILT_DIRS_DEBUG}/libeay32.dll + ${ARCH_PREBUILT_DIRS_DEBUG}/ssleay32.dll + SLPlugin + media_plugin_quicktime + media_plugin_cef + windows-crash-logger + ) + + if (FMODSTUDIO) + if (WORD_SIZE EQUAL 64) + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/fmod64.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/fmod64.dll + ${SHARED_LIB_STAGING_DIR}/Debug/fmodL64.dll + ) + else (WORD_SIZE EQUAL 64) + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/fmod.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/fmod.dll + ${SHARED_LIB_STAGING_DIR}/Debug/fmodL.dll + ) + endif (WORD_SIZE EQUAL 64) + endif (FMODSTUDIO) + + add_custom_command( + OUTPUT ${CMAKE_CFG_INTDIR}/copy_touched.bat + COMMAND ${PYTHON_EXECUTABLE} + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --actions=copy + --arch=${ARCH} + --artwork=${ARTWORK_DIR} + --build=${CMAKE_CURRENT_BINARY_DIR} + --buildtype=${CMAKE_BUILD_TYPE} + --configuration=${CMAKE_CFG_INTDIR} + --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + --grid=${GRID} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + --source=${CMAKE_CURRENT_SOURCE_DIR} + --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + generate_viewer_version + stage_third_party_libs + ${COPY_INPUT_DEPENDENCIES} + COMMENT "Performing viewer_manifest copy" + ) + + add_custom_target(copy_w_viewer_manifest ALL DEPENDS ${CMAKE_CFG_INTDIR}/copy_touched.bat) + + add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon copy_w_viewer_manifest) + + if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) + add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts) + endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) + + add_dependencies(${VIEWER_BINARY_NAME} + SLPlugin + ) + + EMBED_MANIFEST(${VIEWER_BINARY_NAME} 1) + # sets the 'working directory' for debugging from visual studio. if (NOT UNATTENDED) add_custom_command( @@ -1481,32 +1573,7 @@ if (WINDOWS) COMMENT "Setting the ${VIEWER_BINARY_NAME} working directory for debugging." ) endif (NOT UNATTENDED) - - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} PRE_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/messages/message_template.msg - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings/message_template.msg - COMMENT "Copying message_template.msg to the runtime folder." - ) - - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} PRE_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${CMAKE_CURRENT_SOURCE_DIR}/../../etc/message.xml - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings/message.xml - COMMENT "Copying message.xml to the runtime folder." - ) - - if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) - add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts) - endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts) + if (PACKAGE) add_custom_command( OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat @@ -1515,63 +1582,38 @@ if (WINDOWS) ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --arch=${ARCH} --artwork=${ARTWORK_DIR} - --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} + --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --grid=${GRID} - --login_channel=${VIEWER_LOGIN_CHANNEL} --source=${CMAKE_CURRENT_SOURCE_DIR} --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat - --extra_libraries="${MANIFEST_LIBRARIES}" DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + ${COPY_INPUT_DEPENDENCIES} ) - add_custom_command( - OUTPUT ${CMAKE_CFG_INTDIR}/copy_touched.bat - COMMAND ${PYTHON_EXECUTABLE} - ARGS - ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py - --arch=${ARCH} - --artwork=${ARTWORK_DIR} - --actions=copy - --branding_id=${VIEWER_BRANDING_ID} - --build=${CMAKE_CURRENT_BINARY_DIR} - --channel=${VIEWER_CHANNEL} - --configuration=${CMAKE_CFG_INTDIR} - --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} - --grid=${GRID} - --login_channel=${VIEWER_LOGIN_CHANNEL} - --source=${CMAKE_CURRENT_SOURCE_DIR} - --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat - --extra_libraries="${MANIFEST_LIBRARIES}" - DEPENDS - ${VIEWER_BINARY_NAME} - ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py - COMMENT "Performing viewer_manifest copy" + add_custom_target(llpackage ALL DEPENDS + ${CMAKE_CFG_INTDIR}/touched.bat + windows-setup-build-all ) - - add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_webkit basic_plugin_filepicker) - - if(WORD_SIZE EQUAL 32) - add_dependencies(${VIEWER_BINARY_NAME} winmm_shim) - endif(WORD_SIZE EQUAL 32) - - if (PACKAGE) - add_custom_target(package_viewer ALL DEPENDS ${CMAKE_CFG_INTDIR}/touched.bat) endif (PACKAGE) endif (WINDOWS) -# *NOTE - this list is very sensitive to ordering, test carefully on all +# *NOTE: - this list is very sensitive to ordering, test carefully on all # platforms if you change the releative order of the entries here. # In particular, cmake 2.6.4 (when buidling with linux/makefile generators) # appears to sometimes de-duplicate redundantly listed dependencies improperly. # To work around this, higher level modules should be listed before the modules # that they depend upon. -brad target_link_libraries(${VIEWER_BINARY_NAME} + ${PNG_PRELOAD_ARCHIVES} + ${ZLIB_PRELOAD_ARCHIVES} ${GOOGLE_PERFTOOLS_LIBRARIES} ${LLAUDIO_LIBRARIES} ${LLAUDIO_VORBIS_LIBRARIES} @@ -1589,7 +1631,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLVFS_LIBRARIES} ${LLWINDOW_LIBRARIES} ${LLXML_LIBRARIES} -# ${LSCRIPT_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${NDOF_LIBRARY} @@ -1603,6 +1644,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${Boost_DATE_TIME_LIBRARY} ${DBUSGLIB_LIBRARIES} ${OPENGL_LIBRARIES} + ${FMOD_LIBRARY} # must come after LLAudio ${GLOD_LIBRARIES} ${APRUTIL_LIBRARIES} ${OPENGL_LIBRARIES} @@ -1612,44 +1654,44 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${UI_LIBRARIES} ${WINDOWS_LIBRARIES} ${XMLRPCEPI_LIBRARIES} - ${ELFIO_LIBRARIES} ${HUNSPELL_LIBRARY} ${LLPHYSICSEXTENSIONS_LIBRARIES} ${LLAPPEARANCE_LIBRARIES} ) if (LINUX) - add_custom_command( - OUTPUT secondlife-stripped - COMMAND strip - ARGS --strip-debug -o secondlife-stripped ${VIEWER_BINARY_NAME} - DEPENDS ${VIEWER_BINARY_NAME} - ) + set(product Singularity-${ARCH}-${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}) - set(product ${VIEWER_BRANDING_NAME_CAMELCASE}-${ARCH}-${${ROOT_PROJECT_NAME}_VERSION}) + # These are the generated targets that are copied to package/ + set(COPY_INPUT_DEPENDENCIES + ${VIEWER_BINARY_NAME} + SLPlugin + media_plugin_gstreamer010 + llcommon + ) + + add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version) add_custom_command( - OUTPUT ${product}.tar.bz2 + OUTPUT ${product}.tar.xz COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --arch=${ARCH} --artwork=${ARTWORK_DIR} - --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} - --installer_name=${product} - --login_channel=${VIEWER_LOGIN_CHANNEL} --source=${CMAKE_CURRENT_SOURCE_DIR} --standalone=${STANDALONE} --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched - --extra_libraries="${MANIFEST_LIBRARIES}" DEPENDS - secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${COPY_INPUT_DEPENDENCIES} ) add_custom_command( @@ -1660,47 +1702,57 @@ if (LINUX) --arch=${ARCH} --actions=copy --artwork=${ARTWORK_DIR} - --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} - --channel=${VIEWER_CHANNEL} + --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} - --installer_name=${product} - --login_channel=${VIEWER_LOGIN_CHANNEL} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} - --standalone=${STANDALONE} - --extra_libraries="${MANIFEST_LIBRARIES}" DEPENDS - secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${COPY_INPUT_DEPENDENCIES} + COMMENT "Performing viewer_manifest copy" ) - add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_gstreamer010 media_plugin_webkit basic_plugin_filepicker) + add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_gstreamer010 basic_plugin_filepicker) add_custom_target(copy_l_viewer_manifest ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched) if (PACKAGE) - add_custom_target(package_viewer ALL DEPENDS ${product}.tar.bz2) - add_dependencies(package_viewer copy_l_viewer_manifest) + add_custom_target(llpackage ALL DEPENDS ${product}.tar.xz) + # Make sure we don't run two instances of viewer_manifest.py at the same time. + add_dependencies(llpackage copy_l_viewer_manifest) + check_message_template(llpackage) endif (PACKAGE) endif (LINUX) if (DARWIN) set(product ${VIEWER_BRANDING_NAME}) + set(MACOSX_BUNDLE_INFO_STRING "A stable third-party Second Life viewer.") + set(MACOSX_BUNDLE_ICON_FILE "viewer.icns") + set(MACOSX_BUNDLE_GUI_IDENTIFIER "${VIEWER_BRANDING_NAME}") + set(MACOSX_BUNDLE_LONG_VERSION_STRING "${VIEWER_CHANNEL} ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}") + set(MACOSX_BUNDLE_BUNDLE_NAME "${VIEWER_BRANDING_NAME}") + set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VIEWER_SHORT_VERSION}") + set(MACOSX_BUNDLE_BUNDLE_VERSION "${${ROOT_PROJECT_NAME}_VERSION}") + set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2010-2016 Siana Gearz") + set_target_properties( ${VIEWER_BINARY_NAME} PROPERTIES OUTPUT_NAME "${product}" - MACOSX_BUNDLE_INFO_STRING "A stable third-party Second Life viewer." - MACOSX_BUNDLE_ICON_FILE "${VIEWER_BRANDING_ID}_icon.icns" - MACOSX_BUNDLE_GUI_IDENTIFIER "${VIEWER_BRANDING_NAME}" - MACOSX_BUNDLE_LONG_VERSION_STRING "${${ROOT_PROJECT_NAME}_VERSION}" - MACOSX_BUNDLE_BUNDLE_NAME "${VIEWER_BRANDING_NAME}" - MACOSX_BUNDLE_SHORT_VERSION_STRING "${${ROOT_PROJECT_NAME}_VERSION}" - MACOSX_BUNDLE_BUNDLE_VERSION "${${ROOT_PROJECT_NAME}_VERSION}" - MACOSX_BUNDLE_COPYRIGHT "Copyright 2013 Siana Gearz" + MACOSX_BUNDLE_INFO_PLIST + "${CMAKE_CURRENT_SOURCE_DIR}/Info-SecondLife.plist" ) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/Info-SecondLife.plist" + "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app/Contents/Info.plist" + ) + + add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version) + add_custom_command( TARGET ${VIEWER_BINARY_NAME} POST_BUILD COMMAND ${PYTHON_EXECUTABLE} @@ -1717,31 +1769,32 @@ if (DARWIN) --source=${CMAKE_CURRENT_SOURCE_DIR} --extra_libraries="${MANIFEST_LIBRARIES}" DEPENDS - ${VIEWER_BINARY_NAME} - ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${VIEWER_BINARY_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ) add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_webkit basic_plugin_filepicker) if (PACKAGE) - add_custom_target(package_viewer ALL DEPENDS ${VIEWER_BINARY_NAME}) + add_custom_target(llpackage ALL DEPENDS ${VIEWER_BINARY_NAME}) + add_dependencies(llpackage generate_viewer_version) add_custom_command( - TARGET package_viewer POST_BUILD + TARGET llpackage POST_BUILD COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + --arch=${ARCH} --artwork=${ARTWORK_DIR} - --branding_id=${VIEWER_BRANDING_ID} --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app --grid=${GRID} - --login_channel=${VIEWER_LOGIN_CHANNEL} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} - --extra_libraries="${MANIFEST_LIBRARIES}" --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched DEPENDS ${VIEWER_BINARY_NAME} @@ -1754,9 +1807,8 @@ if (INSTALL) include(${CMAKE_CURRENT_SOURCE_DIR}/ViewerInstall.cmake) endif (INSTALL) - if (PACKAGE) - set(SYMBOL_NAME ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${VIEWER_BRANDING_NAME_CAMELCASE}-${${ROOT_PROJECT_NAME}_VERSION}-symbols) + set(SYMBOL_NAME ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Singularity-${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}-symbols) set(SYMBOL_SEARCH_DIRS "") if (WINDOWS) list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") @@ -1765,7 +1817,7 @@ if (PACKAGE) # set(VIEWER_EXE_GLOBS "${VIEWER_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX} slplugin.exe") set(VIEWER_EXE_GLOBS "${VIEWER_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX}") set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}") - set(VIEWER_DUMP_SYMS dump_syms.exe) + set(VIEWER_COPY_MANIFEST copy_w_viewer_manifest) endif (WINDOWS) if (DARWIN) list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") @@ -1774,18 +1826,16 @@ if (PACKAGE) list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/plugins/gstreamer010/${CMAKE_CFG_INTDIR}") list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/plugins/quicktime/${CMAKE_CFG_INTDIR}") list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/plugins/webkit/${CMAKE_CFG_INTDIR}") - set(VIEWER_SYMBOL_FILE "${SYMBOL_NAME}-darwin.tar.bz2") + set(VIEWER_SYMBOL_FILE "${SYMBOL_NAME}-darwin.tar.bz2") set(VIEWER_EXE_GLOBS "'${VIEWER_BRANDING_NAME}' SLPlugin") set(VIEWER_LIB_GLOB "*.dylib") - set(VIEWER_DUMP_SYMS dump_syms) endif (DARWIN) if (LINUX) list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/packaged") - set(VIEWER_SYMBOL_FILE "${SYMBOL_NAME}-linux-${ARCH}.tar.bz2") + set(VIEWER_SYMBOL_FILE "${SYMBOL_NAME}-linux-${ARCH}.tar.bz2") set(VIEWER_EXE_GLOBS "${VIEWER_BRANDING_ID}-do-not-run-directly SLPlugin") set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}*") set(VIEWER_COPY_MANIFEST copy_l_viewer_manifest) - set(VIEWER_DUMP_SYMS dump_syms) endif (LINUX) if(RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) @@ -1804,7 +1854,7 @@ if (PACKAGE) "${SYMBOL_SEARCH_DIRS}" "${VIEWER_EXE_GLOBS}" "${VIEWER_LIB_GLOB}" - "${LIBS_PREBUILT_DIR}/bin/${VIEWER_DUMP_SYMS}|${LIBS_PREBUILT_LEGACY_DIR}/bin/${VIEWER_DUMP_SYMS}" + "${AUTOBUILD_INSTALL_DIR}/bin/dump_syms" "${VIEWER_SYMBOL_FILE}" DEPENDS generate_breakpad_symbols.py VERBATIM) @@ -1814,143 +1864,13 @@ if (PACKAGE) if(VIEWER_COPY_MANIFEST) add_dependencies(generate_breakpad_symbols ${VIEWER_COPY_MANIFEST}) endif(VIEWER_COPY_MANIFEST) - add_dependencies(package_viewer generate_breakpad_symbols) + add_dependencies(llpackage generate_breakpad_symbols) endif(RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) endif (PACKAGE) # Add tests if (LL_TESTS) - ADD_VIEWER_BUILD_TEST(llagentaccess viewer) - #ADD_VIEWER_BUILD_TEST(llworldmap viewer) - #ADD_VIEWER_BUILD_TEST(llworldmipmap viewer) - ADD_VIEWER_BUILD_TEST(lltextureinfo viewer) - ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer) - ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer) - #ADD_VIEWER_COMM_BUILD_TEST(lltranslate viewer "") endif (LL_TESTS) -# Don't do these for DARWIN or LINUX here -- they're taken care of by viewer_manifest.py -if (WINDOWS) +check_message_template(${VIEWER_BINARY_NAME}) - IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) - FOREACH(RUNTIME_LIB ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${RUNTIME_LIB} - ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Copying ${RUNTIME_LIB} to the runtime folder." - ) - ENDFOREACH(RUNTIME_LIB ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) - ENDIF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) - - SET(BUILT_LLCOMMON $) - - set_target_properties(llcommon - PROPERTIES - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\"" - LINK_FLAGS_RELEASE "${release_flags} /LTCG" - LINK_FLAGS_RELWITHDEBINFO "${release_flags}" - ) - - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${BUILT_LLCOMMON} - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} - COMMENT "Copying llcommon.dll to the runtime folder." - ) - - SET(BUILT_SLPLUGIN $) - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${BUILT_SLPLUGIN} - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} - COMMENT "Copying SLPlugin executable to the runtime folder." - ) - - SET(BUILT_WEBKIT_PLUGIN $) - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${BUILT_WEBKIT_PLUGIN} - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin - COMMENT "Copying WebKit Plugin to the runtime folder." - ) - - SET(BUILT_QUICKTIME_PLUGIN $) - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${BUILT_QUICKTIME_PLUGIN} - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin - COMMENT "Copying Quicktime Plugin to the runtime folder." - ) - - SET(BUILT_FILEPICKER_PLUGIN $) - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${BUILT_FILEPICKER_PLUGIN} - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin - COMMENT "Copying filepicker Plugin to the runtime folder." - ) - -# winmm doesn't build on windows 64 - if(WORD_SIZE EQUAL 32) - SET(BUILT_WINMM_SHIM_PLUGIN $) - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${BUILT_WINMM_SHIM_PLUGIN} - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} - COMMENT "Copying winmm.dll to the runtime folder." - ) - endif(WORD_SIZE EQUAL 32) - - # Copying the mime_types.xml file to app_settings - set(mime_types_source "${CMAKE_SOURCE_DIR}/newview/skins/default/xui/en-us") - set(mime_types_dest "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings") - add_custom_command( - TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - -E - copy_if_different - ${mime_types_source}/mime_types_windows.xml - ${mime_types_dest}/mime_types.xml - COMMENT "Copying mime_types_windows.xml to mime_types.xml." - ) - -endif (WINDOWS) - -if (DARWIN) -# Don't do this here -- it's taken care of by viewer_manifest.py -# add_custom_command(TARGET ${VIEWER_BINARY_NAME} POST_BUILD -# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib/release/libllqtwebkit.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llplugin/ -# DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib/release/libllqtwebkit.dylib -# ) -endif (DARWIN) diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt new file mode 100644 index 000000000..f263cd11b --- /dev/null +++ b/indra/newview/VIEWER_VERSION.txt @@ -0,0 +1 @@ +1.8.6 diff --git a/indra/newview/alfloaterregiontracker.cpp b/indra/newview/alfloaterregiontracker.cpp index c19295924..cc58da211 100644 --- a/indra/newview/alfloaterregiontracker.cpp +++ b/indra/newview/alfloaterregiontracker.cpp @@ -48,17 +48,11 @@ #include "llworldmap.h" #include "llworldmapmessage.h" -#include - const std::string TRACKER_FILE = "tracked_regions.json"; ALFloaterRegionTracker::ALFloaterRegionTracker(const LLSD&) : LLFloater(), - LLEventTimer(5.f), - mRefreshRegionListBtn(NULL), - mRemoveRegionBtn(NULL), - mOpenMapBtn(NULL), - mRegionScrollList(NULL) + LLEventTimer(5.f) { LLUICtrlFactory::instance().buildFloater(this, "floater_region_tracker.xml"); loadFromJSON(); @@ -119,7 +113,7 @@ void ALFloaterRegionTracker::refresh() } std::vector saved_selected_values; - BOOST_FOREACH(const LLScrollListItem* item, mRegionScrollList->getAllSelected()) + for(const auto* item : mRegionScrollList->getAllSelected()) { saved_selected_values.push_back(item->getValue().asString()); } @@ -195,7 +189,7 @@ void ALFloaterRegionTracker::requestRegionData() for (LLSD::map_const_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++) { - const std::string& name = it->first; + const auto& name = it->first; if (LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromName(name)) { info->updateAgentCount(LLTimer::getElapsedSeconds()); @@ -210,7 +204,7 @@ void ALFloaterRegionTracker::requestRegionData() void ALFloaterRegionTracker::removeRegions() { - BOOST_FOREACH(const LLScrollListItem* item, mRegionScrollList->getAllSelected()) + for (const auto* item : mRegionScrollList->getAllSelected()) { mRegionMap.erase(item->getValue().asString()); } diff --git a/indra/newview/alfloaterregiontracker.h b/indra/newview/alfloaterregiontracker.h index bf7db79a1..230973f6a 100644 --- a/indra/newview/alfloaterregiontracker.h +++ b/indra/newview/alfloaterregiontracker.h @@ -41,11 +41,11 @@ private: ALFloaterRegionTracker(const LLSD& key); virtual ~ALFloaterRegionTracker(); public: - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(/*const LLSD& key*/); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void refresh(); - /*virtual*/ BOOL tick(); + BOOL postBuild() override; + void onOpen(/*const LLSD& key*/) override; + void onClose(bool app_quitting) override; + void refresh() override; + BOOL tick() override; using LLFloaterSingleton::getInstance; private: @@ -62,8 +62,8 @@ public: private: LLSD mRegionMap; - LLButton* mRefreshRegionListBtn; - LLButton* mRemoveRegionBtn; - LLButton* mOpenMapBtn; - LLScrollListCtrl* mRegionScrollList; + LLButton* mRefreshRegionListBtn = nullptr; + LLButton* mRemoveRegionBtn = nullptr; + LLButton* mOpenMapBtn = nullptr; + LLScrollListCtrl* mRegionScrollList = nullptr; }; diff --git a/indra/newview/app_settings/default_grids.xml b/indra/newview/app_settings/default_grids.xml index 258961627..f258b23d3 100644 --- a/indra/newview/app_settings/default_grids.xml +++ b/indra/newview/app_settings/default_grids.xml @@ -18,7 +18,6 @@ registerhttp://secondlife.com/registration/ passwordhttp://secondlife.com/account/request.php render_compat1 - inventory_links1 auto_update0 locked1 @@ -35,7 +34,6 @@ supporthttp://secondlife.com/support/ registerhttp://secondlife.com/registration/ render_compat0 - inventory_links1 auto_update0 @@ -45,7 +43,6 @@ gridname OSGrid gridnick osgrid helperuri http://helper.osgrid.org/ - inventory_links 0 loginpage http://www.osgrid.org/splash/ loginuri http://login.osgrid.org/ password http://www.osgrid.org/ diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini index d880d48f3..a4a448ca8 100644 --- a/indra/newview/app_settings/keywords.ini +++ b/indra/newview/app_settings/keywords.ini @@ -182,6 +182,8 @@ PSYS_SRC_PATTERN_ANGLE_CONE PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY OBJECT_UNKNOWN_DETAIL Returned by llGetObjectDetails when passed an invalid object parameter type +OBJECT_HOVER_HEIGHT This is a flag used with llGetObjectDetails to get hover height of the avatar. If no data is available, 0.0 is returned. +OBJECT_LAST_OWNER_ID Gets the object's last owner ID. OBJECT_NAME Used with llGetObjectDetails to get an object's name OBJECT_DESC Used with llGetObjectDetails to get an object's description OBJECT_POS Used with llGetObjectDetails to get an object's position @@ -189,6 +191,7 @@ OBJECT_ROT Used with llGetObjectDetails to get an o OBJECT_VELOCITY Used with llGetObjectDetails to get an object's velocity OBJECT_OWNER Used with llGetObjectDetails to get an object's owner's key. Will be NULL_KEY if group owned OBJECT_GROUP Used with llGetObjectDetails to get an object's group's key +OBJECT_CLICK_ACTION This is a flag used with llGetObjectDetails to get the click action. The default is 0. OBJECT_CREATOR Used with llGetObjectDetails to get an object's creator's key OBJECT_RUNNING_SCRIPT_COUNT Gets the number of running scripts attached to the object or agent OBJECT_TOTAL_SCRIPT_COUNT Gets the number of scripts, both running and stopped, attached to the object or agent. @@ -199,6 +202,7 @@ OBJECT_SERVER_COST Used with llGetObjectDetails to get the OBJECT_STREAMING_COST Used with llGetObjectDetails to get the streaming (download) cost. OBJECT_PHYSICS_COST Used with llGetObjectDetails to get the physics cost. OBJECT_PATHFINDING_TYPE Used with llGetObjectDetails to get an object's pathfinding settings. +OBJECT_BODY_SHAPE_TYPE This is a flag used with llGetObjectDetails to get the body type of the avatar, based on shape data. If no data is available, -1.0 is returned. This is normally between 0 and 1.0, with 0.5 and larger considered 'male' OBJECT_CHARACTER_TIME Used with llGetObjectDetails to get an object's average CPU time (in seconds) used by the object for navigation, if the object is a pathfinding character. Returns 0 for non-characters. OBJECT_ROOT Used with llGetObjectDetails to get an object's root prim ID. OBJECT_ATTACHED_POINT Used with llGetObjectDetails to get an object's attachment point. @@ -454,6 +458,7 @@ PRIM_SHINY_LOW Low shininess PRIM_SHINY_MEDIUM Medium shininess PRIM_SHINY_HIGH High shininess + PRIM_BUMP_NONE No bump map PRIM_BUMP_BRIGHT Generate bump map from highlights PRIM_BUMP_DARK Generate bump map from lowlights diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a264b810c..add66a4bc 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -86,18 +86,6 @@ 0 - SianaRenderDeferredInvisiprim - - Comment - Support invisiprims in deferred mode - Persist - 1 - Type - Boolean - Value - 1 - - SianaVoidWaterSubdivision Comment @@ -7514,22 +7502,6 @@ This should be as low as possible, but too low may break functionality 0
- FloaterLagMeter - - Comment - Rectangle for lag meter - Persist - 1 - Type - Rect - Value - - 0 - 142 - 350 - 0 - - ShowRadar Comment @@ -9614,17 +9586,6 @@ This should be as low as possible, but too low may break functionality
Value http://wiki.secondlife.com/wiki/[LSL_STRING]
- LagMeterShrunk - - Comment - Last large/small state for lag meter - Persist - 1 - Type - Boolean - Value - 0 - Language Comment diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index 1146bfc16..e55e281bb 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -951,6 +951,17 @@ Value 3.5 + LiruFlashWhenMinimized + + Comment + Whether or not to flash the taskbar when a message comes in while minimized. + Persist + 1 + Type + Boolean + Value + 1 + OBJExportNotifyFailed Comment @@ -1538,17 +1549,6 @@ Value 0 - ToolbarVisibleLagMeter - - Comment - Whether or not the button for lag meter is on the toolbar - Persist - 1 - Type - Boolean - Value - 0 - ToolbarVisibleLocalAssets Comment diff --git a/indra/newview/app_settings/windlight/skies/%252ACanimod.xml b/indra/newview/app_settings/windlight/skies/%252ACanimod.xml deleted file mode 100644 index d4e69e622..000000000 --- a/indra/newview/app_settings/windlight/skies/%252ACanimod.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - ambient - - 1.4699999094009399 - 1.4699999094009399 - 1.4699999094009399 - 0.48999997973442078 - - blue_density - - 0.099999994039535522 - 0.037499997764825821 - 0.067499987781047821 - 0.049999997019767761 - - blue_horizon - - 0.15130999684333801 - 0.30000001192092896 - 0.35131001472473145 - 1 - - cloud_color - - 0.22999998927116394 - 0.22999998927116394 - 0.22999998927116394 - 0.22999998927116394 - - cloud_pos_density1 - - 0.88419097661972046 - 0.53047597408294678 - 0.52999997138977051 - 1 - - cloud_pos_density2 - - 0.2800000011920929 - 0.19999998807907104 - 0.31999999284744263 - 1 - - cloud_scale - - 0.0099999997764825821 - 0 - 0 - 1 - - cloud_scroll_rate - - 0 - 15.329999446868896 - - cloud_shadow - - 0 - 0 - 0 - 1 - - density_multiplier - - 0.00022000000171829015 - 0 - 0 - 1 - - distance_multiplier - - 16.200000762939453 - 0 - 0 - 1 - - east_angle - 6.2831854820251465 - enable_cloud_scroll - - 1 - 1 - - gamma - - 1.4199999570846558 - 0 - 0 - 1 - - glow - - 18.599998474121094 - 0.0012815999798476696 - 0 - 1 - - haze_density - - 0 - 0 - 0 - 1 - - haze_horizon - - 1 - 0.21744099259376526 - 0.21744099259376526 - 1 - - lightnorm - - -1.7484555314695172e-007 - 0 - 1 - 0 - - max_y - - 403 - 0 - 0 - 1 - - preset_num - 2 - star_brightness - 0 - sun_angle - 0 - sunlight_color - - 0 - 0 - 0 - 0 - - - diff --git a/indra/newview/app_settings/windlight/skies/%252AStarley%252A%20Settings%202.xml b/indra/newview/app_settings/windlight/skies/%252AStarley%252A%20Settings%202.xml deleted file mode 100644 index 6d1c09d30..000000000 --- a/indra/newview/app_settings/windlight/skies/%252AStarley%252A%20Settings%202.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - ambient - - 1.4699999094009399 - 1.4699999094009399 - 1.4699999094009399 - 0.48999997973442078 - - blue_density - - 0.14000000059604645 - 0.14000000059604645 - 0.14000000059604645 - 0.070000000298023224 - - blue_horizon - - 0.83809572458267212 - 1.0735483169555664 - 1.2799999713897705 - 0.63999998569488525 - - cloud_color - - 0.12862999737262726 - 0.12862999737262726 - 0.12862999737262726 - 1 - - cloud_pos_density1 - - 0.70999997854232788 - 0.53047597408294678 - 0.4270470142364502 - 1 - - cloud_pos_density2 - - 0.38419300317764282 - 0.5 - 0.125 - 1 - - cloud_scale - - 0.72999995946884155 - 0 - 0 - 1 - - cloud_scroll_rate - - 10 - 10 - - cloud_shadow - - 0.2199999988079071 - 0 - 0 - 1 - - density_multiplier - - 0.00017999998817685992 - 0 - 0 - 1 - - distance_multiplier - - 11.40000057220459 - 0 - 0 - 1 - - east_angle - 0 - enable_cloud_scroll - - 1 - 1 - - gamma - - 1.6899999380111694 - 0 - 0 - 1 - - glow - - 6.4079799652099609 - 0.0012815999798476696 - -0.39999997615814209 - 1 - - haze_density - - 1.4900000095367432 - 0 - 0 - 1 - - haze_horizon - - 0 - 0.21744099259376526 - 0.21744099259376526 - 1 - - lightnorm - - 0 - 0 - 1 - 0 - - max_y - - 805 - 0 - 0 - 1 - - preset_num - 2 - star_brightness - 1.5699999332427979 - sun_angle - 0 - sunlight_color - - 3 - 3 - 3 - 1 - - - diff --git a/indra/newview/app_settings/windlight/skies/AnaLu%20%252Astudio%252A%205.xml b/indra/newview/app_settings/windlight/skies/AnaLu%20%252Astudio%252A%205.xml deleted file mode 100644 index b7c6d047f..000000000 --- a/indra/newview/app_settings/windlight/skies/AnaLu%20%252Astudio%252A%205.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - ambient - - 2.0099997520446777 - 1.9199999570846558 - 1.8899999856948853 - 2.0099997520446777 - - blue_density - - 0.63999998569488525 - 1.1799999475479126 - 2 - 2 - - blue_horizon - - 0.23999999463558197 - 0.23999999463558197 - 0.31999999284744263 - 0.31999999284744263 - - cloud_color - - 0.39050509865536398 - 0.39050509865536398 - 0.39050509865536398 - 0.39050509865536398 - - cloud_pos_density1 - - 1.6884100437164307 - 0.52609699964523315 - 1 - 1 - - cloud_pos_density2 - - 1.6884100437164307 - 0.52609699964523315 - 0.125 - 1 - - cloud_scale - - 0.41999998254906856 - 0 - 0 - 1 - - cloud_scroll_rate - - 10.199999735331062 - 10.010999579794088 - - cloud_shadow - - 0.12999999523162842 - 0 - 0 - 1 - - density_multiplier - - 0.00017999998391111764 - 0 - 0 - 1 - - distance_multiplier - - 2 - 0 - 0 - 1 - - east_angle - 0 - enable_cloud_scroll - - 1 - 1 - - gamma - - 1.1499999761581421 - 0 - 0 - 1 - - glow - - 4.9999998807907104 - 0.0010000000478643939 - -0.47999998436731417 - 1 - - haze_density - - 0.64999997615814209 - 0 - 0 - 1 - - haze_horizon - - 0.08999999612569809 - 0.19915600121021271 - 0.19915600121021271 - 1 - - lightnorm - - 0 - 0 - 1 - 0 - - max_y - - 188 - 0 - 0 - 1 - - preset_num - 22 - star_brightness - 0 - sun_angle - 0 - sunlight_color - - 2.5799999237060547 - 2.5799999237060547 - 2.5799999237060547 - 2.5799999237060547 - - - diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index aacfe6826..141b57dcd 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -69,25 +69,6 @@ LLPrefsAscentChat::LLPrefsAscentChat() autoresponse->setToolTip(LLTrans::getString("NotLoggedIn")); } - // Saved per account settings aren't detected by control_name, therefore autoresponse controls get their values here and have them saved during apply. - childSetValue("AscentInstantMessageResponseRepeat", gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat")); - childSetValue("AutoresponseAnyone", gSavedPerAccountSettings.getBOOL("AutoresponseAnyone")); - childSetValue("AutoresponseAnyoneFriendsOnly", gSavedPerAccountSettings.getBOOL("AutoresponseAnyoneFriendsOnly")); - childSetValue("AutoresponseAnyoneItem", gSavedPerAccountSettings.getBOOL("AutoresponseAnyoneItem")); - childSetValue("AutoresponseAnyoneMessage", gSavedPerAccountSettings.getString("AutoresponseAnyoneMessage")); - childSetValue("AutoresponseAnyoneShow", gSavedPerAccountSettings.getBOOL("AutoresponseAnyoneShow")); - childSetValue("AutoresponseNonFriends", gSavedPerAccountSettings.getBOOL("AutoresponseNonFriends")); - childSetValue("AutoresponseNonFriendsItem", gSavedPerAccountSettings.getBOOL("AutoresponseNonFriendsItem")); - childSetValue("AutoresponseNonFriendsMessage", gSavedPerAccountSettings.getString("AutoresponseNonFriendsMessage")); - childSetValue("AutoresponseNonFriendsShow", gSavedPerAccountSettings.getBOOL("AutoresponseNonFriendsShow")); - childSetValue("AutoresponseMuted", gSavedPerAccountSettings.getBOOL("AutoresponseMuted")); - childSetValue("AutoresponseMutedItem", gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem")); - childSetValue("AutoresponseMutedMessage", gSavedPerAccountSettings.getString("AutoresponseMutedMessage")); - childSetValue("AutoresponseMutedShow", gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow")); - childSetValue("BusyModeResponse", gSavedPerAccountSettings.getString("BusyModeResponse")); - childSetValue("BusyModeResponseItem", gSavedPerAccountSettings.getBOOL("BusyModeResponseItem")); - childSetValue("BusyModeResponseShow", gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")); - childSetEnabled("reset_antispam", started); getChild("reset_antispam")->setCommitCallback(boost::bind(NACLAntiSpamRegistry::purgeAllQueues)); @@ -274,28 +255,28 @@ void LLPrefsAscentChat::refreshValues() mSpeakerNames = gSavedSettings.getS32("SpeakerNameSystem"); //Autoresponse ------------------------------------------------------------------------ - mIMResponseAnyoneItemID = gSavedPerAccountSettings.getString("AutoresponseAnyoneItemID"); - mIMResponseNonFriendsItemID = gSavedPerAccountSettings.getString("AutoresponseNonFriendsItemID"); - mIMResponseMutedItemID = gSavedPerAccountSettings.getString("AutoresponseMutedItemID"); - mIMResponseBusyItemID = gSavedPerAccountSettings.getString("BusyModeResponseItemID"); - - gSavedPerAccountSettings.setBOOL("AscentInstantMessageResponseRepeat", childGetValue("AscentInstantMessageResponseRepeat")); - gSavedPerAccountSettings.setBOOL("AutoresponseAnyone", childGetValue("AutoresponseAnyone")); - gSavedPerAccountSettings.setBOOL("AutoresponseAnyoneFriendsOnly", childGetValue("AutoresponseAnyoneFriendsOnly")); - gSavedPerAccountSettings.setBOOL("AutoresponseAnyoneItem", childGetValue("AutoresponseAnyoneItem")); - gSavedPerAccountSettings.setString("AutoresponseAnyoneMessage", childGetValue("AutoresponseAnyoneMessage")); - gSavedPerAccountSettings.setBOOL("AutoresponseAnyoneShow", childGetValue("AutoresponseAnyoneShow")); - gSavedPerAccountSettings.setBOOL("AutoresponseNonFriends", childGetValue("AutoresponseNonFriends")); - gSavedPerAccountSettings.setBOOL("AutoresponseNonFriendsItem", childGetValue("AutoresponseNonFriendsItem")); - gSavedPerAccountSettings.setString("AutoresponseNonFriendsMessage", childGetValue("AutoresponseNonFriendsMessage")); - gSavedPerAccountSettings.setBOOL("AutoresponseNonFriendsShow", childGetValue("AutoresponseNonFriendsShow")); - gSavedPerAccountSettings.setBOOL("AutoresponseMuted", childGetValue("AutoresponseMuted")); - gSavedPerAccountSettings.setBOOL("AutoresponseMutedItem", childGetValue("AutoresponseMutedItem")); - gSavedPerAccountSettings.setString("AutoresponseMutedMessage", childGetValue("AutoresponseMutedMessage")); - gSavedPerAccountSettings.setBOOL("AutoresponseMutedShow", childGetValue("AutoresponseMutedShow")); - gSavedPerAccountSettings.setString("BusyModeResponse", childGetValue("BusyModeResponse")); - gSavedPerAccountSettings.setBOOL("BusyModeResponseItem", childGetValue("BusyModeResponseItem")); - gSavedPerAccountSettings.setBOOL("BusyModeResponseShow", childGetValue("BusyModeResponseShow")); + mIMResponseRepeat = gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat"); + mIMResponseAway = gSavedPerAccountSettings.getBOOL("AutoresponseOnlyIfAway"); + mIMResponseAnyone = gSavedPerAccountSettings.getBOOL("AutoresponseAnyone"); + mIMResponseAnyoneFriends = gSavedPerAccountSettings.getBOOL("AutoresponseAnyoneFriendsOnly"); + mIMResponseAnyoneItem = gSavedPerAccountSettings.getBOOL("AutoresponseAnyoneItem"); + mIMResponseAnyoneItemID = gSavedPerAccountSettings.getString("AutoresponseAnyoneItemID"); + mIMResponseAnyoneMessage = gSavedPerAccountSettings.getString("AutoresponseAnyoneMessage"); + mIMResponseAnyoneShow = gSavedPerAccountSettings.getBOOL("AutoresponseAnyoneShow"); + mIMResponseNonFriends = gSavedPerAccountSettings.getBOOL("AutoresponseNonFriends"); + mIMResponseNonFriendsItem = gSavedPerAccountSettings.getBOOL("AutoresponseNonFriendsItem"); + mIMResponseNonFriendsItemID = gSavedPerAccountSettings.getString("AutoresponseNonFriendsItemID"); + mIMResponseNonFriendsMessage = gSavedPerAccountSettings.getString("AutoresponseNonFriendsMessage"); + mIMResponseNonFriendsShow = gSavedPerAccountSettings.getBOOL("AutoresponseNonFriendsShow"); + mIMResponseMuted = gSavedPerAccountSettings.getBOOL("AutoresponseMuted"); + mIMResponseMutedItem = gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem"); + mIMResponseMutedItemID = gSavedPerAccountSettings.getString("AutoresponseMutedItemID"); + mIMResponseMutedMessage = gSavedPerAccountSettings.getString("AutoresponseMutedMessage"); + mIMResponseMutedShow = gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"); + mIMResponseBusyItem = gSavedPerAccountSettings.getBOOL("BusyModeResponseItem"); + mIMResponseBusyItemID = gSavedPerAccountSettings.getString("BusyModeResponseItemID"); + mIMResponseBusyMessage = gSavedPerAccountSettings.getString("BusyModeResponse"); + mIMResponseBusyShow = gSavedPerAccountSettings.getBOOL("BusyModeResponseShow"); //Spam -------------------------------------------------------------------------------- mEnableAS = gSavedSettings.getBOOL("AntiSpamEnabled"); @@ -514,12 +495,30 @@ void LLPrefsAscentChat::cancel() gSavedSettings.setS32("SpeakerNameSystem", mSpeakerNames); //Autoresponse ------------------------------------------------------------------------ - gSavedPerAccountSettings.setString("AutoresponseAnyoneItemID", mIMResponseAnyoneItemID); - gSavedPerAccountSettings.setString("AutoresponseNonFriendsItemID", mIMResponseNonFriendsItemID); - gSavedPerAccountSettings.setString("AutoresponseMutedItemID", mIMResponseMutedItemID); - gSavedPerAccountSettings.setString("BusyModeResponseItemID", mIMResponseBusyItemID); + gSavedPerAccountSettings.setBOOL("AscentInstantMessageResponseRepeat", mIMResponseRepeat); + gSavedPerAccountSettings.setBOOL("AutoresponseOnlyIfAway", mIMResponseAway); + gSavedPerAccountSettings.setBOOL("AutoresponseAnyone", mIMResponseAnyone); + gSavedPerAccountSettings.setBOOL("AutoresponseAnyoneFriendsOnly", mIMResponseAnyoneFriends); + gSavedPerAccountSettings.setBOOL("AutoresponseAnyoneItem", mIMResponseAnyoneItem); + gSavedPerAccountSettings.setString("AutoresponseAnyoneItemID", mIMResponseAnyoneItemID); + gSavedPerAccountSettings.setString("AutoresponseAnyoneMessage", mIMResponseAnyoneMessage); + gSavedPerAccountSettings.setBOOL("AutoresponseAnyoneShow", mIMResponseAnyoneShow); + gSavedPerAccountSettings.setBOOL("AutoresponseNonFriends", mIMResponseNonFriends); + gSavedPerAccountSettings.setBOOL("AutoresponseNonFriendsItem", mIMResponseNonFriendsItem); + gSavedPerAccountSettings.setString("AutoresponseNonFriendsItemID", mIMResponseNonFriendsItemID); + gSavedPerAccountSettings.setString("AutoresponseNonFriendsMessage", mIMResponseNonFriendsMessage); + gSavedPerAccountSettings.setBOOL("AutoresponseNonFriendsShow", mIMResponseNonFriendsShow); + gSavedPerAccountSettings.setBOOL("AutoresponseMuted", mIMResponseMuted); + gSavedPerAccountSettings.setBOOL("AutoresponseMutedItem", mIMResponseMutedItem); + gSavedPerAccountSettings.setString("AutoresponseMutedItemID", mIMResponseMutedItemID); + gSavedPerAccountSettings.setString("AutoresponseMutedMessage", mIMResponseMutedMessage); + gSavedPerAccountSettings.setBOOL("AutoresponseMutedShow", mIMResponseMutedShow); + gSavedPerAccountSettings.setBOOL("BusyModeResponseItem", mIMResponseBusyItem); + gSavedPerAccountSettings.setString("BusyModeResponseItemID", mIMResponseBusyItemID); + gSavedPerAccountSettings.setString("BusyModeResponse", mIMResponseBusyMessage); + gSavedPerAccountSettings.setBOOL("BusyModeResponseShow", mIMResponseBusyShow); - //Spam -------------------------------------------------------------------------------- + //Spam -------------------------------------------------------------------------------- gSavedSettings.setBOOL("AntiSpamEnabled", mEnableAS); gSavedSettings.setBOOL("_NACL_AntiSpamGlobalQueue", mGlobalQueue); gSavedSettings.setU32("_NACL_AntiSpamAmount", mChatSpamCount); diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index 709635d4f..7f0e4a87a 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -95,10 +95,28 @@ private: S32 mSpeakerNames; //Autoresponse ------------------------------------------------------------------------ + bool mIMResponseRepeat; + bool mIMResponseAway; + bool mIMResponseAnyone; + bool mIMResponseAnyoneFriends; + bool mIMResponseAnyoneItem; std::string mIMResponseAnyoneItemID; + std::string mIMResponseAnyoneMessage; + bool mIMResponseAnyoneShow; + bool mIMResponseNonFriends; + bool mIMResponseNonFriendsItem; std::string mIMResponseNonFriendsItemID; + std::string mIMResponseNonFriendsMessage; + bool mIMResponseNonFriendsShow; + bool mIMResponseMuted; + bool mIMResponseMutedItem; std::string mIMResponseMutedItemID; + std::string mIMResponseMutedMessage; + bool mIMResponseMutedShow; + bool mIMResponseBusyItem; std::string mIMResponseBusyItemID; + std::string mIMResponseBusyMessage; + bool mIMResponseBusyShow; //Spam -------------------------------------------------------------------------------- bool mEnableAS; diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index 278084f6e..a2c577d0d 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -144,6 +144,7 @@ void LLPrefsAscentSys::refreshValues() { //General ----------------------------------------------------------------------------- mDoubleClickTeleport = gSavedSettings.getBOOL("DoubleClickTeleport"); + mDoubleClickAutoPilot = gSavedSettings.getBOOL("DoubleClickAutoPilot"); mResetCameraAfterTP = gSavedSettings.getBOOL("OptionRotateCamAfterLocalTP"); mOffsetTPByUserHeight = gSavedSettings.getBOOL("OptionOffsetTPByAgentHeight"); mClearBeaconAfterTeleport = gSavedSettings.getBOOL("ClearBeaconAfterTeleport"); @@ -293,6 +294,7 @@ void LLPrefsAscentSys::cancel() { //General ----------------------------------------------------------------------------- gSavedSettings.setBOOL("DoubleClickTeleport", mDoubleClickTeleport); + gSavedSettings.setBOOL("DoubleClickAutoPilot", mDoubleClickAutoPilot); gSavedSettings.setBOOL("OptionRotateCamAfterLocalTP", mResetCameraAfterTP); gSavedSettings.setBOOL("OptionOffsetTPByAgentHeight", mOffsetTPByUserHeight); gSavedSettings.setBOOL("ClearBeaconAfterTeleport", mClearBeaconAfterTeleport); diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index c23023447..ae7a07cab 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -54,6 +54,7 @@ protected: private: //General ----------------------------------------------------------------------------- bool mDoubleClickTeleport; + bool mDoubleClickAutoPilot; bool mResetCameraAfterTP; bool mOffsetTPByUserHeight; bool mClearBeaconAfterTeleport; diff --git a/indra/newview/awavefront.cpp b/indra/newview/awavefront.cpp index f682c87ec..2c6e0127e 100644 --- a/indra/newview/awavefront.cpp +++ b/indra/newview/awavefront.cpp @@ -252,7 +252,7 @@ namespace asset_id_matches); // See if any of the inventory items matching this sculpt id are exportable - for (S32 i = 0; i < items.size(); i++) + for (U32 i = 0; i < items.size(); i++) { const LLPermissions item_permissions = items[i]->getPermissions(); if (item_permissions.allowExportBy(gAgentID, LFSimFeatureHandler::instance().exportPolicy())) diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 025f4fa1f..daeb07df5 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -16,7 +16,7 @@ * may be used to endorse or promote products derived from this * software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS AS IS + * THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS AS IS * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS @@ -41,6 +41,7 @@ #include "llagentcamera.h" #include "llagentui.h" #include "llavataractions.h" +#include "llnotificationsutil.h" #include "llviewerregion.h" #include "llworld.h" #include "lleventtimer.h" @@ -55,7 +56,7 @@ #include "llviewerobjectlist.h" #include "llviewertexteditor.h" #include "llviewermenu.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "lltooldraganddrop.h" #include "llinventorymodel.h" #include "llregioninfomodel.h" @@ -69,7 +70,6 @@ #include "rlvhandler.h" void cmdline_printchat(const std::string& message); -void cmdline_rezplat(bool use_saved_value = true, F32 visual_radius = 30.0); void cmdline_tp2name(std::string target); LLUUID cmdline_partial_name2key(std::string name); @@ -105,7 +105,7 @@ public: LLViewerInventoryItem* subj = instack.top(); instack.pop(); LLViewerObject *objectp = gObjectList.findObject(indest); - if(objectp) + if (objectp) { cmdline_printchat(std::string("dropping ")+subj->getName()); LLToolDragAndDrop::dropInventory(objectp,subj,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); @@ -147,7 +147,7 @@ public: LLSelectNode* node = (*itr); LLViewerObject* object = node->getObject(); U32 localid=object->getLocalID(); - if(done_prims.find(localid) == done_prims.end()) + if (done_prims.find(localid) == done_prims.end()) { done_prims.insert(localid); std::string name = llformat("%fx%fx%f",object->getScale().mV[VX],object->getScale().mV[VY],object->getScale().mV[VZ]); @@ -221,331 +221,355 @@ void spew_key_to_name(const LLUUID& targetKey, const LLAvatarName& av_name) { cmdline_printchat(llformat("%s: %s", targetKey.asString().c_str(), av_name.getNSName().c_str())); } -bool cmd_line_chat(std::string revised_text, EChatType type) +bool cmd_line_chat(std::string data, EChatType type) { - static LLCachedControl sAscentCmdLine(gSavedSettings, "AscentCmdLine"); - static LLCachedControl sAscentCmdLinePos(gSavedSettings, "AscentCmdLinePos"); - static LLCachedControl sAscentCmdLineDrawDistance(gSavedSettings, "AscentCmdLineDrawDistance"); - static LLCachedControl sAscentCmdTeleportToCam(gSavedSettings, "AscentCmdTeleportToCam"); - static LLCachedControl sAscentCmdLineKeyToName(gSavedSettings, "AscentCmdLineKeyToName"); - static LLCachedControl sAscentCmdLineOfferTp(gSavedSettings, "AscentCmdLineOfferTp"); - static LLCachedControl sAscentCmdLineGround(gSavedSettings, "AscentCmdLineGround"); - static LLCachedControl sAscentCmdLineHeight(gSavedSettings, "AscentCmdLineHeight"); - static LLCachedControl sAscentCmdLineTeleportHome(gSavedSettings, "AscentCmdLineTeleportHome"); - static LLCachedControl sAscentCmdLineRezPlatform(gSavedSettings, "AscentCmdLineRezPlatform"); - static LLCachedControl sAscentCmdLineMapTo(gSavedSettings, "AscentCmdLineMapTo"); - static LLCachedControl sAscentCmdLineMapToKeepPos(gSavedSettings, "AscentMapToKeepPos"); - static LLCachedControl sAscentCmdLineCalc(gSavedSettings, "AscentCmdLineCalc"); - static LLCachedControl sAscentCmdLineTP2(gSavedSettings, "AscentCmdLineTP2"); - static LLCachedControl sAscentCmdLineClearChat(gSavedSettings, "AscentCmdLineClearChat"); - static LLCachedControl sSinguCmdLineAway(gSavedSettings, "SinguCmdLineAway"); - static LLCachedControl sSinguCmdLineRegionSay(gSavedSettings, "SinguCmdLineRegionSay"); - static LLCachedControl sSinguCmdLineURL(gSavedSettings, "SinguCmdLineURL"); - static LLCachedControl sResyncAnimCommand(gSavedSettings, "AlchemyChatCommandResyncAnim", "/resync"); - static LLCachedControl sHoverHeight(gSavedSettings, "AlchemyChatCommandHoverHeight", "/hover"); - - if(sAscentCmdLine) + static LLCachedControl enableChatCmd(gSavedSettings, "AscentCmdLine", true); + if (enableChatCmd) { - std::istringstream i(revised_text); - std::string command; - i >> command; - command = utf8str_tolower(command); - if(command != "") - { - if(command == utf8str_tolower(sAscentCmdLinePos)) - { - F32 x,y,z; - if (i >> x) - { - if (i >> y) - { - if (!(i >> z)) - z = gAgent.getPositionAgent().mV[VZ]; + data = utf8str_tolower(data); + std::istringstream input(data); + std::string cmd; - if (LLViewerRegion* agentRegionp = gAgent.getRegion()) - { - LLVector3 targetPos(x,y,z); - LLVector3d pos_global = from_region_handle(agentRegionp->getHandle()); - pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]); - gAgent.teleportViaLocation(pos_global); - return false; - } + if (!(input >> cmd)) return true; + + static LLCachedControl sDrawDistanceCommand(gSavedSettings, "AscentCmdLineDrawDistance"); + static LLCachedControl sHeightCommand(gSavedSettings, "AscentCmdLineHeight"); + static LLCachedControl sGroundCommand(gSavedSettings, "AscentCmdLineGround"); + static LLCachedControl sPosCommand(gSavedSettings, "AscentCmdLinePos"); + static LLCachedControl sRezPlatCommand(gSavedSettings, "AscentCmdLineRezPlatform"); + static LLCachedControl sHomeCommand(gSavedSettings, "AscentCmdLineTeleportHome"); + static LLCachedControl sCalcCommand(gSavedSettings, "AscentCmdLineCalc"); + static LLCachedControl sMapToCommand(gSavedSettings, "AscentCmdLineMapTo"); + static LLCachedControl sClearCommand(gSavedSettings, "AscentCmdLineClearChat"); + static LLCachedControl sRegionMsgCommand(gSavedSettings, "SinguCmdLineRegionSay"); + static LLCachedControl sTeleportToCam(gSavedSettings, "AscentCmdTeleportToCam"); + static LLCachedControl sHoverHeight(gSavedSettings, "AlchemyChatCommandHoverHeight", "/hover"); + static LLCachedControl sResyncAnimCommand(gSavedSettings, "AlchemyChatCommandResyncAnim", "/resync"); + static LLCachedControl sKeyToName(gSavedSettings, "AscentCmdLineKeyToName"); + static LLCachedControl sOfferTp(gSavedSettings, "AscentCmdLineOfferTp"); + static LLCachedControl sTP2Command(gSavedSettings, "AscentCmdLineTP2"); + static LLCachedControl sAwayCommand(gSavedSettings, "SinguCmdLineAway"); + static LLCachedControl sURLCommand(gSavedSettings, "SinguCmdLineURL"); + + if (cmd == utf8str_tolower(sDrawDistanceCommand)) // dd + { + int drawDist; + if (input >> drawDist) + { + gSavedSettings.setF32("RenderFarClip", drawDist); + gAgentCamera.mDrawDistance=drawDist; + char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ + snprintf(buffer,sizeof(buffer),"Draw distance set to: %dm",drawDist); + cmdline_printchat(std::string(buffer)); + return false; + } + } + else if (cmd == utf8str_tolower(sHeightCommand)) // gth + { + F64 z; + if (input >> z) + { + LLVector3d pos_global = gAgent.getPositionGlobal(); + pos_global.mdV[VZ] = z; + gAgent.teleportViaLocationLookAt(pos_global); + return false; + } + } + else if (cmd == utf8str_tolower(sGroundCommand)) // flr + { + LLVector3d pos_global = gAgent.getPositionGlobal(); + pos_global.mdV[VZ] = 0.0; + gAgent.teleportViaLocationLookAt(pos_global); + return false; + } + else if (cmd == utf8str_tolower(sPosCommand)) // pos + { + F32 x,y,z; + if ((input >> x) && (input >> y)) + { + if (!(input >> z)) + z = gAgent.getPositionAgent().mV[VZ]; + + if (LLViewerRegion* regionp = gAgent.getRegion()) + { + LLVector3d target_pos = regionp->getPosGlobalFromRegion(LLVector3((F32) x, (F32) y, (F32) z)); + gAgent.teleportViaLocationLookAt(target_pos); + return false; + } + } + } + else if (cmd == utf8str_tolower(sRezPlatCommand)) // plat + { + F32 size; + static LLCachedControl platSize(gSavedSettings, "AscentPlatformSize"); + if (!(input >> size)) + size = static_cast(platSize); + + const LLVector3& agent_pos = gAgent.getPositionAgent(); + const LLVector3 rez_pos(agent_pos.mV[VX], agent_pos.mV[VY], agent_pos.mV[VZ] - ((gAgentAvatarp->getScale().mV[VZ] / 2.f) + 0.25f + (gAgent.getVelocity().magVec() * 0.333))); + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ObjectAdd); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID()); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU8Fast(_PREHASH_PCode, LL_PCODE_VOLUME); + msg->addU8Fast(_PREHASH_Material, LL_MCODE_METAL); + msg->addU32Fast(_PREHASH_AddFlags, agent_pos.mV[VZ] > 4096.f ? FLAGS_CREATE_SELECTED : 0U); + + LLVolumeParams volume_params; + volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE_33); + volume_params.setRatio(2, 2); + volume_params.setShear(0, 0); + volume_params.setTaper(2.0f,2.0f); + volume_params.setTaperX(0.f); + volume_params.setTaperY(0.f); + LLVolumeMessage::packVolumeParams(&volume_params, msg); + + size /= 3; + msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.01f, size, size)); + msg->addQuatFast(_PREHASH_Rotation, LLQuaternion(90.f * DEG_TO_RAD, LLVector3::y_axis)); + msg->addVector3Fast(_PREHASH_RayStart, rez_pos); + msg->addVector3Fast(_PREHASH_RayEnd, rez_pos); + msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null); + msg->addU8Fast(_PREHASH_BypassRaycast, TRUE); + msg->addU8Fast(_PREHASH_RayEndIsIntersection, FALSE); + msg->addU8Fast(_PREHASH_State, FALSE); + msg->sendReliable(gAgent.getRegionHost()); + + return false; + } + else if (cmd == utf8str_tolower(sHomeCommand)) // home + { + gAgent.teleportHome(); + return false; + } + else if (cmd == utf8str_tolower(sCalcCommand))//Cryogenic Blitz + { + if (data.length() > cmd.length() + 1) + { + F32 result = 0.f; + std::string expr = data.substr(cmd.length() + 1); + LLStringUtil::toUpper(expr); + if (LLCalc::getInstance()->evalString(expr, result)) + { + // Replace the expression with the result + LLSD args; + args["EXPRESSION"] = expr; + args["RESULT"] = result; + LLNotificationsUtil::add("ChatCommandCalc", args); + return false; + } + LLNotificationsUtil::add("ChatCommandCalcFailed"); + return false; + } + } + else if (cmd == utf8str_tolower(sMapToCommand)) + { + const std::string::size_type length = cmd.length() + 1; + if (data.length() > length) + { + LLSLURL slurl(LLWeb::escapeURL(data.substr(length))); + // The user wants to keep their position between MapTos and they have not passed a position (position is defaulted) + static LLCachedControl sMapToKeepPos(gSavedSettings, "AscentMapToKeepPos"); + if (sMapToKeepPos && slurl.getPosition() == LLVector3(REGION_WIDTH_METERS/2, REGION_WIDTH_METERS/2, 0)) + { + LLVector3d agentPos = gAgent.getPositionGlobal(); + slurl = LLSLURL(slurl.getRegion(), LLVector3(fmod(agentPos.mdV[VX], (F64)REGION_WIDTH_METERS), fmod(agentPos.mdV[VY], (F64)REGION_WIDTH_METERS), agentPos.mdV[VZ])); + } + + LLUrlAction::teleportToLocation(LLWeb::escapeURL(std::string("secondlife:///app/teleport/")+slurl.getLocationString())); + } + return false; + } + else if (cmd == utf8str_tolower(sClearCommand)) + { + LLFloaterChat* nearby_chat = LLFloaterChat::getInstance(); + if (nearby_chat) + { + if (LLViewerTextEditor* editor = nearby_chat->getChild("Chat History Editor")) + editor->clear(); + if (LLViewerTextEditor* editor = nearby_chat->getChild("Chat History Editor with mute")) + editor->clear(); + return false; + } + } + else if (cmd == "/droll") + { + S32 dice_sides; + if (!(input >> dice_sides)) + dice_sides = 6; + LLSD args; + args["RESULT"] = ((ll_rand() % dice_sides) + 1); + LLNotificationsUtil::add("ChatCommandDiceRoll", args); + return false; + } + else if (cmd == utf8str_tolower(sRegionMsgCommand)) // Region Message / Dialog + { + if (data.length() > cmd.length() + 1) + { + std::string notification_message = data.substr(cmd.length() + 1); + if (!gAgent.getRegion()->isEstateManager()) + { + gChatBar->sendChatFromViewer(notification_message, CHAT_TYPE_REGION, false); + return false; + } + std::vector strings(5, "-1"); + // [0] grid_x, unused here + // [1] grid_y, unused here + strings[2] = gAgentID.asString(); // [2] agent_id of sender + // [3] sender name + std::string name; + LLAgentUI::buildFullname(name); + strings[3] = name; + strings[4] = notification_message; // [4] message + LLRegionInfoModel::sendEstateOwnerMessage(gMessageSystem, "simulatormessage", LLFloaterRegionInfo::getLastInvoice(), strings); + } + return false; + } + else if (cmd == utf8str_tolower(sTeleportToCam)) + { + gAgent.teleportViaLocation(gAgentCamera.getCameraPositionGlobal()); + return false; + } + else if (cmd == utf8str_tolower(sHoverHeight)) // Hover height + { + F32 height; + if (input >> height) + { + gSavedPerAccountSettings.set("AvatarHoverOffsetZ", + llclamp(height, MIN_HOVER_Z, MAX_HOVER_Z)); + return false; + } + } + else if (cmd == utf8str_tolower(sResyncAnimCommand)) // Resync Animations + { + for (S32 i = 0; i < gObjectList.getNumObjects(); i++) + { + LLViewerObject* object = gObjectList.getObject(i); + if (object && object->isAvatar()) + { + LLVOAvatar& avatarp = *(LLVOAvatar*)object; + for (LLVOAvatar::AnimIterator it = avatarp.mPlayingAnimations.begin(), end = avatarp.mPlayingAnimations.end(); it != end; ++it) + { + const std::pair& playpair = *it; + avatarp.stopMotion(playpair.first, TRUE); + avatarp.startMotion(playpair.first); } } } - else if(command == utf8str_tolower(sAscentCmdLineDrawDistance)) + return false; + } + else if (cmd == utf8str_tolower(sKeyToName)) + { + LLUUID targetKey; + if (input >> targetKey) { - int drawDist; - if(i >> drawDist) + LLAvatarName av_name; + if (!LLAvatarNameCache::get(targetKey, &av_name)) + { + LLAvatarNameCache::get(targetKey, boost::bind(spew_key_to_name, _1, _2)); + return false; + } + spew_key_to_name(targetKey, av_name); + } + return false; + } + else if (cmd == utf8str_tolower(sOfferTp)) + { + std::string avatarKey; +// LL_INFOS() << "CMD DEBUG 0 " << cmd << " " << avatarName << LL_ENDL; + if (input >> avatarKey) + { +// LL_INFOS() << "CMD DEBUG 0 afterif " << cmd << " " << avatarName << LL_ENDL; + LLUUID tempUUID; + if (LLUUID::parseUUID(avatarKey, &tempUUID)) { - gSavedSettings.setF32("RenderFarClip", drawDist); - gAgentCamera.mDrawDistance=drawDist; char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ - snprintf(buffer,sizeof(buffer),"Draw distance set to: %dm",drawDist); + std::string tpMsg="Join me!"; + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_StartLure); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Info); + msg->addU8Fast(_PREHASH_LureType, (U8)0); + + msg->addStringFast(_PREHASH_Message, tpMsg); + msg->nextBlockFast(_PREHASH_TargetData); + msg->addUUIDFast(_PREHASH_TargetID, tempUUID); + gAgent.sendReliableMessage(); + snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str()); cmdline_printchat(std::string(buffer)); return false; } } - else if(command == utf8str_tolower(sAscentCmdTeleportToCam)) - { - gAgent.teleportViaLocation(gAgentCamera.getCameraPositionGlobal()); - return false; - } - else if(command == utf8str_tolower(sAscentCmdLineKeyToName)) - { - LLUUID targetKey; - if(i >> targetKey) - { - LLAvatarName av_name; - if (!LLAvatarNameCache::get(targetKey, &av_name)) - { - LLAvatarNameCache::get(targetKey, boost::bind(spew_key_to_name, _1, _2)); - return false; - } - spew_key_to_name(targetKey, av_name); - } - return false; - } - else if(command == utf8str_tolower(sAscentCmdLineOfferTp)) - { - std::string avatarKey; -// LL_INFOS() << "CMD DEBUG 0 " << command << " " << avatarName << LL_ENDL; - if(i >> avatarKey) - { -// LL_INFOS() << "CMD DEBUG 0 afterif " << command << " " << avatarName << LL_ENDL; - LLUUID tempUUID; - if(LLUUID::parseUUID(avatarKey, &tempUUID)) - { - char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ - std::string tpMsg="Join me!"; - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_StartLure); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Info); - msg->addU8Fast(_PREHASH_LureType, (U8)0); - - msg->addStringFast(_PREHASH_Message, tpMsg); - msg->nextBlockFast(_PREHASH_TargetData); - msg->addUUIDFast(_PREHASH_TargetID, tempUUID); - gAgent.sendReliableMessage(); - snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str()); - cmdline_printchat(std::string(buffer)); - return false; - } - } - } - else if(command == utf8str_tolower(sAscentCmdLineGround)) - { - LLVector3 agentPos = gAgent.getPositionAgent(); - U64 agentRegion = gAgent.getRegion()->getHandle(); - LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],LLWorld::getInstance()->resolveLandHeightAgent(agentPos)); - LLVector3d pos_global = from_region_handle(agentRegion); - pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]); - gAgent.teleportViaLocation(pos_global); - return false; - } - else if(command == utf8str_tolower(sAscentCmdLineHeight)) - { - F32 z; - if(i >> z) - { - LLVector3 agentPos = gAgent.getPositionAgent(); - U64 agentRegion = gAgent.getRegion()->getHandle(); - LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],z); - LLVector3d pos_global = from_region_handle(agentRegion); - pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]); - gAgent.teleportViaLocation(pos_global); - return false; - } - } - else if(command == utf8str_tolower(sAscentCmdLineTeleportHome)) - { - gAgent.teleportHome(); - return false; - } - else if(command == utf8str_tolower(sAscentCmdLineRezPlatform)) - { - F32 width; - if (i >> width) cmdline_rezplat(false, width); - else cmdline_rezplat(); - return false; - } - else if(command == utf8str_tolower(sAscentCmdLineMapTo)) - { - if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek - { - LLSLURL slurl(LLWeb::escapeURL(revised_text.substr(command.length()+1))); - - // The user wants to keep their position between MapTos and they have not passed a position (position is defaulted) - if (sAscentCmdLineMapToKeepPos && slurl.getPosition() == LLVector3(REGION_WIDTH_METERS/2, REGION_WIDTH_METERS/2, 0)) - { - LLVector3d agentPos = gAgent.getPositionGlobal(); - slurl = LLSLURL(slurl.getRegion(), LLVector3(fmod(agentPos.mdV[VX], (F64)REGION_WIDTH_METERS), fmod(agentPos.mdV[VY], (F64)REGION_WIDTH_METERS), agentPos.mdV[VZ])); - } - - LLUrlAction::teleportToLocation(LLWeb::escapeURL(std::string("secondlife:///app/teleport/")+slurl.getLocationString())); - } - return false; - } - else if(command == utf8str_tolower(sAscentCmdLineCalc))//Cryogenic Blitz - { - bool success; - F32 result = 0.f; - if(revised_text.length() > command.length() + 1) - { - - std::string expr = revised_text.substr(command.length()+1); - LLStringUtil::toUpper(expr); - success = LLCalc::getInstance()->evalString(expr, result); - - std::string out; - - if (!success) - { - out = "Calculation Failed"; - } - else - { - // Replace the expression with the result - std::ostringstream result_str; - result_str << expr; - result_str << " = "; - result_str << result; - out = result_str.str(); - } - cmdline_printchat(out); - return false; - } - } - else if(command == utf8str_tolower(sAscentCmdLineTP2)) - { - if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek - { - std::string name = revised_text.substr(command.length()+1); - cmdline_tp2name(name); - } - return false; - } - else if(command == utf8str_tolower(sSinguCmdLineAway)) - { - handle_fake_away_status(NULL); - return false; - } - else if(command == utf8str_tolower(sSinguCmdLineURL)) - { - if (revised_text.length() > command.length() + 1) - { - const std::string sub(revised_text.substr(command.length()+1)); - LLUUID id; - if (id.parseUUID(sub, &id)) - { - LLAvatarActions::showProfile(id); - return false; - } - LLUrlAction::clickAction(sub); - } - return false; - } - else if(command == utf8str_tolower(sSinguCmdLineRegionSay)) - { - if (revised_text.length() > command.length() + 1) - { - const std::string& message = revised_text.substr(command.length()+1); - if (!gAgent.getRegion()->isEstateManager()) - { - gChatBar->sendChatFromViewer(message, CHAT_TYPE_REGION, false); - return false; - } - std::vector strings(5, "-1"); - // [0] grid_x, unused here - // [1] grid_y, unused here - strings[2] = gAgentID.asString(); // [2] agent_id of sender - // [3] sender name - std::string name; - LLAgentUI::buildFullname(name); - strings[3] = name; - strings[4] = message; // [4] message - LLRegionInfoModel::sendEstateOwnerMessage(gMessageSystem, "simulatormessage", LLFloaterRegionInfo::getLastInvoice(), strings); - } - return false; - } - else if (command == utf8str_tolower(sHoverHeight)) // Hover height - { - F32 height; - if (i >> height) - { - gSavedPerAccountSettings.set("AvatarHoverOffsetZ", - llclamp(height, MIN_HOVER_Z, MAX_HOVER_Z)); - return false; - } - } - else if (command == utf8str_tolower(sResyncAnimCommand)) // Resync Animations - { - for (S32 i = 0; i < gObjectList.getNumObjects(); i++) - { - LLViewerObject* object = gObjectList.getObject(i); - if (object && object->isAvatar()) - { - LLVOAvatar& avatarp = *(LLVOAvatar*)object; - for (LLVOAvatar::AnimIterator it = avatarp.mPlayingAnimations.begin(), end = avatarp.mPlayingAnimations.end(); it != end; ++it) - { - const std::pair& playpair = *it; - avatarp.stopMotion(playpair.first, TRUE); - avatarp.startMotion(playpair.first); - } - } - } - return false; - } - else if(command == "typingstop") - { - std::string text; - if(i >> text) - { - gChatBar->sendChatFromViewer(text, CHAT_TYPE_STOP, FALSE); - } - return false; - } - else if(command == utf8str_tolower(sAscentCmdLineClearChat)) - { - LLFloaterChat* chat = LLFloaterChat::getInstance(LLSD()); - if(chat) - { - LLViewerTextEditor* history_editor = chat->getChild("Chat History Editor"); - LLViewerTextEditor* history_editor_with_mute = chat->getChild("Chat History Editor with mute"); - history_editor->clear(); - history_editor_with_mute->clear(); - return false; - } - } - else if(command == "invrepair") - { - invrepair(); - return false; - } -#ifdef PROF_CTRL_CALLS - else if(command == "dumpcalls") - { - LLControlGroup::key_iter it = LLControlGroup::beginKeys(); - LLControlGroup::key_iter end = LLControlGroup::endKeys(); - for(;it!=end;++it) - { - ProfCtrlListAccum list; - LLControlGroup::getInstance(*it)->applyToAll(&list); - std::sort(list.mVariableList.begin(),list.mVariableList.end(),sort_calls); - LL_INFOS("") << *it << ": lookup count (" << gFrameCount << "frames)" << LL_ENDL; - for(U32 i = 0;i cmd.length() + 1) //Typing this cmd with no argument was causing a crash. -Madgeek + { + std::string name = data.substr(cmd.length()+1); + cmdline_tp2name(name); + } + return false; + } + else if (cmd == utf8str_tolower(sAwayCommand)) + { + handle_fake_away_status(NULL); + return false; + } + else if (cmd == utf8str_tolower(sURLCommand)) + { + if (data.length() > cmd.length() + 1) + { + const std::string sub(data.substr(cmd.length()+1)); + LLUUID id; + if (id.parseUUID(sub, &id)) + { + LLAvatarActions::showProfile(id); + return false; + } + LLUrlAction::clickAction(sub); + } + return false; + } + else if (cmd == "typingstop") + { + std::string text; + if (input >> text) + { + gChatBar->sendChatFromViewer(text, CHAT_TYPE_STOP, FALSE); + } + return false; + } + else if (cmd == "invrepair") + { + invrepair(); + return false; + } +#ifdef PROF_CTRL_CALLS + else if (cmd == "dumpcalls") + { + LLControlGroup::key_iter it = LLControlGroup::beginKeys(); + LLControlGroup::key_iter end = LLControlGroup::endKeys(); + for(;it!=end;++it) + { + ProfCtrlListAccum list; + LLControlGroup::getInstance(*it)->applyToAll(&list); + std::sort(list.mVariableList.begin(),list.mVariableList.end(),sort_calls); + LL_INFOS() << *it << ": lookup count (" << gFrameCount << "frames)" << LL_ENDL; + for(U32 i = 0;igetPositionGlobal(); pos.mdV[VZ] += 2.0; gAgent.teleportViaLocation(pos); } - else if(avlist) + else if (avlist) { LLAvatarListEntry* entry = avlist->getAvatarEntry(avkey); - if(entry) + if (entry) { LLVector3d pos = entry->getPosition(); pos.mdV[VZ] += 2.0; @@ -604,58 +628,6 @@ void cmdline_tp2name(std::string target) } } -void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat() will still work... just will use the saved value -{ - LLVector3 agentPos = gAgent.getPositionAgent()+(gAgent.getVelocity()*(F32)0.333); - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ObjectAdd); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID()); - msg->nextBlockFast(_PREHASH_ObjectData); - msg->addU8Fast(_PREHASH_PCode, LL_PCODE_VOLUME); - msg->addU8Fast(_PREHASH_Material, LL_MCODE_METAL); - - if(agentPos.mV[2] > 4096.0) - msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED); - else - msg->addU32Fast(_PREHASH_AddFlags, 0); - - LLVolumeParams volume_params; - - volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE_33 ); - volume_params.setRatio( 2, 2 ); - volume_params.setShear( 0, 0 ); - volume_params.setTaper(2.0f,2.0f); - volume_params.setTaperX(0.f); - volume_params.setTaperY(0.f); - - LLVolumeMessage::packVolumeParams(&volume_params, msg); - LLVector3 rezpos = agentPos - LLVector3(0.0f,0.0f,2.5f); - LLQuaternion rotation; - rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis); - - if (use_saved_value) - { - visual_radius = gSavedSettings.getF32("AscentPlatformSize"); - } - - F32 realsize = visual_radius / 3.0f; - if (realsize < 0.01f) realsize = 0.01f; - else if (realsize > 10.0f) realsize = 10.0f; - - msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.01f,realsize,realsize) ); - msg->addQuatFast(_PREHASH_Rotation, rotation ); - msg->addVector3Fast(_PREHASH_RayStart, rezpos ); - msg->addVector3Fast(_PREHASH_RayEnd, rezpos ); - msg->addU8Fast(_PREHASH_BypassRaycast, (U8)1 ); - msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE ); - msg->addU8Fast(_PREHASH_State, 0); - msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null ); - msg->sendReliable(gAgent.getRegionHost()); -} - void cmdline_printchat(const std::string& message) { LLChat chat(message); diff --git a/indra/newview/floaterao.cpp b/indra/newview/floaterao.cpp index e254a8f3b..0d584e6e5 100644 --- a/indra/newview/floaterao.cpp +++ b/indra/newview/floaterao.cpp @@ -192,13 +192,13 @@ LLFloaterAO::LLFloaterAO() { // init(); llassert_always(sInstance == NULL); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_ao.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_ao.xml"); sInstance = this; } LLFloaterAO::~LLFloaterAO() { - sInstance=NULL; + sInstance=NULL; mcomboBox_stands = 0; mcomboBox_walks = 0; mcomboBox_runs = 0; @@ -221,7 +221,7 @@ LLFloaterAO::~LLFloaterAO() void LLFloaterAO::show(void*) { - if (!sInstance) + if (!sInstance) { sInstance = new LLFloaterAO(); updateLayout(sInstance); diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py index c1fd05935..d351c406b 100644 --- a/indra/newview/generate_breakpad_symbols.py +++ b/indra/newview/generate_breakpad_symbols.py @@ -31,7 +31,6 @@ $/LicenseInfo$ import collections import fnmatch import itertools -import operator import os import re import sys @@ -83,15 +82,10 @@ def main(configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, v def dump_module(m): print "dumping module '%s' with '%s'..." % (m, dump_syms_tool) dsym_full_path = m - - tools = dump_syms_tool.split('|') - for tool in tools: - if tool: - if os.path.isfile(tool): - child = subprocess.Popen([tool, dsym_full_path] , stdout=subprocess.PIPE) - out, err = child.communicate() - return (m,child.returncode, out, err) - raise IOError('Failed to find dump_syms tool!') + child = subprocess.Popen([dump_syms_tool, dsym_full_path] , stdout=subprocess.PIPE) + out, err = child.communicate() + return (m,child.returncode, out, err) + modules = {} @@ -154,7 +148,7 @@ def main(configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, v == os.path.splitext(os.path.basename(m))[0].lower() # there must be at least one .sym file in tarfile_members that matches # each required module (ignoring file extensions) - if not reduce(operator.or_, itertools.imap(match_module_basename, tarfile_members)): + if not any(itertools.imap(match_module_basename, tarfile_members)): print >> sys.stderr, "failed to find required %s in generated %s" \ % (required_module, viewer_symbol_file) os.remove(viewer_symbol_file) diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt index 45beb85a5..32450b609 100644 --- a/indra/newview/gpu_table.txt +++ b/indra/newview/gpu_table.txt @@ -433,6 +433,8 @@ NVIDIA GTX 750 .*NVIDIA .*GTX *75.* 3 1 NVIDIA GTX 760 .*NVIDIA .*GTX *76.* 3 1 NVIDIA GTX 770 .*NVIDIA .*GTX *77.* 3 1 NVIDIA GTX 780 .*NVIDIA .*GTX *78.* 3 1 +NVIDIA GTX 970 .*NVIDIA .*GTX *97.* 3 1 +NVIDIA GTX 980 .*NVIDIA .*GTX *98.* 3 1 NVIDIA GTX TITAN .*NVIDIA .*GTX *TITAN.* 3 1 NVIDIA GT 7xxM .*NVIDIA .*GT *7.* 3 1 NVIDIA C51 .*NVIDIA .*C51.* 0 1 diff --git a/indra/newview/hippogridmanager.cpp b/indra/newview/hippogridmanager.cpp index 811aa3555..5295aac95 100644 --- a/indra/newview/hippogridmanager.cpp +++ b/indra/newview/hippogridmanager.cpp @@ -56,7 +56,6 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) : mIsInProductionGrid(false), mIsInAvination(false), mRenderCompat(true), - mInvLinks(false), mAutoUpdate(false), mLocked(false), mMaxAgentGroups(-1), @@ -536,23 +535,6 @@ void HippoGridInfo::initFallback() FALLBACK_GRIDINFO.setHelperUri("http://127.0.0.1:9000/"); } -bool HippoGridInfo::supportsInvLinks() -{ - if(isSecondLife()) - return true; - else - return mInvLinks; -} - -void HippoGridInfo::setSupportsInvLinks(bool b) -{ - if (b == true && mInvLinks == false) - { - LL_INFOS() << "Inventory Link support detected" << LL_ENDL; - } - mInvLinks = b; -} - bool HippoGridInfo::getAutoUpdate() { if(isSecondLife()) @@ -915,7 +897,6 @@ void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); - if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]); if (gridMap.has("auto_update")) grid->mAutoUpdate = gridMap["auto_update"]; if (gridMap.has("locked")) grid->mLocked = gridMap["locked"]; if (newGrid) addGrid(grid); @@ -952,7 +933,6 @@ void HippoGridManager::saveFile() gridInfo[i]["search"] = grid->getSearchUrl(); gridInfo[i]["render_compat"] = grid->isRenderCompat(); - gridInfo[i]["inventory_links"] = grid->supportsInvLinks(); gridInfo[i]["auto_update"] = grid->getAutoUpdate(); gridInfo[i]["locked"] = grid->getLocked(); } diff --git a/indra/newview/hippogridmanager.h b/indra/newview/hippogridmanager.h index c28e6b6ce..450cc35f7 100644 --- a/indra/newview/hippogridmanager.h +++ b/indra/newview/hippogridmanager.h @@ -90,8 +90,6 @@ public: void setRealCurrencySymbol(const std::string& sym); void setClassifiedFee(int fee) { mClassifiedFee = fee; } void setDirectoryFee(int fee) { mDirectoryFee = fee; } - bool supportsInvLinks(); - void setSupportsInvLinks(bool b); bool getAutoUpdate(); bool getLocked() { return mLocked; } @@ -119,7 +117,6 @@ private: bool mIsInProductionGrid; bool mIsInAvination; bool mRenderCompat; - bool mInvLinks; bool mAutoUpdate; bool mLocked; bool mUPCSupported; diff --git a/indra/newview/icons/default/viewer.icns b/indra/newview/icons/default/viewer.icns new file mode 100644 index 000000000..28e5a4f44 Binary files /dev/null and b/indra/newview/icons/default/viewer.icns differ diff --git a/indra/newview/installers/windows/install_icon_singularity.ico b/indra/newview/icons/default/viewer.ico similarity index 100% rename from indra/newview/installers/windows/install_icon_singularity.ico rename to indra/newview/icons/default/viewer.ico diff --git a/indra/newview/icons/default/viewer.png b/indra/newview/icons/default/viewer.png new file mode 100644 index 000000000..ae3d64aa3 Binary files /dev/null and b/indra/newview/icons/default/viewer.png differ diff --git a/indra/newview/res-sdl/singularity_icon.BMP b/indra/newview/icons/default/viewer_256.BMP similarity index 100% rename from indra/newview/res-sdl/singularity_icon.BMP rename to indra/newview/icons/default/viewer_256.BMP diff --git a/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt b/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt deleted file mode 100644 index 30f934911..000000000 --- a/indra/newview/installers/windows/FILES_ARE_UNICODE_UTF-16LE.txt +++ /dev/null @@ -1,6 +0,0 @@ -The language files in this directory are Unicode (Little-Endian) format, also known as UTF-16 LE. - -This is the format required for NSIS Unicode. See http://www.scratchpaper.com/ for details. - -James Cook -September 2008 diff --git a/indra/newview/installers/windows/install_icon.ico b/indra/newview/installers/windows/install_icon.ico index 1e00530c9..84a455a22 100644 Binary files a/indra/newview/installers/windows/install_icon.ico and b/indra/newview/installers/windows/install_icon.ico differ diff --git a/indra/newview/installers/windows/install_icon_singularity.BMP b/indra/newview/installers/windows/install_icon_singularity.BMP deleted file mode 100644 index 09df57387..000000000 Binary files a/indra/newview/installers/windows/install_icon_singularity.BMP and /dev/null differ diff --git a/indra/newview/installers/windows/install_icon_snowglobe.BMP b/indra/newview/installers/windows/install_icon_snowglobe.BMP deleted file mode 100644 index 86817c541..000000000 Binary files a/indra/newview/installers/windows/install_icon_snowglobe.BMP and /dev/null differ diff --git a/indra/newview/installers/windows/install_icon_snowglobe.ico b/indra/newview/installers/windows/install_icon_snowglobe.ico deleted file mode 100644 index e866e91a2..000000000 Binary files a/indra/newview/installers/windows/install_icon_snowglobe.ico and /dev/null differ diff --git a/indra/newview/installers/windows/install_welcome.bmp b/indra/newview/installers/windows/install_welcome.bmp new file mode 100644 index 000000000..196a5b7a7 Binary files /dev/null and b/indra/newview/installers/windows/install_welcome.bmp differ diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 5ec4a4274..ed160f8a1 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -1,207 +1,315 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; secondlife setup.nsi -;; Copyright 2004-2008, Linden Research, Inc. +;; Copyright 2004-2011, Linden Research, Inc. +;; Copyright 2013-2015 Alchemy Viewer Project ;; -;; NSIS Unicode 2.38.1 or higher required +;; This library is free software; you can redistribute it and/or +;; modify it under the terms of the GNU Lesser General Public +;; License as published by the Free Software Foundation; +;; version 2.1 of the License only. +;; +;; This library is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; Lesser General Public License for more details. +;; +;; You should have received a copy of the GNU Lesser General Public +;; License along with this library; if not, write to the Free Software +;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;; +;; Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +;; +;; NSIS Unicode 2.46.5 or higher required ;; http://www.scratchpaper.com/ ;; -;; Author: James Cook, Don Kjer, Callum Prentice +;; Author: James Cook, Don Kjer, Callum Prentice, Drake Arconis ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;-------------------------------- +;Include Modern UI -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Compiler flags -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -SetOverwrite on ; overwrite files -SetCompress auto ; compress iff saves space -SetCompressor /solid /final lzma ; compress whole installer as one block -SetDatablockOptimize off ; only saves us 0.1%, not worth it -XPStyle on ; add an XP manifest to the installer -RequestExecutionLevel admin ; on Vista we must be admin because we write to Program Files + !include "LogicLib.nsh" + !include "StdUtils.nsh" + !include "FileFunc.nsh" + !include "x64.nsh" + !include "WinVer.nsh" + !include "MUI2.nsh" -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Project flags -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;------------------------------- +;Global Variables + ; These will be replaced by manifest scripts + %%INST_VARS%% + %%WIN64_BIN_BUILD%% -%%VERSION%% + Var INSTPROG + Var INSTEXE + Var INSTSHORTCUT + Var AUTOSTART + Var COMMANDLINE ; command line passed to this installer, set in .onInit + Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer + Var SKIP_DIALOGS ; set from command line in .onInit. autoinstall + ; GUI and the defaults. + Var SKIP_AUTORUN ; skip automatic launch of viewer after install + Var STARTMENUFOLDER -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Tweak for different servers/builds (this placeholder is replaced by viewer_manifest.py) -;; For example: -;; !define INSTFLAGS "%(flags)s" -;; !define INSTNAME "SecondLife%(grid_caps)s" -;; !define SHORTCUT "Second Life (%(grid_caps)s)" -;; !define URLNAME "secondlife%(grid)s" -;; !define AUTHOR "Linden Research, Inc." -;; !define UNINSTALL_SETTINGS 1 +;-------------------------------- +;General -%%GRID_VARS%% + ;Name and file + Name "${APPNAME}" + OutFile "${INSTOUTFILE}" + Caption "${CAPTIONSTR}" + BrandingText "${VENDORSTR}" -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Alows us to determine if we're running on 64 bit OS; ${If} macros -!include "x64.nsh" -!include "LogicLib.nsh" + ;Default installation folder +!ifdef WIN64_BIN_BUILD + InstallDir "$PROGRAMFILES64\${APPNAMEONEWORD}" +!else + InstallDir "$PROGRAMFILES\${APPNAMEONEWORD}" +!endif -;; are 64 bit binaries packaged in this installer -%%WIN64_BIN_BUILD%% + ;Get installation folder from registry if available and 32bit otherwise do it in init +!ifndef WIN64_BIN_BUILD + InstallDirRegKey HKLM "SOFTWARE\${VENDORSTR}\${APPNAMEONEWORD}" "" +!endif -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; - language files - one for each language (or flavor thereof) -;; (these files are in the same place as the nsi template but the python script generates a new nsi file in the -;; application directory so we have to add a path to these include files) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -!include "%%SOURCE%%\installers\windows\lang_de.nsi" -!include "%%SOURCE%%\installers\windows\lang_en-us.nsi" -!include "%%SOURCE%%\installers\windows\lang_es.nsi" -!include "%%SOURCE%%\installers\windows\lang_fr.nsi" -!include "%%SOURCE%%\installers\windows\lang_ja.nsi" -!include "%%SOURCE%%\installers\windows\lang_it.nsi" -!include "%%SOURCE%%\installers\windows\lang_ko.nsi" -!include "%%SOURCE%%\installers\windows\lang_nl.nsi" -!include "%%SOURCE%%\installers\windows\lang_pt-br.nsi" -!include "%%SOURCE%%\installers\windows\lang_zh.nsi" + ;Request application privileges for Windows Vista + RequestExecutionLevel admin + + ;Compression + SetCompress auto ; compress to saves space + SetCompressor /solid /final lzma ; compress whole installer as one block + + ;File Handling + SetOverwrite on -# *TODO: Move these into the language files themselves -LangString LanguageCode ${LANG_GERMAN} "de" -LangString LanguageCode ${LANG_ENGLISH} "en" -LangString LanguageCode ${LANG_SPANISH} "es" -LangString LanguageCode ${LANG_FRENCH} "fr" -LangString LanguageCode ${LANG_JAPANESE} "ja" -LangString LanguageCode ${LANG_ITALIAN} "it" -LangString LanguageCode ${LANG_KOREAN} "ko" -LangString LanguageCode ${LANG_DUTCH} "nl" -LangString LanguageCode ${LANG_PORTUGUESEBR} "pt" -LangString LanguageCode ${LANG_SIMPCHINESE} "zh" +;-------------------------------- +;Version Information -Name "${VIEWERNAME}" + VIProductVersion "${VERSION_LONG}" + VIAddVersionKey "ProductName" "Singularity Viewer" + VIAddVersionKey "Comments" "A viewer for the meta-verse!" + VIAddVersionKey "CompanyName" "${VENDORSTR}" + VIAddVersionKey "LegalCopyright" "Copyright © 2010-2016, ${VENDORSTR}" + VIAddVersionKey "FileDescription" "${APPNAME} Installer" + VIAddVersionKey "ProductVersion" "${VERSION_LONG}" -SubCaption 0 $(LicenseSubTitleSetup) ; override "license agreement" text +;-------------------------------- +;Interface Settings -BrandingText "Prepare to Implode!" ; bottom of window text -Icon "%%SOURCE%%\installers\windows\${INSTALL_ICON}" -UninstallIcon "%%SOURCE%%\installers\windows\${UNINSTALL_ICON}" -WindowIcon off ; show our icon in left corner -# BGGradient 9090b0 000000 notext -CRCCheck on ; make sure CRC is OK -#InstProgressFlags smooth colored ; new colored smooth look -InstProgressFlags -InstallColors /windows -ShowInstDetails show ; no details, no "show" button -SetOverwrite on ; stomp files by default -AutoCloseWindow true ; after all files install, close window + ;Show Details + ShowInstDetails hide + ShowUninstDetails hide -InstallDir "%%INSTALLDIR%%" -InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\${INSTNAME}" "" -DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup) + !define MUI_ICON "%%SOURCE%%\installers\windows\install_icon.ico" + !define MUI_UNICON "%%SOURCE%%\installers\windows\uninstall_icon.ico" + !define MUI_WELCOMEFINISHPAGE_BITMAP "%%SOURCE%%\installers\windows\install_welcome.bmp" + !define MUI_UNWELCOMEFINISHPAGE_BITMAP "%%SOURCE%%\installers\windows\uninstall_welcome.bmp" + !define MUI_ABORTWARNING -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Variables -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Var INSTPROG -Var INSTEXE -Var INSTFLAGS -Var INSTSHORTCUT -Var COMMANDLINE ; command line passed to this installer, set in .onInit -Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer +;-------------------------------- +;Language Selection Dialog Settings -;;; Function definitions should go before file includes, because calls to -;;; DLLs like LangDLL trigger an implicit file include, so if that call is at -;;; the end of this script NSIS has to decompress the whole installer before -;;; it can call the DLL function. JC + ;Show all languages, despite user's codepage + !define MUI_LANGDLL_ALLLANGUAGES -!include "FileFunc.nsh" ; For GetParameters, GetOptions -!insertmacro GetParameters -!insertmacro GetOptions + ;Remember the installer language + !define MUI_LANGDLL_REGISTRY_ROOT "HKLM" + !define MUI_LANGDLL_REGISTRY_KEY "SOFTWARE\${VENDORSTR}\${APPNAMEONEWORD}" + !define MUI_LANGDLL_REGISTRY_VALUENAME "InstallerLanguage" + + ;Always show the dialog + !define MUI_LANGDLL_ALWAYSSHOW -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; After install completes, launch app -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function .onInstSuccess - Push $R0 # Option value, unused - ${GetOptions} $COMMANDLINE "/AUTOSTART" $R0 - # If parameter was there (no error) just launch - # Otherwise ask - IfErrors label_ask_launch label_launch - -label_ask_launch: - # Don't launch by default when silent - IfSilent label_no_launch - MessageBox MB_YESNO $(InstSuccesssQuestion) \ - IDYES label_launch IDNO label_no_launch - -label_launch: - # Assumes SetOutPath $INSTDIR - Exec '"$INSTDIR\$INSTEXE" $INSTFLAGS $SHORTCUT_LANG_PARAM' -label_no_launch: - Pop $R0 +;-------------------------------- +;Install Pages + + !define MUI_PAGE_CUSTOMFUNCTION_PRE check_skip + !insertmacro MUI_PAGE_WELCOME + + ;License Page + !define MUI_PAGE_CUSTOMFUNCTION_PRE check_skip + !insertmacro MUI_PAGE_LICENSE "%%SOURCE%%\..\..\doc\GPL-license.txt" + + ;Directory Page + !define MUI_PAGE_CUSTOMFUNCTION_PRE check_skip + !insertmacro MUI_PAGE_DIRECTORY + + ;Start Menu Folder Page + !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" + !define MUI_STARTMENUPAGE_REGISTRY_KEY "SOFTWARE\${VENDORSTR}\${APPNAMEONEWORD}" + !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" + !define MUI_PAGE_CUSTOMFUNCTION_PRE check_skip + !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${APPNAME} (64 bit) Viewer" + !insertmacro MUI_PAGE_STARTMENU Application $STARTMENUFOLDER + + ;Install Progress Page + !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckWindowsServPack + !insertmacro MUI_PAGE_INSTFILES + + ; Finish Page + !define MUI_PAGE_CUSTOMFUNCTION_PRE check_skip_finish + !define MUI_FINISHPAGE_RUN + !define MUI_FINISHPAGE_RUN_FUNCTION launch_viewer + !define MUI_FINISHPAGE_NOREBOOTSUPPORT + !insertmacro MUI_PAGE_FINISH + +;-------------------------------- +;Uninstall Pages + + !insertmacro MUI_UNPAGE_WELCOME + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + !insertmacro MUI_UNPAGE_FINISH + +;-------------------------------- +;Languages + + !include "%%SOURCE%%\installers\windows\lang_en-us.nsi" + !include "%%SOURCE%%\installers\windows\lang_fr.nsi" + !include "%%SOURCE%%\installers\windows\lang_de.nsi" + !include "%%SOURCE%%\installers\windows\lang_es.nsi" + !include "%%SOURCE%%\installers\windows\lang_zh.nsi" + !include "%%SOURCE%%\installers\windows\lang_ja.nsi" + !include "%%SOURCE%%\installers\windows\lang_pl.nsi" + !include "%%SOURCE%%\installers\windows\lang_it.nsi" + !include "%%SOURCE%%\installers\windows\lang_pt-br.nsi" + !include "%%SOURCE%%\installers\windows\lang_da.nsi" + !include "%%SOURCE%%\installers\windows\lang_ru.nsi" + !include "%%SOURCE%%\installers\windows\lang_tr.nsi" + +;-------------------------------- +;Reserve Files + + ;If you are using solid compression, files that are required before + ;the actual installation should be stored first in the data block, + ;because this will make your installer start faster. + + !insertmacro MUI_RESERVEFILE_LANGDLL + ReserveFile "${NSISDIR}\Plugins\NSISdl.dll" + ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll" + ReserveFile "${NSISDIR}\Plugins\StartMenu.dll" + ReserveFile "${NSISDIR}\Plugins\StdUtils.dll" + ReserveFile "${NSISDIR}\Plugins\System.dll" + ReserveFile "${NSISDIR}\Plugins\UserInfo.dll" + +;-------------------------------- +; Local Functions + +;Page pre-checks for skip conditions +Function check_skip + StrCmp $SKIP_DIALOGS "true" 0 +2 + Abort FunctionEnd +Function check_skip_finish + StrCmp $SKIP_DIALOGS "true" 0 +4 + StrCmp $AUTOSTART "true" 0 +3 + Call launch_viewer + Abort +FunctionEnd -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Make sure we're not on Windows 98 / ME -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function launch_viewer + ${StdUtils.ExecShellAsUser} $0 "$INSTDIR\$INSTEXE" "open" "$SHORTCUT_LANG_PARAM" +FunctionEnd + +;Check version compatibility Function CheckWindowsVersion - DetailPrint "Checking Windows version..." - Call GetWindowsVersion - Pop $R0 - ; Just get first two characters, ignore 4.0 part of "NT 4.0" - StrCpy $R0 $R0 2 - ; Blacklist certain OS versions - StrCmp $R0 "95" win_ver_bad - StrCmp $R0 "98" win_ver_bad - StrCmp $R0 "ME" win_ver_bad - StrCmp $R0 "NT" win_ver_bad - Return -win_ver_bad: - MessageBox MB_YESNO $(CheckWindowsVersionMB) IDNO win_ver_abort - Return -win_ver_abort: - Quit -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Make sure the user can install/uninstall -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function CheckIfAdministrator - DetailPrint $(CheckAdministratorInstDP) - UserInfo::GetAccountType - Pop $R0 - StrCmp $R0 "Admin" lbl_is_admin - MessageBox MB_OK $(CheckAdministratorInstMB) - Quit -lbl_is_admin: - Return -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function un.CheckIfAdministrator - DetailPrint $(CheckAdministratorUnInstDP) - UserInfo::GetAccountType - Pop $R0 - StrCmp $R0 "Admin" lbl_is_admin - MessageBox MB_OK $(CheckAdministratorUnInstMB) - Quit -lbl_is_admin: - Return -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Checks to see if the current version has already been installed (according to the registry). -; If it has, allow user to bail out of install process. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function CheckIfAlreadyCurrent - Push $0 - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\$INSTPROG" "Version" - StrCmp $0 ${VERSION_LONG} 0 DONE - MessageBox MB_OKCANCEL $(CheckIfCurrentMB) /SD IDOK IDOK DONE +!ifdef WIN64_BIN_BUILD + ${IfNot} ${RunningX64} + MessageBox MB_OK|MB_ICONSTOP "This version requires a 64 bit operating system." Quit + ${EndIf} +!endif - DONE: - Pop $0 - Return + ${If} ${AtMostWinXP} + MessageBox MB_OK $(CheckWindowsVersionMB) + Quit + ${EndIf} FunctionEnd - + +;Check service pack compatibility and suggest upgrade +Function CheckWindowsServPack + ${If} ${IsWinVista} + ${AndIfNot} ${IsServicePack} 2 + MessageBox MB_OK $(CheckWindowsServPackMB) + DetailPrint $(UseLatestServPackDP) + Return + ${EndIf} + + ${If} ${IsWin2008} + ${AndIfNot} ${IsServicePack} 2 + MessageBox MB_OK $(CheckWindowsServPackMB) + DetailPrint $(UseLatestServPackDP) + Return + ${EndIf} + + ${If} ${IsWin7} + ${AndIfNot} ${IsServicePack} 1 + MessageBox MB_OK $(CheckWindowsServPackMB) + DetailPrint $(UseLatestServPackDP) + Return + ${EndIf} + + ${If} ${IsWin2008R2} + ${AndIfNot} ${IsServicePack} 1 + MessageBox MB_OK $(CheckWindowsServPackMB) + DetailPrint $(UseLatestServPackDP) + Return + ${EndIf} +FunctionEnd + +;Make sure the user can install/uninstall +Function CheckIfAdministrator + DetailPrint $(CheckAdministratorInstDP) + UserInfo::GetAccountType + Pop $R0 + StrCmp $R0 "Admin" lbl_is_admin + MessageBox MB_OK $(CheckAdministratorInstMB) + Quit +lbl_is_admin: + Return +FunctionEnd + +Function un.CheckIfAdministrator + DetailPrint $(CheckAdministratorUnInstDP) + UserInfo::GetAccountType + Pop $R0 + StrCmp $R0 "Admin" lbl_is_admin + MessageBox MB_OK $(CheckAdministratorUnInstMB) + Quit +lbl_is_admin: + Return +FunctionEnd + +;Checks for CPU compatibility +Function CheckCPUFlags + Push $1 + System::Call 'kernel32::IsProcessorFeaturePresent(i) i(10) .r1' + IntCmp $1 1 OK_SSE2 + MessageBox MB_OKCANCEL $(MissingSSE2) /SD IDOK IDOK OK_SSE2 + Quit + + OK_SSE2: + Pop $1 + Return +FunctionEnd + +;Checks if installed version is same as installer and offers to cancel +Function CheckIfAlreadyCurrent +!ifdef WIN64_BIN_BUILD + SetRegView 64 +!endif + Push $0 + ReadRegStr $0 HKLM "SOFTWARE\${VENDORSTR}\$INSTPROG" "Version" + StrCmp $0 ${VERSION_LONG} 0 continue_install + StrCmp $SKIP_DIALOGS "true" continue_install + MessageBox MB_OKCANCEL $(CheckIfCurrentMB) /SD IDOK IDOK continue_install + Quit +continue_install: + Pop $0 + Return +FunctionEnd + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Close the program, if running. Modifies no variables. ; Allows user to bail out of install process. @@ -210,225 +318,26 @@ Function CloseSecondLife Push $0 FindWindow $0 "Second Life" "" IntCmp $0 0 DONE - MessageBox MB_YESNOCANCEL $(CloseSecondLifeInstMB) IDYES CLOSE IDNO DONE - Goto CANCEL_INSTALL ; IDCANCEL - - CANCEL_INSTALL: - Quit + + StrCmp $SKIP_DIALOGS "true" CLOSE + MessageBox MB_YESNOCANCEL $(CloseSecondLifeInstMB) IDYES CLOSE IDNO DONE + Quit CLOSE: DetailPrint $(CloseSecondLifeInstDP) SendMessage $0 16 0 0 LOOP: - FindWindow $0 "Second Life" "" - IntCmp $0 0 DONE - Sleep 500 - Goto LOOP + FindWindow $0 "Second Life" "" + IntCmp $0 0 DONE + Sleep 500 + Goto LOOP DONE: Pop $0 Return FunctionEnd -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Test our connection to secondlife.com -; Also allows us to count attempted installs by examining web logs. -; *TODO: Return current SL version info and have installer check -; if it is up to date. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function CheckNetworkConnection - Push $0 - Push $1 - Push $2 # Option value for GetOptions - DetailPrint $(CheckNetworkConnectionDP) - ; Look for a tag value from the stub installer, used for statistics - ; to correlate installs. Default to "" if not found on command line. - StrCpy $2 "" - ${GetOptions} $COMMANDLINE "/STUBTAG=" $2 - GetTempFileName $0 - !define HTTP_TIMEOUT 5000 ; milliseconds - ; Don't show secondary progress bar, this will be quick. - NSISdl::download_quiet \ - /TIMEOUT=${HTTP_TIMEOUT} \ - "http://install.secondlife.com/check/?stubtag=$2&version=${VERSION_LONG}" \ - $0 - Pop $1 ; Return value, either "success", "cancel" or an error message - ; MessageBox MB_OK "Download result: $1" - ; Result ignored for now - ; StrCmp $1 "success" +2 - ; DetailPrint "Connection failed: $1" - Delete $0 ; temporary file - Pop $2 - Pop $1 - Pop $0 - Return -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Delete files in Documents and Settings\\SecondLife\cache -; Delete files in Documents and Settings\All Users\SecondLife\cache -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;Function RemoveCacheFiles -; -;; Delete files in Documents and Settings\\SecondLife -;Push $0 -;Push $1 -;Push $2 -; DetailPrint $(RemoveCacheFilesDP) -; -; StrCpy $0 0 ; Index number used to iterate via EnumRegKey -; -; LOOP: -; EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 -; StrCmp $1 "" DONE ; no more users -; -; ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" -; StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing -; -; ; Required since ProfileImagePath is of type REG_EXPAND_SZ -; ExpandEnvStrings $2 $2 -; -; ; When explicitly uninstalling, everything goes away -; RMDir /r "$2\Application Data\SecondLife\cache" -; -; CONTINUE: -; IntOp $0 $0 + 1 -; Goto LOOP -; DONE: -;Pop $2 -;Pop $1 -;Pop $0 -; -;; Delete files in Documents and Settings\All Users\SecondLife -;Push $0 -; ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData" -; StrCmp $0 "" +2 -; RMDir /r "$0\SecondLife\cache" -;Pop $0 -; -;; Delete filse in C:\Windows\Application Data\SecondLife -;; If the user is running on a pre-NT system, Application Data lives here instead of -;; in Documents and Settings. -;RMDir /r "$WINDIR\Application Data\SecondLife\cache" -; -;FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Delete the installed shader files -;;; Since shaders are in active development, we'll likely need to shuffle them -;;; around a bit from build to build. This ensures that shaders that we move -;;; or rename in the dev tree don't get left behind in the install. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function RemoveOldShaders - -;; Remove old shader files first so fallbacks will work. see DEV-5663 -RMDir /r "$INSTDIR\app_settings\shaders\*" - -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Delete the installed XUI files -;;; We've changed the directory hierarchy for skins, putting all XUI and texture -;;; files under a specific skin directory, i.e. skins/default/xui/en-us as opposed -;;; to skins/xui/en-us. Need to clean up the old path when upgrading -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function RemoveOldXUI - -;; remove old XUI and texture files -RmDir /r "$INSTDIR\skins\html" -RmDir /r "$INSTDIR\skins\xui" -RmDir /r "$INSTDIR\skins\textures" -Delete "$INSTDIR\skins\*.txt" - -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Remove any releasenotes files. -;;; We are no longer including release notes with the viewer. This will delete -;;; any that were left behind by an older installer. Delete will not fail if -;;; the files do not exist -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function RemoveOldReleaseNotes - -;; remove releasenotes.txt file from application directory, and the shortcut -;; from the start menu. -Delete "$SMPROGRAMS\$INSTSHORTCUT\SL Release Notes.lnk" -Delete "$INSTDIR\releasenotes.txt" - -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Delete a xui file that causes crash in Silver skin in cases where it was -;;; left behind by an older installer. -;;; See SNOW-348 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function RemoveOldAboutLandSilver - -Delete "$INSTDIR\skins\silver\xui\en-us\floater_about_land.xml" - -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Delete files in Documents and Settings\\SecondLife -; Delete files in Documents and Settings\All Users\SecondLife -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function un.DocumentsAndSettingsFolder - -; Delete files in Documents and Settings\\SecondLife -Push $0 -Push $1 -Push $2 - - DetailPrint "Deleting files in Documents and Settings folder" - - StrCpy $0 0 ; Index number used to iterate via EnumRegKey - - LOOP: - EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 - StrCmp $1 "" DONE ; no more users - - ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" - StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing - - ; Required since ProfileImagePath is of type REG_EXPAND_SZ - ExpandEnvStrings $2 $2 - - ; If uninstalling a normal install remove everything - ; Otherwise (preview/dmz etc) just remove cache - StrCmp $INSTFLAGS "" RM_ALL RM_CACHE - RM_ALL: - RMDir /r "$2\Application Data\SecondLife" - RM_CACHE: - # Local Settings directory is the cache, there is no "cache" subdir - RMDir /r "$2\Local Settings\Application Data\SecondLife" - # Vista version of the same - RMDir /r "$2\AppData\Local\SecondLife" - Delete "$2\Application Data\SecondLife\user_settings\settings_windlight.xml" - - CONTINUE: - IntOp $0 $0 + 1 - Goto LOOP - DONE: - -Pop $2 -Pop $1 -Pop $0 - -; Delete files in Documents and Settings\All Users\SecondLife -Push $0 - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData" - StrCmp $0 "" +2 - RMDir /r "$0\SecondLife" -Pop $0 - -; Delete filse in C:\Windows\Application Data\SecondLife -; If the user is running on a pre-NT system, Application Data lives here instead of -; in Documents and Settings. -RMDir /r "$WINDIR\Application Data\SecondLife" - -FunctionEnd - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Close the program, if running. Modifies no variables. ; Allows user to bail out of uninstall process. @@ -438,405 +347,284 @@ Function un.CloseSecondLife FindWindow $0 "Second Life" "" IntCmp $0 0 DONE MessageBox MB_YESNOCANCEL $(CloseSecondLifeUnInstMB) IDYES CLOSE IDNO DONE - Goto CANCEL_UNINSTALL ; IDCANCEL - - CANCEL_UNINSTALL: - Quit + Quit CLOSE: DetailPrint $(CloseSecondLifeUnInstDP) SendMessage $0 16 0 0 LOOP: - FindWindow $0 "Second Life" "" - IntCmp $0 0 DONE - Sleep 500 - Goto LOOP + FindWindow $0 "Second Life" "" + IntCmp $0 0 DONE + Sleep 500 + Goto LOOP DONE: Pop $0 Return FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; -; Delete the stored password for the current Windows user -; DEV-10821 -- Unauthorised user can gain access to an SL account after a real user has uninstalled -; -Function un.RemovePassword - -DetailPrint "Removing Second Life password" - -SetShellVarContext current -Delete "$APPDATA\SecondLife\user_settings\password.dat" -SetShellVarContext all - +; Test our connection to secondlife.com +; Also allows us to count attempted installs by examining web logs. +; *TODO: Return current SL version info and have installer check +; if it is up to date. +Function CheckNetworkConnection + ; Uneeded - LD + Return + Push $0 + Push $1 + Push $2 # Option value for GetOptions + DetailPrint $(CheckNetworkConnectionDP) + ; Look for a tag value from the stub installer, used for statistics + ; to correlate installs. Default to "" if not found on command line. + StrCpy $2 "" + ${GetOptions} $COMMANDLINE "/STUBTAG=" $2 + GetTempFileName $0 + !define HTTP_TIMEOUT 5000 ; milliseconds + ; Don't show secondary progress bar, this will be quick. + NSISdl::download_quiet \ + /TIMEOUT=${HTTP_TIMEOUT} \ + "http://install.secondlife.com/check/?stubtag=$2&version=${VERSION_LONG}" \ + $0 + Pop $1 ; Return value, either "success", "cancel" or an error message + ; MessageBox MB_OK "Download result: $1" + ; Result ignored for now + ; StrCmp $1 "success" +2 + ; DetailPrint "Connection failed: $1" + Delete $0 ; temporary file + Pop $2 + Pop $1 + Pop $0 + Return FunctionEnd -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Delete the installed files -;;; This deletes the uninstall executable, but it works -;;; because it is copied to temp directory before running -;;; -;;; Note: You must list all files here, because we only -;;; want to delete our files, not things users left in the -;;; application directories. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function un.ProgramFiles +;-------------------------------- +;Installer Sections -;; Remove mozilla file first so recursive directory deletion doesn't get hung up -Delete "$INSTDIR\app_settings\mozilla\components" +Section "Viewer" + SectionIn RO + SetShellVarContext all +!ifdef WIN64_BIN_BUILD + SetRegView 64 +!endif + ;Start with some default values. + StrCpy $INSTPROG "${APPNAMEONEWORD}" + StrCpy $INSTEXE "${INSTEXE}" + StrCpy $INSTSHORTCUT "${APPNAME}" -;; This placeholder is replaced by the complete list of files to uninstall by viewer_manifest.py -%%DELETE_FILES%% + Call CheckIfAlreadyCurrent + Call CloseSecondLife ; Make sure we're not running + Call CheckNetworkConnection ; ping secondlife.com -;; Optional/obsolete files. Delete won't fail if they don't exist. -Delete "$INSTDIR\dronesettings.ini" -Delete "$INSTDIR\message_template.msg" -Delete "$INSTDIR\newview.pdb" -Delete "$INSTDIR\newview.map" -Delete "$INSTDIR\SecondLife.pdb" -Delete "$INSTDIR\SecondLife.map" -Delete "$INSTDIR\comm.dat" -Delete "$INSTDIR\*.glsl" -Delete "$INSTDIR\motions\*.lla" -Delete "$INSTDIR\trial\*.html" -Delete "$INSTDIR\newview.exe" -;; Remove entire help directory -Delete "$INSTDIR\help\Advanced\*" -RMDir "$INSTDIR\help\Advanced" -Delete "$INSTDIR\help\basics\*" -RMDir "$INSTDIR\help\basics" -Delete "$INSTDIR\help\Concepts\*" -RMDir "$INSTDIR\help\Concepts" -Delete "$INSTDIR\help\welcome\*" -RMDir "$INSTDIR\help\welcome" -Delete "$INSTDIR\help\*" -RMDir "$INSTDIR\help" + SetOutPath "$INSTDIR" + ;Remove old shader files first so fallbacks will work. + RMDir /r "$INSTDIR\app_settings\shaders\*" + + ;This placeholder is replaced by the complete list of all the files in the installer, by viewer_manifest.py + %%INSTALL_FILES%% + +!ifdef WIN64_BIN_BUILD + ExecWait '"$INSTDIR\redist\vc_redist.x64.exe" /passive /norestart' +!else + ExecWait '"$INSTDIR\redist\vc_redist.x86.exe" /passive /norestart' +!endif + + ;Pass the installer's language to the client to use as a default + StrCpy $SHORTCUT_LANG_PARAM "--set InstallLanguage $(LanguageCode)" + + ;Create startmenu shortcuts + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory "$SMPROGRAMS\$STARTMENUFOLDER" +!ifdef WIN64_BIN_BUILD + CreateShortCut "$SMPROGRAMS\$STARTMENUFOLDER\$INSTSHORTCUT (64 bit) Viewer.lnk" "$\"$INSTDIR\$INSTEXE$\"" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$SMPROGRAMS\$STARTMENUFOLDER\Uninstall $INSTSHORTCUT (64 bit) Viewer.lnk" "$\"$INSTDIR\uninst.exe$\"" "" +!else + CreateShortCut "$SMPROGRAMS\$STARTMENUFOLDER\$INSTSHORTCUT.lnk" "$\"$INSTDIR\$INSTEXE$\"" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$SMPROGRAMS\$STARTMENUFOLDER\Uninstall $INSTSHORTCUT.lnk" "$\"$INSTDIR\uninst.exe$\"" "" +!endif + WriteINIStr "$SMPROGRAMS\$STARTMENUFOLDER\SL Create Account.url" "InternetShortcut" "URL" "http://join.secondlife.com/" + WriteINIStr "$SMPROGRAMS\$STARTMENUFOLDER\SL Your Account.url" "InternetShortcut" "URL" "http://www.secondlife.com/account/" + WriteINIStr "$SMPROGRAMS\$STARTMENUFOLDER\SL Scripting Language Help.url" "InternetShortcut" "URL" "http://wiki.secondlife.com/wiki/LSL_Portal" -Delete "$INSTDIR\uninst.exe" -RMDir "$INSTDIR" + !insertmacro MUI_STARTMENU_WRITE_END -IfFileExists "$INSTDIR" FOLDERFOUND NOFOLDER + ;Other shortcuts + SetOutPath "$INSTDIR" +!ifdef WIN64_BIN_BUILD + ;CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$INSTDIR\$INSTSHORTCUT (64 bit) Viewer.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$INSTDIR\$INSTSHORTCUT (64 bit) Viewer Portable.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM --portable" + CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT (64 bit) Viewer.lnk" "$INSTDIR\uninst.exe" "" +!else + ;CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$INSTDIR\$INSTSHORTCUT Viewer.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$INSTDIR\$INSTSHORTCUT Viewer Portable.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM --portable" + CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT Viewer.lnk" "$INSTDIR\uninst.exe" "" +!endif + + ;Write registry + WriteRegStr HKLM "SOFTWARE\${VENDORSTR}\$INSTPROG" "" "$INSTDIR" + WriteRegStr HKLM "SOFTWARE\${VENDORSTR}\$INSTPROG" "Version" "${VERSION_LONG}" + WriteRegStr HKLM "SOFTWARE\${VENDORSTR}\$INSTPROG" "Shortcut" "$INSTSHORTCUT" + WriteRegStr HKLM "SOFTWARE\${VENDORSTR}\$INSTPROG" "Exe" "$INSTEXE" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "Comments" "A viewer for the meta-verse!" +!ifdef WIN64_BIN_BUILD + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTSHORTCUT (64 bit) Viewer" +!else + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTSHORTCUT Viewer" +!endif + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayIcon" "$INSTDIR\$INSTEXE" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayVersion" "${VERSION_LONG}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "InstallSource" "$EXEDIR\" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "HelpLink" "http://www.singularityviewer.org" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "NoRepair" 1 + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "Publisher" "${VENDORSTR}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "URLInfoAbout" "http://www.singularityviewer.org" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "URLUpdateInfo" "http://www.singularityviewer.org/downloads" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "UninstallString" "$\"$INSTDIR\uninst.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "QuietUninstallString" "$\"$INSTDIR\uninst.exe$\" /S" + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "EstimatedSize" "$0" + + + ;Write URL registry info + WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "(Default)" "URL:Second Life" + WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "URL Protocol" "" + WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" "$INSTDIR\$INSTEXE" + ;; URL param must be last item passed to viewer, it ignores subsequent params + ;; to avoid parameter injection attacks. + WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" "$\"$INSTDIR\$INSTEXE$\" -url $\"%1$\"" + + WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "(Default)" "URL:Second Life" + WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "URL Protocol" "" + WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info\DefaultIcon" "" "$\"$INSTDIR\$INSTEXE$\"" + ;; URL param must be last item passed to viewer, it ignores subsequent params + ;; to avoid parameter injection attacks. + WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" "$\"$INSTDIR\$INSTEXE$\" -url $\"%1$\"" + + ;Create uninstaller + SetOutPath "$INSTDIR" + WriteUninstaller "$INSTDIR\uninst.exe" + +SectionEnd + +;-------------------------------- +;Installer Functions +Function .onInit + ;Don't install on unsupported operating systems + Call CheckWindowsVersion + ;Don't install if not administator + Call CheckIfAdministrator + ;Don't install if we lack required cpu support + Call CheckCPUFlags + + Push $0 + + ;Get installation folder from registry if available for 64bit +!ifdef WIN64_BIN_BUILD + SetRegView 64 + ReadRegStr $0 HKLM "SOFTWARE\${VENDORSTR}\${APPNAMEONEWORD}" "" + IfErrors +2 0 ; If error jump past setting SKIP_AUTORUN + StrCpy $INSTDIR $0 +!endif + + ${GetParameters} $COMMANDLINE ; get our command line + + ${GetOptions} $COMMANDLINE "/SKIP_DIALOGS" $0 + IfErrors +2 0 ; If error jump past setting SKIP_DIALOGS + StrCpy $SKIP_DIALOGS "true" + + ${GetOptions} $COMMANDLINE "/SKIP_AUTORUN" $0 + IfErrors +2 0 ; If error jump past setting SKIP_AUTORUN + StrCpy $SKIP_AUTORUN "true" + + ${GetOptions} $COMMANDLINE "/AUTOSTART" $0 + IfErrors +2 0 ; If error jump past setting AUTOSTART + StrCpy $AUTOSTART "true" + + ${GetOptions} $COMMANDLINE "/LANGID=" $0 ; /LANGID=1033 implies US English + ; If no language (error), then proceed + IfErrors lbl_configure_default_lang + ; No error means we got a language, so use it + StrCpy $LANGUAGE $0 + Goto lbl_return + +lbl_configure_default_lang: + ;For silent installs, no language prompt, use default + IfSilent lbl_return + StrCmp $SKIP_DIALOGS "true" lbl_return + + !insertmacro MUI_LANGDLL_DISPLAY + +lbl_return: + Pop $0 + Return +FunctionEnd + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + SectionIn RO + SetShellVarContext all +!ifdef WIN64_BIN_BUILD + SetRegView 64 +!endif + + StrCpy $INSTPROG "${APPNAMEONEWORD}" + StrCpy $INSTEXE "${INSTEXE}" + StrCpy $INSTSHORTCUT "${APPNAME}" + + Call un.CloseSecondLife + + !insertmacro MUI_STARTMENU_GETFOLDER Application $STARTMENUFOLDER + RMDir /r "$SMPROGRAMS\$STARTMENUFOLDER" + + ;This placeholder is replaced by the complete list of all the files in the installer, by viewer_manifest.py + %%DELETE_FILES%% + + ;Optional/obsolete files. Delete won't fail if they don't exist. + Delete "$INSTDIR\message_template.msg" + Delete "$INSTDIR\VivoxVoiceService-*.log" + + ;Shortcuts in install directory +!ifdef WIN64_BIN_BUILD + Delete "$INSTDIR\$INSTSHORTCUT (64 bit) Viewer.lnk" + Delete "$INSTDIR\$INSTSHORTCUT (64 bit) Viewer Portable.lnk" + Delete "$INSTDIR\Uninstall $INSTSHORTCUT (64 bit) Viewer.lnk" +!else + Delete "$INSTDIR\$INSTSHORTCUT Viewer.lnk" + Delete "$INSTDIR\$INSTSHORTCUT Viewer Portable.lnk" + Delete "$INSTDIR\Uninstall $INSTSHORTCUT Viewer.lnk" +!endif + + Delete "$INSTDIR\uninst.exe" + RMDir "$INSTDIR" + + IfFileExists "$INSTDIR" FOLDERFOUND NOFOLDER FOLDERFOUND: - MessageBox MB_YESNO $(DeleteProgramFilesMB) IDNO NOFOLDER + ;Silent uninstall always removes all files (/SD IDYES) + MessageBox MB_YESNO $(DeleteProgramFilesMB) /SD IDYES IDNO NOFOLDER RMDir /r "$INSTDIR" NOFOLDER: - -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Uninstall settings -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -UninstallText $(UninstallTextMsg) -ShowUninstDetails show - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Uninstall section -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Section Uninstall - -; Start with some default values. -StrCpy $INSTFLAGS "" -StrCpy $INSTPROG "${INSTNAME}" -StrCpy $INSTEXE "${INSTEXE}" -StrCpy $INSTSHORTCUT "${SHORTCUT}" -Call un.CheckIfAdministrator ; Make sure the user can install/uninstall - -; uninstall for all users (if you change this, change it in the install as well) -SetShellVarContext all - -; Make sure we're not running -Call un.CloseSecondLife - -; Clean up registry keys and subkeys (these should all be !defines somewhere) -DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\$INSTPROG" -DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" - -; Clean up shortcuts -Delete "$SMPROGRAMS\$INSTSHORTCUT\*.*" -RMDir "$SMPROGRAMS\$INSTSHORTCUT" - -Delete "$DESKTOP\$INSTSHORTCUT.lnk" -Delete "$INSTDIR\$INSTSHORTCUT.lnk" -Delete "$INSTDIR\$INSTSHORTCUT Portable.lnk" -Delete "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" - -; Clean up cache and log files. -; Leave them in-place for non AGNI installs. - -!ifdef UNINSTALL_SETTINGS -Call un.DocumentsAndSettingsFolder -!endif - -; remove stored password on uninstall -Call un.RemovePassword - -Call un.ProgramFiles - -SectionEnd ; end of uninstall section - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; (From the NSIS documentation, JC) -; GetWindowsVersion -; -; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ -; Updated by Joost Verburg -; -; Returns on top of stack -; -; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003) -; or -; '' (Unknown Windows Version) -; -; Usage: -; Call GetWindowsVersion -; Pop $R0 -; ; at this point $R0 is "NT 4.0" or whatnot -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function GetWindowsVersion + DeleteRegKey HKLM "SOFTWARE\${VENDORSTR}\$INSTPROG" + DeleteRegKey /ifempty HKLM "SOFTWARE\${VENDORSTR}" + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" - Push $R0 - Push $R1 - - ReadRegStr $R0 HKLM \ - "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - - IfErrors 0 lbl_winnt - - ; we are not NT - ReadRegStr $R0 HKLM \ - "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber - - StrCpy $R1 $R0 1 - StrCmp $R1 '4' 0 lbl_error - - StrCpy $R1 $R0 3 - - StrCmp $R1 '4.0' lbl_win32_95 - StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 - - lbl_win32_95: - StrCpy $R0 '95' - Goto lbl_done - - lbl_win32_98: - StrCpy $R0 '98' - Goto lbl_done - - lbl_win32_ME: - StrCpy $R0 'ME' - Goto lbl_done - - lbl_winnt: - - StrCpy $R1 $R0 1 - - StrCmp $R1 '3' lbl_winnt_x - StrCmp $R1 '4' lbl_winnt_x - - StrCpy $R1 $R0 3 - - StrCmp $R1 '5.0' lbl_winnt_2000 - StrCmp $R1 '5.1' lbl_winnt_XP - StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error - - lbl_winnt_x: - StrCpy $R0 "NT $R0" 6 - Goto lbl_done - - lbl_winnt_2000: - Strcpy $R0 '2000' - Goto lbl_done - - lbl_winnt_XP: - Strcpy $R0 'XP' - Goto lbl_done - - lbl_winnt_2003: - Strcpy $R0 '2003' - Goto lbl_done - - lbl_error: - Strcpy $R0 '' - lbl_done: - - Pop $R1 - Exch $R0 - -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Note: to add new languages, add a language file include to the list -;; at the top of this file, add an entry to the menu and then add an -;; entry to the language ID selector below -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function .onInit -!ifdef WIN64_BIN_BUILD - ${IfNot} ${RunningX64} - MessageBox MB_OK|MB_ICONSTOP "This version requires 64 bit operating sytem." - Quit - ${EndIf} -!endif - Push $0 - ${GetParameters} $COMMANDLINE ; get our command line - ${GetOptions} $COMMANDLINE "/LANGID=" $0 ; /LANGID=1033 implies US English - ; If no language (error), then proceed - IfErrors lbl_check_silent - ; No error means we got a language, so use it - StrCpy $LANGUAGE $0 - Goto lbl_return - -lbl_check_silent: - ; For silent installs, no language prompt, use default - IfSilent lbl_return - - ; If we currently have a version of SL installed, default to the language of that install - ; Otherwise don't change $LANGUAGE and it will default to the OS UI language. - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\${INSTNAME}" "InstallerLanguage" - IfErrors lbl_build_menu - StrCpy $LANGUAGE $0 - -lbl_build_menu: - Push "" - # Use separate file so labels can be UTF-16 but we can still merge changes - # into this ASCII file. JC - !include "%%SOURCE%%\installers\windows\language_menu.nsi" - - Push A ; A means auto count languages for the auto count to work the first empty push (Push "") must remain - LangDLL::LangDialog $(InstallerLanguageTitle) $(SelectInstallerLanguage) - Pop $0 - StrCmp $0 "cancel" 0 +2 - Abort - StrCpy $LANGUAGE $0 - - ; save language in registry - WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\${INSTNAME}" "InstallerLanguage" $LANGUAGE -lbl_return: - Pop $0 - Return -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function un.onInit - ; read language from registry and set for uninstaller - ; Key will be removed on successful uninstall - ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\${INSTNAME}" "InstallerLanguage" - IfErrors lbl_end - StrCpy $LANGUAGE $0 -lbl_end: - Return -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; MAIN SECTION -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Section "" ; (default section) - -SetShellVarContext all ; install for all users (if you change this, change it in the uninstall as well) - -; Start with some default values. -StrCpy $INSTFLAGS "${INSTFLAGS}" -StrCpy $INSTPROG "${INSTNAME}" -StrCpy $INSTEXE "${INSTEXE}" -StrCpy $INSTSHORTCUT "${SHORTCUT}" - -Call CheckWindowsVersion ; warn if on Windows 98/ME -Call CheckIfAdministrator ; Make sure the user can install/uninstall -Call CheckIfAlreadyCurrent ; Make sure that we haven't already installed this version -Call CloseSecondLife ; Make sure we're not running -#Call CheckNetworkConnection ; ping secondlife.com - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers. -;Call RemoveCacheFiles ; Installing over removes potentially corrupted - ; VFS and cache files. - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Need to clean out shader files from previous installs to fix DEV-5663 -Call RemoveOldShaders - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Need to clean out old XUI files that predate skinning -Call RemoveOldXUI - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Clear out old releasenotes.txt files. These are now on the public wiki. -Call RemoveOldReleaseNotes - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Remove an old xui file that should not be in Silver skin -Call RemoveOldAboutLandSilver - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Files -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; This placeholder is replaced by the complete list of all the files in the installer, by viewer_manifest.py -%%INSTALL_FILES%% - -# Pass the installer's language to the client to use as a default -StrCpy $SHORTCUT_LANG_PARAM "--set InstallLanguage $(LanguageCode)" - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Shortcuts in start menu -CreateDirectory "$SMPROGRAMS\$INSTSHORTCUT" -SetOutPath "$INSTDIR" -CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT.lnk" \ - "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM" - - -WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Create Account.url" \ - "InternetShortcut" "URL" \ - "http://www.secondlife.com/registration/" -WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Your Account.url" \ - "InternetShortcut" "URL" \ - "http://www.secondlife.com/account/" -WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Scripting Language Help.url" \ - "InternetShortcut" "URL" \ - "http://wiki.secondlife.com/wiki/LSL_Portal" -CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\Uninstall $INSTSHORTCUT.lnk" \ - '"$INSTDIR\uninst.exe"' '' - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Other shortcuts -SetOutPath "$INSTDIR" -CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" \ - "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM" -CreateShortCut "$INSTDIR\$INSTSHORTCUT.lnk" \ - "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM" -CreateShortCut "$INSTDIR\$INSTSHORTCUT Portable.lnk" \ - "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM --portable" -CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" \ - '"$INSTDIR\uninst.exe"' '' - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Write registry -WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\$INSTPROG" "" "$INSTDIR" -WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\$INSTPROG" "Version" "${VERSION_LONG}" -WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\$INSTPROG" "Flags" "$INSTFLAGS" -WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\$INSTPROG" "Shortcut" "$INSTSHORTCUT" -WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${AUTHOR}\$INSTPROG" "Exe" "$INSTEXE" -WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTPROG (remove only)" -WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "UninstallString" '"$INSTDIR\uninst.exe"' - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Write URL registry info -WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "(default)" "URL:Second Life" -WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "URL Protocol" "" -WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"' -;; URL param must be last item passed to viewer, it ignores subsequent params -;; to avoid parameter injection attacks. -WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"' - -; write out uninstaller -WriteUninstaller "$INSTDIR\uninst.exe" - -; end of default section SectionEnd -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EOF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;-------------------------------- +;Uninstaller Functions + +Function un.onInit + + Call un.CheckIfAdministrator + + !insertmacro MUI_UNGETLANGUAGE + +FunctionEnd diff --git a/indra/newview/installers/windows/lang_da.nsi b/indra/newview/installers/windows/lang_da.nsi new file mode 100644 index 000000000..11807202d --- /dev/null +++ b/indra/newview/installers/windows/lang_da.nsi @@ -0,0 +1,56 @@ +; First is default +!insertmacro MUI_LANGUAGE "Danish" + +; Language string +LangString LanguageCode ${LANG_DANISH} "da" + +; Language selection dialog +LangString SelectInstallerLanguage ${LANG_DANISH} "Vælg venligst sprog til installation" + +; installation directory text +LangString DirectoryChooseTitle ${LANG_DANISH} "Installationsmappe" +LangString DirectoryChooseUpdate ${LANG_DANISH} "Vælg ${APPNAME} mappe til opdatering til version ${VERSION_LONG}.(XXX):" +LangString DirectoryChooseSetup ${LANG_DANISH} "Vælg mappe hvor ${APPNAME} skal installeres:" + +; CheckStartupParams message box +LangString CheckStartupParamsMB ${LANG_DANISH} "Kunne ikke finde programmet '$INSTPROG'. Baggrundsopdatering fejlede." + +; check windows version +LangString CheckWindowsVersionDP ${LANG_DANISH} "Checker Windows version..." +LangString CheckWindowsVersionMB ${LANG_DANISH} '${APPNAME} supporterer kun Windows XP.$\n$\nForsøg på installation på Windows $R0 kan resultere i nedbrud og datatab.$\n$\n' +LangString CheckWindowsServPackMB ${LANG_DANISH} "It is recomended to run ${APPNAME} on the latest service pack for your operating system.$\nThis will help with performance and stability of the program." +LangString UseLatestServPackDP ${LANG_DANISH} "Please use Windows Update to install the latest Service Pack." + +; checkifadministrator function (install) +LangString CheckAdministratorInstDP ${LANG_DANISH} "Checker rettigheder til installation..." +LangString CheckAdministratorInstMB ${LANG_DANISH} 'Det ser ud til at du benytter en konto med begrænsninger.$\nDu skal have "administrator" rettigheder for at installere ${APPNAME}.' + +; checkifadministrator function (uninstall) +LangString CheckAdministratorUnInstDP ${LANG_DANISH} "Checker rettigheder til at afinstallere..." +LangString CheckAdministratorUnInstMB ${LANG_DANISH} 'Det ser ud til at du benytter en konto med begrænsninger.$\nDu skal have "administrator" rettigheder for at afinstallere ${APPNAME}.' + +; checkifalreadycurrent +LangString CheckIfCurrentMB ${LANG_DANISH} "Det ser ud til at ${APPNAME} ${VERSION_LONG} allerede er installeret.$\n$\nØnsker du at installere igen?" + +; checkcpuflags +LangString MissingSSE2 ${LANG_DANISH} "This machine may not have a CPU with SSE2 support, which is required to run ${APPNAME} ${VERSION_LONG}. Do you want to continue?" + +; closesecondlife function (install) +LangString CloseSecondLifeInstDP ${LANG_DANISH} "Venter på at Singularity skal lukke ned..." +LangString CloseSecondLifeInstMB ${LANG_DANISH} "Singularity kan ikke installeres mens programmet kører.$\n$\nAfslut programmet for at fortsætte.$\nVælg ANNULÉR for at afbryde installation." + +; closesecondlife function (uninstall) +LangString CloseSecondLifeUnInstDP ${LANG_DANISH} "Venter på at Singularity skal lukke ned..." +LangString CloseSecondLifeUnInstMB ${LANG_DANISH} "Singularity kan ikke afinstalleres mens programmet kører.$\n$\nAfslut programmet for at fortsætte.$\nVælg ANNULÉR for at afbryde installation." + +; CheckNetworkConnection +LangString CheckNetworkConnectionDP ${LANG_DANISH} "Checker netværksforbindelse..." + +; removecachefiles +LangString RemoveCacheFilesDP ${LANG_DANISH} "Sletter cache filer i dokument mappen" + +; delete program files +LangString DeleteProgramFilesMB ${LANG_DANISH} "Der er stadig filer i ${APPNAME} program mappen.$\n$\nDette er sandsynligvis filer du har oprettet eller flyttet til :$\n$INSTDIR$\n$\nØnsker du at fjerne disse filer?" + +; uninstall text +LangString UninstallTextMsg ${LANG_DANISH} "Dette vil afinstallere ${APPNAME} ${VERSION_LONG} fra dit system." diff --git a/indra/newview/installers/windows/lang_de.nsi b/indra/newview/installers/windows/lang_de.nsi index b717a4d3a..763f88488 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 9ff482075..9b0b64a7a 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 c6a7f38f3..b940e04c9 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 008c240ed..095847082 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 1208ec4eb..8153b73d4 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 f564291f7..f4cf3c75c 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 new file mode 100644 index 000000000..5c23d89fd --- /dev/null +++ b/indra/newview/installers/windows/lang_pl.nsi @@ -0,0 +1,56 @@ +; First is default +!insertmacro MUI_LANGUAGE "Polish" + +; Language string +LangString LanguageCode ${LANG_POLISH} "pl" + +; Language selection dialog +LangString SelectInstallerLanguage ${LANG_POLISH} "Proszę wybrać język instalatora" + +; installation directory text +LangString DirectoryChooseTitle ${LANG_POLISH} "Katalog instalacji" +LangString DirectoryChooseUpdate ${LANG_POLISH} "Wybierz katalog instalacji ${APPNAME} w celu aktualizacji wersji ${VERSION_LONG}.(XXX):" +LangString DirectoryChooseSetup ${LANG_POLISH} "Wybierz katalog instalacji ${APPNAME} w:" + +; CheckStartupParams message box +LangString CheckStartupParamsMB ${LANG_POLISH} "Nie można odnaleźć programu '$INSTPROG'. Cicha aktualizacja zakończyła się niepowodzeniem." + +; check windows version +LangString CheckWindowsVersionDP ${LANG_POLISH} "Sprawdzanie wersji Windows..." +LangString CheckWindowsVersionMB ${LANG_POLISH} '${APPNAME} obsługuje tylko Windows XP.$\n$\nPróba zainstalowania na Windows $R0 może spowodować awarie i utratę danych.$\n$\n' +LangString CheckWindowsServPackMB ${LANG_POLISH} "Zalecane jest uruchamianie ${APPNAME} z najnowszym dostępnym Service Packiem zainstalowanym w systemie.$\nPomaga on w podniesieniu wydajności i stabilności programu." +LangString UseLatestServPackDP ${LANG_POLISH} "Użyj usługi Windows Update, aby zainstalować najnowszy Service Pack." + +; checkifadministrator function (install) +LangString CheckAdministratorInstDP ${LANG_POLISH} "Sprawdzanie zezwolenia na instalację..." +LangString CheckAdministratorInstMB ${LANG_POLISH} 'Używasz "ograniczonego" konta.$\nMusisz być zalogowany jako "administrator" aby zainstalować ${APPNAME}.' + +; checkifadministrator function (uninstall) +LangString CheckAdministratorUnInstDP ${LANG_POLISH} "Sprawdzanie zezwolenia na odinstalowanie..." +LangString CheckAdministratorUnInstMB ${LANG_POLISH} 'Używasz "ograniczonego" konta.$\nMusisz być być zalogowany jako "administrator" aby zainstalować ${APPNAME}.' + +; checkifalreadycurrent +LangString CheckIfCurrentMB ${LANG_POLISH} "${APPNAME} ${VERSION_LONG} jest już zainstalowane.$\n$\nCzy chcesz zainstalować ${APPNAME} ponownie?" + +; checkcpuflags +LangString MissingSSE2 ${LANG_POLISH} "Ten komputer może nie mieć procesora z obsługą SSE2, który jest wymagany aby uruchomić ${APPNAME} w wersji ${VERSION_LONG}. Chcesz kontynuować?" + +; closesecondlife function (install) +LangString CloseSecondLifeInstDP ${LANG_POLISH} "Oczekiwanie na zamknięcie Singularity..." +LangString CloseSecondLifeInstMB ${LANG_POLISH} "Singularity nie może zostać zainstalowane, ponieważ jest już włączone.$\n$\nZakończ swoje działania i wybierz OK aby zamknąć Singularity i kontynuować.$\nWybierz CANCEL aby anulować instalację." + +; closesecondlife function (uninstall) +LangString CloseSecondLifeUnInstDP ${LANG_POLISH} "Oczekiwanie na zamknięcie Singularity..." +LangString CloseSecondLifeUnInstMB ${LANG_POLISH} "Singularity nie może zostać zainstalowane, ponieważ jest już włączone.$\n$\nZakończ swoje działania i wybierz OK aby zamknąć Singularity i kontynuować.$\nWybierz CANCEL aby anulować." + +; CheckNetworkConnection +LangString CheckNetworkConnectionDP ${LANG_POLISH} "Sprawdzanie połączenia sieciowego..." + +; removecachefiles +LangString RemoveCacheFilesDP ${LANG_POLISH} "Kasowanie plików pamięci podręcznej (cache) w folderze Documents and Settings" + +; delete program files +LangString DeleteProgramFilesMB ${LANG_POLISH} "Nadal istnieją pliki w katalogu instalacyjnym ${APPNAME}.$\n$\nMożliwe, że są to pliki, które stworzyłeś/stworzyłaś lub przeniosłeś/przeniosłaś do:$\n$INSTDIR$\n$\nCzy chcesz je usunąć?" + +; uninstall text +LangString UninstallTextMsg ${LANG_POLISH} "To spowoduje odinstalowanie ${APPNAME} ${VERSION_LONG} z Twojego systemu." diff --git a/indra/newview/installers/windows/lang_pt-br.nsi b/indra/newview/installers/windows/lang_pt-br.nsi index da56a3c33..8eaed25c5 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 new file mode 100644 index 000000000..e64e2b3e0 --- /dev/null +++ b/indra/newview/installers/windows/lang_ru.nsi @@ -0,0 +1,56 @@ +; First is default +!insertmacro MUI_LANGUAGE "Russian" + +; Language string +LangString LanguageCode ${LANG_RUSSIAN} "ru" + +; Language selection dialog +LangString SelectInstallerLanguage ${LANG_RUSSIAN} "Выберите язык программы установки" + +; installation directory text +LangString DirectoryChooseTitle ${LANG_RUSSIAN} "Каталог установки" +LangString DirectoryChooseUpdate ${LANG_RUSSIAN} "Выберите каталог ${APPNAME} для обновления до версии ${VERSION_LONG}.(XXX):" +LangString DirectoryChooseSetup ${LANG_RUSSIAN} "Выберите каталог для установки ${APPNAME}:" + +; CheckStartupParams message box +LangString CheckStartupParamsMB ${LANG_RUSSIAN} "Не удалось найти программу «$INSTPROG». Автоматическое обновление не выполнено." + +; check windows version +LangString CheckWindowsVersionDP ${LANG_RUSSIAN} "Проверка версии Windows..." +LangString CheckWindowsVersionMB ${LANG_RUSSIAN} '${APPNAME} может работать только в Windows XP.$\n$\nПопытка установки в Windows $R0 может привести к сбою и потере данных.$\n$\n' +LangString CheckWindowsServPackMB ${LANG_RUSSIAN} "It is recomended to run ${APPNAME} on the latest service pack for your operating system.$\nThis will help with performance and stability of the program." +LangString UseLatestServPackDP ${LANG_RUSSIAN} "Please use Windows Update to install the latest Service Pack." + +; checkifadministrator function (install) +LangString CheckAdministratorInstDP ${LANG_RUSSIAN} "Проверка разрешений на установку..." +LangString CheckAdministratorInstMB ${LANG_RUSSIAN} 'Вероятно, у вас ограниченный аккаунт.$\nДля установки ${APPNAME} необходимы права администратора.' + +; checkifadministrator function (uninstall) +LangString CheckAdministratorUnInstDP ${LANG_RUSSIAN} "Проверка разрешений на удаление..." +LangString CheckAdministratorUnInstMB ${LANG_RUSSIAN} 'Вероятно, у вас ограниченный аккаунт.$\nДля удаления ${APPNAME} необходимы права администратора.' + +; checkifalreadycurrent +LangString CheckIfCurrentMB ${LANG_RUSSIAN} "Вероятно, версия ${APPNAME} ${VERSION_LONG} уже установлена.$\n$\nУстановить ее снова?" + +; checkcpuflags +LangString MissingSSE2 ${LANG_RUSSIAN} "Возможно, на этом компьютере нет ЦП с поддержкой SSE2, которая необходима для работы ${APPNAME} ${VERSION_LONG}. Продолжить?" + +; closesecondlife function (install) +LangString CloseSecondLifeInstDP ${LANG_RUSSIAN} "Ожидаю завершения работы Singularity..." +LangString CloseSecondLifeInstMB ${LANG_RUSSIAN} "Singularity уже работает, выполнить установку невозможно.$\n$\nЗавершите текущую операцию и нажмите кнопку «OK», чтобы закрыть Singularity и продолжить установку.$\nНажмите кнопку «ОТМЕНА» для отказа от установки." + +; closesecondlife function (uninstall) +LangString CloseSecondLifeUnInstDP ${LANG_RUSSIAN} "Ожидаю завершения работы Singularity..." +LangString CloseSecondLifeUnInstMB ${LANG_RUSSIAN} "Singularity уже работает, выполнить удаление невозможно.$\n$\nЗавершите текущую операцию и нажмите кнопку «OK», чтобы закрыть Singularity и продолжить удаление.$\nНажмите кнопку «ОТМЕНА» для отказа от удаления." + +; CheckNetworkConnection +LangString CheckNetworkConnectionDP ${LANG_RUSSIAN} "Проверка подключения к сети..." + +; removecachefiles +LangString RemoveCacheFilesDP ${LANG_RUSSIAN} "Удаление файлов кэша из папки «Documents and Settings»" + +; delete program files +LangString DeleteProgramFilesMB ${LANG_RUSSIAN} "В каталоге программы ${APPNAME} остались файлы.$\n$\nВероятно, это файлы, созданные или перемещенные вами в $\n$INSTDIR$\n$\nУдалить их?" + +; uninstall text +LangString UninstallTextMsg ${LANG_RUSSIAN} "Программа ${APPNAME} ${VERSION_LONG} будет удалена из вашей системы." diff --git a/indra/newview/installers/windows/lang_tr.nsi b/indra/newview/installers/windows/lang_tr.nsi new file mode 100644 index 000000000..04da01bd2 --- /dev/null +++ b/indra/newview/installers/windows/lang_tr.nsi @@ -0,0 +1,56 @@ +; First is default +!insertmacro MUI_LANGUAGE "Turkish" + +; Language string +LangString LanguageCode ${LANG_TURKISH} "tr" + +; Language selection dialog +LangString SelectInstallerLanguage ${LANG_TURKISH} "Lütfen yükleyicinin dilini seçin" + +; installation directory text +LangString DirectoryChooseTitle ${LANG_TURKISH} "Yükleme Dizini" +LangString DirectoryChooseUpdate ${LANG_TURKISH} "${VERSION_LONG}.(XXX) sürümüne güncelleştirme yapmak için ${APPNAME} dizinini seçin:" +LangString DirectoryChooseSetup ${LANG_TURKISH} "${APPNAME}'ın yükleneceği dizini seçin:" + +; CheckStartupParams message box +LangString CheckStartupParamsMB ${LANG_TURKISH} "'$INSTPROG' programı bulunamadı. Sessiz güncelleştirme başarılamadı." + +; check windows version +LangString CheckWindowsVersionDP ${LANG_TURKISH} "Windows sürümü kontrol ediliyor..." +LangString CheckWindowsVersionMB ${LANG_TURKISH} "${APPNAME} sadece Windows XP'i destekler.$\n$\nWindows $R0 üzerine yüklemeye çalışmak sistem çökmelerine ve veri kaybına neden olabilir.$\n$\n" +LangString CheckWindowsServPackMB ${LANG_TURKISH} "It is recomended to run ${APPNAME} on the latest service pack for your operating system.$\nThis will help with performance and stability of the program." +LangString UseLatestServPackDP ${LANG_TURKISH} "Please use Windows Update to install the latest Service Pack." + +; checkifadministrator function (install) +LangString CheckAdministratorInstDP ${LANG_TURKISH} "Yükleme izni kontrol ediliyor..." +LangString CheckAdministratorInstMB ${LANG_TURKISH} "'Sınırlı' bir hesap kullanıyor görünüyorsunuz.$\n${APPNAME}'ı yüklemek için bir 'yönetici' olmalısınız." + +; checkifadministrator function (uninstall) +LangString CheckAdministratorUnInstDP ${LANG_TURKISH} "Kaldırma izni kontrol ediliyor..." +LangString CheckAdministratorUnInstMB ${LANG_TURKISH} "'Sınırlı' bir hesap kullanıyor görünüyorsunuz.$\n${APPNAME}'ı kaldırmak için bir 'yönetici' olmalısınız." + +; checkifalreadycurrent +LangString CheckIfCurrentMB ${LANG_TURKISH} "${APPNAME} ${VERSION_LONG} zaten yüklü.$\n$\nTekrar yüklemek ister misiniz?" + +; checkcpuflags +LangString MissingSSE2 ${LANG_TURKISH} "Bu makinede SSE2 desteğine sahip bir CPU bulunmayabilir, ${APPNAME} ${VERSION_LONG} çalıştırmak için bu gereklidir. Devam etmek istiyor musunuz?" + +; closesecondlife function (install) +LangString CloseSecondLifeInstDP ${LANG_TURKISH} "Singularity'ın kapatılması bekleniyor..." +LangString CloseSecondLifeInstMB ${LANG_TURKISH} "Singularity zaten çalışırken kapatılamaz.$\n$\nYaptığınız işi bitirdikten sonra Singularity'ı kapatmak ve devam etmek için Tamam seçimini yapın.$\nYüklemeyi iptal etmek için İPTAL seçimini yapın." + +; closesecondlife function (uninstall) +LangString CloseSecondLifeUnInstDP ${LANG_TURKISH} "Singularity'ın kapatılması bekleniyor..." +LangString CloseSecondLifeUnInstMB ${LANG_TURKISH} "Singularity zaten çalışırken kaldırılamaz.$\n$\nYaptığınız işi bitirdikten sonra Singularity'ı kapatmak ve devam etmek için Tamam seçimini yapın.$\nİptal etmek için İPTAL seçimini yapın." + +; CheckNetworkConnection +LangString CheckNetworkConnectionDP ${LANG_TURKISH} "Ağ bağlantısı kontrol ediliyor..." + +; removecachefiles +LangString RemoveCacheFilesDP ${LANG_TURKISH} "Belgeler ve Ayarlar klasöründeki önbellek dosyaları siliniyor" + +; delete program files +LangString DeleteProgramFilesMB ${LANG_TURKISH} "${APPNAME} program dizininizde hala dosyalar var.$\n$\nBunlar muhtemelen sizin oluşturduğunuz veya şuraya taşıdığınız dosyalar:$\n$INSTDIR$\n$\nBunları kaldırmak istiyor musunuz?" + +; uninstall text +LangString UninstallTextMsg ${LANG_TURKISH} "Bu adımla ${APPNAME} ${VERSION_LONG} sisteminizden kaldırılacaktır." diff --git a/indra/newview/installers/windows/lang_zh.nsi b/indra/newview/installers/windows/lang_zh.nsi index d17e860df..906f036fa 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/installers/windows/uninstall_icon.BMP b/indra/newview/installers/windows/uninstall_icon.BMP index 562b56676..e7291fcc3 100644 Binary files a/indra/newview/installers/windows/uninstall_icon.BMP and b/indra/newview/installers/windows/uninstall_icon.BMP differ diff --git a/indra/newview/installers/windows/uninstall_icon.ico b/indra/newview/installers/windows/uninstall_icon.ico index c4ec6c70b..290b1dc2b 100644 Binary files a/indra/newview/installers/windows/uninstall_icon.ico and b/indra/newview/installers/windows/uninstall_icon.ico differ diff --git a/indra/newview/installers/windows/uninstall_icon_singularity.BMP b/indra/newview/installers/windows/uninstall_icon_singularity.BMP deleted file mode 100644 index e7291fcc3..000000000 Binary files a/indra/newview/installers/windows/uninstall_icon_singularity.BMP and /dev/null differ diff --git a/indra/newview/installers/windows/uninstall_icon_singularity.ico b/indra/newview/installers/windows/uninstall_icon_singularity.ico deleted file mode 100644 index 290b1dc2b..000000000 Binary files a/indra/newview/installers/windows/uninstall_icon_singularity.ico and /dev/null differ diff --git a/indra/newview/installers/windows/uninstall_icon_snowglobe.BMP b/indra/newview/installers/windows/uninstall_icon_snowglobe.BMP deleted file mode 100644 index e7291fcc3..000000000 Binary files a/indra/newview/installers/windows/uninstall_icon_snowglobe.BMP and /dev/null differ diff --git a/indra/newview/installers/windows/uninstall_icon_snowglobe.ico b/indra/newview/installers/windows/uninstall_icon_snowglobe.ico deleted file mode 100644 index 290b1dc2b..000000000 Binary files a/indra/newview/installers/windows/uninstall_icon_snowglobe.ico and /dev/null differ diff --git a/indra/newview/installers/windows/uninstall_welcome.bmp b/indra/newview/installers/windows/uninstall_welcome.bmp new file mode 100644 index 000000000..097d09429 Binary files /dev/null and b/indra/newview/installers/windows/uninstall_welcome.bmp differ diff --git a/indra/newview/lgghunspell_wrapper.h b/indra/newview/lgghunspell_wrapper.h index 51c1f37a7..e89b49af2 100644 --- a/indra/newview/lgghunspell_wrapper.h +++ b/indra/newview/lgghunspell_wrapper.h @@ -19,9 +19,14 @@ #define ASPELL_WRAPPER 1 #if LL_WINDOWS -#include "hunspell/hunspelldll.h" +#pragma push_macro("near") +#ifdef near +#undef near +#endif +#include +#pragma pop_macro("near") #else -#include "hunspell/hunspell.hxx" +#include #endif class lggHunSpell_Wrapper diff --git a/indra/newview/linux_tools/wrapper.sh.in b/indra/newview/linux_tools/wrapper.sh similarity index 96% rename from indra/newview/linux_tools/wrapper.sh.in rename to indra/newview/linux_tools/wrapper.sh index 60c92485d..43b135a15 100755 --- a/indra/newview/linux_tools/wrapper.sh.in +++ b/indra/newview/linux_tools/wrapper.sh @@ -142,7 +142,7 @@ if [ -n "$LL_TCMALLOC" ]; then fi fi -export VIEWER_BINARY='@VIEWER_BRANDING_ID@-do-not-run-directly' +export VIEWER_BINARY='do-not-directly-run-singularity-bin' BINARY_TYPE=$(expr match "$(file -b bin/$VIEWER_BINARY)" '\(.*executable\)' | sed -e 's/ / /g') if [ "${BINARY_TYPE}" == "ELF 32-bit LSB executable" ]; then SL_ENV+='LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"' @@ -151,15 +151,9 @@ else fi export SL_CMD='$LL_WRAPPER bin/$VIEWER_BINARY' -if [ -n "$AITESTPLUGIN" ]; then - SL_CMD="$LL_WRAPPER bin/SLPlugin" - SL_OPT="TESTPLUGIN" -else - SL_OPT="`cat gridargs.dat` $@" -fi # Run the program. -eval ${SL_ENV} ${SL_CMD} ${SL_OPT} || LL_RUN_ERR=runerr +eval ${SL_ENV} ${SL_CMD} || LL_RUN_ERR=runerr # Handle any resulting errors if [ "$LL_RUN_ERR" = "runerr" ]; then diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index b6abc2514..f0ba1dbc7 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -430,7 +430,8 @@ LLAgent::LLAgent() : mMouselookModeInSignal(NULL), mMouselookModeOutSignal(NULL), - mPendingLure(NULL) + mPendingLure(NULL), + mFriendObserver(nullptr) { for (U32 i = 0; i < TOTAL_CONTROLS; i++) { @@ -650,7 +651,8 @@ void LLAgent::moveUp(S32 direction) setControlFlags(AGENT_CONTROL_UP_NEG | AGENT_CONTROL_FAST_UP); } - if (!mCrouch) camera_reset_on_motion(); + if (!mCrouch) + camera_reset_on_motion(); } //----------------------------------------------------------------------------- @@ -694,7 +696,7 @@ void LLAgent::movePitch(F32 mag) bool LLAgent::isCrouching() const { - return mCrouch && !getFlying(); // Never crouch when flying + return mCrouch && !getFlying(); } @@ -4685,20 +4687,14 @@ void LLAgent::sendAgentSetAppearance() } - static bool send_physics_params = false; - send_physics_params |= !!gAgentWearables.selfHasWearable(LLWearableType::WT_PHYSICS); S32 transmitted_params = 0; for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam(); param; param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam()) { - if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE || + param->getGroup() == VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT { - //A hack to prevent ruthing on older viewers when phys wearables aren't being worn. - if(!send_physics_params && param->getID() >= 10000) - { - break; - } msg->nextBlockFast(_PREHASH_VisualParam ); // We don't send the param ids. Instead, we assume that the receiver has the same params in the same sequence. diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index cb332a497..261e70acc 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -46,7 +46,10 @@ #include "llinventorymodel.h" #include "v3dmath.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 5a13ffe10..576aea61b 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -110,7 +110,7 @@ void LLAgentPilot::save(const std::string& filename) file << mActions.size() << '\n'; - S32 i; + U32 i; for (i = 0; i < mActions.size(); i++) { file << mActions[i].mTime << "\t" << mActions[i].mType << "\t"; @@ -184,7 +184,7 @@ void LLAgentPilot::updateTarget() { if (mPlaying) { - if (mCurrentAction < mActions.size()) + if (mCurrentAction < (S32)mActions.size()) { if (0 == mCurrentAction) { @@ -209,7 +209,7 @@ void LLAgentPilot::updateTarget() //gAgent.stopAutoPilot(); mCurrentAction++; - if (mCurrentAction < mActions.size()) + if (mCurrentAction < (S32)mActions.size()) { gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget); } diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 49f1d3a4b..dff462286 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1464,7 +1464,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it } #endif // If we got here, everything matches. - matched++; + //matched++; // TODO: Find out why this was here, this became unreachable at some point. } LL_DEBUGS("Avatar") << "matched " << matched << " mismatched " << mismatched << LL_ENDL; for (S32 j=0; j requested_item_ids; std::set current_item_ids; - for (S32 i=0; igetLinkedUUID(); //LL_INFOS() << "Requested attachment id " << requested_id << LL_ENDL; @@ -1941,11 +1941,10 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra } const LLInventoryItem* item = obj_item_array.at(i).get(); - bool replace = !gHippoGridManager->getConnectedGrid()->supportsInvLinks(); msg->nextBlockFast(_PREHASH_ObjectData ); msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); - msg->addU8Fast(_PREHASH_AttachmentPt, replace? 0 : ATTACHMENT_ADD); // Wear at the previous or default attachment point + msg->addU8Fast(_PREHASH_AttachmentPt, ATTACHMENT_ADD); // Wear at the previous or default attachment point // [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1) if ( (rlv_handler_t::isEnabled()) && (sInitialAttachmentsRequested) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) ) { diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index d12d592cc..dce3d22f6 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -267,21 +267,16 @@ void LLInitialWearablesFetch::processWearablesMessage() for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) { // Populate the current outfit folder with links to the wearables passed in the message -// InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback. -// [SL:KB] - Patch: Appearance-MixedViewers | Checked: 2010-05-02 (Catznip-3.0.0a) | Added: Catznip-2.0.0f - // Fixes minor leak: since COF is used onInitialWearableAssetArrived() will never get called and "wearable_data" leaks - InitialWearableData* wearable_data = &mAgentInitialWearables[i]; -// [/SL:KB] + const InitialWearableData& wearable_data = mAgentInitialWearables[i]; - if (wearable_data->mAssetID.notNull()) + if (wearable_data.mAssetID.notNull()) { - ids.push_back(wearable_data->mItemID); + ids.push_back(wearable_data.mItemID); } else { - LL_INFOS() << "Invalid wearable, type " << wearable_data->mType << " itemID " - << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << LL_ENDL; -// delete wearable_data; + LL_INFOS() << "Invalid wearable, type " << wearable_data.mType << " itemID " + << wearable_data.mItemID << " assetID " << wearable_data.mAssetID << LL_ENDL; } } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index f26034441..e2b5185e8 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1630,7 +1630,7 @@ void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id) // deactivate all gestures in the outfit folder LLInventoryModel::item_array_t gest_items; getDescendentsOfAssetType(cat_id, gest_items, LLAssetType::AT_GESTURE, true); - for(S32 i = 0; i < gest_items.size(); ++i) + for(U32 i = 0; i < gest_items.size(); ++i) { LLViewerInventoryItem *gest_item = gest_items[i]; if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) ) @@ -1855,7 +1855,12 @@ bool LLAppearanceMgr::getCanRemoveFromCOF(const LLUUID& outfit_cat_id) } LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false); - return gInventory.hasMatchingDirectDescendent(outfit_cat_id, is_worn, true); + // Singu Note: Diverge from LL here in order to dive into subfolder. + //return gInventory.hasMatchingDirectDescendent(outfit_cat_id, is_worn, true); + LLInventoryModel::item_array_t items; + LLInventoryModel::cat_array_t cats; + gInventory.collectDescendentsIf(outfit_cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_worn, /*follow_folder_links=*/ true); + return items.size(); } // static @@ -1961,7 +1966,7 @@ void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category, LLPointergetActualType() != LLAssetType::AT_LINK_FOLDER) @@ -1983,7 +1988,7 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin LLInventoryModel::item_array_t items; gInventory.collectDescendents(category, cats, items, LLInventoryModel::EXCLUDE_TRASH); - for (S32 i = 0; i < items.size(); ++i) + for (U32 i = 0; i < items.size(); ++i) { LLViewerInventoryItem *item = items.at(i); if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) @@ -2001,7 +2006,7 @@ void LLAppearanceMgr::filterWearableItems( LLInventoryModel::item_array_t& items, S32 max_per_type, S32 max_total) { // Restrict by max total items first. - if ((max_total > 0) && (items.size() > max_total)) + if ((max_total > 0) && ((S32)items.size() > max_total)) { LLInventoryModel::item_array_t items_to_keep; for (S32 i=0; igetLinkedUUID()) ) @@ -2634,7 +2639,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions, // callback will be called (and this object deleted) // before the final getNextData(). - for(S32 i = 0; i < wear_items.size(); ++i) + for(U32 i = 0; i < wear_items.size(); ++i) { LLViewerInventoryItem *item = wear_items.at(i); LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL; @@ -3796,7 +3801,7 @@ void RequestAgentUpdateAppearanceResponder::debugCOF(const LLSD& content) LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); - for (S32 i=0; igetUUID()); @@ -3904,7 +3909,7 @@ LLSD LLAppearanceMgr::dumpCOF() const LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(getCOF(),cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); - for (S32 i=0; igetLinkedItem() : NULL; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f3fd2e5d3..74e55f09a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -36,7 +36,7 @@ #include "hippogridmanager.h" #include "hippolimits.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "llfeaturemanager.h" #include "lluictrlfactory.h" #include "lltexteditor.h" @@ -563,7 +563,7 @@ LLAppViewer::LLAppViewer() : LL_ERRS() << "Oh no! An instance of LLAppViewer already exists! LLAppViewer is sort of like a singleton." << LL_ENDL; } - mDumpPath =""; + mDumpPath =""; // Need to do this initialization before we do anything else, since anything // that touches files should really go through the lldir API @@ -611,6 +611,7 @@ void load_default_bindings(bool zqsd) } } +/* Singu unused namespace { // With Xcode 6, _exit() is too magical to use with boost::bind(), so provide // this little helper function. @@ -619,6 +620,7 @@ void fast_exit(int rc) _exit(rc); } } +*/ bool LLAppViewer::init() { @@ -701,9 +703,9 @@ bool LLAppViewer::init() mDumpPath = logdir; setMiniDumpDir(logdir); logdir += gDirUtilp->getDirDelimiter(); - setDebugFileNames(logdir); + setDebugFileNames(logdir); - mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling")); + mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling")); { // Viewer metrics initialization //static LLCachedControl metrics_submode(gSavedSettings, @@ -719,7 +721,7 @@ bool LLAppViewer::init() LLViewerAssetStatsFF::init(); } - initThreads(); + initThreads(); LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ; // Load art UUID information, don't require these strings to be declared in code. @@ -753,16 +755,9 @@ bool LLAppViewer::init() // Setup notifications after LLUI::initClass() has been called. LLNotifications::instance().createDefaultChannels(); LL_INFOS("InitInfo") << "Notifications initialized." << LL_ENDL ; - - writeSystemInfo(); - // Build a string representing the current version number. - gCurrentVersion = llformat("%s %d.%d.%d.%d", - gVersionChannel, - gVersionMajor, - gVersionMinor, - gVersionPatch, - gVersionBuild ); + writeSystemInfo(); + ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -772,7 +767,7 @@ bool LLAppViewer::init() // // Various introspection concerning the libs we're using - particularly - // the libs involved in getting to a full login screen. + // the libs involved in getting to a full login screen. // LL_INFOS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL; LL_INFOS("InitInfo") << "libcurl version is: " << LLCurl::getVersionString() << LL_ENDL; @@ -1004,7 +999,8 @@ bool LLAppViewer::init() gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString(); // Save the current version to the prefs file - gSavedSettings.setString("LastRunVersion", gCurrentVersion); + gSavedSettings.setString("LastRunVersion", + LLVersionInfo::getChannelAndVersion()); gSimLastTime = gRenderStartTime.getElapsedTimeF32(); gSimFrames = (F32)gFrameCount; @@ -1053,16 +1049,16 @@ void LLAppViewer::initMaxHeapSize() HKEY hKey; - if(fnIsWow64Process && fnIsWow64Process(GetCurrentProcess(), &bWow64Process) && bWow64Process) + if(fnIsWow64Process && fnIsWow64Process(GetCurrentProcess(), &bWow64Process) && bWow64Process) { max_heap_size_gb = 3.7f; } else if(ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management"), &hKey)) { - DWORD dwSize = sizeof(DWORD); + DWORD dwSize = sizeof(DWORD); DWORD dwResult = 0; - if(ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("PhysicalAddressExtension"), NULL, NULL, (LPBYTE)&dwResult, &dwSize)) - { + if(ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("PhysicalAddressExtension"), NULL, NULL, (LPBYTE)&dwResult, &dwSize)) + { if(dwResult) max_heap_size_gb = 3.7f; } @@ -1147,17 +1143,17 @@ bool LLAppViewer::mainLoop() LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); joystick->setNeedsReset(true); - LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); + LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); // merge grid info from web site, if newer. if (gSavedSettings.getBOOL("CheckForGridUpdates")) gHippoGridManager->parseUrl(); - // As we do not (yet) send data on the mainloop LLEventPump that varies - // with each frame, no need to instantiate a new LLSD event object each - // time. Obviously, if that changes, just instantiate the LLSD at the - // point of posting. - LLSD newFrame; + // As we do not (yet) send data on the mainloop LLEventPump that varies + // with each frame, no need to instantiate a new LLSD event object each + // time. Obviously, if that changes, just instantiate the LLSD at the + // point of posting. + LLSD newFrame; BOOL restore_rendering_masks = FALSE; @@ -1233,8 +1229,8 @@ bool LLAppViewer::mainLoop() mem_leak_instance->idle() ; } - // canonical per-frame event - mainloop.post(newFrame); + // canonical per-frame event + mainloop.post(newFrame); if (!LLApp::isExiting()) { @@ -1253,9 +1249,7 @@ bool LLAppViewer::mainLoop() joystick->scanJoystick(); gKeyboard->scanKeyboard(); if (gAgent.isCrouching()) - { gAgent.moveUp(-1); - } } @@ -1368,24 +1362,24 @@ bool LLAppViewer::mainLoop() S32 io_pending = 0; { LLFastTimer ftm(FTM_TEXTURE_CACHE); - work_pending += LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread + work_pending += LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread } { LLFastTimer ftm(FTM_DECODE); - work_pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread + work_pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread } { LLFastTimer ftm(FTM_DECODE); - work_pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread + work_pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread } { LLFastTimer ftm(FTM_VFS); - io_pending += LLVFSThread::updateClass(1); + io_pending += LLVFSThread::updateClass(1); } { LLFastTimer ftm(FTM_LFS); - io_pending += LLLFSThread::updateClass(1); + io_pending += LLLFSThread::updateClass(1); } if (io_pending > 1000) @@ -1536,7 +1530,7 @@ bool LLAppViewer::cleanup() LL_INFOS() << "HUD Objects cleaned up" << LL_ENDL; } - // End TransferManager before deleting systems it depends on (Audio, VFS, AssetStorage) + // End TransferManager before deleting systems it depends on (Audio, VFS, AssetStorage) #if 0 // this seems to get us stuck in an infinite loop... gTransferManager.cleanup(); #endif @@ -1667,7 +1661,7 @@ bool LLAppViewer::cleanup() // *Note: this is where gViewerStats used to be deleted. - //end_messaging_system(); + //end_messaging_system(); LLFollowCamMgr::cleanupClass(); //LLVolumeMgr::cleanupClass(); @@ -1797,11 +1791,11 @@ bool LLAppViewer::cleanup() sTextureFetch->shutDownTextureCacheThread(); sTextureFetch->shutDownImageDecodeThread(); delete sTextureCache; - sTextureCache = NULL; + sTextureCache = NULL; delete sTextureFetch; - sTextureFetch = NULL; + sTextureFetch = NULL; delete sImageDecodeThread; - sImageDecodeThread = NULL; + sImageDecodeThread = NULL; LL_INFOS() << "Cleaning up Media and Textures" << LL_ENDL; @@ -1884,7 +1878,7 @@ bool LLAppViewer::cleanup() MEM_TRACK_RELEASE - LL_INFOS() << "Goodbye!" << LL_ENDL; + LL_INFOS() << "Goodbye!" << LL_ENDL; // return 0; return true; @@ -2001,8 +1995,8 @@ bool init_logging() } bool LLAppViewer::loadSettingsFromDirectory(AIReadAccess const& settings_r, - std::string const& location_key, - bool set_defaults) + std::string const& location_key, + bool set_defaults) { // Find and vet the location key. if(!mSettingsLocationList.has(location_key)) @@ -2033,7 +2027,7 @@ bool LLAppViewer::loadSettingsFromDirectory(AIReadAccess cons settings_map_type::const_iterator const settings_group_iter = settings_r->find(settings_group); LL_INFOS() << "Attempting to load settings for the group " << settings_group - << " - from location " << location_key << LL_ENDL; + << " - from location " << location_key << LL_ENDL; if(settings_group_iter == settings_r->end()) { @@ -2125,7 +2119,7 @@ bool LLAppViewer::initConfiguration() LL_INFOS() << "Loading settings file list" << settings_file_list << LL_ENDL; if (0 == settings_control.loadFromFile(settings_file_list)) { - LL_ERRS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL; + LL_ERRS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL; } mSettingsLocationList = settings_control.getLLSD("Locations"); @@ -2136,7 +2130,7 @@ bool LLAppViewer::initConfiguration() // - set procedural settings values // - read command line settings // - selectively apply settings needed to load user settings. - // - load overrides from user_settings + // - load overrides from user_settings // - apply command line settings (to override the overrides) // - load per account settings (happens in llstartup @@ -2159,9 +2153,9 @@ bool LLAppViewer::initConfiguration() // - set procedural settings gSavedSettings.setString("ClientSettingsFile", - gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global"))); + gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global"))); - gSavedSettings.setString("VersionChannelName", gVersionChannel); + gSavedSettings.setString("VersionChannelName", LLVersionInfo::getChannel()); #if 0 //#ifndef LL_RELEASE_FOR_DOWNLOAD // provide developer build only overrides for these control variables that are not @@ -2268,6 +2262,33 @@ bool LLAppViewer::initConfiguration() LL_INFOS() << "Using command line specified settings filename: " << user_settings_filename << LL_ENDL; } + else + { + std::string channel(LLVersionInfo::getChannel()); + LLStringUtil::toLower(channel); + switch (LLVersionInfo::getViewerMaturity()) + { + default: + case LLVersionInfo::TEST_VIEWER: + case LLVersionInfo::PROJECT_VIEWER: + case LLVersionInfo::ALPHA_VIEWER: + case LLVersionInfo::BETA_VIEWER: + { + channel.erase(std::remove_if(channel.begin(), channel.end(), isspace), channel.end()); + break; + } + case LLVersionInfo::RELEASE_VIEWER: + size_t pos = channel.find(' '); + if (pos != channel.npos) + channel.erase(pos, channel.npos); + break; + } + std::string settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, + llformat("settings_%s.xml", channel.c_str())); + gSavedSettings.setString("ClientSettingsFile", settings_filename); + LL_INFOS() << "Using default settings filename from channel: " + << settings_filename << LL_ENDL; + } // - load overrides from user_settings loadSettingsFromDirectory(settings_w, "User"); @@ -2305,33 +2326,33 @@ bool LLAppViewer::initConfiguration() return false; } - if(clp.hasOption("set")) - { - const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); - if(0x1 & set_values.size()) - { - LL_WARNS() << "Invalid '--set' parameter count." << LL_ENDL; - } - else - { - LLCommandLineParser::token_vector_t::const_iterator itr = set_values.begin(); - for(; itr != set_values.end(); ++itr) - { - const std::string& name = *itr; - const std::string& value = *(++itr); - LLControlVariable* c = settings[sGlobalSettingsName]->getControl(name); - if(c) - { - c->setValue(value, false); - } - else - { - LL_WARNS() << "'--set' specified with unknown setting: '" - << name << "'." << LL_ENDL; - } - } - } - } + if(clp.hasOption("set")) + { + const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); + if(0x1 & set_values.size()) + { + LL_WARNS() << "Invalid '--set' parameter count." << LL_ENDL; + } + else + { + LLCommandLineParser::token_vector_t::const_iterator itr = set_values.begin(); + for(; itr != set_values.end(); ++itr) + { + const std::string& name = *itr; + const std::string& value = *(++itr); + LLControlVariable* c = settings[sGlobalSettingsName]->getControl(name); + if(c) + { + c->setValue(value, false); + } + else + { + LL_WARNS() << "'--set' specified with unknown setting: '" + << name << "'." << LL_ENDL; + } + } + } + } if (!gHippoGridManager) { @@ -2359,40 +2380,40 @@ bool LLAppViewer::initConfiguration() // Handle slurl use. NOTE: Don't let SL-55321 reappear. - // *FIX: This init code should be made more robust to prevent - // the issue SL-55321 from returning. One thought is to allow - // only select options to be set from command line when a slurl - // is specified. More work on the settings system is needed to - // achieve this. For now... + // *FIX: This init code should be made more robust to prevent + // the issue SL-55321 from returning. One thought is to allow + // only select options to be set from command line when a slurl + // is specified. More work on the settings system is needed to + // achieve this. For now... - // *NOTE:Mani The command line parser parses tokens and is - // setup to bail after parsing the '--url' option or the - // first option specified without a '--option' flag (or - // any other option that uses the 'last_option' setting - - // see LLControlGroupCLP::configure()) + // *NOTE:Mani The command line parser parses tokens and is + // setup to bail after parsing the '--url' option or the + // first option specified without a '--option' flag (or + // any other option that uses the 'last_option' setting - + // see LLControlGroupCLP::configure()) - // What can happen is that someone can use IE (or potentially - // other browsers) and do the rough equivalent of command - // injection and steal passwords. Phoenix. SL-55321 - if(clp.hasOption("url")) - { + // What can happen is that someone can use IE (or potentially + // other browsers) and do the rough equivalent of command + // injection and steal passwords. Phoenix. SL-55321 + if(clp.hasOption("url")) + { LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0])); if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) { gHippoGridManager->setCurrentGrid(LLStartUp::getStartSLURL().getGrid()); } - } - else if(clp.hasOption("slurl")) - { + } + else if(clp.hasOption("slurl")) + { LLSLURL start_slurl(clp.getOption("slurl")[0]); LLStartUp::setStartSLURL(start_slurl); - } + } - const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); - if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) - { - gDirUtilp->setSkinFolder(skinfolder->getValue().asString()); - } + const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); + if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) + { + gDirUtilp->setSkinFolder(skinfolder->getValue().asString()); + } // XUI:translate gSecondLife = "Singularity Viewer"; @@ -2460,9 +2481,9 @@ bool LLAppViewer::initConfiguration() if (!gSavedSettings.getBOOL("AllowMultipleViewers")) { - // - // Check for another instance of the app running - // + // + // Check for another instance of the app running + // mSecondInstance = anotherInstanceRunning(); @@ -2478,8 +2499,8 @@ bool LLAppViewer::initConfiguration() } initMarkerFile(); - - } + + } else { mSecondInstance = anotherInstanceRunning(); @@ -2497,10 +2518,10 @@ bool LLAppViewer::initConfiguration() } initMarkerFile(); - + } - // need to do this here - need to have initialized global settings first + // need to do this here - need to have initialized global settings first std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); if ( !nextLoginLocation.empty() ) { @@ -2584,19 +2605,19 @@ bool LLAppViewer::initWindow() void LLAppViewer::writeDebugInfo(bool isStatic) { - //Try to do the minimum when writing data during a crash. - std::string* debug_filename; - debug_filename = ( isStatic - ? getStaticDebugFile() - : getDynamicDebugFile() ); - + //Try to do the minimum when writing data during a crash. + std::string* debug_filename; + debug_filename = ( isStatic + ? getStaticDebugFile() + : getDynamicDebugFile() ); + LL_INFOS() << "Opening debug file " << *debug_filename << LL_ENDL; llofstream out_file(*debug_filename); - - isStatic ? LLSDSerialize::toPrettyXML(gDebugInfo, out_file) - : LLSDSerialize::toPrettyXML(gDebugInfo["Dynamic"], out_file); - - + + isStatic ? LLSDSerialize::toPrettyXML(gDebugInfo, out_file) + : LLSDSerialize::toPrettyXML(gDebugInfo["Dynamic"], out_file); + + out_file.close(); } @@ -2647,17 +2668,18 @@ void LLAppViewer::removeCacheFiles(const std::string& file_mask) void LLAppViewer::writeSystemInfo() { - - if (! gDebugInfo.has("Dynamic") ) - gDebugInfo["Dynamic"] = LLSD::emptyMap(); - + + if (! gDebugInfo.has("Dynamic") ) + gDebugInfo["Dynamic"] = LLSD::emptyMap(); + gDebugInfo["SLLog"] = LLError::logFileName(); - gDebugInfo["ClientInfo"]["Name"] = gVersionChannel; - gDebugInfo["ClientInfo"]["MajorVersion"] = gVersionMajor; - gDebugInfo["ClientInfo"]["MinorVersion"] = gVersionMinor; - gDebugInfo["ClientInfo"]["PatchVersion"] = gVersionPatch; - gDebugInfo["ClientInfo"]["BuildVersion"] = gVersionBuild; + gDebugInfo["ClientInfo"]["Name"] = LLVersionInfo::getChannel(); + gDebugInfo["ClientInfo"]["MajorVersion"] = LLVersionInfo::getMajor(); + gDebugInfo["ClientInfo"]["MinorVersion"] = LLVersionInfo::getMinor(); + gDebugInfo["ClientInfo"]["PatchVersion"] = LLVersionInfo::getPatch(); + gDebugInfo["ClientInfo"]["BuildVersion"] = LLVersionInfo::getBuild(); + #if defined(_WIN64) || defined(__x86_64__) gDebugInfo["ClientInfo"]["Architecture"] = "x86_64"; #else @@ -2703,9 +2725,8 @@ void LLAppViewer::writeSystemInfo() } // Dump some debugging info - LL_INFOS("SystemInfo") << LLTrans::getString("APP_NAME") - << " version " << gVersionMajor << "." << gVersionMinor << "." << gVersionPatch - << LL_ENDL; + LL_INFOS("SystemInfo") << "Application: " << LLTrans::getString("APP_NAME") << LL_ENDL; + LL_INFOS("SystemInfo") << "Version: " << LLVersionInfo::getChannelAndVersion() << LL_ENDL; // Dump the local time and time zone time_t now; @@ -2763,15 +2784,6 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["Dynamic"]["CrashHostUrl"] = crashHostUrl; } - //We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version - //to check against no matter what - gDebugInfo["ClientInfo"]["Name"] = gVersionChannel; - - gDebugInfo["ClientInfo"]["MajorVersion"] = gVersionMajor; - gDebugInfo["ClientInfo"]["MinorVersion"] = gVersionMinor; - gDebugInfo["ClientInfo"]["PatchVersion"] = gVersionPatch; - gDebugInfo["ClientInfo"]["BuildVersion"] = gVersionBuild; - LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if ( parcel && parcel->getMusicURL()[0]) { @@ -2821,7 +2833,7 @@ void LLAppViewer::handleViewerCrash() // The crash is being handled here so set this value to false. // Otherwise the crash logger will think this crash was a freeze. gDebugInfo["Dynamic"]["CrashNotHandled"] = (LLSD::Boolean)false; - + //Write out the crash status file //Use marker file style setup, as that's the simplest, especially since //we're already in a crash situation @@ -2848,7 +2860,7 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["Dynamic"]["MinidumpPath"] = minidump_file; } - gDebugInfo["Dynamic"]["CrashType"]="crash"; + gDebugInfo["Dynamic"]["CrashType"]="crash"; if (gMessageSystem && gDirUtilp) { @@ -3021,10 +3033,10 @@ void LLAppViewer::removeMarkerFile(bool leave_logout_marker) void LLAppViewer::removeDumpDir() { - //Call this routine only on clean exit. Crash reporter will clean up - //its locking table for us. - std::string dump_dir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, ""); - gDirUtilp->deleteDirAndContents(dump_dir); + //Call this routine only on clean exit. Crash reporter will clean up + //its locking table for us. + std::string dump_dir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, ""); + gDirUtilp->deleteDirAndContents(dump_dir); } void LLAppViewer::forceQuit() @@ -3130,7 +3142,7 @@ static bool finish_early_exit(const LLSD& notification, const LLSD& response) void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions) { - LL_WARNS() << "app_early_exit: " << name << LL_ENDL; + LL_WARNS() << "app_early_exit: " << name << LL_ENDL; gDoDisconnect = TRUE; LLNotificationsUtil::add(name, substitutions, LLSD(), finish_early_exit); } @@ -3138,7 +3150,7 @@ void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions) void LLAppViewer::abortQuit() { - LL_INFOS() << "abortQuit()" << LL_ENDL; + LL_INFOS() << "abortQuit()" << LL_ENDL; mQuitRequested = false; } @@ -3215,39 +3227,39 @@ void LLAppViewer::migrateCacheDirectory() void dumpVFSCaches() { - LL_INFOS() << "======= Static VFS ========" << LL_ENDL; - gStaticVFS->listFiles(); + LL_INFOS() << "======= Static VFS ========" << LL_ENDL; + gStaticVFS->listFiles(); #if LL_WINDOWS - LL_INFOS() << "======= Dumping static VFS to StaticVFSDump ========" << LL_ENDL; - WCHAR w_str[MAX_PATH]; - GetCurrentDirectory(MAX_PATH, w_str); - S32 res = LLFile::mkdir("StaticVFSDump"); - if (res == -1) - { - if (errno != EEXIST) - { - LL_WARNS() << "Couldn't create dir StaticVFSDump" << LL_ENDL; - } - } - SetCurrentDirectory(utf8str_to_utf16str("StaticVFSDump").c_str()); - gStaticVFS->dumpFiles(); - SetCurrentDirectory(w_str); + LL_INFOS() << "======= Dumping static VFS to StaticVFSDump ========" << LL_ENDL; + WCHAR w_str[MAX_PATH]; + GetCurrentDirectory(MAX_PATH, w_str); + S32 res = LLFile::mkdir("StaticVFSDump"); + if (res == -1) + { + if (errno != EEXIST) + { + LL_WARNS() << "Couldn't create dir StaticVFSDump" << LL_ENDL; + } + } + SetCurrentDirectory(utf8str_to_utf16str("StaticVFSDump").c_str()); + gStaticVFS->dumpFiles(); + SetCurrentDirectory(w_str); #endif - LL_INFOS() << "========= Dynamic VFS ====" << LL_ENDL; - gVFS->listFiles(); + LL_INFOS() << "========= Dynamic VFS ====" << LL_ENDL; + gVFS->listFiles(); #if LL_WINDOWS - LL_INFOS() << "========= Dumping dynamic VFS to VFSDump ====" << LL_ENDL; - res = LLFile::mkdir("VFSDump"); - if (res == -1) - { - if (errno != EEXIST) - { - LL_WARNS() << "Couldn't create dir VFSDump" << LL_ENDL; - } - } - SetCurrentDirectory(utf8str_to_utf16str("VFSDump").c_str()); - gVFS->dumpFiles(); - SetCurrentDirectory(w_str); + LL_INFOS() << "========= Dumping dynamic VFS to VFSDump ====" << LL_ENDL; + res = LLFile::mkdir("VFSDump"); + if (res == -1) + { + if (errno != EEXIST) + { + LL_WARNS() << "Couldn't create dir VFSDump" << LL_ENDL; + } + } + SetCurrentDirectory(utf8str_to_utf16str("VFSDump").c_str()); + gVFS->dumpFiles(); + SetCurrentDirectory(w_str); #endif } @@ -3335,16 +3347,16 @@ bool LLAppViewer::initCache() // Init the texture cache // Allocate 80% of the cache size for textures - const S32 MB = 1024 * 1024; - const S64 MIN_CACHE_SIZE = 64 * MB; - const S64 MAX_CACHE_SIZE = 9984ll * MB; - const S64 MAX_VFS_SIZE = 1024 * MB; // 1 GB + const U32 MB = 1024 * 1024; + const U64 MIN_CACHE_SIZE = 64 * MB; + const U64 MAX_CACHE_SIZE = 9984ll * MB; + const U64 MAX_VFS_SIZE = 1024 * MB; // 1 GB - S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; + U64 cache_size = (U64)(gSavedSettings.getU32("CacheSize")) * MB; cache_size = llclamp(cache_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE); - S64 texture_cache_size = ((cache_size * 8) / 10); - S64 vfs_size = cache_size - texture_cache_size; + U64 texture_cache_size = ((cache_size * 8) / 10); + U64 vfs_size = cache_size - texture_cache_size; if (vfs_size > MAX_VFS_SIZE) { @@ -3354,7 +3366,7 @@ bool LLAppViewer::initCache() texture_cache_size = cache_size - MAX_VFS_SIZE; } - S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch); + U64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch); texture_cache_size -= extra; LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion()) ; @@ -3544,7 +3556,7 @@ bool finish_disconnect(const LLSD& notification, const LLSD& response) if (1 == option) { - LLAppViewer::instance()->forceQuit(); + LLAppViewer::instance()->forceQuit(); } return false; } @@ -3560,11 +3572,11 @@ bool finish_forced_disconnect(const LLSD& notification, const LLSD& response) void LLAppViewer::forceDisconnect(const std::string& mesg) { if (gDoDisconnect) - { + { // Already popped up one of these dialogs, don't // do this again. return; - } + } // Translate the message if possible std::string big_reason = LLAgent::sTeleportErrorMessages[mesg]; @@ -4297,7 +4309,7 @@ void LLAppViewer::sendLogoutRequest() if (mLogoutMarkerFile) { LL_INFOS() << "Created logout marker file " << mLogoutMarkerFileName << LL_ENDL; - apr_file_close(mLogoutMarkerFile); + apr_file_close(mLogoutMarkerFile); } else { @@ -4333,15 +4345,15 @@ void LLAppViewer::idleNameCache() if (have_capability) { // we have support for display names, use it - U32 url_size = name_lookup_url.size(); - // capabilities require URLs with slashes before query params: - // https://:/cap//?ids= - // but the caps are granted like: - // https://:/cap/ - if (url_size > 0 && name_lookup_url[url_size-1] != '/') - { - name_lookup_url += '/'; - } + U32 url_size = name_lookup_url.size(); + // capabilities require URLs with slashes before query params: + // https://:/cap//?ids= + // but the caps are granted like: + // https://:/cap/ + if (url_size > 0 && name_lookup_url[url_size-1] != '/') + { + name_lookup_url += '/'; + } LLAvatarNameCache::setNameLookupURL(name_lookup_url); } else @@ -4476,7 +4488,7 @@ void LLAppViewer::idleNetwork() LLUUID this_region_id = agent_region->getRegionID(); bool this_region_alive = agent_region->isAlive(); if ((mAgentRegionLastAlive && !this_region_alive) // newly dead - && (mAgentRegionLastID == this_region_id)) // same region + && (mAgentRegionLastID == this_region_id)) // same region { forceDisconnect(LLTrans::getString("AgentLostConnection")); } @@ -4492,7 +4504,7 @@ void LLAppViewer::idleAudio() if (gAudiop) { - audio_update_volume(); + audio_update_volume(); audio_update_listener(); // this line actually commits the changes we've made to source positions, etc. @@ -4505,19 +4517,7 @@ void LLAppViewer::shutdownAudio() if (gAudiop) { // shut down the audio subsystem - - bool want_longname = false; - if (gAudiop->getDriverName(want_longname) == "FMOD") - { - // This hack exists because fmod likes to occasionally - // crash or hang forever when shutting down, for no - // apparent reason. - LL_WARNS() << "Hack, skipping FMOD audio engine cleanup" << LL_ENDL; - } - else - { - gAudiop->shutdown(); - } + gAudiop->shutdown(); delete gAudiop; gAudiop = NULL; @@ -4632,37 +4632,37 @@ void LLAppViewer::disconnectViewer() void LLAppViewer::forceErrorLLError() { - LL_ERRS() << "This is an llerror" << LL_ENDL; + LL_ERRS() << "This is an llerror" << LL_ENDL; } void LLAppViewer::forceErrorBreakpoint() { #ifdef LL_WINDOWS - DebugBreak(); + DebugBreak(); #endif - return; + return; } void LLAppViewer::forceErrorBadMemoryAccess() { - S32* crash = NULL; - *crash = 0xDEADBEEF; - return; + S32* crash = NULL; + *crash = 0xDEADBEEF; + return; } void LLAppViewer::forceErrorInfiniteLoop() { - while(true) - { - ; - } - return; + while(true) + { + ; + } + return; } void LLAppViewer::forceErrorSoftwareException() { - // *FIX: Any way to insure it won't be handled? - throw; + // *FIX: Any way to insure it won't be handled? + throw; } void LLAppViewer::forceErrorDriverCrash() @@ -4736,12 +4736,12 @@ void LLAppViewer::handleLoginComplete() initMainloopTimeout("Mainloop Init"); // Store some data to DebugInfo in case of a freeze. - gDebugInfo["ClientInfo"]["Name"] = gVersionChannel; + gDebugInfo["ClientInfo"]["Name"] = LLVersionInfo::getChannel(); - gDebugInfo["ClientInfo"]["MajorVersion"] = gVersionMajor; - gDebugInfo["ClientInfo"]["MinorVersion"] = gVersionMinor; - gDebugInfo["ClientInfo"]["PatchVersion"] = gVersionPatch; - gDebugInfo["ClientInfo"]["BuildVersion"] = gVersionBuild; + gDebugInfo["ClientInfo"]["MajorVersion"] = LLVersionInfo::getMajor(); + gDebugInfo["ClientInfo"]["MinorVersion"] = LLVersionInfo::getMinor(); + gDebugInfo["ClientInfo"]["PatchVersion"] = LLVersionInfo::getPatch(); + gDebugInfo["ClientInfo"]["BuildVersion"] = LLVersionInfo::getBuild(); LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if ( parcel && parcel->getMusicURL()[0]) diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp index ff839b700..f56a75c59 100644 --- a/indra/newview/llappviewerlinux_api_dbus.cpp +++ b/indra/newview/llappviewerlinux_api_dbus.cpp @@ -47,9 +47,9 @@ extern "C" { #include "apr_dso.h" } -#define DEBUGMSG(...) LL_DEBUGS() << llformat(__VA_ARGS__) << llendl -#define INFOMSG(...) LL_INFOS() << llformat(__VA_ARGS__) << llendl -#define WARNMSG(...) LL_WARNS() << llformat(__VA_ARGS__) << llendl +#define DEBUGMSG(...) LL_DEBUGS() << llformat(__VA_ARGS__) << LL_ENDL +#define INFOMSG(...) LL_INFOS() << llformat(__VA_ARGS__) << LL_ENDL +#define WARNMSG(...) LL_WARNS() << llformat(__VA_ARGS__) << LL_ENDL #define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) RTN (*ll##DBUSSYM)(__VA_ARGS__) = NULL #include "llappviewerlinux_api_dbus_syms_raw.inc" diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 0f103fd6c..daa379ff4 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -122,6 +122,8 @@ bool create_app_mutex() return result; } +#define NVAPI_APPNAME L"Second Life" + void ll_nvapi_init(NvDRSSessionHandle hSession) { // (2) load all the system settings into the session @@ -132,12 +134,9 @@ void ll_nvapi_init(NvDRSSessionHandle hSession) return; } - NvAPI_UnicodeString profile_name; - //std::string app_name = LLTrans::getString("APP_NAME"); - std::string app_name("Second Life"); // - llutf16string w_app_name = utf8str_to_utf16str(app_name); - wsprintf(profile_name, L"%s", w_app_name.c_str()); - status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name); + NvAPI_UnicodeString wsz = { 0 }; + memcpy_s(wsz, sizeof(wsz), NVAPI_APPNAME, sizeof(NVAPI_APPNAME)); + status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, wsz); if (status != NVAPI_OK) { nvapi_error(status); @@ -409,11 +408,8 @@ const S32 MAX_CONSOLE_LINES = 500; void create_console() { - int h_con_handle; - long l_std_handle; CONSOLE_SCREEN_BUFFER_INFO coninfo; - FILE *fp; // allocate a console for this app AllocConsole(); @@ -423,48 +419,16 @@ void create_console() coninfo.dwSize.Y = MAX_CONSOLE_LINES; SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize); - // redirect unbuffered STDOUT to the console - l_std_handle = (long)GetStdHandle(STD_OUTPUT_HANDLE); - h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); - if (h_con_handle == -1) - { - LL_WARNS() << "create_console() failed to open stdout handle" << LL_ENDL; - } - else - { - fp = _fdopen( h_con_handle, "w" ); - *stdout = *fp; - setvbuf( stdout, NULL, _IONBF, 0 ); - } + // Redirect the CRT standard input, output, and error handles to the console + freopen("CONIN$", "r", stdin); + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + + setvbuf( stdin, NULL, _IONBF, 0 ); + setvbuf( stdout, NULL, _IONBF, 0 ); + setvbuf( stderr, NULL, _IONBF, 0 ); - // redirect unbuffered STDIN to the console - l_std_handle = (long)GetStdHandle(STD_INPUT_HANDLE); - h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); - if (h_con_handle == -1) - { - LL_WARNS() << "create_console() failed to open stdin handle" << LL_ENDL; - } - else - { - fp = _fdopen( h_con_handle, "r" ); - *stdin = *fp; - setvbuf( stdin, NULL, _IONBF, 0 ); - } - // redirect unbuffered STDERR to the console - l_std_handle = (long)GetStdHandle(STD_ERROR_HANDLE); - h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); - if (h_con_handle == -1) - { - LL_WARNS() << "create_console() failed to open stderr handle" << LL_ENDL; - } - else - { - fp = _fdopen( h_con_handle, "w" ); - *stderr = *fp; - setvbuf( stderr, NULL, _IOFBF, 1024 ); //Assigning a buffer improves speed a LOT, esp on vista/win7 - //_IOLBF is borked. - } } diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 162fd05c4..64846dcd0 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -33,6 +33,14 @@ #include #include +// For Flags in AvatarPropertiesReply +constexpr U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not +constexpr U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature" +constexpr U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info +constexpr U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info +constexpr U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known. +constexpr U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified + /* *TODO Vadim: This needs some refactoring: - Remove EAvatarProcessorType in favor of separate observers, derived from a common parent (to get rid of void*). diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index c50c328cc..02d2e22de 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -181,12 +181,18 @@ public: { mNotifyCallback(*value); } - } - virtual bool is_required(void) const - { - return mIsRequired; - } + + virtual bool is_required(void) const + { + return mIsRequired; + } + + virtual bool adjacent_tokens_only() const + { + return false; + } + protected: void xparse(boost::any& value_store, const std::vector& new_tokens) const diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 81db452f8..ee5170721 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -50,13 +50,13 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -//#include "lscript_rt_interface.h" #include "llviewercontrol.h" #include "llviewerobject.h" #include "llviewerregion.h" #include "llresmgr.h" #include "llbutton.h" +#include "llscrolllistctrl.h" #include "lldir.h" #include "llnotificationsutil.h" #include "llfloaterchat.h" @@ -66,6 +66,9 @@ #include "llselectmgr.h" +// *TODO: This should be separated into the script queue, and the floater views of that queue. +// There should only be one floater class that can view any queue type + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- @@ -96,22 +99,20 @@ LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name, const std::string& start_string) : LLFloater(name, rect, title, RESIZE_YES, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, - DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES) + DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES), + mMessages(nullptr), + mCloseBtn(nullptr), + mDone(false), + mMono(false) { mID.generate(); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_queue.xml"); - - childSetAction("close",onCloseBtn,this); - childSetEnabled("close",FALSE); - setTitle(title); LLRect curRect = getRect(); translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); - mStartString = start_string; - mDone = FALSE; sInstances.addData(mID, this); } @@ -121,18 +122,20 @@ LLFloaterScriptQueue::~LLFloaterScriptQueue() sInstances.removeData(mID); } +BOOL LLFloaterScriptQueue::postBuild() +{ + childSetAction("close",onCloseBtn,this); + getChildView("close")->setEnabled(FALSE); + return TRUE; +} + // find an instance by ID. Return NULL if it does not exist. // static LLFloaterScriptQueue* LLFloaterScriptQueue::findInstance(const LLUUID& id) { - if(sInstances.checkData(id)) - { - return sInstances.getData(id); - } - return NULL; + return sInstances.checkData(id) ? sInstances.getData(id) : NULL; } - // This is the callback method for the viewer object currently being // worked on. // NOT static, virtual! @@ -188,7 +191,6 @@ void LLFloaterScriptQueue::addObject(const LLUUID& id) BOOL LLFloaterScriptQueue::start() { - //LL_INFOS() << "LLFloaterCompileQueue::start()" << LL_ENDL; std::string buffer; LLStringUtil::format_map_t args; @@ -198,7 +200,7 @@ BOOL LLFloaterScriptQueue::start() getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); - return nextObject(); + return startQueue(); } BOOL LLFloaterScriptQueue::isDone() const @@ -263,6 +265,42 @@ BOOL LLFloaterScriptQueue::popNext() return rv; } +BOOL LLFloaterScriptQueue::startQueue() +{ + return nextObject(); +} + +#if 0 // Singu TODO: Experiences +class CompileQueueExperienceResponder : public LLHTTPClient::ResponderWithResult +{ +public: + CompileQueueExperienceResponder(const LLUUID& parent):mParent(parent) + { + } + + LLUUID mParent; + + /*virtual*/ void httpSuccess() + { + sendResult(getContent()); + } + /*virtual*/ void httpFailure() + { + sendResult(LLSD()); + } + void sendResult(const LLSD& content) + { + LLFloaterCompileQueue* queue = (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mParent); + if(!queue) + return; + + queue->experienceIdsReceived(content["experience_ids"]); + } + /*virtual*/ char const* getName() const { return "RequiredRubbish"; } +}; +#endif + + ///---------------------------------------------------------------------------- /// Class LLFloaterCompileQueue @@ -303,7 +341,7 @@ private: }; // static -LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono) +LLFloaterCompileQueue* LLFloaterCompileQueue::create(bool mono) { S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); @@ -312,7 +350,7 @@ LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono) LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue", rect); new_queue->mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(new_queue->getID())); - new_queue->mMono = mono; + new_queue->setMono(mono); new_queue->open(); return new_queue; } @@ -384,6 +422,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, } } + // This is the callback for when each script arrives // static void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, @@ -392,7 +431,10 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, { LL_INFOS() << "LLFloaterCompileQueue::scriptArrived()" << LL_ENDL; LLScriptQueueData* data = (LLScriptQueueData*)user_data; - if(!data) return; + if(!data) + { + return; + } LLFloaterCompileQueue* queue = static_cast (LLFloaterScriptQueue::findInstance(data->mQueueID)); std::string buffer; @@ -420,8 +462,8 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, file.read(script_data, script_size); queue->mUploadQueue->queue(filename, data->mTaskId, - data->mItemId, is_running, queue->mMono, queue->getID(), - script_data, script_size, data->mScriptName); + data->mItemId, is_running, queue->mMono, queue->getID(), + script_data, script_size, data->mScriptName); } else { @@ -432,42 +474,6 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, LL_WARNS() << "Problem uploading script asset." << LL_ENDL; if(queue) queue->removeItemByItemID(data->mItemId); } -#if 0 //Client side compiling disabled. - else - { - // It's now in the file, now compile it. - buffer = LLTrans::getString("CompileQueueDownloadedCompiling") + (": ") + data->mScriptName; - - // Write script to local file for compilation. - LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ - if (fp) - { - const S32 buf_size = 65536; - U8 copy_buf[buf_size]; - - while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/ - { - if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1) - { - // return a bad file error if we can't write the whole thing - status = LL_ERR_CANNOT_OPEN_FILE; - } - } - - fclose(fp); - } - else - { - LL_ERRS() << "Unable to find object to compile" << LL_ENDL; - } - - // TODO: babbage: No compile if no cap. - queue->compile(filename, data->mItemId); - - // Delete it after we're done compiling? - LLFile::remove(filename); - } -#endif } } else @@ -503,83 +509,6 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, delete data; } -#if 0 //Client side compiling disabled. -// static -void LLFloaterCompileQueue::onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LL_INFOS() << "LLFloaterCompileQueue::onSaveTextComplete()" << LL_ENDL; - if (status) - { - LL_WARNS() << "Unable to save text for script." << LL_ENDL; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveText", args); - } -} - -// static -void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LL_INFOS() << "LLFloaterCompileQueue::onSaveBytecodeComplete()" << LL_ENDL; - LLCompileQueueData* data = (LLCompileQueueData*)user_data; - LLFloaterCompileQueue* queue = static_cast (LLFloaterScriptQueue::findInstance(data->mQueueID)); - if(queue && (0 == status) && data) - { - queue->saveItemByItemID(data->mItemId); - queue->removeItemByItemID(data->mItemId); - } - else - { - LL_WARNS() << "Unable to save bytecode for script." << LL_ENDL; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveBytecode", args); - } - delete data; - data = NULL; -} - -// compile the file given and save it out. -void LLFloaterCompileQueue::compile(const std::string& filename, - const LLUUID& item_id) -{ - LLUUID new_asset_id; - LLTransactionID tid; - tid.generate(); - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - std::string uuid_string; - new_asset_id.toString(uuid_string); - std::string dst_filename; - dst_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".lso"; - std::string err_filename; - err_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".out"; - - gAssetStorage->storeAssetData(filename, tid, - LLAssetType::AT_LSL_TEXT, - &onSaveTextComplete, NULL, FALSE); - - const BOOL compile_to_mono = FALSE; - if(!lscript_compile(filename.c_str(), dst_filename.c_str(), - err_filename.c_str(), compile_to_mono, - uuid_string.c_str(), gAgent.isGodlike())) - { - LL_WARNS() << "compile failed" << LL_ENDL; - removeItemByItemID(item_id); - } - else - { - LL_INFOS() << "compile successful." << LL_ENDL; - - // Save LSL bytecode - LLCompileQueueData* data = new LLCompileQueueData(mID, item_id); - gAssetStorage->storeAssetData(dst_filename, new_asset_id, - LLAssetType::AT_LSL_BYTECODE, - &LLFloaterCompileQueue::onSaveBytecodeComplete, - (void*)data, FALSE); - } -} -#endif const LLInventoryItem* LLFloaterCompileQueue::findItemByItemID(const LLUUID& asset_id) const { @@ -648,7 +577,6 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, { // 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(); @@ -709,8 +637,6 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, { // 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) @@ -788,13 +714,29 @@ void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) } } +BOOL LLFloaterCompileQueue::startQueue() +{ + /* Singu TODO: Experiences + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("GetCreatorExperiences"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url, new CompileQueueExperienceResponder(getKey().asUUID())); + return TRUE; + } + }*/ + return nextObject(); +} + + + 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. - 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) diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index 281929445..9bb67d9cb 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -40,10 +40,11 @@ #include "lluuid.h" #include "llfloater.h" -#include "llscrolllistctrl.h" #include "llviewerinventory.h" +class LLScrollListCtrl; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLFloaterScriptQueue // @@ -58,20 +59,23 @@ class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener { public: + // find an instance by ID. Return NULL if it does not exist. + static LLFloaterScriptQueue* findInstance(const LLUUID& id); + LLFloaterScriptQueue(const std::string& name, const LLRect& rect, + const std::string& title, const std::string& start_string); + virtual ~LLFloaterScriptQueue(); + + /*virtual*/ BOOL postBuild(); + + void setMono(bool mono) { mMono = mono; } + // addObject() accepts an object id. void addObject(const LLUUID& id); // start() returns TRUE if the queue has started, otherwise FALSE. BOOL start(); - // find an instance by ID. Return NULL if it does not exist. - static LLFloaterScriptQueue* findInstance(const LLUUID& id); - protected: - LLFloaterScriptQueue(const std::string& name, const LLRect& rect, - const std::string& title, const std::string& start_string); - virtual ~LLFloaterScriptQueue(); - // This is the callback method for the viewer object currently // being worked on. /*virtual*/ void inventoryChanged(LLViewerObject* obj, @@ -88,12 +92,16 @@ 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(); - // Get this instances ID. + void setStartString(const std::string& s) { mStartString = s; } + + // Get this instance's ID. const LLUUID& getID() const { return mID; } protected: @@ -110,6 +118,7 @@ protected: static LLMap sInstances; std::string mStartString; + bool mMono; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -133,13 +142,16 @@ class LLFloaterCompileQueue : public LLFloaterScriptQueue public: // Use this method to create a compile queue. Once created, it // will be responsible for it's own destruction. - static LLFloaterCompileQueue* create(BOOL mono); + static LLFloaterCompileQueue* create(bool mono); // remove any object in mScriptScripts with the matching uuid. void removeItemByItemID(const LLUUID& item_id); LLAssetUploadQueue* getUploadQueue() { return mUploadQueue; } + void experienceIdsReceived( const LLSD& content ); + BOOL hasExperience(const LLUUID& id)const; + protected: LLFloaterCompileQueue(const std::string& name, const LLRect& rect); virtual ~LLFloaterCompileQueue(); @@ -152,17 +164,6 @@ protected: static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); - -#if 0 //Client side compiling disabled. - static void onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status); - - static void onSaveBytecodeComplete(const LLUUID& asset_id, - void* user_data, - S32 status, LLExtStat ext_status); - - // compile the file given and save it out. - void compile(const std::string& filename, const LLUUID& asset_id); -#endif // remove any object in mScriptScripts with the matching uuid. void removeItemByAssetID(const LLUUID& asset_id); @@ -173,12 +174,13 @@ protected: // find InventoryItem given item id. const LLInventoryItem* findItemByItemID(const LLUUID& item_id) const; + virtual BOOL startQueue(); protected: LLViewerInventoryItem::item_array_t mCurrentScripts; private: - BOOL mMono; // Compile to mono. LLAssetUploadQueue* mUploadQueue; + uuid_list_t mExperienceIds; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 7030356f0..2eb683290 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -61,7 +61,7 @@ class LLVOVolume; class LLViewerTexture; // Can have multiple silhouettes for each object -const U32 SILHOUETTE_HIGHLIGHT = 0; +constexpr U32 SILHOUETTE_HIGHLIGHT = 0; // All data for new renderer goes into this class. LL_ALIGN_PREFIX(16) diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index d8e9864f2..b1d393e9b 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -75,9 +75,6 @@ LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0) case POOL_FULLBRIGHT: poolp = new LLDrawPoolFullbright(); break; - case POOL_INVISIBLE: - poolp = new LLDrawPoolInvisible(); - break; case POOL_GLOW: poolp = new LLDrawPoolGlow(); break; diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index fa8fc3675..95af2d0b6 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -58,18 +58,12 @@ public: POOL_SKY, POOL_WL_SKY, POOL_GRASS, - POOL_INVISIBLE, // see below * POOL_AVATAR, POOL_VOIDWATER, POOL_WATER, POOL_GLOW, POOL_ALPHA, NUM_POOL_TYPES, - // * invisiprims work by rendering to the depth buffer but not the color buffer, occluding anything rendered after them - // - and the LLDrawPool types enum controls what order things are rendered in - // - so, it has absolute control over what invisprims block - // ...invisiprims being rendered in pool_invisible - // ...shiny/bump mapped objects in rendered in POOL_BUMP }; LLDrawPool(const U32 type); @@ -126,8 +120,6 @@ public: PASS_SIMPLE = NUM_POOL_TYPES, PASS_GRASS, PASS_FULLBRIGHT, - PASS_INVISIBLE, - PASS_INVISI_SHINY, PASS_FULLBRIGHT_SHINY, PASS_SHINY, PASS_BUMP, diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 9831a0875..9e3776761 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -918,7 +918,7 @@ void LLDrawPoolAvatar::beginRiggedShinySimple() llassert_always(sVertexProgram->mProgramObject > 0); sVertexProgram->bind(); - LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); + LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel); } void LLDrawPoolAvatar::endRiggedShinySimple() @@ -928,7 +928,7 @@ void LLDrawPoolAvatar::endRiggedShinySimple() if(!sVertexProgram) return; - LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); + LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel); sVertexProgram->unbind(); sVertexProgram = NULL; } @@ -951,7 +951,7 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny() llassert_always(sVertexProgram->mProgramObject > 0); sVertexProgram->bind(); - LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); + LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel); if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) { sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); @@ -971,7 +971,7 @@ void LLDrawPoolAvatar::endRiggedFullbrightShiny() if(!sVertexProgram) return; - LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); + LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel); sVertexProgram->unbind(); sVertexProgram = NULL; } diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index bf4a14754..dba3c1633 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -42,7 +42,7 @@ class LLMeshSkinInfo; class LLVolume; class LLVolumeFace; -const U32 JOINT_COUNT = 52; +constexpr U32 JOINT_COUNT = 52; class LLDrawPoolAvatar : public LLFacePool { diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 81cbfd075..7e4266666 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -330,11 +330,10 @@ void LLDrawPoolBump::endRenderPass(S32 pass) } //static -void LLDrawPoolBump::beginShiny(bool invisible) +void LLDrawPoolBump::beginShiny() { LLFastTimer t(FTM_RENDER_SHINY); - if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| - (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) + if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)) { return; } @@ -342,7 +341,7 @@ void LLDrawPoolBump::beginShiny(bool invisible) mShiny = TRUE; sVertexMask = VERTEX_MASK_SHINY; // Second pass: environment map - if (!invisible && mVertexShaderLevel > 1) + if (mVertexShaderLevel > 1) { sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0; } @@ -357,7 +356,7 @@ void LLDrawPoolBump::beginShiny(bool invisible) shader = NULL; } - bindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel, invisible); + bindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel); if (mVertexShaderLevel > 1) { //indexed texture rendering, channel 0 is always diffuse @@ -366,12 +365,12 @@ void LLDrawPoolBump::beginShiny(bool invisible) } //static -void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel, bool invisible) +void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if( cube_map ) { - if (!invisible && shader ) + if (shader) { LLMatrix4 mat(gGLModelView.getF32ptr()); LLVector3 vec = LLVector3(gShinyOrigin) * mat; @@ -412,11 +411,10 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di } } -void LLDrawPoolBump::renderShiny(bool invisible) +void LLDrawPoolBump::renderShiny() { LLFastTimer t(FTM_RENDER_SHINY); - if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| - (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) + if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)) { return; } @@ -424,28 +422,24 @@ void LLDrawPoolBump::renderShiny(bool invisible) if( gSky.mVOSkyp->getCubeMap() ) { LLGLEnable blend_enable(GL_BLEND); - if (!invisible && mVertexShaderLevel > 1) + if (mVertexShaderLevel > 1) { LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } - else if (!invisible) + else { renderGroups(LLRenderPass::PASS_SHINY, sVertexMask); } - //else // invisible (deprecated) - //{ - //renderGroups(LLRenderPass::PASS_INVISI_SHINY, sVertexMask); - //} } } //static -void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel, bool invisible) +void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if( cube_map ) { - if (!invisible && shader_level > 1) + if (shader_level > 1) { shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); @@ -473,16 +467,15 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& } } -void LLDrawPoolBump::endShiny(bool invisible) +void LLDrawPoolBump::endShiny() { LLFastTimer t(FTM_RENDER_SHINY); - if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| - (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) + if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)) { return; } - unbindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel, invisible); + unbindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel); if (shader) { shader->unbind(); @@ -1545,76 +1538,3 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL gGL.matrixMode(LLRender::MM_MODELVIEW); } } - -void LLDrawPoolInvisible::render(S32 pass) -{ //render invisiprims - LLFastTimer t(FTM_RENDER_INVISIBLE); - - if (LLGLSLShader::sNoFixedFunction) - { - gOcclusionProgram.bind(); - } - - U32 invisi_mask = LLVertexBuffer::MAP_VERTEX; - glStencilMask(0); - gGL.setColorMask(false, false); - pushBatches(LLRenderPass::PASS_INVISIBLE, invisi_mask, FALSE); - gGL.setColorMask(true, false); - glStencilMask(0xFFFFFFFF); - - if (LLGLSLShader::sNoFixedFunction) - { - gOcclusionProgram.unbind(); - } - - /*if (gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)) // invisible (deprecated) - { - beginShiny(true); - renderShiny(true); - endShiny(true); - }*/ -} - -void LLDrawPoolInvisible::beginDeferredPass(S32 pass) -{ - static const LLCachedControl enable("SianaRenderDeferredInvisiprim"); - if (!enable) - { - return; - } - beginRenderPass(pass); -} - -void LLDrawPoolInvisible::endDeferredPass( S32 pass ) -{ - endRenderPass(pass); -} - -void LLDrawPoolInvisible::renderDeferred( S32 pass ) -{ //render invisiprims; this doesn't work becaue it also blocks all the post-deferred stuff - static const LLCachedControl enable("SianaRenderDeferredInvisiprim"); - if (!enable) - { - return; - } - - LLFastTimer t(FTM_RENDER_INVISIBLE); - - gOcclusionProgram.bind(); - - U32 invisi_mask = LLVertexBuffer::MAP_VERTEX; - glStencilMask(0); - gGL.setColorMask(false, false); - pushBatches(LLRenderPass::PASS_INVISIBLE, invisi_mask, FALSE); - gGL.setColorMask(true, true); - glStencilMask(0xFFFFFFFF); - - gOcclusionProgram.unbind(); - - /*if (gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)) // invisible (deprecated) - { - beginShiny(true); - renderShiny(true); - endShiny(true); - }*/ -} diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h index 2611730ee..e51e56627 100644 --- a/indra/newview/lldrawpoolbump.h +++ b/indra/newview/lldrawpoolbump.h @@ -68,9 +68,9 @@ public: S32 numBumpPasses(); - void beginShiny(bool invisible = false); - void renderShiny(bool invisible = false); - void endShiny(bool invisible = false); + void beginShiny(); + void renderShiny(); + void endShiny(); void beginFullbrightShiny(); void renderFullbrightShiny(); @@ -80,8 +80,8 @@ public: void renderBump(U32 pass = LLRenderPass::PASS_BUMP); void endBump(U32 pass = LLRenderPass::PASS_BUMP); - static void bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel, bool invisible); - static void unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel, bool invisible); + static void bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel); + static void unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel); virtual S32 getNumDeferredPasses(); /*virtual*/ void beginDeferredPass(S32 pass); @@ -173,30 +173,4 @@ private: extern LLBumpImageList gBumpImageList; -class LLDrawPoolInvisible : public LLDrawPoolBump -{ -public: - LLDrawPoolInvisible() : LLDrawPoolBump(LLDrawPool::POOL_INVISIBLE) { } - - enum - { - VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX - }; - - virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } - - virtual void prerender() { } - - virtual void render(S32 pass = 0); - virtual void beginRenderPass( S32 pass ) { } - virtual void endRenderPass( S32 pass ) { } - virtual S32 getNumPasses() {return 1;} - - virtual S32 getNumDeferredPasses() { return 1; } - /*virtual*/ void beginDeferredPass(S32 pass); - /*virtual*/ void endDeferredPass(S32 pass); - /*virtual*/ void renderDeferred(S32 pass); -}; - - #endif // LL_LLDRAWPOOLBUMP_H diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 456fc3301..b4f7f8838 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -74,20 +74,11 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : // Hack! sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); - mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", - TRUE, LLGLTexture::BOOST_UI, - LLViewerTexture::FETCHED_TEXTURE, - int_format, 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", TRUE, LLGLTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, - int_format, format, - LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); + int_format, format); //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index a9fb48bac..e87229c0f 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -76,9 +76,7 @@ public: /*virtual*/ LLViewerTexture *getDebugTexture(); /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display - LLPointer mAlphaRampImagep; LLPointer m2DAlphaRampImagep; - LLPointer mAlphaNoiseImagep; static S32 sDetailMode; static F32 sDetailScale; // meters per texture diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 4f4ac87fc..d05ff2a1e 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -49,7 +49,7 @@ #include "llagent.h" #include "llviewerstats.h" #include "llviewerregion.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "lluictrlfactory.h" #include "lluri.h" #include "llweb.h" @@ -70,6 +70,8 @@ #include "lldxhardware.h" #endif +#include "cef/llceflib.h" + extern LLMemoryInfo gSysMemory; extern U32 gPacketsIn; @@ -111,6 +113,9 @@ LLFloaterAbout::LLFloaterAbout() LLViewerTextEditor *credits_widget = getChild("credits_editor", true); + + LLViewerTextEditor *licenses_widget = + getChild("licenses_editor", true); childSetAction("copy_btn", onAboutClickCopyToClipboard, this); @@ -135,9 +140,9 @@ LLFloaterAbout::LLFloaterAbout() + " (64 bit)" #endif + llformat(" %d.%d.%d (%d) %s %s (%s)\n", - gVersionMajor, gVersionMinor, gVersionPatch, gVersionBuild, + LLVersionInfo::getMajor(), LLVersionInfo::getMinor(), LLVersionInfo::getPatch(), LLVersionInfo::getBuild(), __DATE__, __TIME__, - gVersionChannel)); + LLVersionInfo::getChannel().c_str())); support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style); @@ -192,10 +197,10 @@ LLFloaterAbout::LLFloaterAbout() else support.append(RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); // [/RLVa:KN] - support.append("\n"); + support += '\n'; support.append(gLastVersionChannel); - support.append("\n"); + support += '\n'; support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); @@ -217,7 +222,7 @@ LLFloaterAbout::LLFloaterAbout() // CPU support.append("CPU: "); support.append( gSysCPU.getCPUString() ); - support.append("\n"); + support += '\n'; /* This is confusing and WRONG. support.append("SSE Support:"); @@ -236,15 +241,15 @@ LLFloaterAbout::LLFloaterAbout() support.append("OS Version: "); support.append( LLAppViewer::instance()->getOSInfo().getOSString() ); - support.append("\n"); + support += '\n'; support.append("Graphics Card Vendor: "); support.append( (const char*) glGetString(GL_VENDOR) ); - support.append("\n"); + support += '\n'; support.append("Graphics Card: "); support.append( (const char*) glGetString(GL_RENDERER) ); - support.append("\n"); + support += '\n'; #if LL_WINDOWS getWindow()->incBusyCount(); @@ -255,7 +260,7 @@ LLFloaterAbout::LLFloaterAbout() { support.append(driver_info["DriverVersion"]); } - support.append("\n"); + support += '\n'; getWindow()->decBusyCount(); getWindow()->setCursor(UI_CURSOR_ARROW); #endif @@ -263,47 +268,27 @@ LLFloaterAbout::LLFloaterAbout() support.append("OpenGL Version: "); support.append( (const char*) glGetString(GL_VERSION) ); // [RLVa:KB] - Checked: 2010-04-18 (RLVa-1.2.0) - support.append("\n"); + support += '\n'; support.append("RLV Version: " + (RlvActions::isRlvEnabled() ? RlvStrings::getVersionAbout() : "(disabled)")); // [/RLVa:KB] support.append("\n\n"); - support.append("Viewer SSE Version: "); -#if _M_IX86_FP > 0 //Windows - support.append(llformat("SSE%i\n", _M_IX86_FP )); -#elif defined(__SSE2__) //GCC - support.append("SSE2\n"); -#elif defined(__SSE__) //GCC - support.append("SSE\n"); -#else - support.append("None\n"); -#endif - support.append("libcurl Version: "); support.append( LLCurl::getVersionString() ); - support.append("\n"); + support += '\n'; support.append("J2C Decoder Version: "); support.append( LLImageJ2C::getEngineInfo() ); - support.append("\n"); + support += '\n'; support.append("Audio Driver Version: "); bool want_fullname = true; support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : "(none)" ); - support.append("\n"); + support += '\n'; - // TODO: Implement media plugin version query - - support.append("Qt Webkit Version: "); - support.append( -#if LL_LINUX && defined(__x86_64__) - "4.8.6" -#else - "4.7.1" -#endif - ); - support.append(" (version number hard-coded)"); - support.append("\n"); + support.append("LLCEFLib/CEF Version: "); + support.append(LLCEFLIB_VERSION); + support += '\n'; if (gPacketsIn > 0) { @@ -312,7 +297,7 @@ LLFloaterAbout::LLFloaterAbout() F32(gPacketsIn), 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); support.append(packet_loss); - support.append("\n"); + support += '\n'; } support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); @@ -328,6 +313,30 @@ LLFloaterAbout::LLFloaterAbout() credits_widget->setTakesFocus(TRUE); credits_widget->setHandleEditKeysDirectly(TRUE); + // Get the Versions and Copyrights, created at build time + std::string licenses_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "packages-info.txt"); + llifstream licenses_file; + licenses_file.open(licenses_path); /* Flawfinder: ignore */ + if (licenses_file.is_open()) + { + std::string license_line; + licenses_widget->clear(); + while (std::getline(licenses_file, license_line)) + { + licenses_widget->appendColoredText(license_line + '\n', FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); + } + licenses_file.close(); + } + else + { + // this case will use the (out of date) hard coded value from the XUI + LL_INFOS("AboutInit") << "Could not read licenses file at " << licenses_path << LL_ENDL; + } + licenses_widget->setCursorPos(0); + licenses_widget->setEnabled(FALSE); + licenses_widget->setTakesFocus(TRUE); + licenses_widget->setHandleEditKeysDirectly(TRUE); + center(); sInstance = this; diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 61828b493..f23d8c6d3 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -27,6 +27,7 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsdutil.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llwindow.h" @@ -51,7 +52,6 @@ #include "llworld.h" #include -#include #include // [RLVa:KB] @@ -88,22 +88,21 @@ namespace static LLCachedControl radar_alert_chat_range(gSavedSettings, "RadarAlertChatRange"); static LLCachedControl radar_alert_age(gSavedSettings, "RadarAlertAge"); - LLFloaterAvatarList& inst(LLFloaterAvatarList::instance()); LLStringUtil::format_map_t args; LLChat chat; switch(type) { - case STAT_TYPE_SIM: if (radar_alert_sim) args["[RANGE]"] = inst.getString("the_sim"); break; - case STAT_TYPE_DRAW: if (radar_alert_draw) args["[RANGE]"] = inst.getString("draw_distance"); break; - case STAT_TYPE_SHOUTRANGE: if (radar_alert_shout_range) args["[RANGE]"] = inst.getString("shout_range"); break; - case STAT_TYPE_CHATRANGE: if (radar_alert_chat_range) args["[RANGE]"] = inst.getString("chat_range"); break; - case STAT_TYPE_AGE: if (radar_alert_age) chat.mText = name + " " + inst.getString("has_triggered_your_avatar_age_alert") + "."; break; + case STAT_TYPE_SIM: if (radar_alert_sim) args["[RANGE]"] = LLTrans::getString("the_sim"); break; + case STAT_TYPE_DRAW: if (radar_alert_draw) args["[RANGE]"] = LLTrans::getString("draw_distance"); break; + case STAT_TYPE_SHOUTRANGE: if (radar_alert_shout_range) args["[RANGE]"] = LLTrans::getString("shout_range"); break; + case STAT_TYPE_CHATRANGE: if (radar_alert_chat_range) args["[RANGE]"] = LLTrans::getString("chat_range"); break; + case STAT_TYPE_AGE: if (radar_alert_age) chat.mText = name + " " + LLTrans::getString("has_triggered_your_avatar_age_alert") + "."; break; default: llassert(type); break; } args["[NAME]"] = name; - args["[ACTION]"] = inst.getString(entering ? "has_entered" : "has_left"); + args["[ACTION]"] = LLTrans::getString(entering ? "has_entered" : "has_left"); if (args.find("[RANGE]") != args.end()) - chat.mText = inst.getString("template", args); + chat.mText = LLTrans::getString("radar_alert_template", args); else if (chat.mText.empty()) return; if (entering) // Note: If we decide to make this for leaving as well, change this check to dist != F32_MIN { @@ -145,6 +144,7 @@ LLAvatarListEntry::LLAvatarListEntry(const LLUUID& id, const std::string& name, LLAvatarListEntry::~LLAvatarListEntry() { + setPosition(mPosition, F32_MIN, false); // Dead and gone LLAvatarPropertiesProcessor::instance().removeObserver(mID, this); } @@ -268,7 +268,7 @@ void LLFloaterAvatarList::draw() void LLFloaterAvatarList::onOpen() { - if (mAvatars.size()) refreshAvatarList(); + refreshAvatarList(); } void LLFloaterAvatarList::onClose(bool app_quitting) @@ -411,7 +411,7 @@ BOOL LLFloaterAvatarList::postBuild() mAvatarList->setCommitCallback(boost::bind(&LLFloaterAvatarList::onSelectName,this)); mAvatarList->setDoubleClickCallback(boost::bind(&LLFloaterAvatarList::onClickFocus,this)); mAvatarList->setSortChangedCallback(boost::bind(&LLFloaterAvatarList::onAvatarSortingChanged,this)); - BOOST_FOREACH(LLViewerRegion* region, LLWorld::instance().getRegionList()) + for (LLViewerRegion* region : LLWorld::instance().getRegionList()) { updateAvatarList(region); } @@ -509,6 +509,12 @@ void updateParticleActivity(LLDrawable *drawablep) } } +const F32& radar_range_radius() +{ + static const LLCachedControl radius("RadarRangeRadius", 0); + return radius; +} + void LLFloaterAvatarList::updateAvatarList(const LLViewerRegion* region) { // Check whether updates are enabled @@ -523,8 +529,7 @@ void LLFloaterAvatarList::updateAvatarList(const LLViewerRegion* region) const std::vector& map_avids(region->mMapAvatarIDs); const LLVector3d& mypos(gAgent.getPositionGlobal()); const LLVector3d& origin(region->getOriginGlobal()); - static const LLCachedControl radar_range_radius("RadarRangeRadius", 0); - const F32 max_range(radar_range_radius * radar_range_radius); + const F32 max_range(radar_range_radius() * radar_range_radius()); static LLCachedControl announce(gSavedSettings, "RadarChatKeys"); std::queue announce_keys; @@ -594,28 +599,22 @@ void LLFloaterAvatarList::updateAvatarList(const LLViewerRegion* region) void LLFloaterAvatarList::expireAvatarList(const std::list& ids) { - BOOST_FOREACH(const LLUUID& id, ids) + if (!ids.empty()) { - av_list_t::iterator it(std::find_if(mAvatars.begin(), mAvatars.end(), LLAvatarListEntry::uuidMatch(id))); - if (it != mAvatars.end()) + std::vector existing_avs; + std::vector neighbors; + gAgent.getRegion()->getNeighboringRegions(neighbors); + for (const LLViewerRegion* region : neighbors) + existing_avs.insert(existing_avs.end(), region->mMapAvatarIDs.begin(), region->mMapAvatarIDs.end()); + for (const LLUUID& id : ids) { - LLAvatarListEntry* entry = it->get(); - entry->setPosition(entry->getPosition(), F32_MIN, false); // Dead and gone - mAvatars.erase(it); + if (std::find(existing_avs.begin(), existing_avs.end(), id) != existing_avs.end()) continue; // Now in another region we know. + av_list_t::iterator it(std::find_if(mAvatars.begin(), mAvatars.end(), LLAvatarListEntry::uuidMatch(id))); + if (it != mAvatars.end()) + mAvatars.erase(it); } } - if (mAvatars.empty()) - setTitle(getString("Title")); - else if (mAvatars.size() == 1) - setTitle(getString("TitleOneAvatar")); - else - { - LLStringUtil::format_map_t args; - args["[COUNT]"] = boost::lexical_cast(mAvatars.size()); - setTitle(getString("TitleWithCount", args)); - } - refreshAvatarList(); refreshTracker(); } @@ -648,7 +647,7 @@ bool getCustomColorRLV(const LLUUID& id, LLColor4& color, LLViewerRegion* parent */ void LLFloaterAvatarList::refreshAvatarList() { - // Don't update list when interface is hidden + // Don't update when interface is hidden if (!getVisible()) return; // We rebuild the list fully each time it's refreshed @@ -669,8 +668,9 @@ void LLFloaterAvatarList::refreshAvatarList() localRectToScreen(getLocalRect(), &screen_rect); speakermgr.update(!(screen_rect.pointInRect(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY()) && gMouseIdleTimer.getElapsedTimeF32() < 5.f)); + av_list_t dead_entries; bool name_restricted(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); - BOOST_FOREACH(av_list_t::value_type& entry, mAvatars) + for (auto& entry : mAvatars) { LLVector3d position = entry->getPosition(); LLVector3d delta = position - mypos; @@ -684,7 +684,11 @@ void LLFloaterAvatarList::refreshAvatarList() //jcool410 -- this fucks up seeing dueds thru minimap data > 1024m away, so, lets just say > 2048m to the side is bad //aka 8 sims - if (delta.magVec() > 2048.0) continue; + if (delta.magVec() > 2048.0) + { + dead_entries.push_back(entry); + continue; + } entry->setInList(); const LLUUID& av_id = entry->getID(); @@ -969,6 +973,20 @@ void LLFloaterAvatarList::refreshAvatarList() mAvatarList->addRow(element); } + for (auto& dead : dead_entries) + mAvatars.erase(std::remove(mAvatars.begin(), mAvatars.end(), dead), mAvatars.end()); + + if (mAvatars.empty()) + setTitle(getString("Title")); + else if (mAvatars.size() == 1) + setTitle(getString("TitleOneAvatar")); + else + { + LLStringUtil::format_map_t args; + args["[COUNT]"] = boost::lexical_cast(mAvatars.size()); + setTitle(getString("TitleWithCount", args)); + } + // finish mAvatarList->updateSort(); mAvatarList->selectMultiple(selected); @@ -984,7 +1002,7 @@ void LLFloaterAvatarList::resetAvatarNames() bool hide_tags(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)); bool anon_names(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); const std::string& hidden(RlvStrings::getString(RLV_STRING_HIDDEN)); - BOOST_FOREACH(av_list_t::value_type& entry, mAvatars) + for (auto& entry : mAvatars) { entry->resetName(hide_tags, anon_names, hidden); } @@ -1125,7 +1143,7 @@ void LLFloaterAvatarList::onClickFocus() void LLFloaterAvatarList::removeFocusFromAll() { - BOOST_FOREACH(av_list_t::value_type& entry, mAvatars) + for (auto& entry : mAvatars) { entry->setFocus(false); } @@ -1235,7 +1253,7 @@ void LLFloaterAvatarList::sendKeys() const std::ostringstream ids; U32 num_ids = 0; - for (S32 i = 0; i < regionp->mMapAvatarIDs.size(); ++i) + for (U32 i = 0; i < regionp->mMapAvatarIDs.size(); ++i) { ids << "," << regionp->mMapAvatarIDs.at(i); ++num_ids; diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 5308501a8..79c6d72b8 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -46,6 +46,10 @@ LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) : LLFloater(std::string("avatar_texture_debug")), mID(id) { + for (U32 i = 0; i < TEX_NUM_INDICES; i++) + { + mTextures[i] = nullptr; + } } LLFloaterAvatarTextures::~LLFloaterAvatarTextures() diff --git a/indra/newview/llfloaterblacklist.cpp b/indra/newview/llfloaterblacklist.cpp index dd80e2138..255552928 100644 --- a/indra/newview/llfloaterblacklist.cpp +++ b/indra/newview/llfloaterblacklist.cpp @@ -85,7 +85,7 @@ BOOL LLFloaterBlacklist::postBuild() } void LLFloaterBlacklist::refresh() { - + LLScrollListCtrl* list = getChild("file_list"); list->clearRows(); for(std::map::iterator iter = blacklist_entries.begin(); iter != blacklist_entries.end(); ++iter) @@ -207,13 +207,17 @@ void LLFloaterBlacklist::onClickRemove(void* user_data) LLScrollListCtrl* list = floaterp->getChild("file_list"); if(list->getFirstSelected()) { - LLScrollListItem* item = list->getFirstSelected(); - LLUUID selected_id = item->getColumn(0)->getValue().asUUID(); - if(selected_id.isNull()) return; - list->deleteSingleItem(list->getFirstSelectedIndex()); - blacklist_entries.erase(selected_id); + uuid_vec_t selectedIDs = list->getSelectedIDs(); + uuid_vec_t::const_iterator iterator; + for(iterator = selectedIDs.begin(); + iterator != selectedIDs.end(); + ++iterator) + { + LLUUID selectedID = *iterator; + blacklist_entries.erase(selectedID); + } + list->deleteSelectedItems(); updateBlacklists(); - } } // static @@ -252,12 +256,12 @@ void LLFloaterBlacklist::updateBlacklists() { gAssetStorage->mBlackListedAsset.push_back(LLUUID(iter->first)); } - + if(blacklist_entries[iter->first]["entry_type"].asString() == "6") { blacklist_objects.push_back(LLUUID(iter->first)); } - + } saveToDisk(); LLFloaterBlacklist* instance = LLFloaterBlacklist::getInstance(); @@ -300,7 +304,7 @@ void LLFloaterBlacklist::onClickSave_continued(AIFilePicker* filepicker) { data[iter->first.asString()] = iter->second; } - LLSDSerialize::toPrettyXML(data, export_file); + LLSDSerialize::toPrettyXML(data, export_file); export_file.close(); } } diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 1ebbb0aec..a890cba38 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -157,7 +157,8 @@ private: { TransactionPreflight, TransactionCurrency, - TransactionBuy + TransactionBuy, + TransactionNone }; boost::intrusive_ptr mResponder; TransactionType mTransactionType; @@ -281,11 +282,34 @@ void LLFloaterBuyLand::updateEstateOwnerName(const std::string& name) LLFloaterBuyLandUI::LLFloaterBuyLandUI() : LLFloater(std::string("Buy Land")), mParcelSelectionObserver(this), + mRegion(nullptr), mParcel(0), + mIsClaim(false), + mIsForGroup(false), + mCanBuy(false), + mCannotBuyIsError(false), mBought(false), - mParcelValid(false), mSiteValid(false), - mChildren(*this), mCurrency(*this), - mParcelBuyInfo(0) + mAgentCommittedTier(0), + mAgentHasNeverOwnedLand(true), + mParcelValid(false), + mParcelIsForSale(false), + mParcelIsGroupLand(false), + mParcelGroupContribution(0), + mParcelPrice(0), + mParcelActualArea(0), + mParcelBillableArea(0), + mParcelSupportedObjects(0), + mParcelSoldWithObjects(false), + mUserPlanChoice(0), + mSiteValid(false), + mSiteMembershipUpgrade(false), + mSiteLandUseUpgrade(false), + mPreflightAskBillableArea(0), + mPreflightAskCurrencyBuy(0), + mChildren(*this), + mCurrency(*this), + mParcelBuyInfo(nullptr), + mTransactionType(TransactionNone) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_land.xml"); LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver); @@ -347,8 +371,6 @@ void LLFloaterBuyLandUI::updateParcelInfo() mParcelSnapshot.setNull(); mParcelSellerName = ""; - mCanBuy = false; - mCannotBuyIsError = false; if (!mParcelValid) { diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 9d988dcb5..131786afd 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -144,14 +144,13 @@ std::string STATUS[] = // LLFloaterBvhPreview() //----------------------------------------------------------------------------- LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename, void* item) : - LLFloaterNameDesc(filename, item) + LLFloaterNameDesc(filename, item), + mItem(item), // + mLastMouseX(0), + mLastMouseY(0), + mPlayButton(nullptr), + mStopButton(nullptr) { - // - mItem = item; - // - mLastMouseX = 0; - mLastMouseY = 0; - mIDList["Standing"] = ANIM_AGENT_STAND; mIDList["Walking"] = ANIM_AGENT_FEMALE_WALK; mIDList["Sitting"] = ANIM_AGENT_SIT_FEMALE; diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 18826f961..c2bf20283 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -50,7 +50,10 @@ const F32 CAMERA_BUTTON_DELAY = 0.0f; // LLFloaterCamera::LLFloaterCamera(const LLSD& val) -: LLFloater("camera floater") // uses "FloaterCameraRect3" +: LLFloater("camera floater"), // uses "FloaterCameraRect3" + mRotate(nullptr), + mZoom(nullptr), + mTrack(nullptr) { setIsChrome(TRUE); diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index fb2ab184c..11d51fe18 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -78,6 +78,15 @@ const F32 CONTEXT_FADE_TIME = 0.08f; LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) : LLFloater (std::string("Color Picker Floater")), + origR(1.f), + origG(1.f), + origB(1.f), + curR(1.f), + curG(1.f), + curB(1.f), + curH(0.f), + curS(0.f), + curL(1.f), mComponents ( 3 ), mMouseDownInLumRegion ( FALSE ), mMouseDownInHueRegion ( FALSE ), @@ -108,7 +117,11 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show mPaletteRegionHeight ( 40 ), mSwatch ( swatch ), mActive ( TRUE ), + mApplyImmediateCheck(nullptr), mCanApplyImmediately ( show_apply_immediate ), + mSelectBtn(nullptr), + mCancelBtn(nullptr), + mPipetteBtn(nullptr), mContextConeOpacity ( 0.f ) { // build the majority of the gui using the factory builder diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp index c03c8f1a5..657920701 100644 --- a/indra/newview/llfloatercustomize.cpp +++ b/indra/newview/llfloatercustomize.cpp @@ -55,7 +55,7 @@ #include "statemachine/aifilepicker.h" #include "hippogridmanager.h" -#include "aixmllindengenepool.h" +//#include "aixmllindengenepool.h" #include "aifile.h" using namespace LLAvatarAppearanceDefines; @@ -314,6 +314,7 @@ void LLFloaterCustomize::onBtnImport() void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) { +#if 0 if (!filepicker->hasFilename()) { // User canceled import. @@ -456,6 +457,7 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) { AIAlert::add("AIXMLImportWearableTypeMismatch", args("[TYPE]", label)("[ARCHETYPENAME]", wearable_types)); } +#endif } // reX: new function @@ -500,6 +502,7 @@ void LLFloaterCustomize::onBtnExport() //static void LLFloaterCustomize::onBtnExport_continued(LLViewerWearable* edit_wearable, AIFilePicker* filepicker) { +#if 0 if (!filepicker->hasFilename()) { // User canceled export. @@ -527,6 +530,7 @@ void LLFloaterCustomize::onBtnExport_continued(LLViewerWearable* edit_wearable, { AIAlert::add_modal("AIXMLExportSuccess", AIArgs("[FILE]", filename)); } +#endif } void LLFloaterCustomize::onBtnOk() diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index 25ee21f7d..b5b37bfcc 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -204,7 +204,6 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) { sInstance = this; - mFindAllPanel = NULL; mClassifiedPanel = NULL; mEventsPanel = NULL; mLandPanel = NULL; @@ -228,7 +227,6 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) factory_map["people_panel"] = LLCallbackMap(createPeople, this); factory_map["groups_panel"] = LLCallbackMap(createGroups, this); factory_map[market_panel] = LLCallbackMap(LLPanelDirMarket::create, this); - factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); factory_map["showcase_panel"] = LLCallbackMap(createShowcase, this); if (secondlife) { @@ -236,6 +234,7 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) } else { + factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); factory_map["find_all_old_panel"] = LLCallbackMap(createFindAllOld, this); } @@ -248,7 +247,7 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this); - mCommitCallbackRegistrar.add("Search.WebFloater", boost::bind(&LLFloaterSearch::open, boost::bind(LLFloaterSearch::getInstance))); + mCommitCallbackRegistrar.add("Search.WebFloater", boost::bind(&LLFloaterSearch::open, boost::bind(&LLFloaterSearch::getInstance))); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory.xml", &factory_map); moveResizeHandlesToFront(); @@ -260,7 +259,9 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) LLTabContainer* container = getChild("Directory Tabs"); if (secondlife) { - container->removeTabPanel(getChild("find_all_old_panel")); // Not used + // Remove unused tabs + container->removeTabPanel(getChild("find_all_panel")); + container->removeTabPanel(getChild("find_all_old_panel")); } else { @@ -305,9 +306,7 @@ LLFloaterDirectory::~LLFloaterDirectory() // static void *LLFloaterDirectory::createFindAll(void* userdata) { - LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; - self->mFindAllPanel = LLPanelDirFindAllInterface::create(self); - return self->mFindAllPanel; + return LLPanelDirFindAllInterface::create(static_cast(userdata)); } // static @@ -452,24 +451,43 @@ void LLFloaterDirectory::requestClassifieds() } } -void LLFloaterDirectory::searchInAll(const std::string& search_text) +void LLFloaterDirectory::search(const LLFloaterSearch::SearchQuery& search) { start(); - LLPanelDirFindAllInterface::search(sInstance->mFindAllPanel, search_text); - performQueryOn2("classified_panel", search_text); - performQueryOn2("events_panel", search_text); - performQueryOn2("groups_panel", search_text); - performQueryOn2("people_panel", search_text); - performQueryOn2("places_panel", search_text); + const std::string category(search.category()); + const std::string search_text(search.query); + if (category.empty()) + { + LLPanelDirFindAllInterface::search(sInstance, search); + performQueryOn2("classified_panel", search_text); + performQueryOn2("events_panel", search_text); + performQueryOn2("groups_panel", search_text); + performQueryOn2("people_panel", search_text); + performQueryOn2("places_panel", search_text); + } + else if (category == "all") + LLPanelDirFindAllInterface::search(sInstance, search, true); + else if (category == "people") + showPeople(search.query); + else if (category == "places") + showPlaces(search.query); + else if (category == "events") + showEvents(search.query); + else if (category == "groups") + showGroups(search.query); + /* Singu TODO: Wiki tab in secondlife legacy search floater? + else if (category == "wiki") + LLFloaterDirectory::showWiki(search.query);*/ + else if (category == "destinations") + showDestinations(); + else if (category == "classifieds") + showClassified(search.query); + else if (gHippoGridManager->getConnectedGrid()->isSecondLife()) + LLPanelDirFindAllInterface::search(sInstance, search, true); + else + LLNotificationsUtil::add("UnsupportedCommandSLURL"); // Singu Note: Perhaps we should use a special notification here? } -void LLFloaterDirectory::showFindAll(const std::string& search_text) -{ - showPanel(LFSimFeatureHandler::instance().searchURL().empty() ? "find_all_old_panel" : "find_all_panel"); - LLPanelDirFindAllInterface::search(sInstance->mFindAllPanel, search_text); -} - - void LLFloaterDirectory::showClassified(const LLUUID& classified_id) { showPanel("classified_panel"); @@ -598,7 +616,7 @@ void LLFloaterDirectory::start() void LLFloaterDirectory::showPanel(const std::string& tabname) { start(); - sInstance->childShowTab("Directory Tabs", tabname); + sInstance->findChild("Directory Tabs")->selectTabByName(tabname); sInstance->focusCurrentPanel(); } @@ -616,7 +634,7 @@ void LLFloaterDirectory::toggleFind(void*) || (inst.destinationGuideURL().empty() && panel == "showcase_panel")) panel = "find_all_old_panel"; } - else if (panel == "find_all_old_panel") panel = "find_all_panel"; + else if (panel == "find_all_panel" || panel == "find_all_old_panel") panel = "web_panel"; showPanel(panel); diff --git a/indra/newview/llfloaterdirectory.h b/indra/newview/llfloaterdirectory.h index c36ce412b..e685b8d30 100644 --- a/indra/newview/llfloaterdirectory.h +++ b/indra/newview/llfloaterdirectory.h @@ -33,7 +33,7 @@ #ifndef LL_LLFLOATERDIRECTORY_H #define LL_LLFLOATERDIRECTORY_H -#include "llfloater.h" +#include "llfloatersearch.h" #include "lltabcontainer.h" class LLDirectoryCore; @@ -71,8 +71,7 @@ public: // Outside UI widgets can spawn this floater with various tabs // selected. - static void searchInAll(const std::string& search_text); - static void showFindAll(const std::string& search_text); + static void search(const LLFloaterSearch::SearchQuery& search); static void showClassified(const LLUUID& classified_id); static void showClassified(const std::string& search_text = ""); static void showEvents(S32 event_id); @@ -102,7 +101,6 @@ private: private: // Some special "showByID" functions use these cached pointers. // They could be replaced by getPanelByName(), perhaps. JC - LLPanelDirFindAll* mFindAllPanel; LLPanelDirClassified* mClassifiedPanel; LLPanelDirEvents* mEventsPanel; LLPanelDirLand* mLandPanel; diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 5a75a4771..da43f9696 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -272,13 +272,11 @@ BOOL LLPanelFriends::postBuild() { mFriendsList = getChild("friend_list"); mFriendsList->setCommitOnSelectionChange(true); - /* Singu TODO: Update to C++11 and make everything cleaner here auto single_selection(boost::bind(&LLScrollListCtrl::getCurrentID, mFriendsList)); auto selection(boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList)); - */ mFriendsList->setCommitCallback(boost::bind(&LLPanelFriends::onSelectName, this)); //getChild("buddy_group_combobox")->setCommitCallback(boost::bind(&LLPanelFriends::setContactGroup, this, _2)); - mFriendsList->setDoubleClickCallback(boost::bind(LLAvatarActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, mFriendsList))); + mFriendsList->setDoubleClickCallback(boost::bind(LLAvatarActions::startIM, single_selection)); // // Contact search and group system. @@ -294,13 +292,13 @@ BOOL LLPanelFriends::postBuild() U32 changed_mask = LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE; refreshNames(changed_mask); - getChild("im_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickIM, this, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); - //getChild("assign_btn")->setCommitCallback(boost::bind(ASFloaterContactGroups::show, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); - getChild("profile_btn")->setCommitCallback(boost::bind(LLAvatarActions::showProfiles, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList), false)); - getChild("offer_teleport_btn")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); - getChild("pay_btn")->setCommitCallback(boost::bind(LLAvatarActions::pay, boost::bind(&LLScrollListCtrl::getCurrentID, mFriendsList))); + getChild("im_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickIM, this, selection)); + //getChild("assign_btn")->setCommitCallback(boost::bind(ASFloaterContactGroups::show, selection)); + getChild("profile_btn")->setCommitCallback(boost::bind(LLAvatarActions::showProfiles, selection, false)); + getChild("offer_teleport_btn")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), selection)); + getChild("pay_btn")->setCommitCallback(boost::bind(LLAvatarActions::pay, single_selection)); getChild("add_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickAddFriend, this)); - getChild("remove_btn")->setCommitCallback(boost::bind(LLAvatarActions::removeFriendsDialog, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); + getChild("remove_btn")->setCommitCallback(boost::bind(LLAvatarActions::removeFriendsDialog, selection)); //getChild("export_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickExport, this)); Making Dummy View -HgB //getChild("import_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickImport, this)); Making Dummy View -HgB diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index c06a89ae7..b024b0eee 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -118,6 +118,8 @@ void LLFloaterGodTools::refreshAll() LLFloaterGodTools::LLFloaterGodTools() : LLFloater(std::string("godtools floater")), + mPanelRegionTools(nullptr), + mPanelObjectTools(nullptr), mCurrentHost(LLHost::invalid), mUpdateTimer() { diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index 229b75754..36a6844c6 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -48,7 +48,10 @@ #include "llfloater.h" #include "llinstancetracker.h" #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include class LLUICtrl; diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 6b8a18ed8..f6c24f2fb 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -54,6 +54,7 @@ LLFloaterInspect::LLFloaterInspect(const LLSD&) : LLFloater(std::string("Inspect Object")), + mObjectList(nullptr), mDirty(FALSE) { mCommitCallbackRegistrar.add("Inspect.OwnerProfile", boost::bind(&LLFloaterInspect::onClickOwnerProfile, this)); diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index c60b116d7..633507b5c 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -38,7 +38,6 @@ #include "llavatarname.h" #include "llfloater.h" #include "llvoinventorylistener.h" -#include //class LLTool; class LLObjectSelection; @@ -85,9 +84,9 @@ private: std::map > mInventoryNums; // std::vector mQueue; // - boost::container::map mOwnerNameCacheConnection; - boost::container::map mLastOwnerNameCacheConnection; // - boost::container::map mCreatorNameCacheConnection; + std::map mOwnerNameCacheConnection; + std::map mLastOwnerNameCacheConnection; // + std::map mCreatorNameCacheConnection; }; #endif //LL_LLFLOATERINSPECT_H diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 2795ce016..b2d1d63fa 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -49,6 +49,9 @@ LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) : LLFloater("floater_joystick") + , mCheckJoystickEnabled(nullptr) + , mCheckFlycamEnabled(nullptr) + , mAxisStatsBar({ {nullptr,nullptr,nullptr,nullptr,nullptr,nullptr} }) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_joystick.xml"); center(); diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index 07b4b49c7..1104b604f 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -85,7 +85,7 @@ private: // stats view LLStatView* mAxisStatsView; LLStat* mAxisStats[6]; - LLStatBar* mAxisStatsBar[6]; + std::array mAxisStatsBar; }; #endif diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp deleted file mode 100644 index d1445cdbb..000000000 --- a/indra/newview/llfloaterlagmeter.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/** - * @file llfloaterlagmeter.cpp - * @brief The "Lag-o-Meter" floater used to tell users what is causing lag. - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterlagmeter.h" - -#include "lluictrlfactory.h" -#include "llviewerstats.h" -#include "llviewertexture.h" -#include "llviewercontrol.h" -#include "llappviewer.h" - -#include "lltexturefetch.h" - -#include "llbutton.h" -#include "llfocusmgr.h" -#include "lltextbox.h" - -const std::string LAG_CRITICAL_IMAGE_NAME = "lag_status_critical.tga"; -const std::string LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga"; -const std::string LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; - -LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) - : LLFloater(std::string("floater_lagmeter")) -{ - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml"); - - // Don't let this window take keyboard focus -- it's confusing to - // lose arrow-key driving when testing lag. - setIsChrome(TRUE); - - mClientButton = getChild("client_lagmeter"); - mClientText = getChild("client_text"); - mClientCause = getChild("client_lag_cause"); - - mNetworkButton = getChild("network_lagmeter"); - mNetworkText = getChild("network_text"); - mNetworkCause = getChild("network_lag_cause"); - - mServerButton = getChild("server_lagmeter"); - mServerText = getChild("server_text"); - mServerCause = getChild("server_lag_cause"); - - std::string config_string = getString("client_frame_rate_critical_fps", mStringArgs); - mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() ); - config_string = getString("client_frame_rate_warning_fps", mStringArgs); - mClientFrameTimeWarning = 1.0f / (float)atof( config_string.c_str() ); - - config_string = getString("network_packet_loss_critical_pct", mStringArgs); - mNetworkPacketLossCritical = (float)atof( config_string.c_str() ); - config_string = getString("network_packet_loss_warning_pct", mStringArgs); - mNetworkPacketLossWarning = (float)atof( config_string.c_str() ); - - config_string = getString("network_ping_critical_ms", mStringArgs); - mNetworkPingCritical = (float)atof( config_string.c_str() ); - config_string = getString("network_ping_warning_ms", mStringArgs); - mNetworkPingWarning = (float)atof( config_string.c_str() ); - config_string = getString("server_frame_rate_critical_fps", mStringArgs); - - mServerFrameTimeCritical = 1000.0f / (float)atof( config_string.c_str() ); - config_string = getString("server_frame_rate_warning_fps", mStringArgs); - mServerFrameTimeWarning = 1000.0f / (float)atof( config_string.c_str() ); - config_string = getString("server_single_process_max_time_ms", mStringArgs); - mServerSingleProcessMaxTime = (float)atof( config_string.c_str() ); - - mShrunk = false; - config_string = getString("max_width_px", mStringArgs); - mMaxWidth = atoi( config_string.c_str() ); - config_string = getString("min_width_px", mStringArgs); - mMinWidth = atoi( config_string.c_str() ); - - mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps"); - mStringArgs["[CLIENT_FRAME_RATE_WARNING]"] = getString("client_frame_rate_warning_fps"); - - mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct"); - mStringArgs["[NETWORK_PACKET_LOSS_WARNING]"] = getString("network_packet_loss_warning_pct"); - - mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms"); - mStringArgs["[NETWORK_PING_WARNING]"] = getString("network_ping_warning_ms"); - - mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps"); - mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps"); - - childSetAction("minimize", onClickShrink, this); - - // were we shrunk last time? - if (gSavedSettings.getBOOL("LagMeterShrunk")) - { - onClickShrink(this); - } -} - -LLFloaterLagMeter::~LLFloaterLagMeter() -{ - // save shrunk status for next time - gSavedSettings.setBOOL("LagMeterShrunk", mShrunk); - // expand so we save the large window rectangle - if (mShrunk) - { - onClickShrink(this); - } -} - -void LLFloaterLagMeter::draw() -{ - determineClient(); - determineNetwork(); - determineServer(); - - LLFloater::draw(); -} - -void LLFloaterLagMeter::determineClient() -{ - F32 client_frame_time = LLViewerStats::getInstance()->mFPSStat.getMeanDuration(); - bool find_cause = false; - - if (!gFocusMgr.getAppHasFocus()) - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) ); - mClientCause->setText( LLStringUtil::null ); - } - else if(client_frame_time >= mClientFrameTimeCritical) - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) ); - find_cause = true; - } - else if(client_frame_time >= mClientFrameTimeWarning) - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) ); - find_cause = true; - } - else - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) ); - mClientCause->setText( LLStringUtil::null ); - } - - if(find_cause) - { - if(gSavedSettings.getF32("RenderFarClip") > 128) - { - mClientCause->setText( getString("client_draw_distance_cause_msg", mStringArgs) ); - } - else if(LLAppViewer::instance()->getTextureFetch()->getNumRequests() > 2) - { - mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); - } - else if((BYTES_TO_MEGA_BYTES(LLViewerTexture::sBoundTextureMemoryInBytes)) > LLViewerTexture::sMaxBoundTextureMemInMegaBytes) - { - mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); - } - else - { - mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) ); - } - } -} - -void LLFloaterLagMeter::determineNetwork() -{ - F32 packet_loss = LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean(); - F32 ping_time = LLViewerStats::getInstance()->mSimPingStat.getMean(); - bool find_cause_loss = false; - bool find_cause_ping = false; - - // *FIXME: We can't blame a large ping time on anything in - // particular if the frame rate is low, because a low frame - // rate is a sure recipe for crappy ping times right now until - // the network handlers are de-synched from the rendering. - F32 client_frame_time_ms = 1000.0f * LLViewerStats::getInstance()->mFPSStat.getMeanDuration(); - - if(packet_loss >= mNetworkPacketLossCritical) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) ); - find_cause_loss = true; - } - else if(ping_time >= mNetworkPingCritical) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - if (client_frame_time_ms < mNetworkPingCritical) - { - mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) ); - find_cause_ping = true; - } - } - else if(packet_loss >= mNetworkPacketLossWarning) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) ); - find_cause_loss = true; - } - else if(ping_time >= mNetworkPingWarning) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - if (client_frame_time_ms < mNetworkPingWarning) - { - mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) ); - find_cause_ping = true; - } - } - else - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) ); - } - - if(find_cause_loss) - { - mNetworkCause->setText( getString("network_packet_loss_cause_msg", mStringArgs) ); - } - else if(find_cause_ping) - { - mNetworkCause->setText( getString("network_ping_cause_msg", mStringArgs) ); - } - else - { - mNetworkCause->setText( LLStringUtil::null ); - } -} - -void LLFloaterLagMeter::determineServer() -{ - F32 sim_frame_time = LLViewerStats::getInstance()->mSimFrameMsec.getCurrent(); - bool find_cause = false; - - if(sim_frame_time >= mServerFrameTimeCritical) - { - mServerButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) ); - find_cause = true; - } - else if(sim_frame_time >= mServerFrameTimeWarning) - { - mServerButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) ); - find_cause = true; - } - else - { - mServerButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) ); - mServerCause->setText( LLStringUtil::null ); - } - - if(find_cause) - { - if(LLViewerStats::getInstance()->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_net_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_images_cause_msg", mStringArgs) ); - } - else - { - mServerCause->setText( getString("server_generic_cause_msg", mStringArgs) ); - } - } -} - -//static -void LLFloaterLagMeter::onClickShrink(void * data) -{ - LLFloaterLagMeter * self = (LLFloaterLagMeter*)data; - - LLButton * button = self->getChild("minimize"); - S32 delta_width = self->mMaxWidth - self->mMinWidth; - LLRect r = self->getRect(); - if(self->mShrunk) - { - self->setTitle( self->getString("max_title_msg", self->mStringArgs) ); - // make left edge appear to expand - r.translate(-delta_width, 0); - self->setRect(r); - self->reshape(self->mMaxWidth, self->getRect().getHeight()); - - self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) + ":"); - self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) + ":"); - self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) + ":"); - - // usually "<<" - button->setLabel( self->getString("smaller_label", self->mStringArgs) ); - } - else - { - self->setTitle( self->getString("min_title_msg", self->mStringArgs) ); - // make left edge appear to collapse - r.translate(delta_width, 0); - self->setRect(r); - self->reshape(self->mMinWidth, self->getRect().getHeight()); - - self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) ); - self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) ); - self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) ); - - // usually ">>" - button->setLabel( self->getString("bigger_label", self->mStringArgs) ); - } - // Don't put keyboard focus on the button - button->setFocus(FALSE); - - self->mClientText->setVisible(self->mShrunk); - self->mClientCause->setVisible(self->mShrunk); - self->childSetVisible("client_help", self->mShrunk); - - self->mNetworkText->setVisible(self->mShrunk); - self->mNetworkCause->setVisible(self->mShrunk); - self->childSetVisible("network_help", self->mShrunk); - - self->mServerText->setVisible(self->mShrunk); - self->mServerCause->setVisible(self->mShrunk); - self->childSetVisible("server_help", self->mShrunk); - - self->mShrunk = !self->mShrunk; -} diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h deleted file mode 100644 index d9cea1830..000000000 --- a/indra/newview/llfloaterlagmeter.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @file llfloaterlagmeter.h - * @brief The "Lag-o-Meter" floater used to tell users what is causing lag. - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LLFLOATERLAGMETER_H -#define LLFLOATERLAGMETER_H - -#include "llfloater.h" - -class LLFloaterLagMeter : public LLFloater, public LLFloaterSingleton -{ - friend class LLUISingleton >; - -public: - /*virtual*/ void draw(); - -private: - LLFloaterLagMeter(const LLSD& key); - /*virtual*/ ~LLFloaterLagMeter(); - - void determineClient(); - void determineNetwork(); - void determineServer(); - - static void onClickShrink(void * data); - - bool mShrunk; - S32 mMaxWidth, mMinWidth; - - F32 mClientFrameTimeCritical; - F32 mClientFrameTimeWarning; - LLButton * mClientButton; - LLTextBox * mClientText; - LLTextBox * mClientCause; - - F32 mNetworkPacketLossCritical; - F32 mNetworkPacketLossWarning; - F32 mNetworkPingCritical; - F32 mNetworkPingWarning; - LLButton * mNetworkButton; - LLTextBox * mNetworkText; - LLTextBox * mNetworkCause; - - F32 mServerFrameTimeCritical; - F32 mServerFrameTimeWarning; - F32 mServerSingleProcessMaxTime; - LLButton * mServerButton; - LLTextBox * mServerText; - LLTextBox * mServerCause; - - LLStringUtil::format_map_t mStringArgs; -}; - -#endif diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 80a84820c..2318dd601 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -235,7 +235,14 @@ void LLFloaterLand::onClose(bool app_quitting) LLFloaterLand::LLFloaterLand(const LLSD& seed) -: LLFloater(std::string("floaterland"), std::string("FloaterLandRect5"), std::string("About Land")) + : LLFloater(std::string("floaterland"), std::string("FloaterLandRect5"), std::string("About Land")) + , mTabLand(nullptr) + , mPanelGeneral(nullptr) + , mPanelObjects(nullptr) + , mPanelOptions(nullptr) + , mPanelMedia(nullptr) + , mPanelAccess(nullptr) + , mPanelCovenant(nullptr) { mFactoryMap["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); mFactoryMap["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this); @@ -354,9 +361,38 @@ void* LLFloaterLand::createPanelLandAccess(void* data) LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_general_panel")), - mUncheckedSell(FALSE), - mParcel(parcel) + : LLPanel(std::string("land_general_panel")) + , mEditName(nullptr) + , mEditDesc(nullptr) + , mTextSalePending(nullptr) + , mBtnDeedToGroup(nullptr) + , mBtnSetGroup(nullptr) + , mTextOwner(nullptr) + , mBtnProfile(nullptr) + , mContentRating(nullptr) + , mLandType(nullptr) + , mTextGroup(nullptr) + , mTextClaimDate(nullptr) + , mTextPriceLabel(nullptr) + , mTextPrice(nullptr) + , mCheckDeedToGroup(nullptr) + , mCheckContributeWithDeed(nullptr) + , mSaleInfoForSale1(nullptr) + , mSaleInfoForSale2(nullptr) + , mSaleInfoForSaleObjects(nullptr) + , mSaleInfoForSaleNoObjects(nullptr) + , mSaleInfoNotForSale(nullptr) + , mBtnSellLand(nullptr) + , mBtnStopSellLand(nullptr) + , mTextDwell(nullptr) + , mBtnBuyLand(nullptr) + , mBtnScriptLimits(nullptr) + , mBtnBuyGroupLand(nullptr) + , mBtnReleaseLand(nullptr) + , mBtnReclaimLand(nullptr) + , mBtnBuyPass(nullptr) + , mBtnStartAuction(nullptr) + , mParcel(parcel) { } @@ -374,7 +410,6 @@ BOOL LLPanelLandGeneral::postBuild() // preserve that ability. mTextSalePending = getChild("SalePending"); - mTextOwnerLabel = getChild("Owner:"); mTextOwner = getChild("OwnerText"); mContentRating = getChild("ContentRatingText"); @@ -384,7 +419,6 @@ BOOL LLPanelLandGeneral::postBuild() mBtnProfile->setClickedCallback(boost::bind(&LLPanelLandGeneral::onClickProfile, this)); - mTextGroupLabel = getChild("Group:"); mTextGroup = getChild("GroupText"); @@ -425,7 +459,6 @@ BOOL LLPanelLandGeneral::postBuild() mBtnStopSellLand->setClickedCallback(onClickStopSellLand, this); - mTextClaimDateLabel = getChild("Claimed:"); mTextClaimDate = getChild("DateClaimText"); @@ -2412,8 +2445,10 @@ void LLPanelLandOptions::onClickPublishHelp(void*) //--------------------------------------------------------------------------- LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) - : LLPanel(std::string("land_access_panel")), - mParcel(parcel) + : LLPanel(std::string("land_access_panel")) + , mListAccess(nullptr) + , mListBanned(nullptr) + , mParcel(parcel) { } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 72e906a65..168dcc4f1 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -183,11 +183,7 @@ public: virtual BOOL postBuild(); protected: - BOOL mUncheckedSell; // True only when verifying land information when land is for sale on sale info change - - LLTextBox* mLabelName; LLLineEditor* mEditName; - LLTextBox* mLabelDesc; LLTextEditor* mEditDesc; LLTextBox* mTextSalePending; @@ -195,7 +191,6 @@ protected: LLButton* mBtnDeedToGroup; LLButton* mBtnSetGroup; - LLTextBox* mTextOwnerLabel; LLTextBox* mTextOwner; LLButton* mBtnProfile; @@ -203,8 +198,6 @@ protected: LLTextBox* mLandType; LLTextBox* mTextGroup; - LLTextBox* mTextGroupLabel; - LLTextBox* mTextClaimDateLabel; LLTextBox* mTextClaimDate; LLTextBox* mTextPriceLabel; diff --git a/indra/newview/llfloaterlandmark.cpp b/indra/newview/llfloaterlandmark.cpp index 7a8ac4534..7ecf7f7f3 100644 --- a/indra/newview/llfloaterlandmark.cpp +++ b/indra/newview/llfloaterlandmark.cpp @@ -247,7 +247,7 @@ const LLUUID& LLFloaterLandmark::findItemID(const LLUUID& asset_id, BOOL copyabl if (items.size()) { // search for copyable version first - for (S32 i = 0; i < items.size(); i++) + for (U32 i = 0; i < items.size(); i++) { LLInventoryItem* itemp = items[i]; LLPermissions item_permissions = itemp->getPermissions(); diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp index f0f1f3869..53e405af8 100644 --- a/indra/newview/llfloatermediasettings.cpp +++ b/indra/newview/llfloatermediasettings.cpp @@ -43,10 +43,13 @@ LLFloaterMediaSettings* LLFloaterMediaSettings::sInstance = NULL; // LLFloaterMediaSettings::LLFloaterMediaSettings(const LLSD& key) : LLFloater(key), - mTabContainer(NULL), - mPanelMediaSettingsGeneral(NULL), - mPanelMediaSettingsSecurity(NULL), - mPanelMediaSettingsPermissions(NULL), + mOKBtn(nullptr), + mCancelBtn(nullptr), + mApplyBtn(nullptr), + mTabContainer(nullptr), + mPanelMediaSettingsGeneral(nullptr), + mPanelMediaSettingsSecurity(nullptr), + mPanelMediaSettingsPermissions(nullptr), mWaitingToClose( false ), mIdenticalHasMediaInfo( true ), mMultipleMedia(false), diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 327a37cdd..b9539444d 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4177,17 +4177,17 @@ void LLModelPreview::updateStatusMessages() { for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance) { - LLModel* model = instance->mModel; - if (model) + LLModel* lod_model = instance->mModel; + if (lod_model) { //for each model in the lod S32 cur_tris = 0; S32 cur_verts = 0; - S32 cur_submeshes = model->getNumVolumeFaces(); + S32 cur_submeshes = lod_model->getNumVolumeFaces(); for (S32 j = 0; j < cur_submeshes; ++j) { //for each submesh (face), add triangles and vertices to current total - const LLVolumeFace& face = model->getVolumeFace(j); + const LLVolumeFace& face = lod_model->getVolumeFace(j); cur_tris += face.mNumIndices/3; cur_verts += face.mNumVertices; } @@ -4202,6 +4202,11 @@ void LLModelPreview::updateStatusMessages() verts[lod].push_back(cur_verts); submeshes[lod].push_back(cur_submeshes); } + else // !lod_model + { + setLoadState( LLModelLoader::ERROR_MATERIALS ); + mFMP->childDisable( "calculate_btn" ); + } } } } diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 35f6b9c1f..8352d140c 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -77,6 +77,7 @@ LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) mFilterByDescription(NULL), mFilterByLinksetUse(NULL), mEditLinksetUse(NULL), + mEditLinksetUseUnset(nullptr), mEditLinksetUseWalkable(NULL), mEditLinksetUseStaticObstacle(NULL), mEditLinksetUseDynamicObstacle(NULL), diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 6f1cb5e77..64c6cc50e 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -204,6 +204,9 @@ LLUUID LLFloaterRegionInfo::sRequestInvoice; LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) + : LLFloater() + , mTab(nullptr) + , mInfoPanels() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_info.xml", NULL, FALSE); } @@ -508,11 +511,7 @@ void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) mInfoPanels.begin(), mInfoPanels.end(), llbind2nd( -#if LL_WINDOWS - std::mem_fun1(&LLPanelRegionInfo::refreshFromRegion), -#else std::mem_fun(&LLPanelRegionInfo::refreshFromRegion), -#endif region)); } @@ -2467,8 +2466,13 @@ bool LLPanelEstateInfo::onMessageCommit(const LLSD& notification, const LLSD& re } LLPanelEstateCovenant::LLPanelEstateCovenant() - : - mCovenantID(LLUUID::null) + : LLPanelRegionInfo() + , mEstateNameText(nullptr) + , mEstateOwnerText(nullptr) + , mLastModifiedText(nullptr) + , mCovenantID(LLUUID::null) + , mEditor(nullptr) + , mAssetStatus(ASSET_ERROR) { } diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 05ed662bf..be5ff68b1 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -74,7 +74,7 @@ #include "llfloateravatarpicker.h" #include "lldir.h" #include "llselectmgr.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "lluictrlfactory.h" #include "llviewernetwork.h" @@ -624,10 +624,7 @@ LLSD LLFloaterReporter::gatherReport() std::ostringstream details; - details << "V" << gVersionMajor << "." // client version moved to body of email for abuse reports - << gVersionMinor << "." - << gVersionPatch << "." - << gVersionBuild << std::endl << std::endl; + details << "V" << LLVersionInfo::getVersion() << std::endl; // client version moved to body of email for abuse reports std::string object_name = getChild("object_name")->getValue().asString(); if (!object_name.empty() && !mOwnerName.empty()) @@ -644,10 +641,8 @@ LLSD LLFloaterReporter::gatherReport() std::string version_string; version_string = llformat( - "%d.%d.%d %s %s %s %s", - gVersionMajor, - gVersionMinor, - gVersionPatch, + "%s %s %s %s %s", + LLVersionInfo::getShortVersion().c_str(), platform, gSysCPU.getFamily().c_str(), gGLManager.mGLRenderer.c_str(), diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 71f478e52..5e9d9ebf8 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -48,9 +48,9 @@ class LLMeanCollisionData; struct LLResourceData; // these flags are used to label info requests to the server -//const U32 BUG_REPORT_REQUEST = 0x01 << 0; // DEPRECATED -const U32 COMPLAINT_REPORT_REQUEST = 0x01 << 1; -const U32 OBJECT_PAY_REQUEST = 0x01 << 2; +//constexpr U32 BUG_REPORT_REQUEST = 0x01 << 0; // DEPRECATED +constexpr U32 COMPLAINT_REPORT_REQUEST = 0x01 << 1; +constexpr U32 OBJECT_PAY_REQUEST = 0x01 << 2; // ************************************************************ diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index df9ff37eb..7fe24895c 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -162,7 +162,8 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput() } LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id) -: LLFloater(std::string("script instance floater"), LLRect(0, 200, 200, 0), std::string("Script"), TRUE), mObjectID(object_id) +: LLFloater(std::string("script instance floater"), LLRect(0, 200, 200, 0), std::string("Script"), TRUE), mObjectID(object_id), + mHistoryEditor(nullptr) { S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; S32 x = LLFLOATER_HPAD; diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 0f6b6b78b..a0a6184aa 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -84,6 +84,8 @@ const S32 SIZE_OF_ONE_KB = 1024; LLFloaterScriptLimits::LLFloaterScriptLimits(const LLSD& seed) : LLFloater(/*seed*/) + , mTab(nullptr) + , mInfoPanels() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_script_limits.xml"); } diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index 67e9421a5..f0fdc3444 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -113,20 +113,8 @@ LLFloaterSearch::_Params::_Params() } LLFloaterSearch::LLFloaterSearch(const Params& key) : - LLFloaterWebContent(key), - mSearchGodLevel(0) + LLFloaterWebContent(key) { - // declare a map that transforms a category name into - // the URL suffix that is used to search that category - mCategoryPaths = LLSD::emptyMap(); - mCategoryPaths["all"] = "search"; - mCategoryPaths["people"] = "search/people"; - mCategoryPaths["places"] = "search/places"; - mCategoryPaths["events"] = "search/events"; - mCategoryPaths["groups"] = "search/groups"; - mCategoryPaths["wiki"] = "search/wiki"; - mCategoryPaths["destinations"] = "destinations"; - mCategoryPaths["classifieds"] = "classifieds"; LLUICtrlFactory::getInstance()->buildFloater(this, "floater_web_content.xml"); } @@ -143,8 +131,8 @@ BOOL LLFloaterSearch::postBuild() getChildView("popexternal")->setEnabled(false); setRectControl("FloaterSearchRect"); applyRectControl(); - search(SearchQuery()); - gSavedSettings.getControl("SearchURL")->getSignal()->connect(boost::bind(&LLFloaterSearch::search, this, SearchQuery())); + search(SearchQuery(), mWebBrowser); + gSavedSettings.getControl("SearchURL")->getSignal()->connect(boost::bind(LLFloaterSearch::search, SearchQuery(), mWebBrowser)); return TRUE; } @@ -156,32 +144,11 @@ void LLFloaterSearch::showInstance(const SearchQuery& search, bool web) { LLFloaterSearch* floater = getInstance(); floater->open(); // May not be open - floater->search(search); + floater->search(search, floater->mWebBrowser); } else { - const std::string category(search.category()); - if (category.empty()) - LLFloaterDirectory::searchInAll(search.query); - else if (category == "all") - LLFloaterDirectory::showFindAll(search.query); - else if (category == "people") - LLFloaterDirectory::showPeople(search.query); - else if (category == "places") - LLFloaterDirectory::showPlaces(search.query); - else if (category == "events") - LLFloaterDirectory::showEvents(search.query); - else if (category == "groups") - LLFloaterDirectory::showGroups(search.query); - /* Singu TODO: Wiki tab in secondlife legacy search floater? - else if (category == "wiki") - LLFloaterDirectory::showWiki(search.query);*/ - else if (category == "destinations") - LLFloaterDirectory::showDestinations(); - else if (category == "classifieds") - LLFloaterDirectory::showClassified(search.query); - else - LLNotificationsUtil::add("UnsupportedCommandSLURL"); // Singu Note: Perhaps we should use a special notification here? + LLFloaterDirectory::search(search); } } @@ -192,7 +159,7 @@ void LLFloaterSearch::showInstance(const SearchQuery& search, bool web) p.allow_address_entry = false; LLFloaterWebContent::onOpen(p); - search(p.search); + search(p.search, mWebBrowser); }*/ void LLFloaterSearch::onClose(bool app_quitting) @@ -208,31 +175,30 @@ void LLFloaterSearch::onClose(bool app_quitting) destroy(); } -void LLFloaterSearch::godLevelChanged(U8 godlevel) -{ - // search results can change based upon god level - if the user - // changes god level, then give them a warning (we don't refresh - // the search as this might undo any page navigation or - // AJAX-driven changes since the last search). - - //FIXME: set status bar text - - //getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel)); -} - -void LLFloaterSearch::search(const SearchQuery &p) +// static +void LLFloaterSearch::search(const SearchQuery &p, LLMediaCtrl* mWebBrowser) { if (! mWebBrowser || !p.validateBlock()) { return; } - // reset the god level warning as we're sending the latest state - //getChildView("refresh_search")->setVisible(FALSE); - mSearchGodLevel = gAgent.getGodLevel(); - // work out the subdir to use based on the requested category LLSD subs; + // declare a map that transforms a category name into + // the URL suffix that is used to search that category + static LLSD mCategoryPaths = LLSD::emptyMap(); + if (mCategoryPaths.size() == 0) + { + mCategoryPaths["all"] = "search"; + mCategoryPaths["people"] = "search/people"; + mCategoryPaths["places"] = "search/places"; + mCategoryPaths["events"] = "search/events"; + mCategoryPaths["groups"] = "search/groups"; + mCategoryPaths["wiki"] = "search/wiki"; + mCategoryPaths["destinations"] = "destinations"; + mCategoryPaths["classifieds"] = "classifieds"; + } if (mCategoryPaths.has(p.category)) { subs["CATEGORY"] = mCategoryPaths[p.category].asString(); diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h index 8cba06a1e..96fbd35c1 100644 --- a/indra/newview/llfloatersearch.h +++ b/indra/newview/llfloatersearch.h @@ -79,18 +79,10 @@ public: /// - "id": specifies the text phrase to search for /// - "category": one of "all" (default), "people", "places", /// "events", "groups", "wiki", "destinations", "classifieds" - void search(const SearchQuery &query); - - /// changing godmode can affect the search results that are - /// returned by the search website - use this method to tell the - /// search floater that the user has changed god level. - void godLevelChanged(U8 godlevel); + static void search(const SearchQuery& query, LLMediaCtrl* mWebBrowser); private: /*virtual*/ BOOL postBuild(); - - LLSD mCategoryPaths; - U8 mSearchGodLevel; }; #endif // LL_LLFLOATERSEARCH_H diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 9c0fcf159..46f45b1e2 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -55,6 +55,7 @@ LLFloaterSettingsDebug::LLFloaterSettingsDebug() , mCurrentControlVariable(NULL) , mOldControlVariable(NULL) , mOldSearchTerm(std::string("---")) +, mComment(nullptr) { mCommitCallbackRegistrar.add("SettingSelect", boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this)); mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 3c526a1ac..727a89b3c 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -103,6 +103,7 @@ public: LLFloaterURLEntry::LLFloaterURLEntry(LLHandle parent) : LLFloater(), + mMediaURLEdit(nullptr), mPanelLandMediaHandle(parent) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_url_entry.xml"); diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp index fc74c9e87..a60ca1ca7 100644 --- a/indra/newview/llfloatervoiceeffect.cpp +++ b/indra/newview/llfloatervoiceeffect.cpp @@ -38,6 +38,7 @@ LLFloaterVoiceEffect::LLFloaterVoiceEffect(const LLSD& key) : LLFloater(/*key*/) + , mVoiceEffectList(nullptr) { mCommitCallbackRegistrar.add("VoiceEffect.Record", boost::bind(&LLFloaterVoiceEffect::onClickRecord, this)); mCommitCallbackRegistrar.add("VoiceEffect.Play", boost::bind(&LLFloaterVoiceEffect::onClickPlay, this)); diff --git a/indra/newview/llfloatervoiceeffect.h b/indra/newview/llfloatervoiceeffect.h index 9bee8937c..e7c0af852 100644 --- a/indra/newview/llfloatervoiceeffect.h +++ b/indra/newview/llfloatervoiceeffect.h @@ -67,7 +67,6 @@ private: void onClickStop(); void onClickActivate(); - LLUUID mSelectedID; LLScrollListCtrl* mVoiceEffectList; }; diff --git a/indra/newview/llfloaterwhitelistentry.cpp b/indra/newview/llfloaterwhitelistentry.cpp index f930e0940..c7a17f136 100644 --- a/indra/newview/llfloaterwhitelistentry.cpp +++ b/indra/newview/llfloaterwhitelistentry.cpp @@ -37,8 +37,9 @@ /////////////////////////////////////////////////////////////////////////////// // -LLFloaterWhiteListEntry::LLFloaterWhiteListEntry() : - LLFloater() +LLFloaterWhiteListEntry::LLFloaterWhiteListEntry() + : LLFloater() + , mWhiteListEdit(nullptr) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_whitelist_entry.xml"); } diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index f60ff56e1..caca3f627 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -617,7 +617,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) buildLandmarkIDLists(); BOOL found = FALSE; - S32 idx; + U32 idx; for (idx = 0; idx < mLandmarkItemIDList.size(); idx++) { if ( mLandmarkItemIDList.at(idx) == landmark_item_id) diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 7bf80e021..1605f8174 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -768,7 +768,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) // item. gFocusMgr.setKeyboardFocus(NULL); - return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); + return LLToolDragAndDrop::getInstance()->handleHover( screen_x, screen_y, mask ); } } } diff --git a/indra/newview/llframestats.cpp b/indra/newview/llframestats.cpp index 38ba40aa7..a87fd67a2 100644 --- a/indra/newview/llframestats.cpp +++ b/indra/newview/llframestats.cpp @@ -195,7 +195,7 @@ void LLFrameStats::dump() fprintf(fp, "Time\tNumTriangles\t"); - S32 i; + U32 i; for (i = 0; i < NUM_STATS; i++) { fprintf(fp, "%s\t", sStatLabels[i].c_str()); diff --git a/indra/newview/llgivemoney.cpp b/indra/newview/llgivemoney.cpp index bd9243827..ea1502973 100644 --- a/indra/newview/llgivemoney.cpp +++ b/indra/newview/llgivemoney.cpp @@ -76,16 +76,13 @@ LLFloaterPay::LLFloaterPay(const std::string& name, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, DRAG_ON_TOP, MINIMIZE_NO, CLOSE_YES), mCallback(callback), - mObjectNameText(NULL), mTargetUUID(uuid), mTargetIsObject(target_is_object), mTargetIsGroup(FALSE), - mDefaultValue(0) + mDefaultValue(0), + mQuickPayButton({ {nullptr,nullptr,nullptr,nullptr} }), + mQuickPayInfo({ {PAY_BUTTON_DEFAULT_0, PAY_BUTTON_DEFAULT_1, PAY_BUTTON_DEFAULT_2, PAY_BUTTON_DEFAULT_3} }) { - mQuickPayInfo[0] = PAY_BUTTON_DEFAULT_0; - mQuickPayInfo[1] = PAY_BUTTON_DEFAULT_1; - mQuickPayInfo[2] = PAY_BUTTON_DEFAULT_2; - mQuickPayInfo[3] = PAY_BUTTON_DEFAULT_3; BOOST_STATIC_ASSERT(MAX_PAY_BUTTONS == 4); if (target_is_object) diff --git a/indra/newview/llgivemoney.h b/indra/newview/llgivemoney.h index 540d0dade..26abf3450 100644 --- a/indra/newview/llgivemoney.h +++ b/indra/newview/llgivemoney.h @@ -81,14 +81,12 @@ private: protected: money_callback mCallback; - LLTextBox* mObjectNameText; LLUUID mTargetUUID; BOOL mTargetIsObject; BOOL mTargetIsGroup; - BOOL mHaveName; - LLButton* mQuickPayButton[MAX_PAY_BUTTONS]; - S32 mQuickPayInfo[MAX_PAY_BUTTONS]; + std::array mQuickPayButton; + std::array mQuickPayInfo; S32 mDefaultValue; LLSafeHandle mObjectSelection; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 028060358..b4bd6770e 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -38,6 +38,7 @@ #include "llappviewer.h" //For gFrameCount #include "llagent.h" +#include "llavatarnamecache.h" #include "llui.h" #include "message.h" #include "roles_constants.h" @@ -79,6 +80,7 @@ LLRoleActionSet::~LLRoleActionSet() { delete mActionSetData; std::for_each(mActions.begin(), mActions.end(), DeletePointer()); + mActions.clear(); } // @@ -237,7 +239,8 @@ LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) : mRoleMemberDataComplete(false), mGroupPropertiesDataComplete(false), mPendingRoleMemberRequest(false), - mAccessTime(0.0f) + mAccessTime(0.0f), + mPendingBanRequest(false) { mMemberVersion.generate(); } @@ -844,8 +847,69 @@ void LLGroupMgrGroupData::removeBanEntry(const LLUUID& ban_id) mBanList.erase(ban_id); } +void LLGroupMgrGroupData::banMemberById(const LLUUID& participant_uuid) +{ + if (!mMemberDataComplete || + !mRoleDataComplete || + !(mRoleMemberDataComplete && mMembers.size())) + { + LL_WARNS() << "No Role-Member data yet, setting ban request to pending." << LL_ENDL; + mPendingBanRequest = true; + mPendingBanMemberID = participant_uuid; + if (!mMemberDataComplete) + { + LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mID); + } + if (!mRoleDataComplete) + { + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mID); + } + + return; + } + + LLGroupMgrGroupData::member_list_t::iterator mi = mMembers.find((participant_uuid)); + if (mi == mMembers.end()) + { + if (!mPendingBanRequest) + { + mPendingBanRequest = true; + mPendingBanMemberID = participant_uuid; + LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mID); // member isn't in members list, request reloading + } + else + { + mPendingBanRequest = false; + } + + return; + } + + mPendingBanRequest = false; + + LLGroupMemberData* member_data = (*mi).second; + if (member_data && member_data->isInRole(mOwnerRole)) + { + return; // can't ban group owner + } + + std::vector ids; + ids.push_back(participant_uuid); + + LLGroupBanData ban_data; + createBanEntry(participant_uuid, ban_data); + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mID, LLGroupMgr::BAN_CREATE, ids); + LLGroupMgr::getInstance()->sendGroupMemberEjects(mID, ids); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mID); + LLSD args; + std::string name; + LLAvatarNameCache::getNSName(participant_uuid, name); + args["AVATAR_NAME"] = name; + args["GROUP_NAME"] = mName; + LLNotifications::instance().add(LLNotification::Params("EjectAvatarFromGroup").substitutions(args)); +} // // LLGroupMgr @@ -1352,6 +1416,11 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) group_datap->mChanged = TRUE; LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_MEMBER_DATA); + + if (group_datap->mPendingBanRequest) + { + group_datap->banMemberById(group_datap->mPendingBanMemberID); + } } // static @@ -2082,6 +2151,7 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) if (!gdatap) return; + gdatap->clearBanList(); LLSD::map_const_iterator i = content["ban_list"].beginMap(); LLSD::map_const_iterator iEnd = content["ban_list"].endMap(); for(;i != iEnd; ++i) @@ -2195,11 +2265,6 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) return; } - // If we have no members, there's no reason to do anything else - S32 num_members = content["member_count"]; - if (num_members < 1) - return; - LLUUID group_id = content["group_id"].asUUID(); LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); @@ -2209,6 +2274,18 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) return; } + // If we have no members, there's no reason to do anything else + S32 num_members = content["member_count"]; + if (num_members < 1) + { + LL_INFOS("GrpMgr") << "Received empty group members list for group id: " << group_id.asString() << LL_ENDL; + // Set mMemberDataComplete for correct handling of empty responses. See MAINT-5237 + group_datap->mMemberDataComplete = true; + group_datap->mChanged = TRUE; + LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA); + return; + } + group_datap->mMemberCount = num_members; LLSD member_list = content["members"]; diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 20c637112..1e7e4f5ae 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -149,7 +149,7 @@ public: const uuid_vec_t& getRoleMembers() const { return mMemberIDs; } S32 getMembersInRole(uuid_vec_t members, BOOL needs_sort = TRUE); - S32 getTotalMembersInRole() { return mMemberIDs.size(); } + S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : mMemberIDs.size(); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 LLRoleData getRoleData() const { return mRoleData; } void setRoleData(LLRoleData data) { mRoleData = data; } @@ -269,7 +269,7 @@ public: void createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data = LLGroupBanData()); void removeBanEntry(const LLUUID& ban_id); - + void banMemberById(const LLUUID& participant_uuid); public: typedef std::map member_list_t; @@ -301,6 +301,9 @@ public: S32 mMemberCount; S32 mRoleCount; + bool mPendingBanRequest; + LLUUID mPendingBanMemberID; + protected: void sendRoleChanges(); void cancelRoleChanges(); diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 5cbbbb577..90546e5b9 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -441,7 +441,7 @@ bool LLHUDEffectPointAt::calcTargetPosition() mTargetPos -= mSourceObject->getRenderPosition(); - if (!llfinite(mTargetPos.lengthSquared())) + if (!std::isfinite(mTargetPos.lengthSquared())) { return false; } diff --git a/indra/newview/llhudeffecttrail.h b/indra/newview/llhudeffecttrail.h index 033fbeb06..15daa80db 100644 --- a/indra/newview/llhudeffecttrail.h +++ b/indra/newview/llhudeffecttrail.h @@ -42,7 +42,7 @@ class LLViewerObject; -const U32 NUM_TRAIL_POINTS = 40; +constexpr U32 NUM_TRAIL_POINTS = 40; class LLHUDEffectSpiral : public LLHUDEffect diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp index c78880d90..8ffb1a9be 100644 --- a/indra/newview/llhudmanager.cpp +++ b/indra/newview/llhudmanager.cpp @@ -66,7 +66,7 @@ static LLFastTimer::DeclareTimer FTM_HUD_EFFECTS("Hud Effects"); void LLHUDManager::updateEffects() { LLFastTimer ftm(FTM_HUD_EFFECTS); - S32 i; + U32 i; for (i = 0; i < mHUDEffects.size(); i++) { LLHUDEffect *hep = mHUDEffects[i]; @@ -84,7 +84,7 @@ void LLHUDManager::sendEffects() static LLCachedControl disable_pointat_effect(gSavedSettings, "DisablePointAtAndBeam", false); static LLCachedControl broadcast_viewer_effects(gSavedSettings, "BroadcastViewerEffects", true); - S32 i; + U32 i; for (i = 0; i < mHUDEffects.size(); i++) { LLHUDEffect *hep = mHUDEffects[i]; @@ -141,7 +141,7 @@ void LLHUDManager::shutdownClass() void LLHUDManager::cleanupEffects() { - S32 i = 0; + U32 i = 0; while (i < mHUDEffects.size()) { @@ -194,7 +194,7 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat { effectp = NULL; LLHUDEffect::getIDType(mesgsys, k, effect_id, effect_type); - S32 i; + U32 i; for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.size(); i++) { LLHUDEffect *cur_effectp = LLHUDManager::getInstance()->mHUDEffects[i]; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bf72f2f91..6c0995292 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -91,18 +91,12 @@ #include "rlvhandler.h" #include "rlvlocks.h" // [/RLVa:KB] -#include // Marketplace outbox current disabled #define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 #define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 1 #define BLOCK_WORN_ITEMS_IN_OUTBOX 1 -bool InventoryLinksEnabled() -{ - return gHippoGridManager->getConnectedGrid()->supportsInvLinks(); -} - typedef std::pair two_uuids_t; typedef std::list two_uuids_list_t; @@ -318,8 +312,8 @@ void LLInvFVBridge::removeBatch(std::vector& batch) LLViewerInventoryCategory* cat = NULL; LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - S32 count = batch.size(); - S32 i,j; + U32 count = batch.size(); + U32 i,j; for(i = 0; i < count; ++i) { bridge = (LLInvFVBridge*)(batch.at(i)); @@ -574,10 +568,6 @@ bool LLInvFVBridge::isClipboardPasteableAsCopy() const BOOL LLInvFVBridge::isClipboardPasteableAsLink() const { - if (!InventoryLinksEnabled()) - { - return FALSE; - } if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory()) { return FALSE; @@ -814,7 +804,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { items.push_back(std::string("Paste")); // Paste as copy if we have links. - if (InventoryLinksEnabled() && isClipboardPasteableAsCopy()) + if (isClipboardPasteableAsCopy()) { items.push_back(std::string("Paste As Copy")); paste_as_copy = true; @@ -827,7 +817,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, paste_as_copy = false; } - if (!paste_as_copy && InventoryLinksEnabled()) + if (!paste_as_copy) { items.push_back(std::string("Paste As Link")); if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0) @@ -1852,21 +1842,18 @@ BOOL LLItemBridge::removeItem() // [SL:KB] - Patch: Inventory-Links | Checked: 2010-06-01 (Catznip-2.2.0a) | Added: Catznip-2.0.1a // Users move folders around and reuse links that way... if we know something has links then it's just bad not to warn them :| // [/SL:KB] -// if (!InventoryLinksEnabled()) + if (!item->getIsLinkType()) { - if (!item->getIsLinkType()) + LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); + const U32 num_links = item_array.size(); + if (num_links > 0) { - LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); - const U32 num_links = item_array.size(); - if (num_links > 0) - { - // Warn if the user is will break any links when deleting this item. - LLNotifications::instance().add(params); - return FALSE; - } + // Warn if the user is will break any links when deleting this item. + LLNotifications::instance().add(params); + return FALSE; } } - + LLNotifications::instance().forceResponse(params, 0); return TRUE; } @@ -1924,7 +1911,7 @@ BOOL LLItemBridge::isItemCopyable() const // NOTE: we do *not* want to return TRUE on everything like LL seems to do in SL-2.1.0 because not all types are "linkable" return (item->getPermissions().allowCopyBy(gAgent.getID())) || (LLAssetType::lookupCanLink(item->getType())); // [/SL:KB] -// return item->getPermissions().allowCopyBy(gAgent.getID()) || InventoryLinksEnabled(); +// return item->getPermissions().allowCopyBy(gAgent.getID()); } return FALSE; } @@ -2209,7 +2196,7 @@ int get_folder_levels(LLInventoryCategory* inv_cat) int max_child_levels = 0; - for (S32 i=0; i < cats->size(); ++i) + for (size_t i=0; i < cats->size(); ++i) { LLInventoryCategory* category = cats->at(i); max_child_levels = llmax(max_child_levels, get_folder_levels(category)); @@ -2319,7 +2306,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (is_movable) { model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); - for (S32 i=0; i < descendent_categories.size(); ++i) + for (U32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) @@ -2354,7 +2341,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_trash) { - for (S32 i=0; i < descendent_items.size(); ++i) + for (U32 i=0; i < descendent_items.size(); ++i) { LLInventoryItem* item = descendent_items[i]; if (get_is_item_worn(item->getUUID())) @@ -2366,7 +2353,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_landmarks) { - for (S32 i=0; i < descendent_items.size(); ++i) + for (U32 i=0; i < descendent_items.size(); ++i) { LLViewerInventoryItem* item = descendent_items[i]; @@ -2459,7 +2446,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (is_movable == TRUE) { - for (S32 i=0; i < descendent_items.size(); ++i) + for (size_t i=0; i < descendent_items.size(); ++i) { LLInventoryItem* item = descendent_items[i]; if (!can_move_to_outbox(item)) @@ -2482,7 +2469,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // Look for any gestures and deactivate them if (move_is_into_trash) { - for (S32 i=0; i < descendent_items.size(); i++) + for (U32 i=0; i < descendent_items.size(); i++) { LLInventoryItem* item = descendent_items[i]; if (item->getType() == LLAssetType::AT_GESTURE @@ -2510,7 +2497,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel::item_array_t items; model->collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); LLInventoryObject::const_object_list_t citems; - BOOST_FOREACH(LLPointer item, items) + for (LLPointer item : items) { citems.push_back(item.get()); } @@ -3585,15 +3572,13 @@ void build_context_menu_folder_options(LLInventoryModel* model, const LLUUID& mU // Only enable add/replace outfit for non-system folders. if (!is_system_folder) { - if (InventoryLinksEnabled() /*&& // Adding an outfit onto another (versus replacing) doesn't make sense. // Actually, it does make a bit of sense, in some cases. - !is_outfit*/) + //if(!is_outfit) { items.push_back(std::string("Add To Outfit")); } - else //if(!InventoryLinksEnabled()) - items.push_back(std::string("Wearable And Object Wear")); + //items.push_back(std::string("Wearable And Object Wear")); items.push_back(std::string("Replace Outfit")); } @@ -5615,8 +5600,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Wearable And Object Separator")); items.push_back(std::string("Wearable And Object Wear")); - if (InventoryLinksEnabled()) - items.push_back(std::string("Wearable Add")); + items.push_back(std::string("Wearable Add")); items.push_back(std::string("Attach To")); items.push_back(std::string("Attach To HUD")); // commented out for DEV-32347 - AND Commented back in for non-morons. -HgB @@ -5926,7 +5910,6 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // Disable wear and take off based on whether the item is worn. if(item) { - bool cof_pending = LLUpdateAppearanceOnDestroy::sActiveCallbacks; switch (item->getType()) { case LLAssetType::AT_CLOTHING: @@ -5935,12 +5918,20 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) case LLAssetType::AT_BODYPART: items.push_back(std::string("Wearable And Object Wear")); - if (!cof_pending && get_is_item_worn(item->getUUID())) + if (LLUpdateAppearanceOnDestroy::sActiveCallbacks) // cof_pending + { + disabled_items.push_back(std::string("Wearable And Object Wear")); + disabled_items.push_back(std::string("Wearable Add")); + disabled_items.push_back(std::string("Take Off")); + disabled_items.push_back(std::string("Wearable Move Forward")); + disabled_items.push_back(std::string("Wearable Move Back")); + } + else if (get_is_item_worn(item->getUUID())) { disabled_items.push_back(std::string("Wearable And Object Wear")); disabled_items.push_back(std::string("Wearable Add")); // [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0c) | Added: RLVa-1.2.0c - if (cof_pending || (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item))) + if ((rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item))) disabled_items.push_back(std::string("Take Off")); // [/RLVa:KB] } @@ -5948,11 +5939,11 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { disabled_items.push_back(std::string("Take Off")); disabled_items.push_back(std::string("Wearable Edit")); - if (cof_pending || gAgentWearables.getWearableFromAssetID(item->getAssetUUID())) + if (gAgentWearables.getWearableFromAssetID(item->getAssetUUID())) { disabled_items.push_back(std::string("Wearable Add")); LLViewerWearable* wearable = gAgentWearables.getWearableFromAssetID(item->getAssetUUID()); - if (cof_pending || (wearable && wearable != gAgentWearables.getTopWearable(mWearableType))) + if (wearable && wearable != gAgentWearables.getTopWearable(mWearableType)) disabled_items.push_back(std::string("Wearable And Object Wear")); } // [RLVa:KB] - Checked: 2010-06-09 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g @@ -5974,12 +5965,13 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Wearable Move Back")); bool is_worn = get_is_item_worn(item->getUUID()); - if (cof_pending || !is_worn || !gAgentWearables.canMoveWearable(item->getUUID(), false)) + if (!is_worn || !gAgentWearables.canMoveWearable(item->getUUID(), false)) disabled_items.push_back(std::string("Wearable Move Forward")); - if (cof_pending || !is_worn || !gAgentWearables.canMoveWearable(item->getUUID(), true)) + if (!is_worn || !gAgentWearables.canMoveWearable(item->getUUID(), true)) disabled_items.push_back(std::string("Wearable Move Back")); - if (cof_pending || !gAgentWearables.canAddWearable(mWearableType)) + // Allow adding for the behavior of replacing bodyparts but keeping worn things else. + if (item->getType() != LLAssetType::AT_BODYPART && !gAgentWearables.canAddWearable(mWearableType)) { disabled_items.push_back(std::string("Wearable Add")); } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 26a8678e2..279c9dc35 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2303,19 +2303,20 @@ void LLInventoryModel::buildParentChildMap() // Now we have a structure with all of the categories that we can // iterate over and insert into the correct place in the child // category tree. - S32 count = cats.size(); - S32 i; - S32 lost = 0; + U32 count = cats.size(); + U32 i; + U32 lost = 0; cat_array_t lost_cats; for(i = 0; i < count; ++i) { LLViewerInventoryCategory* cat = cats.at(i); catsp = getUnlockedCatArray(cat->getParentUUID()); - if(catsp && - // Only the two root folders should be children of null. - // Others should go to lost & found. - (cat->getParentUUID().notNull() || - cat->getPreferredType() == LLFolderType::FT_ROOT_INVENTORY )) + if (catsp && + // Only the two root folders should be children of null. + // Others should go to lost & found. + (cat->getParentUUID().notNull() || + (cat->getPreferredType() == LLFolderType::FT_ROOT_INVENTORY + || (cat->getParentUUID().isNull() && cat->getName() == "My Inventory")))) { catsp->push_back(cat); } @@ -3745,7 +3746,7 @@ bool LLInventoryModel::validate() const { item_lock++; } - for (S32 i = 0; isize(); i++) + for (U32 i = 0; isize(); i++) { LLViewerInventoryItem *item = items->at(i); @@ -3823,7 +3824,7 @@ bool LLInventoryModel::validate() const else { bool found = false; - for (S32 i = 0; isize(); i++) + for (U32 i = 0; isize(); i++) { LLViewerInventoryCategory *kid_cat = cats->at(i); if (kid_cat == cat) @@ -3869,7 +3870,7 @@ bool LLInventoryModel::validate() const else { bool found = false; - for (S32 i=0; isize(); ++i) + for (U32 i=0; isize(); ++i) { if (items->at(i) == item) { diff --git a/indra/newview/lllandmarklist.h b/indra/newview/lllandmarklist.h index 3356f866c..ab51f7135 100644 --- a/indra/newview/lllandmarklist.h +++ b/indra/newview/lllandmarklist.h @@ -27,7 +27,10 @@ #ifndef LL_LLLANDMARKLIST_H #define LL_LLLANDMARKLIST_H +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include "lllandmark.h" #include "lluuid.h" diff --git a/indra/newview/llmakeoutfitdialog.cpp b/indra/newview/llmakeoutfitdialog.cpp index fb47753a2..d01860947 100644 --- a/indra/newview/llmakeoutfitdialog.cpp +++ b/indra/newview/llmakeoutfitdialog.cpp @@ -85,13 +85,6 @@ LLMakeOutfitDialog::LLMakeOutfitDialog(bool modal) : LLModalDialog(LLStringUtil: } } - if (!gHippoGridManager->getConnectedGrid()->supportsInvLinks()) - { - childSetValue("checkbox_use_links", false); - childSetEnabled("checkbox_use_outfits", false); - childSetValue("checkbox_use_outfits", false); - } - getChild("Save")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onSave, this)); getChild("Cancel")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::close, this, _1)); getChild("Check All")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onCheckAll, this, true)); @@ -140,7 +133,7 @@ void LLMakeOutfitDialog::refresh() if (fUseOutfits) pCheckCtrl->setValue(true); } - getChild("checkbox_use_links")->setEnabled(!fUseOutfits && gHippoGridManager->getConnectedGrid()->supportsInvLinks()); + getChild("checkbox_use_links")->setEnabled(!fUseOutfits); getChild("checkbox_legacy_copy_changes")->setEnabled(!fUseOutfits); } diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 45b18ae2f..53c18d214 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -488,7 +488,7 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit(); // have permission to move and object is root of selection or individually selected - if (object->permMove() && !object->isPermanentEnforced() && + if (object && object->permMove() && !object->isPermanentEnforced() && ((root_object == NULL) || !root_object->isPermanentEnforced()) && (object->isRootEdit() || selectNode->mIndividualSelection)) { @@ -578,7 +578,7 @@ void LLManipRotate::drag( S32 x, S32 y ) LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit(); // have permission to move and object is root of selection or individually selected - if (object->permMove() && !object->isPermanentEnforced() && + if (object && object->permMove() && !object->isPermanentEnforced() && ((root_object == NULL) || !root_object->isPermanentEnforced()) && (object->isRootEdit() || selectNode->mIndividualSelection)) { diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index a3e2561af..9dcb6fdc1 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -704,7 +704,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } LLViewerObject* root_object = (object == NULL) ? NULL : object->getRootEdit(); - if (object->permMove() && !object->isPermanentEnforced() && + if (object && object->permMove() && !object->isPermanentEnforced() && ((root_object == NULL) || !root_object->isPermanentEnforced())) { // handle attachments in local space @@ -2317,7 +2317,7 @@ BOOL LLManipTranslate::canAffectSelection() virtual bool apply(LLViewerObject* objectp) { LLViewerObject *root_object = (objectp == NULL) ? NULL : objectp->getRootEdit(); - return objectp->permMove() && !objectp->isPermanentEnforced() && + return objectp && objectp->permMove() && !objectp->isPermanentEnforced() && ((root_object == NULL) || !root_object->isPermanentEnforced()) && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 6203af84f..d658775b9 100644 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -30,7 +30,10 @@ #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include "llsingleton.h" diff --git a/indra/newview/llmarketplacenotifications.cpp b/indra/newview/llmarketplacenotifications.cpp index 0886f9a99..8944d293f 100644 --- a/indra/newview/llmarketplacenotifications.cpp +++ b/indra/newview/llmarketplacenotifications.cpp @@ -33,10 +33,6 @@ #include "llerror.h" -#include -#include - - namespace LLMarketplaceInventoryNotifications { typedef boost::signals2::signal no_copy_payload_cb_signal_t; @@ -54,7 +50,7 @@ namespace LLMarketplaceInventoryNotifications llassert(!no_copy_payloads.empty()); llassert(no_copy_cb_action != NULL); - BOOST_FOREACH(const LLSD& payload, no_copy_payloads) + for (const LLSD& payload : no_copy_payloads) { (*no_copy_cb_action)(payload); } diff --git a/indra/newview/llmarketplacenotifications.h b/indra/newview/llmarketplacenotifications.h index 83a4e163c..d54761e46 100644 --- a/indra/newview/llmarketplacenotifications.h +++ b/indra/newview/llmarketplacenotifications.h @@ -30,7 +30,10 @@ #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif // diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index ef98d11dc..f4d4d877a 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -412,6 +412,23 @@ BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) return result; } +//////////////////////////////////////////////////////////////////////////////// +// +BOOL LLMediaCtrl::handleKeyUpHere(KEY key, MASK mask) +{ + BOOL result = FALSE; + + if (mMediaSource) + { + result = mMediaSource->handleKeyUpHere(key, mask); + } + + if (!result) + result = LLPanel::handleKeyUpHere(key, mask); + + return result; +} + //////////////////////////////////////////////////////////////////////////////// // void LLMediaCtrl::handleVisibilityChange ( BOOL new_visibility ) @@ -940,7 +957,7 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << self->getCursorName() << LL_ENDL; } break; - + case MEDIA_EVENT_NAVIGATE_BEGIN: { LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN, url is " << self->getNavigateURI() << LL_ENDL; @@ -995,21 +1012,23 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) std::string target = self->getClickTarget(); std::string uuid = self->getClickUUID(); - LLNotification::Params notify_params("PopupAttempt"); - notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID); - notify_params.functor(boost::bind(&LLMediaCtrl::onPopup, this, _1, _2)); + LLWeb::loadURL(url, target, std::string()); - if (mTrusted) - { - LLNotifications::instance().forceResponse(notify_params, 0); - } - else - { - LLNotifications::instance().add(notify_params); - } + //LLNotification::Params notify_params("PopupAttempt"); + //notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID); + //notify_params.functor(boost::bind(&LLMediaCtrl::onPopup, this, _1, _2)); + + //if (mTrusted) + //{ + // LLNotifications::instance().forceResponse(notify_params, 0); + //} + //else + //{ + // LLNotifications::instance().add(notify_params); + //} break; }; - + case MEDIA_EVENT_CLICK_LINK_NOFOLLOW: { LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is " << self->getClickURL() << LL_ENDL; @@ -1076,6 +1095,13 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) }; break; + case MEDIA_EVENT_FILE_DOWNLOAD: + { + //llinfos << "Media event - file download requested - filename is " << self->getFileDownloadFilename() << llendl; + //LLNotificationsUtil::add("MediaFileDownloadUnsupported"); + }; + break; + case MEDIA_EVENT_DEBUG_MESSAGE: { LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL; @@ -1142,6 +1168,16 @@ void LLMediaCtrl::setTrustedContent(bool trusted) } } +bool LLMediaCtrl::wantsKeyUpKeyDown() const +{ + return true; +} + +bool LLMediaCtrl::wantsReturnKey() const +{ + return true; +} + // virtual LLXMLNodePtr LLMediaCtrl::getXML(bool save_children) const { diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 306d68650..02f4558d0 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -160,6 +160,7 @@ public: // over-rides virtual BOOL handleKeyHere( KEY key, MASK mask); + virtual BOOL handleKeyUpHere(KEY key, MASK mask); virtual void handleVisibilityChange ( BOOL new_visibility ); virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE); @@ -178,6 +179,10 @@ public: LLUUID getTextureID() {return mMediaTextureID;} + // The Browser windows want keyup and keydown events. Overridden from LLFocusableElement to return true. + virtual bool wantsKeyUpKeyDown() const; + virtual bool wantsReturnKey() const; + protected: void convertInputCoords(S32& x, S32& y); diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index e7684b034..2524ebdd0 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -73,7 +73,6 @@ #include "llfloaterinspect.h" #include "llfloaterinventory.h" #include "llfloaterjoystick.h" -#include "llfloaterlagmeter.h" #include "llfloaterland.h" #include "llfloaterlandholdings.h" #include "llfloatermap.h" @@ -229,7 +228,6 @@ struct MenuFloaterDict : public LLSingleton registerFloater ("im"); registerFloater ("inspect"); registerFloater ("joystick"); - registerFloater ("lag meter"); registerFloater ("media filter"); registerFloater ("mini map"); registerFloater ("movement controls"); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 70bfef427..3b7dadf17 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2137,7 +2137,8 @@ void LLMeshHeaderResponder::completedRaw(LLChannelDescriptors const& channels, LLMeshRepository::LLMeshRepository() : mMeshMutex(NULL), mMeshThreadCount(0), - mThread(NULL) + mThread(NULL), + mDecompThread(nullptr) { } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 71442b009..c6ccd68cd 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -39,7 +39,10 @@ #include "lluploadfloaterobservers.h" #include "aistatemachinethread.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif class LLVOVolume; class LLMeshResponder; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index d9fe32e4e..88fe06ff9 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -351,9 +351,9 @@ void LLNetMap::draw() { const LLViewerRegion::tex_matrix_t& tiles(regionp->getWorldMapTiles()); - for (S32 i(0), scaled_width(real_width/region_width), square_width(scaled_width*scaled_width); i < square_width; ++i) + for (S32 i(0), scaled_width((S32)real_width/region_width), square_width(scaled_width*scaled_width); i < square_width; ++i) { - const F32 y(i/scaled_width); + const F32 y(i / (F32)scaled_width); const F32 x(i - y*scaled_width); const F32 local_left(left + x*mScale); const F32 local_right(local_left + mScale); diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 3e8d77d0e..44631adb9 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -65,7 +65,7 @@ #include "rlvhandler.h" // [/RLVa:KB] -#include +#include // // Globals @@ -244,7 +244,7 @@ void LLOverlayBar::layoutButtons() { U32 button_count = 0; const child_list_t& view_list = *(mStateManagementContainer->getChildList()); - BOOST_FOREACH(LLView* viewp, view_list) + for (LLView* viewp : view_list) { if(!viewp->getEnabled()) continue; @@ -264,7 +264,7 @@ void LLOverlayBar::layoutButtons() S32 left = 0; S32 bottom = 1; - BOOST_REVERSE_FOREACH(LLView* viewp, view_list) + for (LLView* viewp : boost::adaptors::reverse(view_list)) { if(!viewp->getEnabled()) continue; diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index af7855ca3..e9f394b31 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -100,7 +100,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) } LLUUID group_id; // used for SL-23488 - LLSelectMgr::getInstance()->selectGetGroup(group_id); // sets group_id as a side effect SL-23488 + (void)LLSelectMgr::getInstance()->selectGetGroup(group_id); // sets group_id as a side effect SL-23488 // BUG? Check for all objects being editable? bool editable = gAgent.isGodlike() diff --git a/indra/newview/llpaneldirfind.cpp b/indra/newview/llpaneldirfind.cpp index 1792d0c9d..7c7a7c21c 100644 --- a/indra/newview/llpaneldirfind.cpp +++ b/indra/newview/llpaneldirfind.cpp @@ -598,6 +598,7 @@ void LLPanelDirFind::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent even // LLPanelDirFindAllInterface //--------------------------------------------------------------------------- +static LLPanelDirFindAll* sFindAll = NULL; // static LLPanelDirFindAll* LLPanelDirFindAllInterface::create(LLFloaterDirectory* floater) { @@ -606,12 +607,29 @@ LLPanelDirFindAll* LLPanelDirFindAllInterface::create(LLFloaterDirectory* floate static LLPanelDirFindAllOld* sFindAllOld = NULL; // static -void LLPanelDirFindAllInterface::search(LLPanelDirFindAll* panel, - const std::string& search_text) +void LLPanelDirFindAllInterface::search(LLFloaterDirectory* inst, + const LLFloaterSearch::SearchQuery& search, bool show) { bool secondlife(gHippoGridManager->getConnectedGrid()->isSecondLife()); - if (secondlife || !getSearchUrl().empty()) panel->search(search_text); - if (!secondlife && sFindAllOld) sFindAllOld->search(search_text); + LLPanelDirFind* find_panel(secondlife ? inst->findChild("web_panel") : sFindAll); + LLPanel* panel(find_panel); + if (secondlife) + LLFloaterSearch::search(search, find_panel->mWebBrowser); + else + { + bool has_url(!getSearchUrl().empty()); + if (has_url) find_panel->search(search.query); + if (sFindAllOld) + { + sFindAllOld->search(search.query); + if (!has_url) panel = sFindAllOld; + } + } + if (show && panel) + { + inst->findChild("Directory Tabs")->selectTabPanel(panel); + panel->setFocus(true); + } } // static diff --git a/indra/newview/llpaneldirfind.h b/indra/newview/llpaneldirfind.h index 866c330a8..f5e4b690c 100644 --- a/indra/newview/llpaneldirfind.h +++ b/indra/newview/llpaneldirfind.h @@ -34,10 +34,8 @@ #define LL_LLPANELDIRFIND_H #include "llpaneldirbrowser.h" -#include "llmediactrl.h" +#include "llfloatersearch.h" -class LLUICtrl; -class LLLineEditor; class LLPanelDirFindAll; class LLFloaterDirectory; @@ -76,6 +74,7 @@ private: /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); protected: + friend class LLPanelDirFindAllInterface; LLMediaCtrl* mWebBrowser; std::string mBrowserName; }; @@ -84,7 +83,7 @@ class LLPanelDirFindAllInterface { public: static LLPanelDirFindAll* create(LLFloaterDirectory* floater); - static void search(LLPanelDirFindAll* panel, const std::string& search_text); + static void search(LLFloaterDirectory* inst, const LLFloaterSearch::SearchQuery& search, bool show = false); static void focus(LLPanelDirFindAll* panel); }; diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 8aaaa7816..497dc1e14 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -65,7 +65,10 @@ #include "llwearablelist.h" #include "llinventoryicon.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif // subparts of the UI for focus, camera position, etc. enum ESubpart @@ -735,7 +738,7 @@ BOOL LLPanelEditWearable::postBuild() { LL_WARNS() << "could not get wearable dictionary entry for wearable of type: " << mType << LL_ENDL; } - U8 num_subparts = wearable_entry->mSubparts.size(); + U8 num_subparts = (U8) wearable_entry->mSubparts.size(); for (U8 index = 0; index < num_subparts; ++index) { @@ -856,7 +859,7 @@ void LLPanelEditWearable::draw() const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mType); if (wearable_entry) { - U8 num_subparts = wearable_entry->mSubparts.size(); + U8 num_subparts = (U8) wearable_entry->mSubparts.size(); for (U8 index = 0; index < num_subparts; ++index) { diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f957414f1..4a5c25d79 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1866,6 +1866,8 @@ void LLPanelFace::onCancelNormalTexture(const LLSD& data) U8 bumpy = 0; bool identical_bumpy = false; LLSelectedTE::getBumpmap(bumpy, identical_bumpy); + LLUUID norm_map_id = mBumpyTextureCtrl->getImageAssetID(); + bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE; sendBump(bumpy); } diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp index 5915d355f..2080117c5 100644 --- a/indra/newview/llpanelgroupbulkban.cpp +++ b/indra/newview/llpanelgroupbulkban.cpp @@ -49,8 +49,6 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" -#include - LLPanelGroupBulkBan::LLPanelGroupBulkBan(const LLUUID& group_id) : LLPanelGroupBulk(group_id) { // Pass on construction of this panel to the control factory. @@ -163,7 +161,7 @@ void LLPanelGroupBulkBan::submit() } if (group_datap) { - BOOST_FOREACH(const LLGroupMgrGroupData::ban_list_t::value_type& group_ban_pair, group_datap->mBanList) + for (const LLGroupMgrGroupData::ban_list_t::value_type& group_ban_pair : group_datap->mBanList) { const LLUUID& group_ban_agent_id = group_ban_pair.first; std::vector::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), group_ban_agent_id); diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 70037243d..ed6c3225c 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -195,7 +195,7 @@ public: void requestGroupLandInfo(); - int getStoredContribution(); + S32 getStoredContribution(); void setYourContributionTextField(int contrib); void setYourMaxContributionTextBox(int max); @@ -341,14 +341,14 @@ bool LLPanelGroupLandMoney::impl::applyContribution() // Retrieves the land contribution for this agent that is currently // stored in the database, NOT what is currently entered in the text field -int LLPanelGroupLandMoney::impl::getStoredContribution() +S32 LLPanelGroupLandMoney::impl::getStoredContribution() { LLGroupData group_data; group_data.mContribution = 0; - gAgent.getGroupData(mPanel.mGroupID, group_data); + bool found_group = gAgent.getGroupData(mPanel.mGroupID, group_data); - return group_data.mContribution; + return found_group ? group_data.mContribution : 0; } // Fills in the text field with the contribution, contrib diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index b346aa922..e51341416 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -42,7 +42,6 @@ #include "llfontgl.h" #include "llmd5.h" #include "llsecondlifeurls.h" -#include "sgversion.h" #include "v4color.h" #include "llappviewer.h" @@ -62,6 +61,7 @@ #include "llui.h" #include "lluiconstants.h" #include "llurlhistory.h" // OGPX : regionuri text box has a history of region uris (if FN/LN are loaded at startup) +#include "llversioninfo.h" #include "llviewertexturelist.h" #include "llviewermenu.h" // for handle_preferences() #include "llviewernetwork.h" @@ -243,13 +243,12 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) getChild("grids_btn")->setCommitCallback(boost::bind(LLPanelLogin::onClickGrids)); - std::string channel = gVersionChannel; + std::string channel = LLVersionInfo::getChannel(); + + std::string version = llformat("%s (%d)", + LLVersionInfo::getShortVersion().c_str(), + LLVersionInfo::getBuild()); - std::string version = llformat("%d.%d.%d (%d)", - gVersionMajor, - gVersionMinor, - gVersionPatch, - gVersionBuild ); LLTextBox* channel_text = getChild("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); @@ -722,25 +721,27 @@ void LLPanelLogin::loadLoginPage() sInstance->setSiteIsAlive(false); return; } - + // Use the right delimeter depending on how LLURI parses the URL LLURI login_page = LLURI(login_page_str); LLSD params(login_page.queryMap()); LL_DEBUGS("AppInit") << "login_page: " << login_page << LL_ENDL; - // Language + // Language params["lang"] = LLUI::getLanguage(); - - // First Login? - if (gSavedSettings.getBOOL("FirstLoginThisInstall")) + + // First Login? + if (gSavedSettings.getBOOL("FirstLoginThisInstall")) { params["firstlogin"] = "TRUE"; // not bool: server expects string TRUE - } - - params["version"]= llformat("%d.%d.%d (%d)", - gVersionMajor, gVersionMinor, gVersionPatch, gVersionBuild); - params["channel"] = gVersionChannel; + } + + // Channel and Version + params["version"] = llformat("%s (%d)", + LLVersionInfo::getShortVersion().c_str(), + LLVersionInfo::getBuild()); + params["channel"] = LLVersionInfo::getChannel(); // Grid diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 02f3eedf0..7439d80ae 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -95,7 +95,12 @@ LLInventoryView::LLInventoryView(const std::string& name, LLFloater(name, rect, std::string("Inventory"), RESIZE_YES, INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP, MINIMIZE_NO, CLOSE_YES), - mActivePanel(NULL) + mFilterEditor(nullptr), + mFilterTabs(nullptr), + mActivePanel(nullptr), + mResortActivePanel(true), + mSavedFolderState(nullptr), + mFilterText("") //LLHandle mFinderHandle takes care of its own initialization { init(inventory); @@ -107,7 +112,12 @@ LLInventoryView::LLInventoryView(const std::string& name, LLFloater(name, rect, std::string("Inventory"), RESIZE_YES, INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP, MINIMIZE_NO, CLOSE_YES), - mActivePanel(NULL) + mFilterEditor(nullptr), + mFilterTabs(nullptr), + mActivePanel(nullptr), + mResortActivePanel(true), + mSavedFolderState(nullptr), + mFilterText("") //LLHandle mFinderHandle takes care of its own initialization { init(inventory); diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp index f8ede13ba..7372064c4 100644 --- a/indra/newview/llpanelmediasettingsgeneral.cpp +++ b/indra/newview/llpanelmediasettingsgeneral.cpp @@ -467,7 +467,7 @@ bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace(bool only_if_current_ bool all_face_media_navigated = false; LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection(); - selected_objects->getSelectedTEValue( &functor_navigate_media, all_face_media_navigated ); + (void)selected_objects->getSelectedTEValue( &functor_navigate_media, all_face_media_navigated ); // Note: we don't update the 'current URL' field until the media data itself changes diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index c578c9a8d..55d07a021 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -76,13 +76,23 @@ static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5 LLPanelNearByMedia::LLPanelNearByMedia(bool standalone_panel) -: mMediaList(NULL), - mEnableAllCtrl(NULL), - mAllMediaDisabled(false), - mDebugInfoVisible(false), - mParcelMediaItem(NULL), - mParcelAudioItem(NULL), - mStandalonePanel(standalone_panel) + : mNearbyMediaPanel(nullptr) + , mMediaList(nullptr) + , mEnableAllCtrl(nullptr) + , mDisableAllCtrl(nullptr) + , mShowCtrl(nullptr) + , mStopCtrl(nullptr) + , mPlayCtrl(nullptr) + , mPauseCtrl(nullptr) + , mMuteCtrl(nullptr) + , mVolumeSliderCtrl(nullptr) + , mZoomCtrl(nullptr) + , mUnzoomCtrl(nullptr) + , mVolumeSlider(nullptr) + , mMuteBtn(nullptr) + , mDebugInfoVisible(false) + , mParcelMediaItem(nullptr) + , mParcelAudioItem(nullptr) { mHoverTimer.stop(); diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h index 410dfb48c..8b5bbdc35 100644 --- a/indra/newview/llpanelnearbymedia.h +++ b/indra/newview/llpanelnearbymedia.h @@ -165,7 +165,6 @@ private: LLSlider* mVolumeSlider; LLButton* mMuteBtn; - bool mAllMediaDisabled; bool mDebugInfoVisible; bool mParcelAudioAutoStart; std::string mEmptyNameString; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 48c6e7a3e..e7fef5ebf 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -407,7 +407,7 @@ const LLUUID& LLPanelObject::findItemID(const LLUUID& asset_id) if (items.size()) { // search for copyable version first - for (S32 i = 0; i < items.size(); i++) + for (U32 i = 0; i < items.size(); i++) { LLInventoryItem* itemp = items[i]; LLPermissions item_permissions = itemp->getPermissions(); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 0b01837b5..7e0f9c198 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1882,7 +1882,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li } // now, for each category, do the second pass - for(S32 i = 0; i < child_categories.size(); i++) + for(U32 i = 0; i < child_categories.size(); i++) { createViewsForCategory(inventory, child_categories[i]->first, child_categories[i]->second ); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index a2ce5bb74..d881f1b16 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -92,7 +92,7 @@ bool is_asset_exportable(const LLUUID& asset_id) LLAssetIDMatches asset_id_matches(asset_id); gInventory.collectDescendentsIf(LLUUID::null, cats, items, true, asset_id_matches, false); - for (int i = 0; i < items.size(); ++i) + for (U32 i = 0; i < items.size(); ++i) { if (perms_allow_export(items[i]->getPermissions())) return true; } diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 577e1cd64..60f6c55f5 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -318,10 +318,11 @@ void LLPanelPrimMediaControls::updateShape() { bool mini_controls = false; LLMediaEntry *media_data = objectp->getTE(mTargetObjectFace)->getMediaData(); - if (media_data && NULL != dynamic_cast(objectp)) + LLVOVolume *vol = dynamic_cast(objectp); + if (media_data && vol) { // Don't show the media controls if we do not have permissions - enabled = dynamic_cast(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL); + enabled = vol->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL); mini_controls = (LLMediaEntry::MINI == media_data->getControls()); } const bool is_hud = objectp->isHUDAttachment(); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 910e43e9e..d35d481ab 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -97,13 +97,7 @@ public: } std::string verb = params[1].asString(); -#if LL_WINDOWS // C++11 - while (!verb.empty() && std::ispunct(verb.back())) - verb.pop_back(); -#else - for (size_t i = verb.size()-1; i >= 0 && std::ispunct(verb[i]); --i) - verb.erase(i); -#endif + for (; !verb.empty() && std::ispunct(verb.back()); verb.pop_back()); if (verb == "about") { LLAvatarActions::showProfile(avatar_id); diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 8f9f4ede2..8c8096991 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -34,7 +34,10 @@ #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index c61ff244f..3a2d2d0dc 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -30,7 +30,10 @@ #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include "llpathfindinglinkset.h" diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 87f32b8d5..7692a7bf4 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -30,7 +30,10 @@ #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include "llpathfindingnavmeshstatus.h" diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index b8d3ca236..1c7df6db4 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -30,7 +30,10 @@ #include #include +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include #include "llavatarname.h" diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 1039544c2..75ead67ca 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1,11 +1,11 @@ -/** +/** * @file llpreviewscript.cpp * @brief LLPreviewScript class implementation * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * * Copyright (c) 2002-2009, Linden Research, Inc. - * + * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 @@ -13,17 +13,17 @@ * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * + * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or * online at * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * + * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, * and agree to abide by those obligations. - * + * * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * COMPLETENESS OR PERFORMANCE. @@ -116,13 +116,13 @@ const S32 LINE_COLUMN_HEIGHT = 14; const S32 SCRIPT_EDITOR_MIN_HEIGHT = 2 * SCROLLBAR_SIZE + 2 * LLPANEL_BORDER_WIDTH + 128; -const S32 SCRIPT_MIN_WIDTH = - 2 * SCRIPT_BORDER + - 2 * SCRIPT_BUTTON_WIDTH + +const S32 SCRIPT_MIN_WIDTH = + 2 * SCRIPT_BORDER + + 2 * SCRIPT_BUTTON_WIDTH + SCRIPT_PAD + RESIZE_HANDLE_WIDTH + SCRIPT_PAD; -const S32 SCRIPT_MIN_HEIGHT = +const S32 SCRIPT_MIN_HEIGHT = 2 * SCRIPT_BORDER + 3*(SCRIPT_BUTTON_HEIGHT + SCRIPT_PAD) + LINE_COLUMN_HEIGHT + @@ -209,7 +209,7 @@ void LLScriptEdCore::parseFunctions(const std::string& filename) { LLSDSerialize::fromXMLDocument(function_list, importer); importer.close(); - + for (LLSD::map_const_iterator it = function_list.beginMap(); it != function_list.endMap(); ++it) { LSLFunctionProps fn; @@ -267,7 +267,7 @@ BOOL LLScriptEdCore::postBuild() mErrorList = getChild("lsl errors"); mFunctions = getChild( "Insert..."); - + childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); mEditor = getChild("Script Editor"); @@ -290,25 +290,25 @@ BOOL LLScriptEdCore::postBuild() { std::string name = i->mName; funcs.push_back(name); - + std::string desc_name = "LSLTipText_"; desc_name += name; std::string desc = LLTrans::getString(desc_name); - + F32 sleep_time = i->mSleepTime; if( sleep_time ) { desc += "\n"; - + LLStringUtil::format_map_t args; args["[SLEEP_TIME]"] = llformat("%.1f", sleep_time ); desc += LLTrans::getString("LSLTipSleepTime", args); } - + // A \n linefeed is not part of xml. Let's add one to keep all // the tips one-per-line in strings.xml LLStringUtil::replaceString( desc, "\\n", "\n" ); - + tooltips.push_back(desc); } } @@ -366,7 +366,7 @@ void LLScriptEdCore::initMenu() menuItem = getChild("Save"); menuItem->setMenuCallback(onBtnSave, this); menuItem->setEnabledCallback(hasChanged); - + menuItem = getChild("Revert All Changes"); menuItem->setMenuCallback(onBtnUndoChanges, this); menuItem->setEnabledCallback(hasChanged); @@ -438,19 +438,27 @@ bool LLScriptEdCore::loadScriptText(const std::string& filename) // read in the whole file fseek(file, 0L, SEEK_END); - size_t file_length = (size_t) ftell(file); + long file_length = ftell(file); fseek(file, 0L, SEEK_SET); - char* buffer = new char[file_length+1]; - size_t nread = fread(buffer, 1, file_length, file); - if (nread < file_length) + if (file_length > 0) { - LL_WARNS() << "Short read" << LL_ENDL; - } - buffer[nread] = '\0'; - fclose(file); + char* buffer = new char[file_length+1]; + size_t nread = fread(buffer, 1, file_length, file); + if (nread < file_length) + { + LL_WARNS() << "Short read" << LL_ENDL; + } + buffer[nread] = '\0'; + fclose(file); - mEditor->setText(LLStringExplicit(buffer)); - delete[] buffer; + mEditor->setText(LLStringExplicit(buffer)); + delete[] buffer; + } + else + { + LL_WARNS() << "Error opening " << filename << LL_ENDL; + return false; + } return true; } @@ -594,7 +602,7 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string) { LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; - + LLMediaCtrl* web_browser = help_floater->getChild("lsl_guide_html"); if (!web_browser) return; @@ -699,7 +707,7 @@ bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLS return false; } -// static +// static bool LLScriptEdCore::onHelpWebDialog(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -715,7 +723,7 @@ bool LLScriptEdCore::onHelpWebDialog(const LLSD& notification, const LLSD& respo return false; } -// static +// static void LLScriptEdCore::onBtnHelp(void* userdata) { LLSD payload; @@ -723,7 +731,7 @@ void LLScriptEdCore::onBtnHelp(void* userdata) LLNotificationsUtil::add("WebLaunchLSLGuide", LLSD(), payload, onHelpWebDialog); } -// static +// static void LLScriptEdCore::onBtnDynamicHelp(void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; @@ -752,8 +760,8 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) LLComboBox* help_combo = live_help_floater->getChild("history_combo"); LLKeywordToken *token; LLKeywords::keyword_iterator_t token_it; - for (token_it = corep->mEditor->keywordsBegin(); - token_it != corep->mEditor->keywordsEnd(); + for (token_it = corep->mEditor->keywordsBegin(); + token_it != corep->mEditor->keywordsEnd(); ++token_it) { token = token_it->second; @@ -768,7 +776,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) corep->updateDynamicHelp(TRUE); } -//static +//static void LLScriptEdCore::onClickBack(void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; @@ -783,7 +791,7 @@ void LLScriptEdCore::onClickBack(void* userdata) } } -//static +//static void LLScriptEdCore::onClickForward(void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; @@ -809,7 +817,7 @@ void LLScriptEdCore::onCheckLock(LLUICtrl* ctrl, void* userdata) corep->mLastHelpToken = NULL; } -// static +// static void LLScriptEdCore::onBtnInsertSample(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*) userdata; @@ -820,7 +828,7 @@ void LLScriptEdCore::onBtnInsertSample(void* userdata) self->mEditor->insertText(self->mSampleText); } -// static +// static void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata) { LLScriptEdCore* corep = (LLScriptEdCore*)userdata; @@ -839,7 +847,7 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata) } } -// static +// static void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*) userdata; @@ -943,7 +951,7 @@ void LLScriptEdCore::onSearchMenu(void* userdata) } } -// static +// static void LLScriptEdCore::onUndoMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -951,7 +959,7 @@ void LLScriptEdCore::onUndoMenu(void* userdata) self->mEditor->undo(); } -// static +// static void LLScriptEdCore::onRedoMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -959,7 +967,7 @@ void LLScriptEdCore::onRedoMenu(void* userdata) self->mEditor->redo(); } -// static +// static void LLScriptEdCore::onCutMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -967,7 +975,7 @@ void LLScriptEdCore::onCutMenu(void* userdata) self->mEditor->cut(); } -// static +// static void LLScriptEdCore::onCopyMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -975,7 +983,7 @@ void LLScriptEdCore::onCopyMenu(void* userdata) self->mEditor->copy(); } -// static +// static void LLScriptEdCore::onPasteMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -983,7 +991,7 @@ void LLScriptEdCore::onPasteMenu(void* userdata) self->mEditor->paste(); } -// static +// static void LLScriptEdCore::onSelectAllMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -991,7 +999,7 @@ void LLScriptEdCore::onSelectAllMenu(void* userdata) self->mEditor->selectAll(); } -// static +// static void LLScriptEdCore::onDeselectMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -999,7 +1007,7 @@ void LLScriptEdCore::onDeselectMenu(void* userdata) self->mEditor->deselect(); } -// static +// static BOOL LLScriptEdCore::enableUndoMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -1007,7 +1015,7 @@ BOOL LLScriptEdCore::enableUndoMenu(void* userdata) return self->mEditor->canUndo(); } -// static +// static BOOL LLScriptEdCore::enableRedoMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -1015,7 +1023,7 @@ BOOL LLScriptEdCore::enableRedoMenu(void* userdata) return self->mEditor->canRedo(); } -// static +// static BOOL LLScriptEdCore::enableCutMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -1023,7 +1031,7 @@ BOOL LLScriptEdCore::enableCutMenu(void* userdata) return self->mEditor->canCut(); } -// static +// static BOOL LLScriptEdCore::enableCopyMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -1031,7 +1039,7 @@ BOOL LLScriptEdCore::enableCopyMenu(void* userdata) return self->mEditor->canCopy(); } -// static +// static BOOL LLScriptEdCore::enablePasteMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -1039,7 +1047,7 @@ BOOL LLScriptEdCore::enablePasteMenu(void* userdata) return self->mEditor->canPaste(); } -// static +// static BOOL LLScriptEdCore::enableSelectAllMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -1047,7 +1055,7 @@ BOOL LLScriptEdCore::enableSelectAllMenu(void* userdata) return self->mEditor->canSelectAll(); } -// static +// static BOOL LLScriptEdCore::enableDeselectMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; @@ -1074,7 +1082,6 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data) //LL_INFOS() << "LLScriptEdCore::onErrorList() - " << row << ", " //<< column << LL_ENDL; self->mEditor->setCursor(row, column); - self->mEditor->setFocus(TRUE); } } @@ -1246,7 +1253,7 @@ struct LLScriptSaveInfo //static void* LLPreviewLSL::createScriptEdPanel(void* userdata) { - + LLPreviewLSL *self = (LLPreviewLSL*)userdata; self->mScriptEd = new LLScriptEdCore( @@ -1274,7 +1281,7 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, const st // virtual BOOL LLPreviewLSL::postBuild() { - const LLInventoryItem* item = getItem(); + const LLInventoryItem* item = getItem(); llassert(item); if (item) @@ -1332,7 +1339,7 @@ void LLPreviewLSL::loadAsset() } if(item) { - BOOL is_copyable = gAgent.allowOperation(PERM_COPY, + BOOL is_copyable = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); @@ -1390,7 +1397,7 @@ void LLPreviewLSL::closeIfNeeded() void LLPreviewLSL::onSearchReplace(void* userdata) { LLPreviewLSL* self = (LLPreviewLSL*)userdata; - LLScriptEdCore* sec = self->mScriptEd; + LLScriptEdCore* sec = self->mScriptEd; if (sec && sec->mEditor) { LLFloaterSearchReplace::show(sec->mEditor); @@ -1524,7 +1531,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ std::string line; - while(!feof(fp)) + while(!feof(fp)) { if (fgets(buffer, MAX_STRING, fp) == NULL) { @@ -1689,7 +1696,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) { - is_modifiable = TRUE; + is_modifiable = TRUE; } preview->mScriptEd->setEnableEditing(is_modifiable); preview->mAssetStatus = PREVIEW_ASSET_LOADED; @@ -1725,10 +1732,10 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset /// --------------------------------------------------------------------------- -//static +//static void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) { - + LLLiveLSLEditor *self = (LLLiveLSLEditor*)userdata; self->mScriptEd = new LLScriptEdCore( @@ -1816,7 +1823,7 @@ void LLLiveLSLEditor::loadAsset() if(object) { LLViewerInventoryItem* item = dynamic_cast(object->getInventoryObject(mItemUUID)); - if(item + if(item && (gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE) || gAgent.isGodlike())) { @@ -1866,7 +1873,7 @@ void LLLiveLSLEditor::loadAsset() mAssetStatus = PREVIEW_ASSET_LOADED; } - mIsModifiable = item && gAgent.allowOperation(PERM_MODIFY, + mIsModifiable = item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); refreshFromItem(item); @@ -2032,7 +2039,7 @@ void LLLiveLSLEditor::onReset(void *userdata) } else { - LLNotificationsUtil::add("CouldNotStartStopScript"); + LLNotificationsUtil::add("CouldNotStartStopScript"); } } @@ -2097,7 +2104,7 @@ void LLLiveLSLEditor::onSearchReplace(void* userdata) { LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; - LLScriptEdCore* sec = self->mScriptEd; + LLScriptEdCore* sec = self->mScriptEd; if (sec && sec->mEditor) { LLFloaterSearchReplace::show(sec->mEditor); @@ -2188,7 +2195,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) { mScriptEd->sync(); } - + // save it out to asset server std::string url = object->getRegion()->getCapability("UpdateScriptTask"); getWindow()->incBusyCount(); @@ -2262,9 +2269,9 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ std::string line; - while(!feof(fp)) + while(!feof(fp)) { - + if (fgets(buffer, MAX_STRING, fp) == NULL) { buffer[0] = '\0'; @@ -2277,7 +2284,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, { line.assign(buffer); LLStringUtil::stripNonprintable(line); - + LLSD row; row["columns"][0]["value"] = line; row["columns"][0]["font"] = "OCRA"; @@ -2475,4 +2482,4 @@ BOOL LLLiveLSLEditor::monoChecked() const return mMonoCheckbox->getValue()? TRUE : FALSE; } return FALSE; -} \ No newline at end of file +} diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 1427f0d13..c5e6a987c 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -73,8 +73,8 @@ LLPreviewTexture::LLPreviewTexture(const std::string& name, mLoadingFullImage( FALSE ), mShowKeepDiscard(show_keep_discard), mCopyToInv(FALSE), - mIsCopyable(FALSE), - mUpdateDimensions(TRUE), + mIsCopyable(FALSE), + mUpdateDimensions(TRUE), mLastHeight(0), mLastWidth(0), mAspectRatio(0.f), diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 267b95dcb..674418489 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -4370,7 +4370,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point, bool replace) if (0 == attachment_point || get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL)) { - if ((!replace || attachment_point != 0) && gHippoGridManager->getConnectedGrid()->supportsInvLinks()) + if (!replace || attachment_point != 0) { // If we know the attachment point then we got here by clicking an // "Attach to..." context menu item, so we should add, not replace. diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index a1922c942..599b70e7f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3577,6 +3577,7 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, mOffset(offset), mFullbright(fullbright), mBump(bump), + mShiny(0), mParticle(particle), mPartSize(part_size), mVSize(0.f), diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 58ba9d0e9..8ca0b78b3 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -127,9 +127,7 @@ public: U32 mBlendFuncDst; BOOL mHasGlow; LLPointer mSpecularMap; - const LLMatrix4* mSpecularMapMatrix; LLPointer mNormalMap; - const LLMatrix4* mNormalMapMatrix; LLVector4 mSpecColor; // XYZ = Specular RGB, W = Specular Exponent F32 mEnvIntensity; F32 mAlphaMaskCutoff; diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 254aa72d8..8f989454c 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -42,10 +42,6 @@ #include "rlvhandler.h" -#include - -extern AIHTTPTimeoutPolicy moderationResponder_timeout; - const LLColor4 INACTIVE_COLOR(0.3f, 0.3f, 0.3f, 0.5f); const LLColor4 ACTIVE_COLOR(0.5f, 0.5f, 0.5f, 1.f); @@ -204,7 +200,7 @@ BOOL LLSpeakerActionTimer::tick() void LLSpeakerActionTimer::unset() { - mActionCallback = 0; + mActionCallback = NULL; } LLSpeakersDelayActionsStorage::LLSpeakersDelayActionsStorage(LLSpeakerActionTimer::action_callback_t action_cb, F32 action_delay) @@ -289,9 +285,10 @@ public: mSessionID = session_id; } - virtual void httpFailure(void) +protected: + virtual void httpFailure() { - LL_WARNS() << mStatus << ": " << mReason << LL_ENDL; + LL_WARNS() << dumpResponse() << LL_ENDL; if ( gIMMgr ) { @@ -314,7 +311,6 @@ public: } } } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return moderationResponder_timeout; } /*virtual*/ char const* getName(void) const { return "ModerationResponder"; } private: @@ -819,7 +815,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) } else { - LL_WARNS() << "bad membership list update " << ll_print_sd(agent_data["transition"]) << LL_ENDL; + LL_WARNS() << "bad membership list update from 'agent_updates' for agent " << agent_id << ", transition " << ll_print_sd(agent_data["transition"]) << LL_ENDL; } } @@ -872,8 +868,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) } else { - LL_WARNS() << "bad membership list update " - << agent_transition << LL_ENDL; + LL_WARNS() << "bad membership list update from 'updates' for agent " << agent_id << ", transition " << agent_transition << LL_ENDL; } } } @@ -1043,8 +1038,8 @@ void LLLocalSpeakerMgr::updateSpeakerList() // pick up non-voice speakers in chat range uuid_vec_t avatar_ids; - LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS); - BOOST_FOREACH(const LLUUID& id, avatar_ids) + LLWorld::getInstance()->getAvatars(&avatar_ids, nullptr, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS); + for (const auto& id : avatar_ids) { setSpeaker(id); } @@ -1054,7 +1049,7 @@ void LLLocalSpeakerMgr::updateSpeakerList() { LLUUID speaker_id = speaker_it->first; LLSpeaker* speakerp = speaker_it->second; - if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) + if (speakerp && speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) { LLVOAvatar* avatarp = gObjectList.findAvatar(speaker_id); if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 7be6ffd4f..4198a5247 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -49,10 +49,6 @@ # include "llaudioengine_fmodstudio.h" #endif -#if LL_FMODEX -# include "llaudioengine_fmodex.h" -#endif - #ifdef LL_OPENAL #include "llaudioengine_openal.h" #endif @@ -90,7 +86,7 @@ #include "lltexteditor.h" #include "llurlentry.h" #include "lluserrelations.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "llviewercontrol.h" #include "llvfs.h" #include "llxorcipher.h" // saved password, MAC address @@ -434,17 +430,6 @@ void init_audio() } #endif -#ifdef LL_FMODEX - if (!gAudiop -#if !LL_WINDOWS - && NULL == getenv("LL_BAD_FMODEX_DRIVER") -#endif // !LL_WINDOWS - ) - { - gAudiop = (LLAudioEngine *) new LLAudioEngine_FMODEX(gSavedSettings.getBOOL("SHEnableFMODExProfiler"),gSavedSettings.getBOOL("SHEnableFMODEXVerboseDebugging")); - } -#endif - #ifdef LL_OPENAL if (!gAudiop #if !LL_WINDOWS @@ -693,9 +678,9 @@ bool idle_startup() if(!start_messaging_system( message_template_path, port, - gVersionMajor, - gVersionMinor, - gVersionPatch, + LLVersionInfo::getMajor(), + LLVersionInfo::getMinor(), + LLVersionInfo::getPatch(), FALSE, std::string(), responder, diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index ba9744497..1e17dd14a 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -41,7 +41,6 @@ #include "llfloaterbuycurrency.h" #include "llfloaterchat.h" #include "llfloaterinventory.h" -#include "llfloaterlagmeter.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" #include "llfloaterscriptdebug.h" @@ -276,7 +275,6 @@ mIsNavMeshDirty(false) addChild(mSGPacketLoss); mStatBtn = getChild("stat_btn"); - mStatBtn->setClickedCallback(boost::bind(LLFloaterLagMeter::showInstance, LLSD())); } LLStatusBar::~LLStatusBar() diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 0817aa9fd..7e4ed1ad3 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -931,17 +931,17 @@ void LLTextureCache::setReadOnly(BOOL read_only) } //called in the main thread. -S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache_mismatch) +U64 LLTextureCache::initCache(ELLPath location, U64 max_size, BOOL texture_cache_mismatch) { llassert_always(getPending() == 0); //should not start accessing the texture cache before initialized. - S64 header_size = (max_size * 2) / 10; - S64 max_entries = header_size / TEXTURE_CACHE_ENTRY_SIZE; - sCacheMaxEntries = (S32)(llmin((S64)sCacheMaxEntries, max_entries)); + U64 header_size = (max_size * 2) / 10; + U32 max_entries = header_size / TEXTURE_CACHE_ENTRY_SIZE; + sCacheMaxEntries = (llmin(sCacheMaxEntries, max_entries)); header_size = sCacheMaxEntries * TEXTURE_CACHE_ENTRY_SIZE; max_size -= header_size; if (sCacheMaxTexturesSize > 0) - sCacheMaxTexturesSize = llmin(sCacheMaxTexturesSize, max_size); + sCacheMaxTexturesSize = (U32)llmin((U64)sCacheMaxTexturesSize, max_size); else sCacheMaxTexturesSize = max_size; max_size -= sCacheMaxTexturesSize; diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 2715ef2c4..0a35767ec 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -105,7 +105,7 @@ public: void purgeCache(ELLPath location); void setReadOnly(BOOL read_only) ; - S64 initCache(ELLPath location, S64 maxsize, BOOL texture_cache_mismatch); + U64 initCache(ELLPath location, U64 maxsize, BOOL texture_cache_mismatch); handle_t readFromCache(const std::string& local_filename, const LLUUID& id, U32 priority, S32 offset, S32 size, ReadResponder* responder); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index ca3c3b498..7dfc7f68d 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -754,7 +754,7 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co if (items.size()) { // search for copyable version first - for (S32 i = 0; i < items.size(); i++) + for (U32 i = 0; i < items.size(); i++) { LLInventoryItem* itemp = items[i]; LLPermissions item_permissions = itemp->getPermissions(); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 5a0711b91..4f5bb691e 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1199,7 +1199,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj, break; } } - else + else if (hit_obj) { //hit_obj->setTEImage(hit_face, image); hit_obj->setTETexture(hit_face, asset_id); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture, diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index c854760bf..16b32d2e4 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -108,7 +108,7 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) mMouseDownX = x; mMouseDownY = y; - //left mouse down always picks transparent + //left mouse down always picks transparent (but see handleMouseUp) mPick = gViewerWindow->pickImmediate(x, y, TRUE); mPick.mKeyMask = mask; @@ -583,7 +583,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE); LLViewerObject *parent = NULL; LLViewerObject *object = mHoverPick.getObject(); - LLSelectMgr::getInstance()->setHoverObject(object, mHoverPick.mObjectFace); + //LLSelectMgr::getInstance()->setHoverObject(object, mHoverPick.mObjectFace); // Singu TODO: remove llhoverview.cpp // [RLVa:KB] - Checked: 2010-03-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l // Block all special click action cursors when: // - @fartouch=n restricted and the object is out of range @@ -605,6 +605,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) if (handleMediaHover(mHoverPick)) { // cursor set by media object + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } else if (!mMouseOutsideSlop && mMouseButtonDown @@ -640,6 +641,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) { ECursorType cursor = cursorFromObject(click_action_object); gViewerWindow->setCursor(cursor); + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } // [RLVa:KB] - Checked: 2010-03-11 (RLVa-1.2.0e) | Added: RLVa-1.1.0l else if ( (object) && (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object)) ) @@ -652,22 +654,23 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) || (parent && !parent->isAvatar() && parent->flagUsePhysics())) { gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } else if ( (object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch())) { gViewerWindow->setCursor(UI_CURSOR_HAND); + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } else { gViewerWindow->setCursor(UI_CURSOR_ARROW); + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } } if(!object) { - //gViewerWindow->setCursor(UI_CURSOR_ARROW); - // We need to clear media hover flag LLViewerMediaFocus::getInstance()->clearHover(); } @@ -693,50 +696,53 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) && gAgentAvatarp && !gAgentAvatarp->isSitting() && !mBlockClickToWalk // another behavior hasn't cancelled click to walk - && !mPick.mPosGlobal.isExactlyZero() // valid coordinates for pick - && (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land - || mPick.mObjectID.notNull())) // or on an object + ) { - // handle special cases of steering picks - LLViewerObject* avatar_object = mPick.getObject(); + // We may be doing click to walk, but we don't want to use a target on + // a transparent object because the user thought they were clicking on + // whatever they were seeing through it, so recompute what was clicked on + // ignoring transparent objects + LLPickInfo savedPick = mPick; + mPick = gViewerWindow->pickImmediate(savedPick.mMousePt.mX, savedPick.mMousePt.mY, + FALSE /* ignore transparent *//*, + FALSE*/ /* ignore particles */); // Singu TODO: Particle picking - // get pointer to avatar - while (avatar_object && !avatar_object->isAvatar()) - { - avatar_object = (LLViewerObject*)avatar_object->getParent(); - } - - if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf()) - { - const F64 SELF_CLICK_WALK_DISTANCE = 3.0; - // pretend we picked some point a bit in front of avatar - mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE; - } - gAgentCamera.setFocusOnAvatar(TRUE, TRUE); - walkToClickedLocation(); - - return TRUE; - } - else - { - switch(click_action) - { - case CLICK_ACTION_BUY: - case CLICK_ACTION_PAY: - case CLICK_ACTION_OPEN: - // Because these actions open UI dialogs, we won't change - // the cursor again until the next hover and GL pick over - // the world. Keep the cursor an arrow, assuming that - // after the user moves off the UI, they won't be on the - // same object anymore. - gViewerWindow->setCursor(UI_CURSOR_ARROW); - // Make sure the hover-picked object is ignored. - gHoverView->resetLastHoverObject(); - break; - default: - break; + LLViewerObject* objp = mPick.getObject(); + bool is_in_world = mPick.mObjectID.notNull() && objp && !objp->isHUDAttachment(); // We clicked on a non-hud object + bool is_land = mPick.mPickType == LLPickInfo::PICK_LAND; // or on land + bool pos_non_zero = !mPick.mPosGlobal.isExactlyZero(); // valid coordinates for pick + if (pos_non_zero && (is_land || is_in_world)) + { + // get pointer to avatar + while (objp && !objp->isAvatar()) + { + objp = (LLViewerObject*) objp->getParent(); + } + + if (objp && ((LLVOAvatar*) objp)->isSelf()) + { + const F64 SELF_CLICK_WALK_DISTANCE = 3.0; + // pretend we picked some point a bit in front of avatar + mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE; + } + gAgentCamera.setFocusOnAvatar(TRUE, TRUE); + walkToClickedLocation(); + //LLFirstUse::notMoving(false); + + return TRUE; } + else + { + LL_DEBUGS("maint5901") << "walk target was " + << (mPick.mPosGlobal.isExactlyZero() ? "zero" : "not zero") + << ", pick type was " << (mPick.mPickType == LLPickInfo::PICK_LAND ? "land" : "not land") + << ", pick object was " << mPick.mObjectID + << LL_ENDL; + // we didn't click to walk, so restore the original target + mPick = savedPick; + } } + gViewerWindow->setCursor(UI_CURSOR_ARROW); if (hasMouseCapture()) { setMouseCapture(FALSE); @@ -768,17 +774,27 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) LL_INFOS() << "LLToolPie handleDoubleClick (becoming mouseDown)" << LL_ENDL; } - if (gSavedSettings.getBOOL("DoubleClickAutoPilot")) - { - if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || - (mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero())) - { - walkToClickedLocation(); - return TRUE; - } - } - else if (gSavedSettings.getBOOL("DoubleClickTeleport")) + if (handleMediaDblClick(mPick)) + { + return TRUE; + } + + bool dbl_click_autoplt = gSavedSettings.getBOOL("DoubleClickAutoPilot"); + bool dbl_click_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); + + if (dbl_click_autoplt || dbl_click_teleport) { + // Save the original pick + LLPickInfo savedPick = mPick; + + // We may be doing double click to walk or a double click teleport, but + // we don't want to use a target on a transparent object because the user + // thought they were clicking on whatever they were seeing through it, so + // recompute what was clicked on ignoring transparent objects + mPick = gViewerWindow->pickImmediate(savedPick.mMousePt.mX, savedPick.mMousePt.mY, + FALSE /* ignore transparent *//*, + FALSE*/ /* ignore particles */); // Singu TODO: Particle picking + LLViewerObject* objp = mPick.getObject(); LLViewerObject* parentp = objp ? objp->getRootEdit() : NULL; @@ -786,15 +802,43 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) bool is_land = mPick.mPickType == LLPickInfo::PICK_LAND; bool pos_non_zero = !mPick.mPosGlobal.isExactlyZero(); bool has_touch_handler = (objp && objp->flagHandleTouch()) || (parentp && parentp->flagHandleTouch()); - bool has_click_action = final_click_action(objp); - - if (pos_non_zero && (is_land || (is_in_world && !has_touch_handler && !has_click_action))) + bool no_click_action = final_click_action(objp) == CLICK_ACTION_NONE; + if (pos_non_zero && (is_land || (is_in_world && !has_touch_handler && no_click_action))) { - LLVector3d pos = mPick.mPosGlobal; - pos.mdV[VZ] += gAgentAvatarp->getPelvisToFoot(); - gAgent.teleportViaLocationLookAt(pos); - return TRUE; + if (dbl_click_autoplt + && !gAgent.getFlying() // don't auto-navigate while flying until that works + && isAgentAvatarValid() + && !gAgentAvatarp->isSitting() + ) + { + // get pointer to avatar + while (objp && !objp->isAvatar()) + { + objp = (LLViewerObject*) objp->getParent(); + } + + if (objp && ((LLVOAvatar*) objp)->isSelf()) + { + const F64 SELF_CLICK_WALK_DISTANCE = 3.0; + // pretend we picked some point a bit in front of avatar + mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE; + } + gAgentCamera.setFocusOnAvatar(TRUE, TRUE); + walkToClickedLocation(); + //LLFirstUse::notMoving(false); + return TRUE; + } + else if (dbl_click_teleport) + { + LLVector3d pos = mPick.mPosGlobal; + pos.mdV[VZ] += gAgentAvatarp->getPelvisToFoot(); + gAgent.teleportViaLocationLookAt(pos); + return TRUE; + } } + + // restore the original pick for any other purpose + mPick = savedPick; } return FALSE; @@ -898,56 +942,110 @@ static void handle_click_action_play() bool LLToolPie::handleMediaClick(const LLPickInfo& pick) { - //FIXME: how do we handle object in different parcel than us? - LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - LLPointer objectp = pick.getObject(); + //FIXME: how do we handle object in different parcel than us? + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + LLPointer objectp = pick.getObject(); - if (!parcel || - objectp.isNull() || - pick.mObjectFace < 0 || - pick.mObjectFace >= objectp->getNumTEs()) - { - LLViewerMediaFocus::getInstance()->clearFocus(); + if (!parcel || + objectp.isNull() || + pick.mObjectFace < 0 || + pick.mObjectFace >= objectp->getNumTEs()) + { + LLViewerMediaFocus::getInstance()->clearFocus(); - return false; - } + return false; + } - // Does this face have media? - const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace); - if(!tep) - return false; + // Does this face have media? + const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace); + if (!tep) + return false; - LLMediaEntry* mep = (tep->hasMedia()) ? tep->getMediaData() : NULL; - if(!mep) - return false; - - viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); + LLMediaEntry* mep = (tep->hasMedia()) ? tep->getMediaData() : NULL; + if (!mep) + return false; - if (gSavedSettings.getBOOL("MediaOnAPrimUI")) - { - if (!LLViewerMediaFocus::getInstance()->isFocusedOnFace(pick.getObject(), pick.mObjectFace) || media_impl.isNull()) - { - // It's okay to give this a null impl - LLViewerMediaFocus::getInstance()->setFocusFace(pick.getObject(), pick.mObjectFace, media_impl, pick.mNormal); - } - else - { - // Make sure keyboard focus is set to the media focus object. - gFocusMgr.setKeyboardFocus(LLViewerMediaFocus::getInstance()); - LLEditMenuHandler::gEditMenuHandler = LLViewerMediaFocus::instance().getFocusedMediaImpl(); - - media_impl->mouseDown(pick.mUVCoords, gKeyboard->currentMask(TRUE)); - mMediaMouseCaptureID = mep->getMediaID(); - setMouseCapture(TRUE); // This object will send a mouse-up to the media when it loses capture. - } + viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); - return true; - } + if (gSavedSettings.getBOOL("MediaOnAPrimUI")) + { + if (!LLViewerMediaFocus::getInstance()->isFocusedOnFace(pick.getObject(), pick.mObjectFace) || media_impl.isNull()) + { + // It's okay to give this a null impl + LLViewerMediaFocus::getInstance()->setFocusFace(pick.getObject(), pick.mObjectFace, media_impl, pick.mNormal); + } + else + { + // Make sure keyboard focus is set to the media focus object. + gFocusMgr.setKeyboardFocus(LLViewerMediaFocus::getInstance()); + LLEditMenuHandler::gEditMenuHandler = LLViewerMediaFocus::instance().getFocusedMediaImpl(); - LLViewerMediaFocus::getInstance()->clearFocus(); + media_impl->mouseDown(pick.mUVCoords, gKeyboard->currentMask(TRUE)); + mMediaMouseCaptureID = mep->getMediaID(); + setMouseCapture(TRUE); // This object will send a mouse-up to the media when it loses capture. + } - return false; + return true; + } + + LLViewerMediaFocus::getInstance()->clearFocus(); + + return false; +} + +bool LLToolPie::handleMediaDblClick(const LLPickInfo& pick) +{ + //FIXME: how do we handle object in different parcel than us? + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + LLPointer objectp = pick.getObject(); + + + if (!parcel || + objectp.isNull() || + pick.mObjectFace < 0 || + pick.mObjectFace >= objectp->getNumTEs()) + { + LLViewerMediaFocus::getInstance()->clearFocus(); + + return false; + } + + // Does this face have media? + const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace); + if (!tep) + return false; + + LLMediaEntry* mep = (tep->hasMedia()) ? tep->getMediaData() : NULL; + if (!mep) + return false; + + viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); + + if (gSavedSettings.getBOOL("MediaOnAPrimUI")) + { + if (!LLViewerMediaFocus::getInstance()->isFocusedOnFace(pick.getObject(), pick.mObjectFace) || media_impl.isNull()) + { + // It's okay to give this a null impl + LLViewerMediaFocus::getInstance()->setFocusFace(pick.getObject(), pick.mObjectFace, media_impl, pick.mNormal); + } + else + { + // Make sure keyboard focus is set to the media focus object. + gFocusMgr.setKeyboardFocus(LLViewerMediaFocus::getInstance()); + LLEditMenuHandler::gEditMenuHandler = LLViewerMediaFocus::instance().getFocusedMediaImpl(); + + media_impl->mouseDoubleClick(pick.mUVCoords, gKeyboard->currentMask(TRUE)); + mMediaMouseCaptureID = mep->getMediaID(); + setMouseCapture(TRUE); // This object will send a mouse-up to the media when it loses capture. + } + + return true; + } + + LLViewerMediaFocus::getInstance()->clearFocus(); + + return false; } bool LLToolPie::handleMediaHover(const LLPickInfo& pick) @@ -958,7 +1056,7 @@ bool LLToolPie::handleMediaHover(const LLPickInfo& pick) LLPointer objectp = pick.getObject(); - // Early out cases. Must clear media hover. + // Early out cases. Must clear media hover. // did not hit an object or did not hit a valid face if ( objectp.isNull() || pick.mObjectFace < 0 || @@ -1231,12 +1329,10 @@ BOOL LLToolPie::handleRightClickPick() void LLToolPie::showVisualContextMenuEffect() { - // if (gSavedSettings.getBOOL("DisablePointAtAndBeam")) { return; } - // // VEFFECT: ShowPie LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); @@ -1282,6 +1378,7 @@ bool intersect_ray_with_sphere( const LLVector3& ray_pt, const LLVector3& ray_di void LLToolPie::startCameraSteering() { + //LLFirstUse::notMoving(false); mMouseOutsideSlop = true; mBlockClickToWalk = true; @@ -1389,7 +1486,7 @@ void LLToolPie::steerCameraWithMouse(S32 x, S32 y) { old_yaw_angle = F_PI_BY_TWO + asinf(pick_distance_from_rotation_center / camera_distance_from_rotation_center); - if (mouse_ray * rotation_frame.getLeftAxis() < 0.f) + if (old_mouse_ray * rotation_frame.getLeftAxis() < 0.f) { old_yaw_angle *= -1.f; } diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 5f3c75c3b..ffae5b945 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -89,6 +89,7 @@ private: ECursorType cursorFromObject(LLViewerObject* object); bool handleMediaClick(const LLPickInfo& info); + bool handleMediaDblClick(const LLPickInfo& info); bool handleMediaHover(const LLPickInfo& info); bool handleMediaMouseUp(); diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 833926afe..b639c7585 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -35,7 +35,7 @@ #include "llbufferstream.h" #include "lltranslate.h" #include "llui.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "llweb.h" // @@ -64,9 +64,12 @@ void LLTranslate::translateMessage(LLHTTPClient::ResponderPtr &result, const std std::string url; getTranslateUrl(url, fromLang, toLang, mesg); -// - std::string user_agent = gCurrentVersion; -// + std::string user_agent = llformat("%s %d.%d.%d (%d)", + LLVersionInfo::getChannel().c_str(), + LLVersionInfo::getMajor(), + LLVersionInfo::getMinor(), + LLVersionInfo::getPatch(), + LLVersionInfo::getBuild()); if (m_Header.empty()) { diff --git a/indra/newview/lluserauth.cpp b/indra/newview/lluserauth.cpp index 501c9ac7e..a2f0ea9e0 100644 --- a/indra/newview/lluserauth.cpp +++ b/indra/newview/lluserauth.cpp @@ -38,7 +38,7 @@ #include #include "lldir.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "llappviewer.h" #include "llviewercontrol.h" #include "llxmlrpcresponder.h" @@ -57,16 +57,14 @@ // Don't define PLATFORM_STRING for unknown platforms - they need // to get added to the login cgi script, so we want this to cause an // error if we get compiled for a different platform. -// *FIX: This is misreporting on linux. Change this so that linux is -// in fact reporting linux. -#if LL_WINDOWS || LL_LINUX -static const char* PLATFORM_STRING = "Win"; +#if LL_WINDOWS +static const char* PLATFORM_STRING = "win"; #elif LL_DARWIN -static const char* PLATFORM_STRING = "Mac"; +static const char* PLATFORM_STRING = "mac"; #elif LL_LINUX -static const char* PLATFORM_STRING = "Lnx"; +static const char* PLATFORM_STRING = "lnx"; #elif LL_SOLARIS -static const char* PLATFORM_STRING = "Sol"; +static const char* PLATFORM_STRING = "sol"; #else #error("Unknown platform defined!") #endif @@ -130,9 +128,10 @@ void LLUserAuth::authenticate( XMLRPC_VectorAppendString(params, "last", lastname.c_str(), 0); XMLRPC_VectorAppendString(params, "web_login_key", web_login_key.getString().c_str(), 0); XMLRPC_VectorAppendString(params, "start", start.c_str(), 0); - XMLRPC_VectorAppendString(params, "version", gCurrentVersion.c_str(), 0); // Includes channel name - XMLRPC_VectorAppendString(params, "channel", gVersionChannel, 0); + XMLRPC_VectorAppendString(params, "version", LLVersionInfo::getChannelAndVersion().c_str(), 0); // Includes channel name + XMLRPC_VectorAppendString(params, "channel", LLVersionInfo::getChannel().c_str(), 0); XMLRPC_VectorAppendString(params, "platform", PLATFORM_STRING, 0); + XMLRPC_VectorAppendString(params, "platform_version", LLAppViewer::instance()->getOSInfo().getOSVersionString().c_str(), 0); XMLRPC_VectorAppendString(params, "mac", hashed_mac.c_str(), 0); // A bit of security through obscurity: id0 is volume_serial @@ -216,22 +215,19 @@ void LLUserAuth::authenticate( XMLRPC_VectorAppendString(params, "last", lastname.c_str(), 0); XMLRPC_VectorAppendString(params, "passwd", dpasswd.c_str(), 0); XMLRPC_VectorAppendString(params, "start", start.c_str(), 0); - XMLRPC_VectorAppendString(params, "version", llformat("%d.%d.%d.%d", gVersionMajor, gVersionMinor, gVersionPatch, gVersionBuild).c_str(), 0); + XMLRPC_VectorAppendString(params, "version", LLVersionInfo::getVersion().c_str(), 0); // Singu Note: At the request of Linden Lab we change channel sent to the login server in the following way: // * If channel is "Singularity" we change it to "Singularity Release", due to their statistics system // not being able to distinguish just the release version // * We append "64" to channel name on 64-bit for systems for the LL stats system to be able to produce independent // crash statistics depending on the architecture - std::string chan(gVersionChannel); - if (chan == "Singularity") - { - chan += " Release"; - } + std::string chan(LLVersionInfo::getChannel()); #if defined(_WIN64) || defined(__x86_64__) chan += " 64"; #endif XMLRPC_VectorAppendString(params, "channel", chan.c_str(), 0); XMLRPC_VectorAppendString(params, "platform", PLATFORM_STRING, 0); + XMLRPC_VectorAppendString(params, "platform_version", LLAppViewer::instance()->getOSInfo().getOSVersionString().c_str(), 0); XMLRPC_VectorAppendString(params, "mac", hashed_mac.c_str(), 0); // A bit of security through obscurity: id0 is volume_serial diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp new file mode 100644 index 000000000..765f10736 --- /dev/null +++ b/indra/newview/llversioninfo.cpp @@ -0,0 +1,179 @@ +/** + * @file llversioninfo.cpp + * @brief Routines to access the viewer version and build information + * @author Martin Reddy + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include +#include +#include "llversioninfo.h" +#include + +#if ! defined(LL_VIEWER_CHANNEL) \ + || ! defined(LL_VIEWER_VERSION_MAJOR) \ + || ! defined(LL_VIEWER_VERSION_MINOR) \ + || ! defined(LL_VIEWER_VERSION_PATCH) \ + || ! defined(LL_VIEWER_VERSION_BUILD) + #error "Channel or Version information is undefined" +#endif + +// +// Set the version numbers in indra/VIEWER_VERSION +// + +//static +S32 LLVersionInfo::getMajor() +{ + return LL_VIEWER_VERSION_MAJOR; +} + +//static +S32 LLVersionInfo::getMinor() +{ + return LL_VIEWER_VERSION_MINOR; +} + +//static +S32 LLVersionInfo::getPatch() +{ + return LL_VIEWER_VERSION_PATCH; +} + +//static +S32 LLVersionInfo::getBuild() +{ + return LL_VIEWER_VERSION_BUILD; +} + +//static +const std::string &LLVersionInfo::getVersion() +{ + static std::string version(""); + if (version.empty()) + { + std::ostringstream stream; + stream << LLVersionInfo::getShortVersion() << "." << LLVersionInfo::getBuild(); + // cache the version string + version = stream.str(); + } + return version; +} + +//static +const std::string &LLVersionInfo::getShortVersion() +{ + static std::string short_version(""); + if(short_version.empty()) + { + // cache the version string + std::ostringstream stream; + stream << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH; + short_version = stream.str(); + } + return short_version; +} + +namespace +{ + /// Storage of the channel name the viewer is using. + // The channel name is set by hardcoded constant, + // or by calling LLVersionInfo::resetChannel() + std::string sWorkingChannelName(LL_VIEWER_CHANNEL); + + // Storage for the "version and channel" string. + // This will get reset too. + std::string sVersionChannel(""); +} + +//static +const std::string &LLVersionInfo::getChannelAndVersion() +{ + if (sVersionChannel.empty()) + { + // cache the version string + sVersionChannel = LLVersionInfo::getChannel() + " " + LLVersionInfo::getVersion(); + } + + return sVersionChannel; +} + +//static +const std::string &LLVersionInfo::getChannel() +{ + return sWorkingChannelName; +} + +void LLVersionInfo::resetChannel(const std::string& channel) +{ + sWorkingChannelName = channel; + sVersionChannel.clear(); // Reset version and channel string til next use. +} + +//static +LLVersionInfo::ViewerMaturity LLVersionInfo::getViewerMaturity() +{ + ViewerMaturity maturity; + + std::string channel = getChannel(); + + static const boost::regex is_test_channel("\\bTest\\b"); + static const boost::regex is_alpha_channel("\\bAlpha\\b"); + static const boost::regex is_beta_channel("\\bBeta\\b"); + static const boost::regex is_project_channel("\\bProject\\b"); + static const boost::regex is_release_channel("\\bRelease\\b"); + + if (boost::regex_search(channel, is_release_channel)) + { + maturity = RELEASE_VIEWER; + } + else if (boost::regex_search(channel, is_beta_channel)) + { + maturity = BETA_VIEWER; + } + else if (boost::regex_search(channel, is_alpha_channel)) + { + maturity = ALPHA_VIEWER; + } + else if (boost::regex_search(channel, is_project_channel)) + { + maturity = PROJECT_VIEWER; + } + else if (boost::regex_search(channel, is_test_channel)) + { + maturity = TEST_VIEWER; + } + else + { + LL_WARNS() << "Channel '" << channel + << "' does not follow naming convention, assuming Test" + << LL_ENDL; + maturity = TEST_VIEWER; + } + return maturity; +} + + diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h new file mode 100644 index 000000000..049b6056b --- /dev/null +++ b/indra/newview/llversioninfo.h @@ -0,0 +1,83 @@ +/** + * @file llversioninfo.h + * @brief Routines to access the viewer version and build information + * @author Martin Reddy + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLVERSIONINFO_H +#define LL_LLVERSIONINFO_H + +#include +#include "stdtypes.h" + +/// +/// This API provides version information for the viewer. This +/// includes access to the major, minor, patch, and build integer +/// values, as well as human-readable string representations. All +/// viewer code that wants to query the current version should +/// use this API. +/// +class LLVersionInfo +{ +public: + /// return the major verion number as an integer + static S32 getMajor(); + + /// return the minor verion number as an integer + static S32 getMinor(); + + /// return the patch verion number as an integer + static S32 getPatch(); + + /// return the build number as an integer + static S32 getBuild(); + + /// return the full viewer version as a string like "2.0.0.200030" + static const std::string &getVersion(); + + /// return the viewer version as a string like "2.0.0" + static const std::string &getShortVersion(); + + /// return the viewer version and channel as a string + /// like "Second Life Release 2.0.0.200030" + static const std::string &getChannelAndVersion(); + + /// return the channel name, e.g. "Second Life" + static const std::string &getChannel(); + + /// reset the channel name used by the viewer. + static void resetChannel(const std::string& channel); + + typedef enum + { + TEST_VIEWER, + PROJECT_VIEWER, + ALPHA_VIEWER, + BETA_VIEWER, + RELEASE_VIEWER + } ViewerMaturity; + static ViewerMaturity getViewerMaturity(); +}; + +#endif diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index ba8d99b40..4ac560651 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -70,7 +70,6 @@ #include "llnotify.h" #include "llkeyboard.h" #include "llerrorcontrol.h" -#include "sgversion.h" #include "llappviewer.h" #include "llvosurfacepatch.h" #include "llvowlsky.h" @@ -98,7 +97,6 @@ LLControlGroup gColors("Colors"); // saved at end of session LLControlGroup gCrashSettings("CrashSettings"); // saved at end of session std::string gLastRunVersion; -std::string gCurrentVersion; extern BOOL gResizeScreenTexture; extern BOOL gDebugGL; @@ -654,6 +652,19 @@ static bool handleAllowLargeSounds(const LLSD& newvalue) return true; } +enum DCAction { AUTOPILOT, TELEPORT }; +static void handleDoubleClickActionChanged(const DCAction& action, const LLSD& newvalue) +{ + // Doubleclick actions - there can be only one + if (newvalue.asBoolean()) + { + if (action == AUTOPILOT) + gSavedSettings.setBOOL("DoubleClickTeleport", false); + else + gSavedSettings.setBOOL("DoubleClickAutoPilot", false); + } +} + void handleHighResChanged(const LLSD& val) { if (val) // High Res Snapshot active, must uncheck RenderUIInSnapshot @@ -855,6 +866,8 @@ void settings_setup_listeners() gSavedSettings.getControl("AllowLargeSounds")->getSignal()->connect(boost::bind(&handleAllowLargeSounds, _2)); gSavedSettings.getControl("LiruUseZQSDKeys")->getSignal()->connect(boost::bind(load_default_bindings, _2)); + gSavedSettings.getControl("DoubleClickAutoPilot")->getSignal()->connect(boost::bind(handleDoubleClickActionChanged, AUTOPILOT, _2)); + gSavedSettings.getControl("DoubleClickTeleport")->getSignal()->connect(boost::bind(handleDoubleClickActionChanged, TELEPORT, _2)); gSavedSettings.getControl("HighResSnapshot")->getSignal()->connect(boost::bind(&handleHighResChanged, _2)); } diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index d8bdf3670..0fd6b9cd4 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -67,8 +67,6 @@ extern LLControlGroup gCrashSettings; // Set after settings loaded extern std::string gLastRunVersion; -extern std::string gCurrentVersion; - bool handleCloudSettingsChanged(const LLSD& newvalue); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 3d57b6b4b..562605b19 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1213,8 +1213,6 @@ void render_hud_attachments() gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_SHINY); - gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISIBLE); - gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY); gPipeline.stateSort(hud_cam, result); diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index 77d39a149..fbabfa540 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -136,7 +136,9 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() addEntry(LLFolderType::FT_OUTBOX, new ViewerFolderEntry("Merchant Outbox", "inv_folder_outbox.tga", "inv_folder_outbox.tga", FALSE, false)); addEntry(LLFolderType::FT_BASIC_ROOT, new ViewerFolderEntry("Basic Root", "inv_folder_plain_open.tga", "inv_folder_plain_closed.tga", FALSE, false)); - + + addEntry(LLFolderType::FT_SUITCASE, new ViewerFolderEntry("My Suitcase", "inv_folder_plain_open.tga", "inv_folder_plain_closed.tga", FALSE, false)); + addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "inv_folder_plain_open.tga", "inv_folder_plain_closed.tga", FALSE, false, "default")); #if SUPPORT_ENSEMBLES diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ee4a0d8bd..dec9ddb35 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1932,7 +1932,7 @@ void remove_folder_contents(const LLUUID& category, bool keep_outfit_links, LLInventoryModel::item_array_t items; gInventory.collectDescendents(category, cats, items, LLInventoryModel::EXCLUDE_TRASH); - for (S32 i = 0; i < items.size(); ++i) + for (U32 i = 0; i < items.size(); ++i) { LLViewerInventoryItem *item = items.at(i); if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 9b0649070..bb1c236c5 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -61,7 +61,7 @@ const S32 NUDGE_FRAMES = 2; const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed struct LLKeyboardActionRegistry -: public LLRegistrySingleton, LLKeyboardActionRegistry> +: public LLRegistrySingleton, LLKeyboardActionRegistry> { }; @@ -70,13 +70,14 @@ LLViewerKeyboard gViewerKeyboard; void agent_jump( EKeystate s ) { if( KEYSTATE_UP == s ) return; + static LLCachedControl sAutomaticFly(gSavedSettings, "AutomaticFly"); F32 time = gKeyboard->getCurKeyElapsedTime(); S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount()); if( time < FLY_TIME || frame_count <= FLY_FRAMES || gAgent.upGrabbed() - || !gSavedSettings.getBOOL("AutomaticFly")) + || !sAutomaticFly()) { gAgent.moveUp(1); } @@ -86,22 +87,24 @@ void agent_jump( EKeystate s ) gAgent.moveUp(1); } } -// + void agent_toggle_down( EKeystate s ) { if (KEYSTATE_UP == s) return; - if (KEYSTATE_DOWN == s && !gAgent.getFlying() && gSavedSettings.getBOOL("SGShiftCrouchToggle")) + static LLCachedControl sCrouchToggle(gSavedSettings, "SGShiftCrouchToggle"); + if (KEYSTATE_DOWN == s + && !gAgent.getFlying() + && sCrouchToggle()) { gAgent.toggleCrouch(); } gAgent.moveUp(-1); } -// void agent_push_down( EKeystate s ) { - if( KEYSTATE_UP == s ) return; + if( KEYSTATE_UP == s ) return; gAgent.moveUp(-1); } @@ -570,11 +573,11 @@ void start_gesture( EKeystate s ) #define REGISTER_KEYBOARD_ACTION(KEY, ACTION) LLREGISTER_STATIC(LLKeyboardActionRegistry, KEY, ACTION); REGISTER_KEYBOARD_ACTION("jump", agent_jump); REGISTER_KEYBOARD_ACTION("push_down", agent_push_down); +REGISTER_KEYBOARD_ACTION("toggle_down", agent_toggle_down); REGISTER_KEYBOARD_ACTION("push_forward", agent_push_forward); REGISTER_KEYBOARD_ACTION("push_backward", agent_push_backward); REGISTER_KEYBOARD_ACTION("look_up", agent_look_up); REGISTER_KEYBOARD_ACTION("look_down", agent_look_down); -REGISTER_KEYBOARD_ACTION("toggle_down", agent_toggle_down); REGISTER_KEYBOARD_ACTION("toggle_fly", agent_toggle_fly); REGISTER_KEYBOARD_ACTION("turn_left", agent_turn_left); REGISTER_KEYBOARD_ACTION("turn_right", agent_turn_right); @@ -702,13 +705,16 @@ BOOL LLViewerKeyboard::handleKey(KEY translated_key, MASK translated_mask, BOOL return mKeyHandledByUI[translated_key]; } - +BOOL LLViewerKeyboard::handleKeyUp(KEY translated_key, MASK translated_mask) +{ + return gViewerWindow->handleKeyUp(translated_key, translated_mask); +} BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) { S32 index; - typedef boost::function function_t; - function_t function = NULL; + typedef std::function function_t; + function_t function; std::string name; // Allow remapping of F2-F12 diff --git a/indra/newview/llviewerkeyboard.h b/indra/newview/llviewerkeyboard.h index 29fff6f98..bcc937f49 100644 --- a/indra/newview/llviewerkeyboard.h +++ b/indra/newview/llviewerkeyboard.h @@ -89,6 +89,7 @@ public: LLViewerKeyboard(); BOOL handleKey(KEY key, MASK mask, BOOL repeated); + BOOL handleKeyUp(KEY key, MASK mask); S32 loadBindings(const std::string& filename); // returns number bound, 0 on error S32 loadBindingsXML(const std::string& filename); // returns number bound, 0 on error diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index b63720c6d..15c3723af 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -94,11 +94,6 @@ std::string getProfileURL(const std::string& agent_name); /*static*/ const char* LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING = "MediaShowOutsideParcel"; -class AIHTTPTimeoutPolicy; -extern AIHTTPTimeoutPolicy mimeDiscoveryResponder_timeout; -extern AIHTTPTimeoutPolicy viewerMediaOpenIDResponder_timeout; -extern AIHTTPTimeoutPolicy viewerMediaWebProfileResponder_timeout; - // Move this to its own file. LLViewerMediaEventEmitter::~LLViewerMediaEventEmitter() @@ -177,9 +172,8 @@ class LLMimeDiscoveryResponder : public LLHTTPClient::ResponderHeadersOnly { LOG_CLASS(LLMimeDiscoveryResponder); public: - LLMimeDiscoveryResponder(viewer_media_t media_impl, std::string const& default_mime_type) + LLMimeDiscoveryResponder( viewer_media_t media_impl) : mMediaImpl(media_impl), - mDefaultMimeType(default_mime_type), mInitialized(false) { if(mMediaImpl->mMimeTypeProbe != NULL) @@ -195,29 +189,56 @@ public: disconnectOwner(); } - /*virtual*/ void completedHeaders(void) +private: + /* virtual */ void completedHeaders() { - if ((200 <= mStatus && mStatus < 300) || mStatus == 405) // Using HEAD may result in a 405 METHOD NOT ALLOWED, but still have the right Content-Type header. + if (!isGoodStatus(mStatus)) { - std::string media_type; - if (mReceivedHeaders.getFirstValue("content-type", media_type)) + LL_WARNS() << dumpResponse() + << " [headers:" << getResponseHeaders() << "]" << LL_ENDL; + } + std::string media_type; + std::string::size_type idx1 = media_type.find_first_of(";"); + std::string mime_type = media_type.substr(0, idx1); + + LL_DEBUGS() << "status is " << getStatus() << ", media type \"" << media_type << "\"" << LL_ENDL; + + // 2xx status codes indicate success. + // Most 4xx status codes are successful enough for our purposes. + // 499 is the error code for host not found, timeout, etc. + // 500 means "Internal Server error" but we decided it's okay to + // accept this and go past it in the MIME type probe + // 302 means the resource can be found temporarily in a different place - added this for join.secondlife.com + // 499 is a code specifc to join.secondlife.com apparently safe to ignore +// if( ((status >= 200) && (status < 300)) || +// ((status >= 400) && (status < 499)) || +// (status == 500) || +// (status == 302) || +// (status == 499) +// ) + // We now no longer check the error code returned from the probe. + // If we have a mime type, use it. If not, default to the web plugin and let it handle error reporting. + //if(1) + { + // The probe was successful. + if(mime_type.empty()) { - std::string::size_type idx1 = media_type.find_first_of(";"); - std::string mime_type = media_type.substr(0, idx1); - completeAny(mStatus, mime_type); - return; - } - if (200 <= mStatus && mStatus < 300) - { - LL_WARNS() << "LLMimeDiscoveryResponder::completedHeaders: OK HTTP status (" << mStatus << ") but no Content-Type! Received headers: " << mReceivedHeaders << LL_ENDL; + // Some sites don't return any content-type header at all. + // Treat an empty mime type as text/html. + mime_type = "text/html"; } } - LL_WARNS() << "LLMimeDiscoveryResponder::completedHeaders: Got status " << mStatus << ". Using default mime-type: " << mDefaultMimeType << LL_ENDL; - completeAny(mStatus, mDefaultMimeType); - } + //else + //{ + // LL_WARNS() << "responder failed with status " << dumpResponse() << LL_ENDL; + // + // if(mMediaImpl) + // { + // mMediaImpl->mMediaSourceFailed = true; + // } + // return; + //} - void completeAny(U32 status, const std::string& mime_type) - { // the call to initializeMedia may disconnect the responder, which will clear mMediaImpl. // Make a local copy so we can call loadURI() afterwards. LLViewerMediaImpl *impl = mMediaImpl; @@ -233,8 +254,7 @@ public: } } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mimeDiscoveryResponder_timeout; } - +public: /*virtual*/ char const* getName(void) const { return "LLMimeDiscoveryResponder"; } void cancelRequest() { @@ -258,8 +278,7 @@ private: public: - viewer_media_t mMediaImpl; - std::string mDefaultMimeType; + LLViewerMediaImpl *mMediaImpl; bool mInitialized; }; @@ -275,75 +294,70 @@ public: { } - /*virtual*/ bool needsHeaders(void) const { return true; } - - /*virtual*/ void completedHeaders(void) + /* virtual */ void completedRaw( + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { - LL_DEBUGS("MediaAuth") << "status = " << mStatus << ", reason = " << mReason << LL_ENDL; - LL_DEBUGS("MediaAuth") << mReceivedHeaders << LL_ENDL; - LLViewerMedia::openIDCookieResponse(get_cookie("agni_sl_session_id")); + // We don't care about the content of the response, only the Set-Cookie header. + LL_DEBUGS("MediaAuth") << dumpResponse() + << " [headers:" << getResponseHeaders() << "]" << LL_ENDL; + std::string cookie; + getResponseHeaders().getFirstValue("set-cookie", cookie); + + // *TODO: What about bad status codes? Does this destroy previous cookies? + LLViewerMedia::openIDCookieResponse(cookie); } - /*virtual*/ void completedRaw(LLChannelDescriptors const& channels, LLIOPipe::buffer_ptr_t const& buffer) - { - // This is just here to disable the default behavior (attempting to parse the response as llsd). - // We don't care about the content of the response, only the set-cookie header. - } - - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerMediaOpenIDResponder_timeout; } /*virtual*/ char const* getName(void) const { return "LLViewerMediaOpenIDResponder"; } + /*virtual*/ bool needsHeaders(void) const { return true; } }; class LLViewerMediaWebProfileResponder : public LLHTTPClient::ResponderWithCompleted { LOG_CLASS(LLViewerMediaWebProfileResponder); public: - LLViewerMediaWebProfileResponder(std::string host) : mHost(host) { } - ~LLViewerMediaWebProfileResponder() { } - - /*virtual*/ bool needsHeaders(void) const { return true; } - - /*virtual*/ void completedHeaders(void) + LLViewerMediaWebProfileResponder(std::string host) { - LL_INFOS("MediaAuth") << "status = " << mStatus << ", reason = " << mReason << LL_ENDL; - LL_INFOS("MediaAuth") << mReceivedHeaders << LL_ENDL; + mHost = host; + } + + ~LLViewerMediaWebProfileResponder() + { + } + + void completedRaw( + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + // We don't care about the content of the response, only the set-cookie header. + LL_WARNS("MediaAuth") << dumpResponse() + << " [headers:" << getResponseHeaders() << "]" << LL_ENDL; + + AIHTTPReceivedHeaders stripped_content = getResponseHeaders(); + LL_WARNS("MediaAuth") << stripped_content << LL_ENDL; - bool found = false; AIHTTPReceivedHeaders::range_type cookies; if (mReceivedHeaders.getValues("set-cookie", cookies)) { for (AIHTTPReceivedHeaders::iterator_type cookie = cookies.first; cookie != cookies.second; ++cookie) { - LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie->second, mHost); + // *TODO: What about bad status codes? Does this destroy previous cookies? + LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie->second, mHost); - std::string key = cookie->second.substr(0, cookie->second.find('=')); - if (key == "_my_secondlife_session") - { - // Set cookie for snapshot publishing. - std::string auth_cookie = cookie->second.substr(0, cookie->second.find(";")); // strip path - LL_INFOS("MediaAuth") << "Setting openID auth cookie \"" << auth_cookie << "\"." << LL_ENDL; - LLWebProfile::setAuthCookie(auth_cookie); - found = true; - break; - } + if (cookie->second.substr(0, cookie->second.find('=')) == "_my_secondlife_session") + { + // Set cookie for snapshot publishing. + std::string auth_cookie = cookie->second.substr(0, cookie->second.find(";")); // strip path + LLWebProfile::setAuthCookie(auth_cookie); + break; + } } } - if (!found) - { - LL_WARNS() << "LLViewerMediaWebProfileResponder did not receive a session ID cookie \"_my_secondlife_session\"! OpenID authentications will fail!" << LL_ENDL; - } } - /*virtual*/ void completedRaw(LLChannelDescriptors const& channels, LLIOPipe::buffer_ptr_t const& buffer) - { - // This is just here to disable the default behavior (attempting to parse the response as llsd). - // We don't care about the content of the response, only the set-cookie header. - } + /*virtual*/ char const* getName() const { return "LLViewerMediaWebProfileResponder"; } + /*virtual*/ bool needsHeaders() const { return true; } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerMediaWebProfileResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "LLViewerMediaWebProfileResponder"; } - -private: std::string mHost; }; @@ -799,7 +813,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg) LLFastTimer t1(FTM_MEDIA_UPDATE); // Enable/disable the plugin read thread - LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread")); + static LLCachedControl pluginUseReadThread(gSavedSettings, "PluginUseReadThread"); + LLPluginProcessParent::setUseReadThread(pluginUseReadThread); // HACK: we always try to keep a spare running webkit plugin around to improve launch times. createSpareBrowserMediaSource(); @@ -849,12 +864,12 @@ void LLViewerMedia::updateMedia(void *dummy_arg) std::vector proximity_order; - bool inworld_media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia"); - bool inworld_audio_enabled = gSavedSettings.getBOOL("AudioStreamingMusic"); - U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal"); - U32 max_normal = gSavedSettings.getU32("PluginInstancesNormal"); - U32 max_low = gSavedSettings.getU32("PluginInstancesLow"); - F32 max_cpu = gSavedSettings.getF32("PluginInstancesCPULimit"); + static LLCachedControl inworld_media_enabled(gSavedSettings, "AudioStreamingMedia"); + static LLCachedControl inworld_audio_enabled(gSavedSettings, "AudioStreamingMusic"); + static LLCachedControl max_instances(gSavedSettings, "PluginInstancesTotal"); + static LLCachedControl max_normal(gSavedSettings, "PluginInstancesNormal"); + static LLCachedControl max_low(gSavedSettings, "PluginInstancesLow"); + static LLCachedControl max_cpu(gSavedSettings, "PluginInstancesCPULimit"); // Setting max_cpu to 0.0 disables CPU usage checking. bool check_cpu_usage = (max_cpu != 0.0f); @@ -1026,7 +1041,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg) } } - if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug")) + static LLCachedControl mediaPerformanceManager(gSavedSettings, "MediaPerformanceManagerDebug"); + if(mediaPerformanceManager) { // Give impls the same ordering as the priority list // they're already in the right order for this. @@ -1124,7 +1140,7 @@ bool LLViewerMedia::isParcelAudioPlaying() return (LLViewerMedia::hasParcelAudio() && gAudiop && LLAudioEngine::AUDIO_PLAYING == gAudiop->isInternetStreamPlaying()); } -bool LLViewerMedia::onAuthSubmit(const LLSD& notification, const LLSD& response) +void LLViewerMedia::onAuthSubmit(const LLSD& notification, const LLSD& response) { LLViewerMediaImpl *impl = LLViewerMedia::getMediaImplFromTextureID(notification["payload"]["media_id"]); if(impl) @@ -1142,7 +1158,6 @@ bool LLViewerMedia::onAuthSubmit(const LLSD& notification, const LLSD& response) } } } - return false; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1401,6 +1416,8 @@ AIHTTPHeaders LLViewerMedia::getHeaders() { AIHTTPHeaders headers; headers.addHeader("Accept", "*/*"); + // *TODO: Should this be 'application/llsd+xml' ? + // *TODO: Should this even be set at all? This header is only not overridden in 'GET' methods. headers.addHeader("Content-Type", "application/xml"); headers.addHeader("Cookie", sOpenIDCookie); headers.addHeader("User-Agent", getCurrentUserAgent()); @@ -1439,24 +1456,21 @@ void LLViewerMedia::setOpenIDCookie() getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(host_start, host_end - host_start)); - // Does grid supports web profiles at all? - if (!gSavedSettings.getString("WebProfileURL").empty()) - { - // Do a web profile get so we can store the cookie - AIHTTPHeaders headers; - headers.addHeader("Accept", "*/*"); - headers.addHeader("Cookie", sOpenIDCookie); - headers.addHeader("User-Agent", getCurrentUserAgent()); + if (gSavedSettings.getString("WebProfileURL").empty()) return; + // Do a web profile get so we can store the cookie + AIHTTPHeaders headers; + headers.addHeader("Accept", "*/*"); + headers.addHeader("Cookie", sOpenIDCookie); + headers.addHeader("User-Agent", getCurrentUserAgent()); - std::string profile_url = getProfileURL(""); - LLURL raw_profile_url( profile_url.c_str() ); + std::string profile_url = getProfileURL(""); + LLURL raw_profile_url( profile_url.c_str() ); - LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << LL_ENDL; - LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL; - LLHTTPClient::get(profile_url, - new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()), - headers); - } + LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << LL_ENDL; + LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL; + LLHTTPClient::get(profile_url, + new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()), + headers); } } @@ -1545,21 +1559,19 @@ void LLViewerMedia::proxyWindowClosed(const std::string &uuid) void LLViewerMedia::createSpareBrowserMediaSource() { static bool failedLoading = false; + if (failedLoading) return; // If we don't have a spare browser media source, create one. // However, if PluginAttachDebuggerToPlugins is set then don't spawn a spare // SLPlugin process in order to not be confused by an unrelated gdb terminal // popping up at the moment we start a media plugin. - if (!failedLoading && !sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) + if (!sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) { // The null owner will keep the browser plugin from fully initializing // (specifically, it keeps LLPluginClassMedia from negotiating a size change, // which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color) sSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType("text/html", NULL, 0, 0); - if (!sSpareBrowserMediaSource) - { - failedLoading = true; - } + if (!sSpareBrowserMediaSource) failedLoading = true; } } @@ -1746,17 +1758,11 @@ bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type) { bool mimeTypeChanged = (mMimeType != mime_type); bool pluginChanged = (LLMIMETypes::implType(mCurrentMimeType) != LLMIMETypes::implType(mime_type)); + if(!mPluginBase || pluginChanged) { - if(! initializePlugin(mime_type)) - { - /*LL_WARNS("Plugin") << "plugin intialization failed for mime type: " << mime_type << LL_ENDL; - LLSD args; - args["MIME_TYPE"] = mime_type; - LLNotificationsUtil::add("NoPlugin", args); - - return false;*/ - } + // We don't have a plugin at all, or the new mime type is handled by a different plugin than the old mime type. + (void)initializePlugin(mime_type); } else if(mimeTypeChanged) { @@ -1764,7 +1770,6 @@ bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type) mMimeType = mime_type; } - // play(); return (mPluginBase != NULL); } @@ -1810,7 +1815,6 @@ void LLViewerMediaImpl::destroyMediaSource() mPluginBase->setDeleteOK(true) ; destroyPlugin(); } - } ////////////////////////////////////////////////////////////////////////////////////////// @@ -1828,7 +1832,8 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ // HACK: we always try to keep a spare running webkit plugin around to improve launch times. // If a spare was already created before PluginAttachDebuggerToPlugins was set, don't use it. - if(plugin_basename == "media_plugin_webkit" && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) + if ((plugin_basename == "media_plugin_cef") && + !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) { media_source = LLViewerMedia::getSpareBrowserMediaSource(); if(media_source) @@ -1840,7 +1845,6 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ return media_source; } } - if(plugin_basename.empty()) { LL_WARNS_ONCE("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL; @@ -1849,20 +1853,26 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ { std::string launcher_name = gDirUtilp->getLLPluginLauncher(); std::string plugin_name = gDirUtilp->getLLPluginFilename(plugin_basename); - std::string user_data_path = gDirUtilp->getOSUserAppDir(); - user_data_path += gDirUtilp->getDirDelimiter(); + + std::string user_data_path_cache = gDirUtilp->getCacheDir(false); + user_data_path_cache += gDirUtilp->getDirDelimiter(); + + std::string user_data_path_cookies = gDirUtilp->getOSUserAppDir(); + user_data_path_cookies += gDirUtilp->getDirDelimiter(); + + std::string user_data_path_logs = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); // Fix for EXT-5960 - make browser profile specific to user (cache, cookies etc.) // If the linden username returned is blank, that can only mean we are // at the login page displaying login Web page or Web browser test via Develop menu. // In this case we just use whatever gDirUtilp->getOSUserAppDir() gives us (this // is what we always used before this change) - std::string linden_user_dir = gDirUtilp->getLindenUserDir(true); + std::string linden_user_dir = gDirUtilp->getLindenUserDir(); if ( ! linden_user_dir.empty() ) { // gDirUtilp->getLindenUserDir() is whole path, not just Linden name - user_data_path = linden_user_dir; - user_data_path += gDirUtilp->getDirDelimiter(); + user_data_path_cookies = linden_user_dir; + user_data_path_cookies += gDirUtilp->getDirDelimiter(); }; // See if the plugin executable exists @@ -1870,18 +1880,16 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ if(LLFile::stat(launcher_name, &s)) { LL_WARNS_ONCE("Media") << "Couldn't find launcher at " << launcher_name << LL_ENDL; - llassert(false); // Fail in debugging mode. } else if(LLFile::stat(plugin_name, &s)) { LL_WARNS_ONCE("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL; - llassert(false); // Fail in debugging mode. } else { media_source = new LLPluginClassMedia(owner); media_source->setSize(default_width, default_height); - media_source->setUserDataPath(user_data_path); + media_source->setUserDataPath(user_data_path_cache, user_data_path_cookies, user_data_path_logs); media_source->setLanguageCode(LLUI::getLanguage()); // collect 'cookies enabled' setting from prefs and send to embedded browser @@ -1899,6 +1907,9 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled ); + // need to set agent string here before instance created + media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent()); + media_source->setTarget(target); const std::string plugin_dir = gDirUtilp->getLLPluginDir(); @@ -1926,12 +1937,12 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { // Save the previous media source's last set size before destroying it. - mMediaWidth = plugin->getSetWidth(); - mMediaHeight = plugin->getSetHeight(); + mMediaWidth = mMediaSource->getSetWidth(); + mMediaHeight = mMediaSource->getSetHeight(); } // Always delete the old media impl first. @@ -2012,8 +2023,8 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::loadURI() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { // trim whitespace from front and back of URL - fixes EXT-5363 LLStringUtil::trim( mMediaURL ); @@ -2033,10 +2044,14 @@ void LLViewerMediaImpl::loadURI() "<>#%" ";/?:@&=", false); - LL_INFOS() << "Asking media source to load URI: " << uri << LL_ENDL; - - - plugin->loadURI( uri ); + { + // Do not log the query parts + LLURI u(uri); + std::string sanitized_uri = (u.query().empty() ? uri : u.scheme() + "://" + u.authority() + u.path()); + LL_INFOS() << "Asking media source to load URI: " << sanitized_uri << LL_ENDL; + } + + mMediaSource->loadURI( uri ); // A non-zero mPreviousMediaTime means that either this media was previously unloaded by the priority code while playing/paused, // or a seek happened before the media loaded. In either case, seek to the saved time. @@ -2062,14 +2077,16 @@ void LLViewerMediaImpl::loadURI() } } } + +////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::setSize(int width, int height) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); mMediaWidth = width; mMediaHeight = height; - if (plugin) + if (mMediaSource) { - plugin->setSize(width, height); + mMediaSource->setSize(width, height); } } @@ -2088,10 +2105,10 @@ void LLViewerMediaImpl::hideNotification() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::play() { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); // If the media source isn't there, try to initialize it and load an URL. - if (!plugin) + if(mMediaSource == NULL) { if(!initializeMedia(mMimeType)) { @@ -2110,10 +2127,10 @@ void LLViewerMediaImpl::play() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::stop() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->stop(); + mMediaSource->stop(); // destroyMediaSource(); } } @@ -2121,10 +2138,10 @@ void LLViewerMediaImpl::stop() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::pause() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->pause(); + mMediaSource->pause(); } else { @@ -2135,10 +2152,10 @@ void LLViewerMediaImpl::pause() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::start() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->start(); + mMediaSource->start(); } else { @@ -2149,10 +2166,10 @@ void LLViewerMediaImpl::start() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::seek(F32 time) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->seek(time); + mMediaSource->seek(time); } else { @@ -2164,17 +2181,17 @@ void LLViewerMediaImpl::seek(F32 time) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::skipBack(F32 step_scale) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - if(plugin->pluginSupportsMediaTime()) + if(mMediaSource->pluginSupportsMediaTime()) { - F64 back_step = plugin->getCurrentTime() - (plugin->getDuration()*step_scale); + F64 back_step = mMediaSource->getCurrentTime() - (mMediaSource->getDuration()*step_scale); if(back_step < 0.0) { back_step = 0.0; } - plugin->seek(back_step); + mMediaSource->seek(back_step); } } } @@ -2182,17 +2199,17 @@ void LLViewerMediaImpl::skipBack(F32 step_scale) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::skipForward(F32 step_scale) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - if(plugin->pluginSupportsMediaTime()) + if(mMediaSource->pluginSupportsMediaTime()) { - F64 forward_step = plugin->getCurrentTime() + (plugin->getDuration()*step_scale); - if(forward_step > plugin->getDuration()) + F64 forward_step = mMediaSource->getCurrentTime() + (mMediaSource->getDuration()*step_scale); + if(forward_step > mMediaSource->getDuration()) { - forward_step = plugin->getDuration(); + forward_step = mMediaSource->getDuration(); } - plugin->seek(forward_step); + mMediaSource->seek(forward_step); } } } @@ -2207,24 +2224,27 @@ void LLViewerMediaImpl::setVolume(F32 volume) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::updateVolume() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { // always scale the volume by the global media volume F32 volume = mRequestedVolume * LLViewerMedia::getVolume(); if (mProximityCamera > 0) { - if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMax")) + static LLCachedControl sMediaRollOffMax(gSavedSettings, "MediaRollOffMax", 30.f); + static LLCachedControl sMediaRollOffMin(gSavedSettings, "MediaRollOffMin", 5.f); + static LLCachedControl sMediaRollOffRate(gSavedSettings, "MediaRollOffRate", 0.125f); + if (mProximityCamera > sMediaRollOffMax) { volume = 0; } - else if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMin")) + else if (mProximityCamera > sMediaRollOffMin) { // attenuated_volume = 1 / (roll_off_rate * (d - min))^2 // the +1 is there so that for distance 0 the volume stays the same - F64 adjusted_distance = mProximityCamera - gSavedSettings.getF32("MediaRollOffMin"); - F64 attenuation = 1.0 + (gSavedSettings.getF32("MediaRollOffRate") * adjusted_distance); + F64 adjusted_distance = mProximityCamera - sMediaRollOffMin; + F64 attenuation = 1.0 + (sMediaRollOffRate * adjusted_distance); attenuation = 1.0 / (attenuation * attenuation); // the attenuation multiplier should never be more than one since that would increase volume volume = volume * llmin(1.0, attenuation); @@ -2233,11 +2253,11 @@ void LLViewerMediaImpl::updateVolume() if (sOnlyAudibleTextureID == LLUUID::null || sOnlyAudibleTextureID == mTextureId) { - plugin->setVolume(volume); + mMediaSource->setVolume(volume); } else { - plugin->setVolume(0.0f); + mMediaSource->setVolume(0.0f); } } } @@ -2247,21 +2267,23 @@ F32 LLViewerMediaImpl::getVolume() { return mRequestedVolume; } + +////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::focus(bool focus) { mHasFocus = focus; - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) { // call focus just for the hell of it, even though this apopears to be a nop - plugin->focus(focus); + mMediaSource->focus(focus); if (focus) { // spoof a mouse click to *actually* pass focus // Don't do this anymore -- it actually clicks through now. -// plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, 1, 1, 0); -// plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 1, 1, 0); +// mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, 1, 1, 0); +// mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 1, 1, 0); } } } @@ -2286,10 +2308,10 @@ std::string LLViewerMediaImpl::getCurrentMediaURL() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::clearCache() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->clear_cache(); + mMediaSource->clear_cache(); } else { @@ -2301,59 +2323,61 @@ void LLViewerMediaImpl::clearCache() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::setPageZoomFactor( double factor ) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin && factor != mZoomFactor) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource && factor != mZoomFactor) { mZoomFactor = factor; - plugin->set_page_zoom_factor( factor ); + mMediaSource->set_page_zoom_factor( factor ); } } ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; - if (plugin) +// LL_INFOS() << "mouse down (" << x << ", " << y << ")" << LL_ENDL; + if (mMediaSource) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, button, x, y, mask); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, button, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::mouseUp(S32 x, S32 y, MASK mask, S32 button) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; - if (plugin) +// LL_INFOS() << "mouse up (" << x << ", " << y << ")" << LL_ENDL; + if (mMediaSource) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, button, x, y, mask); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, button, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; - if (plugin) +// LL_INFOS() << "mouse move (" << x << ", " << y << ")" << LL_ENDL; + if (mMediaSource) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, 0, x, y, mask); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, 0, x, y, mask); } } - ////////////////////////////////////////////////////////////////////////////////////////// //static void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); F32 texture_x = texture_coords.mV[VX]; F32 texture_y = texture_coords.mV[VY]; @@ -2367,18 +2391,18 @@ void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32 texture_y = 1.0 + texture_y; // scale x and y to texel units. - *x = ll_round(texture_x * plugin->getTextureWidth()); - *y = ll_round((1.0f - texture_y) * plugin->getTextureHeight()); + *x = ll_round(texture_x * mMediaSource->getTextureWidth()); + *y = ll_round((1.0f - texture_y) * mMediaSource->getTextureHeight()); // Adjust for the difference between the actual texture height and the amount of the texture in use. - *y -= (plugin->getTextureHeight() - plugin->getHeight()); + *y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); } ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { S32 x, y; scaleTextureCoords(texture_coords, &x, &y); @@ -2389,8 +2413,8 @@ void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S3 void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 button) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { S32 x, y; scaleTextureCoords(texture_coords, &x, &y); @@ -2401,8 +2425,8 @@ void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { S32 x, y; scaleTextureCoords(texture_coords, &x, &y); @@ -2411,39 +2435,51 @@ void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask) } } +void LLViewerMediaImpl::mouseDoubleClick(const LLVector2& texture_coords, MASK mask) +{ + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) + { + S32 x, y; + scaleTextureCoords(texture_coords, &x, &y); + + mouseDoubleClick(x, y, mask); + } +} + ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; - if (plugin) + if (mMediaSource) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, button, x, y, mask); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, button, x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::scrollWheel(S32 x, S32 y, MASK mask) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; - if (plugin) + if (mMediaSource) { - plugin->scrollEvent(x, y, mask); + mMediaSource->scrollEvent(x, y, mask); } } ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::onMouseCaptureLost() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) { - plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 0, mLastMouseX, mLastMouseY, 0); + mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 0, mLastMouseX, mLastMouseY, 0); } } @@ -2467,11 +2503,11 @@ void LLViewerMediaImpl::updateJavascriptObject() { static LLFrameTimer timer ; - LLPluginClassMedia* plugin = getMediaPlugin(); - if ( plugin ) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if ( mMediaSource ) { // flag to expose this information to internal browser or not. - bool enable = gSavedSettings.getBOOL("BrowserEnableJSObject"); + static LLCachedControl enable(gSavedSettings, "BrowserEnableJSObject", false); if(!enable) { @@ -2484,7 +2520,7 @@ void LLViewerMediaImpl::updateJavascriptObject() } timer.reset() ; - plugin->jsEnableObject( enable ); + mMediaSource->jsEnableObject( enable ); // these values are only menaingful after login so don't set them before //bool logged_in = LLLoginInstance::getInstance()->authSuccess(); @@ -2496,20 +2532,20 @@ void LLViewerMediaImpl::updateJavascriptObject() double x = agent_pos.mV[ VX ]; double y = agent_pos.mV[ VY ]; double z = agent_pos.mV[ VZ ]; - plugin->jsAgentLocationEvent( x, y, z ); + mMediaSource->jsAgentLocationEvent( x, y, z ); // current location within the grid LLVector3d agent_pos_global = gAgent.getLastPositionGlobal(); double global_x = agent_pos_global.mdV[ VX ]; double global_y = agent_pos_global.mdV[ VY ]; double global_z = agent_pos_global.mdV[ VZ ]; - plugin->jsAgentGlobalLocationEvent( global_x, global_y, global_z ); + mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z ); // current agent orientation double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] ); double angle = rotation * RAD_TO_DEG; if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation! - plugin->jsAgentOrientationEvent( angle ); + mMediaSource->jsAgentOrientationEvent( angle ); // current region agent is in std::string region_name(""); @@ -2518,29 +2554,31 @@ void LLViewerMediaImpl::updateJavascriptObject() { region_name = region->getName(); }; - plugin->jsAgentRegionEvent( region_name ); + mMediaSource->jsAgentRegionEvent( region_name ); } // language code the viewer is set to - plugin->jsAgentLanguageEvent( LLUI::getLanguage() ); + mMediaSource->jsAgentLanguageEvent( LLUI::getLanguage() ); // maturity setting the agent has selected if ( gAgent.prefersAdult() ) - plugin->jsAgentMaturityEvent( "GMA" ); // Adult means see adult, mature and general content + mMediaSource->jsAgentMaturityEvent( "GMA" ); // Adult means see adult, mature and general content else if ( gAgent.prefersMature() ) - plugin->jsAgentMaturityEvent( "GM" ); // Mature means see mature and general content + mMediaSource->jsAgentMaturityEvent( "GM" ); // Mature means see mature and general content else if ( gAgent.prefersPG() ) - plugin->jsAgentMaturityEvent( "G" ); // PG means only see General content + mMediaSource->jsAgentMaturityEvent( "G" ); // PG means only see General content } } + +////////////////////////////////////////////////////////////////////////////////////////// const std::string& LLViewerMediaImpl::getName() const { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) { - return plugin->getMediaName(); + return mMediaSource->getMediaName(); } return LLStringUtil::null; @@ -2549,20 +2587,20 @@ const std::string& LLViewerMediaImpl::getName() const ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::navigateBack() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) { - plugin->browse_back(); + mMediaSource->browse_back(); } } ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::navigateForward() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) { - plugin->browse_forward(); + mMediaSource->browse_forward(); } } @@ -2627,7 +2665,12 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi if(mPriority == PRIORITY_UNLOADED) { // Helpful to have media urls in log file. Shouldn't be spammy. - LL_INFOS() << "NOT LOADING media id= " << mTextureId << " url=" << url << " mime_type=" << mime_type << LL_ENDL; + { + // Do not log the query parts + LLURI u(url); + std::string sanitized_url = (u.query().empty() ? url : u.scheme() + "://" + u.authority() + u.path()); + LL_INFOS() << "NOT LOADING media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mime_type << LL_ENDL; + } // This impl should not be loaded at this time. LL_DEBUGS("PluginPriority") << this << "Not loading (PRIORITY_UNLOADED)" << LL_ENDL; @@ -2642,7 +2685,12 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi void LLViewerMediaImpl::navigateInternal() { // Helpful to have media urls in log file. Shouldn't be spammy. - LL_INFOS() << "media id= " << mTextureId << " url=" << mMediaURL << " mime_type=" << mMimeType << LL_ENDL; + { + // Do not log the query parts + LLURI u(mMediaURL); + std::string sanitized_url = (u.query().empty() ? mMediaURL : u.scheme() + "://" + u.authority() + u.path()); + LL_INFOS() << "media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mMimeType << LL_ENDL; + } if (mMediaURL.empty()) { @@ -2700,8 +2748,9 @@ void LLViewerMediaImpl::navigateInternal() // which is really not what we want. AIHTTPHeaders headers; headers.addHeader("Accept", "*/*"); + // Allow cookies in the response, to prevent a redirect loop when accessing join.secondlife.com headers.addHeader("Cookie", ""); - LLHTTPClient::getHeaderOnly( mMediaURL, new LLMimeDiscoveryResponder(this, "text/html"), headers); + LLHTTPClient::getHeaderOnly( mMediaURL, new LLMimeDiscoveryResponder(this), headers); } else if("data" == scheme || "file" == scheme || "about" == scheme) { @@ -2734,39 +2783,43 @@ void LLViewerMediaImpl::navigateInternal() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::navigateStop() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->browse_stop(); + mMediaSource->browse_stop(); } - } ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask) { bool result = false; - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); - if (plugin) + if (mMediaSource) { // FIXME: THIS IS SO WRONG. // Menu keys should be handled by the menu system and not passed to UI elements, but this is how LLTextEditor and LLLineEditor do it... + if (MASK_CONTROL & mask && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END) + { + result = true; + } + if( MASK_CONTROL & mask ) { if('C' == key) { - plugin->copy(); + mMediaSource->copy(); result = true; } else if('V' == key) { - plugin->paste(); + mMediaSource->paste(); result = true; } else if('X' == key) { - plugin->cut(); + mMediaSource->cut(); result = true; } } @@ -2778,25 +2831,45 @@ bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask) if(!result) { - LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData(); - - result = plugin->keyEvent(LLPluginClassMedia::KEY_EVENT_DOWN ,key, mask, native_key_data); - // Since the viewer internal event dispatching doesn't give us key-up events, simulate one here. - (void)plugin->keyEvent(LLPluginClassMedia::KEY_EVENT_UP ,key, mask, native_key_data); + result = mMediaSource->keyEvent(LLPluginClassMedia::KEY_EVENT_DOWN, key, mask, native_key_data); } } return result; } +////////////////////////////////////////////////////////////////////////////////////////// +bool LLViewerMediaImpl::handleKeyUpHere(KEY key, MASK mask) +{ + bool result = false; + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + + if (mMediaSource) + { + // FIXME: THIS IS SO WRONG. + // Menu keys should be handled by the menu system and not passed to UI elements, but this is how LLTextEditor and LLLineEditor do it... + if (MASK_CONTROL & mask && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END) + { + result = true; + } + + if (!result) + { + LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData(); + result = mMediaSource->keyEvent(LLPluginClassMedia::KEY_EVENT_UP, key, mask, native_key_data); + } + } + + return result; +} ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) { bool result = false; - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); - if (plugin) + if (mMediaSource) { // only accept 'printable' characters, sigh... if (uni_char >= 32 // discard 'control' characters @@ -2804,7 +2877,7 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) { LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData(); - plugin->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data); + mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data); } } @@ -2814,11 +2887,11 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::canNavigateForward() { - bool result = false; - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + BOOL result = FALSE; + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) { - result = plugin->getHistoryForwardAvailable(); + result = mMediaSource->getHistoryForwardAvailable(); } return result; } @@ -2826,11 +2899,11 @@ bool LLViewerMediaImpl::canNavigateForward() ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::canNavigateBack() { - bool result = false; - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) + BOOL result = FALSE; + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) { - result = plugin->getHistoryBackAvailable(); + result = mMediaSource->getHistoryBackAvailable(); } return result; } @@ -2844,10 +2917,8 @@ static LLFastTimer::DeclareTimer FTM_MEDIA_SET_SUBIMAGE("Set Subimage"); void LLViewerMediaImpl::update() { LLFastTimer t(FTM_MEDIA_DO_UPDATE); - - LLPluginClassMedia* plugin = getMediaPlugin(); - - if(plugin == NULL) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource == NULL) { if(mPriority == PRIORITY_UNLOADED) { @@ -2887,12 +2958,12 @@ void LLViewerMediaImpl::update() if(!sUpdatedCookies.empty()) { // TODO: Only send cookies to plugins that need them - plugin->set_cookies(sUpdatedCookies); + mMediaSource->set_cookies(sUpdatedCookies); } } - if(plugin == NULL) + if(mMediaSource == NULL) { return; } @@ -2900,24 +2971,24 @@ void LLViewerMediaImpl::update() // Make sure a navigate doesn't happen during the idle -- it can cause mMediaSource to get destroyed, which can cause a crash. setNavigateSuspended(true); - plugin->idle(); + mMediaSource->idle(); setNavigateSuspended(false); - plugin = getMediaPlugin(); - if(plugin == NULL) + mMediaSource = getMediaPlugin(); + if(mMediaSource == NULL) { return; } - if (plugin->isPluginExited()) + if(mMediaSource->isPluginExited()) { resetPreviousMediaState(); destroyMediaSource(); return; } - if (!plugin->textureValid()) + if(!mMediaSource->textureValid()) { return; } @@ -2936,7 +3007,7 @@ void LLViewerMediaImpl::update() // Since we're updating this texture, we know it's playing. Tell the texture to do its replacement magic so it gets rendered. placeholder_image->setPlaying(TRUE); - if (plugin->getDirty(&dirty_rect)) + if(mMediaSource->getDirty(&dirty_rect)) { // Constrain the dirty rect to be inside the texture S32 x_pos = llmax(dirty_rect.mLeft, 0); @@ -2950,29 +3021,29 @@ void LLViewerMediaImpl::update() U8* data = NULL; { LLFastTimer t(FTM_MEDIA_GET_DATA); - data = plugin->getBitsData(); + data = mMediaSource->getBitsData(); } // Offset the pixels pointer to match x_pos and y_pos - data += ( x_pos * plugin->getTextureDepth() * plugin->getBitsWidth() ); - data += ( y_pos * plugin->getTextureDepth() ); + data += ( x_pos * mMediaSource->getTextureDepth() * mMediaSource->getBitsWidth() ); + data += ( y_pos * mMediaSource->getTextureDepth() ); { LLFastTimer t(FTM_MEDIA_SET_SUBIMAGE); placeholder_image->setSubImage( data, - plugin->getBitsWidth(), - plugin->getBitsHeight(), + mMediaSource->getBitsWidth(), + mMediaSource->getBitsHeight(), x_pos, y_pos, width, height, - TRUE); // force a fast update (i.e. don't call analyzeAlpha, etc.) + TRUE); // } } - plugin->resetDirty(); + mMediaSource->resetDirty(); } } } @@ -2995,22 +3066,22 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage() LLViewerMediaTexture* placeholder_image = LLViewerTextureManager::getMediaTexture( mTextureId ); - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); if (mNeedsNewTexture || placeholder_image->getUseMipMaps() - || (placeholder_image->getWidth() != plugin->getTextureWidth()) - || (placeholder_image->getHeight() != plugin->getTextureHeight()) - || (mTextureUsedWidth != plugin->getWidth()) - || (mTextureUsedHeight != plugin->getHeight()) + || (placeholder_image->getWidth() != mMediaSource->getTextureWidth()) + || (placeholder_image->getHeight() != mMediaSource->getTextureHeight()) + || (mTextureUsedWidth != mMediaSource->getWidth()) + || (mTextureUsedHeight != mMediaSource->getHeight()) ) { LL_DEBUGS("Media") << "initializing media placeholder" << LL_ENDL; LL_DEBUGS("Media") << "movie image id " << mTextureId << LL_ENDL; - int texture_width = plugin->getTextureWidth(); - int texture_height = plugin->getTextureHeight(); - int texture_depth = plugin->getTextureDepth(); + int texture_width = mMediaSource->getTextureWidth(); + int texture_height = mMediaSource->getTextureHeight(); + int texture_depth = mMediaSource->getTextureDepth(); // MEDIAOPT: check to see if size actually changed before doing work placeholder_image->destroyGLTexture(); @@ -3026,16 +3097,13 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage() int discard_level = 0; // ask media source for correct GL image format constants - placeholder_image->setExplicitFormat(plugin->getTextureFormatInternal(), - plugin->getTextureFormatPrimary(), - plugin->getTextureFormatType(), - plugin->getTextureFormatSwapBytes()); + placeholder_image->setExplicitFormat(mMediaSource->getTextureFormatInternal(), + mMediaSource->getTextureFormatPrimary(), + mMediaSource->getTextureFormatType(), + mMediaSource->getTextureFormatSwapBytes()); placeholder_image->createGLTexture(discard_level, raw); - // placeholder_image->setExplicitFormat() - //placeholder_image->setUseMipMaps(FALSE); - // MEDIAOPT: set this dynamically on play/stop // FIXME // placeholder_image->mIsMediaTexture = true; @@ -3043,8 +3111,8 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage() // If the amount of the texture being drawn by the media goes down in either width or height, // recreate the texture to avoid leaving parts of the old image behind. - mTextureUsedWidth = plugin->getWidth(); - mTextureUsedHeight = plugin->getHeight(); + mTextureUsedWidth = mMediaSource->getWidth(); + mTextureUsedHeight = mMediaSource->getHeight(); } return placeholder_image; @@ -3060,17 +3128,18 @@ LLUUID LLViewerMediaImpl::getMediaTextureID() const ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::setVisible(bool visible) { - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); mVisible = visible; if(mVisible) { - if(plugin && plugin->isPluginExited()) + if(mMediaSource && mMediaSource->isPluginExited()) { destroyMediaSource(); - plugin = NULL; + mMediaSource = NULL; } - if(!plugin) + + if(!mMediaSource) { createMediaSource(); } @@ -3097,15 +3166,17 @@ void LLViewerMediaImpl::scaleMouse(S32 *mouse_x, S32 *mouse_y) #endif } + + ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMediaImpl::isMediaTimeBased() { bool result = false; - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); - if(plugin) + if(mMediaSource) { - result = plugin->pluginSupportsMediaTime(); + result = mMediaSource->pluginSupportsMediaTime(); } return result; @@ -3115,11 +3186,11 @@ bool LLViewerMediaImpl::isMediaTimeBased() bool LLViewerMediaImpl::isMediaPlaying() { bool result = false; - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); - if(plugin) + if(mMediaSource) { - EMediaStatus status = plugin->getStatus(); + EMediaStatus status = mMediaSource->getStatus(); if(status == MEDIA_PLAYING || status == MEDIA_LOADING) result = true; } @@ -3130,11 +3201,11 @@ bool LLViewerMediaImpl::isMediaPlaying() bool LLViewerMediaImpl::isMediaPaused() { bool result = false; - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); - if(plugin) + if(mMediaSource) { - if(plugin->getStatus() == MEDIA_PAUSED) + if(mMediaSource->getStatus() == MEDIA_PAUSED) result = true; } @@ -3191,13 +3262,13 @@ bool LLViewerMediaImpl::isForcedUnloaded() const { return true; } - + // If this media's class is not supposed to be shown, unload if (!shouldShowBasedOnClass()) { return true; } - + return false; } @@ -3210,32 +3281,25 @@ bool LLViewerMediaImpl::isPlayable() const // All of the forced-unloaded criteria also imply not playable. return false; } - + if(hasMedia()) { // Anything that's already playing is, by definition, playable. return true; } - + if(!mMediaURL.empty()) { // If something has navigated the instance, it's ready to be played. return true; } - + return false; } static void handle_pick_file_request_continued(LLPluginClassMedia* plugin, AIFilePicker* filepicker) { - std::string response; - - if(filepicker->hasFilename()) - { - response = filepicker->getFilename(); - } - - plugin->sendPickFileResponse(response); + plugin->sendPickFileResponse(filepicker->hasFilename() ? filepicker->getFilename() : LLStringUtil::null); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -3486,9 +3550,9 @@ void LLViewerMediaImpl::handleCookieSet(LLPluginClassMedia* self, const std::str void LLViewerMediaImpl::cut() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) - plugin->cut(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) + mMediaSource->cut(); } //////////////////////////////////////////////////////////////////////////////// @@ -3496,9 +3560,9 @@ LLViewerMediaImpl::cut() BOOL LLViewerMediaImpl::canCut() const { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) - return plugin->canCut(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) + return mMediaSource->canCut(); else return FALSE; } @@ -3508,9 +3572,9 @@ LLViewerMediaImpl::canCut() const void LLViewerMediaImpl::copy() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) - plugin->copy(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) + mMediaSource->copy(); } //////////////////////////////////////////////////////////////////////////////// @@ -3518,9 +3582,9 @@ LLViewerMediaImpl::copy() BOOL LLViewerMediaImpl::canCopy() const { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) - return plugin->canCopy(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) + return mMediaSource->canCopy(); else return FALSE; } @@ -3530,9 +3594,9 @@ LLViewerMediaImpl::canCopy() const void LLViewerMediaImpl::paste() { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) - plugin->paste(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) + mMediaSource->paste(); } //////////////////////////////////////////////////////////////////////////////// @@ -3540,9 +3604,9 @@ LLViewerMediaImpl::paste() BOOL LLViewerMediaImpl::canPaste() const { - LLPluginClassMedia* plugin = getMediaPlugin(); - if (plugin) - return plugin->canPaste(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if (mMediaSource) + return mMediaSource->canPaste(); else return FALSE; } @@ -3637,11 +3701,11 @@ F64 LLViewerMediaImpl::getApproximateTextureInterest() { F64 result = 0.0f; - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - result = plugin->getFullWidth(); - result *= plugin->getFullHeight(); + result = mMediaSource->getFullWidth(); + result *= mMediaSource->getFullHeight(); } else { @@ -3678,21 +3742,21 @@ void LLViewerMediaImpl::setBackgroundColor(LLColor4 color) { mBackgroundColor = color; - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->setBackgroundColor(mBackgroundColor); + mMediaSource->setBackgroundColor(mBackgroundColor); } }; F64 LLViewerMediaImpl::getCPUUsage() const { F64 result = 0.0f; - LLPluginClassMedia* plugin = getMediaPlugin(); + LLPluginClassMedia* mMediaSource = getMediaPlugin(); - if(plugin) + if(mMediaSource) { - result = plugin->getCPUUsage(); + result = mMediaSource->getCPUUsage(); } return result; @@ -3725,29 +3789,28 @@ void LLViewerMediaImpl::setPriority(EPriority priority) mPriority = priority; - LLPluginClassMedia* plugin = getMediaPlugin(); - + LLPluginClassMedia* mMediaSource = getMediaPlugin(); if(priority == PRIORITY_UNLOADED) { - if(plugin) + if(mMediaSource) { // Need to unload the media source // First, save off previous media state - mPreviousMediaState = plugin->getStatus(); - mPreviousMediaTime = plugin->getCurrentTime(); + mPreviousMediaState = mMediaSource->getStatus(); + mPreviousMediaTime = mMediaSource->getCurrentTime(); destroyMediaSource(); - plugin = NULL; + mMediaSource = NULL; } } - if(plugin) + if(mMediaSource) { if(mPriority >= PRIORITY_LOW) - plugin->setPriority((LLPluginClassBasic::EPriority)((U32)mPriority-((U32)PRIORITY_LOW-1))); + mMediaSource->setPriority((LLPluginClassBasic::EPriority)((U32)mPriority-((U32)PRIORITY_LOW-1))); else - plugin->setPriority(LLPluginClassBasic::PRIORITY_SLEEP); + mMediaSource->setPriority(LLPluginClassBasic::PRIORITY_SLEEP); } // NOTE: loading (or reloading) media sources whose priority has risen above PRIORITY_UNLOADED is done in update(). @@ -3755,10 +3818,10 @@ void LLViewerMediaImpl::setPriority(EPriority priority) void LLViewerMediaImpl::setLowPrioritySizeLimit(int size) { - LLPluginClassMedia* plugin = getMediaPlugin(); - if(plugin) + LLPluginClassMedia* mMediaSource = getMediaPlugin(); + if(mMediaSource) { - plugin->setLowPrioritySizeLimit(size); + mMediaSource->setLowPrioritySizeLimit(size); } } @@ -3879,16 +3942,10 @@ bool LLViewerMediaImpl::isAutoPlayable() const static const LLCachedControl media_tentative_auto_play("MediaTentativeAutoPlay",false); static const LLCachedControl auto_play_parcel_media(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING,false); static const LLCachedControl auto_play_prim_media(LLViewerMedia::AUTO_PLAY_PRIM_MEDIA_SETTING,false); - if(mMediaAutoPlay && media_tentative_auto_play) - { - if(getUsedInUI()) - return true; - else if(isParcelMedia() && auto_play_parcel_media) - return true; - else if(auto_play_prim_media) - return true; - } - return false; + return mMediaAutoPlay && media_tentative_auto_play && + (getUsedInUI() + || (isParcelMedia() && auto_play_parcel_media) + || auto_play_prim_media); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -3914,18 +3971,18 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const // If it is attached to an avatar and the pref is off, we shouldn't show it if (attached_to_another_avatar) { - static LLCachedControl show_media_on_others(gSavedSettings, LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING); + static LLCachedControl show_media_on_others(gSavedSettings, LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING, false); return show_media_on_others; } if (inside_parcel) { - static LLCachedControl show_media_within_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING); + static LLCachedControl show_media_within_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING, true); return show_media_within_parcel; } else { - static LLCachedControl show_media_outside_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING); + static LLCachedControl show_media_outside_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING, true); return show_media_outside_parcel; } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 902d7ae0f..0a3485ccf 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -56,7 +56,6 @@ class LLMediaEntry; class LLVOVolume; class LLMimeDiscoveryResponder; class LLPluginCookieStore; -class AIHTTPHeaders; typedef LLPointer viewer_media_t; /////////////////////////////////////////////////////////////////////////////// @@ -92,6 +91,7 @@ public: typedef std::list impl_list; typedef std::map impl_id_map; + // Special case early init for just web browser component // so we can show login screen. See .cpp file for details. JC @@ -137,7 +137,7 @@ public: static bool isParcelMediaPlaying(); static bool isParcelAudioPlaying(); - static bool onAuthSubmit(const LLSD& notification, const LLSD& response); + static void onAuthSubmit(const LLSD& notification, const LLSD& response); // Clear all cookies for all plugins static void clearAllCookies(); @@ -169,7 +169,7 @@ public: static void setOnlyAudibleMediaTextureID(const LLUUID& texture_id); - static AIHTTPHeaders getHeaders(); + static class AIHTTPHeaders getHeaders(); private: static void setOpenIDCookie(); @@ -234,6 +234,7 @@ public: void mouseDown(const LLVector2& texture_coords, MASK mask, S32 button = 0); void mouseUp(const LLVector2& texture_coords, MASK mask, S32 button = 0); void mouseMove(const LLVector2& texture_coords, MASK mask); + void mouseDoubleClick(const LLVector2& texture_coords, MASK mask); void mouseDoubleClick(S32 x,S32 y, MASK mask, S32 button = 0); void scrollWheel(S32 x, S32 y, MASK mask); void mouseCapture(); @@ -247,6 +248,7 @@ public: void navigateInternal(); void navigateStop(); bool handleKeyHere(KEY key, MASK mask); + bool handleKeyUpHere(KEY key, MASK mask); bool handleUnicodeCharHere(llwchar uni_char); bool canNavigateForward(); bool canNavigateBack(); @@ -257,6 +259,7 @@ public: void setHomeURL(const std::string& home_url, const std::string& mime_type = LLStringUtil::null) { mHomeURL = home_url; mHomeMimeType = mime_type;}; void clearCache(); void setPageZoomFactor( double factor ); + double getPageZoomFactor() {return mZoomFactor;} std::string getMimeType() { return mMimeType; } void scaleMouse(S32 *mouse_x, S32 *mouse_y); void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index d99a57cd8..f7f579e94 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -351,6 +351,18 @@ BOOL LLViewerMediaFocus::handleKey(KEY key, MASK mask, BOOL called_from_parent) return true; } +BOOL LLViewerMediaFocus::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +{ + LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); + if (media_impl) + { + media_impl->handleKeyUpHere(key, mask); + } + return true; +} + + + BOOL LLViewerMediaFocus::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) { LLViewerMediaImpl* media_impl = getFocusedMediaImpl(); @@ -434,7 +446,6 @@ void LLViewerMediaFocus::update() { mMediaControls.get()->setMediaFace(NULL, 0, NULL); } - } } @@ -603,3 +614,13 @@ LLUUID LLViewerMediaFocus::getControlsMediaID() return LLUUID::null; } + +bool LLViewerMediaFocus::wantsKeyUpKeyDown() const +{ + return true; +} + +bool LLViewerMediaFocus::wantsReturnKey() const +{ + return true; +} diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h index f03dd8751..0b2a64868 100644 --- a/indra/newview/llviewermediafocus.h +++ b/indra/newview/llviewermediafocus.h @@ -56,6 +56,7 @@ public: /*virtual*/ bool getFocus(); /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + /*virtual*/ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); @@ -87,6 +88,10 @@ public: // Return the ID of the media instance the controls are currently attached to (either focus or hover). LLUUID getControlsMediaID(); + // The MoaP object wants keyup and keydown events. Overridden to return true. + virtual bool wantsKeyUpKeyDown() const; + virtual bool wantsReturnKey() const; + protected: /*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusLost(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2608ba7e3..305165524 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -711,6 +711,7 @@ void init_menus() menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle, NULL, NULL)); // Debugging view for unified notifications: CTRL-SHIFT-5 menu->addChild(new LLMenuItemCallGL("Notifications Console...", handle_show_notifications_console, NULL, NULL, '5', MASK_CONTROL|MASK_SHIFT)); + menu->addChild(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml)); gLoginMenuBarView->addChild(menu); menu->updateParent(LLMenuGL::sMenuContainer); @@ -4513,7 +4514,7 @@ static void derez_objects( msg->addU8Fast(_PREHASH_PacketCount, packet_count); msg->addU8Fast(_PREHASH_PacketNumber, packet_number); objects_in_packet = 0; - while((object_index < objectsp->size()) + while((object_index < (S32)objectsp->size()) && (objects_in_packet++ < MAX_ROOTS_PER_PACKET)) { @@ -7306,16 +7307,7 @@ void menu_toggle_double_click_control(void* user_data) { std::string setting(static_cast(user_data)); LLControlVariable* control(gSavedSettings.getControl(setting)); - bool checked = control->get(); - // Doubleclick actions - there can be only one - if (!checked) - { - if (setting == "DoubleClickAutoPilot") - gSavedSettings.setBOOL("DoubleClickTeleport", false); - else if (setting == "DoubleClickTeleport") - gSavedSettings.setBOOL("DoubleClickAutoPilot", false); - } - control->set(!checked); + control->set(!control->get()); } diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 46f942402..f99b3c7be 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -95,9 +95,26 @@ class LLFileEnableSaveAs : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gFloaterView->getFrontmost() && - gFloaterView->getFrontmost()->canSaveAs(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + LLFloater* frontmost = gFloaterView->getFrontmost(); + if (frontmost && frontmost->hasChild("Save Preview As...", true)) // If we're the tearoff. + { + // Get the next frontmost sibling. + const LLView::child_list_const_iter_t kids_end = gFloaterView->endChild(); + LLView::child_list_const_iter_t kid = std::find(gFloaterView->beginChild(), kids_end, frontmost); + if (kids_end != kid) + { + for (++kid; kid != kids_end; ++kid) + { + LLView* viewp = *kid; + if (viewp->getVisible() && !viewp->isDead()) + { + frontmost = static_cast(viewp); + break; + } + } + } + } + gMenuHolder->findControl(userdata["control"].asString())->setValue(frontmost && frontmost->canSaveAs()); return true; } }; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d2fdcb6fa..f51932041 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -126,7 +126,7 @@ #include "hippogridmanager.h" #include "hippolimits.h" #include "hippofloaterxml.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "m7wlinterface.h" #include "llgiveinventory.h" @@ -1727,56 +1727,81 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& return false; } +bool has_spam_bypass(bool is_friend, bool is_owned_by_me) +{ + static LLCachedControl antispam_not_mine(gSavedSettings,"AntiSpamNotMine"); + static LLCachedControl antispam_not_friend(gSavedSettings,"AntiSpamNotFriend"); + return (antispam_not_mine && is_owned_by_me) || (antispam_not_friend && is_friend); +} + void script_msg_api(const std::string& msg); bool is_spam_filtered(const EInstantMessage& dialog, bool is_friend, bool is_owned_by_me) { - // First, check the master filter + // First, check that this doesn't bypass. + if (has_spam_bypass(is_friend, is_owned_by_me)) return false; + + // Second, check the master filter static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); if (antispam) return true; - // Second, check if this dialog type is even being filtered + // Third, check if this dialog type is even being filtered switch(dialog) { case IM_GROUP_NOTICE: case IM_GROUP_NOTICE_REQUESTED: - if (!gSavedSettings.getBOOL("AntiSpamGroupNotices")) return false; + { + static LLCachedControl filter(gSavedSettings, "AntiSpamGroupNotices"); + if (!filter) return false; break; + } case IM_GROUP_INVITATION: - if (!gSavedSettings.getBOOL("AntiSpamGroupInvites")) return false; + { + static LLCachedControl filter(gSavedSettings, "AntiSpamGroupInvites"); + if (!filter) return false; break; + } case IM_INVENTORY_OFFERED: case IM_TASK_INVENTORY_OFFERED: - if (!gSavedSettings.getBOOL("AntiSpamItemOffers")) return false; + { + static LLCachedControl filter(gSavedSettings, "AntiSpamItemOffers"); + if (!filter) return false; break; + } case IM_FROM_TASK_AS_ALERT: - if (!gSavedSettings.getBOOL("AntiSpamAlerts")) return false; + { + static LLCachedControl filter(gSavedSettings, "AntiSpamAlerts"); + if (!filter) return false; break; + } case IM_LURE_USER: - if (!gSavedSettings.getBOOL("AntiSpamTeleports")) return false; + { + static LLCachedControl filter(gSavedSettings, "AntiSpamTeleports"); + if (!filter) return false; break; + } case IM_TELEPORT_REQUEST: - if (!gSavedSettings.getBOOL("AntiSpamTeleportRequests")) return false; + { + static LLCachedControl filter(gSavedSettings, "AntiSpamTeleportRequests"); + if (!filter) return false; break; + } case IM_FRIENDSHIP_OFFERED: - if (!gSavedSettings.getBOOL("AntiSpamFriendshipOffers")) return false; + { + static LLCachedControl filter(gSavedSettings, "AntiSpamFriendshipOffers"); + if (!filter) return false; break; + } case IM_COUNT: + { // Bit of a hack, we should never get here unless we did this on purpose, though, doesn't matter because we'd do nothing anyway - if (!gSavedSettings.getBOOL("AntiSpamScripts")) return false; + static LLCachedControl filter(gSavedSettings, "AntiSpamScripts"); + if (!filter) return false; break; + } default: return false; } - // Third, possibly filtered, check the filter bypasses - static LLCachedControl antispam_not_mine(gSavedSettings,"AntiSpamNotMine"); - if (antispam_not_mine && is_owned_by_me) - return false; - - static LLCachedControl antispam_not_friend(gSavedSettings,"AntiSpamNotFriend"); - if (antispam_not_friend && is_friend) - return false; - // Last, definitely filter return true; } @@ -2006,24 +2031,35 @@ static bool parse_lure_bucket(const std::string& bucket, tokenizer tokens(bucket, sep); tokenizer::iterator iter = tokens.begin(); - S32 e[8]; + S32 gx,gy,rx,ry,rz,lx,ly,lz; try { - for (int i = 0; i < 8 && iter != tokens.end(); ++i) - { - e[i] = boost::lexical_cast((*(iter++)).c_str()); - } + gx = std::stoi(*(iter)); + gy = std::stoi(*(++iter)); + rx = std::stoi(*(++iter)); + ry = std::stoi(*(++iter)); + rz = std::stoi(*(++iter)); + lx = std::stoi(*(++iter)); + ly = std::stoi(*(++iter)); + lz = std::stoi(*(++iter)); } - catch( boost::bad_lexical_cast& ) + catch( const std::invalid_argument& ) { LL_WARNS("parse_lure_bucket") - << "Couldn't parse lure bucket with content \"" << bucket << "\"." + << "Couldn't parse lure bucket." + << LL_ENDL; + return false; + } + catch( const std::out_of_range& ) + { + LL_WARNS("parse_lure_bucket") + << "Couldn't parse lure bucket." << LL_ENDL; return false; } // Grab region access region_access = SIM_ACCESS_MIN; - if (iter != tokens.end()) + if (++iter != tokens.end()) { std::string access_str((*iter).c_str()); LLStringUtil::trim(access_str); @@ -2041,10 +2077,10 @@ static bool parse_lure_bucket(const std::string& bucket, } } - pos.setVec((F32)e[2], (F32)e[3], (F32)e[4]); - look_at.setVec((F32)e[5], (F32)e[6], (F32)e[7]); + pos.setVec((F32)rx, (F32)ry, (F32)rz); + look_at.setVec((F32)lx, (F32)ly, (F32)lz); - region_handle = to_region_handle(e[0], e[1]); + region_handle = to_region_handle(gx, gy); return true; } @@ -2157,32 +2193,29 @@ void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string m } -// Replace wild cards in autoresponse messages -std::string replace_wildcards(std::string autoresponse, const LLUUID& id, const std::string& name) +// Replace wild cards in message strings +std::string replace_wildcards(std::string input, const LLUUID& id, const std::string& name) { - // Add in their legacy name - boost::algorithm::replace_all(autoresponse, "#n", name); + boost::algorithm::replace_all(input, "#n", name); LLSLURL slurl; LLAgentUI::buildSLURL(slurl); + boost::algorithm::replace_all(input, "#r", slurl.getSLURLString()); - // Add in our location's slurl - boost::algorithm::replace_all(autoresponse, "#r", slurl.getSLURLString()); - - // Add in their display name LLAvatarName av_name; - boost::algorithm::replace_all(autoresponse, "#d", LLAvatarNameCache::get(id, &av_name) ? av_name.getDisplayName() : name); + boost::algorithm::replace_all(input, "#d", LLAvatarNameCache::get(id, &av_name) ? av_name.getDisplayName() : name); - if (!isAgentAvatarValid()) return autoresponse; - // Add in idle time - LLStringUtil::format_map_t args; - args["[MINS]"] = boost::lexical_cast(gAgentAvatarp->mIdleTimer.getElapsedTimeF32()/60); - boost::algorithm::replace_all(autoresponse, "#i", LLTrans::getString("IM_autoresponse_minutes", args)); + if (isAgentAvatarValid()) + { + LLStringUtil::format_map_t args; + args["[MINS]"] = boost::lexical_cast(gAgentAvatarp->mIdleTimer.getElapsedTimeF32()/60); + boost::algorithm::replace_all(input, "#i", LLTrans::getString("IM_autoresponse_minutes", args)); + } - return autoresponse; + return input; } -void autoresponder_finish(bool show_autoresponded, const LLUUID& computed_session_id, const LLUUID& from_id, const std::string& name, const LLUUID& itemid, bool is_muted) +void autoresponder_finish(bool show_autoresponded, const LLUUID& session_id, const LLUUID& from_id, const std::string& name, const LLUUID& itemid, bool is_muted) { LLAvatarName av_name; const std::string ns_name(LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name); @@ -2190,15 +2223,15 @@ void autoresponder_finish(bool show_autoresponded, const LLUUID& computed_sessio if (show_autoresponded) { const std::string notice(LLTrans::getString("IM_autoresponded_to") + ' ' + ns_name); - is_muted ? cmdline_printchat(notice) : gIMMgr->addMessage(computed_session_id, from_id, name, notice); + is_muted ? cmdline_printchat(notice) : gIMMgr->addMessage(session_id, from_id, name, notice); } if (LLViewerInventoryItem* item = gInventory.getItem(itemid)) { - LLGiveInventory::doGiveInventoryItem(from_id, item, computed_session_id); + LLGiveInventory::doGiveInventoryItem(from_id, item, session_id); if (show_autoresponded) { const std::string notice(llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); - is_muted ? cmdline_printchat(notice) : gIMMgr->addMessage(computed_session_id, from_id, name, notice); + is_muted ? cmdline_printchat(notice) : gIMMgr->addMessage(session_id, from_id, name, notice); } } } @@ -2290,15 +2323,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // bool is_do_not_disturb = gAgent.isDoNotDisturb(); - BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat) + bool is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat) // object IMs contain sender object id in session_id (STORM-1209) - || dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id); - BOOL is_linden = LLMuteList::getInstance()->isLinden(name); - BOOL is_owned_by_me = FALSE; - BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true; - BOOL accept_im_from_only_friend = gSavedSettings.getBOOL("InstantMessagesFriendsOnly"); - - LLUUID computed_session_id = LLIMMgr::computeSessionID(dialog,from_id); + || (dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id)); + bool is_owned_by_me = false; + bool is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true; + bool accept_im_from_only_friend = gSavedSettings.getBOOL("InstantMessagesFriendsOnly"); + bool is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && + LLMuteList::getInstance()->isLinden(name); chat.mMuted = is_muted && !is_linden; chat.mFromID = from_id; @@ -2334,10 +2366,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } // These bools are here because they would make mess of logic down below in IM_NOTHING_SPECIAL. - bool autorespond_status = gAgent.getAFK() || !gSavedPerAccountSettings.getBOOL("AutoresponseOnlyIfAway") || gSavedSettings.getBOOL("FakeAway"); - bool is_autorespond = !is_muted && autorespond_status && (is_friend || !gSavedPerAccountSettings.getBOOL("AutoresponseAnyoneFriendsOnly")) && gSavedPerAccountSettings.getBOOL("AutoresponseAnyone"); - bool is_autorespond_muted = is_muted && gSavedPerAccountSettings.getBOOL("AutoresponseMuted"); - bool is_autorespond_nonfriends = !is_friend && !is_muted && autorespond_status && gSavedPerAccountSettings.getBOOL("AutoresponseNonFriends"); + static LLCachedControl sAutorespond(gSavedPerAccountSettings, "AutoresponseAnyone", false); + static LLCachedControl sAutorespondFriendsOnly(gSavedPerAccountSettings, "AutoresponseAnyoneFriendsOnly", false); + static LLCachedControl sAutorespondAway(gSavedPerAccountSettings, "AutoresponseOnlyIfAway", false); + static LLCachedControl sAutorespondNonFriend(gSavedPerAccountSettings, "AutoresponseNonFriends", false); + static LLCachedControl sAutorespondMuted(gSavedPerAccountSettings, "AutoresponseMuted", false); + static LLCachedControl sAutorespondRepeat(gSavedPerAccountSettings, "AscentInstantMessageResponseRepeat", false); + static LLCachedControl sFakeAway(gSavedSettings, "FakeAway", false); + bool autorespond_status = !sAutorespondAway || sFakeAway || gAgent.getAFK(); + bool is_autorespond = !is_muted && autorespond_status && (is_friend || !sAutorespondFriendsOnly) && sAutorespond; + bool is_autorespond_muted = is_muted && sAutorespondMuted; + bool is_autorespond_nonfriends = !is_friend && !is_muted && autorespond_status && sAutorespondNonFriend; LLSD args; switch(dialog) @@ -2350,7 +2389,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLNotificationsUtil::add("SystemMessageTip",args); break; - case IM_NOTHING_SPECIAL: + case IM_NOTHING_SPECIAL: // p2p IM // Don't show dialog, just do IM if (!gAgent.isGodlike() && gAgent.getRegion()->isPrelude() @@ -2369,35 +2408,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) gIMMgr->processIMTypingStop(im_info); } // [/RLVa:KB] -// else if (offline == IM_ONLINE -// && is_do_not_disturb -// && !is_muted // Singu Note: Never if muted -// && from_id.notNull() //not a system message -// && to_id.notNull()) //not global message -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) else if (offline == IM_ONLINE && is_do_not_disturb - && !is_muted // Singu Note: Never if muted + && !is_muted // Note: Never if muted && from_id.notNull() //not a system message && to_id.notNull() //not global message +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) && RlvActions::canReceiveIM(from_id)) // [/RLVa:KB] { - // return a standard "do not disturb" message, but only do it to online IM - // (i.e. not other auto responses and not store-and-forward IM) - if (!gIMMgr->hasSession(session_id) || gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat")) - { - // if the user wants to repeat responses over and over or - // if there is not a panel for this conversation (i.e. it is a new IM conversation - // initiated by the other party) then... - send_do_not_disturb_message(msg, from_id, session_id); - } - // now store incoming IM in chat history buffer = separator_string + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; script_msg_api(from_id.asString() + ", 0"); + // add to IM panel, but do not bother the user gIMMgr->addMessage( session_id, @@ -2414,23 +2439,35 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // pretend this is chat generated by self, so it does not show up on screen chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset); LLFloaterChat::addChat(chat, true, true); + + if (sAutorespondRepeat || !gIMMgr->hasSession(session_id)) + { + // if the user wants to repeat responses over and over or + // if there is not a panel for this conversation (i.e. it is a new IM conversation + // initiated by the other party) then... + // return a standard "do not disturb" message, but only do it to online IM + // (i.e. not other auto responses and not store-and-forward IM) + send_do_not_disturb_message(msg, from_id, session_id); + } + } -// else if (offline == IM_ONLINE && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && from_id.notNull() && to_id.notNull()) + else if (offline == IM_ONLINE + && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) + && from_id.notNull() //not a system message + && to_id.notNull() //not global message // [RLVa:LF] - Same as above: Checked: 2010-11-30 (RLVa-1.3.0) - else if (offline == IM_ONLINE && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && from_id.notNull() && to_id.notNull() && RlvActions::canReceiveIM(from_id) && RlvActions::canSendIM(from_id)) + && RlvActions::canReceiveIM(from_id) && RlvActions::canSendIM(from_id)) // [/RLVa:LF] { - // now store incoming IM in chat history - buffer = separator_string + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; if (!is_muted) script_msg_api(from_id.asString() + ", 0"); - bool send_autoresponse = !gIMMgr->hasSession(session_id) || gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat"); + + bool send_response = !gIMMgr->hasSession(session_id) || sAutorespondRepeat; // add to IM panel, but do not bother the user - gIMMgr->addMessage( - session_id, + gIMMgr->addMessage(session_id, from_id, name, buffer, @@ -2445,9 +2482,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset); LLFloaterChat::addChat( chat, TRUE, TRUE ); - // return a standard "busy" message, but only do it to online IM - // (i.e. not other auto responses and not store-and-forward IM) - if (send_autoresponse) + if (send_response) { // if there is not a panel for this conversation (i.e. it is a new IM conversation // initiated by the other party) then... @@ -2490,9 +2525,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) session_id); gAgent.sendReliableMessage(); - autoresponder_finish(show_autoresponded, computed_session_id, from_id, name, itemid, is_muted); + autoresponder_finish(show_autoresponded, session_id, from_id, name, itemid, is_muted); } - // We stored the incoming IM in history before autoresponding, logically. } else if (from_id.isNull()) { @@ -2572,7 +2606,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLFloaterChat::addChat(chat, true, true); // Autoresponse to muted avatars - if (!gIMMgr->isNonFriendSessionNotified(session_id) && gSavedPerAccountSettings.getBOOL("AutoresponseMuted")) + if (!gIMMgr->isNonFriendSessionNotified(session_id) && sAutorespondMuted) { std::string my_name; LLAgentUI::buildFullname(my_name); @@ -2588,7 +2622,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) IM_BUSY_AUTO_RESPONSE, session_id); gAgent.sendReliableMessage(); - autoresponder_finish(gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"), computed_session_id, from_id, name, gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem") ? static_cast(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")) : LLUUID::null, true); + autoresponder_finish(gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"), session_id, from_id, name, gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem") ? static_cast(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")) : LLUUID::null, true); } } } @@ -2596,14 +2630,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_TYPING_START: { + static LLCachedControl sNotifyIncomingMessage(gSavedSettings, "AscentInstantMessageAnnounceIncoming"); // Don't announce that someone has started messaging, if they're muted or when in busy mode - if (!is_muted && (!accept_im_from_only_friend || is_friend) && !is_do_not_disturb && !gIMMgr->hasSession(computed_session_id) && gSavedSettings.getBOOL("AscentInstantMessageAnnounceIncoming")) + if (sNotifyIncomingMessage && + ((accept_im_from_only_friend && (is_friend || is_linden)) || + (!(is_muted || is_do_not_disturb))) && + !gIMMgr->hasSession(session_id) + ) { LLAvatarName av_name; std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name; - gIMMgr->addMessage( - computed_session_id, + gIMMgr->addMessage(session_id, from_id, name, llformat("%s ", ns_name.c_str()) + LLTrans::getString("IM_announce_incoming"), @@ -2617,7 +2655,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // This block is very similar to the one above, but is necessary, since a session is opened to announce incoming message.. // In order to prevent doubling up on the first response, We neglect to send this if Repeat for each message is on. - if ((is_autorespond_nonfriends || is_autorespond) && !gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat")) + if ((is_autorespond_nonfriends || is_autorespond) && !sAutorespondRepeat) { std::string my_name; LLAgentUI::buildFullname(my_name); @@ -2641,7 +2679,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) pack_instant_message(gMessageSystem, gAgentID, false, gAgentSessionID, from_id, my_name, replace_wildcards(response, from_id, name), IM_ONLINE, IM_BUSY_AUTO_RESPONSE, session_id); gAgent.sendReliableMessage(); - autoresponder_finish(show_autoresponded, computed_session_id, from_id, name, itemid, is_muted); + autoresponder_finish(show_autoresponded, session_id, from_id, name, itemid, is_muted); } } LLPointer im_info = new LLIMInfo(gMessageSystem); @@ -2694,7 +2732,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // The group notice packet does not have an AgentID. Obtain one from the name cache. // If last name is "Resident" strip it out so the cache name lookup works. - U32 index = original_name.find(" Resident"); + size_t index = original_name.find(" Resident"); if (index != std::string::npos) { original_name = original_name.substr(0, index); @@ -3462,21 +3500,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } LLWindow* viewer_window = gViewerWindow->getWindow(); - if (viewer_window && viewer_window->getMinimized()) + if (viewer_window && viewer_window->getMinimized() && gSavedSettings.getBOOL("LiruFlashWhenMinimized")) { viewer_window->flashIcon(5.f); } } -void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id) +void send_do_not_disturb_message(LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id) { if (gAgent.isDoNotDisturb()) { std::string my_name; LLAgentUI::buildFullname(my_name); - std::string from_name; - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, from_name); - from_name = LLCacheName::cleanFullName(from_name); + std::string name; + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name); + name = LLCacheName::cleanFullName(name); std::string response = gSavedPerAccountSettings.getString("BusyModeResponse"); pack_instant_message( msg, @@ -3485,24 +3523,20 @@ void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, c gAgent.getSessionID(), from_id, my_name, - replace_wildcards(response, from_id, from_name), + replace_wildcards(response, from_id, name), IM_ONLINE, - IM_BUSY_AUTO_RESPONSE); + IM_BUSY_AUTO_RESPONSE, + session_id); gAgent.sendReliableMessage(); LLAvatarName av_name; - std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : from_name; - LLUUID session_id; - msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id); - if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) gIMMgr->addMessage(session_id, from_id, from_name, LLTrans::getString("IM_autoresponded_to") + ' ' + ns_name); + std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name; + if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) gIMMgr->addMessage(session_id, from_id, name, LLTrans::getString("IM_autoresponded_to") + ' ' + ns_name); if (!gSavedPerAccountSettings.getBOOL("BusyModeResponseItem")) return; // Not sending an item, finished if (LLViewerInventoryItem* item = gInventory.getItem(static_cast(gSavedPerAccountSettings.getString("BusyModeResponseItemID")))) { - U8 d; - msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Dialog, d); - LLUUID computed_session_id = LLIMMgr::computeSessionID(static_cast(d), from_id); - LLGiveInventory::doGiveInventoryItem(from_id, item, computed_session_id); + LLGiveInventory::doGiveInventoryItem(from_id, item, session_id); if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) - gIMMgr->addMessage(computed_session_id, from_id, from_name, llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); + gIMMgr->addMessage(session_id, from_id, name, llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); } } } @@ -3845,7 +3879,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // hello from object if (from_id.isNull()) return; char buf[200]; - snprintf(buf, 200, "%s v%d.%d.%d", gVersionChannel, gVersionMajor, gVersionMinor, gVersionPatch); + snprintf(buf, 200, "%s v%d.%d.%d", LLVersionInfo::getChannel().c_str(), LLVersionInfo::getMajor(), LLVersionInfo::getMinor(), LLVersionInfo::getPatch()); send_chat_from_viewer(buf, CHAT_TYPE_WHISPER, 427169570); sChatObjectAuth[from_id] = 1; return; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 0f4f433d5..331fe0c51 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1822,7 +1822,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, LLVector3 diff = new_pos_parent - test_pos_parent ; F32 mag_sqr = diff.magVecSquared() ; - if(llfinite(mag_sqr)) + if(std::isfinite(mag_sqr)) { setPositionParent(new_pos_parent); } diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 6d3dafe58..ab3c9b3ac 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -48,15 +48,15 @@ class LLCamera; class LLNetMap; class LLDebugBeacon; -const U32 CLOSE_BIN_SIZE = 10; -const U32 NUM_BINS = 128; +constexpr U32 CLOSE_BIN_SIZE = 10; +constexpr U32 NUM_BINS = 128; // GL name = position in object list + GL_NAME_INDEX_OFFSET so that // we can have special numbers like zero. -const U32 GL_NAME_LAND = 0; -const U32 GL_NAME_PARCEL_WALL = 1; +constexpr U32 GL_NAME_LAND = 0; +constexpr U32 GL_NAME_PARCEL_WALL = 1; -const U32 GL_NAME_INDEX_OFFSET = 10; +constexpr U32 GL_NAME_INDEX_OFFSET = 10; class LLViewerObjectList { diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 3a9570710..b9520932d 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -33,7 +33,10 @@ #include "llparcelselection.h" #include "llui.h" +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #include class LLUUID; diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 187e71a72..466c69b28 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -41,20 +41,15 @@ #include "linden_common.h" -// We may want to take the windows.h include out, but it used to be in -// linden_common.h, and hence in all the libraries. This is better. JC -#if LL_WINDOWS - // Limit Windows API to small and manageable set. - // If you get undefined symbols, find the appropriate - // Windows header file and include that in your .cpp file. - #define WIN32_LEAN_AND_MEAN - #include - #include -#endif - -// Work around stupid Microsoft STL warning -#ifdef LL_WINDOWS -#pragma warning (disable : 4702) // warning C4702: unreachable code +// We may want to take the windows.h include out, but it used to be in +// linden_common.h, and hence in all the libraries. This is better. JC +#if LL_WINDOWS + // Limit Windows API to small and manageable set. + // If you get undefined symbols, find the appropriate + // Windows header file and include that in your .cpp file. +#define WIN32_LEAN_AND_MEAN +#include +#include #endif #include diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0f22d1efd..842da8025 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1286,10 +1286,11 @@ public: S32 target_index = input["body"]["Index"][0]["Prey"].asInteger(); S32 you_index = input["body"]["Index"][0]["You" ].asInteger(); - std::vector* avatar_locs = ®ion->mMapAvatars; - std::vector* avatar_ids = ®ion->mMapAvatarIDs; - avatar_locs->clear(); - avatar_ids->clear(); + std::vector& avatar_locs = region->mMapAvatars; + std::vector& avatar_ids = region->mMapAvatarIDs; + std::list map_avids(avatar_ids.begin(), avatar_ids.end()); + avatar_locs.clear(); + avatar_ids.clear(); //LL_INFOS() << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << LL_ENDL; //LL_INFOS() << "my agent id = " << gAgent.getID() << LL_ENDL; @@ -1329,13 +1330,14 @@ public: pos |= y; pos <<= 8; pos |= z; - avatar_locs->push_back(pos); + avatar_locs.push_back(pos); //LL_INFOS() << "next pos: " << x << "," << y << "," << z << ": " << pos << LL_ENDL; if(has_agent_data) // for backwards compatibility with old message format { LLUUID agent_id(agents_it->get("AgentID").asUUID()); //LL_INFOS() << "next agent: " << agent_id.asString() << LL_ENDL; - avatar_ids->push_back(agent_id); + avatar_ids.push_back(agent_id); + map_avids.remove(agent_id); } } if (has_agent_data) @@ -1343,6 +1345,12 @@ public: agents_it++; } } + if (LLFloaterAvatarList::instanceExists()) + { + LLFloaterAvatarList& inst(LLFloaterAvatarList::instance()); + inst.updateAvatarList(region); + inst.expireAvatarList(map_avids); + } } }; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 3ff7a33e0..41cf0f276 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -51,6 +51,7 @@ #include "llagentcamera.h" #include "llviewercontrol.h" #include "llfloaterdirectory.h" +#include "llversioninfo.h" #include "llfloatertools.h" #include "lldebugview.h" #include "llfasttimerview.h" @@ -780,7 +781,7 @@ void send_stats() // send fps only for time app spends in foreground agent["fps"] = (F32)gForegroundFrameCount / gForegroundTime.getElapsedTimeF32(); - agent["version"] = gCurrentVersion; + agent["version"] = LLVersionInfo::getChannelAndVersion(); std::string language = LLUI::getLanguage(); agent["language"] = language; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index a5ec4c9a7..d67fc1e08 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -171,6 +171,20 @@ void LLViewerTextureList::doPreloadImages() image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } + image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, + 0,0,LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); + if (image) + { + image->setAddressMode(LLTexUnit::TAM_WRAP); + mImagePreloads.insert(image); + } + image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, + 0,0,LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); + if (image) + { + image->setAddressMode(LLTexUnit::TAM_WRAP); + mImagePreloads.insert(image); + } //Hideous hack to set filtering and address modes without messing with our texture classes. { LLPointer temp_image = image_list->getUIImage("checkerboard.tga",LLViewerFetchedTexture::BOOST_UI); diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 1f8add5c2..71bf61541 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -42,7 +42,6 @@ #include "llinventoryfunctions.h" #include "lllocaltextureobject.h" #include "llpaneleditwearable.h" -#include "aixmllindengenepool.h" using namespace LLAvatarAppearanceDefines; @@ -136,7 +135,7 @@ LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_st return result; } - +#if 0 AIArchetype LLViewerWearable::getArchetype(void) const { AIArchetype archetype(this); @@ -150,7 +149,7 @@ AIArchetype LLViewerWearable::getArchetype(void) const } return archetype; } - +#endif // Avatar parameter and texture definitions can change over time. // This function returns true if parameters or textures have been added or removed // since this wearable was created. @@ -600,18 +599,7 @@ void LLViewerWearable::saveNewAsset() const //LL_INFOS() << *this << LL_ENDL; const std::string filename = asset_id_to_filename(mAssetID); - LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ - BOOL successful_save = FALSE; - if(fp && exportFile(fp)) - { - successful_save = TRUE; - } - if(fp) - { - fclose(fp); - fp = NULL; - } - if(!successful_save) + if(! exportFile(filename)) { std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); LL_WARNS() << buffer << LL_ENDL; diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index 3f5d8ec17..245753865 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -29,7 +29,6 @@ #include "llwearable.h" #include "llavatarappearancedefines.h" -#include "aixmllindengenepool.h" class LLVOAvatar; class LLAPRFile; @@ -69,7 +68,9 @@ public: /*virtual*/ EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ); // Singu extension. +#if 0 AIArchetype getArchetype(void) const; +#endif void setParamsToDefaults(); void setTexturesToDefaults(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 4a896285f..1b753104e 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1362,7 +1362,11 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated) // it's all entered/processed. if (key == KEY_RETURN && mask == MASK_NONE) { - return FALSE; + // RIDER: although, at times some of the controlls (in particular the CEF viewer + // would like to know about the KEYDOWN for an enter key... so ask and pass it along. + LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); + if (keyboard_focus && !keyboard_focus->wantsReturnKey()) + return FALSE; } return gViewerKeyboard.handleKey(key, mask, repeated); @@ -1380,10 +1384,9 @@ BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask) tool_inspectp->keyUp(key, mask); } - return FALSE; + return gViewerKeyboard.handleKeyUp(key, mask); } - void LLViewerWindow::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) { LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); @@ -2681,6 +2684,46 @@ void LLViewerWindow::draw() #endif } +// Takes a single keyup event, usually when UI is visible +BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask) +{ + LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); + + if (keyboard_focus + && !(mask & (MASK_CONTROL | MASK_ALT)) + && !gFocusMgr.getKeystrokesOnly()) + { + // We have keyboard focus, and it's not an accelerator + if (keyboard_focus && keyboard_focus->wantsKeyUpKeyDown()) + { + return keyboard_focus->handleKeyUp(key, mask, FALSE); + } + else if (key < 0x80) + { + // Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first. + return (gFocusMgr.getKeyboardFocus() != NULL); + } + } + + if (keyboard_focus) + { + if (keyboard_focus->handleKeyUp(key, mask, FALSE)) + { + LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned true" << LL_ENDL; + //LLViewerEventRecorder::instance().logKeyEvent(key, mask); + return TRUE; + } + else { + LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned FALSE" << LL_ENDL; + } + } + + // don't pass keys on to world when something in ui has focus + return gFocusMgr.childHasKeyboardFocus(mRootView) + || LLMenuGL::getKeyboardMode() + || (gMenuBarView && gMenuBarView->getHighlightedItem() && gMenuBarView->getHighlightedItem()->isActive()); +} + // Takes a single keydown event, usually when UI is visible BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { @@ -2699,7 +2742,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) && !gFocusMgr.getKeystrokesOnly()) { // We have keyboard focus, and it's not an accelerator - if (key < 0x80) + if (gFocusMgr.getKeyboardFocus() && gFocusMgr.getKeyboardFocus()->wantsKeyUpKeyDown()) + { + return gFocusMgr.getKeyboardFocus()->handleKey(key, mask, FALSE ); + } + else if (key < 0x80) { // Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first. return (gFocusMgr.getKeyboardFocus() != NULL); diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 7e47a1a1b..437dd874b 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -292,6 +292,7 @@ public: void updateKeyboardFocus(); BOOL handleKey(KEY key, MASK mask); + BOOL handleKeyUp(KEY key, MASK mask); void handleScrollWheel (S32 clicks); // Hide normal UI when a logon fails, re-show everything when logon is attempted again diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp index cccd389da..d570428bd 100644 --- a/indra/newview/llvlmanager.cpp +++ b/indra/newview/llvlmanager.cpp @@ -46,7 +46,7 @@ LLVLManager gVLManager; LLVLManager::~LLVLManager() { - S32 i; + U32 i; for (i = 0; i < mPacketData.size(); i++) { delete mPacketData[i]; @@ -95,7 +95,7 @@ void LLVLManager::unpackData(const S32 num_packets) { static LLFrameTimer decode_timer; - S32 i; + U32 i; for (i = 0; i < mPacketData.size(); i++) { LLVLData *datap = mPacketData[i]; @@ -163,7 +163,7 @@ S32 LLVLManager::getTotalBytes() const void LLVLManager::cleanupData(LLViewerRegion *regionp) { - S32 cur = 0; + U32 cur = 0; while (cur < mPacketData.size()) { if (mPacketData[cur]->mRegionp == regionp) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 56cf792fd..61c6f3fdf 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -111,7 +111,7 @@ #include "llsdutil.h" #include "llfloaterexploreanimations.h" -#include "aixmllindengenepool.h" +//#include "aixmllindengenepool.h" #include "aifile.h" #include "llavatarname.h" @@ -8670,6 +8670,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara void LLVOAvatar::dumpArchetypeXML_cont(std::string const& fullpath, bool group_by_wearables) { +#if 0 try { AIFile outfile(fullpath, "wb"); @@ -8745,6 +8746,7 @@ void LLVOAvatar::dumpArchetypeXML_cont(std::string const& fullpath, bool group_b { AIAlert::add_modal("AIXMLdumpArchetypeXMLError", AIArgs("[FILE]", fullpath), error); } +#endif } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e0e998d49..46b991c9e 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2648,7 +2648,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const if (items.size()) { // search for full permissions version - for (S32 i = 0; i < items.size(); i++) + for (U32 i = 0; i < items.size(); i++) { LLViewerInventoryItem* itemp = items[i]; if (itemp->getIsFullPerm()) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 1563c3f16..63735252d 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -3912,7 +3912,7 @@ void LLVivoxVoiceClient::sessionState::removeParticipant(const std::string& uri) vector_replace_with_last(mParticipantList, iter); if (mParticipantList.empty() || mParticipantList.capacity() - mParticipantList.size() > 16) { - vector_shrink_to_fit(mParticipantList); + mParticipantList.shrink_to_fit(); } mParticipantsChanged = true; LL_DEBUGS("Voice") << "participant \"" << uri << "\" (" << iter->mAvatarID << ") removed." << LL_ENDL; @@ -3929,7 +3929,7 @@ void LLVivoxVoiceClient::sessionState::removeAllParticipants() // Singu Note: mParticipantList has replaced both mParticipantsByURI and mParticipantsByUUID, meaning we don't have two maps to maintain any longer. mParticipantList.clear(); - vector_shrink_to_fit(mParticipantList); + mParticipantList.shrink_to_fit(); } void LLVivoxVoiceClient::getParticipantList(std::set &participants) diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 9ec279d7e..fda546b19 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -408,8 +408,8 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) else inv_camera_dist_squared = 1.f; - llassert(llfinite(inv_camera_dist_squared)); - llassert(!llisnan(inv_camera_dist_squared)); + llassert(std::isfinite(inv_camera_dist_squared)); + llassert(!std::isnan(inv_camera_dist_squared)); F32 area = part->mScale.mV[0] * part->mScale.mV[1] * inv_camera_dist_squared; tot_area = llmax(tot_area, area); diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index 2a150eccb..b2ed8f42f 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -42,28 +42,28 @@ // Will clean these up at some point... // -const F32 HORIZON_DIST = 1024.0f; -const F32 SKY_BOX_MULT = 16.0f; -const F32 HEAVENLY_BODY_DIST = HORIZON_DIST - 10.f; -const F32 HEAVENLY_BODY_FACTOR = 0.1f; -const F32 HEAVENLY_BODY_SCALE = HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR; -const F32 EARTH_RADIUS = 6.4e6f; // exact radius = 6.37 x 10^6 m -const F32 ATM_EXP_FALLOFF = 0.000126f; -const F32 ATM_SEA_LEVEL_NDENS = 2.55e25f; +constexpr F32 HORIZON_DIST = 1024.0f; +constexpr F32 SKY_BOX_MULT = 16.0f; +constexpr F32 HEAVENLY_BODY_DIST = HORIZON_DIST - 10.f; +constexpr F32 HEAVENLY_BODY_FACTOR = 0.1f; +constexpr F32 HEAVENLY_BODY_SCALE = HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR; +constexpr F32 EARTH_RADIUS = 6.4e6f; // exact radius = 6.37 x 10^6 m +constexpr F32 ATM_EXP_FALLOFF = 0.000126f; +constexpr F32 ATM_SEA_LEVEL_NDENS = 2.55e25f; // Somewhat arbitrary: -const F32 ATM_HEIGHT = 100000.f; +constexpr F32 ATM_HEIGHT = 100000.f; -const F32 FIRST_STEP = 5000.f; -const F32 INV_FIRST_STEP = 1.f/FIRST_STEP; -const S32 NO_STEPS = 15; -const F32 INV_NO_STEPS = 1.f/NO_STEPS; +constexpr F32 FIRST_STEP = 5000.f; +constexpr F32 INV_FIRST_STEP = 1.f/FIRST_STEP; +constexpr S32 NO_STEPS = 15; +constexpr F32 INV_NO_STEPS = 1.f/NO_STEPS; // constants used in calculation of scattering coeff of clear air -const F32 sigma = 0.035f; -const F32 fsigma = (6.f + 3.f * sigma) / (6.f-7.f*sigma); -const F64 Ndens = 2.55e25; -const F64 Ndens2 = Ndens*Ndens; +constexpr F32 sigma = 0.035f; +constexpr F32 fsigma = (6.f + 3.f * sigma) / (6.f-7.f*sigma); +constexpr F64 Ndens = 2.55e25; +constexpr F64 Ndens2 = Ndens*Ndens; // HACK: Allow server to change sun and moon IDs. // I can't figure out how to pass the appropriate diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1bb904e6c..b6ff1dfab 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1757,7 +1757,7 @@ void LLVOVolume::setNumTEs(const U8 num_tes) } else if(old_num_tes > num_tes && mMediaImplList.size() > num_tes) //old faces removed { - U8 end = mMediaImplList.size() ; + size_t end = mMediaImplList.size() ; for(U8 i = num_tes; i < end ; i++) { removeMediaImpl(i) ; @@ -3073,7 +3073,6 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const static const F32 ARC_BUMP_MULT = 1.25f; // tested based on performance static const F32 ARC_FLEXI_MULT = 5; // tested based on performance static const F32 ARC_SHINY_MULT = 1.6f; // tested based on performance - static const F32 ARC_INVISI_COST = 1.2f; // tested based on performance static const F32 ARC_WEIGHTED_MESH = 1.2f; // tested based on performance static const F32 ARC_PLANAR_COST = 1.0f; // tested based on performance to have negligible impact @@ -3082,7 +3081,6 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const F32 shame = 0; - U32 invisi = 0; U32 shiny = 0; U32 glow = 0; U32 alpha = 0; @@ -3190,10 +3188,6 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const { alpha = 1; } - else if (img && img->getPrimaryFormat() == GL_ALPHA) - { - invisi = 1; - } if (face->hasMedia()) { media_faces++; @@ -3247,11 +3241,6 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const shame *= alpha * ARC_ALPHA_COST; } - if(invisi) - { - shame *= invisi * ARC_INVISI_COST; - } - if (glow) { shame *= glow * ARC_GLOW_MULT; @@ -3934,8 +3923,9 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons { F32 w = weight[j][k]; - idx[k] = (S32) floorf(w); - wght[k] = w - floorf(w); + const F32 w_floor = floorf(w); + idx[k] = (S32) w_floor; + wght[k] = w - w_floor; scale += wght[k]; } @@ -3947,8 +3937,10 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons for (U32 k = 0; k < 4; k++) { F32 w = wght[k]; + LLMatrix4a src; - src.setMul(mp[idx[k]], w); + // clamp k to kMaxJoints to avoid reading garbage off stack in release + src.setMul(mp[(idx[k] < (S32)count) ? idx[k] : 0], w); final_mat.add(src); } @@ -4054,11 +4046,6 @@ bool can_batch_texture(const LLFace* facep) return false; } - if (facep->getTexture() && facep->getTexture()->getPrimaryFormat() == GL_ALPHA) - { //can't batch invisiprims - return false; - } - if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE) { //texture animation breaks batches return false; @@ -4077,11 +4064,6 @@ bool can_batch_texture(const LLFace* facep) return false; } - if (facep->getPoolType() != LLDrawPool::POOL_ALPHA && facep->getTexture() && facep->getTexture()->getPrimaryFormat() == GL_ALPHA) - { //can't batch invisiprims - return false; - } - if (facep->isState(LLFace::TEXTURE_ANIM) && facep->getVirtualSize() > MIN_TEX_ANIM_SIZE) { //texture animation breaks batches return false; @@ -4115,7 +4097,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if(!facep->mShinyInAlpha) facep->mShinyInAlpha = (type == LLRenderPass::PASS_FULLBRIGHT_SHINY) || - (type == LLRenderPass::PASS_INVISI_SHINY) || (type == LLRenderPass::PASS_SHINY) || (LLPipeline::sRenderDeferred && type == LLRenderPass::PASS_BUMP) || (LLPipeline::sRenderDeferred && type == LLRenderPass::PASS_SIMPLE); @@ -4130,7 +4111,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if(!alt_batching) { fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || - (type == LLRenderPass::PASS_INVISIBLE) || (type == LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK) || (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)) || (facep->getTextureEntry()->getFullbright()); @@ -6047,12 +6027,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac && te->getShiny() && can_be_shiny) { //shiny - if (tex->getPrimaryFormat() == GL_ALPHA) - { //invisiprim+shiny - registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY); - registerFace(group, facep, LLRenderPass::PASS_INVISIBLE); - } - else if (LLPipeline::sRenderDeferred && !hud_group) + if (LLPipeline::sRenderDeferred && !hud_group) { //deferred rendering if (te->getFullbright()) { //register in post deferred fullbright shiny pass @@ -6083,11 +6058,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac } else { //not alpha and not shiny - if (!is_alpha && tex->getPrimaryFormat() == GL_ALPHA) - { //invisiprim - registerFace(group, facep, LLRenderPass::PASS_INVISIBLE); - } - else if (fullbright) + if (fullbright) { //fullbright if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { @@ -6210,15 +6181,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac } else { - if (tex->getPrimaryFormat() == GL_ALPHA) - { - if(is_shiny_shader && facep->getPoolType() == LLDrawPool::POOL_BUMP) - { - registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY); - } - registerFace(group, facep, LLRenderPass::PASS_INVISIBLE); - } - else if (facep->getPoolType() == LLDrawPool::POOL_SIMPLE) + if (facep->getPoolType() == LLDrawPool::POOL_SIMPLE) { registerFace(group, facep, LLRenderPass::PASS_SIMPLE); } diff --git a/indra/newview/llwatchdog.h b/indra/newview/llwatchdog.h index 1a10e331d..9ad803d99 100644 --- a/indra/newview/llwatchdog.h +++ b/indra/newview/llwatchdog.h @@ -33,7 +33,10 @@ #ifndef LL_LLTHREADWATCHDOG_H #define LL_LLTHREADWATCHDOG_H +#ifndef BOOST_FUNCTION_HPP_INCLUDED #include +#define BOOST_FUNCTION_HPP_INCLUDED +#endif #ifndef LL_TIMER_H #include "lltimer.h" diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index aed18769e..3e459a040 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -47,7 +47,7 @@ #include "llalertdialog.h" #include "llui.h" #include "lluri.h" -#include "sgversion.h" +#include "llversioninfo.h" #include "llviewercontrol.h" #include "llviewernetwork.h" #include "llviewerparcelmgr.h" @@ -214,12 +214,12 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url, const LLSD &default_subs) { LLSD substitution = default_subs; - substitution["VERSION"] = gCurrentVersion; - substitution["VERSION_MAJOR"] = gVersionMajor; - substitution["VERSION_MINOR"] = gVersionMinor; - substitution["VERSION_PATCH"] = gVersionPatch; - substitution["VERSION_BUILD"] = gVersionBuild; - substitution["CHANNEL"] = gVersionChannel; + substitution["VERSION"] = LLVersionInfo::getVersion(); + substitution["VERSION_MAJOR"] = LLVersionInfo::getMajor(); + substitution["VERSION_MINOR"] = LLVersionInfo::getMinor(); + substitution["VERSION_PATCH"] = LLVersionInfo::getPatch(); + substitution["VERSION_BUILD"] = LLVersionInfo::getBuild(); + substitution["CHANNEL"] = LLVersionInfo::getChannel(); const HippoGridInfo* grid(gHippoGridManager->getCurrentGrid()); std::string gridId(grid->isSecondLife() ? getLoginUriDomain() : grid->getGridName()); if (grid->isSecondLife()) diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index aa3acc14a..577dca897 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -39,7 +39,7 @@ #include "llviewermedia.h" // FIXME: don't use LLViewerMedia internals // third-party JSONCPP -#include // JSONCPP +#include // JSONCPP /* * Workflow: @@ -87,7 +87,7 @@ public: Json::Reader reader; if (!reader.parse(body, root)) { - LL_WARNS() << "Failed to parse upload config: " << reader.getFormatedErrorMessages() << LL_ENDL; + LL_WARNS() << "Failed to parse upload config: " << reader.getFormattedErrorMessages() << LL_ENDL; LLWebProfile::reportImageUploadStatus(false); return; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f0f71c112..3befdff47 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -174,7 +174,6 @@ const LLMatrix4a* gGLLastMatrix = NULL; LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Geometry"); LLFastTimer::DeclareTimer FTM_RENDER_GRASS("Grass"); -LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE("Invisible"); LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION("Occlusion"); LLFastTimer::DeclareTimer FTM_RENDER_SHINY("Shiny"); LLFastTimer::DeclareTimer FTM_RENDER_SIMPLE("Simple"); @@ -234,7 +233,6 @@ std::string gPoolNames[] = "POOL_SKY", "POOL_WL_SKY", "POOL_GRASS", - "POOL_INVISIBLE", "POOL_AVATAR", "POOL_VOIDWATER", "POOL_WATER", @@ -382,7 +380,6 @@ LLPipeline::LLPipeline() : mAlphaMaskPool(NULL), mFullbrightAlphaMaskPool(NULL), mFullbrightPool(NULL), - mInvisiblePool(NULL), mGlowPool(NULL), mBumpPool(NULL), mMaterialsPool(NULL), @@ -421,7 +418,6 @@ void LLPipeline::init() getPool(LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK); getPool(LLDrawPool::POOL_GRASS); getPool(LLDrawPool::POOL_FULLBRIGHT); - getPool(LLDrawPool::POOL_INVISIBLE); getPool(LLDrawPool::POOL_BUMP); getPool(LLDrawPool::POOL_MATERIALS); getPool(LLDrawPool::POOL_GLOW); @@ -553,8 +549,6 @@ void LLPipeline::cleanup() mSimplePool = NULL; delete mFullbrightPool; mFullbrightPool = NULL; - delete mInvisiblePool; - mInvisiblePool = NULL; delete mGlowPool; mGlowPool = NULL; delete mBumpPool; @@ -1395,10 +1389,6 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0) poolp = mFullbrightPool; break; - case LLDrawPool::POOL_INVISIBLE: - poolp = mInvisiblePool; - break; - case LLDrawPool::POOL_GLOW: poolp = mGlowPool; break; @@ -5059,18 +5049,6 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) } break; - case LLDrawPool::POOL_INVISIBLE: - if (mInvisiblePool) - { - llassert(0); - LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL; - } - else - { - mInvisiblePool = (LLRenderPass*) new_poolp; - } - break; - case LLDrawPool::POOL_GLOW: if (mGlowPool) { @@ -5221,11 +5199,6 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) mFullbrightPool = NULL; break; - case LLDrawPool::POOL_INVISIBLE: - llassert(mInvisiblePool == poolp); - mInvisiblePool = NULL; - break; - case LLDrawPool::POOL_WL_SKY: llassert(mWLSkyPool == poolp); mWLSkyPool = NULL; @@ -7468,7 +7441,15 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield, b gGL.getTexUnit(0)->bind(&mPhysicsDisplay); - drawFullScreenRect(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); + gGL.begin(LLRender::TRIANGLES); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2f(-1.f, -1.f); + gGL.texCoord2f(0.f, mScreen.getHeight() * 2.f); + gGL.vertex2f(-1.f, 3.f); + gGL.texCoord2f(mScreen.getWidth() * 2.f, 0.f); + gGL.vertex2f( 3.f, -1.f); + gGL.end(); + gGL.flush(); if (LLGLSLShader::sNoFixedFunction) { @@ -8306,8 +8287,6 @@ void LLPipeline::renderDeferredLighting() LLPipeline::RENDER_TYPE_PASS_GLOW, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_PASS_SHINY, - LLPipeline::RENDER_TYPE_PASS_INVISIBLE, - LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY, LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_ALPHA_MASK, LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK, @@ -8878,8 +8857,6 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) LLPipeline::RENDER_TYPE_PASS_GLOW, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_PASS_SHINY, - LLPipeline::RENDER_TYPE_PASS_INVISIBLE, - LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY, LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_ALPHA_MASK, LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK, @@ -10534,12 +10511,9 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLPipeline::RENDER_TYPE_PASS_GLOW, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_PASS_SHINY, - LLPipeline::RENDER_TYPE_PASS_INVISIBLE, - LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY, LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_ALPHA_MASK, LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK, - LLPipeline::RENDER_TYPE_INVISIBLE, LLPipeline::RENDER_TYPE_SIMPLE, END_RENDER_TYPES); } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 1cf400446..b7d357f97 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -86,7 +86,6 @@ void glh_set_current_projection(const LLMatrix4a& mat); extern LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY; extern LLFastTimer::DeclareTimer FTM_RENDER_GRASS; -extern LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE; extern LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION; extern LLFastTimer::DeclareTimer FTM_RENDER_SHINY; extern LLFastTimer::DeclareTimer FTM_RENDER_SIMPLE; @@ -448,7 +447,6 @@ public: RENDER_TYPE_MATERIALS = LLDrawPool::POOL_MATERIALS, RENDER_TYPE_AVATAR = LLDrawPool::POOL_AVATAR, RENDER_TYPE_TREE = LLDrawPool::POOL_TREE, - RENDER_TYPE_INVISIBLE = LLDrawPool::POOL_INVISIBLE, RENDER_TYPE_VOIDWATER = LLDrawPool::POOL_VOIDWATER, RENDER_TYPE_WATER = LLDrawPool::POOL_WATER, RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA, @@ -456,8 +454,6 @@ public: RENDER_TYPE_PASS_SIMPLE = LLRenderPass::PASS_SIMPLE, RENDER_TYPE_PASS_GRASS = LLRenderPass::PASS_GRASS, RENDER_TYPE_PASS_FULLBRIGHT = LLRenderPass::PASS_FULLBRIGHT, - RENDER_TYPE_PASS_INVISIBLE = LLRenderPass::PASS_INVISIBLE, - RENDER_TYPE_PASS_INVISI_SHINY = LLRenderPass::PASS_INVISI_SHINY, RENDER_TYPE_PASS_FULLBRIGHT_SHINY = LLRenderPass::PASS_FULLBRIGHT_SHINY, RENDER_TYPE_PASS_SHINY = LLRenderPass::PASS_SHINY, RENDER_TYPE_PASS_BUMP = LLRenderPass::PASS_BUMP, @@ -771,7 +767,6 @@ private: LLRenderPass* mAlphaMaskPool; LLRenderPass* mFullbrightAlphaMaskPool; LLRenderPass* mFullbrightPool; - LLDrawPool* mInvisiblePool; LLDrawPool* mGlowPool; LLDrawPool* mBumpPool; LLDrawPool* mMaterialsPool; diff --git a/indra/newview/res/singularity_icon.ico b/indra/newview/res/singularity_icon.ico deleted file mode 100644 index 84a455a22..000000000 Binary files a/indra/newview/res/singularity_icon.ico and /dev/null differ diff --git a/indra/newview/res/viewerRes.rc.in b/indra/newview/res/viewerRes.rc similarity index 86% rename from indra/newview/res/viewerRes.rc.in rename to indra/newview/res/viewerRes.rc index 0119f9fd9..bf112c35e 100644 --- a/indra/newview/res/viewerRes.rc.in +++ b/indra/newview/res/viewerRes.rc @@ -13,8 +13,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -// Commented out because it only compiles if you have MFC installed. -//#include "winres.h" +#include "windows.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -41,7 +40,7 @@ END 2 TEXTINCLUDE BEGIN - "#include ""winres.h""\r\n" + "#include ""windows.h""\r\n" "\0" END @@ -61,8 +60,8 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_LL_ICON ICON "${VIEWER_BRANDING_ID}_icon.ico" -IDI_LCD_LL_ICON ICON "${VIEWER_BRANDING_ID}_icon.ico" +IDI_LL_ICON ICON "viewer_icon.ico" +IDI_LCD_LL_ICON ICON "viewer_icon.ico" ///////////////////////////////////////////////////////////////////////////// // @@ -74,7 +73,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE FONT 8, "MS Sans Serif" BEGIN ICON IDI_LL_ICON,IDC_STATIC,7,7,20,20 - LTEXT "Loading ${VIEWER_CHANNEL}...",666,36,13,91,8 + LTEXT "Loading Singularity Viewer...",666,36,13,91,8 END @@ -123,14 +122,14 @@ TOOLPICKOBJECT3 CURSOR "toolpickobject3.cur" ARROWCOPY CURSOR "arrowcop.cur" ARROWDRAGMULTI CURSOR "llarrowdragmulti.cur" ARROWCOPYMULTI CURSOR "arrowcopmulti.cur" -TOOLSIT CURSOR "toolsit.cur" -TOOLBUY CURSOR "toolbuy.cur" -TOOLPAY CURSOR "toolpay.cur" -TOOLOPEN CURSOR "toolopen.cur" TOOLPIPETTE CURSOR "toolpipette.cur" TOOLPLAY CURSOR "toolplay.cur" TOOLPAUSE CURSOR "toolpause.cur" TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" +TOOLBUY CURSOR "toolbuy.cur" +TOOLPAY CURSOR "toolpay.cur" +TOOLOPEN CURSOR "toolopen.cur" +TOOLSIT CURSOR "toolsit.cur" ///////////////////////////////////////////////////////////////////////////// // @@ -138,8 +137,8 @@ TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" // VS_VERSION_INFO VERSIONINFO - FILEVERSION ${vMAJOR},${vMINOR},${vPATCH},${vBUILD} - PRODUCTVERSION ${vMAJOR},${vMINOR},${vPATCH},${vBUILD} + FILEVERSION ${VIEWER_VERSION_MAJOR},${VIEWER_VERSION_MINOR},${VIEWER_VERSION_PATCH},${VIEWER_VERSION_REVISION} + PRODUCTVERSION ${VIEWER_VERSION_MAJOR},${VIEWER_VERSION_MINOR},${VIEWER_VERSION_PATCH},${VIEWER_VERSION_REVISION} FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -156,12 +155,12 @@ BEGIN BEGIN VALUE "CompanyName", "Siana Gearz" VALUE "FileDescription", "Singularity Viewer" - VALUE "FileVersion", "${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}" + VALUE "FileVersion", "${VIEWER_VERSION_MAJOR}.${VIEWER_VERSION_MINOR}.${VIEWER_VERSION_PATCH}.${VIEWER_VERSION_REVISION}" VALUE "InternalName", "Second Life" VALUE "LegalCopyright", "Copyright 2001-2010, Linden Research, Inc., Copyright 2010 Siana Gearz" VALUE "OriginalFilename", "SingularityViewer.exe" VALUE "ProductName", "Singularity Viewer" - VALUE "ProductVersion", "${vMAJOR}.${vMINOR}.${vPATCH}.${vBUILD}" + VALUE "ProductVersion", "${VIEWER_VERSION_MAJOR}.${VIEWER_VERSION_MINOR}.${VIEWER_VERSION_PATCH}.${VIEWER_VERSION_REVISION}" END END BLOCK "VarFileInfo" @@ -170,12 +169,6 @@ BEGIN END END - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index d1afc57fb..95e53bc40 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -20,9 +20,7 @@ #include #include "rlvcommon.h" -#if LL_GNUC || LL_INTELC || LL_CLANG #include "rlvhelper.h" // Needed to make GCC happy -#endif // LL_GNUC // ============================================================================ diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index a1a3eeb8b..874a35958 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -26,7 +26,6 @@ #include "rlvinventory.h" #include -#include // ============================================================================ // RlvCommmand @@ -913,7 +912,7 @@ void RlvForceWear::updatePendingAttachments() if (RlvForceWear::instanceExists()) { RlvForceWear* pThis = RlvForceWear::getInstance(); - BOOST_FOREACH(const pendingattachments_map_t::value_type& itAttach, pThis->m_pendingAttachments) + for (const auto& itAttach : pThis->m_pendingAttachments) LLAttachmentsMgr::instance().addAttachment(itAttach.first, itAttach.second & ~ATTACHMENT_ADD, itAttach.second & ATTACHMENT_ADD); pThis->m_pendingAttachments.clear(); } @@ -954,7 +953,7 @@ void RlvForceWear::done() // Wearables if (m_remWearables.size()) { - BOOST_FOREACH(const LLViewerWearable* pWearable, m_remWearables) + for (const LLViewerWearable* pWearable : m_remWearables) remItems.push_back(pWearable->getItemID()); m_remWearables.clear(); } @@ -963,7 +962,7 @@ void RlvForceWear::done() if (m_remGestures.size()) { // NOTE: LLGestureMgr::deactivateGesture() will call LLAppearanceMgr::removeCOFItemLinks() for us and supply its own callback - BOOST_FOREACH(const LLViewerInventoryItem* pItem, m_remGestures) + for (const LLViewerInventoryItem* pItem : m_remGestures) LLGestureMgr::instance().deactivateGesture(pItem->getUUID()); m_remGestures.clear(); } @@ -972,7 +971,7 @@ void RlvForceWear::done() if (m_remAttachments.size()) { LLAgentWearables::userRemoveMultipleAttachments(m_remAttachments); - BOOST_FOREACH(const LLViewerObject* pAttachObj, m_remAttachments) + for (const LLViewerObject* pAttachObj : m_remAttachments) remItems.push_back(pAttachObj->getAttachmentItemID()); m_remAttachments.clear(); } @@ -986,7 +985,7 @@ void RlvForceWear::done() for (addwearables_map_t::const_iterator itAddWearables = m_addWearables.begin(); itAddWearables != m_addWearables.end(); ++itAddWearables) { // NOTE: LLAppearanceMgr will filter our duplicates so no need for us to check here - BOOST_FOREACH(LLViewerInventoryItem* pItem, itAddWearables->second) + for (LLViewerInventoryItem* pItem : itAddWearables->second) { if (LLAssetType::AT_BODYPART == pItem->getType()) addBodyParts.push_back(pItem); @@ -999,7 +998,7 @@ void RlvForceWear::done() // Until LL provides a way for updateCOF to selectively attach add/replace we have to deal with attachments ourselves for (addattachments_map_t::const_iterator itAddAttachments = m_addAttachments.begin(); itAddAttachments != m_addAttachments.end(); ++itAddAttachments) { - BOOST_FOREACH(const LLViewerInventoryItem* pItem, itAddAttachments->second) + for (const LLViewerInventoryItem* pItem : itAddAttachments->second) addPendingAttachment(pItem->getLinkedUUID(), itAddAttachments->first); } m_addAttachments.clear(); diff --git a/indra/newview/rlvinventory.h b/indra/newview/rlvinventory.h index 90de5c73d..0aee6aa38 100644 --- a/indra/newview/rlvinventory.h +++ b/indra/newview/rlvinventory.h @@ -21,9 +21,12 @@ #include "llinventoryobserver.h" #include "llsingleton.h" +#include "rlvdefines.h" #include "rlvhelper.h" #include "rlvlocks.h" +#include + // ============================================================================ // RlvInventory class declaration // @@ -305,7 +308,7 @@ inline bool RlvInventory::isFoldedFolder(const LLInventoryCategory* pFolder, boo // .() type folder (0 != RlvAttachPtLookup::getAttachPointIndex(pFolder)) // .(nostrip) folder - || ( (pFolder) && (".("RLV_FOLDER_FLAG_NOSTRIP")" == pFolder->getName()) ) + || ((pFolder) && ((boost::format("%1%%2%%3%") % ".(" % RLV_FOLDER_FLAG_NOSTRIP % ")").str() == pFolder->getName())) // Composite folder (if composite folders are enabled and we're asked to look for them) #ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS || ( (fCheckComposite) && (RlvSettings::getEnableComposites()) && diff --git a/indra/newview/sgversion.cpp b/indra/newview/sgversion.cpp deleted file mode 100644 index 615064f27..000000000 --- a/indra/newview/sgversion.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2012 Siana Gearz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA */ - -#include "llviewerprecompiledheaders.h" - -#include "llversionviewer.h" - -#include "sgversion.h" - -const S32 gVersionMajor = LL_VERSION_MAJOR; -const S32 gVersionMinor = LL_VERSION_MINOR; -const S32 gVersionPatch = LL_VERSION_PATCH; -const S32 gVersionBuild = LL_VERSION_BUILD; - -const char* gVersionChannel = LL_CHANNEL; - -#if LL_DARWIN -const char* gVersionBundleID = LL_VERSION_BUNDLE_ID; -#endif \ No newline at end of file diff --git a/indra/newview/sgversion.h b/indra/newview/sgversion.h deleted file mode 100644 index afdc8b51a..000000000 --- a/indra/newview/sgversion.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2012 Siana Gearz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA */ - -#ifndef SGVERSION_H -#define SGVERSION_H - -extern const S32 gVersionMajor; -extern const S32 gVersionMinor; -extern const S32 gVersionPatch; -extern const S32 gVersionBuild; - -extern const char* gVersionChannel; - -#if LL_DARWIN -extern const char* gVersionBundleID; -#endif - -#endif diff --git a/indra/newview/singularity_icon.icns b/indra/newview/singularity_icon.icns deleted file mode 100644 index 062da4a33..000000000 Binary files a/indra/newview/singularity_icon.icns and /dev/null differ diff --git a/indra/newview/skins/apollo/keywords.ini b/indra/newview/skins/apollo/keywords.ini index 8d0fd6b71..26c994488 100644 --- a/indra/newview/skins/apollo/keywords.ini +++ b/indra/newview/skins/apollo/keywords.ini @@ -182,6 +182,8 @@ PSYS_SRC_PATTERN_ANGLE_CONE PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY OBJECT_UNKNOWN_DETAIL Returned by llGetObjectDetails when passed an invalid object parameter type +OBJECT_HOVER_HEIGHT This is a flag used with llGetObjectDetails to get hover height of the avatar. If no data is available, 0.0 is returned. +OBJECT_LAST_OWNER_ID Gets the object's last owner ID. OBJECT_NAME Used with llGetObjectDetails to get an object's name OBJECT_DESC Used with llGetObjectDetails to get an object's description OBJECT_POS Used with llGetObjectDetails to get an object's position @@ -189,6 +191,7 @@ OBJECT_ROT Used with llGetObjectDetails to get an o OBJECT_VELOCITY Used with llGetObjectDetails to get an object's velocity OBJECT_OWNER Used with llGetObjectDetails to get an object's owner's key. Will be NULL_KEY if group owned OBJECT_GROUP Used with llGetObjectDetails to get an object's group's key +OBJECT_CLICK_ACTION This is a flag used with llGetObjectDetails to get the click action. The default is 0. OBJECT_CREATOR Used with llGetObjectDetails to get an object's creator's key OBJECT_RUNNING_SCRIPT_COUNT Gets the number of running scripts attached to the object or agent OBJECT_TOTAL_SCRIPT_COUNT Gets the number of scripts, both running and stopped, attached to the object or agent. @@ -199,6 +202,7 @@ OBJECT_SERVER_COST Used with llGetObjectDetails to get the OBJECT_STREAMING_COST Used with llGetObjectDetails to get the streaming (download) cost. OBJECT_PHYSICS_COST Used with llGetObjectDetails to get the physics cost. OBJECT_PATHFINDING_TYPE Used with llGetObjectDetails to get an object's pathfinding settings. +OBJECT_BODY_SHAPE_TYPE This is a flag used with llGetObjectDetails to get the body type of the avatar, based on shape data. If no data is available, -1.0 is returned. This is normally between 0 and 1.0, with 0.5 and larger considered 'male' OBJECT_CHARACTER_TIME Used with llGetObjectDetails to get an object's average CPU time (in seconds) used by the object for navigation, if the object is a pathfinding character. Returns 0 for non-characters. OBJECT_ROOT Used with llGetObjectDetails to get an object's root prim ID. OBJECT_ATTACHED_POINT Used with llGetObjectDetails to get an object's attachment point. diff --git a/indra/newview/skins/default/textures/Accordion_ArrowClosed_Off.png b/indra/newview/skins/default/textures/Accordion_ArrowClosed_Off.png new file mode 100644 index 000000000..3dfe6d454 Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_ArrowClosed_Off.png differ diff --git a/indra/newview/skins/default/textures/Accordion_ArrowClosed_Press.png b/indra/newview/skins/default/textures/Accordion_ArrowClosed_Press.png new file mode 100644 index 000000000..c381e8e1d Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_ArrowClosed_Press.png differ diff --git a/indra/newview/skins/default/textures/Accordion_ArrowOpened_Off.png b/indra/newview/skins/default/textures/Accordion_ArrowOpened_Off.png new file mode 100644 index 000000000..1a898834c Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_ArrowOpened_Off.png differ diff --git a/indra/newview/skins/default/textures/Accordion_ArrowOpened_Press.png b/indra/newview/skins/default/textures/Accordion_ArrowOpened_Press.png new file mode 100644 index 000000000..05b381bdb Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_ArrowOpened_Press.png differ diff --git a/indra/newview/skins/default/textures/Accordion_Off.png b/indra/newview/skins/default/textures/Accordion_Off.png new file mode 100644 index 000000000..47b63618f Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_Off.png differ diff --git a/indra/newview/skins/default/textures/Accordion_Over.png b/indra/newview/skins/default/textures/Accordion_Over.png new file mode 100644 index 000000000..6dcb4401e Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_Over.png differ diff --git a/indra/newview/skins/default/textures/Accordion_Press.png b/indra/newview/skins/default/textures/Accordion_Press.png new file mode 100644 index 000000000..a6b17a91f Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_Press.png differ diff --git a/indra/newview/skins/default/textures/Accordion_Selected.png b/indra/newview/skins/default/textures/Accordion_Selected.png new file mode 100644 index 000000000..27091d3bd Binary files /dev/null and b/indra/newview/skins/default/textures/Accordion_Selected.png differ diff --git a/indra/newview/skins/default/textures/icn_toolbar_lag_meter.tga b/indra/newview/skins/default/textures/icn_toolbar_lag_meter.tga deleted file mode 100644 index 49e5d11a2..000000000 Binary files a/indra/newview/skins/default/textures/icn_toolbar_lag_meter.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index b6420d4e0..6ec647776 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -400,6 +400,16 @@ + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/de/floater_directory.xml b/indra/newview/skins/default/xui/de/floater_directory.xml index 7dfa569bd..be4c32662 100644 --- a/indra/newview/skins/default/xui/de/floater_directory.xml +++ b/indra/newview/skins/default/xui/de/floater_directory.xml @@ -54,6 +54,12 @@ Fertig http://secondlife.com/app/search/notfound.html "http://secondlife.com/app/search/index.php?" + + + + + + Loading... + Done + [APP_SITE]/404 + http://search.secondlife.com/ Done [APP_SITE]/404 https://marketplace.secondlife.com/ - - - - - - Loading... - Done - [APP_SITE]/404 - http://search.secondlife.com/ - - - - - - diff --git a/indra/newview/skins/default/xui/en-us/strings.xml b/indra/newview/skins/default/xui/en-us/strings.xml index 1317ce053..bba92c151 100644 --- a/indra/newview/skins/default/xui/en-us/strings.xml +++ b/indra/newview/skins/default/xui/en-us/strings.xml @@ -158,7 +158,7 @@ Make sure you entered the correct Login URI. An example of a Login URI is: \"htt Searching... None found. - + Retrieving... Release Notes @@ -350,6 +350,8 @@ Make sure you entered the correct Login URI. An example of a Login URI is: \"htt Track your camera Control your camera Teleport you + Manage your estates silently + Change your default animations Join an experience Suppress alerts when managing estate access lists Replace your default animations @@ -389,13 +391,21 @@ Make sure you entered the correct Login URI. An example of a Login URI is: \"htt Load Targa Images Bitmap Images + PNG Images + JPEG Images + Jpeg2000 Images + Targa, PNG, JPEG, Jpeg2000, or Bitmap Images AVI Movie File XAF Anim File XML File + Comma separated values RAW File Compressed Images Load Files Choose Directory + Scripts + Dictionaries + Zip files Sound: @@ -586,11 +596,11 @@ Returns the wind velocity at the object position + offset llSetStatus(integer status, integer value) -Sets status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB, STATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) to value +Sets status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB, STATUS_BLOCK_GRAB_OBJECT, STATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) to value integer llGetStatus(integer status) -Returns value of status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB, STATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) +Returns the boolean value of status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB, STATUS_BLOCK_GRAB_OBJECT, STATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) llSetScale(vector scale) @@ -746,7 +756,7 @@ Returns the script time in seconds and then resets the script timer to zero llSound(string sound, float volume, integer queue, integer loop) -Plays sound at volume and whether it should loop or not +Plays sound at volume and whether it should loop or not. llPlaySound(string sound, float volume) @@ -3103,6 +3113,18 @@ Where tag = tag string to match. Removes bot's matching the tag. Deleted [SCRIPTS] scripts in [OBJECTS] objects. took a snapshot + + [NAME] [ACTION] [RANGE]. + + has triggered your avatar age alert + has entered + has left + + the sim + draw distance + shout range + chat range + Not Away Away @@ -3484,6 +3506,10 @@ Expected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh Alt- Shift- + + [ALT]Left arrow for previous tab + [ALT]Right arrow for next tab + File Saved Receiving diff --git a/indra/newview/skins/default/xui/es/floater_about_land.xml b/indra/newview/skins/default/xui/es/floater_about_land.xml index c11128f59..8765a2d91 100644 --- a/indra/newview/skins/default/xui/es/floater_about_land.xml +++ b/indra/newview/skins/default/xui/es/floater_about_land.xml @@ -34,7 +34,7 @@