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..718308dc9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -/installed.xml -/indra/llcommon/llversionviewer.h /indra/build-* /indra/tools/vstool/obj/ *.aps @@ -12,6 +10,8 @@ /indra/viewer-* /indra/newview/vivox-runtime/ /indra/newview/dbghelp.dll +indra/newview/res/viewer_icon.* +indra/newview/res-sdl/viewer_icon.* /libraries/ /lib/ *.pyc @@ -26,12 +26,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..fbdca77b8 --- /dev/null +++ b/autobuild.xml @@ -0,0 +1,2944 @@ + + + + installables + + SDL + + copyright + Copyright (C) 1997-2012 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 + 459cdc8d7c19a8025f98f61db95622ff + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/sdl_3p-update-sdl/rev/297546/arch/Linux/installer/SDL-1.2.15-linux-297546.tar.bz2 + + name + linux + + + 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 + 0c53148aa00e51c06fa246c4130915be + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/apr_3p-update-apr/rev/297252/arch/Darwin/installer/apr_suite-1.4.5.297252-darwin-297252.tar.bz2 + + name + darwin + + linux + + archive + + hash + 402552cf158e2fe953b7224f4615a957 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/apr_3p-update-apr/rev/297252/arch/Linux/installer/apr_suite-1.4.5.297252-linux-297252.tar.bz2 + + name + linux + + windows + + archive + + hash + a0674f9dfce2b15bc90bf86ef2b01196 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/apr_suite-1.5.2-windows-201601151037.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 31c5f5b399da00037edd5b094ac6b97b + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/apr_suite-1.5.2-windows64-201512102110.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 + 637b4996f703f3e5bf835d847fc4cb81 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/ares_3p-update-ares/rev/295506/arch/Darwin/installer/ares-1.10.0.295506-darwin-295506.tar.bz2 + + name + darwin + + linux + + archive + + hash + 7771d3653a0daf22d35bf96055d02d9a + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/ares_3p-update-ares/rev/295506/arch/Linux/installer/ares-1.10.0.295506-linux-295506.tar.bz2 + + name + linux + + 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 + c296845cad075250c1ae2620f175a957 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/boost_3p-update-boost/rev/297445/arch/Darwin/installer/boost-1.57-darwin-297445.tar.bz2 + + name + darwin + + linux + + archive + + hash + fb1537f7ad0b490fcb4f096c15dce9cd + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/boost_3p-update-boost/rev/297445/arch/Linux/installer/boost-1.57-linux-297445.tar.bz2 + + name + linux + + 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 + 66849777a83cb69cec3c06b07da7cd3d + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/colladadom_3p-update-colladadom/rev/297450/arch/Darwin/installer/colladadom-2.3.297450-darwin-297450.tar.bz2 + + name + darwin + + linux + + archive + + hash + d627c2a679f3afb8d3e090d42f53cd2e + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/colladadom_3p-update-colladadom/rev/297450/arch/Linux/installer/colladadom-2.3.297450-linux-297450.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 - 2015, 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 + d1c5125650a339a5209f429c70f4d395 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/curl_3p-update-curl/rev/297172/arch/Darwin/installer/curl-7.38.0.297172-darwin-297172.tar.bz2 + + name + darwin + + linux + + archive + + hash + ee6c089ee193e551040d610befc5d1c1 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/curl_3p-update-curl/rev/297172/arch/Linux/installer/curl-7.38.0.297172-linux-297172.tar.bz2 + + name + linux + + windows + + archive + + hash + 6e443a01d85367e1f058fbfb378cf80e + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/curl-7.46.0-windows-201601151153.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 9aca8339f269df5f42484f4bfafbf430 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/curl-7.46.0-windows64-201512122022.tar.bz2 + + name + windows64 + + + version + 7.46.0 + + db + + copyright + Copyright (c) 1990, 2010 Oracle and/or its affiliates. All rights reserved. + description + Berkeley DB (libdb) is a programmatic toolkit that provides embedded database support for both traditional and client/server applications. + license + bsd + license_file + LICENSES/db.txt + name + db + platforms + + linux + + archive + + hash + 1cc7940e500858a9754e9a3cc3ba2237 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/db_3p-update-db/rev/295315/arch/Linux/installer/db-5.1.25-linux-295315.tar.bz2 + + name + linux + + + version + 5.1.25 + + 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 + c11ff7e2e0bd59e6e59628f24902bbcd + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/dbus-glib_3p-update-dbus-glib/rev/297768/arch/Linux/installer/dbus_glib-0.76-linux-297768.tar.bz2 + + name + linux + + + 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 + + elfio + + license + lgpl + license_file + LICENSES/elfio.txt + name + elfio + platforms + + linux + + archive + + hash + 031e6315a5c0829c9b9a2ec18aeb7ae3 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-elfio/rev/222074/arch/Linux/installer/elfio-1.0.3-linux-20110225.tar.bz2 + + name + linux + + + + 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 + 452d1910ef853329cd59858e6c5b2c48 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/expat_3p-update-expat/rev/297014/arch/Darwin/installer/expat-2.0.1.297014-darwin-297014.tar.bz2 + + name + darwin + + linux + + archive + + hash + f546615d76bc0f9e8bc2b9ef89f0ca86 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/expat_3p-update-expat/rev/297014/arch/Linux/installer/expat-2.0.1.297014-linux-297014.tar.bz2 + + name + linux + + windows + + archive + + hash + 97786c456086c2aeb7554c755361df81 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/expat-2.1.0-windows-201601150958.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 7a08c54a3a869068f40a6ad4ea2716bb + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/expat-2.1.0-windows64-201512092314.tar.bz2 + + name + windows64 + + + version + 2.1.0 + + 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 + a51da309dd81293ae2940181d345bb77 + hash_algorithm + md5 + url + https://bitbucket.org/alchemyviewer/publiclibs-darwin/downloads/fmodstudio-1.07.00-darwin-201510062322.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 + adc55fd330f41a66dc64a6c3f7084e79 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/linux64/lib/fmodstudio-1.07.00-linux64-201510070033.tar.bz2 + + name + linux64 + + windows + + archive + + hash + b8de0e7146e671c6cf1171f86a7b46a1 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib/fmodstudio-1.07.05-windows-201601151004.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 8b80c508ebb6cd923d3448ba6f48fe3c + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib/fmodstudio-1.07.05-windows64-201601160255.tar.bz2 + + name + windows64 + + + version + 1.07.05 + + 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 + 864f9361661748ecf0e2cec7110d70b3 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/fontconfig_3p-update-fontconfig/rev/297551/arch/Linux/installer/fontconfig-2.11.0-linux-297551.tar.bz2 + + name + linux + + + 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-2015 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 + 83618d16d974eb0af93926a10ac13297 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/freetype_3p-update-freetype/rev/297053/arch/Darwin/installer/freetype-2.4.4.297053-darwin-297053.tar.bz2 + + name + darwin + + linux + + archive + + hash + 1ac3152b440287c58509d8af0a50326d + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/freetype_3p-update-freetype/rev/297053/arch/Linux/installer/freetype-2.4.4.297053-linux-297053.tar.bz2 + + name + linux + + windows + + archive + + hash + 980d01acc3f88ed345dc20fc3e0ba6c0 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/freetype-2.6.2-windows-201601151045.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 80d268872b1e9209b8932390caacd550 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/freetype-2.6.2-windows64-201512130440.tar.bz2 + + name + windows64 + + + version + 2.6.2 + + 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 + 71e678d70e276fc42a56926fc28a7abd + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/glod_3p-update-glod/rev/296895/arch/Darwin/installer/glod-1.0pre4.296895-darwin-296895.tar.bz2 + + name + darwin + + linux + + archive + + hash + fffd130f17cbbe2b93cc241b27262647 + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/glod_3p-update-glod/rev/296895/arch/Linux/installer/glod-1.0pre4.296895-linux-296895.tar.bz2 + + name + linux + + 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 + 171b39db6d0702535b41fad5b476e39d + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/google-breakpad_3p-update-google-breakpad/rev/298033/arch/Darwin/installer/google_breakpad-1413.298033-darwin-298033.tar.bz2 + + name + darwin + + linux + + archive + + hash + 0bf69fbc829d964820b798a0494278c9 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/google-breakpad_3p-update-google-breakpad/rev/298033/arch/Linux/installer/google_breakpad-1413.298033-linux-298033.tar.bz2 + + name + linux + + 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 + + darwin + + archive + + hash + 0137e450bf24cff7e78634bb9a1c85e4 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/google-perftools_3p-update-google-perftools/rev/297263/arch/Darwin/installer/gperftools-2.0.297263-darwin-297263.tar.bz2 + + name + darwin + + linux + + archive + + hash + 0c252bcaa1cb852f5c4e46a13ed459c5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/google-perftools_3p-update-google-perftools/rev/297263/arch/Linux/installer/gperftools-2.0.297263-linux-297263.tar.bz2 + + name + linux + + windows + + archive + + hash + 2946f9bbf227dee8881af43856ebb3a1 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/google-perftools_3p-update-google-perftools/rev/297263/arch/CYGWIN/installer/gperftools-2.0.297263-windows-297263.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 + + linux + + archive + + hash + fb1479533a7699b44d34e3a550037eb7 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/gstreamer_3p-update-gstreamer/rev/294903/arch/Linux/installer/gstreamer-0.10.6.294903-linux-294903.tar.bz2 + + name + linux + + + version + 0.10.6.294903 + + gtk-atk-pango-glib + + copyright + Copyright (various, see sources) + license + lgpl + license_file + LICENSES/gtk-atk-pango-glib.txt + name + gtk-atk-pango-glib + platforms + + linux + + archive + + hash + 15af375116f5c943ea6f4190bc764224 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/gtk_3p-gtk-atk-pango-glib/rev/294804/arch/Linux/installer/gtk_atk_pango_glib-0.1-linux-294804.tar.bz2 + + name + linux + + + version + 0.0 + + havok-source + + copyright + Uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details. + description + Havok source code for libs and demos + license + havok + license_file + LICENSES/havok.txt + name + havok-source + platforms + + darwin + + archive + + hash + 5c5b4820999ae9e398801d6a46f45897 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/havok-source_3p-update-havok-source/rev/297312/arch/Darwin/installer/havok_source-2012.1-darwin-297312.tar.bz2 + + name + darwin + + linux + + archive + + hash + 6b0f41ddddfa60d8424d8a2e0bc2077d + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/havok-source_3p-update-havok-source/rev/296959/arch/Linux/installer/havok_source-2012.1-linux-296959.tar.bz2 + + name + linux + + windows + + archive + + hash + ab30ae74a665950d73ea559f019ff358 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/havok-source_3p-update-havok-source/rev/297566/arch/CYGWIN/installer/havok_source-2012.1-windows-297566.tar.bz2 + + name + windows + + + version + 2012.1 + + 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 + 4d7658997fd0f93a9c55e40e40b1b0e5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/jpeglib_3p-update-jpeglib/rev/296854/arch/Darwin/installer/jpeglib-8c.296854-darwin-296854.tar.bz2 + + name + darwin + + linux + + archive + + hash + 0a6641f030e173a7bc0dc8a3087b6c7d + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/jpeglib_3p-update-jpeglib/rev/296854/arch/Linux/installer/jpeglib-8c.296854-linux-296854.tar.bz2 + + name + linux + + 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 + b25a4f480e07c670ffef00c3da578f87 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/jsoncpp_3p-update-jsoncpp/rev/297281/arch/Darwin/installer/jsoncpp-0.5.0.297281-darwin-297281.tar.bz2 + + name + darwin + + linux + + archive + + hash + 5b3b5dbf0c82c1046482a74ce9e11c38 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/jsoncpp_3p-update-jsoncpp/rev/297281/arch/Linux/installer/jsoncpp-0.5.0.297281-linux-297281.tar.bz2 + + name + linux + + 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 + + kdu + + copyright + Kakadu software + description + JPEG2000 library by Kakadu + license + Kakadu + license_file + LICENSES/kdu.txt + name + kdu + platforms + + darwin + + archive + + hash + e62f2fc1ee9ab791d603c5b717b46119 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/kdu_3p-update-kdu/rev/296932/arch/Darwin/installer/kdu-7.2.296932-darwin-296932.tar.bz2 + + name + darwin + + linux + + archive + + hash + ed952c0cb86329e63a8db190953962d8 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/kdu_3p-update-kdu/rev/296932/arch/Linux/installer/kdu-7.2.296932-linux-296932.tar.bz2 + + name + linux + + windows + + archive + + hash + a0e5c050a4975c81611d9f1862ac57fb + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/kdu_3p-update-kdu/rev/296932/arch/CYGWIN/installer/kdu-7.2.296932-windows-296932.tar.bz2 + + name + windows + + + version + 7.2.296932 + + libhunspell + + copyright + See hunspell.txt + description + Spell checking library + license + LGPL + license_file + LICENSES/hunspell.txt + name + libhunspell + platforms + + darwin + + archive + + hash + 05eda16106df26a211f8bdd874d1fca5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/hunspell_3p-update-hunspell/rev/296916/arch/Darwin/installer/libhunspell-1.3.2.296916-darwin-296916.tar.bz2 + + name + darwin + + linux + + archive + + hash + 988deae5c63ec638ad222b400a431f5b + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/hunspell_3p-update-hunspell/rev/296916/arch/Linux/installer/libhunspell-1.3.2.296916-linux-296916.tar.bz2 + + name + linux + + 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 + + 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 + a01b411433dbf8a4b481de9e76d9a652 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libndofdev_3p-update-libndofdev/rev/297264/arch/Darwin/installer/libndofdev-0.1.297264-darwin-297264.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 + + libpng + + copyright + Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson + description + PNG Reference library + license + libpng + license_file + LICENSES/libpng.txt + name + libpng + platforms + + darwin + + archive + + hash + 14cb5c8686a472e9e60179e46cd196f7 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libpng_3p-update-libpng/rev/297708/arch/Darwin/installer/libpng-1.6.8.297708-darwin-297708.tar.bz2 + + name + darwin + + linux + + archive + + hash + 6dec32fc2527f8cafd616f9271ff3478 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libpng_3p-update-libpng/rev/297051/arch/Linux/installer/libpng-1.6.8.297051-linux-297051.tar.bz2 + + name + linux + + windows + + archive + + hash + 28c4370ae17b7881a8604ff0ed6c204b + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/libpng-1.6.19-windows-201601151047.tar.bz2 + + name + windows + + windows64 + + archive + + hash + a6646a596c1f015831c337605bb907e5 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/libpng-1.6.19-windows64-201512122034.tar.bz2 + + name + windows64 + + + version + 1.6.19 + + libuuid + + copyright + Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/> + description + OSSP uuid is a ISO-C:1999 application programming interface (API) and corresponding command line interface (CLI) for the generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant Universally Unique Identifier (UUID). + license + UUID + license_file + LICENSES/uuid.txt + name + libuuid + platforms + + linux + + archive + + hash + f231b6ec8bc2f050cfb1ee20bd83190d + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libuuid_3p-update-libuuid/rev/295209/arch/Linux/installer/libuuid-1.6.2-linux-295209.tar.bz2 + + name + linux + + + version + 1.6.2 + + 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 + 9303f0dd174129e297eca6cc2eb1ab3f + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libxml_3p-update-libxml/rev/297050/arch/Darwin/installer/libxml2-2.9.1.297050-darwin-297050.tar.bz2 + + name + darwin + + linux + + archive + + hash + b8b584853dc1344bb3571c13b06ec39e + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libxml_3p-update-libxml/rev/297050/arch/Linux/installer/libxml2-2.9.1.297050-linux-297050.tar.bz2 + + name + linux + + 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 + + llappearance_utility + + copyright + Copyright (c) 2000-2012, Linden Research, Inc. + description + Linden Lab appearance utility for server-side avatar baking services. + license + Proprietary + license_file + LICENSES/llappearanceutility.txt + name + llappearance_utility + platforms + + linux + + archive + + hash + ce1261a54d877ab5530ae6a9134a77a3 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearance_viewer-update-llappearance-utility/rev/294906/arch/Linux/installer/llappearance_utility-0.0.1-linux-294906.tar.bz2 + + name + linux + + + version + 0.0.1 + + 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 + 5a0f74f8e736d91d2c2c6cbc71db90bd + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/309177/arch/Darwin/installer/llceflib-1.5.1.309177-darwin-309177.tar.bz2 + + name + darwin + + 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.1364.gf6bf57b + + llphysicsextensions_source + + copyright + Copyright (c) 2010, Linden Research, Inc. + license + internal + license_file + LICENSES/llphysicsextensions.txt + name + llphysicsextensions_source + platforms + + darwin + + archive + + hash + 468e88a527e610804c3eecf07f4ed70b + hash_algorithm + md5 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source_llphysicsextensions-update/rev/298369/arch/Darwin/installer/llphysicsextensions_source-1.0.298369-darwin-298369.tar.bz2 + + name + darwin + + linux + + archive + + hash + 793964e49c935b414c4bdbb8a0d14ad1 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source_llphysicsextensions-update/rev/298369/arch/Linux/installer/llphysicsextensions_source-1.0.298369-linux-298369.tar.bz2 + + name + linux + + windows + + archive + + hash + 922aad5261aac150e5ce3c094e57f373 + url + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llphysicsextensions-source_llphysicsextensions-update/rev/298369/arch/CYGWIN/installer/llphysicsextensions_source-1.0.298369-windows-298369.tar.bz2 + + name + windows + + + version + 1.0.298369 + + 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 + 07fca1531a27915f642a5c1d95008d54 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/oggvorbis_3p-update-oggvorbis/rev/296878/arch/Darwin/installer/ogg_vorbis-1.2.2-1.3.2.296878-darwin-296878.tar.bz2 + + name + darwin + + linux + + archive + + hash + b0cd31d5b07a9fc25c4d69ba2f95eace + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/oggvorbis_3p-update-oggvorbis/rev/296878/arch/Linux/installer/ogg_vorbis-1.2.2-1.3.2.296878-linux-296878.tar.bz2 + + name + linux + + 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 + + open-libndofdev + + copyright + Copyright (c) 2008, Jan Ciger (jan.ciger (at) gmail.com) + description + Open Source replacement for 3DConnection SDK + license + BSD + license_file + LICENSES/libndofdev.txt + name + open-libndofdev + platforms + + linux + + archive + + hash + b1245d467d5914a266efa16afeb55406 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/libndofdev_3p-update-libndofdev/rev/297553/arch/Linux/installer/open_libndofdev-0.3-linux-297553.tar.bz2 + + name + linux + + + version + 0.3 + + 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 + + linux + + archive + + hash + 15ebe611213c9577691ffbade081549d + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/openal_3p-update-openal/rev/297677/arch/Linux/installer/openal-1.12.854-1.1.0.297677-linux-297677.tar.bz2 + + name + linux + + 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-2011 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 + 0a77d56769e6075957f614be6575423e + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/openssl_3p-update-openssl/rev/297168/arch/Darwin/installer/openssl-1.0.1h.297168-darwin-297168.tar.bz2 + + name + darwin + + linux + + archive + + hash + c310ba9971cbd796b303c3be67fb11c6 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/openssl_3p-update-openssl/rev/297168/arch/Linux/installer/openssl-1.0.1h.297168-linux-297168.tar.bz2 + + name + linux + + windows + + archive + + hash + 213e62795373d12621282636fc760f20 + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows/lib-vc14/openssl-1.0.2e-windows-201601151130.tar.bz2 + + name + windows + + windows64 + + archive + + hash + 44f5553704a5fc74f23342ac1216175b + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/openssl-1.0.2e-windows64-201512121953.tar.bz2 + + name + windows64 + + + version + 1.0.2e + + 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 + 48ed7ddcf93fa3c751d677f5eb5f9367 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/slvoice_3p-update-slvoice/rev/298329/arch/Linux/installer/slvoice-3.2.0002.10426.298329-linux-298329.tar.bz2 + + name + linux + + 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 + 22608adaf54e8ddc9182a719ba6e2b32 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/uriparser_3p-update-uriparser/rev/299435/arch/Darwin/installer/uriparser-0.8.0.1-darwin-299435.tar.bz2 + + name + darwin + + linux + + archive + + hash + dddfc8dea540801f93ba0382cb1e3685 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/uriparser_3p-update-uriparser/rev/299435/arch/Linux/installer/uriparser-0.8.0.1-linux-299435.tar.bz2 + + name + linux + + 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 + + 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 + ffd3aab8e0c0ff6dadbce49ca2809078 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/xmlrpc-emi_3p-update-xmlrpc-epi/rev/297075/arch/Darwin/installer/xmlrpc_epi-0.54.1.297075-darwin-297075.tar.bz2 + + name + darwin + + linux + + archive + + hash + 30bb26d6cc78c16047fc85a63f48fcdb + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/xmlrpc-emi_3p-update-xmlrpc-epi/rev/297075/arch/Linux/installer/xmlrpc_epi-0.54.1.297075-linux-297075.tar.bz2 + + name + linux + + 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 + 727dd03de835cb4b0ab201101f3025da + hash_algorithm + md5 + url + http://depot.alchemyviewer.org/pub/windows64/lib-vc14/xmlrpc_epi-0.54.2-windows64-201512102119.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 + 1a79eeac199c2d94e4ae4e5d0194e25f + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/zlib_3p-update-zlib/rev/296881/arch/Darwin/installer/zlib-1.2.8.296881-darwin-296881.tar.bz2 + + name + darwin + + linux + + archive + + hash + 2eb8e59b6464222dcf4435016ad5f618 + hash_algorithm + md5 + url + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/zlib_3p-update-zlib/rev/296881/arch/Linux/installer/zlib-1.2.8.296881-linux-296881.tar.bz2 + + name + linux + + 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) 2014, Linden Research, Inc. + description + Second Life Viewer + license + LGPL + license_file + docs/LICENSE-source.txt + name + Second Life 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 + + default + + build + + + name + default + + + name + linux + + 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 + secondlife-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 + secondlife-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 + secondlife-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 + secondlife-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..fc61f3f8a 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) -# 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..f6d570c3f 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) @@ -70,56 +54,44 @@ if (WINDOWS) 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) 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 (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") diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake index c47363aa1..f43b3fda1 100644 --- a/indra/cmake/APR.cmake +++ b/indra/cmake/APR.cmake @@ -13,37 +13,43 @@ 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 - ) + set(APR_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/apr-1) if (LINUX) list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES}) 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/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..9cfb7d14c --- /dev/null +++ b/indra/cmake/CEFPlugin.cmake @@ -0,0 +1,40 @@ +# -*- 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) +endif (WINDOWS) diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index c6d716fed..708db7571 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -16,22 +16,21 @@ set(cmake_SOURCE_FILES 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 + DeploySharedLibs.cmake ELFIO.cmake EXPAT.cmake ExamplePlugin.cmake - FMODEX.cmake FMODSTUDIO.cmake FindAPR.cmake + FindAutobuild.cmake FindBerkeleyDB.cmake FindCARes.cmake FindColladadom.cmake @@ -41,7 +40,6 @@ set(cmake_SOURCE_FILES FindGooglePerfTools.cmake FindHunSpell.cmake FindJsonCpp.cmake - FindLLQtWebkit.cmake FindNDOF.cmake FindOpenJPEG.cmake FindTut.cmake @@ -71,8 +69,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 +89,6 @@ set(cmake_SOURCE_FILES Prebuilt.cmake PulseAudio.cmake Python.cmake - Qt4.cmake QuickTimePlugin.cmake RunBuildTest.cmake StateMachine.cmake @@ -101,7 +98,7 @@ set(cmake_SOURCE_FILES UnixInstall.cmake Variables.cmake ViewerMiscLibs.cmake - WebKitLibPlugin.cmake + WinManifest.cmake XmlRpcEpi.cmake ZLIB.cmake ) @@ -110,7 +107,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..0aafa312d 100644 --- a/indra/cmake/CURL.cmake +++ b/indra/cmake/CURL.cmake @@ -18,8 +18,5 @@ else (STANDALONE) list(APPEND CURL_LIBRARIES idn) endif(LINUX AND WORD_SIZE EQUAL 64) 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..3ec8b7847 --- /dev/null +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -0,0 +1,244 @@ +# -*- 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 + libdb-5.1.so + libexpat.so + libexpat.so.1 + libfreetype.so.6.6.2 + libfreetype.so.6 + libGLOD.so + libgmodule-2.0.so + libgobject-2.0.so + libhunspell-1.3.so.0.0.0 + libopenal.so + libopenjpeg.so + libuuid.so.16 + libuuid.so.16.0.22 + libfontconfig.so.1.8.0 + libfontconfig.so.1 + ) + + 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/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/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..e7ce595ef 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -2,10 +2,6 @@ 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) @@ -86,10 +82,17 @@ 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) + + set (FMOD_LIBRARY + debug ${FMOD_LINK_LIBRARY_DEBUG} + optimized ${FMOD_LINK_LIBRARY_RELEASE} + ) + use_prebuilt_binary(fmodstudio) set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodstudio) @@ -108,5 +111,5 @@ 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/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..09260582e 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) + set(GLOD_LIBRARIES GLOD) endif (STANDALONE) diff --git a/indra/cmake/GStreamer010Plugin.cmake b/indra/cmake/GStreamer010Plugin.cmake index 9fdf60eba..11028f6fb 100644 --- a/indra/cmake/GStreamer010Plugin.cmake +++ b/indra/cmake/GStreamer010Plugin.cmake @@ -17,7 +17,7 @@ else (STANDALONE) 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/glib-2.0 ${LIBS_PREBUILT_DIR}/include/libxml2 ${LIBS_PREBUILT_LEGACY_DIR}/include/gstreamer-0.10 ${LIBS_PREBUILT_LEGACY_DIR}/include/glib-2.0 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..3519ce4b9 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/jsoncpp) 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/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index dd1d806d5..f508d7e9a 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -1,18 +1,25 @@ # -*- 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 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/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..b742874e2 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(open-libndofdev) + endif (WINDOWS OR DARWIN) if (WINDOWS) set(NDOF_LIBRARY libndofdev) @@ -15,10 +19,7 @@ else (STANDALONE) set(NDOF_LIBRARY ndofdev) endif (WINDOWS) - set(NDOF_INCLUDE_DIR - ${LIBS_PREBUILT_DIR}/include/ndofdev - ${LIBS_PREBUILT_LEGACY_DIR}/include/ndofdev - ) + set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev) set(NDOF_FOUND 1) endif (STANDALONE) @@ -26,6 +27,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/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..e918de019 100644 --- a/indra/cmake/PulseAudio.cmake +++ b/indra/cmake/PulseAudio.cmake @@ -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..065e74da9 100644 --- a/indra/cmake/UI.cmake +++ b/indra/cmake/UI.cmake @@ -63,10 +63,7 @@ else (STANDALONE) ${LIBS_PREBUILT_LEGACY_DIR}/include/pixman-1 ) 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..015dfb162 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -23,26 +23,60 @@ 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.") + +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") @@ -98,25 +132,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 +166,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..c0a20e183 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -2,7 +2,7 @@ include(Prebuilt) if (NOT STANDALONE) - use_prebuilt_binary(vivox) + use_prebuilt_binary(slvoice) if(LINUX) use_prebuilt_binary(libuuid) if (${ARCH} STREQUAL "x86_64") 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..48e5130ad 100644 --- a/indra/cmake/ZLIB.cmake +++ b/indra/cmake/ZLIB.cmake @@ -17,9 +17,6 @@ else (STANDALONE) 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/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..930af7fc2 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -281,8 +281,8 @@ void F_STDCALL decode_dealloc(void *ptr, FMOD_MEMORY_TYPE type, const char *sour 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 @@ -477,7 +477,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"; } 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..047b6e5f1 100644 --- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp +++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp @@ -226,7 +226,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((utf16strtype*)input, len / 2); if (len % 2) { out_16.push_back((input)[len - 1] << 8); 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/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 72e03e709..c6a187840 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 @@ -251,11 +254,22 @@ set_source_files_properties(${llcommon_HEADER_FILES} 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(LLCOMMON_LINK_SHARED) + add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) + if(NOT WORD_SIZE EQUAL 32) + if(NOT WINDOWS) + add_definitions(-fPIC) + endif(NOT WINDOWS) + endif(NOT WORD_SIZE EQUAL 32) + 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 +294,5 @@ if (DARWIN) INSTALL_NAME_DIR "@executable_path/../Resources" ) endif (DARWIN) + +add_dependencies(llcommon stage_third_party_libs) 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..240d7ee3f 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -63,6 +63,7 @@ using namespace llsd; # include # include # include // GetPerformanceInfo() et al. +# include #elif LL_DARWIN # include # include @@ -108,78 +109,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 +141,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 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/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/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/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index 1c43bb218..96986b79f 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -97,4 +97,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/llcalcparser.h b/indra/llmath/llcalcparser.h index 8df507bc8..0fbf358a1 100644 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -33,10 +33,21 @@ #endif // Add this in if we want boost math constants. +#include + +#if defined(LL_WINDOWS) +#pragma warning(push) +// warning C4348: 'boost::spirit::terminal<...>::result_helper': redefinition of default parameter: parameter 3, 4 +#pragma warning(disable: 4348) +#endif + //#include #include #include +#if defined(LL_WINDOWS) +#pragma warning(pop) +#endif namespace expression { @@ -54,37 +65,43 @@ T max_glue(T a, T b) { return std::max(a, b); } + +struct lazy_pow_ +{ + template + struct result { typedef X type; }; + + template + X operator()(X x, Y y) const + { + return std::pow(x, y); + } +}; -template struct lazy_ufunc_ { - typedef RT result_type; - template - struct result { typedef RT type; }; + struct result { typedef A1 type; }; template - RT operator()(F f, A1 a1) const + A1 operator()(F f, A1 a1) const { return f(a1); } }; - -template + struct lazy_bfunc_ { - typedef RT result_type; - template - struct result { typedef RT type; }; + struct result { typedef A1 type; }; template - RT operator()(F f, A1 a1, A2 a2) const + A1 operator()(F f, A1 a1, A2 a2) const { return f(a1, a2); } }; - + //} // end namespace anonymous template @@ -172,9 +189,10 @@ struct grammar 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; - + boost::phoenix::function lazy_pow; + boost::phoenix::function lazy_ufunc; + boost::phoenix::function lazy_bfunc; + expression = term [_val = _1] >> *( ('+' >> term [_val += _1]) @@ -191,7 +209,7 @@ struct grammar factor = primary [_val = _1] - >> *( ("**" >> factor [_val = boost::phoenix::bind(static_cast(&std::pow),_val,_1)]) + >> *( ("**" >> factor [_val = lazy_pow(_val, _1)]) ) ; 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 ff37b849d..52a8fb36b 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" 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/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..9020b85ca 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} @@ -58,6 +59,7 @@ if (WINDOWS) PROPERTIES LINK_FLAGS "/OPT:NOREF" ) + 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..3fc0a9390 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -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/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/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/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/llview.cpp b/indra/llui/llview.cpp index d7a11ad00..df9510bf0 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -963,6 +963,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 +1002,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 +1134,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) { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 89d2fc33c..9a3f477ea 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -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, @@ -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/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/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/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..2245255cd 100644 --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -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/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 fb4d8b728..2c89f64da 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -4,20 +4,18 @@ 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,16 +32,16 @@ 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) + if (WINDOWS) set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) @@ -74,8 +72,7 @@ include_directories( ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} ${LLAPPEARANCE_INCLUDE_DIRS} -# ${LSCRIPT_INCLUDE_DIRS} -# ${LSCRIPT_INCLUDE_DIRS}/lscript_compile + ${CMAKE_CURRENT_SOURCE_DIR} ) set(viewer_SOURCE_FILES @@ -492,6 +489,7 @@ set(viewer_SOURCE_FILES llurlwhitelist.cpp lluserauth.cpp llvectorperfoptions.cpp + llversioninfo.cpp llvelocitybar.cpp llviewchildren.cpp llviewerassetstats.cpp @@ -596,7 +594,6 @@ set(viewer_SOURCE_FILES rlvui.cpp scriptcounter.cpp sgmemstat.cpp - sgversion.cpp shcommandhandler.cpp shfloatermediaticker.cpp wlfPanel_AdvSettings.cpp @@ -1030,6 +1027,7 @@ set(viewer_HEADER_FILES lluserauth.h llvectorperfoptions.h llvelocitybar.h + llversioninfo.h llviewchildren.h llviewerassetstats.h llviewerassetstorage.h @@ -1137,7 +1135,6 @@ set(viewer_HEADER_FILES roles_constants.h scriptcounter.h sgmemstat.h - sgversion.h shcommandhandler.h shfloatermediaticker.h wlfPanel_AdvSettings.h @@ -1145,6 +1142,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) @@ -1161,7 +1174,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/ @@ -1208,19 +1220,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. @@ -1249,7 +1277,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 @@ -1264,30 +1294,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 @@ -1300,27 +1329,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 @@ -1370,6 +1378,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}) @@ -1418,42 +1427,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") @@ -1466,6 +1441,127 @@ 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 + 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( @@ -1480,32 +1576,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 @@ -1514,57 +1585,30 @@ 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. @@ -1602,6 +1646,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} @@ -1625,6 +1670,8 @@ if (LINUX) DEPENDS ${VIEWER_BINARY_NAME} ) + add_dependencies(${VIEWER_BINARY_NAME} generate_viewer_version) + set(product ${VIEWER_BRANDING_NAME_CAMELCASE}-${ARCH}-${${ROOT_PROJECT_NAME}_VERSION}) add_custom_command( @@ -1679,27 +1726,37 @@ if (LINUX) 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.bz2) + add_dependencies(llpackage copy_l_viewer_manifest) 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 2013 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} @@ -1716,17 +1773,18 @@ 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 @@ -1764,7 +1822,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}") @@ -1773,18 +1831,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) @@ -1803,7 +1859,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) @@ -1813,143 +1869,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/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/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/icons/default/viewer_256.BMP b/indra/newview/icons/default/viewer_256.BMP new file mode 100644 index 000000000..7e27d0eca Binary files /dev/null and b/indra/newview/icons/default/viewer_256.BMP differ 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..446bb536f 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -1,207 +1,314 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 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 + !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,8 +317,9 @@ Function CloseSecondLife Push $0 FindWindow $0 "Second Life" "" IntCmp $0 0 DONE - MessageBox MB_YESNOCANCEL $(CloseSecondLifeInstMB) IDYES CLOSE IDNO DONE - Goto CANCEL_INSTALL ; IDCANCEL + + StrCmp $SKIP_DIALOGS "true" CLOSE + MessageBox MB_OKCANCEL $(CloseSecondLifeInstMB) IDOK CLOSE IDCANCEL CANCEL_INSTALL CANCEL_INSTALL: Quit @@ -221,214 +329,16 @@ Function CloseSecondLife 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. @@ -437,8 +347,7 @@ Function un.CloseSecondLife Push $0 FindWindow $0 "Second Life" "" IntCmp $0 0 DONE - MessageBox MB_YESNOCANCEL $(CloseSecondLifeUnInstMB) IDYES CLOSE IDNO DONE - Goto CANCEL_UNINSTALL ; IDCANCEL + MessageBox MB_OKCANCEL $(CloseSecondLifeUnInstMB) IDOK CLOSE IDCANCEL CANCEL_UNINSTALL CANCEL_UNINSTALL: Quit @@ -448,395 +357,262 @@ Function un.CloseSecondLife 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' +;!else +; ExecWait '"$INSTDIR\redist\vc_redist.x86.exe" /passive' +;!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 x64.lnk" "$\"$INSTDIR\$INSTEXE$\"" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$SMPROGRAMS\$STARTMENUFOLDER\Uninstall $INSTSHORTCUT x64.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" + ;CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$INSTDIR\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$SHORTCUT_LANG_PARAM" + CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" "$INSTDIR\uninst.exe" "" + + ;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 x64" +!else + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTSHORTCUT" +!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" + 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 + Delete "$INSTDIR\$INSTSHORTCUT.lnk" + Delete "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" + + 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..756e275f6 --- /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 Alchemy skal lukke ned..." +LangString CloseSecondLifeInstMB ${LANG_DANISH} "Alchemy 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 Alchemy skal lukke ned..." +LangString CloseSecondLifeUnInstMB ${LANG_DANISH} "Alchemy 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..b2e9299bd 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..b83a35cdb 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..b3f57380d 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..a45392ea1 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..0a77f8517 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..bb9978694 --- /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 Alchemy..." +LangString CloseSecondLifeInstMB ${LANG_POLISH} "Alchemy nie może zostać zainstalowane, ponieważ jest już włączone.$\n$\nZakończ swoje działania i wybierz OK aby zamknąć Alchemy i kontynuować.$\nWybierz CANCEL aby anulować instalację." + +; closesecondlife function (uninstall) +LangString CloseSecondLifeUnInstDP ${LANG_POLISH} "Oczekiwanie na zamknięcie Alchemy..." +LangString CloseSecondLifeUnInstMB ${LANG_POLISH} "Alchemy nie może zostać zainstalowane, ponieważ jest już włączone.$\n$\nZakończ swoje działania i wybierz OK aby zamknąć Alchemy 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..d7984a50c 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..e61d39f56 --- /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} "Ожидаю завершения работы Alchemy..." +LangString CloseSecondLifeInstMB ${LANG_RUSSIAN} "Alchemy уже работает, выполнить установку невозможно.$\n$\nЗавершите текущую операцию и нажмите кнопку «OK», чтобы закрыть Alchemy и продолжить установку.$\nНажмите кнопку «ОТМЕНА» для отказа от установки." + +; closesecondlife function (uninstall) +LangString CloseSecondLifeUnInstDP ${LANG_RUSSIAN} "Ожидаю завершения работы Alchemy..." +LangString CloseSecondLifeUnInstMB ${LANG_RUSSIAN} "Alchemy уже работает, выполнить удаление невозможно.$\n$\nЗавершите текущую операцию и нажмите кнопку «OK», чтобы закрыть Alchemy и продолжить удаление.$\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..5d524929f --- /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} "Alchemy'ın kapatılması bekleniyor..." +LangString CloseSecondLifeInstMB ${LANG_TURKISH} "Alchemy zaten çalışırken kapatılamaz.$\n$\nYaptığınız işi bitirdikten sonra Alchemy'ı 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} "Alchemy'ın kapatılması bekleniyor..." +LangString CloseSecondLifeUnInstMB ${LANG_TURKISH} "Alchemy zaten çalışırken kaldırılamaz.$\n$\nYaptığınız işi bitirdikten sonra Alchemy'ı 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..764ac0cfd 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/llappviewer.cpp b/indra/newview/llappviewer.cpp index 07a6a7244..a0ae18270 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" @@ -755,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 ); ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -1006,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; @@ -2161,7 +2155,7 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setString("ClientSettingsFile", 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 @@ -2647,17 +2641,18 @@ void LLAppViewer::removeCacheFiles(const std::string& file_mask) void LLAppViewer::writeSystemInfo() { - + 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 +2698,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 +2757,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]) { @@ -4505,19 +4490,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; @@ -4736,12 +4709,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/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/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/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 4f4ac87fc..14823bf31 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); @@ -268,17 +273,6 @@ LLFloaterAbout::LLFloaterAbout() // [/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"); @@ -293,16 +287,8 @@ LLFloaterAbout::LLFloaterAbout() support.append("\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("LLCEFLib/CEF Version: "); + support.append(LLCEFLIB_VERSION); support.append("\n"); if (gPacketsIn > 0) @@ -328,6 +314,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/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 6f1cb5e77..5f6f149c3 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -508,11 +508,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)); } diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 05ed662bf..9088a7374 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 << 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/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/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index dc656a0d3..497dc1e14 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -738,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) { @@ -859,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/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/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/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 750e9786b..5f2d4b403 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -749,6 +749,11 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) LL_INFOS() << "LLToolPie handleDoubleClick (becoming mouseDown)" << LL_ENDL; } + if (handleMediaDblClick(mPick)) + { + return TRUE; + } + if (gSavedSettings.getBOOL("DoubleClickAutoPilot")) { if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || @@ -879,56 +884,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) @@ -939,7 +998,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 || 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 d67c8d9d7..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" @@ -128,8 +128,8 @@ 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); @@ -215,17 +215,13 @@ 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 diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp new file mode 100644 index 000000000..e53de8be3 --- /dev/null +++ b/indra/newview/llversioninfo.cpp @@ -0,0 +1,174 @@ +/** + * @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_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_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..4e75535ec --- /dev/null +++ b/indra/newview/llversioninfo.h @@ -0,0 +1,82 @@ +/** + * @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, + BETA_VIEWER, + RELEASE_VIEWER + } ViewerMaturity; + static ViewerMaturity getViewerMaturity(); +}; + +#endif diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index abcac1719..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; 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/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 89b52d8b5..864dff39e 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -706,7 +706,10 @@ 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) { 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 1d137f161..15c3723af 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1832,7 +1832,7 @@ 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") && + if ((plugin_basename == "media_plugin_cef") && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) { media_source = LLViewerMedia::getSpareBrowserMediaSource(); @@ -1853,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 @@ -1883,7 +1889,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ { 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 @@ -1901,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(); @@ -2426,6 +2435,18 @@ 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) { @@ -2779,7 +2800,7 @@ bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask) { // 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) + if (MASK_CONTROL & mask && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END) { result = true; } @@ -2810,18 +2831,38 @@ bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask) if(!result) { - LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData(); - - result = mMediaSource->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)mMediaSource->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) { @@ -3221,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; } @@ -3240,19 +3281,19 @@ 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; } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 4dff5cde5..0a3485ccf 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -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/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d2fdcb6fa..1a97a3463 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" @@ -3845,7 +3845,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/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/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/llvovolume.cpp b/indra/newview/llvovolume.cpp index 970bbcae9..e24e14493 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) ; 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..efbedea7f 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: 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/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/default/xui/en-us/mime_types_mac.xml b/indra/newview/skins/default/xui/en-us/mime_types_mac.xml index 7931e55c0..47a6bf086 100644 --- a/indra/newview/skins/default/xui/en-us/mime_types_mac.xml +++ b/indra/newview/skins/default/xui/en-us/mime_types_mac.xml @@ -7,7 +7,7 @@ none - media_plugin_webkit + media_plugin_cef