diff options
145 files changed, 2317 insertions, 1579 deletions
diff --git a/LICENSE.GPL3 b/LICENSE.GPL3 deleted file mode 100644 index 265c4ea..0000000 --- a/LICENSE.GPL3 +++ /dev/null @@ -1,696 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - - The Qt GUI Toolkit is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - Contact: Nokia Corporation (qt-info@nokia.com) - - You may use, distribute and copy the Qt GUI Toolkit under the terms of - GNU General Public License version 3, which is displayed below. - -------------------------------------------------------------------------- - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. - -------------------------------------------------------------------------- - -In addition, as a special exception, Nokia gives permission to link the -code of its release of Qt with the OpenSSL project's "OpenSSL" library (or -modified versions of it that use the same license as the "OpenSSL" -library), and distribute the linked executables. You must comply with the -GNU General Public License versions 2.0 or 3.0 in all respects for all of -the code used other than the "OpenSSL" code. If you modify this file, you -may extend this exception to your version of the file, but you are not -obligated to do so. If you do not wish to do so, delete this exception -statement from your version of this file. @@ -644,7 +644,7 @@ CFG_SVG=yes CFG_DECLARATIVE=yes CFG_WEBKIT=auto # (yes|no|auto) -CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen" +CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb" CFG_GFX_ON="linuxfb multiscreen" CFG_GFX_PLUGIN_AVAILABLE= CFG_GFX_PLUGIN= @@ -3857,16 +3857,22 @@ if [ "$Edition" = "NokiaInternalBuild" ]; then elif [ "$Edition" = "OpenSource" ]; then while true; do echo "You are licensed to use this software under the terms of" - echo "the GNU General Public License (GPL) versions 3." - echo "You are also licensed to use this software under the terms of" echo "the Lesser GNU General Public License (LGPL) versions 2.1." + if [ -e "$relpath/LICENSE.GPL3" ]; then + echo "You are also licensed to use this software under the terms of" + echo "the GNU General Public License (GPL) versions 3." + affix="either" + else + affix="the" + fi echo - affix="either" if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $LicenseType license." + echo "You have already accepted the terms of the $LicenseType license." acceptance=yes else - echo "Type '3' to view the GNU General Public License version 3." + if [ -e "$relpath/LICENSE.GPL3" ]; then + echo "Type '3' to view the GNU General Public License version 3." + fi echo "Type 'L' to view the Lesser GNU General Public License version 2.1." echo "Type 'yes' to accept this license offer." echo "Type 'no' to decline this license offer." diff --git a/demos/boxes/qtbox.cpp b/demos/boxes/qtbox.cpp index 015bc95..54882fb 100644 --- a/demos/boxes/qtbox.cpp +++ b/demos/boxes/qtbox.cpp @@ -122,7 +122,7 @@ void ItemBase::duplicateSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) scene->addItem(itemBase->createNew(itemBase->m_size, itemBase->pos().x() + itemBase->m_size, itemBase->pos().y())); } @@ -137,7 +137,7 @@ void ItemBase::deleteSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) delete itemBase; } @@ -152,7 +152,7 @@ void ItemBase::growSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) { itemBase->prepareGeometryChange(); itemBase->m_size *= 2; @@ -171,7 +171,7 @@ void ItemBase::shrinkSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) { itemBase->prepareGeometryChange(); itemBase->m_size /= 2; @@ -257,6 +257,12 @@ void ItemBase::wheelEvent(QGraphicsSceneWheelEvent *event) m_size = MIN_ITEM_SIZE; } +int ItemBase::type() const +{ + return Type; +} + + bool ItemBase::isInResizeArea(const QPointF &pos) { return (-pos.y() < pos.x() - m_size + 9); diff --git a/demos/boxes/qtbox.h b/demos/boxes/qtbox.h index 6f39b0d..9465911 100644 --- a/demos/boxes/qtbox.h +++ b/demos/boxes/qtbox.h @@ -47,10 +47,11 @@ #include <QtGui/qvector3d.h> #include "glbuffers.h" -class ItemBase : public QObject, public QGraphicsItem +class ItemBase : public QGraphicsItem { - Q_OBJECT public: + enum { Type = UserType + 1 }; + ItemBase(int size, int x, int y); virtual ~ItemBase(); virtual QRectF boundingRect() const; @@ -64,6 +65,7 @@ protected: virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void keyPressEvent(QKeyEvent *event); virtual void wheelEvent(QGraphicsSceneWheelEvent *event); + virtual int type() const; bool isInResizeArea(const QPointF &pos); static void duplicateSelectedItems(QGraphicsScene *scene); diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml index 81d8352..f009631 100644 --- a/demos/declarative/contacts/contacts.qml +++ b/demos/declarative/contacts/contacts.qml @@ -105,7 +105,7 @@ Rectangle { } PropertyChanges { target: contactListView - locked: 1 + interactive: 0 } PropertyChanges { target: label diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml index c497e4e..9d2a3fb 100644 --- a/demos/declarative/flickr/flickr-mobile.qml +++ b/demos/declarative/flickr/flickr-mobile.qml @@ -23,12 +23,12 @@ Item { Mobile.GridDelegate { id: GridDelegate } GridView { id: PhotoGridView; model: RssModel; delegate: GridDelegate; cacheBuffer: 100 - cellWidth: 79; cellHeight: 79; width: parent.width; height: parent.height - 1 + cellWidth: 79; cellHeight: 79; width: parent.width; height: parent.height - 1; z: 6 } Mobile.ListDelegate { id: ListDelegate } ListView { - id: PhotoListView; model: RssModel; delegate: ListDelegate + id: PhotoListView; model: RssModel; delegate: ListDelegate; z: 6 width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; } states: State { @@ -42,11 +42,11 @@ Item { } } - Common.ImageDetails { id: ImageDetails; width: parent.width; anchors.left: Views.right; height: parent.height } - Mobile.TitleBar { id: TitleBar; width: parent.width; height: 40; opacity: 0.9 } + Mobile.ImageDetails { id: ImageDetails; width: parent.width; anchors.left: Views.right; height: parent.height; z:1 } + Mobile.TitleBar { id: TitleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 } Mobile.ToolBar { - id: ToolBar + id: ToolBar; z: 5 height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 button1Label: "Update"; button2Label: "View mode" onButton1Clicked: RssModel.reload() @@ -56,6 +56,8 @@ Item { states: State { name: "DetailedView" PropertyChanges { target: Views; x: -parent.width } + PropertyChanges { target: ToolBar; button1Label: "More..." } + PropertyChanges { target: ToolBar; onButton1Clicked: { } } PropertyChanges { target: ToolBar; button2Label: "Back" } PropertyChanges { target: ToolBar; onButton2Clicked: { } } } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 91e7c8d..890e020 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -8,7 +8,6 @@ Script { function photoClicked() { ImageDetails.photoTitle = title; - ImageDetails.photoDescription = description; ImageDetails.photoTags = tags; ImageDetails.photoWidth = photoWidth; ImageDetails.photoHeight = photoHeight; @@ -46,8 +45,9 @@ }, State { name: "Details"; extend: "Show" + //PropertyChanges { target: ImageDetails; z: 2 } ParentChange { target: Wrapper; parent: ImageDetails.frontContainer } - PropertyChanges { target: Wrapper; x: 20; y: 60 } + PropertyChanges { target: Wrapper; x: 20; y: 60; z: 1000 } PropertyChanges { target: Background; state: "DetailedView" } } ] diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml new file mode 100644 index 0000000..5f16a24 --- /dev/null +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -0,0 +1,129 @@ +import Qt 4.6 +import "../common" as Common + +Flipable { + id: Container + + property var frontContainer: ContainerFront + property string photoTitle: "" + property string photoTags: "" + property int photoWidth + property int photoHeight + property string photoType + property string photoAuthor + property string photoDate + property string photoUrl + property int rating: 2 + property var prevScale: 1.0 + + signal closed + + transform: Rotation { + id: Rotation + origin.x: Container.width / 2; + axis.y: 1; axis.z: 0 + } + + front: Item { + id: ContainerFront; anchors.fill: Container + + Rectangle { + anchors.fill: parent + color: "black"; opacity: 0.4 + } + + Connection { + sender: ToolBar; signal: "button1Clicked()" + script: if (Container.state=='') Container.state='Back'; else Container.state='' + } + + Column { + spacing: 10 + anchors { + left: parent.left; leftMargin: 20 + right: parent.right; rightMargin: 20 + top: parent.top; topMargin: 180 + } + Text { id: TitleText; font.bold: true; color: "white"; elide: "ElideRight"; text: Container.photoTitle } + Text { id: Size; color: "white"; elide: "ElideRight"; text: "<b>Size:</b> " + Container.photoWidth + 'x' + Container.photoHeight } + Text { id: Type; color: "white"; elide: "ElideRight"; text: "<b>Type:</b> " + Container.photoType } + Text { id: Author; color: "white"; elide: "ElideRight"; text: "<b>Author:</b> " + Container.photoAuthor } + Text { id: Date; color: "white"; elide: "ElideRight"; text: "<b>Published:</b> " + Container.photoDate } + Text { id: TagsLabel; color: "white"; elide: "ElideRight"; text: Container.photoTags == "" ? "" : "<b>Tags:</b> " } + Text { id: Tags; color: "white"; elide: "ElideRight"; elide: "ElideRight"; text: Container.photoTags } + } + } + + back: Item { + anchors.fill: Container + + Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 } + + Common.Progress { anchors.centerIn: parent; width: 200; height: 18; progress: BigImage.progress; visible: BigImage.status!=1 } + Flickable { + id: Flick; anchors.fill: parent; clip: true + viewportWidth: ImageContainer.width; viewportHeight: ImageContainer.height + + Item { + id: ImageContainer + width: Math.max(BigImage.width * BigImage.scale, Flick.width); + height: Math.max(BigImage.height * BigImage.scale, Flick.height); + + Image { + id: BigImage; source: Container.photoUrl; scale: Slider.value + // Center image if it is smaller than the flickable area. + x: ImageContainer.width > width*scale ? (ImageContainer.width - width*scale) / 2 : 0 + y: ImageContainer.height > height*scale ? (ImageContainer.height - height*scale) / 2 : 0 + smooth: !Flick.moving + onStatusChanged : { + // Default scale shows the entire image. + if (status == 1 && width != 0) { + Slider.minimum = Math.min(Flick.width / width, Flick.height / height); + prevScale = Math.min(Slider.minimum, 1); + Slider.value = prevScale; + } + } + } + } + } + + Text { + text: "Image Unavailable" + visible: BigImage.status == 'Error' + anchors.centerIn: parent; color: "white"; font.bold: true + } + + Common.Slider { + id: Slider; visible: { BigImage.status == 1 && maximum > minimum } + anchors { + bottom: parent.bottom; bottomMargin: 65 + left: parent.left; leftMargin: 25 + right: parent.right; rightMargin: 25 + } + onValueChanged: { + if (BigImage.width * value > Flick.width) { + var xoff = (Flick.width/2 + Flick.viewportX) * value / prevScale; + Flick.viewportX = xoff - Flick.width/2; + } + if (BigImage.height * value > Flick.height) { + var yoff = (Flick.height/2 + Flick.viewportY) * value / prevScale; + Flick.viewportY = yoff - Flick.height/2; + } + prevScale = value; + } + } + } + + states: State { + name: "Back" + PropertyChanges { target: Rotation; angle: 180 } + } + + transitions: Transition { + SequentialAnimation { + PropertyAction { target: BigImage; property: "smooth"; value: false } + NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } + PropertyAction { target: BigImage; property: "smooth"; value: !Flick.moving } + } + } +} diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp index b4fd0c9..79de011 100644 --- a/demos/sub-attaq/graphicsscene.cpp +++ b/demos/sub-attaq/graphicsscene.cpp @@ -51,6 +51,7 @@ #include "animationmanager.h" #include "qanimationstate.h" #include "progressitem.h" +#include "textinformationitem.h" //Qt #include <QtCore/QPropertyAnimation> @@ -112,6 +113,8 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode) //The item that display score and level progressItem = new ProgressItem(backgroundItem); + textInformationItem = new TextInformationItem(backgroundItem); + textInformationItem->hide(); //We create the boat boat = new Boat(); addItem(boat); @@ -244,15 +247,15 @@ void GraphicsScene::setupScene(const QList<QAction *> &actions) lettersFadingState->setAnimation(lettersGroupFading); //if new game then we fade out the welcome screen and start playing - lettersMovingState->addTransition(newAction, SIGNAL(triggered()),lettersFadingState); - lettersFadingState->addTransition(lettersFadingState, SIGNAL(animationFinished()),gameState); + lettersMovingState->addTransition(newAction, SIGNAL(triggered()), lettersFadingState); + lettersFadingState->addTransition(lettersFadingState, SIGNAL(animationFinished()), gameState); //New Game is triggered then player start playing - gameState->addTransition(newAction, SIGNAL(triggered()),gameState); + gameState->addTransition(newAction, SIGNAL(triggered()), gameState); //Wanna quit, then connect to CTRL+Q - gameState->addTransition(quitAction, SIGNAL(triggered()),final); - lettersMovingState->addTransition(quitAction, SIGNAL(triggered()),final); + gameState->addTransition(quitAction, SIGNAL(triggered()), final); + lettersMovingState->addTransition(quitAction, SIGNAL(triggered()), final); //Welcome screen is the initial state machine->setInitialState(lettersMovingState); diff --git a/demos/sub-attaq/graphicsscene.h b/demos/sub-attaq/graphicsscene.h index 073ad17..8fa62f7 100644 --- a/demos/sub-attaq/graphicsscene.h +++ b/demos/sub-attaq/graphicsscene.h @@ -54,6 +54,7 @@ class Torpedo; class Bomb; class PixmapItem; class ProgressItem; +class TextInformationItem; QT_BEGIN_NAMESPACE class QAction; QT_END_NAMESPACE @@ -108,6 +109,7 @@ private: Mode mode; PixmapItem *backgroundItem; ProgressItem *progressItem; + TextInformationItem *textInformationItem; QAction * newAction; QAction * quitAction; Boat *boat; diff --git a/demos/sub-attaq/states.cpp b/demos/sub-attaq/states.cpp index 75a2615..5c809cb 100644 --- a/demos/sub-attaq/states.cpp +++ b/demos/sub-attaq/states.cpp @@ -47,6 +47,7 @@ #include "torpedo.h" #include "animationmanager.h" #include "progressitem.h" +#include "textinformationitem.h" //Qt #include <QtGui/QMessageBox> @@ -226,8 +227,15 @@ void LostState::onEntry(QEvent *) //We clear the scene scene->clearScene(); - //we have only one view - QMessageBox::information(scene->views().at(0),"You lose",message); + //We inform the player + scene->textInformationItem->setMessage(message); + scene->textInformationItem->show(); +} + +void LostState::onExit(QEvent *) +{ + //we hide the information + scene->textInformationItem->hide(); } /** Win State */ @@ -242,7 +250,7 @@ void WinState::onEntry(QEvent *) QString message; if (scene->levelsData.size() - 1 != game->currentLevel) { - message = QString("You win the level %1. Your score is %2.\nPress Space to continue after closing this dialog.").arg(game->currentLevel+1).arg(game->score); + message = QString("You win the level %1. Your score is %2.\nPress Space to continue.").arg(game->currentLevel+1).arg(game->score); //We increment the level number game->currentLevel++; } else { @@ -253,8 +261,15 @@ void WinState::onEntry(QEvent *) game->score = 0; } - //we have only one view - QMessageBox::information(scene->views().at(0),"You win",message); + //We inform the player + scene->textInformationItem->setMessage(message); + scene->textInformationItem->show(); +} + +void WinState::onExit(QEvent *) +{ + //we hide the information + scene->textInformationItem->hide(); } /** UpdateScore State */ diff --git a/demos/sub-attaq/states.h b/demos/sub-attaq/states.h index 7635c0c..3176571 100644 --- a/demos/sub-attaq/states.h +++ b/demos/sub-attaq/states.h @@ -113,6 +113,7 @@ public: protected: void onEntry(QEvent *); + void onExit(QEvent *); private : GraphicsScene *scene; PlayState *game; @@ -125,6 +126,7 @@ public: protected: void onEntry(QEvent *); + void onExit(QEvent *); private : GraphicsScene *scene; PlayState *game; diff --git a/demos/sub-attaq/sub-attaq.pro b/demos/sub-attaq/sub-attaq.pro index ad1327d..ba2b54b 100644 --- a/demos/sub-attaq/sub-attaq.pro +++ b/demos/sub-attaq/sub-attaq.pro @@ -1,5 +1,4 @@ contains(QT_CONFIG, opengl):QT += opengl - HEADERS += boat.h \ bomb.h \ mainwindow.h \ @@ -13,7 +12,8 @@ HEADERS += boat.h \ submarine_p.h \ custompropertyanimation.h \ qanimationstate.h \ - progressitem.h + progressitem.h \ + textinformationitem.h SOURCES += boat.cpp \ bomb.cpp \ main.cpp \ @@ -26,12 +26,18 @@ SOURCES += boat.cpp \ states.cpp \ custompropertyanimation.cpp \ qanimationstate.cpp \ - progressitem.cpp + progressitem.cpp \ + textinformationitem.cpp RESOURCES += subattaq.qrc # install target.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS sub-attaq.pro pics +sources.files = $$SOURCES \ + $$HEADERS \ + $$RESOURCES \ + $$FORMS \ + sub-attaq.pro \ + pics sources.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq -INSTALLS += target sources - +INSTALLS += target \ + sources diff --git a/examples/effects/lighting/shadoweffect.cpp b/demos/sub-attaq/textinformationitem.cpp index 16e52fb..759aa56 100644 --- a/examples/effects/lighting/shadoweffect.cpp +++ b/demos/sub-attaq/textinformationitem.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,39 +38,17 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "textinformationitem.h" +#include "pixmapitem.h" -#include "shadoweffect.h" - -#include <math.h> - -ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source) - : QGraphicsDropShadowEffect() - , item(item), m_lightSource(source) -{ - setBlurRadius(8); - m_color = color(); -} - -void ShadowEffect::adjustForItem() +TextInformationItem::TextInformationItem (QGraphicsItem * parent) + : QGraphicsTextItem(parent) { - QPointF delta = item->pos() - m_lightSource->pos(); - setOffset(delta.toPoint() / 30); - - qreal dx = delta.x(); - qreal dy = delta.y(); - qreal dd = sqrt(dx * dx + dy * dy); - m_color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7)); - setColor(m_color); + setFont(QFont("Comic Sans MS", 25)); } - -QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const -{ - const_cast<ShadowEffect *>(this)->adjustForItem(); - return QGraphicsDropShadowEffect::boundingRectFor(rect); -} - -void ShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +#include <QDebug> +void TextInformationItem::setMessage(const QString& text) { - adjustForItem(); - QGraphicsDropShadowEffect::draw(painter, source); + setHtml(text); + setPos(parentItem()->boundingRect().center().x() - boundingRect().size().width()/2 , parentItem()->boundingRect().center().y()); } diff --git a/examples/effects/lighting/shadoweffect.h b/demos/sub-attaq/textinformationitem.h index 64314e5..aa7f0be 100644 --- a/examples/effects/lighting/shadoweffect.h +++ b/demos/sub-attaq/textinformationitem.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,28 +39,17 @@ ** ****************************************************************************/ -#ifndef SHADOWEFFECT_H -#define SHADOWEFFECT_H +#ifndef TEXTINFORMATIONITEM_H +#define TEXTINFORMATIONITEM_H -#include <QGraphicsEffect> -#include <QGraphicsItem> +//Qt +#include <QtGui/QGraphicsTextItem> -class ShadowEffect: public QGraphicsDropShadowEffect +class TextInformationItem : public QGraphicsTextItem { public: - ShadowEffect(QGraphicsItem *item, QGraphicsItem *source); - - QRectF boundingRectFor(const QRectF &rect) const; - - void draw(QPainter *painter, QGraphicsEffectSource *source); - -private: - void adjustForItem(); - -private: - QColor m_color; - QGraphicsItem *item; - QGraphicsItem *m_lightSource; + TextInformationItem(QGraphicsItem * parent = 0); + void setMessage(const QString& text); }; -#endif // SHADOWEFFECT_H +#endif // TEXTINFORMATIONITEM_H diff --git a/doc/src/examples/diagramscene.qdoc b/doc/src/examples/diagramscene.qdoc index 9f5d785..2011aa9 100644 --- a/doc/src/examples/diagramscene.qdoc +++ b/doc/src/examples/diagramscene.qdoc @@ -704,7 +704,7 @@ We use \c itemChange() and \c focusOutEvent() to notify the \c DiagramScene when the text item loses focus and gets selected. - Vi reimplement the functions that handle mouse events to make it + We reimplement the functions that handle mouse events to make it possible to alter the mouse behavior of QGraphicsTextItem. \section1 DiagramTextItem Implementation @@ -729,7 +729,8 @@ \snippet examples/graphicsview/diagramscene/diagramtextitem.cpp 2 \c DiagramScene uses the signal emitted when the text item looses - remove the item if it is empty, i.e., it contains no text. + focus to remove the item if it is empty, i.e., it contains no + text. This is the implementation of \c mouseDoubleClickEvent(): @@ -838,7 +839,7 @@ \snippet examples/graphicsview/diagramscene/arrow.cpp 7 - If the line is selected we draw to dotted lines that are + If the line is selected, we draw two dotted lines that are parallel with the line of the arrow. We do not use the default implementation, which uses \l{QGraphicsItem::}{boundingRect()} because the QRect bounding rectangle is considerably larger than diff --git a/doc/src/snippets/code/src_corelib_io_qsettings.cpp b/doc/src/snippets/code/src_corelib_io_qsettings.cpp index 12a204b..c380d19 100644 --- a/doc/src/snippets/code/src_corelib_io_qsettings.cpp +++ b/doc/src/snippets/code/src_corelib_io_qsettings.cpp @@ -309,7 +309,7 @@ int main(int argc, char *argv[]) const QSettings::Format XmlFormat = QSettings::registerFormat("xml", readXmlFile, writeXmlFile); - QSettings settings(XmlFormat, QSettings::UserSettings, "MySoft", + QSettings settings(XmlFormat, QSettings::UserScope, "MySoft", "Star Runner"); ... diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index 6355850..354050d 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -2067,6 +2067,9 @@ QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox, QSplitter, QStatusBar, QTextEdit, and QToolTip. + The value is relative to the contents rect in the \l{The + Box Model}{box model}. + Example: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 63 @@ -2084,6 +2087,9 @@ QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox, QSplitter, QStatusBar, QTextEdit, and QToolTip. + The value is relative to the contents rect in the \l{The + Box Model}{box model}. + Example: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 64 @@ -2121,6 +2127,9 @@ If this property is not specified, the minimum height is derived based on the widget's contents and the style. + The value is relative to the contents rect in the \l{The + Box Model}{box model}. + Example: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 66 @@ -2141,6 +2150,9 @@ If this property is not specified, the minimum width is derived based on the widget's contents and the style. + The value is relative to the contents rect in the \l{The + Box Model}{box model}. + Example: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 67 diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp index a78548c..9644049 100644 --- a/examples/animation/states/main.cpp +++ b/examples/animation/states/main.cpp @@ -179,8 +179,8 @@ int main(int argc, char *argv[]) // State 3 state3->assignProperty(button, "text", "Switch to state 1"); - state3->assignProperty(p1, "geometry", QRectF(5, 5, 64, 64)); - state3->assignProperty(p2, "geometry", QRectF(5, 5 + 64 + 5, 64, 64)); + state3->assignProperty(p1, "geometry", QRectF(0, 5, 64, 64)); + state3->assignProperty(p2, "geometry", QRectF(0, 5 + 64 + 5, 64, 64)); state3->assignProperty(p3, "geometry", QRectF(5, 5 + (64 + 5) + 64, 64, 64)); state3->assignProperty(p4, "geometry", QRectF(5 + 64 + 5, 5, 64, 64)); state3->assignProperty(p5, "geometry", QRectF(5 + 64 + 5, 5 + 64 + 5, 64, 64)); diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index eac8bb5..2148ef4 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -104,9 +104,9 @@ Rectangle { // Make the detailed view fill the entire list area PropertyChanges { target: wrapper; height: List.height } // Move the list so that this item is at the top. - PropertyChanges { target: wrapper.ListView.view; explicit: true; yPosition: wrapper.y } + PropertyChanges { target: wrapper.ListView.view; explicit: true; viewportY: wrapper.y } // Disallow flicking while we're in detailed view - PropertyChanges { target: wrapper.ListView.view; locked: 1 } + PropertyChanges { target: wrapper.ListView.view; interactive: false } } ] transitions: [ @@ -115,7 +115,7 @@ Rectangle { ParallelAnimation { ColorAnimation { property: "color"; duration: 500 } NumberAnimation { - duration: 300; properties: "detailsOpacity,x,yPosition,height,width" + duration: 300; properties: "detailsOpacity,x,viewportY,height,width" } } } diff --git a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml index d16e3ca..8ee51c3 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml @@ -84,7 +84,7 @@ Item { } PropertyChanges { target: contactListView - locked: 1 + interactive: 0 } PropertyChanges { target: label diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml index bf73367..76dc3e2 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml @@ -102,7 +102,7 @@ Item { } PropertyChanges { target: contactListView - locked: 1 + interactive: 0 } PropertyChanges { target: label diff --git a/examples/effects/lighting/lighting.cpp b/examples/effects/lighting/lighting.cpp index 2294b36..e309e2e 100644 --- a/examples/effects/lighting/lighting.cpp +++ b/examples/effects/lighting/lighting.cpp @@ -43,8 +43,6 @@ #include <QtGui> -#include "shadoweffect.h" - #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -98,7 +96,7 @@ void Lighting::setupScene() item->setPen(QPen(Qt::black)); item->setBrush(QBrush(Qt::white)); - item->setGraphicsEffect(new ShadowEffect(item, m_lightSource)); + item->setGraphicsEffect(new QGraphicsDropShadowEffect); item->setZValue(1); item->setPos(i * 80, j * 80); m_scene.addItem(item); @@ -114,6 +112,24 @@ void Lighting::animate() qreal xs = 200 * sin(angle) - 40 + 25; qreal ys = 200 * cos(angle) - 40 + 25; m_lightSource->setPos(xs, ys); + + for (int i = 0; i < m_items.size(); ++i) { + QGraphicsItem *item = m_items.at(i); + Q_ASSERT(item); + QGraphicsDropShadowEffect *effect = static_cast<QGraphicsDropShadowEffect *>(item->graphicsEffect()); + Q_ASSERT(effect); + + QPointF delta(item->x() - xs, item->y() - ys); + effect->setOffset(delta.toPoint() / 30); + + qreal dx = delta.x(); + qreal dy = delta.y(); + qreal dd = sqrt(dx * dx + dy * dy); + QColor color = effect->color(); + color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7)); + effect->setColor(color); + } + m_scene.update(); } diff --git a/examples/effects/lighting/lighting.h b/examples/effects/lighting/lighting.h index 3e12fdf..eef5cae 100644 --- a/examples/effects/lighting/lighting.h +++ b/examples/effects/lighting/lighting.h @@ -45,8 +45,6 @@ #include <QGraphicsEffect> #include <QGraphicsView> -#include "shadoweffect.h" - class Lighting: public QGraphicsView { Q_OBJECT diff --git a/examples/effects/lighting/lighting.pro b/examples/effects/lighting/lighting.pro index ea9d5f6..432d1b5 100644 --- a/examples/effects/lighting/lighting.pro +++ b/examples/effects/lighting/lighting.pro @@ -1,5 +1,5 @@ -SOURCES += main.cpp lighting.cpp shadoweffect.cpp -HEADERS += lighting.h shadoweffect.h +SOURCES += main.cpp lighting.cpp +HEADERS += lighting.h # install target.path = $$[QT_INSTALL_EXAMPLES]/effects/lighting diff --git a/examples/qws/dbscreen/dbscreen.cpp b/examples/qws/dbscreen/dbscreen.cpp index aa33a97..3d3b15b 100644 --- a/examples/qws/dbscreen/dbscreen.cpp +++ b/examples/qws/dbscreen/dbscreen.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/qws/dbscreen/dbscreen.h b/examples/qws/dbscreen/dbscreen.h index a3c392e..b177cfc 100644 --- a/examples/qws/dbscreen/dbscreen.h +++ b/examples/qws/dbscreen/dbscreen.h @@ -1,11 +1,11 @@ - /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions @@ -36,11 +36,8 @@ ** ** ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +****************************************************************************/ #ifndef DBSCREEN_H #define DBSCREEN_H diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index 8371229..4a33e67 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -684,6 +684,10 @@ void JIT::emit_op_catch(Instruction* currentInstruction) killLastResultRegister(); // FIXME: Implicitly treat op_catch as a labeled statement, and remove this line of code. peek(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*)); emitPutVirtualRegister(currentInstruction[1].u.operand); +#ifdef QT_BUILD_SCRIPT_LIB + JITStubCall stubCall(this, JITStubs::cti_op_debug_catch); + stubCall.call(); +#endif } void JIT::emit_op_jmp_scopes(Instruction* currentInstruction) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 2563848..f0d3b84 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -2713,15 +2713,22 @@ DEFINE_STUB_FUNCTION(void, op_debug) int debugHookID = stackFrame.args[0].int32(); int firstLine = stackFrame.args[1].int32(); int lastLine = stackFrame.args[2].int32(); -#ifdef QT_BUILD_SCRIPT_LIB int column = stackFrame.args[3].int32(); -#else - int column = -1; -#endif stackFrame.globalData->interpreter->debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column); } +#ifdef QT_BUILD_SCRIPT_LIB +DEFINE_STUB_FUNCTION(void, op_debug_catch) +{ + STUB_INIT_STACK_FRAME(stackFrame); + CallFrame* callFrame = stackFrame.callFrame; + if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) { + debugger->exceptionCatch(DebuggerCallFrame(callFrame), callFrame->codeBlock()->ownerNode()->sourceID()); + } +} +#endif + DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw) { STUB_INIT_STACK_FRAME(stackFrame); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index 0493189..60bf64a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -221,6 +221,9 @@ namespace JITStubs { extern "C" { void JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION); +#ifdef QT_BUILD_SCRIPT_LIB + void JIT_STUB cti_op_debug_catch(STUB_ARGS_DECLARATION); +#endif void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION); void JIT_STUB cti_op_pop_scope(STUB_ARGS_DECLARATION); diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index 621c836..94f85a5 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -1437,6 +1437,9 @@ extern Q_GUI_EXPORT bool qt_win_ignoreNextMouseReleaseEvent; HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable) { +#if !defined(Q_OS_WINCE) + LockWindowUpdate(host->window()->winId()); +#endif EnableWindow(host->window()->winId(), fEnable); if (!fEnable) { @@ -1447,7 +1450,9 @@ HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable) QApplicationPrivate::leaveModal(host); } qt_win_ignoreNextMouseReleaseEvent = false; - +#if !defined(Q_OS_WINCE) + LockWindowUpdate(0); +#endif return S_OK; } diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h index 50dedc1..9b7ff5d 100644 --- a/src/corelib/arch/qatomic_windows.h +++ b/src/corelib/arch/qatomic_windows.h @@ -68,7 +68,7 @@ # if _WIN32_WCE < 0x600 && defined(_X86_) // For X86 Windows CE, include winbase.h to catch inline functions which -// overwrite the regular definitions inside of coredll.dll. +// override the regular definitions inside of coredll.dll. // Though one could use the original version of Increment/Decrement, others are // not exported at all. # include <winbase.h> @@ -76,19 +76,21 @@ // It's safer to remove the volatile and let the compiler add it as needed. # define QT_INTERLOCKED_NO_VOLATILE -# else // _WIN32_WCE >= 0x600 || _X86_ +# else // _WIN32_WCE >= 0x600 || !_X86_ # define QT_INTERLOCKED_PROTOTYPE __cdecl # define QT_INTERLOCKED_DECLARE_PROTOTYPES -# if _WIN32_WCE >= 0x600 && defined(_X86_) -# define QT_INTERLOCKED_PREFIX _ -# define QT_INTERLOCKED_INTRINSIC +# if _WIN32_WCE >= 0x600 +# if defined(_X86_) +# define QT_INTERLOCKED_PREFIX _ +# define QT_INTERLOCKED_INTRINSIC +# endif # else # define QT_INTERLOCKED_NO_VOLATILE # endif -# endif // _WIN32_WCE >= 0x600 || _X86_ +# endif // _WIN32_WCE >= 0x600 || !_X86_ #endif // Q_OS_WINCE @@ -131,10 +133,10 @@ extern "C" { long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchange )(long QT_INTERLOCKED_VOLATILE *, long); long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long); -# if !defined(__i386__) && !defined(_M_IX86) - long QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); - long QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); - __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, long); +# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) + void * QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); + void * QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); + __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64); # endif } @@ -190,7 +192,7 @@ extern "C" { QT_INTERLOCKED_REMOVE_VOLATILE( value ), \ valueToAdd ) -#if defined(__i386__) || defined(_M_IX86) +#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ reinterpret_cast<void *>( \ @@ -209,7 +211,7 @@ extern "C" { QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ valueToAdd ) -#else // !defined(__i386__) && !defined(_M_IX86) +#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ QT_INTERLOCKED_FUNCTION(InterlockedCompareExchangePointer)( \ @@ -227,7 +229,7 @@ extern "C" { QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ valueToAdd ) -#endif // !defined(__i386__) && !defined(_M_IX86) +#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 55eb4fa..ed403cb 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1372,6 +1372,9 @@ inline void qt_noop() {} #ifdef QT_BOOTSTRAPPED # define QT_NO_EXCEPTIONS #endif +#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS) +# define QT_NO_EXCEPTIONS +#endif #ifdef QT_NO_EXCEPTIONS # define QT_TRY if (true) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 75f8e54..ac9f532 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -122,7 +122,12 @@ void debugBinaryString(const char *data, qint64 maxlen) */ QIODevicePrivate::QIODevicePrivate() : openMode(QIODevice::NotOpen), buffer(QIODEVICE_BUFFERSIZE), - pos(0), devicePos(0), accessMode(Unset) + pos(0), devicePos(0) + , baseReadLineDataCalled(false) + , accessMode(Unset) +#ifdef QT_NO_QOBJECT + , q_ptr(0) +#endif { } diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 48f34d6..fa3ed09 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -292,14 +292,20 @@ class QTemporaryFileEngine : public QFSFileEngine Q_DECLARE_PRIVATE(QFSFileEngine) public: QTemporaryFileEngine(const QString &file, bool fileIsTemplate = true) - : QFSFileEngine(file), filePathIsTemplate(fileIsTemplate) + : QFSFileEngine(), filePathIsTemplate(fileIsTemplate) { + Q_D(QFSFileEngine); + d->filePath = file; + + if (!filePathIsTemplate) + QFSFileEngine::setFileName(file); } ~QTemporaryFileEngine(); bool isReallyOpen(); void setFileName(const QString &file); + void setFileTemplate(const QString &fileTemplate); bool open(QIODevice::OpenMode flags); bool remove(); @@ -336,6 +342,13 @@ void QTemporaryFileEngine::setFileName(const QString &file) QFSFileEngine::setFileName(file); } +void QTemporaryFileEngine::setFileTemplate(const QString &fileTemplate) +{ + Q_D(QFSFileEngine); + if (filePathIsTemplate) + d->filePath = fileTemplate; +} + bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) { Q_D(QFSFileEngine); @@ -382,12 +395,19 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) return false; } + QString template_ = d->filePath; d->filePath = QString::fromLocal8Bit(filename); - filePathIsTemplate = false; d->nativeInitFileName(); - d->closeFileHandle = true; delete [] filename; - return QFSFileEngine::open(openMode); + + if (QFSFileEngine::open(openMode)) { + filePathIsTemplate = false; + return true; + } + + d->filePath = template_; + d->nativeFilePath.clear(); + return false; #endif } @@ -533,7 +553,8 @@ QTemporaryFile::QTemporaryFile() QTemporaryFile::QTemporaryFile(const QString &templateName) : QFile(*new QTemporaryFilePrivate, 0) { - setFileTemplate(templateName); + Q_D(QTemporaryFile); + d->templateName = templateName; } /*! @@ -567,7 +588,8 @@ QTemporaryFile::QTemporaryFile(QObject *parent) QTemporaryFile::QTemporaryFile(const QString &templateName, QObject *parent) : QFile(*new QTemporaryFilePrivate, parent) { - setFileTemplate(templateName); + Q_D(QTemporaryFile); + d->templateName = templateName; } #endif @@ -671,10 +693,10 @@ QString QTemporaryFile::fileTemplate() const */ void QTemporaryFile::setFileTemplate(const QString &name) { - Q_ASSERT(!isOpen()); Q_D(QTemporaryFile); - fileEngine()->setFileName(name); d->templateName = name; + if (d->fileEngine) + static_cast<QTemporaryFileEngine*>(d->fileEngine)->setFileTemplate(name); } /*! diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 0a6c628..ec8fb76 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -601,7 +601,6 @@ void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent, void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) { - Q_Q(QAbstractItemModel); QVector<QPersistentModelIndexData *> persistent_moved_explicitly; QVector<QPersistentModelIndexData *> persistent_moved_in_source; QVector<QPersistentModelIndexData *> persistent_moved_in_destination; @@ -2469,7 +2468,6 @@ void QAbstractItemModel::endRemoveRows() */ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation) { - Q_Q(QAbstractItemModel); // Don't move the range within itself. if ( ( destinationParent == srcParent ) && ( destinationStart >= start ) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 30f1cc8..c311465 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -943,7 +943,7 @@ QByteArray QMetaObject::normalizedType(const char *type) if (!type || !*type) return result; - QVarLengthArray<char> stackbuf((int)strlen(type)); + QVarLengthArray<char> stackbuf(int(strlen(type)) + 1); qRemoveWhitespace(type, stackbuf.data()); int templdepth = 0; qNormalizeType(stackbuf.data(), templdepth, result); @@ -968,10 +968,9 @@ QByteArray QMetaObject::normalizedSignature(const char *method) if (!method || !*method) return result; int len = int(strlen(method)); - char stackbuf[64]; - char *buf = (len >= 64 ? new char[len+1] : stackbuf); - qRemoveWhitespace(method, buf); - char *d = buf; + QVarLengthArray<char> stackbuf(len + 1); + char *d = stackbuf.data(); + qRemoveWhitespace(method, d); result.reserve(len); @@ -987,8 +986,6 @@ QByteArray QMetaObject::normalizedSignature(const char *method) result += *d++; } - if (buf != stackbuf) - delete [] buf; return result; } diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 4d9d3b2..c0c97b8 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3364,10 +3364,10 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign && (currentThreadData != sender->d_func()->threadData || receiver->d_func()->threadData != sender->d_func()->threadData)) || (c->connectionType == Qt::QueuedConnection)) { - queued_activate(sender, signal_absolute_index, c, argv); + queued_activate(sender, signal_absolute_index, c, argv ? argv : empty_argv); continue; } else if (c->connectionType == Qt::BlockingQueuedConnection) { - blocking_activate(sender, signal_absolute_index, c, argv); + blocking_activate(sender, signal_absolute_index, c, argv ? argv : empty_argv); continue; } @@ -3442,7 +3442,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign void QMetaObject::activate(QObject *sender, int signal_index, void **argv) { const QMetaObject *mo = sender->metaObject(); - while (mo && mo->methodOffset() > signal_index) + while (mo->methodOffset() > signal_index) mo = mo->superClass(); activate(sender, mo, signal_index - mo->methodOffset(), argv); } @@ -3706,7 +3706,7 @@ void QObject::dumpObjectInfo() const QMetaObject *mo = metaObject(); int signalOffset, methodOffset; computeOffsets(mo, &signalOffset, &methodOffset); - while (mo && signalOffset > signal_index) { + while (signalOffset > signal_index) { mo = mo->superClass(); offsetToNextMetaObject = signalOffset; computeOffsets(mo, &signalOffset, &methodOffset); diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index ba8ae56..c2bdbee 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -52,6 +52,7 @@ #endif #include <new> +#include <string.h> QT_BEGIN_HEADER diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index df08da1..747ea5e 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \class QMargins \ingroup painting - \brief The QMargins + \brief The QMargins class defines the four margins of a rectangle. QMargin defines a set of four margins; left, top, right and bottom, that describe the size of the borders surrounding a rectangle. @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE Constructs a margins object with all margins set to 0. - \sa isValid() + \sa isNull() */ /*! @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE Constructs margins with the given \a left, \a top, \a right, \a bottom - \sa setWidth(), setHeight() + \sa setLeft(), setRight(), setTop(), setBottom() */ /*! @@ -86,8 +86,6 @@ QT_BEGIN_NAMESPACE Returns true if all margins are is 0; otherwise returns false. - - \sa isValid(), isEmpty() */ diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h index be918cc..549c634 100644 --- a/src/corelib/tools/qmargins.h +++ b/src/corelib/tools/qmargins.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) -class Q_CORE_EXPORT QMargins +class QMargins { public: QMargins(); @@ -68,11 +68,6 @@ public: void setRight(int right); void setBottom(int bottom); - int &rleft(); - int &rtop(); - int &rright(); - int &rbottom(); - private: int m_left; int m_top; diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 069bf49..a401a70 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,7 +1,7 @@ QML API Review ============== -The QML API is being reviewed from 17 to 28 August 2009. This +The QML API is being reviewed from 17 to 4 September 2009. This file documents the changes. Note that the changes are incremental, so a rename A->B for example may be follow by another subseqent rename B->C, if later reviews override earlier reviews. @@ -47,6 +47,7 @@ Flickable: yPosition -> viewportY Flickable: xVelocity -> horizontalVelocity Flickable: yVelocity -> verticalVelocity Flickable: velocityDecay -> reportedVelocitySmoothing +Flickable: locked -> interactive (note reversal of meaning) WebView: idealWidth -> preferredWidth WebView: idealHeight -> preferredHeight WebView: status -> statusText diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 27bfa27..0690df1 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -95,7 +95,7 @@ void ElasticValue::updateCurrentTime(int) QFxFlickablePrivate::QFxFlickablePrivate() : _flick(new QFxItem), _moveX(_flick, &QFxItem::setX), _moveY(_flick, &QFxItem::setY) , vWidth(-1), vHeight(-1), overShoot(true), flicked(false), moving(false), stealMouse(false) - , pressed(false), maxVelocity(-1), locked(false), dragMode(QFxFlickable::Hard) + , pressed(false), maxVelocity(-1), interactive(true), dragMode(QFxFlickable::Hard) , elasticY(_moveY), elasticX(_moveX), reportedVelocitySmoothing(100), horizontalVelocity(this), verticalVelocity(this) , vTime(0), atXEnd(false), atXBeginning(true), pageXPosition(0.), pageWidth(0.) , atYEnd(false), atYBeginning(true), pageYPosition(0.), pageHeight(0.) @@ -201,12 +201,12 @@ void QFxFlickablePrivate::fixupX() vTime = _tl.time(); if (_moveX.value() > q->minXExtent() || (q->maxXExtent() > q->maxXExtent())) { - _tl.clear(); + _tl.reset(_moveY); if (_moveX.value() != q->minXExtent()) _tl.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else if (_moveX.value() < q->maxXExtent()) { - _tl.clear(); + _tl.reset(_moveY); _tl.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else { @@ -223,12 +223,12 @@ void QFxFlickablePrivate::fixupY() vTime = _tl.time(); if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) { - _tl.clear(); + _tl.reset(_moveY); if (_moveY.value() != q->minYExtent()) _tl.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else if (_moveY.value() < q->maxYExtent()) { - _tl.clear(); + _tl.reset(_moveY); _tl.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else { @@ -411,24 +411,30 @@ void QFxFlickable::setViewportY(qreal pos) } /*! - \qmlproperty bool Flickable::locked + \qmlproperty bool Flickable::interactive - A user cannot drag or flick a Flickable that is locked. + A user cannot drag or flick a Flickable that is not interactive. This property is useful for temporarily disabling flicking. This allows special interaction with Flickable's children: for example, you might want to freeze a flickable map while viewing detailed information on a location popup that is a child of the Flickable. */ -bool QFxFlickable::isLocked() const +bool QFxFlickable::isInteractive() const { Q_D(const QFxFlickable); - return d->locked; + return d->interactive; } -void QFxFlickable::setLocked(bool lock) +void QFxFlickable::setInteractive(bool interactive) { Q_D(QFxFlickable); - d->locked = lock; + d->interactive = interactive; + if (!interactive && d->flicked) { + d->_tl.clear(); + d->flicked = false; + emit flickingChanged(); + emit flickEnded(); + } } /*! @@ -577,7 +583,7 @@ qreal QFxFlickable::visibleY() const void QFxFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) { - if (!locked && _tl.isActive() && (qAbs(velocityX) > 10 || qAbs(velocityY) > 10)) + if (interactive && _tl.isActive() && (qAbs(velocityX) > 10 || qAbs(velocityY) > 10)) stealMouse = true; // If we've been flicked then steal the click. else stealMouse = false; @@ -602,7 +608,7 @@ void QFxFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_Q(QFxFlickable); - if (locked || lastPosTime.isNull()) + if (!interactive || lastPosTime.isNull()) return; bool rejectY = false; bool rejectX = false; diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index c27b29f..57a01d7 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -69,7 +69,7 @@ class Q_DECLARATIVE_EXPORT QFxFlickable : public QFxItem Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) - Q_PROPERTY(bool locked READ isLocked WRITE setLocked) //### interactive, ensure flicking is stopped, etc. + Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive) Q_PROPERTY(DragMode dragMode READ dragMode WRITE setDragMode) //### remove. Consider a better way to implement different drag behavior Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged) @@ -117,8 +117,8 @@ public: qreal maximumFlickVelocity() const; void setMaximumFlickVelocity(qreal); - bool isLocked() const; - void setLocked(bool); + bool isInteractive() const; + void setInteractive(bool); Q_ENUMS(DragMode) enum DragMode { Hard, Elastic }; diff --git a/src/declarative/fx/qfxflickable_p.h b/src/declarative/fx/qfxflickable_p.h index a0ac011..ad9484f 100644 --- a/src/declarative/fx/qfxflickable_p.h +++ b/src/declarative/fx/qfxflickable_p.h @@ -121,7 +121,7 @@ public: QmlTimeLineEvent fixupXEvent; QmlTimeLineEvent fixupYEvent; qreal maxVelocity; - bool locked; + bool interactive; QFxFlickable::DragMode dragMode; ElasticValue elasticY; ElasticValue elasticX; diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 138a8ae..6fd080b 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -1069,7 +1069,7 @@ qreal QFxGridView::maxXExtent() const void QFxGridView::keyPressEvent(QKeyEvent *event) { Q_D(QFxGridView); - if (d->model && d->model->count() && !d->locked) { + if (d->model && d->model->count() && d->interactive) { if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Up) || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Left)) { if (currentIndex() >= d->columns || d->wrap) { diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 147c977..34fe827 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1344,7 +1344,7 @@ qreal QFxListView::maxXExtent() const void QFxListView::keyPressEvent(QKeyEvent *event) { Q_D(QFxListView); - if (d->model && d->model->count() && !d->locked) { + if (d->model && d->model->count() && d->interactive) { if ((d->orient == Qt::Horizontal && event->key() == Qt::Key_Left) || (d->orient == Qt::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || d->wrap) { diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 6eeff89..124c8f3 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -652,7 +652,7 @@ QScriptValue QmlEnginePrivate::qmlScriptObject(QObject* object, QmlEngine* engine) { QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - return scriptEngine->newObject(new QmlObjectScriptClass(engine), scriptEngine->newQObject(object)); + return scriptEngine->newObject(engine->d_func()->objectClass, scriptEngine->newQObject(object, QScriptEngine::AutoOwnership)); } /*! diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index ccbf7fc..f60e80e 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -335,7 +335,7 @@ void QGraphicsEffect::setEnabled(bool enable) d->isEnabled = enable; if (d->source) - d->source->update(); + d->source->d_func()->effectBoundingRectChanged(); emit enabledChanged(enable); } @@ -349,6 +349,22 @@ void QGraphicsEffect::setEnabled(bool enable) */ /*! + Schedules a redraw of the source. Call this function whenever the source + needs to be redrawn. + + This convenience function is equivalent to calling + QGraphicsEffectSource::update(). + + \sa updateBoundingRect(), QGraphicsEffectSource::update() +*/ +void QGraphicsEffect::update() +{ + Q_D(QGraphicsEffect); + if (d->source) + d->source->update(); +} + +/*! Returns a pointer to the source, which provides extra context information that can be useful for the effect. @@ -366,13 +382,15 @@ QGraphicsEffectSource *QGraphicsEffect::source() const function whenever you change any parameters that will cause the virtual boundingRectFor() function to return a different value. + This function will call update() if this is necessary. + \sa boundingRectFor(), boundingRect() */ void QGraphicsEffect::updateBoundingRect() { Q_D(QGraphicsEffect); if (d->source) - d->source->update(); + d->source->d_func()->effectBoundingRectChanged(); } /*! @@ -523,6 +541,7 @@ void QGraphicsColorizeEffect::setColor(const QColor &color) return; d->filter->setColor(color); + update(); emit colorChanged(color); } @@ -610,6 +629,7 @@ void QGraphicsPixelizeEffect::setPixelSize(int size) return; d->pixelSize = size; + update(); emit pixelSizeChanged(size); } @@ -820,7 +840,7 @@ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect() By default, the offset is 8 pixels towards the lower right. - \sa blurRadius(), color() + \sa xOffset(), yOffset(), blurRadius(), color() */ QPointF QGraphicsDropShadowEffect::offset() const { @@ -840,6 +860,24 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset) } /*! + \property QGraphicsDropShadowEffect::xOffset + \brief the horizontal shadow offset in pixels. + + By default, the horizontal shadow offset is 8 pixels. + + \sa yOffset(), offset() +*/ + +/*! + \property QGraphicsDropShadowEffect::yOffset + \brief the vertical shadow offset in pixels. + + By default, the vertical shadow offset is 8 pixels. + + \sa xOffset(), offset() +*/ + +/*! \fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset) This signal is emitted whenever the effect's shadow offset changes. @@ -903,6 +941,7 @@ void QGraphicsDropShadowEffect::setColor(const QColor &color) return; d->filter->setColor(color); + update(); emit colorChanged(color); } @@ -1012,6 +1051,7 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity) d->isFullyOpaque = 0; else d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1); + update(); emit opacityChanged(opacity); } @@ -1050,6 +1090,7 @@ void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask) d->opacityMask = mask; d->hasOpacityMask = (mask.style() != Qt::NoBrush); + update(); emit opacityMaskChanged(mask); } @@ -1088,19 +1129,20 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); painter->drawPixmap(offset, pixmap); } else { - QRectF srcBrect = source->boundingRect(); - QPixmap pixmap(srcBrect.size().toSize()); + QRect srcBrect = source->boundingRect().toAlignedRect(); + offset = srcBrect.topLeft(); + QPixmap pixmap(srcBrect.size()); pixmap.fill(Qt::transparent); QPainter pixmapPainter(&pixmap); pixmapPainter.setRenderHints(painter->renderHints()); - pixmapPainter.translate(-srcBrect.topLeft()); + pixmapPainter.translate(-offset); source->draw(&pixmapPainter); pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); pixmapPainter.fillRect(srcBrect, d->opacityMask); pixmapPainter.end(); - painter->drawPixmap(srcBrect.topLeft(), pixmap); + painter->drawPixmap(offset, pixmap); } } else { // Draw pixmap in device coordinates to avoid pixmap scaling; diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index 8e5384c..aee7834 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -118,7 +118,7 @@ public: public Q_SLOTS: void setEnabled(bool enable); - // ### add update() slot + void update(); Q_SIGNALS: void enabledChanged(bool enabled); @@ -237,6 +237,8 @@ class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged) + Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged) + Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged) Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) public: @@ -245,15 +247,31 @@ public: QRectF boundingRectFor(const QRectF &rect) const; QPointF offset() const; + + inline qreal xOffset() const + { return offset().x(); } + + inline qreal yOffset() const + { return offset().y(); } + int blurRadius() const; QColor color() const; public Q_SLOTS: void setOffset(const QPointF &ofs); + inline void setOffset(qreal dx, qreal dy) { setOffset(QPointF(dx, dy)); } + inline void setOffset(qreal d) { setOffset(QPointF(d, d)); } + + inline void setXOffset(qreal dx) + { setOffset(QPointF(dx, yOffset())); } + + inline void setYOffset(qreal dy) + { setOffset(QPointF(xOffset(), dy)); } + void setBlurRadius(int blurRadius); void setColor(const QColor &color); diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index bfabfc0..24b605f 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -76,6 +76,7 @@ public: virtual void update() = 0; virtual bool isPixmap() const = 0; virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0) const = 0; + virtual void effectBoundingRectChanged() = 0; friend class QGraphicsScenePrivate; friend class QGraphicsItem; friend class QGraphicsItemPrivate; diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri new file mode 100644 index 0000000..7dae9d5 --- /dev/null +++ b/src/gui/embedded/directfb.pri @@ -0,0 +1,39 @@ +# These defines might be necessary if your DirectFB driver doesn't +# support all of the DirectFB API. +# +#DEFINES += QT_NO_DIRECTFB_SUBSURFACE +#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR +#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER +#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE +#DEFINES += QT_DIRECTFB_IMAGECACHE +#DEFINES += QT_NO_DIRECTFB_WM +#DEFINES += QT_NO_DIRECTFB_LAYER +#DEFINES += QT_NO_DIRECTFB_PALETTE +#DEFINES += QT_NO_DIRECTFB_PREALLOCATED +#DEFINES += QT_NO_DIRECTFB_MOUSE +#DEFINES += QT_NO_DIRECTFB_KEYBOARD +#DEFINES += QT_DIRECTFB_TIMING +#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION +#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS +#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" +#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" + +HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h + +SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp \ + $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp + + +QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB +LIBS += $$QT_LIBS_DIRECTFB diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri index 255a504..eb13d8d 100644 --- a/src/gui/embedded/embedded.pri +++ b/src/gui/embedded/embedded.pri @@ -139,6 +139,10 @@ embedded { SOURCES += embedded/qscreentransformed_qws.cpp } + contains( gfx-drivers, directfb ) { + INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb + include($$PWD/directfb.pri) + } # # Keyboard drivers # diff --git a/src/gui/embedded/qscreendriverfactory_qws.cpp b/src/gui/embedded/qscreendriverfactory_qws.cpp index 21058af..99ee8f2 100644 --- a/src/gui/embedded/qscreendriverfactory_qws.cpp +++ b/src/gui/embedded/qscreendriverfactory_qws.cpp @@ -51,7 +51,9 @@ #include <stdlib.h> #include "private/qfactoryloader_p.h" #include "qscreendriverplugin_qws.h" - +#ifndef QT_NO_QWS_DIRECTFB +#include "qdirectfbscreen.h" +#endif #ifndef QT_NO_QWS_VNC #include "qscreenvnc_qws.h" #endif @@ -118,6 +120,10 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId) if (driver == QLatin1String("linuxfb") || driver.isEmpty()) return new QLinuxFbScreen(displayId); #endif +#ifndef QT_NO_QWS_DIRECTFB + if (driver == QLatin1String("directfb") || driver.isEmpty()) + return new QDirectFBScreen(displayId); +#endif #ifndef QT_NO_QWS_TRANSFORMED if (driver == QLatin1String("transformed")) return new QTransformedScreen(displayId); @@ -130,7 +136,6 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId) if (driver == QLatin1String("multi")) return new QMultiScreen(displayId); #endif - #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) #ifndef QT_NO_LIBRARY diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0dae629..e931e4c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -198,20 +198,19 @@ \o hoverEnterEvent(), hoverMoveEvent(), and hoverLeaveEvent() handles hover enter, move and leave events \o inputMethodEvent() handles input events, for accessibility support - \o keyPressEvent() and keyReleaseEvent handle key press and release events + \o keyPressEvent() and keyReleaseEvent() handle key press and release events \o mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), and mouseDoubleClickEvent() handles mouse press, move, release, click and doubleclick events \endlist - You can filter events for any other item by installing event - filters. This functionaly is separate from from Qt's regular - event filters (see QObject::installEventFilter()), which only - work on subclasses of QObject. After installing your item as an - event filter for another item by calling - installSceneEventFilter(), the filtered events will be received - by the virtual function sceneEventFilter(). You can remove item - event filters by calling removeSceneEventFilter(). + You can filter events for any other item by installing event filters. This + functionality is separate from Qt's regular event filters (see + QObject::installEventFilter()), which only work on subclasses of QObject. After + installing your item as an event filter for another item by calling + installSceneEventFilter(), the filtered events will be received by the virtual + function sceneEventFilter(). You can remove item event filters by calling + removeSceneEventFilter(). \section1 Custom Data @@ -410,11 +409,11 @@ (same as transform()), and QGraphicsItem ignores the return value for this notification (i.e., a read-only notification). - \value ItemSelectedChange The item's selected state changes. If the item - is presently selected, it will become unselected, and vice verca. The - value argument is the new selected state (i.e., true or false). Do not - call setSelected() in itemChange() as this notification is delivered(); - instead, you can return the new selected state from itemChange(). + \value ItemSelectedChange The item's selected state changes. If the item is + presently selected, it will become unselected, and vice verca. The value + argument is the new selected state (i.e., true or false). Do not call + setSelected() in itemChange() as this notification is delivered; instead, you + can return the new selected state from itemChange(). \value ItemSelectedHasChanged The item's selected state has changed. The value argument is the new selected state (i.e., true or false). Do not diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 9dc1204..cf34c6e 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -611,6 +611,9 @@ public: inline void update() { item->update(); } + inline void effectBoundingRectChanged() + { item->prepareGeometryChange(); } + inline bool isPixmap() const { return (item->type() == QGraphicsPixmapItem::Type); diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index a4ea6af..e23677f 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -888,10 +888,9 @@ void QIcon::setThemeSearchPaths(const QStringList &paths) On X11, the search path will use the XDG_DATA_DIRS environment variable if available. - On Windows the search path defaults to [Application Directory]/icons - - On Mac the default search path will search in the - [Contents/Resources/icons] part of the application bundle. + By default all platforms will have the resource directory + ":\icons" as their fallback. You can use "rcc -project" + to generate a resource file from your icon theme. \sa setThemeSearchPaths(), fromTheme(), setThemeName() */ @@ -906,7 +905,7 @@ QStringList QIcon::themeSearchPaths() Sets the current icon theme to \a name. The \a name should correspond to a directory name in the - current themeSearchPath() containing an index.theme + themeSearchPath() containing an index.theme file describing it's contents. \sa themeSearchPaths(), themeName() @@ -939,10 +938,6 @@ QString QIcon::themeName() icon theme. If no such icon is found in the current theme \a fallback is return instead. - To use an icon theme on Windows or Mac, you will need to - bundle a compliant theme with your application and make sure - it is located in your themeSarchPaths. - The lastest version of the freedesktop icon specification and naming spesification can be obtained here: http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 279703c..cb1cc61 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -187,14 +187,17 @@ QStringList QIconLoader::themeSearchPaths() const QDir homeDir(QDir::homePath() + QLatin1String("/.icons")); if (homeDir.exists()) m_iconDirs.prepend(homeDir.path()); - -#elif defined(Q_WS_WIN) +#endif + +#if defined(Q_WS_WIN) m_iconDirs.append(qApp->applicationDirPath() + QLatin1String("/icons")); #elif defined(Q_WS_MAC) m_iconDirs.append(qApp->applicationDirPath() + QLatin1String("/../Resources/icons")); #endif + // Allways add resource directory as search path + m_iconDirs.append(QLatin1String(":/icons")); } return m_iconDirs; } diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 2b82f49..89af452 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2892,6 +2892,12 @@ static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt: Q_ASSERT(src->height == dest->height); QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format); + if (colorTable.size() == 0) { + colorTable.resize(256); + for (int i=0; i<256; ++i) + colorTable[i] = qRgb(i, i, i); + + } int w = src->width; const uchar *src_data = src->data; diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 07c5454..ea98cb2 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -956,6 +956,7 @@ QModelIndex QAbstractItemView::currentIndex() const void QAbstractItemView::reset() { Q_D(QAbstractItemView); + d->delayedReset.stop(); //make sure we stop the timer QList<QEditorInfo>::const_iterator it = d->editors.constBegin(); for (; it != d->editors.constEnd(); ++it) d->releaseEditor(it->editor); @@ -2208,7 +2209,9 @@ void QAbstractItemView::timerEvent(QTimerEvent *event) Q_D(QAbstractItemView); if (event->timerId() == d->fetchMoreTimer.timerId()) d->fetchMore(); - if (event->timerId() == d->autoScrollTimer.timerId()) + else if (event->timerId() == d->delayedReset.timerId()) + reset(); + else if (event->timerId() == d->autoScrollTimer.timerId()) doAutoScroll(); else if (event->timerId() == d->updateTimer.timerId()) d->updateDirtyRegion(); @@ -3132,9 +3135,8 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &, int, int) */ void QAbstractItemViewPrivate::_q_modelDestroyed() { - Q_Q(QAbstractItemView); model = QAbstractItemModelPrivate::staticEmptyModel(); - QMetaObject::invokeMethod(q, "reset", Qt::QueuedConnection); + doDelayedReset(); } /*! diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 4517941..434d644 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -328,6 +328,15 @@ public: QStyleOptionViewItemV4 viewOptionsV4() const; + void doDelayedReset() + { + //we delay the reset of the timer because some views (QTableView) + //with headers can't handle the fact that the model has been destroyed + //all _q_modelDestroyed slots must have been called + if (!delayedReset.isActive()) + delayedReset.start(0, q_func()); + } + QAbstractItemModel *model; QPointer<QAbstractItemDelegate> itemDelegate; QMap<int, QPointer<QAbstractItemDelegate> > rowDelegates; @@ -389,6 +398,7 @@ public: QBasicTimer updateTimer; QBasicTimer delayedEditing; QBasicTimer delayedAutoScroll; //used when an item is clicked + QBasicTimer delayedReset; QAbstractItemView::ScrollMode verticalScrollMode; QAbstractItemView::ScrollMode horizontalScrollMode; diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index a1c3e4e..4dbd6dc 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -1047,7 +1047,9 @@ int QHeaderView::visualIndex(int logicalIndex) const /*! Returns the logicalIndex for the section at the given \a visualIndex - position, or -1 otherwise. + position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count(). + + Note that the visualIndex is not affected by hidden sections. \sa visualIndex(), sectionPosition() */ diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 37ffa8fb..863c43e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5962,6 +5962,8 @@ bool QWidget::hasFocus() const isActiveWindow() active window\endlink. The \a reason argument will be passed into any focus event sent from this function, it is used to give an explanation of what caused the widget to get focus. + If the window is not active, the widget will be given the focus when + the window becomes active. First, a focus out event is sent to the focus widget (if any) to tell it that it is about to lose the focus. Then a focus in event diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index ff0c453..f69c3a7 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -727,6 +727,16 @@ public: inline bool isPixmap() const { return false; } + inline void effectBoundingRectChanged() + { + // ### This function should take a rect parameter; then we can avoid + // updating too much on the parent widget. + if (QWidget *parent = m_widget->parentWidget()) + parent->update(); + else + m_widget->update(); + } + inline const QStyleOption *styleOption() const { return 0; } diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 422d5a3..173c870 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -298,7 +298,7 @@ QT_BEGIN_NAMESPACE /*! \enum QColor::Spec - The type of color specified, either RGB, HSV or CMYK. + The type of color specified, either RGB, HSV, CMYK or HSL. \value Rgb \value Hsv diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 6d957ca..20f1d26 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -561,14 +561,20 @@ static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTi QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110)); painter->setPen(QPen(mdiButtonBorderColor, 1)); - painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()); - painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()); - painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2); - painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2); - painter->drawPoint(tmp.left() + 1, tmp.top() + 1); - painter->drawPoint(tmp.right() - 1, tmp.top() + 1); - painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1); - painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1); + const QLine lines[4] = { + QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()), + QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()), + QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2), + QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2) + }; + painter->drawLines(lines, 4); + const QPoint points[4] = { + QPoint(tmp.left() + 1, tmp.top() + 1), + QPoint(tmp.right() - 1, tmp.top() + 1), + QPoint(tmp.left() + 1, tmp.bottom() - 1), + QPoint(tmp.right() - 1, tmp.bottom() - 1) + }; + painter->drawPoints(points, 4); painter->setPen(titleBarHighlight); painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1); @@ -900,14 +906,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, QRect r = rect.adjusted(0, 1, 0, -1); painter->setPen(buttonShadowAlpha); painter->drawLine(QPoint(r.left() + 2, r.top() - 1), QPoint(r.right() - 2, r.top() - 1)); - painter->drawPoint(r.right() - 1, r.top()); - painter->drawPoint(r.right(), r.top() + 1); - painter->drawPoint(r.right() - 1, r.bottom()); - painter->drawPoint(r.right(), r.bottom() - 1); - painter->drawPoint(r.left() + 1, r.top() ); - painter->drawPoint(r.left(), r.top() + 1); - painter->drawPoint(r.left() + 1, r.bottom() ); - painter->drawPoint(r.left(), r.bottom() - 1); + const QPoint points[8] = { + QPoint(r.right() - 1, r.top()), + QPoint(r.right(), r.top() + 1), + QPoint(r.right() - 1, r.bottom()), + QPoint(r.right(), r.bottom() - 1), + QPoint(r.left() + 1, r.top() ), + QPoint(r.left(), r.top() + 1), + QPoint(r.left() + 1, r.bottom() ), + QPoint(r.left(), r.bottom() - 1) + }; + painter->drawPoints(points, 8); painter->setPen(QPen(option->palette.background().color(), 1)); painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1)); @@ -939,10 +948,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, painter->drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2)); painter->drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)); painter->drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right() - 2, r.bottom())); - painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1)); - painter->drawPoint(QPoint(r.right() - 1, r.top() + 1)); - painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1)); - painter->drawPoint(QPoint(r.left() + 1, r.top() + 1)); + const QPoint points2[4] = { + QPoint(r.right() - 1, r.bottom() - 1), + QPoint(r.right() - 1, r.top() + 1), + QPoint(r.left() + 1, r.bottom() - 1), + QPoint(r.left() + 1, r.top() + 1) + }; + painter->drawPoints(points2, 4); painter->drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())); painter->setPen(oldPen); } @@ -1040,10 +1052,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, painter->setBrush(QBrush(dark.darker(120), Qt::Dense4Pattern)); painter->setBrushOrigin(rect.topLeft()); painter->setPen(Qt::NoPen); - painter->drawRect(rect.left(), rect.top(), rect.width(), 1); // Top - painter->drawRect(rect.left(), rect.bottom(), rect.width(), 1); // Bottom - painter->drawRect(rect.left(), rect.top(), 1, rect.height()); // Left - painter->drawRect(rect.right(), rect.top(), 1, rect.height()); // Right + const QRect rects[4] = { + QRect(rect.left(), rect.top(), rect.width(), 1), // Top + QRect(rect.left(), rect.bottom(), rect.width(), 1), // Bottom + QRect(rect.left(), rect.top(), 1, rect.height()), // Left + QRect(rect.right(), rect.top(), 1, rect.height()) // Right + }; + painter->drawRects(rects, 4); painter->restore(); } break; @@ -1065,18 +1080,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, if (isDefault) { r = option->rect.adjusted(0, 1, 0, -1); painter->setPen(QPen(Qt::black, 0)); - painter->drawLine(QPoint(r.left() + 2, r.top()), - QPoint(r.right() - 2, r.top())); - painter->drawLine(QPoint(r.left(), r.top() + 2), - QPoint(r.left(), r.bottom() - 2)); - painter->drawLine(QPoint(r.right(), r.top() + 2), - QPoint(r.right(), r.bottom() - 2)); - painter->drawLine(QPoint(r.left() + 2, r.bottom()), - QPoint(r.right() - 2, r.bottom())); - painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1)); - painter->drawPoint(QPoint(r.right() - 1, r.top() + 1)); - painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1)); - painter->drawPoint(QPoint(r.left() + 1, r.top() + 1)); + const QLine lines[4] = { + QLine(QPoint(r.left() + 2, r.top()), + QPoint(r.right() - 2, r.top())), + QLine(QPoint(r.left(), r.top() + 2), + QPoint(r.left(), r.bottom() - 2)), + QLine(QPoint(r.right(), r.top() + 2), + QPoint(r.right(), r.bottom() - 2)), + QLine(QPoint(r.left() + 2, r.bottom()), + QPoint(r.right() - 2, r.bottom())) + }; + painter->drawLines(lines, 4); + const QPoint points[4] = { + QPoint(r.right() - 1, r.bottom() - 1), + QPoint(r.right() - 1, r.top() + 1), + QPoint(r.left() + 1, r.bottom() - 1), + QPoint(r.left() + 1, r.top() + 1) + }; + painter->drawPoints(points, 4); painter->setPen(oldPen); } return; @@ -1140,10 +1161,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, QPoint(r.right(), r.bottom() - 2)); p->drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right() - 2, r.bottom())); - p->drawPoint(QPoint(r.right() - 1, r.bottom() - 1)); - p->drawPoint(QPoint(r.right() - 1, r.top() + 1)); - p->drawPoint(QPoint(r.left() + 1, r.bottom() - 1)); - p->drawPoint(QPoint(r.left() + 1, r.top() + 1)); + const QPoint points[4] = { + QPoint(r.right() - 1, r.bottom() - 1), + QPoint(r.right() - 1, r.top() + 1), + QPoint(r.left() + 1, r.bottom() - 1), + QPoint(r.left() + 1, r.top() + 1) + }; + p->drawPoints(points, 4); if (!isDefault && !hasFocus && isEnabled) p->setPen(QPen(darkOutline.darker(110), 0)); @@ -1163,14 +1187,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, topShadow.setAlpha(60); p->setPen(topShadow); - p->drawPoint(QPoint(r.right(), r.top() + 1)); - p->drawPoint(QPoint(r.right() - 1, r.top() )); - p->drawPoint(QPoint(r.right(), r.bottom() - 1)); - p->drawPoint(QPoint(r.right() - 1, r.bottom() )); - p->drawPoint(QPoint(r.left() + 1, r.bottom())); - p->drawPoint(QPoint(r.left(), r.bottom() - 1)); - p->drawPoint(QPoint(r.left() + 1, r.top())); - p->drawPoint(QPoint(r.left(), r.top() + 1)); + const QPoint points2[8] = { + QPoint(r.right(), r.top() + 1), + QPoint(r.right() - 1, r.top() ), + QPoint(r.right(), r.bottom() - 1), + QPoint(r.right() - 1, r.bottom() ), + QPoint(r.left() + 1, r.bottom()), + QPoint(r.left(), r.bottom() - 1), + QPoint(r.left() + 1, r.top()), + QPoint(r.left(), r.top() + 1) + }; + p->drawPoints(points2, 8); topShadow.setAlpha(30); p->setPen(topShadow); @@ -1183,18 +1210,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, if (isDefault) { r.adjust(-1, -1, 1, 1); p->setPen(buttonShadowAlpha.darker(120)); - p->drawLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0)); - p->drawLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0)); - p->drawLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3)); - p->drawLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3)); - p->drawPoint(r.topRight() + QPoint(-2, 1)); - p->drawPoint(r.topRight() + QPoint(-1, 2)); - p->drawPoint(r.bottomRight() + QPoint(-1, -2)); - p->drawPoint(r.bottomRight() + QPoint(-2, -1)); - p->drawPoint(r.topLeft() + QPoint(1, 2)); - p->drawPoint(r.topLeft() + QPoint(2, 1)); - p->drawPoint(r.bottomLeft() + QPoint(1, -2)); - p->drawPoint(r.bottomLeft() + QPoint(2, -1)); + const QLine lines[4] = { + QLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0)), + QLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0)), + QLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3)), + QLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3)) + }; + p->drawLines(lines, 4); + const QPoint points3[8] = { + r.topRight() + QPoint(-2, 1), + r.topRight() + QPoint(-1, 2), + r.bottomRight() + QPoint(-1, -2), + r.bottomRight() + QPoint(-2, -1), + r.topLeft() + QPoint(1, 2), + r.topLeft() + QPoint(2, 1), + r.bottomLeft() + QPoint(1, -2), + r.bottomLeft() + QPoint(2, -1) + }; + p->drawPoints(points3, 8); } painter->setPen(oldPen); painter->setBrush(oldBrush); @@ -1307,12 +1340,15 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, painter->drawLine(innerBottomLine); painter->setPen(alphaCornerColor); - painter->drawPoint(leftBottomInnerCorner1); - painter->drawPoint(leftBottomInnerCorner2); - painter->drawPoint(rightBottomInnerCorner1); - painter->drawPoint(rightBottomInnerCorner2); - painter->drawPoint(leftTopInnerCorner1); - painter->drawPoint(leftTopInnerCorner2); + const QPoint points[6] = { + leftBottomInnerCorner1, + leftBottomInnerCorner2, + rightBottomInnerCorner1, + rightBottomInnerCorner2, + leftTopInnerCorner1, + leftTopInnerCorner2 + }; + painter->drawPoints(points, 6); } #endif // QT_NO_TABWIDGET painter->restore(); @@ -1670,19 +1706,25 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o painter->fillRect(rect, option->palette.base()); QColor borderColor = dark.lighter(110); painter->setPen(QPen(borderColor, 0)); - painter->drawLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top())); - painter->drawLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom())); - painter->drawLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1)); - painter->drawLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1)); + const QLine lines[4] = { + QLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top())), + QLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom())), + QLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1)), + QLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1)) + }; + painter->drawLines(lines, 4); QColor alphaCorner = mergedColors(borderColor, option->palette.background().color()); QColor innerShadow = mergedColors(borderColor, option->palette.base().color()); //corner smoothing painter->setPen(alphaCorner); - painter->drawPoint(rect.topRight()); - painter->drawPoint(rect.topLeft()); - painter->drawPoint(rect.bottomRight()); - painter->drawPoint(rect.bottomLeft()); + const QPoint points[4] = { + rect.topRight(), + rect.topLeft(), + rect.bottomRight(), + rect.bottomLeft() + }; + painter->drawPoints(points, 4); //inner shadow painter->setPen(innerShadow); @@ -1807,10 +1849,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o option->palette.highlight()); painter->setPen(QPen(highlightOutline, 0)); - painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom())); - painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom())); - painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())); - painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top())); + const QLine lines[4] = { + QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom())), + QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom())), + QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())), + QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top())) + }; + painter->drawLines(lines, 4); //draw text QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText; @@ -1864,10 +1909,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o highlight); r = r.adjusted(-1, 0, 1, 0); painter->setPen(QPen(highlightOutline, 0)); - painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1)); - painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1)); - painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())); - painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top())); + const QLine lines[4] = { + QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1)), + QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1)), + QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())), + QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top())) + }; + painter->drawLines(lines, 4); } else { painter->fillRect(option->rect, menuBackground); } @@ -2447,14 +2495,17 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp cachePainter.setPen(topShadow); // antialias corners - cachePainter.drawPoint(QPoint(r.right(), r.top() + 1)); - cachePainter.drawPoint(QPoint(r.right() - 1, r.top() )); - cachePainter.drawPoint(QPoint(r.right(), r.bottom() - 1)); - cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() )); - cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom())); - cachePainter.drawPoint(QPoint(r.left(), r.bottom() - 1)); - cachePainter.drawPoint(QPoint(r.left() + 1, r.top())); - cachePainter.drawPoint(QPoint(r.left(), r.top() + 1)); + const QPoint points[8] = { + QPoint(r.right(), r.top() + 1), + QPoint(r.right() - 1, r.top() ), + QPoint(r.right(), r.bottom() - 1), + QPoint(r.right() - 1, r.bottom() ), + QPoint(r.left() + 1, r.bottom()), + QPoint(r.left(), r.bottom() - 1), + QPoint(r.left() + 1, r.top()), + QPoint(r.left(), r.top() + 1) + }; + cachePainter.drawPoints(points, 8); // draw frame topShadow.setAlpha(30); @@ -2482,10 +2533,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp cachePainter.setPen(QPen(darkOutline, 1)); // top and bottom lines - cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom())); - cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())); - cachePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)); - cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2)); + const QLine lines[4] = { + QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom())), + QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())), + QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)), + QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2)) + }; + cachePainter.drawLines(lines, 4); } // gradients @@ -2519,10 +2573,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp if (spinBox->frame) { // rounded corners - cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1)); - cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1)); - cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() - 1)); - cachePainter.drawPoint(QPoint(r.right() - 1, r.top() + 1)); + const QPoint points[4] = { + QPoint(r.left() + 1, r.bottom() - 1), + QPoint(r.left() + 1, r.top() + 1), + QPoint(r.right() - 1, r.bottom() - 1), + QPoint(r.right() - 1, r.top() + 1) + }; + cachePainter.drawPoints(points, 4); if (option->state & State_HasFocus) { QColor darkoutline = option->palette.highlight().color().darker(150); @@ -2531,10 +2588,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp if (spinBox->direction == Qt::LeftToRight) { cachePainter.drawRect(rect.adjusted(1, 2, -3 -downRect.width(), -3)); cachePainter.setPen(QPen(darkoutline, 0)); - cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom())); - cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top())); - cachePainter.drawLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1)); - cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2)); + const QLine lines[4] = { + QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom())), + QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top())), + QLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1)), + QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2)) + }; + cachePainter.drawLines(lines, 4); cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1)); cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1)); cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2)); @@ -2679,18 +2739,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // top outline painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top()); painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom()); - painter->drawPoint(fullRect.left() + 4, fullRect.top() + 1); - painter->drawPoint(fullRect.left() + 3, fullRect.top() + 1); - painter->drawPoint(fullRect.left() + 2, fullRect.top() + 2); - painter->drawPoint(fullRect.left() + 1, fullRect.top() + 3); - painter->drawPoint(fullRect.left() + 1, fullRect.top() + 4); + const QPoint points[5] = { + QPoint(fullRect.left() + 4, fullRect.top() + 1), + QPoint(fullRect.left() + 3, fullRect.top() + 1), + QPoint(fullRect.left() + 2, fullRect.top() + 2), + QPoint(fullRect.left() + 1, fullRect.top() + 3), + QPoint(fullRect.left() + 1, fullRect.top() + 4) + }; + painter->drawPoints(points, 5); painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom()); - painter->drawPoint(fullRect.right() - 3, fullRect.top() + 1); - painter->drawPoint(fullRect.right() - 4, fullRect.top() + 1); - painter->drawPoint(fullRect.right() - 2, fullRect.top() + 2); - painter->drawPoint(fullRect.right() - 1, fullRect.top() + 3); - painter->drawPoint(fullRect.right() - 1, fullRect.top() + 4); + const QPoint points2[5] = { + QPoint(fullRect.right() - 3, fullRect.top() + 1), + QPoint(fullRect.right() - 4, fullRect.top() + 1), + QPoint(fullRect.right() - 2, fullRect.top() + 2), + QPoint(fullRect.right() - 1, fullRect.top() + 3), + QPoint(fullRect.right() - 1, fullRect.top() + 4) + }; + painter->drawPoints(points2, 5); // draw bottomline painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom()); @@ -2749,10 +2815,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1, maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1); painter->setPen(textAlphaColor); - painter->drawPoint(maxButtonIconRect.topLeft()); - painter->drawPoint(maxButtonIconRect.topRight()); - painter->drawPoint(maxButtonIconRect.bottomLeft()); - painter->drawPoint(maxButtonIconRect.bottomRight()); + const QPoint points[4] = { + maxButtonIconRect.topLeft(), + maxButtonIconRect.topRight(), + maxButtonIconRect.bottomLeft(), + maxButtonIconRect.bottomRight() + }; + painter->drawPoints(points, 4); } } @@ -2765,18 +2834,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp qt_cleanlooks_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken); QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); painter->setPen(textAlphaColor); - painter->drawLine(closeIconRect.left() + 1, closeIconRect.top(), - closeIconRect.right(), closeIconRect.bottom() - 1); - painter->drawLine(closeIconRect.left(), closeIconRect.top() + 1, - closeIconRect.right() - 1, closeIconRect.bottom()); - painter->drawLine(closeIconRect.right() - 1, closeIconRect.top(), - closeIconRect.left(), closeIconRect.bottom() - 1); - painter->drawLine(closeIconRect.right(), closeIconRect.top() + 1, - closeIconRect.left() + 1, closeIconRect.bottom()); - painter->drawPoint(closeIconRect.topLeft()); - painter->drawPoint(closeIconRect.topRight()); - painter->drawPoint(closeIconRect.bottomLeft()); - painter->drawPoint(closeIconRect.bottomRight()); + const QLine lines[4] = { + QLine(closeIconRect.left() + 1, closeIconRect.top(), + closeIconRect.right(), closeIconRect.bottom() - 1), + QLine(closeIconRect.left(), closeIconRect.top() + 1, + closeIconRect.right() - 1, closeIconRect.bottom()), + QLine(closeIconRect.right() - 1, closeIconRect.top(), + closeIconRect.left(), closeIconRect.bottom() - 1), + QLine(closeIconRect.right(), closeIconRect.top() + 1, + closeIconRect.left() + 1, closeIconRect.bottom()) + }; + painter->drawLines(lines, 4); + const QPoint points[4] = { + closeIconRect.topLeft(), + closeIconRect.topRight(), + closeIconRect.bottomLeft(), + closeIconRect.bottomRight() + }; + painter->drawPoints(points, 4); painter->setPen(textColor); painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1, @@ -2806,10 +2881,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1, frontWindowRect.right() - 1, frontWindowRect.top() + 1); painter->setPen(textAlphaColor); - painter->drawPoint(frontWindowRect.topLeft()); - painter->drawPoint(frontWindowRect.topRight()); - painter->drawPoint(frontWindowRect.bottomLeft()); - painter->drawPoint(frontWindowRect.bottomRight()); + const QPoint points[4] = { + frontWindowRect.topLeft(), + frontWindowRect.topRight(), + frontWindowRect.bottomLeft(), + frontWindowRect.bottomRight() + }; + painter->drawPoints(points, 4); QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3); QRegion clipRegion = backWindowRect; @@ -2821,10 +2899,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1, backWindowRect.right() - 1, backWindowRect.top() + 1); painter->setPen(textAlphaColor); - painter->drawPoint(backWindowRect.topLeft()); - painter->drawPoint(backWindowRect.topRight()); - painter->drawPoint(backWindowRect.bottomLeft()); - painter->drawPoint(backWindowRect.bottomRight()); + const QPoint points2[4] = { + backWindowRect.topLeft(), + backWindowRect.topRight(), + backWindowRect.bottomLeft(), + backWindowRect.bottomRight() + }; + painter->drawPoints(points2, 4); painter->restore(); } } @@ -3498,10 +3579,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp handlePainter.save(); handlePainter.setRenderHint(QPainter::Antialiasing); handlePainter.translate(0.5, 0.5); - handlePainter.drawLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())); - handlePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top())); - handlePainter.drawLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom())); - handlePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top())); + const QLine lines[4] = { + QLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())), + QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top())), + QLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom())), + QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top())) + }; + handlePainter.drawLines(lines, 4); handlePainter.restore();; handlePainter.setPen(QPen(outline.darker(130), 1)); handlePainter.drawLine(QPoint(r.left() + 3, r.top()), QPoint(r.right() - 3, r.top())); diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index d61d291..0500bff 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -1897,11 +1897,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, Returns an integer representing the specified style \a hint for the given \a widget described by the provided style \a option. - Note that currently, the \a returnData and \a widget parameters - are not used; they are provided for future enhancement. In - addition, the \a option parameter is used only in case of the - SH_ComboBox_Popup, SH_ComboBox_LayoutDirection, and - SH_GroupBox_TextLabelColor style hints. + \c returnData is used when the querying widget needs more detailed data than + the integer that styleHint() returns. See the QStyleHintReturn class + description for details. */ /*! diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index a54c701..3789854 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -1094,7 +1094,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption XPThemeData theme(widget, painter, QLatin1String("PROGRESS"), vertical ? PP_FILLVERT : PP_FILL); theme.rect = option->rect; - bool reverse = bar->direction == (Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted); + bool reverse = (bar->direction == Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted); QTime current = QTime::currentTime(); if (isIndeterminate) { diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp index dfd8639..8ed57cd 100644 --- a/src/gui/widgets/qcalendarwidget.cpp +++ b/src/gui/widgets/qcalendarwidget.cpp @@ -1967,9 +1967,7 @@ void QCalendarWidgetPrivate::_q_editingFinished() The widget is initialized with the current month and year, but QCalendarWidget provides several public slots to change the year - and month that is shown. The currently displayed month and year - can be retrieved using the currentPageMonth() and currentPageYear() - functions, respectively. + and month that is shown. By default, today's date is selected, and the user can select a date using both mouse and keyboard. The currently selected date @@ -1982,6 +1980,9 @@ void QCalendarWidgetPrivate::_q_editingFinished() all. Note that a date also can be selected programmatically using the setSelectedDate() slot. + The currently displayed month and year can be retrieved using the + monthShown() and yearShown() functions, respectively. + A newly created calendar widget uses abbreviated day names, and both Saturdays and Sundays are marked in red. The calendar grid is not visible. The week numbers are displayed, and the first column @@ -2287,7 +2288,7 @@ int QCalendarWidget::monthShown() const selected date. The currently displayed month and year can be retrieved using the - currentPageMonth() and currentPageYear() functions respectively. + monthShown() and yearShown() functions respectively. \sa yearShown(), monthShown(), showPreviousMonth(), showNextMonth(), showPreviousYear(), showNextYear() diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index e68aa3a..bd6fa57 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -425,32 +425,25 @@ void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socke int i = indexOf(socket); if (!highPriorityQueue.isEmpty()) { - for (int j = highPriorityQueue.count() - 1; j >= 0; --j) { - HttpMessagePair &messagePair = highPriorityQueue[j]; - if (!messagePair.second->d_func()->requestIsPrepared) - prepareRequest(messagePair); - - channels[i].request = messagePair.first; - channels[i].reply = messagePair.second; - // remove before sendRequest! else we might pipeline the same request again - highPriorityQueue.removeAt(j); - channels[i].sendRequest(); - return; - } + // remove from queue before sendRequest! else we might pipeline the same request again + HttpMessagePair messagePair = highPriorityQueue.takeLast(); + if (!messagePair.second->d_func()->requestIsPrepared) + prepareRequest(messagePair); + channels[i].request = messagePair.first; + channels[i].reply = messagePair.second; + channels[i].sendRequest(); + return; } if (!lowPriorityQueue.isEmpty()) { - for (int j = lowPriorityQueue.count() - 1; j >= 0; --j) { - HttpMessagePair &messagePair = lowPriorityQueue[j]; - if (!messagePair.second->d_func()->requestIsPrepared) - prepareRequest(messagePair); - channels[i].request = messagePair.first; - channels[i].reply = messagePair.second; - // remove before sendRequest! else we might pipeline the same request again - lowPriorityQueue.removeAt(j); - channels[i].sendRequest(); - return; - } + // remove from queue before sendRequest! else we might pipeline the same request again + HttpMessagePair messagePair = lowPriorityQueue.takeLast(); + if (!messagePair.second->d_func()->requestIsPrepared) + prepareRequest(messagePair); + channels[i].request = messagePair.first; + channels[i].reply = messagePair.second; + channels[i].sendRequest(); + return; } } @@ -519,7 +512,7 @@ bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue, if (queue.isEmpty()) return true; - for (int i = 0; i < queue.length(); i++) { + for (int i = queue.count() - 1; i >= 0; --i) { HttpMessagePair messagePair = queue.at(i); const QHttpNetworkRequest &request = messagePair.first; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index b624c24..be7896b 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -92,8 +92,11 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM QNetworkRequest::PreferNetwork).toInt()); if (mode == QNetworkRequest::AlwaysCache && (op == QNetworkAccessManager::GetOperation - || op == QNetworkAccessManager::HeadOperation)) - return new QNetworkAccessCacheBackend; + || op == QNetworkAccessManager::HeadOperation)) { + QNetworkAccessBackend *backend = new QNetworkAccessCacheBackend; + backend->manager = this; + return backend; + } if (!factoryDataShutdown) { QMutexLocker locker(&factoryData()->mutex); @@ -111,7 +114,6 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM return 0; } - QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() { QNonContiguousByteDevice* device = 0; @@ -143,6 +145,8 @@ void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 byt } QNetworkAccessBackend::QNetworkAccessBackend() + : manager(0) + , reply(0) { } @@ -205,7 +209,9 @@ QList<QNetworkProxy> QNetworkAccessBackend::proxyList() const QAbstractNetworkCache *QNetworkAccessBackend::networkCache() const { - return reply->networkCache; // should be the same as manager->networkCache + if (!manager) + return 0; + return manager->networkCache; } void QNetworkAccessBackend::setCachingEnabled(bool enable) diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index df66c9d..2be10db 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE QNetworkAccessCacheBackend::QNetworkAccessCacheBackend() : QNetworkAccessBackend() + , device(0) { } diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index d925e77..bc01e82 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -711,9 +711,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // fourth step: setup the reply priv->setup(op, request, outgoingData); - if (request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt() != - QNetworkRequest::AlwaysNetwork) - priv->setNetworkCache(d->networkCache); #ifndef QT_NO_NETWORKPROXY QList<QNetworkProxy> proxyList = d->queryProxy(QNetworkProxyQuery(request.url())); priv->proxyList = proxyList; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 3b0948b..a60a8dd 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() : backend(0), outgoingData(0), outgoingDataBuffer(0), - copyDevice(0), networkCache(0), + copyDevice(0), cacheEnabled(false), cacheSaveDevice(0), notificationHandlingPaused(false), bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), @@ -252,11 +252,6 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const q->QIODevice::open(QIODevice::ReadOnly); } -void QNetworkReplyImplPrivate::setNetworkCache(QAbstractNetworkCache *nc) -{ - networkCache = nc; -} - void QNetworkReplyImplPrivate::backendNotify(InternalNotifications notification) { Q_Q(QNetworkReplyImpl); @@ -318,17 +313,28 @@ void QNetworkReplyImplPrivate::resumeNotificationHandling() QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated)); } +QAbstractNetworkCache *QNetworkReplyImplPrivate::networkCache() const +{ + if (!backend) + return 0; + return backend->networkCache(); +} + void QNetworkReplyImplPrivate::createCache() { // check if we can save and if we're allowed to - if (!networkCache || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()) + if (!networkCache() + || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool() + || request.attribute(QNetworkRequest::CacheLoadControlAttribute, + QNetworkRequest::PreferNetwork).toInt() + == QNetworkRequest::AlwaysNetwork) return; cacheEnabled = true; } bool QNetworkReplyImplPrivate::isCachingEnabled() const { - return (cacheEnabled && networkCache != 0); + return (cacheEnabled && networkCache() != 0); } void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) @@ -352,7 +358,7 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) qDebug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false) -- " "backend %s probably needs to be fixed", backend->metaObject()->className()); - networkCache->remove(url); + networkCache()->remove(url); cacheSaveDevice = 0; cacheEnabled = false; } @@ -361,9 +367,9 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) void QNetworkReplyImplPrivate::completeCacheSave() { if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) { - networkCache->remove(url); + networkCache()->remove(url); } else if (cacheEnabled && cacheSaveDevice) { - networkCache->insert(cacheSaveDevice); + networkCache()->insert(cacheSaveDevice); } cacheSaveDevice = 0; cacheEnabled = false; @@ -410,15 +416,15 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) metaData.setAttributes(attributes); } - cacheSaveDevice = networkCache->prepare(metaData); + cacheSaveDevice = networkCache()->prepare(metaData); if (!cacheSaveDevice || (cacheSaveDevice && !cacheSaveDevice->isOpen())) { if (cacheSaveDevice && !cacheSaveDevice->isOpen()) qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- " "class %s probably needs to be fixed", - networkCache->metaObject()->className()); + networkCache()->metaObject()->className()); - networkCache->remove(url); + networkCache()->remove(url); cacheSaveDevice = 0; cacheEnabled = false; } @@ -566,7 +572,7 @@ QNetworkReplyImpl::~QNetworkReplyImpl() { Q_D(QNetworkReplyImpl); if (d->isCachingEnabled()) - d->networkCache->remove(url()); + d->networkCache()->remove(url()); } void QNetworkReplyImpl::abort() diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 8cda7a4..04f8aa8 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -131,7 +131,6 @@ public: void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); - void setNetworkCache(QAbstractNetworkCache *networkCache); void pauseNotificationHandling(); void resumeNotificationHandling(); @@ -160,7 +159,7 @@ public: QIODevice *outgoingData; QRingBuffer *outgoingDataBuffer; QIODevice *copyDevice; - QAbstractNetworkCache *networkCache; + QAbstractNetworkCache *networkCache() const; bool cacheEnabled; QIODevice *cacheSaveDevice; diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index bb0915a..9ef92e1 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -752,6 +752,7 @@ QHttpSocketEnginePrivate::QHttpSocketEnginePrivate() , readNotificationPending(false) , writeNotificationPending(false) , connectionNotificationPending(false) + , pendingResponseData(0) { socket = 0; state = QHttpSocketEngine::None; diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 3e56995..3d9aa61 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -389,10 +389,19 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data"); } - // Set the send and receive buffer sizes to a magic size, found - // most optimal for our platforms. - setReceiveBufferSize(49152); - setSendBufferSize(49152); + // Before Qt 4.6, we always set the send and receive buffer size to 49152 as + // this was found to be an optimal value. However, modern OS + // all have some kind of auto tuning for this and we therefore don't set + // this explictly anymore. + // If it introduces any performance regressions for Qt 4.6.x (x > 0) then + // it will be put back in. + // + // You can use tests/manual/qhttpnetworkconnection to test HTTP download speed + // with this. + // + // pre-4.6: + // setReceiveBufferSize(49152); + // setSendBufferSize(49152); d->socketType = socketType; d->socketProtocol = protocol; diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 666770d..3793b1e 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -250,14 +250,22 @@ void QSslCertificate::clear() */ QByteArray QSslCertificate::version() const { + if (d->versionString.isEmpty() && d->x509) + d->versionString = + QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1); + return d->versionString; } /*! - Returns the certificate's serial number string. + Returns the certificate's serial number string in decimal format. */ QByteArray QSslCertificate::serialNumber() const { + if (d->serialNumberString.isEmpty() && d->x509) + d->serialNumberString = + QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber))); + return d->serialNumberString; } diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 69d2ccd..d47c91d 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -105,10 +105,8 @@ public: }; /*! - Constructs a QSslError object. The two optional arguments specify the \a - error that occurred, and which \a certificate the error relates to. + Constructs a QSslError object with no error and default certificate. - \sa QSslCertificate */ // RVCT compiler in debug build does not like about default values in const- @@ -120,6 +118,11 @@ QSslError::QSslError() d->certificate = QSslCertificate(); } +/*! + Constructs a QSslError object. The argument specifies the \a + error that occurred. + +*/ QSslError::QSslError(SslError error) : d(new QSslErrorPrivate) { @@ -127,6 +130,12 @@ QSslError::QSslError(SslError error) d->certificate = QSslCertificate(); } +/*! + Constructs a QSslError object. The two arguments specify the \a + error that occurred, and which \a certificate the error relates to. + + \sa QSslCertificate +*/ QSslError::QSslError(SslError error, const QSslCertificate &certificate) : d(new QSslErrorPrivate) { diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 6858d40..0e0c347 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1745,7 +1745,13 @@ qint64 QSslSocket::writeData(const char *data, qint64 len) \internal */ QSslSocketPrivate::QSslSocketPrivate() - : initialized(false), readyReadEmittedPointer(0), plainSocket(0) + : initialized(false) + , mode(QSslSocket::UnencryptedMode) + , autoStartHandshake(false) + , connectionEncrypted(false) + , ignoreAllSslErrors(false) + , readyReadEmittedPointer(0) + , plainSocket(0) { QSslConfigurationPrivate::deepCopyDefaultConfiguration(&configuration); } diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 5b04a57..d3dcd51 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -94,6 +94,7 @@ QT_BEGIN_NAMESPACE #ifdef SSLEAY_MACROS DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return) #endif +DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return) DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return) DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return) DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return) @@ -608,6 +609,7 @@ bool q_resolveOpenSslSymbols() #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup) #endif + RESOLVEFUNC(ASN1_INTEGER_get) RESOLVEFUNC(ASN1_STRING_data) RESOLVEFUNC(ASN1_STRING_length) RESOLVEFUNC(BIO_ctrl) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index f9c92e5..30762ca 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -201,6 +201,7 @@ QT_BEGIN_NAMESPACE #endif // !defined QT_LINKED_OPENSSL bool q_resolveOpenSslSymbols(); +long q_ASN1_INTEGER_get(ASN1_INTEGER *a); unsigned char * q_ASN1_STRING_data(ASN1_STRING *a); int q_ASN1_STRING_length(ASN1_STRING *a); long q_BIO_ctrl(BIO *a, int b, long c, void *d); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 891c027..d48a7b6 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -570,20 +570,34 @@ bool QGLEngineShaderManager::useCorrectShaderProg() requiredProgram.program->link(); if (!requiredProgram.program->isLinked()) { + QLatin1String none("none"); + QLatin1String br("\n"); QString error; - qWarning() << "Shader program failed to link," + error = QLatin1String("Shader program failed to link,") #if defined(QT_DEBUG) - << '\n' - << " Shaders Used:" << '\n' - << " mainVertexShader = " << requiredProgram.mainVertexShader->objectName() << '\n' - << " positionVertexShader = " << requiredProgram.positionVertexShader->objectName() << '\n' - << " mainFragShader = " << requiredProgram.mainFragShader->objectName() << '\n' - << " srcPixelFragShader = " << requiredProgram.srcPixelFragShader->objectName() << '\n' - << " maskFragShader = " << requiredProgram.maskFragShader->objectName() << '\n' - << " compositionFragShader = "<< requiredProgram.compositionFragShader->objectName() << '\n' + + br + + QLatin1String(" Shaders Used:\n") + + QLatin1String(" mainVertexShader = ") + + (requiredProgram.mainVertexShader ? + requiredProgram.mainVertexShader->objectName() : none) + br + + QLatin1String(" positionVertexShader = ") + + (requiredProgram.positionVertexShader ? + requiredProgram.positionVertexShader->objectName() : none) + br + + QLatin1String(" mainFragShader = ") + + (requiredProgram.mainFragShader ? + requiredProgram.mainFragShader->objectName() : none) + br + + QLatin1String(" srcPixelFragShader = ") + + (requiredProgram.srcPixelFragShader ? + requiredProgram.srcPixelFragShader->objectName() : none) + br + + QLatin1String(" maskFragShader = ") + + (requiredProgram.maskFragShader ? + requiredProgram.maskFragShader->objectName() : none) + br + + QLatin1String(" compositionFragShader = ") + + (requiredProgram.compositionFragShader ? + requiredProgram.compositionFragShader->objectName() : none) + br #endif - << " Error Log:" << '\n' - << " " << requiredProgram.program->log(); + + QLatin1String(" Error Log:\n") + + QLatin1String(" ") + requiredProgram.program->log(); qWarning() << error; delete requiredProgram.program; } else { diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index a976a02..0c01263 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -380,7 +380,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader() } if (simpleShaderDepthUniformDirty) { - shaderManager->simpleProgram()->setUniformValue("depth", (GLfloat)q->state()->currentDepth); + shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(q->state()->currentDepth)); simpleShaderDepthUniformDirty = false; } } @@ -731,7 +731,6 @@ void QGL2PaintEngineExPrivate::resetGLState() glActiveTexture(GL_TEXTURE0); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - glDepthFunc(GL_LESS); glDepthMask(true); glClearDepth(1); } @@ -959,7 +958,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) } if (depthUniformDirty) { - shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), (GLfloat)q->state()->currentDepth); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), normalizedDeviceDepth(q->state()->currentDepth)); depthUniformDirty = false; } @@ -1351,7 +1350,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) if (!d->inRenderText) { glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - glDepthFunc(GL_LEQUAL); + glDepthFunc(GL_LESS); glDepthMask(false); } @@ -1441,7 +1440,7 @@ void QGL2PaintEngineEx::ensureActive() if (d->needsSync) { glViewport(0, 0, d->width, d->height); glDepthMask(false); - glDepthFunc(GL_LEQUAL); + glDepthFunc(GL_LESS); setState(state()); d->needsSync = false; } @@ -1492,7 +1491,7 @@ void QGL2PaintEngineEx::clipEnabledChanged() d->regenerateDepthClip(); } else { if (d->use_system_clip) { - state()->currentDepth = -0.5f; + state()->currentDepth = 0; } else { state()->depthTestEnabled = false; } @@ -1501,7 +1500,7 @@ void QGL2PaintEngineEx::clipEnabledChanged() } } -void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth) +void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint depth) { transferMode(BrushDrawingMode); @@ -1510,7 +1509,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth) if (q->state()->needsDepthBufferClear) { glDepthMask(true); - glClearDepth(0.5); + glClearDepth(rawDepth(2)); glClear(GL_DEPTH_BUFFER_BIT); q->state()->needsDepthBufferClear = false; glDepthMask(false); @@ -1532,7 +1531,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth) glColorMask(false, false, false, false); glDepthMask(true); - shaderManager->simpleProgram()->setUniformValue("depth", depth); + shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(depth)); simpleShaderDepthUniformDirty = true; glEnable(GL_DEPTH_TEST); @@ -1596,12 +1595,12 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) glDepthFunc(GL_ALWAYS); - state()->maxDepth = 0.5f; + state()->maxDepth = 4; d->writeClip(qtVectorPathForPath(path), state()->maxDepth); - state()->currentDepth = 0.25f; + state()->currentDepth = 3; state()->depthTestEnabled = true; - glDepthFunc(GL_LEQUAL); + glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); } @@ -1610,7 +1609,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) if (d->use_system_clip) { glEnable(GL_DEPTH_TEST); state()->depthTestEnabled = true; - state()->currentDepth = -0.5; + state()->currentDepth = 0; } else { glDisable(GL_DEPTH_TEST); state()->depthTestEnabled = false; @@ -1618,18 +1617,18 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) state()->canRestoreClip = false; break; case Qt::IntersectClip: - state()->maxDepth = (1.0f + state()->maxDepth) * 0.5; + ++state()->maxDepth; d->writeClip(path, state()->maxDepth); - state()->currentDepth = 1.5 * state()->maxDepth - 0.5f; + state()->currentDepth = state()->maxDepth - 1; state()->depthTestEnabled = true; break; case Qt::ReplaceClip: d->systemStateChanged(); state()->rectangleClip = QRect(); - state()->maxDepth = 0.5f; + state()->maxDepth = 4; glDepthFunc(GL_ALWAYS); d->writeClip(path, state()->maxDepth); - state()->currentDepth = 0.25f; + state()->currentDepth = 3; state()->canRestoreClip = false; state()->depthTestEnabled = true; break; @@ -1641,7 +1640,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) break; } - glDepthFunc(GL_LEQUAL); + glDepthFunc(GL_LESS); if (state()->depthTestEnabled) { glEnable(GL_DEPTH_TEST); d->simpleShaderDepthUniformDirty = true; @@ -1672,8 +1671,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged() glDisable(GL_SCISSOR_TEST); - q->state()->currentDepth = -0.5f; - q->state()->maxDepth = 0.5f; + q->state()->currentDepth = 1; + q->state()->maxDepth = 4; q->state()->rectangleClip = QRect(0, 0, width, height); @@ -1708,8 +1707,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged() path.addRegion(systemClip); glDepthFunc(GL_ALWAYS); - writeClip(qtVectorPathForPath(path), 0.0f); - glDepthFunc(GL_LEQUAL); + writeClip(qtVectorPathForPath(path), 2); + glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); q->state()->depthTestEnabled = true; @@ -1718,7 +1717,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged() q->transformChanged(); } - q->state()->currentDepth = -0.5f; + q->state()->currentDepth = 1; simpleShaderDepthUniformDirty = true; depthUniformDirty = true; } @@ -1757,7 +1756,7 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) if (old_state && old_state != s && old_state->canRestoreClip) { d->updateDepthScissorTest(); glDepthMask(false); - glDepthFunc(GL_LEQUAL); + glDepthFunc(GL_LESS); s->maxDepth = old_state->maxDepth; } else { d->regenerateDepthClip(); @@ -1802,8 +1801,8 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() needsDepthBufferClear = true; depthTestEnabled = false; scissorTestEnabled = false; - currentDepth = -0.5f; - maxDepth = 0.5f; + currentDepth = 1; + maxDepth = 4; canRestoreClip = true; hasRectangleClip = false; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 58fcde1..552e390 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -82,8 +82,8 @@ public: bool depthTestEnabled; bool scissorTestEnabled; - qreal currentDepth; - qreal maxDepth; + uint maxDepth; + uint currentDepth; bool canRestoreClip; QRect rectangleClip; @@ -230,13 +230,26 @@ public: QGLEngineShaderManager* shaderManager; - void writeClip(const QVectorPath &path, float depth); + void writeClip(const QVectorPath &path, uint depth); void updateDepthScissorTest(); void setScissor(const QRect &rect); void regenerateDepthClip(); void systemStateChanged(); uint use_system_clip : 1; + static inline GLfloat rawDepth(uint depth) + { + // assume at least 16 bits in the depth buffer, and + // use 2^15 depth levels to be safe with regard to + // rounding issues etc + return depth * (1.0f / GLfloat((1 << 15) - 1)); + } + + static inline GLfloat normalizedDeviceDepth(uint depth) + { + return 2.0f * rawDepth(depth) - 1.0f; + } + uint location(QGLEngineShaderManager::Uniform uniform) { return shaderManager->getUniformLocation(uniform); diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 9659654..427aab3 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -875,9 +875,22 @@ QImage QGLFramebufferObject::toImage() const if (!d->valid) return QImage(); - const_cast<QGLFramebufferObject *>(this)->bind(); + // qt_gl_read_framebuffer doesn't work on a multisample FBO + if (format().samples() != 0) { + QGLFramebufferObject temp(size(), QGLFramebufferObjectFormat()); + + QRect rect(QPoint(0, 0), size()); + blitFramebuffer(&temp, rect, const_cast<QGLFramebufferObject *>(this), rect); + + return temp.toImage(); + } + + bool wasBound = isBound(); + if (!wasBound) + const_cast<QGLFramebufferObject *>(this)->bind(); QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true); - const_cast<QGLFramebufferObject *>(this)->release(); + if (!wasBound) + const_cast<QGLFramebufferObject *>(this)->release(); return image; } diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index c4d9322..56b55d0 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -501,6 +501,25 @@ bool QGLShader::compile(const char *source) return d->compile(this); } else if (d->shader) { QVarLengthArray<const char *> src; + int headerLen = 0; + while (source && source[headerLen] == '#') { + // Skip #version and #extension directives at the start of + // the shader code. We need to insert the qualifierDefines + // and redefineHighp just after them. + if (qstrncmp(source + headerLen, "#version", 8) != 0 && + qstrncmp(source + headerLen, "#extension", 10) != 0) { + break; + } + while (source[headerLen] != '\0' && source[headerLen] != '\n') + ++headerLen; + if (source[headerLen] == '\n') + ++headerLen; + } + QByteArray header; + if (headerLen > 0) { + header = QByteArray(source, headerLen); + src.append(header.constData()); + } #ifdef QGL_DEFINE_QUALIFIERS src.append(qualifierDefines); #endif @@ -509,7 +528,7 @@ bool QGLShader::compile(const char *source) d->shaderType == PartialFragmentShader) src.append(redefineHighp); #endif - src.append(source); + src.append(source + headerLen); QGLContextGroup *ctx = d->ctx; glShaderSource(d->shader, src.size(), src.data(), 0); return d->compile(this); diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index c5da3df..d397050 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -1,47 +1,15 @@ TARGET = qdirectfbscreen include(../../qpluginbase.pri) +include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers -# These defines might be necessary if your DirectFB driver doesn't -# support all of the DirectFB API. -# -#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR -#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER -#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE -#DEFINES += QT_DIRECTFB_IMAGECACHE -#DEFINES += QT_NO_DIRECTFB_WM -#DEFINES += QT_NO_DIRECTFB_LAYER -#DEFINES += QT_NO_DIRECTFB_PALETTE -#DEFINES += QT_NO_DIRECTFB_PREALLOCATED -#DEFINES += QT_NO_DIRECTFB_MOUSE -#DEFINES += QT_NO_DIRECTFB_KEYBOARD -#DEFINES += QT_DIRECTFB_TIMING -#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION -#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS -#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" -#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" - target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers INSTALLS += target -HEADERS = qdirectfbscreen.h \ - qdirectfbwindowsurface.h \ - qdirectfbpaintengine.h \ - qdirectfbpaintdevice.h \ - qdirectfbpixmap.h \ - qdirectfbkeyboard.h \ - qdirectfbmouse.h - -SOURCES = qdirectfbscreen.cpp \ - qdirectfbscreenplugin.cpp \ - qdirectfbwindowsurface.cpp \ - qdirectfbpaintengine.cpp \ - qdirectfbpaintdevice.cpp \ - qdirectfbpixmap.cpp \ - qdirectfbkeyboard.cpp \ - qdirectfbmouse.cpp +SOURCES += qdirectfbscreenplugin.cpp QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB LIBS += $$QT_LIBS_DIRECTFB DEFINES += $$QT_DEFINES_DIRECTFB +contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 2fb1520..896f512 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -121,8 +121,8 @@ QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler return; } - int flags = ::fcntl(fd, F_GETFL, 0); - ::fcntl(fd, F_SETFL, flags | O_NONBLOCK); + int flags = fcntl(fd, F_GETFL, 0); + fcntl(fd, F_SETFL, flags | O_NONBLOCK); // DirectFB seems to assume that the mouse always starts centered prevPoint = QPoint(screen->deviceWidth() / 2, screen->deviceHeight() / 2); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index 106de0d..2e56b9a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -48,14 +48,29 @@ QT_BEGIN_NAMESPACE QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr) - : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr), - bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), - imageFormat(QImage::Format_Invalid) -{} + : QCustomRasterPaintDevice(0), dfbSurface(0), screen(scr), + bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), imageFormat(QImage::Format_Invalid) +{ +#ifdef QT_DIRECTFB_SUBSURFACE + subSurface = 0; + syncPending = false; +#endif +} QDirectFBPaintDevice::~QDirectFBPaintDevice() { - delete lockedImage; + unlockSurface(); + if (QDirectFBScreen::instance()) { + unlockSurface(); +#ifdef QT_DIRECTFB_SUBSURFACE + if (subSurface) { + screen->releaseDFBSurface(subSurface); + } +#endif + if (dfbSurface) { + screen->releaseDFBSurface(dfbSurface); + } + } delete engine; } @@ -64,30 +79,57 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const return dfbSurface; } -void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags) +bool QDirectFBPaintDevice::lockSurface(DFBSurfaceLockFlags lockFlags) { - if (!(lockFlgs & flags)) { - if (lockFlgs) - unlockDirectFB(); - mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl); + if (lockFlgs && (lockFlags & ~lockFlgs)) + unlockSurface(); + if (!mem) { + Q_ASSERT(dfbSurface); +#ifdef QT_DIRECTFB_SUBSURFACE + if (!subSurface) { + DFBResult result; + subSurface = screen->getSubSurface(dfbSurface, QRect(), QDirectFBScreen::TrackSurface, &result); + if (result != DFB_OK || !subSurface) { + DirectFBError("Couldn't create sub surface", result); + return false; + } + } + IDirectFBSurface *surface = subSurface; +#else + IDirectFBSurface *surface = dfbSurface; +#endif + Q_ASSERT(surface); + mem = QDirectFBScreen::lockSurface(surface, lockFlags, &bpl); + lockFlgs = lockFlags; Q_ASSERT(mem); + Q_ASSERT(bpl > 0); const QSize s = size(); - lockedImage = new QImage(mem, s.width(), s.height(), bpl, - QDirectFBScreen::getImageFormat(dfbSurface)); - lockFlgs = flags; + lockedImage = QImage(mem, s.width(), s.height(), bpl, + QDirectFBScreen::getImageFormat(dfbSurface)); + return true; + } +#ifdef QT_DIRECTFB_SUBSURFACE + if (syncPending) { + syncPending = false; + screen->waitIdle(); } +#endif + return false; } -void QDirectFBPaintDevice::unlockDirectFB() +void QDirectFBPaintDevice::unlockSurface() { - if (!lockedImage || !QDirectFBScreen::instance()) - return; - - dfbSurface->Unlock(dfbSurface); - delete lockedImage; - lockedImage = 0; - mem = 0; - lockFlgs = DFBSurfaceLockFlags(0); + if (QDirectFBScreen::instance() && lockFlgs) { +#ifdef QT_DIRECTFB_SUBSURFACE + IDirectFBSurface *surface = subSurface; +#else + IDirectFBSurface *surface = dfbSurface; +#endif + if (surface) { + surface->Unlock(surface); + lockFlgs = static_cast<DFBSurfaceLockFlags>(0); + } + } } void *QDirectFBPaintDevice::memory() const @@ -102,17 +144,10 @@ QImage::Format QDirectFBPaintDevice::format() const int QDirectFBPaintDevice::bytesPerLine() const { - if (bpl == -1) { - // Can only get the stride when we lock the surface - Q_ASSERT(!lockedImage); - QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this); - that->lockDirectFB(DSLF_READ|DSLF_WRITE); - Q_ASSERT(bpl != -1); - } + Q_ASSERT(!mem || bpl != -1); return bpl; } - QSize QDirectFBPaintDevice::size() const { int w, h; @@ -142,8 +177,8 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmDepth: return QDirectFBScreen::depth(imageFormat); case QPaintDevice::PdmNumColors: { - if (lockedImage) - return lockedImage->numColors(); + if (!lockedImage.isNull()) + return lockedImage.numColors(); DFBResult result; IDirectFBPalette *palette = 0; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index f5de44b..cdd2bea 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -62,8 +62,8 @@ public: virtual IDirectFBSurface *directFBSurface() const; - void lockDirectFB(DFBSurfaceLockFlags lock); - void unlockDirectFB(); + bool lockSurface(DFBSurfaceLockFlags lockFlags); + void unlockSurface(); // Reimplemented from QCustomRasterPaintDevice: void *memory() const; @@ -73,7 +73,6 @@ public: int metric(QPaintDevice::PaintDeviceMetric metric) const; DFBSurfaceLockFlags lockFlags() const { return lockFlgs; } QPaintEngine *paintEngine() const; - protected: QDirectFBPaintDevice(QDirectFBScreen *scr); inline int dotsPerMeterX() const @@ -84,17 +83,20 @@ protected: { return (screen->deviceHeight() * 1000) / screen->physicalHeight(); } -protected: + IDirectFBSurface *dfbSurface; - QImage *lockedImage; +#ifdef QT_DIRECTFB_SUBSURFACE + IDirectFBSurface *subSurface; + friend class QDirectFBPaintEnginePrivate; + bool syncPending; +#endif + QImage lockedImage; QDirectFBScreen *screen; int bpl; DFBSurfaceLockFlags lockFlgs; uchar *mem; QDirectFBPaintEngine *engine; QImage::Format imageFormat; -private: - Q_DISABLE_COPY(QDirectFBPaintDevice); }; QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 9a9553e..5bad4de 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -93,6 +93,7 @@ public: inline void lock(); inline void unlock(); + static inline void unlock(QDirectFBPaintDevice *device); inline bool isSimpleBrush(const QBrush &brush) const; @@ -109,7 +110,7 @@ public: #endif void prepareForBlit(bool alpha); -private: + IDirectFBSurface *surface; bool antialiased; @@ -129,7 +130,6 @@ private: QRect currentClip; QDirectFBPaintEngine *q; - friend class QDirectFBPaintEngine; }; class SurfaceCache @@ -222,6 +222,7 @@ template <class T> static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface); #define CLIPPED_PAINT(operation) { \ + d->unlock(); \ DFBRegion clipRegion; \ switch (d->clipType) { \ case QDirectFBPaintEnginePrivate::NoClip: \ @@ -269,6 +270,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device) QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbPixmapData = static_cast<QDirectFBPixmapData*>(data); + QDirectFBPaintEnginePrivate::unlock(dfbPixmapData); d->dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData); } @@ -409,14 +411,13 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) QRasterPaintEngine::drawRects(rects, rectCount); return; } - d->unlock(); if (brush != Qt::NoBrush) { d->setDFBColor(brush.color()); - CLIPPED_PAINT(::fillRects<QRect>(rects, rectCount, state()->matrix, d->surface)); + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects<QRect>)(rects, rectCount, state()->matrix, d->surface)); } if (pen != Qt::NoPen) { d->setDFBColor(pen.color()); - CLIPPED_PAINT(::drawRects<QRect>(rects, rectCount, state()->matrix, d->surface)); + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRect>)(rects, rectCount, state()->matrix, d->surface)); } } @@ -438,14 +439,13 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) QRasterPaintEngine::drawRects(rects, rectCount); return; } - d->unlock(); if (brush != Qt::NoBrush) { d->setDFBColor(brush.color()); - CLIPPED_PAINT(::fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface)); + CLIPPED_PAINT(fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface)); } if (pen != Qt::NoPen) { d->setDFBColor(pen.color()); - CLIPPED_PAINT(::drawRects<QRectF>(rects, rectCount, state()->matrix, d->surface)); + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRectF>)(rects, rectCount, state()->matrix, d->surface)); } } @@ -464,9 +464,8 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) const QPen &pen = state()->pen; if (pen != Qt::NoPen) { - d->unlock(); d->setDFBColor(pen.color()); - CLIPPED_PAINT(::drawLines<QLine>(lines, lineCount, state()->matrix, d->surface)); + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLine>)(lines, lineCount, state()->matrix, d->surface)); } } @@ -485,9 +484,8 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) const QPen &pen = state()->pen; if (pen != Qt::NoPen) { - d->unlock(); d->setDFBColor(pen.color()); - CLIPPED_PAINT(::drawLines<QLineF>(lines, lineCount, state()->matrix, d->surface)); + CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLineF>)(lines, lineCount, state()->matrix, d->surface)); } } @@ -533,7 +531,6 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, return; } #if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE - d->unlock(); bool release; IDirectFBSurface *imgSurface = d->getSurface(image, &release); d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface)); @@ -561,25 +558,25 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); d->lock(); QRasterPaintEngine::drawPixmap(r, pixmap, sr); - } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || (state()->renderHints & QPainter::SmoothPixmapTransform - && state()->matrix.mapRect(r).size() != sr.size())) { - RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); - const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ); - d->lock(); - QRasterPaintEngine::drawImage(r, *img, sr); } else { - d->unlock(); - d->prepareForBlit(pixmap.hasAlphaChannel()); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); - dfbData->unlockDirectFB(); - IDirectFBSurface *s = dfbData->directFBSurface(); - - CLIPPED_PAINT(d->blit(r, s, sr)); + if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits) + || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || (state()->renderHints & QPainter::SmoothPixmapTransform + && state()->matrix.mapRect(r).size() != sr.size())) { + RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); + const QImage *img = dfbData->buffer(); + d->lock(); + QRasterPaintEngine::drawImage(r, *img, sr); + } else { + QDirectFBPaintEnginePrivate::unlock(dfbData); + d->prepareForBlit(pixmap.hasAlphaChannel()); + IDirectFBSurface *s = dfbData->directFBSurface(); + CLIPPED_PAINT(d->blit(r, s, sr)); + } } } @@ -602,14 +599,16 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip || (state()->renderHints & QPainter::SmoothPixmapTransform && state()->matrix.isScaling())) { RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); - const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ); + QPixmapData *pixmapData = pixmap.pixmapData(); + Q_ASSERT(pixmapData->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(pixmapData); + const QImage *img = dfbData->buffer(); d->lock(); QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); data->fromImage(*img, Qt::AutoColor); const QPixmap pix(data); QRasterPaintEngine::drawTiledPixmap(r, pix, offset); } else { - d->unlock(); CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset)); } } @@ -708,7 +707,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) const QColor color = brush.color(); if (!color.isValid()) return; - d->unlock(); d->setDFBColor(color); const QRect r = state()->matrix.mapRect(rect).toRect(); CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); @@ -725,7 +723,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass) break; - d->unlock(); CLIPPED_PAINT(d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin)); return; } default: @@ -749,7 +746,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) d->lock(); QRasterPaintEngine::fillRect(rect, color); } else { - d->unlock(); d->setDFBColor(color); const QRect r = state()->matrix.mapRect(rect).toRect(); CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); @@ -811,8 +807,7 @@ void QDirectFBPaintEnginePrivate::lock() // lock so we need to call the base implementation of prepare so // it updates its rasterBuffer to point to the new buffer address. Q_ASSERT(dfbDevice); - if (dfbDevice->lockFlags() != (DSLF_WRITE|DSLF_READ)) { - dfbDevice->lockDirectFB(DSLF_READ|DSLF_WRITE); + if (dfbDevice->lockSurface(DSLF_READ|DSLF_WRITE)) { prepare(dfbDevice); } } @@ -820,7 +815,21 @@ void QDirectFBPaintEnginePrivate::lock() void QDirectFBPaintEnginePrivate::unlock() { Q_ASSERT(dfbDevice); - dfbDevice->unlockDirectFB(); +#ifdef QT_DIRECTFB_SUBSURFACE + dfbDevice->syncPending = true; +#else + QDirectFBPaintEnginePrivate::unlock(dfbDevice); +#endif +} + +void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device) +{ +#ifdef QT_NO_DIRECTFB_SUBSURFACE + Q_ASSERT(device); + device->unlockSurface(); +#else + Q_UNUSED(device); +#endif } void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) @@ -1031,7 +1040,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); - dfbData->unlockDirectFB(); + QDirectFBPaintEnginePrivate::unlock(dfbData); const QSize pixmapSize = dfbData->size(); IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); if (transform.isScaling()) { @@ -1040,8 +1049,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix offset.ry() *= transform.m22(); const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22()); - qreal y = ::fixCoord(destinationRect.y(), mappedSize.height(), offset.y()); - const qreal startX = ::fixCoord(destinationRect.x(), mappedSize.width(), offset.x()); + qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y()); + const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x()); while (y <= destinationRect.bottom()) { qreal x = startX; while (x <= destinationRect.right()) { @@ -1052,8 +1061,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix y += mappedSize.height(); } } else { - qreal y = ::fixCoord(destinationRect.y(), pixmapSize.height(), offset.y()); - const qreal startX = ::fixCoord(destinationRect.x(), pixmapSize.width(), offset.x()); + qreal y = fixCoord(destinationRect.y(), pixmapSize.height(), offset.y()); + const qreal startX = fixCoord(destinationRect.x(), pixmapSize.width(), offset.x()); int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1; if (startX != destinationRect.x()) ++horizontal; @@ -1165,12 +1174,12 @@ template <class T> static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface) { if (n == 1) { - const QLine l = ::map(transform, lines[0]); + const QLine l = map(transform, lines[0]); surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); } else { QVarLengthArray<DFBRegion, 32> lineArray(n); for (int i=0; i<n; ++i) { - const QLine l = ::map(transform, lines[i]); + const QLine l = map(transform, lines[i]); lineArray[i].x1 = l.x1(); lineArray[i].y1 = l.y1(); lineArray[i].x2 = l.x2(); @@ -1184,12 +1193,12 @@ template <class T> static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) { if (n == 1) { - const QRect r = ::mapRect(transform, rects[0]); + const QRect r = mapRect(transform, rects[0]); surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height()); } else { QVarLengthArray<DFBRectangle, 32> rectArray(n); for (int i=0; i<n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = mapRect(transform, rects[i]); rectArray[i].x = r.x(); rectArray[i].y = r.y(); rectArray[i].w = r.width(); @@ -1203,7 +1212,7 @@ template <class T> static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) { for (int i=0; i<n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = mapRect(transform, rects[i]); surface->DrawRectangle(surface, r.x(), r.y(), r.width(), r.height()); } } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 0717020..6550683 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -64,9 +64,6 @@ QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixe QDirectFBPixmapData::~QDirectFBPixmapData() { - unlockDirectFB(); - if (dfbSurface && QDirectFBScreen::instance()) - screen->releaseDFBSurface(dfbSurface); } void QDirectFBPixmapData::resize(int width, int height) @@ -167,7 +164,7 @@ static bool checkForAlphaPixels(const QImage &img) bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) { #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - return ::checkForAlphaPixels(img); + return checkForAlphaPixels(img); #else return img.hasAlphaChannel(); #endif @@ -375,9 +372,13 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) QPixmapData::copy(data, rect); return; } - unlockDirectFB(); const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data); +#ifdef QT_NO_DIRECTFB_SUBSURFACE + if (otherData->lockFlags()) { + const_cast<QDirectFBPixmapData*>(otherData)->unlockSurface(); + } +#endif IDirectFBSurface *src = otherData->directFBSurface(); alpha = data->hasAlphaChannel(); imageFormat = (alpha @@ -405,6 +406,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) h = rect.height(); d = otherData->d; is_null = (w <= 0 || h <= 0); + unlockSurface(); DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); #if (Q_DIRECTFB_VERSION >= 0x010000) dfbSurface->ReleaseSource(dfbSurface); @@ -443,7 +445,7 @@ void QDirectFBPixmapData::fill(const QColor &color) alpha = (color.alpha() < 255); - if (alpha && ::isOpaqueFormat(imageFormat)) { + if (alpha && isOpaqueFormat(imageFormat)) { QSize size; dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight()); screen->releaseDFBSurface(dfbSurface); @@ -465,18 +467,21 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, Qt::TransformationMode mode) const { QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this); +#ifdef QT_NO_DIRECTFB_SUBSURFACE + if (lockFlags()) + that->unlockSurface(); +#endif + if (!dfbSurface || transform.type() != QTransform::TxScale || mode != Qt::FastTransformation) { const QImage *image = that->buffer(); Q_ASSERT(image); const QImage transformed = image->transformed(transform, mode); - that->unlockDirectFB(); QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType); data->fromImage(transformed, Qt::AutoColor); return QPixmap(data); } - that->unlockDirectFB(); const QSize size = transform.mapRect(QRect(0, 0, w, h)).size(); if (size.isEmpty()) @@ -556,14 +561,12 @@ QPaintEngine *QDirectFBPixmapData::paintEngine() const QImage *QDirectFBPixmapData::buffer() { - lockDirectFB(DSLF_READ|DSLF_WRITE); - return lockedImage; -} - -QImage * QDirectFBPixmapData::buffer(DFBSurfaceLockFlags lockFlags) -{ - lockDirectFB(lockFlags); - return lockedImage; + if (!lockFlgs) { + lockSurface(DSLF_READ|DSLF_WRITE); + } + Q_ASSERT(lockFlgs); + Q_ASSERT(!lockedImage.isNull()); + return &lockedImage; } void QDirectFBPixmapData::invalidate() diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 7b4ae47..5d3a2f6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -81,11 +81,9 @@ public: virtual QImage toImage() const; virtual QPaintEngine *paintEngine() const; virtual QImage *buffer(); - virtual int metric(QPaintDevice::PaintDeviceMetric m) const {return QDirectFBPaintDevice::metric(m);} - - QImage *buffer(DFBSurfaceLockFlags lockFlags); - // Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice + virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); } + inline QImage::Format pixelFormat() const { return imageFormat; } static bool hasAlphaChannel(const QImage &img); inline bool hasAlphaChannel() const { return alpha; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 59fa191..599b2a9 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -319,14 +319,38 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, if (options & TrackSurface) { d_ptr->allocatedSurfaces.insert(newSurface); - - //qDebug("Created a new DirectFB surface at %p. New count = %d", - // newSurface, d_ptr->allocatedSurfaces.count()); } return newSurface; } +#ifdef QT_DIRECTFB_SUBSURFACE +IDirectFBSurface *QDirectFBScreen::getSubSurface(IDirectFBSurface *surface, + const QRect &rect, + SurfaceCreationOptions options, + DFBResult *resultPtr) +{ + Q_ASSERT(!(options & NoPreallocated)); + Q_ASSERT(surface); + DFBResult res; + DFBResult &result = (resultPtr ? *resultPtr : res); + IDirectFBSurface *subSurface = 0; + if (rect.isNull()) { + result = surface->GetSubSurface(surface, 0, &subSurface); + } else { + const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() }; + result = surface->GetSubSurface(surface, &subRect, &subSurface); + } + if (result != DFB_OK) { + DirectFBError("Can't get sub surface", result); + } else if (options & TrackSurface) { + d_ptr->allocatedSurfaces.insert(subSurface); + } + return subSurface; +} +#endif + + void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface) { Q_ASSERT(QDirectFBScreen::instance()); @@ -999,9 +1023,9 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface) dev.name, dev.vendor, dev.driver.name, dev.driver.major, dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat), QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask, - ::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(), - dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(), - dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(), + flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(), + dev.blitting_flags, flagDescriptions(dev.blitting_flags, blitDescriptions).constData(), + dev.drawing_flags, flagDescriptions(dev.drawing_flags, drawDescriptions).constData(), (dev.video_memory >> 10)); } #endif @@ -1067,7 +1091,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) #ifdef QT_DIRECTFB_IMAGECACHE int imageCacheSize = 4 * 1024 * 1024; // 4 MB - ::setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize); + setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize); QDirectFBPaintEngine::initImageCache(imageCacheSize); #endif @@ -1191,8 +1215,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) "Unable to get screen size!", result); return false; } - ::setIntOption(displayArgs, QLatin1String("width"), &w); - ::setIntOption(displayArgs, QLatin1String("height"), &h); + setIntOption(displayArgs, QLatin1String("width"), &w); + setIntOption(displayArgs, QLatin1String("height"), &h); dw = w; dh = h; @@ -1200,8 +1224,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) Q_ASSERT(dw != 0 && dh != 0); physWidth = physHeight = -1; - ::setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth); - ::setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight); + setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth); + setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight); const int dpi = 72; if (physWidth < 0) physWidth = qRound(dw * 25.4 / dpi); @@ -1527,6 +1551,11 @@ void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider) } #endif +void QDirectFBScreen::waitIdle() +{ + d_ptr->dfb->WaitIdle(d_ptr->dfb); +} + IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const { Q_ASSERT(widget); @@ -1540,6 +1569,7 @@ IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRec return 0; } +#ifdef QT_DIRECTFB_SUBSURFACE IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const { Q_ASSERT(widget); @@ -1550,7 +1580,7 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co if (!area.isNull()) rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0))); if (!rect.isNull()) { - const DFBRectangle subRect = {rect.x(), rect.y(), rect.width(), rect.height() }; + const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() }; const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface); if (result != DFB_OK) { DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result); @@ -1559,6 +1589,7 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co } return subSurface; } +#endif QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index e74adb1..0ce7a53 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -54,6 +54,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) +#if !defined QT_NO_DIRECTFB_SUBSURFACE && !defined QT_DIRECTFB_SUBSURFACE +#define QT_DIRECTFB_SUBSURFACE +#endif #if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER #define QT_DIRECTFB_LAYER #endif @@ -166,8 +169,11 @@ public: return static_cast<QDirectFBScreen*>(inst); } + void waitIdle(); IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; +#ifdef QT_DIRECTFB_SUBSURFACE IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const; +#endif IDirectFB *dfb(); #ifdef QT_NO_DIRECTFB_WM @@ -199,6 +205,12 @@ public: IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options, DFBResult *result); +#ifdef QT_DIRECTFB_SUBSURFACE + IDirectFBSurface *getSubSurface(IDirectFBSurface *surface, + const QRect &rect, + SurfaceCreationOptions options, + DFBResult *result); +#endif void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, const QRegion ®ion, const QPoint &offset); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 73a6dd7..e288199 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -102,6 +102,11 @@ QDirectFBWindowSurface::~QDirectFBWindowSurface() { } +bool QDirectFBWindowSurface::isValid() const +{ + return true; +} + #ifdef QT_DIRECTFB_WM void QDirectFBWindowSurface::raise() { @@ -111,14 +116,7 @@ void QDirectFBWindowSurface::raise() sibling->raise(); } } -#endif -bool QDirectFBWindowSurface::isValid() const -{ - return true; -} - -#ifndef QT_NO_DIRECTFB_WM void QDirectFBWindowSurface::createWindow() { IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); @@ -148,10 +146,8 @@ void QDirectFBWindowSurface::createWindow() dfbWindow->GetSurface(dfbWindow, &dfbSurface); updateFormat(); } -#endif // QT_NO_DIRECTFB_WM -#ifndef QT_NO_DIRECTFB_WM -static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect) +static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect) { DFBResult result = DFB_OK; const bool isMove = old.isEmpty() || rect.topLeft() != old.topLeft(); @@ -178,7 +174,7 @@ static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const #endif return result; } -#endif +#endif // QT_NO_DIRECTFB_WM void QDirectFBWindowSurface::setGeometry(const QRect &rect) { @@ -205,11 +201,10 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) const QRect oldRect = geometry(); DFBResult result = DFB_OK; // If we're in a resize, the surface shouldn't be locked - Q_ASSERT((lockedImage == 0) || (rect.size() == geometry().size())); #ifdef QT_DIRECTFB_WM if (!dfbWindow) createWindow(); - ::setGeometry(dfbWindow, oldRect, rect); + setWindowGeometry(dfbWindow, oldRect, rect); #else if (mode == Primary) { if (dfbSurface && dfbSurface != primarySurface) @@ -271,12 +266,12 @@ bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) return false; dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); if (region.numRects() == 1) { - ::scrollSurface(dfbSurface, region.boundingRect(), dx, dy); + scrollSurface(dfbSurface, region.boundingRect(), dx, dy); } else { const QVector<QRect> rects = region.rects(); const int n = rects.size(); for (int i=0; i<n; ++i) { - ::scrollSurface(dfbSurface, rects.at(i), dx, dy); + scrollSurface(dfbSurface, rects.at(i), dx, dy); } } return true; @@ -420,7 +415,9 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &) void QDirectFBWindowSurface::endPaint(const QRegion &) { - unlockDirectFB(); +#ifdef QT_NO_DIRECTFB_SUBSURFACE + unlockSurface(); +#endif } IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index de985d8..0f6a349 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp @@ -234,7 +234,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, #define LM(l, m) (((m)<<8)|l) digress = false; - int initial = length; + const int initial = length; while (!digress && length) { length--; unsigned char ch=*buffer++; @@ -333,7 +333,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, sheight = newtop + newheight; QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32; - if (image->isNull() || (image->size() != QSize(swidth, sheight)) || image->format() != format) { + if (image->isNull()) { (*image) = QImage(swidth, sheight, format); memset(image->bits(), 0, image->numBytes()); diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 742d596..2692c96 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -323,12 +323,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call } } - char* buf = new char[colSize]; + QVarLengthArray<char> buf(colSize); while (true) { r = SQLGetData(hStmt, column+1, unicode ? SQL_C_WCHAR : SQL_C_CHAR, - (SQLPOINTER)buf, + (SQLPOINTER)buf.data(), colSize, &lengthIndicator); if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { @@ -343,11 +343,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni // colSize-1: remove 0 termination when there is more data to fetch int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator; if (unicode) { - fieldVal += QString((QChar*) buf, rSize / 2); + fieldVal += QString((const QChar*) buf.constData(), rSize / 2); } else { - fieldVal += QString::fromAscii(buf, rSize); + fieldVal += QString::fromAscii(buf.constData(), rSize); } - if (lengthIndicator - fieldVal.size() <= 0) { + memset(buf.data(), 0, colSize); + if (lengthIndicator < colSize) { // workaround for Drivermanagers that don't return SQL_NO_DATA break; } @@ -359,7 +360,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni break; } } - delete[] buf; return fieldVal; } diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 371b845..9683efd 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -685,6 +685,28 @@ static QString idFromUrl(const QString &url) return id; } +static inline QStringRef trimRef(const QStringRef &str) +{ + if (str.isEmpty()) + return QStringRef(); + const QChar *s = str.string()->constData() + str.position(); + int end = str.length() - 1; + if (!s[0].isSpace() && !s[end].isSpace()) + return str; + + int start = 0; + while (start<=end && s[start].isSpace()) // skip white space from start + start++; + if (start <= end) { // only white space + while (s[end].isSpace()) // skip white space from end + end--; + } + int l = end - start + 1; + if (l <= 0) + return QStringRef(); + return QStringRef(str.string(), str.position() + start, l); +} + /** * returns true when successfuly set the color. false signifies * that the color should be inherited @@ -903,12 +925,16 @@ static void parseBrush(QSvgNode *node, -static QMatrix parseTransformationMatrix(const QString &value) +static QMatrix parseTransformationMatrix(const QStringRef &value) { + if (value.isEmpty()) + return QMatrix(); + QMatrix matrix; const QChar *str = value.constData(); + const QChar *end = str + value.length(); - while (*str != QLatin1Char(0)) { + while (str < end) { if (str->isSpace() || *str == QLatin1Char(',')) { ++str; continue; @@ -973,7 +999,7 @@ static QMatrix parseTransformationMatrix(const QString &value) } - while (str->isSpace()) + while (str < end && str->isSpace()) ++str; if (*str != QLatin1Char('(')) goto error; @@ -1212,10 +1238,7 @@ static void parseTransform(QSvgNode *node, { if (attributes.transform.isEmpty()) return; - QString value = attributes.transform.toString().trimmed(); - if (value.isEmpty()) - return; - QMatrix matrix = parseTransformationMatrix(value); + QMatrix matrix = parseTransformationMatrix(trimRef(attributes.transform)); if (!matrix.isIdentity()) { node->appendStyleProperty(new QSvgTransformStyle(QTransform(matrix)), someId(attributes)); @@ -1391,24 +1414,29 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) QChar pathElem = *str; ++str; QChar endc = *end; - *const_cast<QChar *>(end) = 0; // parseNumbersList requires 0-termination that QStringRef cannot guarantee - QVector<qreal> arg = parseNumbersList(str); + *const_cast<QChar *>(end) = 0; // parseNumbersArray requires 0-termination that QStringRef cannot guarantee + QVarLengthArray<qreal, 8> arg; + parseNumbersArray(str, arg); *const_cast<QChar *>(end) = endc; if (pathElem == QLatin1Char('z') || pathElem == QLatin1Char('Z')) arg.append(0);//dummy - while (!arg.isEmpty()) { + const qreal *num = arg.constData(); + int count = arg.count(); + while (count > 0) { qreal offsetX = x; // correction offsets qreal offsetY = y; // for relative commands switch (pathElem.unicode()) { case 'm': { - if (arg.count() < 2) { - arg.pop_front(); + if (count < 2) { + num++; + count--; break; } - x = x0 = arg[0] + offsetX; - y = y0 = arg[1] + offsetY; + x = x0 = num[0] + offsetX; + y = y0 = num[1] + offsetY; + num += 2; + count -= 2; path.moveTo(x0, y0); - arg.pop_front(); arg.pop_front(); // As per 1.2 spec 8.3.2 The "moveto" commands // If a 'moveto' is followed by multiple pairs of coordinates without explicit commands, @@ -1417,15 +1445,16 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) } break; case 'M': { - if (arg.count() < 2) { - arg.pop_front(); + if (count < 2) { + num++; + count--; break; } - x = x0 = arg[0]; - y = y0 = arg[1]; - + x = x0 = num[0]; + y = y0 = num[1]; + num += 2; + count -= 2; path.moveTo(x0, y0); - arg.pop_front(); arg.pop_front(); // As per 1.2 spec 8.3.2 The "moveto" commands // If a 'moveto' is followed by multiple pairs of coordinates without explicit commands, @@ -1437,96 +1466,104 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) case 'Z': { x = x0; y = y0; + count--; // skip dummy + num++; path.closeSubpath(); - arg.pop_front();//pop dummy } break; case 'l': { - if (arg.count() < 2) { - arg.pop_front(); + if (count < 2) { + num++; + count--; break; } - x = arg.front() + offsetX; - arg.pop_front(); - y = arg.front() + offsetY; - arg.pop_front(); + x = x0 = num[0] + offsetX; + y = y0 = num[1] + offsetY; + num += 2; + count -= 2; path.lineTo(x, y); } break; case 'L': { - if (arg.count() < 2) { - arg.pop_front(); + if (count < 2) { + num++; + count--; break; } - x = arg.front(); arg.pop_front(); - y = arg.front(); arg.pop_front(); + x = x0 = num[0]; + y = y0 = num[1]; + num += 2; + count -= 2; path.lineTo(x, y); } break; case 'h': { - x = arg.front() + offsetX; arg.pop_front(); + x = num[0] + offsetX; + num++; + count--; path.lineTo(x, y); } break; case 'H': { - x = arg[0]; + x = num[0]; + num++; + count--; path.lineTo(x, y); - arg.pop_front(); } break; case 'v': { - y = arg[0] + offsetY; + y = num[0] + offsetY; + num++; + count--; path.lineTo(x, y); - arg.pop_front(); } break; case 'V': { - y = arg[0]; + y = num[0]; + num++; + count--; path.lineTo(x, y); - arg.pop_front(); } break; case 'c': { - if (arg.count() < 6) { - while (arg.count()) - arg.pop_front(); + if (count < 6) { + num += count; + count = 0; break; } - QPointF c1(arg[0]+offsetX, arg[1]+offsetY); - QPointF c2(arg[2]+offsetX, arg[3]+offsetY); - QPointF e(arg[4]+offsetX, arg[5]+offsetY); + QPointF c1(num[0] + offsetX, num[1] + offsetY); + QPointF c2(num[2] + offsetX, num[3] + offsetY); + QPointF e(num[4] + offsetX, num[5] + offsetY); + num += 6; + count -= 6; path.cubicTo(c1, c2, e); ctrlPt = c2; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); break; } case 'C': { - if (arg.count() < 6) { - while (arg.count()) - arg.pop_front(); + if (count < 6) { + num += count; + count = 0; break; } - QPointF c1(arg[0], arg[1]); - QPointF c2(arg[2], arg[3]); - QPointF e(arg[4], arg[5]); + QPointF c1(num[0], num[1]); + QPointF c2(num[2], num[3]); + QPointF e(num[4], num[5]); + num += 6; + count -= 6; path.cubicTo(c1, c2, e); ctrlPt = c2; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); break; } case 's': { - if (arg.count() < 4) { - while (arg.count()) - arg.pop_front(); + if (count < 4) { + num += count; + count = 0; break; } QPointF c1; @@ -1535,20 +1572,20 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y()); else c1 = QPointF(x, y); - QPointF c2(arg[0]+offsetX, arg[1]+offsetY); - QPointF e(arg[2]+offsetX, arg[3]+offsetY); + QPointF c2(num[0] + offsetX, num[1] + offsetY); + QPointF e(num[2] + offsetX, num[3] + offsetY); + num += 4; + count -= 4; path.cubicTo(c1, c2, e); ctrlPt = c2; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); break; } case 'S': { - if (arg.count() < 4) { - while (arg.count()) - arg.pop_front(); + if (count < 4) { + num += count; + count = 0; break; } QPointF c1; @@ -1557,55 +1594,57 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y()); else c1 = QPointF(x, y); - QPointF c2(arg[0], arg[1]); - QPointF e(arg[2], arg[3]); + QPointF c2(num[0], num[1]); + QPointF e(num[2], num[3]); + num += 4; + count -= 4; path.cubicTo(c1, c2, e); ctrlPt = c2; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); break; } case 'q': { - if (arg.count() < 4) { - while (arg.count()) - arg.pop_front(); + if (count < 4) { + num += count; + count = 0; break; } - QPointF c(arg[0]+offsetX, arg[1]+offsetY); - QPointF e(arg[2]+offsetX, arg[3]+offsetY); + QPointF c(num[0] + offsetX, num[1] + offsetY); + QPointF e(num[2] + offsetX, num[3] + offsetY); + num += 4; + count -= 4; path.quadTo(c, e); ctrlPt = c; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); break; } case 'Q': { - if (arg.count() < 4) { - while (arg.count()) - arg.pop_front(); + if (count < 4) { + num += count; + count = 0; break; } - QPointF c(arg[0], arg[1]); - QPointF e(arg[2], arg[3]); + QPointF c(num[0], num[1]); + QPointF e(num[2], num[3]); + num += 4; + count -= 4; path.quadTo(c, e); ctrlPt = c; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); break; } case 't': { - if (arg.count() < 2) { - while (arg.count()) - arg.pop_front(); + if (count < 2) { + num += count; + count = 0; break; } - QPointF e(arg[0]+offsetX, arg[1]+offsetY); + QPointF e(num[0] + offsetX, num[1] + offsetY); + num += 2; + count -= 2; QPointF c; if (lastMode == 'q' || lastMode == 'Q' || lastMode == 't' || lastMode == 'T') @@ -1616,16 +1655,17 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) ctrlPt = c; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); break; } case 'T': { - if (arg.count() < 2) { - while (arg.count()) - arg.pop_front(); + if (count < 2) { + num += count; + count = 0; break; } - QPointF e(arg[0], arg[1]); + QPointF e(num[0], num[1]); + num += 2; + count -= 2; QPointF c; if (lastMode == 'q' || lastMode == 'Q' || lastMode == 't' || lastMode == 'T') @@ -1636,22 +1676,22 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) ctrlPt = c; x = e.x(); y = e.y(); - arg.pop_front(); arg.pop_front(); break; } case 'a': { - if (arg.count() < 7) { - while (arg.count()) - arg.pop_front(); + if (count < 7) { + num += count; + count = 0; break; } - qreal rx = arg[0]; - qreal ry = arg[1]; - qreal xAxisRotation = arg[2]; - qreal largeArcFlag = arg[3]; - qreal sweepFlag = arg[4]; - qreal ex = arg[5] + offsetX; - qreal ey = arg[6] + offsetY; + qreal rx = (*num++); + qreal ry = (*num++); + qreal xAxisRotation = (*num++); + qreal largeArcFlag = (*num++); + qreal sweepFlag = (*num++); + qreal ex = (*num++) + offsetX; + qreal ey = (*num++) + offsetY; + count -= 7; qreal curx = x; qreal cury = y; pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag), @@ -1659,36 +1699,29 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) x = ex; y = ey; - - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); } break; case 'A': { - if (arg.count() < 7) { - while (arg.count()) - arg.pop_front(); + if (count < 7) { + num += count; + count = 0; break; } - qreal rx = arg[0]; - qreal ry = arg[1]; - qreal xAxisRotation = arg[2]; - qreal largeArcFlag = arg[3]; - qreal sweepFlag = arg[4]; - qreal ex = arg[5]; - qreal ey = arg[6]; + qreal rx = (*num++); + qreal ry = (*num++); + qreal xAxisRotation = (*num++); + qreal largeArcFlag = (*num++); + qreal sweepFlag = (*num++); + qreal ex = (*num++); + qreal ey = (*num++); + count -= 7; qreal curx = x; qreal cury = y; pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag), int(sweepFlag), ex, ey, curx, cury); + x = ex; y = ey; - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); arg.pop_front(); - arg.pop_front(); } break; default: @@ -2583,7 +2616,7 @@ static void parseBaseGradient(QSvgNode *node, QSvgHandler *handler) { QString link = attributes.value(QLatin1String("xlink:href")).toString(); - QString trans = attributes.value(QLatin1String("gradientTransform")).toString(); + QStringRef trans = attributes.value(QLatin1String("gradientTransform")); QString spread = attributes.value(QLatin1String("spreadMethod")).toString(); QString units = attributes.value(QLatin1String("gradientUnits")).toString(); diff --git a/tests/auto/declarative/qfxtextinput/data/navigation.qml b/tests/auto/declarative/qfxtextinput/data/navigation.qml new file mode 100644 index 0000000..c1a6162 --- /dev/null +++ b/tests/auto/declarative/qfxtextinput/data/navigation.qml @@ -0,0 +1,23 @@ +import Qt 4.6 + +Rectangle { + property var myInput: Input + + width: 800; height: 600; color: "blue" + + Item { + id: FirstItem + KeyNavigation.right: Input + } + + TextInput { id: Input; focus: true; + KeyNavigation.left: FirstItem + KeyNavigation.right: LastItem + KeyNavigation.up: FirstItem + KeyNavigation.down: LastItem + } + Item { + id: LastItem + KeyNavigation.left: Input + } +} diff --git a/tests/auto/declarative/qfxtextinput/qfxtextinput.pro b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro new file mode 100644 index 0000000..396e66d --- /dev/null +++ b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +SOURCES += tst_qfxtextinput.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp new file mode 100644 index 0000000..852a868 --- /dev/null +++ b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp @@ -0,0 +1,78 @@ +#include <qtest.h> +#include <QtDeclarative/qmlengine.h> +#include <QFile> +#include <QtDeclarative/qfxview.h> +#include <qfxtextinput.h> +#include <QDebug> + +class tst_qfxtextinput : public QObject + +{ + Q_OBJECT +public: + tst_qfxtextinput(); + +private slots: + void navigation(); + +private: + void simulateKey(QFxView *, int key); + QFxView *createView(const QString &filename); + + QmlEngine engine; +}; + +tst_qfxtextinput::tst_qfxtextinput() +{ +} + +/* +TextInput element should only handle left/right keys until the cursor reaches +the extent of the text, then they should ignore the keys. +*/ +void tst_qfxtextinput::navigation() +{ + QFxView *canvas = createView(SRCDIR "/data/navigation.qml"); + canvas->execute(); + canvas->show(); + + QVERIFY(canvas->root() != 0); + + QFxItem *input = qobject_cast<QFxItem *>(qvariant_cast<QObject *>(canvas->root()->property("myInput"))); + + QVERIFY(input != 0); + QVERIFY(input->hasFocus() == true); + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasFocus() == false); + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasFocus() == true); + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasFocus() == false); + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasFocus() == true); +} + +void tst_qfxtextinput::simulateKey(QFxView *view, int key) +{ + QKeyEvent press(QKeyEvent::KeyPress, key, 0); + QKeyEvent release(QKeyEvent::KeyRelease, key, 0); + + QApplication::sendEvent(view, &press); + QApplication::sendEvent(view, &release); +} + +QFxView *tst_qfxtextinput::createView(const QString &filename) +{ + QFxView *canvas = new QFxView(0); + + QFile file(filename); + file.open(QFile::ReadOnly); + QString xml = file.readAll(); + canvas->setQml(xml, filename); + + return canvas; +} + +QTEST_MAIN(tst_qfxtextinput) + +#include "tst_qfxtextinput.moc" diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp index 36471a4..e953717 100644 --- a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp +++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp @@ -429,23 +429,25 @@ void tst_qmlparser::autoComponentCreation() void tst_qmlparser::propertyValueSource() { - QVERIFY(false); - -/* Does not compile... - QmlComponent component(&engine, TEST_FILE("propertyValueSource.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QList<QmlPropertyValueSource *> valueSources = - object->findChildren<QmlPropertyValueSource *>(); + + QList<QObject *> valueSources; + QObjectList allChildren = object->findChildren<QObject*>(); + foreach (QObject *child, allChildren) { + QmlType *type = QmlMetaType::qmlType(child->metaObject()); + if (type && type->propertyValueSourceCast() != -1) + valueSources.append(child); + } + QCOMPARE(valueSources.count(), 1); MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); QVERIFY(valueSource != 0); QCOMPARE(valueSource->prop.object(), object); QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); -*/ } void tst_qmlparser::attachedProperties() diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp index 6425dcd..dd0615d 100644 --- a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp +++ b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp @@ -41,13 +41,10 @@ #include "dynamictreemodel.h" -#include <QHash> -#include <QList> -#include <QTimer> +#include <QtCore/QHash> +#include <QtCore/QList> +#include <QtCore/QTimer> -#include <QDebug> - -#include <kdebug.h> DynamicTreeModel::DynamicTreeModel(QObject *parent) : QAbstractItemModel(parent), diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.h b/tests/auto/qabstractitemmodel/dynamictreemodel.h index d84bf68..a769c38 100644 --- a/tests/auto/qabstractitemmodel/dynamictreemodel.h +++ b/tests/auto/qabstractitemmodel/dynamictreemodel.h @@ -42,14 +42,11 @@ #ifndef DYNAMICTREEMODEL_H #define DYNAMICTREEMODEL_H -#include <QAbstractItemModel> +#include <QtCore/QAbstractItemModel> -#include <QHash> -#include <QList> +#include <QtCore/QHash> +#include <QtCore/QList> -#include <QDebug> - -#include <kdebug.h> template<typename T> class QList; diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro index 84ed5a2..a31868b 100644 --- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro +++ b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro @@ -2,5 +2,5 @@ load(qttest_p4) SOURCES += tst_qabstractitemmodel.cpp dynamictreemodel.cpp HEADERS += dynamictreemodel.h -QT = core + diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index da65e7d..58832c7 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -43,7 +43,7 @@ #include <QtTest/QtTest> #include <QtCore/QtCore> -#include <QSortFilterProxyModel> +#include <QtGui/QSortFilterProxyModel> //TESTED_CLASS=QAbstractListModel QAbstractTableModel //TESTED_FILES= diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index fa36845..19fa502 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -69,6 +69,8 @@ private slots: void cacheControl_data(); void cacheControl(); + void deleteCache(); + private: void check(); }; @@ -84,8 +86,8 @@ public: #ifdef Q_OS_SYMBIAN QString location = QLatin1String("./cache/"); #else - QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation) - + QLatin1String("/cache/"); + QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation) + + QLatin1String("/qnetworkdiskcache/"); #endif setCacheDirectory(location); clear(); @@ -275,6 +277,20 @@ void tst_QAbstractNetworkCache::check() QCOMPARE(diskCache->gotData, fetchFromCache); } +void tst_QAbstractNetworkCache::deleteCache() +{ + QNetworkAccessManager manager; + NetworkDiskCache *diskCache = new NetworkDiskCache(&manager); + manager.setCache(diskCache); + + QString url = "httpcachetest_cachecontrol.cgi?max-age=1000"; + QNetworkRequest request(QUrl(TESTFILE + url)); + QNetworkReply *reply = manager.get(request); + QSignalSpy downloaded1(reply, SIGNAL(finished())); + manager.setCache(0); + QTRY_COMPARE(downloaded1.count(), 1); +} + QTEST_MAIN(tst_QAbstractNetworkCache) #include "tst_qabstractnetworkcache.moc" diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 073afc8..f979174 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -46,6 +46,7 @@ #include <qdebug.h> #include <qgl.h> #include <qglpixelbuffer.h> +#include <qglframebufferobject.h> #include <qglcolormap.h> #include <qpaintengine.h> @@ -71,6 +72,8 @@ private slots: void partialGLWidgetUpdates_data(); void partialGLWidgetUpdates(); void glWidgetRendering(); + void glFBORendering(); + void glFBOUseInGLWidget(); void glPBufferRendering(); void glWidgetReparent(); void colormap(); @@ -706,6 +709,121 @@ void tst_QGL::glWidgetRendering() QCOMPARE(fb, reference); } +// NOTE: This tests that CombinedDepthStencil attachment works by assuming the +// GL2 engine is being used and is implemented the same way as it was when +// this autotest was written. If this is not the case, there may be some +// false-positives: I.e. The test passes when either the depth or stencil +// buffer is actually missing. But that's probably ok anyway. +void tst_QGL::glFBORendering() +{ + if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) + QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle); + + QGLWidget glw; + glw.makeCurrent(); + + // No multisample with combined depth/stencil attachment: + QGLFramebufferObjectFormat fboFormat(0, QGLFramebufferObject::CombinedDepthStencil); + + // Don't complicate things by using NPOT: + QGLFramebufferObject *fbo = new QGLFramebufferObject(256, 128, fboFormat); + + QPainter fboPainter; + bool painterBegun = fboPainter.begin(fbo); + QVERIFY(painterBegun); + + QPainterPath intersectingPath; + intersectingPath.moveTo(0, 0); + intersectingPath.lineTo(100, 0); + intersectingPath.lineTo(0, 100); + intersectingPath.lineTo(100, 100); + intersectingPath.closeSubpath(); + + QPainterPath trianglePath; + trianglePath.moveTo(50, 0); + trianglePath.lineTo(100, 100); + trianglePath.lineTo(0, 100); + trianglePath.closeSubpath(); + + fboPainter.fillRect(0, 0, fbo->width(), fbo->height(), Qt::red); // Background + fboPainter.translate(14, 14); + fboPainter.fillPath(intersectingPath, Qt::blue); // Test stencil buffer works + fboPainter.translate(128, 0); + fboPainter.setClipPath(trianglePath); // Test depth buffer works + fboPainter.setTransform(QTransform()); // reset xform + fboPainter.fillRect(0, 0, fbo->width(), fbo->height(), Qt::green); + fboPainter.end(); + + QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32); + delete fbo; + + // As we're doing more than trivial painting, we can't just compare to + // an image rendered with raster. Instead, we sample at well-defined + // test-points: + QCOMPARE(fb.pixel(39, 64), QColor(Qt::red).rgb()); + QCOMPARE(fb.pixel(89, 64), QColor(Qt::red).rgb()); + QCOMPARE(fb.pixel(64, 39), QColor(Qt::blue).rgb()); + QCOMPARE(fb.pixel(64, 89), QColor(Qt::blue).rgb()); + + QCOMPARE(fb.pixel(167, 39), QColor(Qt::red).rgb()); + QCOMPARE(fb.pixel(217, 39), QColor(Qt::red).rgb()); + QCOMPARE(fb.pixel(192, 64), QColor(Qt::green).rgb()); +} + +class FBOUseInGLWidget : public QGLWidget +{ +public: + bool widgetPainterBeginOk; + bool fboPainterBeginOk; + QImage fboImage; +protected: + void paintEvent(QPaintEvent*) + { + QPainter widgetPainter; + widgetPainterBeginOk = widgetPainter.begin(this); + QGLFramebufferObjectFormat fboFormat(0, QGLFramebufferObject::CombinedDepthStencil); + QGLFramebufferObject *fbo = new QGLFramebufferObject(128, 128, fboFormat); + + QPainter fboPainter; + fboPainterBeginOk = fboPainter.begin(fbo); + fboPainter.fillRect(0, 0, 128, 128, Qt::red); + fboPainter.end(); + fboImage = fbo->toImage(); + + widgetPainter.fillRect(rect(), Qt::blue); + + delete fbo; + } + +}; + +void tst_QGL::glFBOUseInGLWidget() +{ + if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) + QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle); + + FBOUseInGLWidget w; + w.resize(128, 128); + w.show(); + +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&w); +#endif + QTest::qWait(200); + + QVERIFY(w.widgetPainterBeginOk); + QVERIFY(w.fboPainterBeginOk); + + QImage widgetFB = w.grabFrameBuffer(false); + QImage widgetReference(widgetFB.size(), widgetFB.format()); + widgetReference.fill(0xff0000ff); + QCOMPARE(widgetFB, widgetReference); + + QImage fboReference(w.fboImage.size(), w.fboImage.format()); + fboReference.fill(0xffff0000); + QCOMPARE(w.fboImage, fboReference); +} + void tst_QGL::glWidgetReparent() { // Try it as a top-level first: diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index a807e62..e6364c8 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -5417,6 +5417,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation() qt_x11_wait_for_window_manager(&view); #endif view.resize(200, 200); + QTest::qWait(250); QContextMenuEvent event(QContextMenuEvent::Mouse, QPoint(10, 10), view.viewport()->mapToGlobal(QPoint(10, 10))); diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 6549be8..419eb71 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -189,7 +189,9 @@ void tst_QHttpNetworkConnection::head() QCOMPARE(reply->statusCode(), statusCode); QCOMPARE(reply->reasonPhrase(), statusString); - QCOMPARE(reply->contentLength(), qint64(contentLength)); + // only check it if it is set + if (reply->contentLength() != -1) + QCOMPARE(reply->contentLength(), qint64(contentLength)); QVERIFY(reply->isFinished()); @@ -249,7 +251,9 @@ void tst_QHttpNetworkConnection::get() QCOMPARE(reply->statusCode(), statusCode); QCOMPARE(reply->reasonPhrase(), statusString); - QCOMPARE(reply->contentLength(), qint64(contentLength)); + // only check it if it is set + if (reply->contentLength() != -1) + QCOMPARE(reply->contentLength(), qint64(contentLength)); stopWatch.start(); QByteArray ba; diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp index b614ab9..bacf7a5 100644 --- a/tests/auto/qicon/tst_qicon.cpp +++ b/tests/auto/qicon/tst_qicon.cpp @@ -609,8 +609,7 @@ void tst_QIcon::task184901_badCache() void tst_QIcon::fromTheme() { - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); - QString searchPath = prefix + QLatin1String("/icons"); + QString searchPath = QLatin1String(":/icons"); QIcon::setThemeSearchPaths(QStringList() << searchPath); QVERIFY(QIcon::themeSearchPaths().size() == 1); QCOMPARE(searchPath, QIcon::themeSearchPaths()[0]); diff --git a/tests/auto/qicon/tst_qicon.qrc b/tests/auto/qicon/tst_qicon.qrc index 1e1a030..7925a33 100644 --- a/tests/auto/qicon/tst_qicon.qrc +++ b/tests/auto/qicon/tst_qicon.qrc @@ -2,5 +2,19 @@ <qresource prefix="/"> <file>image.png</file> <file>rect.png</file> +<file>./icons/testtheme/16x16/actions/appointment-new.png</file> +<file>./icons/testtheme/22x22/actions/appointment-new.png</file> +<file>./icons/testtheme/32x32/actions/appointment-new.png</file> +<file>./icons/testtheme/index.theme</file> +<file>./icons/testtheme/scalable/actions/svg-only.svg</file> +<file>./icons/themeparent/16x16/actions/address-book-new.png</file> +<file>./icons/themeparent/16x16/actions/appointment-new.png</file> +<file>./icons/themeparent/22x22/actions/address-book-new.png</file> +<file>./icons/themeparent/22x22/actions/appointment-new.png</file> +<file>./icons/themeparent/32x32/actions/address-book-new.png</file> +<file>./icons/themeparent/32x32/actions/appointment-new.png</file> +<file>./icons/themeparent/index.theme</file> +<file>./icons/themeparent/scalable/actions/address-book-new.svg</file> +<file>./icons/themeparent/scalable/actions/appointment-new.svg</file> </qresource> </RCC> diff --git a/tests/auto/qimagereader/images/qt.gif b/tests/auto/qimagereader/images/qt.gif Binary files differnew file mode 100644 index 0000000..e0a5a80 --- /dev/null +++ b/tests/auto/qimagereader/images/qt.gif diff --git a/tests/auto/qimagereader/images/qt1.gif b/tests/auto/qimagereader/images/qt1.gif Binary files differnew file mode 100644 index 0000000..0ce910c --- /dev/null +++ b/tests/auto/qimagereader/images/qt1.gif diff --git a/tests/auto/qimagereader/images/qt2.gif b/tests/auto/qimagereader/images/qt2.gif Binary files differnew file mode 100644 index 0000000..993a315 --- /dev/null +++ b/tests/auto/qimagereader/images/qt2.gif diff --git a/tests/auto/qimagereader/images/qt3.gif b/tests/auto/qimagereader/images/qt3.gif Binary files differnew file mode 100644 index 0000000..7391678 --- /dev/null +++ b/tests/auto/qimagereader/images/qt3.gif diff --git a/tests/auto/qimagereader/images/qt4.gif b/tests/auto/qimagereader/images/qt4.gif Binary files differnew file mode 100644 index 0000000..41109a9 --- /dev/null +++ b/tests/auto/qimagereader/images/qt4.gif diff --git a/tests/auto/qimagereader/images/qt5.gif b/tests/auto/qimagereader/images/qt5.gif Binary files differnew file mode 100644 index 0000000..5a3fb54 --- /dev/null +++ b/tests/auto/qimagereader/images/qt5.gif diff --git a/tests/auto/qimagereader/images/qt6.gif b/tests/auto/qimagereader/images/qt6.gif Binary files differnew file mode 100644 index 0000000..f22e7c9 --- /dev/null +++ b/tests/auto/qimagereader/images/qt6.gif diff --git a/tests/auto/qimagereader/images/qt7.gif b/tests/auto/qimagereader/images/qt7.gif Binary files differnew file mode 100644 index 0000000..a315671 --- /dev/null +++ b/tests/auto/qimagereader/images/qt7.gif diff --git a/tests/auto/qimagereader/images/qt8.gif b/tests/auto/qimagereader/images/qt8.gif Binary files differnew file mode 100644 index 0000000..2a7d09e --- /dev/null +++ b/tests/auto/qimagereader/images/qt8.gif diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc index c6b963b..11b9406 100644 --- a/tests/auto/qimagereader/qimagereader.qrc +++ b/tests/auto/qimagereader/qimagereader.qrc @@ -1,5 +1,5 @@ -<!DOCTYPE RCC><RCC version="1.0"> - <qresource> +<RCC> + <qresource prefix="/" > <file>images/16bpp.bmp</file> <file>images/4bpp-rle.bmp</file> <file>images/YCbCr_cmyk.jpg</file> @@ -48,5 +48,14 @@ <file>images/tst7.png</file> <file>images/transparent.xpm</file> <file>images/trolltech.gif</file> + <file>images/qt.gif</file> + <file>images/qt1.gif</file> + <file>images/qt2.gif</file> + <file>images/qt3.gif</file> + <file>images/qt4.gif</file> + <file>images/qt5.gif</file> + <file>images/qt6.gif</file> + <file>images/qt7.gif</file> + <file>images/qt8.gif</file> </qresource> </RCC> diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 27c6925..a325a33 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -140,6 +140,7 @@ private slots: #if defined QTEST_HAVE_GIF void gifHandlerBugs(); + void animatedGif(); #endif void readCorruptImage_data(); @@ -710,6 +711,18 @@ void tst_QImageReader::gifHandlerBugs() QCOMPARE(im1.convertToFormat(QImage::Format_ARGB32), im2.convertToFormat(QImage::Format_ARGB32)); } } + +void tst_QImageReader::animatedGif() +{ + QImageReader io(prefix + "qt.gif"); + QImage image= io.read(); + int i=0; + while(!image.isNull()){ + QString frameName = QString(prefix + "qt%1.gif").arg(++i); + QCOMPARE(image, QImage(frameName)); + image=io.read(); + } +} #endif class Server : public QObject diff --git a/tests/auto/qmargins/tst_qmargins.cpp b/tests/auto/qmargins/tst_qmargins.cpp index 070aa19..6ee2495 100644 --- a/tests/auto/qmargins/tst_qmargins.cpp +++ b/tests/auto/qmargins/tst_qmargins.cpp @@ -9,8 +9,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -21,25 +21,24 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this ** package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include <QtTest/QtTest> #include <qmargins.h> diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 52e967f..a223d1c 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -1366,8 +1366,10 @@ void tst_QNetworkReply::getFromHttp() QCOMPARE(reply->url(), request.url()); QCOMPARE(reply->error(), QNetworkReply::NoError); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); - - QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size()); + QCOMPARE(reply->size(), reference.size()); + // only compare when the header is set. + if (reply->header(QNetworkRequest::ContentLengthHeader).isValid()) + QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size()); QCOMPARE(reply->readAll(), reference.readAll()); } diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp index 26c1f9b..9c4cbc4 100644 --- a/tests/auto/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp @@ -1145,8 +1145,9 @@ void tst_QPainterPath::testToFillPolygons() path.lineTo(QPointF(70, 100)); path.lineTo(QPointF(40, 100)); - QPolygonF polygon = path.toFillPolygons(QMatrix()).first(); - QCOMPARE(polygon.count(QPointF(70, 50)), 2); + const QList<QPolygonF> polygons = path.toFillPolygons(); + QCOMPARE(polygons.size(), 2); + QCOMPARE(polygons.first().count(QPointF(70, 50)), 0); } void tst_QPainterPath::connectPathDuplicatePoint() diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 02ab1cc..7752a4f 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -95,6 +95,9 @@ private slots: void fromImage_data(); void fromImage(); + void fromUninitializedImage_data(); + void fromUninitializedImage(); + void convertFromImage_data(); void convertFromImage(); @@ -318,6 +321,32 @@ void tst_QPixmap::fromImage() QCOMPARE(result, image); } + +void tst_QPixmap::fromUninitializedImage_data() +{ + QTest::addColumn<QImage::Format>("format"); + + QTest::newRow("Format_Mono") << QImage::Format_Mono; + QTest::newRow("Format_MonoLSB") << QImage::Format_MonoLSB; + QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8; + QTest::newRow("Format_RGB32") << QImage::Format_RGB32; + QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32; + QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied; + QTest::newRow("Format_RGB16") << QImage::Format_RGB16; +} + +void tst_QPixmap::fromUninitializedImage() +{ + QFETCH(QImage::Format, format); + + QImage image(100, 100, format); + QPixmap pix = QPixmap::fromImage(image); + + // it simply shouldn't crash... + QVERIFY(true); + +} + void tst_QPixmap::convertFromImage_data() { QTest::addColumn<QImage>("img1"); diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 68f0620..8fe6839 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -155,7 +155,7 @@ struct ScriptEngineEvent lineNumber(lineNumber) { } - ScriptEngineEvent(Type type, qint64 scriptId = -1) + ScriptEngineEvent(Type type, qint64 scriptId = -777) : type(type), scriptId(scriptId) { } @@ -1593,8 +1593,6 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao'); } catch (e) { }"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); QCOMPARE(spy->at(0).type, ScriptEngineEvent::ExceptionThrow); @@ -1606,6 +1604,8 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch() QCOMPARE(spy->at(1).type, ScriptEngineEvent::ExceptionCatch); QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue); QVERIFY(spy->at(1).value.strictlyEquals(spy->at(0).value)); } } @@ -1728,8 +1728,6 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao') } catch (e) { void(e); }"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 12); // load QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); @@ -1751,6 +1749,8 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch() QVERIFY(spy->at(7).hasExceptionHandler); // catch QCOMPARE(spy->at(8).type, ScriptEngineEvent::ExceptionCatch); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue); QVERIFY(spy->at(8).value.isError()); // void(e) QCOMPARE(spy->at(9).type, ScriptEngineEvent::PositionChange); @@ -1914,8 +1914,6 @@ void tst_QScriptEngineAgent::eventOrder_throwCatchFinally() { spy->clear(); eng.evaluate("try { throw 1; } catch(e) { i = e; } finally { i = 2; }"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 9); // load @@ -2100,6 +2098,7 @@ void tst_QScriptEngineAgent::syntaxError() i = 2; QCOMPARE(spy->at(i).type, ScriptEngineEvent::ContextPush); + QEXPECT_FAIL("","The test is broken, contextPush event do not provide scriptId", Continue); QVERIFY(spy->at(i).scriptId == -1); i = 3; QCOMPARE(spy->at(i).type, ScriptEngineEvent::FunctionEntry); @@ -2109,6 +2108,7 @@ void tst_QScriptEngineAgent::syntaxError() QVERIFY(spy->at(i).scriptId == -1); i = 5; QCOMPARE(spy->at(i).type, ScriptEngineEvent::ContextPop); + QEXPECT_FAIL("","The test is broken, contextPop event do not provide scriptId", Continue); QVERIFY(spy->at(i).scriptId == -1); i = 6; QCOMPARE(spy->at(i).type, ScriptEngineEvent::ExceptionThrow); diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index a6b887a..e9a0670 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -180,6 +180,8 @@ private slots: void odbc_uintfield(); void odbc_bindBoolean_data() { generic_data("QODBC"); } void odbc_bindBoolean(); + void odbc_testqGetString_data() { generic_data("QODBC"); } + void odbc_testqGetString(); void oci_serverDetach_data() { generic_data("QOCI"); } void oci_serverDetach(); // For task 154518 @@ -347,6 +349,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) << qTableName("numericfields") << qTableName("qtest_ibaseblobs") << qTableName("qtestBindBool") + << qTableName("testqGetString") << qTableName("qtest_sqlguid") << qTableName("uint_table") << qTableName("uint_test") @@ -2024,6 +2027,44 @@ void tst_QSqlDatabase::odbc_bindBoolean() QCOMPARE(q.value(1).toBool(), false); } +void tst_QSqlDatabase::odbc_testqGetString() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(65538))")); + + QString largeString; + largeString.fill('A', 65536); + + // Bind and insert + QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("testqGetString") + " VALUES(?, ?)")); + q.bindValue(0, 1); + q.bindValue(1, largeString); + QVERIFY_SQL(q, exec()); + q.bindValue(0, 2); + q.bindValue(1, largeString+QLatin1Char('B')); + QVERIFY_SQL(q, exec()); + q.bindValue(0, 3); + q.bindValue(1, largeString+QLatin1Char('B')+QLatin1Char('C')); + QVERIFY_SQL(q, exec()); + + // Retrive + QVERIFY_SQL(q, exec("SELECT id, vcvalue FROM " + qTableName("testqGetString") + " ORDER BY id")); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 1); + QCOMPARE(q.value(1).toString().length(), 65536); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 2); + QCOMPARE(q.value(1).toString().length(), 65537); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 3); + QCOMPARE(q.value(1).toString().length(), 65538); +} + + void tst_QSqlDatabase::mysql_multiselect() { QFETCH(QString, dbName); diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index add48c4..4dfb6b9 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -267,6 +267,8 @@ void tst_QSslCertificate::compareCertificates( QCOMPARE(cert1.alternateSubjectNames(), cert2.alternateSubjectNames()); QCOMPARE(cert1.effectiveDate(), cert2.effectiveDate()); QCOMPARE(cert1.expiryDate(), cert2.expiryDate()); + QCOMPARE(cert1.version(), cert2.version()); + QCOMPARE(cert1.serialNumber(), cert2.serialNumber()); // ### add more functions here ... } @@ -677,7 +679,9 @@ void tst_QSslCertificate::certInfo() QCOMPARE(cert.subjectInfo("C"), QString("NO")); QCOMPARE(cert.subjectInfo("ST"), QString()); - QCOMPARE(cert.version(), QByteArray()); + QCOMPARE(cert.version(), QByteArray::number(1)); + QCOMPARE(cert.serialNumber(), QByteArray::number(17)); + QCOMPARE(cert.toPem().constData(), (const char*)pem); QCOMPARE(cert.toDer(), QByteArray::fromHex(der)); diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index b797c39..5a84cc1 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -93,6 +93,8 @@ private slots: void renameFdLeak(); void reOpenThroughQFile(); void keepOpenMode(); + void resetTemplateAfterError(); + void setTemplateAfterOpen(); public: }; @@ -476,5 +478,85 @@ void tst_QTemporaryFile::keepOpenMode() } } +void tst_QTemporaryFile::resetTemplateAfterError() +{ + // calling setFileTemplate on a failed open + + QString tempPath = QDir::tempPath(); + + QString const fileTemplate("destination/qt_temp_file_test.XXXXXX"); + QString const fileTemplate2(tempPath + "/qt_temp_file_test.XXXXXX"); + + QVERIFY2( QDir(tempPath).exists() || QDir().mkpath(tempPath), "Test precondition" ); + QVERIFY2( !QFile::exists("destination"), "Test precondition" ); + QVERIFY2( !QFile::exists(fileTemplate2) || QFile::remove(fileTemplate2), "Test precondition" ); + + QFile file(fileTemplate2); + QByteArray fileContent("This file is intentionally NOT left empty."); + + QVERIFY( file.open(QIODevice::ReadWrite | QIODevice::Truncate) ); + QCOMPARE( file.write(fileContent), (qint64)fileContent.size() ); + QVERIFY( file.flush() ); + + QString fileName; + { + QTemporaryFile temp; + + QVERIFY( temp.fileName().isEmpty() ); + QVERIFY( !temp.fileTemplate().isEmpty() ); + + temp.setFileTemplate( fileTemplate ); + + QVERIFY( temp.fileName().isEmpty() ); + QCOMPARE( temp.fileTemplate(), fileTemplate ); + + QVERIFY( !temp.open() ); + + QVERIFY( temp.fileName().isEmpty() ); + QCOMPARE( temp.fileTemplate(), fileTemplate ); + + temp.setFileTemplate( fileTemplate2 ); + QVERIFY( temp.open() ); + + fileName = temp.fileName(); + QVERIFY( QFile::exists(fileName) ); + QVERIFY( !fileName.isEmpty() ); + QVERIFY2( fileName != fileTemplate2, + ("Generated name shouldn't be same as template: " + fileTemplate2).toLocal8Bit().constData() ); + } + + QVERIFY( !QFile::exists(fileName) ); + + file.seek(0); + QCOMPARE( QString(file.readAll()), QString(fileContent) ); + QVERIFY( file.remove() ); +} + +void tst_QTemporaryFile::setTemplateAfterOpen() +{ + QTemporaryFile temp; + + QVERIFY( temp.fileName().isEmpty() ); + QVERIFY( !temp.fileTemplate().isEmpty() ); + + QVERIFY( temp.open() ); + + QString const fileName = temp.fileName(); + QString const newTemplate("funny-path/funny-name-XXXXXX.tmp"); + + QVERIFY( !fileName.isEmpty() ); + QVERIFY( QFile::exists(fileName) ); + QVERIFY( !temp.fileTemplate().isEmpty() ); + QVERIFY( temp.fileTemplate() != newTemplate ); + + temp.close(); // QTemporaryFile::setFileTemplate will assert on isOpen() up to 4.5.2 + temp.setFileTemplate(newTemplate); + QCOMPARE( temp.fileTemplate(), newTemplate ); + + QVERIFY( temp.open() ); + QCOMPARE( temp.fileName(), fileName ); + QCOMPARE( temp.fileTemplate(), newTemplate ); +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index ef43c3a..6709807 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -233,6 +233,7 @@ private slots: void task239271_addRowsWithFirstColumnHidden(); void task254234_proxySort(); void task248022_changeSelection(); + void task245654_changeModelAndExpandAll(); }; class QtTestModel: public QAbstractItemModel @@ -3463,6 +3464,35 @@ void tst_QTreeView::task248022_changeSelection() QCOMPARE(view.selectionModel()->selectedIndexes().count(), list.count()); } +void tst_QTreeView::task245654_changeModelAndExpandAll() +{ + QTreeView view; + QStandardItemModel *model = new QStandardItemModel; + QStandardItem *top = new QStandardItem("top"); + QStandardItem *sub = new QStandardItem("sub"); + top->appendRow(sub); + model->appendRow(top); + view.setModel(model); + view.expandAll(); + QApplication::processEvents(); + QVERIFY(view.isExpanded(top->index())); + + //now let's try to delete the model + //then repopulate and expand again + delete model; + model = new QStandardItemModel; + top = new QStandardItem("top"); + sub = new QStandardItem("sub"); + top->appendRow(sub); + model->appendRow(top); + view.setModel(model); + view.expandAll(); + QApplication::processEvents(); + QVERIFY(view.isExpanded(top->index())); + +} + + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" diff --git a/tests/benchmarks/declarative/pointers/pointers.pro b/tests/benchmarks/declarative/pointers/pointers.pro new file mode 100644 index 0000000..fafdcd6 --- /dev/null +++ b/tests/benchmarks/declarative/pointers/pointers.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_pointers + +SOURCES += tst_pointers.cpp + diff --git a/tests/benchmarks/declarative/pointers/tst_pointers.cpp b/tests/benchmarks/declarative/pointers/tst_pointers.cpp new file mode 100644 index 0000000..f397c0c --- /dev/null +++ b/tests/benchmarks/declarative/pointers/tst_pointers.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +****************************************************************************/ + +#include <qtest.h> +#include "private/qguard_p.h" +#include <QWeakPointer> + +class tst_pointers : public QObject +{ + Q_OBJECT + +public: + tst_pointers() {} + +private slots: + void guard(); + void weakPointer(); +}; + +void tst_pointers::guard() +{ + QObject *obj = new QObject; + QBENCHMARK { + QGuard<QObject> guardedObject; + guardedObject = obj; + } +} + +void tst_pointers::weakPointer() +{ + QObject *obj = new QObject; + QBENCHMARK { + QWeakPointer<QObject> guardedObject; + guardedObject = obj; + } +} + +QTEST_MAIN(tst_pointers) +#include "tst_pointers.moc" diff --git a/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro new file mode 100644 index 0000000..0d563b9 --- /dev/null +++ b/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qgraphicsanchorlayout + +SOURCES += tst_qgraphicsanchorlayout.cpp + diff --git a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp new file mode 100644 index 0000000..e419bae --- /dev/null +++ b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QtGui/qgraphicsanchorlayout.h> +#include <QtGui/qgraphicswidget.h> +#include <QtGui/qgraphicsview.h> + +class tst_QGraphicsAnchorLayout : public QObject +{ + Q_OBJECT +public: + tst_QGraphicsAnchorLayout() {} + ~tst_QGraphicsAnchorLayout() {} + +private slots: + void s60_hard_complex_data(); + void s60_hard_complex(); +}; + + +class RectWidget : public QGraphicsWidget +{ +public: + RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){} + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + { + Q_UNUSED(option); + Q_UNUSED(widget); + painter->drawRoundRect(rect()); + painter->drawLine(rect().topLeft(), rect().bottomRight()); + painter->drawLine(rect().bottomLeft(), rect().topRight()); + } +}; + +static QGraphicsWidget *createItem(const QSizeF &minimum = QSizeF(100.0, 100.0), + const QSizeF &preferred = QSize(150.0, 100.0), + const QSizeF &maximum = QSizeF(200.0, 100.0), + const QString &name = QString()) +{ + QGraphicsWidget *w = new RectWidget; + w->setMinimumSize(minimum); + w->setPreferredSize(preferred); + w->setMaximumSize(maximum); + w->setData(0, name); + return w; +} + +static void setAnchor(QGraphicsAnchorLayout *l, + QGraphicsLayoutItem *firstItem, + Qt::AnchorPoint firstEdge, + QGraphicsLayoutItem *secondItem, + Qt::AnchorPoint secondEdge, + qreal spacing) +{ + l->addAnchor(firstItem, firstEdge, secondItem, secondEdge); + l->setAnchorSpacing(firstItem, firstEdge, secondItem, secondEdge, spacing); +} + +void tst_QGraphicsAnchorLayout::s60_hard_complex_data() +{ + QTest::addColumn<int>("whichSizeHint"); + QTest::newRow("minimumSizeHint") + << int(Qt::MinimumSize); + QTest::newRow("preferredSizeHint") + << int(Qt::PreferredSize); + QTest::newRow("maximumSizeHint") + << int(Qt::MaximumSize); + // Add it as a reference to see how much overhead the body of effectiveSizeHint takes. + QTest::newRow("noSizeHint") + << -1; +} + +void tst_QGraphicsAnchorLayout::s60_hard_complex() +{ + QFETCH(int, whichSizeHint); + + // Test for "hard" complex case, taken from wiki + // https://cwiki.nokia.com/S60QTUI/AnchorLayoutComplexCases + QSizeF min(0, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *d = createItem(min, pref, max, "d"); + QGraphicsWidget *e = createItem(min, pref, max, "e"); + QGraphicsWidget *f = createItem(min, pref, max, "f"); + QGraphicsWidget *g = createItem(min, pref, max, "g"); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + //<!-- Trunk --> + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10); + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 10); + setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 10); + setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 10); + setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 10); + + //<!-- Above trunk --> + setAnchor(l, b, Qt::AnchorLeft, e, Qt::AnchorLeft, 10); + setAnchor(l, e, Qt::AnchorRight, d, Qt::AnchorLeft, 10); + + //<!-- Below trunk --> + setAnchor(l, a, Qt::AnchorHorizontalCenter, g, Qt::AnchorLeft, 10); + setAnchor(l, g, Qt::AnchorRight, f, Qt::AnchorHorizontalCenter, 10); + setAnchor(l, c, Qt::AnchorLeft, f, Qt::AnchorLeft, 10); + setAnchor(l, f, Qt::AnchorRight, d, Qt::AnchorRight, 10); + + //<!-- vertical is simpler --> + setAnchor(l, l, Qt::AnchorTop, e, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, a, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, b, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, c, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, d, Qt::AnchorTop, 0); + setAnchor(l, a, Qt::AnchorBottom, f, Qt::AnchorTop, 0); + setAnchor(l, a, Qt::AnchorBottom, b, Qt::AnchorBottom, 0); + setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorBottom, 0); + setAnchor(l, a, Qt::AnchorBottom, d, Qt::AnchorBottom, 0); + setAnchor(l, f, Qt::AnchorBottom, g, Qt::AnchorTop, 0); + setAnchor(l, g, Qt::AnchorBottom, l, Qt::AnchorBottom, 0); + + // It won't query the size hint if it already has a size set. + // If only one of the sizes is unset it will query sizeHint only of for that hint type. + l->setMinimumSize(60,40); + l->setPreferredSize(220,40); + l->setMaximumSize(240,40); + + switch (whichSizeHint) { + case Qt::MinimumSize: + l->setMinimumSize(-1, -1); + break; + case Qt::PreferredSize: + l->setPreferredSize(-1, -1); + break; + case Qt::MaximumSize: + l->setMaximumSize(-1, -1); + break; + default: + break; + } + + QSizeF sizeHint; + // warm up instruction cache + l->invalidate(); + sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); + // ...then measure... + QBENCHMARK { + l->invalidate(); + sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); + } +} + +QTEST_MAIN(tst_QGraphicsAnchorLayout) + +#include "tst_qgraphicsanchorlayout.moc" diff --git a/tests/manual/qhttpnetworkconnection/main.cpp b/tests/manual/qhttpnetworkconnection/main.cpp new file mode 100644 index 0000000..b15a7ed --- /dev/null +++ b/tests/manual/qhttpnetworkconnection/main.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +// This file contains benchmarks for QNetworkReply functions. + +#include <QDebug> +#include <qtest.h> +#include <QtTest/QtTest> +#include <QtNetwork/qnetworkreply.h> +#include <QtNetwork/qnetworkrequest.h> +#include <QtNetwork/qnetworkaccessmanager.h> +#include "../../auto/network-settings.h" + +class tst_qhttpnetworkconnection : public QObject +{ + Q_OBJECT +private slots: + void bigRemoteFile(); + +}; + +void tst_qhttpnetworkconnection::bigRemoteFile() +{ + QNetworkAccessManager manager; + qint64 size; + QTime t; + QNetworkRequest request(QUrl("http://nds1.nokia.com/files/support/global/phones/software/Nokia_Ovi_Suite_webinstaller.exe")); + QNetworkReply* reply = manager.get(request); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + qDebug() << "Starting download"; + t.start(); + QTestEventLoop::instance().enterLoop(50); + QVERIFY(!QTestEventLoop::instance().timeout()); + size = reply->size(); + delete reply; + qDebug() << "Finished!" << endl; + qDebug() << "Time:" << t.elapsed() << "msec"; + qDebug() << "Bytes:" << size; + qDebug() << "Speed:" << (size / 1024) / (t.elapsed() / 1000) << "KB/sec"; +} + +QTEST_MAIN(tst_qhttpnetworkconnection) + +#include "main.moc" diff --git a/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro new file mode 100644 index 0000000..2471389 --- /dev/null +++ b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qhttpnetworkconnection +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui +QT += network + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/manual/qtabletevent/device_information/main.cpp b/tests/manual/qtabletevent/device_information/main.cpp index 0c2eda3..69867bc 100644 --- a/tests/manual/qtabletevent/device_information/main.cpp +++ b/tests/manual/qtabletevent/device_information/main.cpp @@ -3,14 +3,14 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the test suite module of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -21,20 +21,20 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this ** package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.h b/tests/manual/qtabletevent/device_information/tabletwidget.h index b16e9ed..d3ccb32 100644 --- a/tests/manual/qtabletevent/device_information/tabletwidget.h +++ b/tests/manual/qtabletevent/device_information/tabletwidget.h @@ -9,8 +9,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -21,20 +21,20 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this ** package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/manual/qtabletevent/event_compression/main.cpp b/tests/manual/qtabletevent/event_compression/main.cpp index 3b869e3..26611d3 100644 --- a/tests/manual/qtabletevent/event_compression/main.cpp +++ b/tests/manual/qtabletevent/event_compression/main.cpp @@ -3,14 +3,14 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the test suite module of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -21,20 +21,20 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this ** package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index e8b810c..e5bfdc6 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3650,10 +3650,14 @@ bool Configure::showLicense(QString orgLicenseFile) return true; } + bool haveGpl3 = false; QString licenseFile = orgLicenseFile; QString theLicense; if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") { - theLicense = "GNU General Public License (GPL) version 3 \nor the GNU Lesser General Public License (LGPL) version 2.1"; + haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3"); + theLicense = "GNU Lesser General Public License (LGPL) version 2.1"; + if (haveGpl3) + theLicense += "\nor the GNU General Public License (GPL) version 3"; } else { // the first line of the license file tells us which license it is QFile file(licenseFile); @@ -3670,7 +3674,8 @@ bool Configure::showLicense(QString orgLicenseFile) << "the " << theLicense << "." << endl << endl; if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") { - cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl; + if (haveGpl3) + cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl; cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl; } else { cout << "Type '?' to view the " << theLicense << "." << endl; diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index b02edec..c0bc3d47 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -254,7 +254,6 @@ span.string,span.char } .qmltype { - // font-weight: bold; text-align: center; font-size: 160%; } |